diff options
666 files changed, 12144 insertions, 6938 deletions
diff --git a/.gitignore b/.gitignore index fb2190c61af0..de6344e15706 100644 --- a/.gitignore +++ b/.gitignore | |||
@@ -37,6 +37,7 @@ modules.builtin | |||
37 | tags | 37 | tags |
38 | TAGS | 38 | TAGS |
39 | vmlinux | 39 | vmlinux |
40 | vmlinuz | ||
40 | System.map | 41 | System.map |
41 | Module.markers | 42 | Module.markers |
42 | Module.symvers | 43 | Module.symvers |
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl index f508a8a27fea..5e7d84b48505 100644 --- a/Documentation/DocBook/mtdnand.tmpl +++ b/Documentation/DocBook/mtdnand.tmpl | |||
@@ -174,7 +174,7 @@ | |||
174 | </para> | 174 | </para> |
175 | <programlisting> | 175 | <programlisting> |
176 | static struct mtd_info *board_mtd; | 176 | static struct mtd_info *board_mtd; |
177 | static unsigned long baseaddr; | 177 | static void __iomem *baseaddr; |
178 | </programlisting> | 178 | </programlisting> |
179 | <para> | 179 | <para> |
180 | Static example | 180 | Static example |
@@ -182,7 +182,7 @@ static unsigned long baseaddr; | |||
182 | <programlisting> | 182 | <programlisting> |
183 | static struct mtd_info board_mtd; | 183 | static struct mtd_info board_mtd; |
184 | static struct nand_chip board_chip; | 184 | static struct nand_chip board_chip; |
185 | static unsigned long baseaddr; | 185 | static void __iomem *baseaddr; |
186 | </programlisting> | 186 | </programlisting> |
187 | </sect1> | 187 | </sect1> |
188 | <sect1 id="Partition_defines"> | 188 | <sect1 id="Partition_defines"> |
@@ -283,8 +283,8 @@ int __init board_init (void) | |||
283 | } | 283 | } |
284 | 284 | ||
285 | /* map physical address */ | 285 | /* map physical address */ |
286 | baseaddr = (unsigned long)ioremap(CHIP_PHYSICAL_ADDRESS, 1024); | 286 | baseaddr = ioremap(CHIP_PHYSICAL_ADDRESS, 1024); |
287 | if(!baseaddr){ | 287 | if (!baseaddr) { |
288 | printk("Ioremap to access NAND chip failed\n"); | 288 | printk("Ioremap to access NAND chip failed\n"); |
289 | err = -EIO; | 289 | err = -EIO; |
290 | goto out_mtd; | 290 | goto out_mtd; |
@@ -316,7 +316,7 @@ int __init board_init (void) | |||
316 | goto out; | 316 | goto out; |
317 | 317 | ||
318 | out_ior: | 318 | out_ior: |
319 | iounmap((void *)baseaddr); | 319 | iounmap(baseaddr); |
320 | out_mtd: | 320 | out_mtd: |
321 | kfree (board_mtd); | 321 | kfree (board_mtd); |
322 | out: | 322 | out: |
@@ -341,7 +341,7 @@ static void __exit board_cleanup (void) | |||
341 | nand_release (board_mtd); | 341 | nand_release (board_mtd); |
342 | 342 | ||
343 | /* unmap physical address */ | 343 | /* unmap physical address */ |
344 | iounmap((void *)baseaddr); | 344 | iounmap(baseaddr); |
345 | 345 | ||
346 | /* Free the MTD device structure */ | 346 | /* Free the MTD device structure */ |
347 | kfree (board_mtd); | 347 | kfree (board_mtd); |
diff --git a/Documentation/IO-mapping.txt b/Documentation/IO-mapping.txt index 78a440695e11..1b5aa10df845 100644 --- a/Documentation/IO-mapping.txt +++ b/Documentation/IO-mapping.txt | |||
@@ -157,7 +157,7 @@ For such memory, you can do things like | |||
157 | * access only the 640k-1MB area, so anything else | 157 | * access only the 640k-1MB area, so anything else |
158 | * has to be remapped. | 158 | * has to be remapped. |
159 | */ | 159 | */ |
160 | char * baseptr = ioremap(0xFC000000, 1024*1024); | 160 | void __iomem *baseptr = ioremap(0xFC000000, 1024*1024); |
161 | 161 | ||
162 | /* write a 'A' to the offset 10 of the area */ | 162 | /* write a 'A' to the offset 10 of the area */ |
163 | writeb('A',baseptr+10); | 163 | writeb('A',baseptr+10); |
diff --git a/Documentation/DMA-mapping.txt b/Documentation/PCI/PCI-DMA-mapping.txt index ecad88d9fe59..ecad88d9fe59 100644 --- a/Documentation/DMA-mapping.txt +++ b/Documentation/PCI/PCI-DMA-mapping.txt | |||
diff --git a/Documentation/block/00-INDEX b/Documentation/block/00-INDEX index 961a0513f8c3..a406286f6f3e 100644 --- a/Documentation/block/00-INDEX +++ b/Documentation/block/00-INDEX | |||
@@ -1,7 +1,5 @@ | |||
1 | 00-INDEX | 1 | 00-INDEX |
2 | - This file | 2 | - This file |
3 | as-iosched.txt | ||
4 | - Anticipatory IO scheduler | ||
5 | barrier.txt | 3 | barrier.txt |
6 | - I/O Barriers | 4 | - I/O Barriers |
7 | biodoc.txt | 5 | biodoc.txt |
diff --git a/Documentation/block/as-iosched.txt b/Documentation/block/as-iosched.txt deleted file mode 100644 index 738b72be128e..000000000000 --- a/Documentation/block/as-iosched.txt +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | Anticipatory IO scheduler | ||
2 | ------------------------- | ||
3 | Nick Piggin <piggin@cyberone.com.au> 13 Sep 2003 | ||
4 | |||
5 | Attention! Database servers, especially those using "TCQ" disks should | ||
6 | investigate performance with the 'deadline' IO scheduler. Any system with high | ||
7 | disk performance requirements should do so, in fact. | ||
8 | |||
9 | If you see unusual performance characteristics of your disk systems, or you | ||
10 | see big performance regressions versus the deadline scheduler, please email | ||
11 | me. Database users don't bother unless you're willing to test a lot of patches | ||
12 | from me ;) its a known issue. | ||
13 | |||
14 | Also, users with hardware RAID controllers, doing striping, may find | ||
15 | highly variable performance results with using the as-iosched. The | ||
16 | as-iosched anticipatory implementation is based on the notion that a disk | ||
17 | device has only one physical seeking head. A striped RAID controller | ||
18 | actually has a head for each physical device in the logical RAID device. | ||
19 | |||
20 | However, setting the antic_expire (see tunable parameters below) produces | ||
21 | very similar behavior to the deadline IO scheduler. | ||
22 | |||
23 | Selecting IO schedulers | ||
24 | ----------------------- | ||
25 | Refer to Documentation/block/switching-sched.txt for information on | ||
26 | selecting an io scheduler on a per-device basis. | ||
27 | |||
28 | Anticipatory IO scheduler Policies | ||
29 | ---------------------------------- | ||
30 | The as-iosched implementation implements several layers of policies | ||
31 | to determine when an IO request is dispatched to the disk controller. | ||
32 | Here are the policies outlined, in order of application. | ||
33 | |||
34 | 1. one-way Elevator algorithm. | ||
35 | |||
36 | The elevator algorithm is similar to that used in deadline scheduler, with | ||
37 | the addition that it allows limited backward movement of the elevator | ||
38 | (i.e. seeks backwards). A seek backwards can occur when choosing between | ||
39 | two IO requests where one is behind the elevator's current position, and | ||
40 | the other is in front of the elevator's position. If the seek distance to | ||
41 | the request in back of the elevator is less than half the seek distance to | ||
42 | the request in front of the elevator, then the request in back can be chosen. | ||
43 | Backward seeks are also limited to a maximum of MAXBACK (1024*1024) sectors. | ||
44 | This favors forward movement of the elevator, while allowing opportunistic | ||
45 | "short" backward seeks. | ||
46 | |||
47 | 2. FIFO expiration times for reads and for writes. | ||
48 | |||
49 | This is again very similar to the deadline IO scheduler. The expiration | ||
50 | times for requests on these lists is tunable using the parameters read_expire | ||
51 | and write_expire discussed below. When a read or a write expires in this way, | ||
52 | the IO scheduler will interrupt its current elevator sweep or read anticipation | ||
53 | to service the expired request. | ||
54 | |||
55 | 3. Read and write request batching | ||
56 | |||
57 | A batch is a collection of read requests or a collection of write | ||
58 | requests. The as scheduler alternates dispatching read and write batches | ||
59 | to the driver. In the case a read batch, the scheduler submits read | ||
60 | requests to the driver as long as there are read requests to submit, and | ||
61 | the read batch time limit has not been exceeded (read_batch_expire). | ||
62 | The read batch time limit begins counting down only when there are | ||
63 | competing write requests pending. | ||
64 | |||
65 | In the case of a write batch, the scheduler submits write requests to | ||
66 | the driver as long as there are write requests available, and the | ||
67 | write batch time limit has not been exceeded (write_batch_expire). | ||
68 | However, the length of write batches will be gradually shortened | ||
69 | when read batches frequently exceed their time limit. | ||
70 | |||
71 | When changing between batch types, the scheduler waits for all requests | ||
72 | from the previous batch to complete before scheduling requests for the | ||
73 | next batch. | ||
74 | |||
75 | The read and write fifo expiration times described in policy 2 above | ||
76 | are checked only when in scheduling IO of a batch for the corresponding | ||
77 | (read/write) type. So for example, the read FIFO timeout values are | ||
78 | tested only during read batches. Likewise, the write FIFO timeout | ||
79 | values are tested only during write batches. For this reason, | ||
80 | it is generally not recommended for the read batch time | ||
81 | to be longer than the write expiration time, nor for the write batch | ||
82 | time to exceed the read expiration time (see tunable parameters below). | ||
83 | |||
84 | When the IO scheduler changes from a read to a write batch, | ||
85 | it begins the elevator from the request that is on the head of the | ||
86 | write expiration FIFO. Likewise, when changing from a write batch to | ||
87 | a read batch, scheduler begins the elevator from the first entry | ||
88 | on the read expiration FIFO. | ||
89 | |||
90 | 4. Read anticipation. | ||
91 | |||
92 | Read anticipation occurs only when scheduling a read batch. | ||
93 | This implementation of read anticipation allows only one read request | ||
94 | to be dispatched to the disk controller at a time. In | ||
95 | contrast, many write requests may be dispatched to the disk controller | ||
96 | at a time during a write batch. It is this characteristic that can make | ||
97 | the anticipatory scheduler perform anomalously with controllers supporting | ||
98 | TCQ, or with hardware striped RAID devices. Setting the antic_expire | ||
99 | queue parameter (see below) to zero disables this behavior, and the | ||
100 | anticipatory scheduler behaves essentially like the deadline scheduler. | ||
101 | |||
102 | When read anticipation is enabled (antic_expire is not zero), reads | ||
103 | are dispatched to the disk controller one at a time. | ||
104 | At the end of each read request, the IO scheduler examines its next | ||
105 | candidate read request from its sorted read list. If that next request | ||
106 | is from the same process as the request that just completed, | ||
107 | or if the next request in the queue is "very close" to the | ||
108 | just completed request, it is dispatched immediately. Otherwise, | ||
109 | statistics (average think time, average seek distance) on the process | ||
110 | that submitted the just completed request are examined. If it seems | ||
111 | likely that that process will submit another request soon, and that | ||
112 | request is likely to be near the just completed request, then the IO | ||
113 | scheduler will stop dispatching more read requests for up to (antic_expire) | ||
114 | milliseconds, hoping that process will submit a new request near the one | ||
115 | that just completed. If such a request is made, then it is dispatched | ||
116 | immediately. If the antic_expire wait time expires, then the IO scheduler | ||
117 | will dispatch the next read request from the sorted read queue. | ||
118 | |||
119 | To decide whether an anticipatory wait is worthwhile, the scheduler | ||
120 | maintains statistics for each process that can be used to compute | ||
121 | mean "think time" (the time between read requests), and mean seek | ||
122 | distance for that process. One observation is that these statistics | ||
123 | are associated with each process, but those statistics are not associated | ||
124 | with a specific IO device. So for example, if a process is doing IO | ||
125 | on several file systems on separate devices, the statistics will be | ||
126 | a combination of IO behavior from all those devices. | ||
127 | |||
128 | |||
129 | Tuning the anticipatory IO scheduler | ||
130 | ------------------------------------ | ||
131 | When using 'as', the anticipatory IO scheduler there are 5 parameters under | ||
132 | /sys/block/*/queue/iosched/. All are units of milliseconds. | ||
133 | |||
134 | The parameters are: | ||
135 | * read_expire | ||
136 | Controls how long until a read request becomes "expired". It also controls the | ||
137 | interval between which expired requests are served, so set to 50, a request | ||
138 | might take anywhere < 100ms to be serviced _if_ it is the next on the | ||
139 | expired list. Obviously request expiration strategies won't make the disk | ||
140 | go faster. The result basically equates to the timeslice a single reader | ||
141 | gets in the presence of other IO. 100*((seek time / read_expire) + 1) is | ||
142 | very roughly the % streaming read efficiency your disk should get with | ||
143 | multiple readers. | ||
144 | |||
145 | * read_batch_expire | ||
146 | Controls how much time a batch of reads is given before pending writes are | ||
147 | served. A higher value is more efficient. This might be set below read_expire | ||
148 | if writes are to be given higher priority than reads, but reads are to be | ||
149 | as efficient as possible when there are no writes. Generally though, it | ||
150 | should be some multiple of read_expire. | ||
151 | |||
152 | * write_expire, and | ||
153 | * write_batch_expire are equivalent to the above, for writes. | ||
154 | |||
155 | * antic_expire | ||
156 | Controls the maximum amount of time we can anticipate a good read (one | ||
157 | with a short seek distance from the most recently completed request) before | ||
158 | giving up. Many other factors may cause anticipation to be stopped early, | ||
159 | or some processes will not be "anticipated" at all. Should be a bit higher | ||
160 | for big seek time devices though not a linear correspondence - most | ||
161 | processes have only a few ms thinktime. | ||
162 | |||
163 | In addition to the tunables above there is a read-only file named est_time | ||
164 | which, when read, will show: | ||
165 | |||
166 | - The probability of a task exiting without a cooperating task | ||
167 | submitting an anticipated IO. | ||
168 | |||
169 | - The current mean think time. | ||
170 | |||
171 | - The seek distance used to determine if an incoming IO is better. | ||
172 | |||
diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt index 8d2158a1c6aa..6fab97ea7e6b 100644 --- a/Documentation/block/biodoc.txt +++ b/Documentation/block/biodoc.txt | |||
@@ -186,7 +186,7 @@ a virtual address mapping (unlike the earlier scheme of virtual address | |||
186 | do not have a corresponding kernel virtual address space mapping) and | 186 | do not have a corresponding kernel virtual address space mapping) and |
187 | low-memory pages. | 187 | low-memory pages. |
188 | 188 | ||
189 | Note: Please refer to Documentation/DMA-mapping.txt for a discussion | 189 | Note: Please refer to Documentation/PCI/PCI-DMA-mapping.txt for a discussion |
190 | on PCI high mem DMA aspects and mapping of scatter gather lists, and support | 190 | on PCI high mem DMA aspects and mapping of scatter gather lists, and support |
191 | for 64 bit PCI. | 191 | for 64 bit PCI. |
192 | 192 | ||
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt index af6885c3c821..e1def1786e50 100644 --- a/Documentation/filesystems/ext4.txt +++ b/Documentation/filesystems/ext4.txt | |||
@@ -196,7 +196,7 @@ nobarrier This also requires an IO stack which can support | |||
196 | also be used to enable or disable barriers, for | 196 | also be used to enable or disable barriers, for |
197 | consistency with other ext4 mount options. | 197 | consistency with other ext4 mount options. |
198 | 198 | ||
199 | inode_readahead=n This tuning parameter controls the maximum | 199 | inode_readahead_blks=n This tuning parameter controls the maximum |
200 | number of inode table blocks that ext4's inode | 200 | number of inode table blocks that ext4's inode |
201 | table readahead algorithm will pre-read into | 201 | table readahead algorithm will pre-read into |
202 | the buffer cache. The default value is 32 blocks. | 202 | the buffer cache. The default value is 32 blocks. |
diff --git a/Documentation/filesystems/nilfs2.txt b/Documentation/filesystems/nilfs2.txt index 4949fcaa6b6a..839efd8a8a8c 100644 --- a/Documentation/filesystems/nilfs2.txt +++ b/Documentation/filesystems/nilfs2.txt | |||
@@ -28,7 +28,7 @@ described in the man pages included in the package. | |||
28 | Project web page: http://www.nilfs.org/en/ | 28 | Project web page: http://www.nilfs.org/en/ |
29 | Download page: http://www.nilfs.org/en/download.html | 29 | Download page: http://www.nilfs.org/en/download.html |
30 | Git tree web page: http://www.nilfs.org/git/ | 30 | Git tree web page: http://www.nilfs.org/git/ |
31 | NILFS mailing lists: http://www.nilfs.org/mailman/listinfo/users | 31 | List info: http://vger.kernel.org/vger-lists.html#linux-nilfs |
32 | 32 | ||
33 | Caveats | 33 | Caveats |
34 | ======= | 34 | ======= |
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 220cc6376ef8..0d07513a67a6 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -177,7 +177,6 @@ read the file /proc/PID/status: | |||
177 | CapBnd: ffffffffffffffff | 177 | CapBnd: ffffffffffffffff |
178 | voluntary_ctxt_switches: 0 | 178 | voluntary_ctxt_switches: 0 |
179 | nonvoluntary_ctxt_switches: 1 | 179 | nonvoluntary_ctxt_switches: 1 |
180 | Stack usage: 12 kB | ||
181 | 180 | ||
182 | This shows you nearly the same information you would get if you viewed it with | 181 | This shows you nearly the same information you would get if you viewed it with |
183 | the ps command. In fact, ps uses the proc file system to obtain its | 182 | the ps command. In fact, ps uses the proc file system to obtain its |
@@ -231,7 +230,6 @@ Table 1-2: Contents of the statm files (as of 2.6.30-rc7) | |||
231 | Mems_allowed_list Same as previous, but in "list format" | 230 | Mems_allowed_list Same as previous, but in "list format" |
232 | voluntary_ctxt_switches number of voluntary context switches | 231 | voluntary_ctxt_switches number of voluntary context switches |
233 | nonvoluntary_ctxt_switches number of non voluntary context switches | 232 | nonvoluntary_ctxt_switches number of non voluntary context switches |
234 | Stack usage: stack usage high water mark (round up to page size) | ||
235 | .............................................................................. | 233 | .............................................................................. |
236 | 234 | ||
237 | Table 1-3: Contents of the statm files (as of 2.6.8-rc3) | 235 | Table 1-3: Contents of the statm files (as of 2.6.8-rc3) |
diff --git a/Documentation/hwmon/amc6821 b/Documentation/hwmon/amc6821 new file mode 100644 index 000000000000..ced8359c50f8 --- /dev/null +++ b/Documentation/hwmon/amc6821 | |||
@@ -0,0 +1,102 @@ | |||
1 | Kernel driver amc6821 | ||
2 | ===================== | ||
3 | |||
4 | Supported chips: | ||
5 | Texas Instruments AMC6821 | ||
6 | Prefix: 'amc6821' | ||
7 | Addresses scanned: 0x18, 0x19, 0x1a, 0x2c, 0x2d, 0x2e, 0x4c, 0x4d, 0x4e | ||
8 | Datasheet: http://focus.ti.com/docs/prod/folders/print/amc6821.html | ||
9 | |||
10 | Authors: | ||
11 | Tomaz Mertelj <tomaz.mertelj@guest.arnes.si> | ||
12 | |||
13 | |||
14 | Description | ||
15 | ----------- | ||
16 | |||
17 | This driver implements support for the Texas Instruments amc6821 chip. | ||
18 | The chip has one on-chip and one remote temperature sensor and one pwm fan | ||
19 | regulator. | ||
20 | The pwm can be controlled either from software or automatically. | ||
21 | |||
22 | The driver provides the following sensor accesses in sysfs: | ||
23 | |||
24 | temp1_input ro on-chip temperature | ||
25 | temp1_min rw " | ||
26 | temp1_max rw " | ||
27 | temp1_crit rw " | ||
28 | temp1_min_alarm ro " | ||
29 | temp1_max_alarm ro " | ||
30 | temp1_crit_alarm ro " | ||
31 | |||
32 | temp2_input ro remote temperature | ||
33 | temp2_min rw " | ||
34 | temp2_max rw " | ||
35 | temp2_crit rw " | ||
36 | temp2_min_alarm ro " | ||
37 | temp2_max_alarm ro " | ||
38 | temp2_crit_alarm ro " | ||
39 | temp2_fault ro " | ||
40 | |||
41 | fan1_input ro tachometer speed | ||
42 | fan1_min rw " | ||
43 | fan1_max rw " | ||
44 | fan1_fault ro " | ||
45 | fan1_div rw Fan divisor can be either 2 or 4. | ||
46 | |||
47 | pwm1 rw pwm1 | ||
48 | pwm1_enable rw regulator mode, 1=open loop, 2=fan controlled | ||
49 | by remote temperature, 3=fan controlled by | ||
50 | combination of the on-chip temperature and | ||
51 | remote-sensor temperature, | ||
52 | pwm1_auto_channels_temp ro 1 if pwm_enable==2, 3 if pwm_enable==3 | ||
53 | pwm1_auto_point1_pwm ro Hardwired to 0, shared for both | ||
54 | temperature channels. | ||
55 | pwm1_auto_point2_pwm rw This value is shared for both temperature | ||
56 | channels. | ||
57 | pwm1_auto_point3_pwm rw Hardwired to 255, shared for both | ||
58 | temperature channels. | ||
59 | |||
60 | temp1_auto_point1_temp ro Hardwired to temp2_auto_point1_temp | ||
61 | which is rw. Below this temperature fan stops. | ||
62 | temp1_auto_point2_temp rw The low-temperature limit of the proportional | ||
63 | range. Below this temperature | ||
64 | pwm1 = pwm1_auto_point2_pwm. It can go from | ||
65 | 0 degree C to 124 degree C in steps of | ||
66 | 4 degree C. Read it out after writing to get | ||
67 | the actual value. | ||
68 | temp1_auto_point3_temp rw Above this temperature fan runs at maximum | ||
69 | speed. It can go from temp1_auto_point2_temp. | ||
70 | It can only have certain discrete values | ||
71 | which depend on temp1_auto_point2_temp and | ||
72 | pwm1_auto_point2_pwm. Read it out after | ||
73 | writing to get the actual value. | ||
74 | |||
75 | temp2_auto_point1_temp rw Must be between 0 degree C and 63 degree C and | ||
76 | it defines the passive cooling temperature. | ||
77 | Below this temperature the fan stops in | ||
78 | the closed loop mode. | ||
79 | temp2_auto_point2_temp rw The low-temperature limit of the proportional | ||
80 | range. Below this temperature | ||
81 | pwm1 = pwm1_auto_point2_pwm. It can go from | ||
82 | 0 degree C to 124 degree C in steps | ||
83 | of 4 degree C. | ||
84 | |||
85 | temp2_auto_point3_temp rw Above this temperature fan runs at maximum | ||
86 | speed. It can only have certain discrete | ||
87 | values which depend on temp2_auto_point2_temp | ||
88 | and pwm1_auto_point2_pwm. Read it out after | ||
89 | writing to get actual value. | ||
90 | |||
91 | |||
92 | Module parameters | ||
93 | ----------------- | ||
94 | |||
95 | If your board has a BIOS that initializes the amc6821 correctly, you should | ||
96 | load the module with: init=0. | ||
97 | |||
98 | If your board BIOS doesn't initialize the chip, or you want | ||
99 | different settings, you can set the following parameters: | ||
100 | init=1, | ||
101 | pwminv: 0 default pwm output, 1 inverts pwm output. | ||
102 | |||
diff --git a/Documentation/hwmon/k10temp b/Documentation/hwmon/k10temp index a7a18d453a51..6526eee525a6 100644 --- a/Documentation/hwmon/k10temp +++ b/Documentation/hwmon/k10temp | |||
@@ -3,8 +3,8 @@ Kernel driver k10temp | |||
3 | 3 | ||
4 | Supported chips: | 4 | Supported chips: |
5 | * AMD Family 10h processors: | 5 | * AMD Family 10h processors: |
6 | Socket F: Quad-Core/Six-Core/Embedded Opteron | 6 | Socket F: Quad-Core/Six-Core/Embedded Opteron (but see below) |
7 | Socket AM2+: Opteron, Phenom (II) X3/X4 | 7 | Socket AM2+: Quad-Core Opteron, Phenom (II) X3/X4, Athlon X2 (but see below) |
8 | Socket AM3: Quad-Core Opteron, Athlon/Phenom II X2/X3/X4, Sempron II | 8 | Socket AM3: Quad-Core Opteron, Athlon/Phenom II X2/X3/X4, Sempron II |
9 | Socket S1G3: Athlon II, Sempron, Turion II | 9 | Socket S1G3: Athlon II, Sempron, Turion II |
10 | * AMD Family 11h processors: | 10 | * AMD Family 11h processors: |
@@ -36,10 +36,15 @@ Description | |||
36 | This driver permits reading of the internal temperature sensor of AMD | 36 | This driver permits reading of the internal temperature sensor of AMD |
37 | Family 10h and 11h processors. | 37 | Family 10h and 11h processors. |
38 | 38 | ||
39 | All these processors have a sensor, but on older revisions of Family 10h | 39 | All these processors have a sensor, but on those for Socket F or AM2+, |
40 | processors, the sensor may return inconsistent values (erratum 319). The | 40 | the sensor may return inconsistent values (erratum 319). The driver |
41 | driver will refuse to load on these revisions unless you specify the | 41 | will refuse to load on these revisions unless you specify the "force=1" |
42 | "force=1" module parameter. | 42 | module parameter. |
43 | |||
44 | Due to technical reasons, the driver can detect only the mainboard's | ||
45 | socket type, not the processor's actual capabilities. Therefore, if you | ||
46 | are using an AM3 processor on an AM2+ mainboard, you can safely use the | ||
47 | "force=1" parameter. | ||
43 | 48 | ||
44 | There is one temperature measurement value, available as temp1_input in | 49 | There is one temperature measurement value, available as temp1_input in |
45 | sysfs. It is measured in degrees Celsius with a resolution of 1/8th degree. | 50 | sysfs. It is measured in degrees Celsius with a resolution of 1/8th degree. |
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt index 947374977ca5..35cf64d4436d 100644 --- a/Documentation/ioctl/ioctl-number.txt +++ b/Documentation/ioctl/ioctl-number.txt | |||
@@ -56,10 +56,11 @@ Following this convention is good because: | |||
56 | (5) When following the convention, the driver code can use generic | 56 | (5) When following the convention, the driver code can use generic |
57 | code to copy the parameters between user and kernel space. | 57 | code to copy the parameters between user and kernel space. |
58 | 58 | ||
59 | This table lists ioctls visible from user land for Linux/i386. It contains | 59 | This table lists ioctls visible from user land for Linux/x86. It contains |
60 | most drivers up to 2.3.14, but I know I am missing some. | 60 | most drivers up to 2.6.31, but I know I am missing some. There has been |
61 | no attempt to list non-X86 architectures or ioctls from drivers/staging/. | ||
61 | 62 | ||
62 | Code Seq# Include File Comments | 63 | Code Seq#(hex) Include File Comments |
63 | ======================================================== | 64 | ======================================================== |
64 | 0x00 00-1F linux/fs.h conflict! | 65 | 0x00 00-1F linux/fs.h conflict! |
65 | 0x00 00-1F scsi/scsi_ioctl.h conflict! | 66 | 0x00 00-1F scsi/scsi_ioctl.h conflict! |
@@ -69,119 +70,228 @@ Code Seq# Include File Comments | |||
69 | 0x03 all linux/hdreg.h | 70 | 0x03 all linux/hdreg.h |
70 | 0x04 D2-DC linux/umsdos_fs.h Dead since 2.6.11, but don't reuse these. | 71 | 0x04 D2-DC linux/umsdos_fs.h Dead since 2.6.11, but don't reuse these. |
71 | 0x06 all linux/lp.h | 72 | 0x06 all linux/lp.h |
72 | 0x09 all linux/md.h | 73 | 0x09 all linux/raid/md_u.h |
74 | 0x10 00-0F drivers/char/s390/vmcp.h | ||
73 | 0x12 all linux/fs.h | 75 | 0x12 all linux/fs.h |
74 | linux/blkpg.h | 76 | linux/blkpg.h |
75 | 0x1b all InfiniBand Subsystem <http://www.openib.org/> | 77 | 0x1b all InfiniBand Subsystem <http://www.openib.org/> |
76 | 0x20 all drivers/cdrom/cm206.h | 78 | 0x20 all drivers/cdrom/cm206.h |
77 | 0x22 all scsi/sg.h | 79 | 0x22 all scsi/sg.h |
78 | '#' 00-3F IEEE 1394 Subsystem Block for the entire subsystem | 80 | '#' 00-3F IEEE 1394 Subsystem Block for the entire subsystem |
81 | '$' 00-0F linux/perf_counter.h, linux/perf_event.h | ||
79 | '1' 00-1F <linux/timepps.h> PPS kit from Ulrich Windl | 82 | '1' 00-1F <linux/timepps.h> PPS kit from Ulrich Windl |
80 | <ftp://ftp.de.kernel.org/pub/linux/daemons/ntp/PPS/> | 83 | <ftp://ftp.de.kernel.org/pub/linux/daemons/ntp/PPS/> |
84 | '2' 01-04 linux/i2o.h | ||
85 | '3' 00-0F drivers/s390/char/raw3270.h conflict! | ||
86 | '3' 00-1F linux/suspend_ioctls.h conflict! | ||
87 | and kernel/power/user.c | ||
81 | '8' all SNP8023 advanced NIC card | 88 | '8' all SNP8023 advanced NIC card |
82 | <mailto:mcr@solidum.com> | 89 | <mailto:mcr@solidum.com> |
83 | 'A' 00-1F linux/apm_bios.h | 90 | '@' 00-0F linux/radeonfb.h conflict! |
91 | '@' 00-0F drivers/video/aty/aty128fb.c conflict! | ||
92 | 'A' 00-1F linux/apm_bios.h conflict! | ||
93 | 'A' 00-0F linux/agpgart.h conflict! | ||
94 | and drivers/char/agp/compat_ioctl.h | ||
95 | 'A' 00-7F sound/asound.h conflict! | ||
96 | 'B' 00-1F linux/cciss_ioctl.h conflict! | ||
97 | 'B' 00-0F include/linux/pmu.h conflict! | ||
84 | 'B' C0-FF advanced bbus | 98 | 'B' C0-FF advanced bbus |
85 | <mailto:maassen@uni-freiburg.de> | 99 | <mailto:maassen@uni-freiburg.de> |
86 | 'C' all linux/soundcard.h | 100 | 'C' all linux/soundcard.h conflict! |
101 | 'C' 01-2F linux/capi.h conflict! | ||
102 | 'C' F0-FF drivers/net/wan/cosa.h conflict! | ||
87 | 'D' all arch/s390/include/asm/dasd.h | 103 | 'D' all arch/s390/include/asm/dasd.h |
88 | 'E' all linux/input.h | 104 | 'D' 40-5F drivers/scsi/dpt/dtpi_ioctl.h |
89 | 'F' all linux/fb.h | 105 | 'D' 05 drivers/scsi/pmcraid.h |
90 | 'H' all linux/hiddev.h | 106 | 'E' all linux/input.h conflict! |
91 | 'I' all linux/isdn.h | 107 | 'E' 00-0F xen/evtchn.h conflict! |
108 | 'F' all linux/fb.h conflict! | ||
109 | 'F' 01-02 drivers/scsi/pmcraid.h conflict! | ||
110 | 'F' 20 drivers/video/fsl-diu-fb.h conflict! | ||
111 | 'F' 20 drivers/video/intelfb/intelfb.h conflict! | ||
112 | 'F' 20 linux/ivtvfb.h conflict! | ||
113 | 'F' 20 linux/matroxfb.h conflict! | ||
114 | 'F' 20 drivers/video/aty/atyfb_base.c conflict! | ||
115 | 'F' 00-0F video/da8xx-fb.h conflict! | ||
116 | 'F' 80-8F linux/arcfb.h conflict! | ||
117 | 'F' DD video/sstfb.h conflict! | ||
118 | 'G' 00-3F drivers/misc/sgi-gru/grulib.h conflict! | ||
119 | 'G' 00-0F linux/gigaset_dev.h conflict! | ||
120 | 'H' 00-7F linux/hiddev.h conflict! | ||
121 | 'H' 00-0F linux/hidraw.h conflict! | ||
122 | 'H' 00-0F sound/asound.h conflict! | ||
123 | 'H' 20-40 sound/asound_fm.h conflict! | ||
124 | 'H' 80-8F sound/sfnt_info.h conflict! | ||
125 | 'H' 10-8F sound/emu10k1.h conflict! | ||
126 | 'H' 10-1F sound/sb16_csp.h conflict! | ||
127 | 'H' 10-1F sound/hda_hwdep.h conflict! | ||
128 | 'H' 40-4F sound/hdspm.h conflict! | ||
129 | 'H' 40-4F sound/hdsp.h conflict! | ||
130 | 'H' 90 sound/usb/usx2y/usb_stream.h | ||
131 | 'H' C0-F0 net/bluetooth/hci.h conflict! | ||
132 | 'H' C0-DF net/bluetooth/hidp/hidp.h conflict! | ||
133 | 'H' C0-DF net/bluetooth/cmtp/cmtp.h conflict! | ||
134 | 'H' C0-DF net/bluetooth/bnep/bnep.h conflict! | ||
135 | 'I' all linux/isdn.h conflict! | ||
136 | 'I' 00-0F drivers/isdn/divert/isdn_divert.h conflict! | ||
137 | 'I' 40-4F linux/mISDNif.h conflict! | ||
92 | 'J' 00-1F drivers/scsi/gdth_ioctl.h | 138 | 'J' 00-1F drivers/scsi/gdth_ioctl.h |
93 | 'K' all linux/kd.h | 139 | 'K' all linux/kd.h |
94 | 'L' 00-1F linux/loop.h | 140 | 'L' 00-1F linux/loop.h conflict! |
95 | 'L' 20-2F driver/usb/misc/vstusb.h | 141 | 'L' 10-1F drivers/scsi/mpt2sas/mpt2sas_ctl.h conflict! |
142 | 'L' 20-2F linux/usb/vstusb.h | ||
96 | 'L' E0-FF linux/ppdd.h encrypted disk device driver | 143 | 'L' E0-FF linux/ppdd.h encrypted disk device driver |
97 | <http://linux01.gwdg.de/~alatham/ppdd.html> | 144 | <http://linux01.gwdg.de/~alatham/ppdd.html> |
98 | 'M' all linux/soundcard.h | 145 | 'M' all linux/soundcard.h conflict! |
146 | 'M' 01-16 mtd/mtd-abi.h conflict! | ||
147 | and drivers/mtd/mtdchar.c | ||
148 | 'M' 01-03 drivers/scsi/megaraid/megaraid_sas.h | ||
149 | 'M' 00-0F drivers/video/fsl-diu-fb.h conflict! | ||
99 | 'N' 00-1F drivers/usb/scanner.h | 150 | 'N' 00-1F drivers/usb/scanner.h |
100 | 'O' 00-02 include/mtd/ubi-user.h UBI | 151 | 'O' 00-06 mtd/ubi-user.h UBI |
101 | 'P' all linux/soundcard.h | 152 | 'P' all linux/soundcard.h conflict! |
153 | 'P' 60-6F sound/sscape_ioctl.h conflict! | ||
154 | 'P' 00-0F drivers/usb/class/usblp.c conflict! | ||
102 | 'Q' all linux/soundcard.h | 155 | 'Q' all linux/soundcard.h |
103 | 'R' 00-1F linux/random.h | 156 | 'R' 00-1F linux/random.h conflict! |
157 | 'R' 01 linux/rfkill.h conflict! | ||
158 | 'R' 01-0F media/rds.h conflict! | ||
159 | 'R' C0-DF net/bluetooth/rfcomm.h | ||
104 | 'S' all linux/cdrom.h conflict! | 160 | 'S' all linux/cdrom.h conflict! |
105 | 'S' 80-81 scsi/scsi_ioctl.h conflict! | 161 | 'S' 80-81 scsi/scsi_ioctl.h conflict! |
106 | 'S' 82-FF scsi/scsi.h conflict! | 162 | 'S' 82-FF scsi/scsi.h conflict! |
163 | 'S' 00-7F sound/asequencer.h conflict! | ||
107 | 'T' all linux/soundcard.h conflict! | 164 | 'T' all linux/soundcard.h conflict! |
165 | 'T' 00-AF sound/asound.h conflict! | ||
108 | 'T' all arch/x86/include/asm/ioctls.h conflict! | 166 | 'T' all arch/x86/include/asm/ioctls.h conflict! |
109 | 'U' 00-EF linux/drivers/usb/usb.h | 167 | 'T' C0-DF linux/if_tun.h conflict! |
110 | 'V' all linux/vt.h | 168 | 'U' all sound/asound.h conflict! |
169 | 'U' 00-0F drivers/media/video/uvc/uvcvideo.h conflict! | ||
170 | 'U' 00-CF linux/uinput.h conflict! | ||
171 | 'U' 00-EF linux/usbdevice_fs.h | ||
172 | 'U' C0-CF drivers/bluetooth/hci_uart.h | ||
173 | 'V' all linux/vt.h conflict! | ||
174 | 'V' all linux/videodev2.h conflict! | ||
175 | 'V' C0 linux/ivtvfb.h conflict! | ||
176 | 'V' C0 linux/ivtv.h conflict! | ||
177 | 'V' C0 media/davinci/vpfe_capture.h conflict! | ||
178 | 'V' C0 media/si4713.h conflict! | ||
179 | 'V' C0-CF drivers/media/video/mxb.h conflict! | ||
111 | 'W' 00-1F linux/watchdog.h conflict! | 180 | 'W' 00-1F linux/watchdog.h conflict! |
112 | 'W' 00-1F linux/wanrouter.h conflict! | 181 | 'W' 00-1F linux/wanrouter.h conflict! |
113 | 'X' all linux/xfs_fs.h | 182 | 'W' 00-3F sound/asound.h conflict! |
183 | 'X' all fs/xfs/xfs_fs.h conflict! | ||
184 | and fs/xfs/linux-2.6/xfs_ioctl32.h | ||
185 | and include/linux/falloc.h | ||
186 | and linux/fs.h | ||
187 | 'X' all fs/ocfs2/ocfs_fs.h conflict! | ||
188 | 'X' 01 linux/pktcdvd.h conflict! | ||
114 | 'Y' all linux/cyclades.h | 189 | 'Y' all linux/cyclades.h |
115 | '[' 00-07 linux/usb/usbtmc.h USB Test and Measurement Devices | 190 | 'Z' 14-15 drivers/message/fusion/mptctl.h |
191 | '[' 00-07 linux/usb/tmc.h USB Test and Measurement Devices | ||
116 | <mailto:gregkh@suse.de> | 192 | <mailto:gregkh@suse.de> |
117 | 'a' all ATM on linux | 193 | 'a' all linux/atm*.h, linux/sonet.h ATM on linux |
118 | <http://lrcwww.epfl.ch/linux-atm/magic.html> | 194 | <http://lrcwww.epfl.ch/linux-atm/magic.html> |
119 | 'b' 00-FF bit3 vme host bridge | 195 | 'b' 00-FF conflict! bit3 vme host bridge |
120 | <mailto:natalia@nikhefk.nikhef.nl> | 196 | <mailto:natalia@nikhefk.nikhef.nl> |
197 | 'b' 00-0F media/bt819.h conflict! | ||
198 | 'c' all linux/cm4000_cs.h conflict! | ||
121 | 'c' 00-7F linux/comstats.h conflict! | 199 | 'c' 00-7F linux/comstats.h conflict! |
122 | 'c' 00-7F linux/coda.h conflict! | 200 | 'c' 00-7F linux/coda.h conflict! |
123 | 'c' 80-9F arch/s390/include/asm/chsc.h | 201 | 'c' 00-1F linux/chio.h conflict! |
124 | 'c' A0-AF arch/x86/include/asm/msr.h | 202 | 'c' 80-9F arch/s390/include/asm/chsc.h conflict! |
203 | 'c' A0-AF arch/x86/include/asm/msr.h conflict! | ||
125 | 'd' 00-FF linux/char/drm/drm/h conflict! | 204 | 'd' 00-FF linux/char/drm/drm/h conflict! |
205 | 'd' 02-40 pcmcia/ds.h conflict! | ||
206 | 'd' 10-3F drivers/media/video/dabusb.h conflict! | ||
207 | 'd' C0-CF drivers/media/video/saa7191.h conflict! | ||
126 | 'd' F0-FF linux/digi1.h | 208 | 'd' F0-FF linux/digi1.h |
127 | 'e' all linux/digi1.h conflict! | 209 | 'e' all linux/digi1.h conflict! |
128 | 'e' 00-1F net/irda/irtty.h conflict! | 210 | 'e' 00-1F drivers/net/irda/irtty-sir.h conflict! |
129 | 'f' 00-1F linux/ext2_fs.h | 211 | 'f' 00-1F linux/ext2_fs.h conflict! |
130 | 'h' 00-7F Charon filesystem | 212 | 'f' 00-1F linux/ext3_fs.h conflict! |
213 | 'f' 00-0F fs/jfs/jfs_dinode.h conflict! | ||
214 | 'f' 00-0F fs/ext4/ext4.h conflict! | ||
215 | 'f' 00-0F linux/fs.h conflict! | ||
216 | 'f' 00-0F fs/ocfs2/ocfs2_fs.h conflict! | ||
217 | 'g' 00-0F linux/usb/gadgetfs.h | ||
218 | 'g' 20-2F linux/usb/g_printer.h | ||
219 | 'h' 00-7F conflict! Charon filesystem | ||
131 | <mailto:zapman@interlan.net> | 220 | <mailto:zapman@interlan.net> |
132 | 'i' 00-3F linux/i2o.h | 221 | 'h' 00-1F linux/hpet.h conflict! |
222 | 'i' 00-3F linux/i2o-dev.h conflict! | ||
223 | 'i' 0B-1F linux/ipmi.h conflict! | ||
224 | 'i' 80-8F linux/i8k.h | ||
133 | 'j' 00-3F linux/joystick.h | 225 | 'j' 00-3F linux/joystick.h |
226 | 'k' 00-0F linux/spi/spidev.h conflict! | ||
227 | 'k' 00-05 video/kyro.h conflict! | ||
134 | 'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system | 228 | 'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system |
135 | <http://mikonos.dia.unisa.it/tcfs> | 229 | <http://mikonos.dia.unisa.it/tcfs> |
136 | 'l' 40-7F linux/udf_fs_i.h in development: | 230 | 'l' 40-7F linux/udf_fs_i.h in development: |
137 | <http://sourceforge.net/projects/linux-udf/> | 231 | <http://sourceforge.net/projects/linux-udf/> |
138 | 'm' 00-09 linux/mmtimer.h | 232 | 'm' 00-09 linux/mmtimer.h conflict! |
139 | 'm' all linux/mtio.h conflict! | 233 | 'm' all linux/mtio.h conflict! |
140 | 'm' all linux/soundcard.h conflict! | 234 | 'm' all linux/soundcard.h conflict! |
141 | 'm' all linux/synclink.h conflict! | 235 | 'm' all linux/synclink.h conflict! |
236 | 'm' 00-19 drivers/message/fusion/mptctl.h conflict! | ||
237 | 'm' 00 drivers/scsi/megaraid/megaraid_ioctl.h conflict! | ||
142 | 'm' 00-1F net/irda/irmod.h conflict! | 238 | 'm' 00-1F net/irda/irmod.h conflict! |
143 | 'n' 00-7F linux/ncp_fs.h | 239 | 'n' 00-7F linux/ncp_fs.h and fs/ncpfs/ioctl.c |
144 | 'n' 80-8F linux/nilfs2_fs.h NILFS2 | 240 | 'n' 80-8F linux/nilfs2_fs.h NILFS2 |
145 | 'n' E0-FF video/matrox.h matroxfb | 241 | 'n' E0-FF linux/matroxfb.h matroxfb |
146 | 'o' 00-1F fs/ocfs2/ocfs2_fs.h OCFS2 | 242 | 'o' 00-1F fs/ocfs2/ocfs2_fs.h OCFS2 |
147 | 'o' 00-03 include/mtd/ubi-user.h conflict! (OCFS2 and UBI overlaps) | 243 | 'o' 00-03 mtd/ubi-user.h conflict! (OCFS2 and UBI overlaps) |
148 | 'o' 40-41 include/mtd/ubi-user.h UBI | 244 | 'o' 40-41 mtd/ubi-user.h UBI |
149 | 'o' 01-A1 include/linux/dvb/*.h DVB | 245 | 'o' 01-A1 linux/dvb/*.h DVB |
150 | 'p' 00-0F linux/phantom.h conflict! (OpenHaptics needs this) | 246 | 'p' 00-0F linux/phantom.h conflict! (OpenHaptics needs this) |
247 | 'p' 00-1F linux/rtc.h conflict! | ||
151 | 'p' 00-3F linux/mc146818rtc.h conflict! | 248 | 'p' 00-3F linux/mc146818rtc.h conflict! |
152 | 'p' 40-7F linux/nvram.h | 249 | 'p' 40-7F linux/nvram.h |
153 | 'p' 80-9F user-space parport | 250 | 'p' 80-9F linux/ppdev.h user-space parport |
154 | <mailto:tim@cyberelk.net> | 251 | <mailto:tim@cyberelk.net> |
155 | 'p' a1-a4 linux/pps.h LinuxPPS | 252 | 'p' A1-A4 linux/pps.h LinuxPPS |
156 | <mailto:giometti@linux.it> | 253 | <mailto:giometti@linux.it> |
157 | 'q' 00-1F linux/serio.h | 254 | 'q' 00-1F linux/serio.h |
158 | 'q' 80-FF Internet PhoneJACK, Internet LineJACK | 255 | 'q' 80-FF linux/telephony.h Internet PhoneJACK, Internet LineJACK |
159 | <http://www.quicknet.net> | 256 | linux/ixjuser.h <http://www.quicknet.net> |
160 | 'r' 00-1F linux/msdos_fs.h | 257 | 'r' 00-1F linux/msdos_fs.h and fs/fat/dir.c |
161 | 's' all linux/cdk.h | 258 | 's' all linux/cdk.h |
162 | 't' 00-7F linux/if_ppp.h | 259 | 't' 00-7F linux/if_ppp.h |
163 | 't' 80-8F linux/isdn_ppp.h | 260 | 't' 80-8F linux/isdn_ppp.h |
261 | 't' 90 linux/toshiba.h | ||
164 | 'u' 00-1F linux/smb_fs.h | 262 | 'u' 00-1F linux/smb_fs.h |
165 | 'v' 00-1F linux/ext2_fs.h conflict! | ||
166 | 'v' all linux/videodev.h conflict! | 263 | 'v' all linux/videodev.h conflict! |
264 | 'v' 00-1F linux/ext2_fs.h conflict! | ||
265 | 'v' 00-1F linux/fs.h conflict! | ||
266 | 'v' 00-0F linux/sonypi.h conflict! | ||
267 | 'v' C0-CF drivers/media/video/ov511.h conflict! | ||
268 | 'v' C0-DF media/pwc-ioctl.h conflict! | ||
269 | 'v' C0-FF linux/meye.h conflict! | ||
270 | 'v' C0-CF drivers/media/video/zoran/zoran.h conflict! | ||
271 | 'v' D0-DF drivers/media/video/cpia2/cpia2dev.h conflict! | ||
167 | 'w' all CERN SCI driver | 272 | 'w' all CERN SCI driver |
168 | 'y' 00-1F packet based user level communications | 273 | 'y' 00-1F packet based user level communications |
169 | <mailto:zapman@interlan.net> | 274 | <mailto:zapman@interlan.net> |
170 | 'z' 00-3F CAN bus card | 275 | 'z' 00-3F CAN bus card conflict! |
171 | <mailto:hdstich@connectu.ulm.circular.de> | 276 | <mailto:hdstich@connectu.ulm.circular.de> |
172 | 'z' 40-7F CAN bus card | 277 | 'z' 40-7F CAN bus card conflict! |
173 | <mailto:oe@port.de> | 278 | <mailto:oe@port.de> |
279 | 'z' 10-4F drivers/s390/crypto/zcrypt_api.h conflict! | ||
174 | 0x80 00-1F linux/fb.h | 280 | 0x80 00-1F linux/fb.h |
175 | 0x81 00-1F linux/videotext.h | 281 | 0x81 00-1F linux/videotext.h |
282 | 0x88 00-3F media/ovcamchip.h | ||
176 | 0x89 00-06 arch/x86/include/asm/sockios.h | 283 | 0x89 00-06 arch/x86/include/asm/sockios.h |
177 | 0x89 0B-DF linux/sockios.h | 284 | 0x89 0B-DF linux/sockios.h |
178 | 0x89 E0-EF linux/sockios.h SIOCPROTOPRIVATE range | 285 | 0x89 E0-EF linux/sockios.h SIOCPROTOPRIVATE range |
286 | 0x89 E0-EF linux/dn.h PROTOPRIVATE range | ||
179 | 0x89 F0-FF linux/sockios.h SIOCDEVPRIVATE range | 287 | 0x89 F0-FF linux/sockios.h SIOCDEVPRIVATE range |
180 | 0x8B all linux/wireless.h | 288 | 0x8B all linux/wireless.h |
181 | 0x8C 00-3F WiNRADiO driver | 289 | 0x8C 00-3F WiNRADiO driver |
182 | <http://www.proximity.com.au/~brian/winradio/> | 290 | <http://www.proximity.com.au/~brian/winradio/> |
183 | 0x90 00 drivers/cdrom/sbpcd.h | 291 | 0x90 00 drivers/cdrom/sbpcd.h |
292 | 0x92 00-0F drivers/usb/mon/mon_bin.c | ||
184 | 0x93 60-7F linux/auto_fs.h | 293 | 0x93 60-7F linux/auto_fs.h |
294 | 0x94 all fs/btrfs/ioctl.h | ||
185 | 0x99 00-0F 537-Addinboard driver | 295 | 0x99 00-0F 537-Addinboard driver |
186 | <mailto:buk@buks.ipn.de> | 296 | <mailto:buk@buks.ipn.de> |
187 | 0xA0 all linux/sdp/sdp.h Industrial Device Project | 297 | 0xA0 all linux/sdp/sdp.h Industrial Device Project |
@@ -192,17 +302,22 @@ Code Seq# Include File Comments | |||
192 | 0xAB 00-1F linux/nbd.h | 302 | 0xAB 00-1F linux/nbd.h |
193 | 0xAC 00-1F linux/raw.h | 303 | 0xAC 00-1F linux/raw.h |
194 | 0xAD 00 Netfilter device in development: | 304 | 0xAD 00 Netfilter device in development: |
195 | <mailto:rusty@rustcorp.com.au> | 305 | <mailto:rusty@rustcorp.com.au> |
196 | 0xAE all linux/kvm.h Kernel-based Virtual Machine | 306 | 0xAE all linux/kvm.h Kernel-based Virtual Machine |
197 | <mailto:kvm@vger.kernel.org> | 307 | <mailto:kvm@vger.kernel.org> |
198 | 0xB0 all RATIO devices in development: | 308 | 0xB0 all RATIO devices in development: |
199 | <mailto:vgo@ratio.de> | 309 | <mailto:vgo@ratio.de> |
200 | 0xB1 00-1F PPPoX <mailto:mostrows@styx.uwaterloo.ca> | 310 | 0xB1 00-1F PPPoX <mailto:mostrows@styx.uwaterloo.ca> |
311 | 0xC0 00-0F linux/usb/iowarrior.h | ||
201 | 0xCB 00-1F CBM serial IEC bus in development: | 312 | 0xCB 00-1F CBM serial IEC bus in development: |
202 | <mailto:michael.klein@puffin.lb.shuttle.de> | 313 | <mailto:michael.klein@puffin.lb.shuttle.de> |
314 | 0xCD 01 linux/reiserfs_fs.h | ||
315 | 0xCF 02 fs/cifs/ioctl.c | ||
316 | 0xDB 00-0F drivers/char/mwave/mwavepub.h | ||
203 | 0xDD 00-3F ZFCP device driver see drivers/s390/scsi/ | 317 | 0xDD 00-3F ZFCP device driver see drivers/s390/scsi/ |
204 | <mailto:aherrman@de.ibm.com> | 318 | <mailto:aherrman@de.ibm.com> |
205 | 0xF3 00-3F video/sisfb.h sisfb (in development) | 319 | 0xF3 00-3F drivers/usb/misc/sisusbvga/sisusb.h sisfb (in development) |
206 | <mailto:thomas@winischhofer.net> | 320 | <mailto:thomas@winischhofer.net> |
207 | 0xF4 00-1F video/mbxfb.h mbxfb | 321 | 0xF4 00-1F video/mbxfb.h mbxfb |
208 | <mailto:raph@8d.com> | 322 | <mailto:raph@8d.com> |
323 | 0xFD all linux/dm-ioctl.h | ||
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt index 348b9e5e28fc..27a52b35d55b 100644 --- a/Documentation/kernel-doc-nano-HOWTO.txt +++ b/Documentation/kernel-doc-nano-HOWTO.txt | |||
@@ -214,11 +214,13 @@ The format of the block comment is like this: | |||
214 | * (section header: (section description)? )* | 214 | * (section header: (section description)? )* |
215 | (*)?*/ | 215 | (*)?*/ |
216 | 216 | ||
217 | The short function description ***cannot be multiline***, but the other | 217 | All "description" text can span multiple lines, although the |
218 | descriptions can be (and they can contain blank lines). If you continue | 218 | function_name & its short description are traditionally on a single line. |
219 | that initial short description onto a second line, that second line will | 219 | Description text may also contain blank lines (i.e., lines that contain |
220 | appear further down at the beginning of the description section, which is | 220 | only a "*"). |
221 | almost certainly not what you had in mind. | 221 | |
222 | "section header:" names must be unique per function (or struct, | ||
223 | union, typedef, enum). | ||
222 | 224 | ||
223 | Avoid putting a spurious blank line after the function name, or else the | 225 | Avoid putting a spurious blank line after the function name, or else the |
224 | description will be repeated! | 226 | description will be repeated! |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 5ba4d9dff113..736d45602886 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -240,7 +240,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
240 | 240 | ||
241 | acpi_sleep= [HW,ACPI] Sleep options | 241 | acpi_sleep= [HW,ACPI] Sleep options |
242 | Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig, | 242 | Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig, |
243 | old_ordering, s4_nonvs } | 243 | old_ordering, s4_nonvs, sci_force_enable } |
244 | See Documentation/power/video.txt for information on | 244 | See Documentation/power/video.txt for information on |
245 | s3_bios and s3_mode. | 245 | s3_bios and s3_mode. |
246 | s3_beep is for debugging; it makes the PC's speaker beep | 246 | s3_beep is for debugging; it makes the PC's speaker beep |
@@ -253,6 +253,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
253 | of _PTS is used by default). | 253 | of _PTS is used by default). |
254 | s4_nonvs prevents the kernel from saving/restoring the | 254 | s4_nonvs prevents the kernel from saving/restoring the |
255 | ACPI NVS memory during hibernation. | 255 | ACPI NVS memory during hibernation. |
256 | sci_force_enable causes the kernel to set SCI_EN directly | ||
257 | on resume from S1/S3 (which is against the ACPI spec, | ||
258 | but some broken systems don't work without it). | ||
256 | 259 | ||
257 | acpi_use_timer_override [HW,ACPI] | 260 | acpi_use_timer_override [HW,ACPI] |
258 | Use timer override. For some broken Nvidia NF5 boards | 261 | Use timer override. For some broken Nvidia NF5 boards |
diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt index e1a114161027..2811e452f756 100644 --- a/Documentation/kvm/api.txt +++ b/Documentation/kvm/api.txt | |||
@@ -685,7 +685,7 @@ struct kvm_vcpu_events { | |||
685 | __u8 pad; | 685 | __u8 pad; |
686 | } nmi; | 686 | } nmi; |
687 | __u32 sipi_vector; | 687 | __u32 sipi_vector; |
688 | __u32 flags; /* must be zero */ | 688 | __u32 flags; |
689 | }; | 689 | }; |
690 | 690 | ||
691 | 4.30 KVM_SET_VCPU_EVENTS | 691 | 4.30 KVM_SET_VCPU_EVENTS |
@@ -701,6 +701,14 @@ vcpu. | |||
701 | 701 | ||
702 | See KVM_GET_VCPU_EVENTS for the data structure. | 702 | See KVM_GET_VCPU_EVENTS for the data structure. |
703 | 703 | ||
704 | Fields that may be modified asynchronously by running VCPUs can be excluded | ||
705 | from the update. These fields are nmi.pending and sipi_vector. Keep the | ||
706 | corresponding bits in the flags field cleared to suppress overwriting the | ||
707 | current in-kernel state. The bits are: | ||
708 | |||
709 | KVM_VCPUEVENT_VALID_NMI_PENDING - transfer nmi.pending to the kernel | ||
710 | KVM_VCPUEVENT_VALID_SIPI_VECTOR - transfer sipi_vector | ||
711 | |||
704 | 712 | ||
705 | 5. The kvm_run structure | 713 | 5. The kvm_run structure |
706 | 714 | ||
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index 169091f75e6d..75afa1229fd7 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt | |||
@@ -1092,8 +1092,8 @@ WARNING: | |||
1092 | its level up and down at every change. | 1092 | its level up and down at every change. |
1093 | 1093 | ||
1094 | 1094 | ||
1095 | Volume control | 1095 | Volume control (Console Audio control) |
1096 | -------------- | 1096 | -------------------------------------- |
1097 | 1097 | ||
1098 | procfs: /proc/acpi/ibm/volume | 1098 | procfs: /proc/acpi/ibm/volume |
1099 | ALSA: "ThinkPad Console Audio Control", default ID: "ThinkPadEC" | 1099 | ALSA: "ThinkPad Console Audio Control", default ID: "ThinkPadEC" |
@@ -1110,9 +1110,53 @@ the desktop environment to just provide on-screen-display feedback. | |||
1110 | Software volume control should be done only in the main AC97/HDA | 1110 | Software volume control should be done only in the main AC97/HDA |
1111 | mixer. | 1111 | mixer. |
1112 | 1112 | ||
1113 | This feature allows volume control on ThinkPad models with a digital | 1113 | |
1114 | volume knob (when available, not all models have it), as well as | 1114 | About the ThinkPad Console Audio control: |
1115 | mute/unmute control. The available commands are: | 1115 | |
1116 | ThinkPads have a built-in amplifier and muting circuit that drives the | ||
1117 | console headphone and speakers. This circuit is after the main AC97 | ||
1118 | or HDA mixer in the audio path, and under exclusive control of the | ||
1119 | firmware. | ||
1120 | |||
1121 | ThinkPads have three special hotkeys to interact with the console | ||
1122 | audio control: volume up, volume down and mute. | ||
1123 | |||
1124 | It is worth noting that the normal way the mute function works (on | ||
1125 | ThinkPads that do not have a "mute LED") is: | ||
1126 | |||
1127 | 1. Press mute to mute. It will *always* mute, you can press it as | ||
1128 | many times as you want, and the sound will remain mute. | ||
1129 | |||
1130 | 2. Press either volume key to unmute the ThinkPad (it will _not_ | ||
1131 | change the volume, it will just unmute). | ||
1132 | |||
1133 | This is a very superior design when compared to the cheap software-only | ||
1134 | mute-toggle solution found on normal consumer laptops: you can be | ||
1135 | absolutely sure the ThinkPad will not make noise if you press the mute | ||
1136 | button, no matter the previous state. | ||
1137 | |||
1138 | The IBM ThinkPads, and the earlier Lenovo ThinkPads have variable-gain | ||
1139 | amplifiers driving the speakers and headphone output, and the firmware | ||
1140 | also handles volume control for the headphone and speakers on these | ||
1141 | ThinkPads without any help from the operating system (this volume | ||
1142 | control stage exists after the main AC97 or HDA mixer in the audio | ||
1143 | path). | ||
1144 | |||
1145 | The newer Lenovo models only have firmware mute control, and depend on | ||
1146 | the main HDA mixer to do volume control (which is done by the operating | ||
1147 | system). In this case, the volume keys are filtered out for unmute | ||
1148 | key press (there are some firmware bugs in this area) and delivered as | ||
1149 | normal key presses to the operating system (thinkpad-acpi is not | ||
1150 | involved). | ||
1151 | |||
1152 | |||
1153 | The ThinkPad-ACPI volume control: | ||
1154 | |||
1155 | The preferred way to interact with the Console Audio control is the | ||
1156 | ALSA interface. | ||
1157 | |||
1158 | The legacy procfs interface allows one to read the current state, | ||
1159 | and if volume control is enabled, accepts the following commands: | ||
1116 | 1160 | ||
1117 | echo up >/proc/acpi/ibm/volume | 1161 | echo up >/proc/acpi/ibm/volume |
1118 | echo down >/proc/acpi/ibm/volume | 1162 | echo down >/proc/acpi/ibm/volume |
@@ -1121,12 +1165,10 @@ mute/unmute control. The available commands are: | |||
1121 | echo 'level <level>' >/proc/acpi/ibm/volume | 1165 | echo 'level <level>' >/proc/acpi/ibm/volume |
1122 | 1166 | ||
1123 | The <level> number range is 0 to 14 although not all of them may be | 1167 | The <level> number range is 0 to 14 although not all of them may be |
1124 | distinct. The unmute the volume after the mute command, use either the | 1168 | distinct. To unmute the volume after the mute command, use either the |
1125 | up or down command (the level command will not unmute the volume), or | 1169 | up or down command (the level command will not unmute the volume), or |
1126 | the unmute command. | 1170 | the unmute command. |
1127 | 1171 | ||
1128 | The current volume level and mute state is shown in the file. | ||
1129 | |||
1130 | You can use the volume_capabilities parameter to tell the driver | 1172 | You can use the volume_capabilities parameter to tell the driver |
1131 | whether your thinkpad has volume control or mute-only control: | 1173 | whether your thinkpad has volume control or mute-only control: |
1132 | volume_capabilities=1 for mixers with mute and volume control, | 1174 | volume_capabilities=1 for mixers with mute and volume control, |
diff --git a/Documentation/sound/alsa/Procfile.txt b/Documentation/sound/alsa/Procfile.txt index 719a819f8cc2..07301de12cc4 100644 --- a/Documentation/sound/alsa/Procfile.txt +++ b/Documentation/sound/alsa/Procfile.txt | |||
@@ -95,7 +95,7 @@ card*/pcm*/xrun_debug | |||
95 | It takes an integer value, can be changed by writing to this | 95 | It takes an integer value, can be changed by writing to this |
96 | file, such as | 96 | file, such as |
97 | 97 | ||
98 | # cat 5 > /proc/asound/card0/pcm0p/xrun_debug | 98 | # echo 5 > /proc/asound/card0/pcm0p/xrun_debug |
99 | 99 | ||
100 | The value consists of the following bit flags: | 100 | The value consists of the following bit flags: |
101 | bit 0 = Enable XRUN/jiffies debug messages | 101 | bit 0 = Enable XRUN/jiffies debug messages |
diff --git a/Documentation/trace/ftrace-design.txt b/Documentation/trace/ftrace-design.txt index 641a1ef2a7ff..239f14b2b55a 100644 --- a/Documentation/trace/ftrace-design.txt +++ b/Documentation/trace/ftrace-design.txt | |||
@@ -53,14 +53,14 @@ size of the mcount call that is embedded in the function). | |||
53 | For example, if the function foo() calls bar(), when the bar() function calls | 53 | For example, if the function foo() calls bar(), when the bar() function calls |
54 | mcount(), the arguments mcount() will pass to the tracer are: | 54 | mcount(), the arguments mcount() will pass to the tracer are: |
55 | "frompc" - the address bar() will use to return to foo() | 55 | "frompc" - the address bar() will use to return to foo() |
56 | "selfpc" - the address bar() (with _mcount() size adjustment) | 56 | "selfpc" - the address bar() (with mcount() size adjustment) |
57 | 57 | ||
58 | Also keep in mind that this mcount function will be called *a lot*, so | 58 | Also keep in mind that this mcount function will be called *a lot*, so |
59 | optimizing for the default case of no tracer will help the smooth running of | 59 | optimizing for the default case of no tracer will help the smooth running of |
60 | your system when tracing is disabled. So the start of the mcount function is | 60 | your system when tracing is disabled. So the start of the mcount function is |
61 | typically the bare min with checking things before returning. That also means | 61 | typically the bare minimum with checking things before returning. That also |
62 | the code flow should usually kept linear (i.e. no branching in the nop case). | 62 | means the code flow should usually be kept linear (i.e. no branching in the nop |
63 | This is of course an optimization and not a hard requirement. | 63 | case). This is of course an optimization and not a hard requirement. |
64 | 64 | ||
65 | Here is some pseudo code that should help (these functions should actually be | 65 | Here is some pseudo code that should help (these functions should actually be |
66 | implemented in assembly): | 66 | implemented in assembly): |
@@ -131,10 +131,10 @@ some functions to save (hijack) and restore the return address. | |||
131 | 131 | ||
132 | The mcount function should check the function pointers ftrace_graph_return | 132 | The mcount function should check the function pointers ftrace_graph_return |
133 | (compare to ftrace_stub) and ftrace_graph_entry (compare to | 133 | (compare to ftrace_stub) and ftrace_graph_entry (compare to |
134 | ftrace_graph_entry_stub). If either of those are not set to the relevant stub | 134 | ftrace_graph_entry_stub). If either of those is not set to the relevant stub |
135 | function, call the arch-specific function ftrace_graph_caller which in turn | 135 | function, call the arch-specific function ftrace_graph_caller which in turn |
136 | calls the arch-specific function prepare_ftrace_return. Neither of these | 136 | calls the arch-specific function prepare_ftrace_return. Neither of these |
137 | function names are strictly required, but you should use them anyways to stay | 137 | function names is strictly required, but you should use them anyway to stay |
138 | consistent across the architecture ports -- easier to compare & contrast | 138 | consistent across the architecture ports -- easier to compare & contrast |
139 | things. | 139 | things. |
140 | 140 | ||
@@ -144,7 +144,7 @@ but the first argument should be a pointer to the "frompc". Typically this is | |||
144 | located on the stack. This allows the function to hijack the return address | 144 | located on the stack. This allows the function to hijack the return address |
145 | temporarily to have it point to the arch-specific function return_to_handler. | 145 | temporarily to have it point to the arch-specific function return_to_handler. |
146 | That function will simply call the common ftrace_return_to_handler function and | 146 | That function will simply call the common ftrace_return_to_handler function and |
147 | that will return the original return address with which, you can return to the | 147 | that will return the original return address with which you can return to the |
148 | original call site. | 148 | original call site. |
149 | 149 | ||
150 | Here is the updated mcount pseudo code: | 150 | Here is the updated mcount pseudo code: |
diff --git a/Documentation/trace/mmiotrace.txt b/Documentation/trace/mmiotrace.txt index 162effbfbdec..664e7386d89e 100644 --- a/Documentation/trace/mmiotrace.txt +++ b/Documentation/trace/mmiotrace.txt | |||
@@ -44,7 +44,8 @@ Check for lost events. | |||
44 | Usage | 44 | Usage |
45 | ----- | 45 | ----- |
46 | 46 | ||
47 | Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges) | 47 | Make sure debugfs is mounted to /sys/kernel/debug. |
48 | If not (requires root privileges): | ||
48 | $ mount -t debugfs debugfs /sys/kernel/debug | 49 | $ mount -t debugfs debugfs /sys/kernel/debug |
49 | 50 | ||
50 | Check that the driver you are about to trace is not loaded. | 51 | Check that the driver you are about to trace is not loaded. |
@@ -91,7 +92,7 @@ $ dmesg > dmesg.txt | |||
91 | $ tar zcf pciid-nick-mmiotrace.tar.gz mydump.txt lspci.txt dmesg.txt | 92 | $ tar zcf pciid-nick-mmiotrace.tar.gz mydump.txt lspci.txt dmesg.txt |
92 | and then send the .tar.gz file. The trace compresses considerably. Replace | 93 | and then send the .tar.gz file. The trace compresses considerably. Replace |
93 | "pciid" and "nick" with the PCI ID or model name of your piece of hardware | 94 | "pciid" and "nick" with the PCI ID or model name of your piece of hardware |
94 | under investigation and your nick name. | 95 | under investigation and your nickname. |
95 | 96 | ||
96 | 97 | ||
97 | How Mmiotrace Works | 98 | How Mmiotrace Works |
@@ -100,7 +101,7 @@ How Mmiotrace Works | |||
100 | Access to hardware IO-memory is gained by mapping addresses from PCI bus by | 101 | Access to hardware IO-memory is gained by mapping addresses from PCI bus by |
101 | calling one of the ioremap_*() functions. Mmiotrace is hooked into the | 102 | calling one of the ioremap_*() functions. Mmiotrace is hooked into the |
102 | __ioremap() function and gets called whenever a mapping is created. Mapping is | 103 | __ioremap() function and gets called whenever a mapping is created. Mapping is |
103 | an event that is recorded into the trace log. Note, that ISA range mappings | 104 | an event that is recorded into the trace log. Note that ISA range mappings |
104 | are not caught, since the mapping always exists and is returned directly. | 105 | are not caught, since the mapping always exists and is returned directly. |
105 | 106 | ||
106 | MMIO accesses are recorded via page faults. Just before __ioremap() returns, | 107 | MMIO accesses are recorded via page faults. Just before __ioremap() returns, |
@@ -122,11 +123,11 @@ Trace Log Format | |||
122 | ---------------- | 123 | ---------------- |
123 | 124 | ||
124 | The raw log is text and easily filtered with e.g. grep and awk. One record is | 125 | The raw log is text and easily filtered with e.g. grep and awk. One record is |
125 | one line in the log. A record starts with a keyword, followed by keyword | 126 | one line in the log. A record starts with a keyword, followed by keyword- |
126 | dependant arguments. Arguments are separated by a space, or continue until the | 127 | dependent arguments. Arguments are separated by a space, or continue until the |
127 | end of line. The format for version 20070824 is as follows: | 128 | end of line. The format for version 20070824 is as follows: |
128 | 129 | ||
129 | Explanation Keyword Space separated arguments | 130 | Explanation Keyword Space-separated arguments |
130 | --------------------------------------------------------------------------- | 131 | --------------------------------------------------------------------------- |
131 | 132 | ||
132 | read event R width, timestamp, map id, physical, value, PC, PID | 133 | read event R width, timestamp, map id, physical, value, PC, PID |
@@ -136,7 +137,7 @@ iounmap event UNMAP timestamp, map id, PC, PID | |||
136 | marker MARK timestamp, text | 137 | marker MARK timestamp, text |
137 | version VERSION the string "20070824" | 138 | version VERSION the string "20070824" |
138 | info for reader LSPCI one line from lspci -v | 139 | info for reader LSPCI one line from lspci -v |
139 | PCI address map PCIDEV space separated /proc/bus/pci/devices data | 140 | PCI address map PCIDEV space-separated /proc/bus/pci/devices data |
140 | unk. opcode UNKNOWN timestamp, map id, physical, data, PC, PID | 141 | unk. opcode UNKNOWN timestamp, map id, physical, data, PC, PID |
141 | 142 | ||
142 | Timestamp is in seconds with decimals. Physical is a PCI bus address, virtual | 143 | Timestamp is in seconds with decimals. Physical is a PCI bus address, virtual |
diff --git a/Documentation/trace/ring-buffer-design.txt b/Documentation/trace/ring-buffer-design.txt index 5b1d23d604c5..d299ff31df57 100644 --- a/Documentation/trace/ring-buffer-design.txt +++ b/Documentation/trace/ring-buffer-design.txt | |||
@@ -33,9 +33,9 @@ head_page - a pointer to the page that the reader will use next | |||
33 | 33 | ||
34 | tail_page - a pointer to the page that will be written to next | 34 | tail_page - a pointer to the page that will be written to next |
35 | 35 | ||
36 | commit_page - a pointer to the page with the last finished non nested write. | 36 | commit_page - a pointer to the page with the last finished non-nested write. |
37 | 37 | ||
38 | cmpxchg - hardware assisted atomic transaction that performs the following: | 38 | cmpxchg - hardware-assisted atomic transaction that performs the following: |
39 | 39 | ||
40 | A = B iff previous A == C | 40 | A = B iff previous A == C |
41 | 41 | ||
@@ -52,15 +52,15 @@ The Generic Ring Buffer | |||
52 | The ring buffer can be used in either an overwrite mode or in | 52 | The ring buffer can be used in either an overwrite mode or in |
53 | producer/consumer mode. | 53 | producer/consumer mode. |
54 | 54 | ||
55 | Producer/consumer mode is where the producer were to fill up the | 55 | Producer/consumer mode is where if the producer were to fill up the |
56 | buffer before the consumer could free up anything, the producer | 56 | buffer before the consumer could free up anything, the producer |
57 | will stop writing to the buffer. This will lose most recent events. | 57 | will stop writing to the buffer. This will lose most recent events. |
58 | 58 | ||
59 | Overwrite mode is where the produce were to fill up the buffer | 59 | Overwrite mode is where if the producer were to fill up the buffer |
60 | before the consumer could free up anything, the producer will | 60 | before the consumer could free up anything, the producer will |
61 | overwrite the older data. This will lose the oldest events. | 61 | overwrite the older data. This will lose the oldest events. |
62 | 62 | ||
63 | No two writers can write at the same time (on the same per cpu buffer), | 63 | No two writers can write at the same time (on the same per-cpu buffer), |
64 | but a writer may interrupt another writer, but it must finish writing | 64 | but a writer may interrupt another writer, but it must finish writing |
65 | before the previous writer may continue. This is very important to the | 65 | before the previous writer may continue. This is very important to the |
66 | algorithm. The writers act like a "stack". The way interrupts works | 66 | algorithm. The writers act like a "stack". The way interrupts works |
@@ -79,16 +79,16 @@ the interrupt doing a write as well. | |||
79 | 79 | ||
80 | Readers can happen at any time. But no two readers may run at the | 80 | Readers can happen at any time. But no two readers may run at the |
81 | same time, nor can a reader preempt/interrupt another reader. A reader | 81 | same time, nor can a reader preempt/interrupt another reader. A reader |
82 | can not preempt/interrupt a writer, but it may read/consume from the | 82 | cannot preempt/interrupt a writer, but it may read/consume from the |
83 | buffer at the same time as a writer is writing, but the reader must be | 83 | buffer at the same time as a writer is writing, but the reader must be |
84 | on another processor to do so. A reader may read on its own processor | 84 | on another processor to do so. A reader may read on its own processor |
85 | and can be preempted by a writer. | 85 | and can be preempted by a writer. |
86 | 86 | ||
87 | A writer can preempt a reader, but a reader can not preempt a writer. | 87 | A writer can preempt a reader, but a reader cannot preempt a writer. |
88 | But a reader can read the buffer at the same time (on another processor) | 88 | But a reader can read the buffer at the same time (on another processor) |
89 | as a writer. | 89 | as a writer. |
90 | 90 | ||
91 | The ring buffer is made up of a list of pages held together by a link list. | 91 | The ring buffer is made up of a list of pages held together by a linked list. |
92 | 92 | ||
93 | At initialization a reader page is allocated for the reader that is not | 93 | At initialization a reader page is allocated for the reader that is not |
94 | part of the ring buffer. | 94 | part of the ring buffer. |
@@ -102,7 +102,7 @@ the head page. | |||
102 | 102 | ||
103 | The reader has its own page to use. At start up time, this page is | 103 | The reader has its own page to use. At start up time, this page is |
104 | allocated but is not attached to the list. When the reader wants | 104 | allocated but is not attached to the list. When the reader wants |
105 | to read from the buffer, if its page is empty (like it is on start up) | 105 | to read from the buffer, if its page is empty (like it is on start-up), |
106 | it will swap its page with the head_page. The old reader page will | 106 | it will swap its page with the head_page. The old reader page will |
107 | become part of the ring buffer and the head_page will be removed. | 107 | become part of the ring buffer and the head_page will be removed. |
108 | The page after the inserted page (old reader_page) will become the | 108 | The page after the inserted page (old reader_page) will become the |
@@ -206,7 +206,7 @@ The main pointers: | |||
206 | 206 | ||
207 | commit page - the page that last finished a write. | 207 | commit page - the page that last finished a write. |
208 | 208 | ||
209 | The commit page only is updated by the outer most writer in the | 209 | The commit page only is updated by the outermost writer in the |
210 | writer stack. A writer that preempts another writer will not move the | 210 | writer stack. A writer that preempts another writer will not move the |
211 | commit page. | 211 | commit page. |
212 | 212 | ||
@@ -281,7 +281,7 @@ with the previous write. | |||
281 | The commit pointer points to the last write location that was | 281 | The commit pointer points to the last write location that was |
282 | committed without preempting another write. When a write that | 282 | committed without preempting another write. When a write that |
283 | preempted another write is committed, it only becomes a pending commit | 283 | preempted another write is committed, it only becomes a pending commit |
284 | and will not be a full commit till all writes have been committed. | 284 | and will not be a full commit until all writes have been committed. |
285 | 285 | ||
286 | The commit page points to the page that has the last full commit. | 286 | The commit page points to the page that has the last full commit. |
287 | The tail page points to the page with the last write (before | 287 | The tail page points to the page with the last write (before |
@@ -292,7 +292,7 @@ be several pages ahead. If the tail page catches up to the commit | |||
292 | page then no more writes may take place (regardless of the mode | 292 | page then no more writes may take place (regardless of the mode |
293 | of the ring buffer: overwrite and produce/consumer). | 293 | of the ring buffer: overwrite and produce/consumer). |
294 | 294 | ||
295 | The order of pages are: | 295 | The order of pages is: |
296 | 296 | ||
297 | head page | 297 | head page |
298 | commit page | 298 | commit page |
@@ -311,7 +311,7 @@ Possible scenario: | |||
311 | There is a special case that the head page is after either the commit page | 311 | There is a special case that the head page is after either the commit page |
312 | and possibly the tail page. That is when the commit (and tail) page has been | 312 | and possibly the tail page. That is when the commit (and tail) page has been |
313 | swapped with the reader page. This is because the head page is always | 313 | swapped with the reader page. This is because the head page is always |
314 | part of the ring buffer, but the reader page is not. When ever there | 314 | part of the ring buffer, but the reader page is not. Whenever there |
315 | has been less than a full page that has been committed inside the ring buffer, | 315 | has been less than a full page that has been committed inside the ring buffer, |
316 | and a reader swaps out a page, it will be swapping out the commit page. | 316 | and a reader swaps out a page, it will be swapping out the commit page. |
317 | 317 | ||
@@ -338,7 +338,7 @@ and a reader swaps out a page, it will be swapping out the commit page. | |||
338 | In this case, the head page will not move when the tail and commit | 338 | In this case, the head page will not move when the tail and commit |
339 | move back into the ring buffer. | 339 | move back into the ring buffer. |
340 | 340 | ||
341 | The reader can not swap a page into the ring buffer if the commit page | 341 | The reader cannot swap a page into the ring buffer if the commit page |
342 | is still on that page. If the read meets the last commit (real commit | 342 | is still on that page. If the read meets the last commit (real commit |
343 | not pending or reserved), then there is nothing more to read. | 343 | not pending or reserved), then there is nothing more to read. |
344 | The buffer is considered empty until another full commit finishes. | 344 | The buffer is considered empty until another full commit finishes. |
@@ -395,7 +395,7 @@ The main idea behind the lockless algorithm is to combine the moving | |||
395 | of the head_page pointer with the swapping of pages with the reader. | 395 | of the head_page pointer with the swapping of pages with the reader. |
396 | State flags are placed inside the pointer to the page. To do this, | 396 | State flags are placed inside the pointer to the page. To do this, |
397 | each page must be aligned in memory by 4 bytes. This will allow the 2 | 397 | each page must be aligned in memory by 4 bytes. This will allow the 2 |
398 | least significant bits of the address to be used as flags. Since | 398 | least significant bits of the address to be used as flags, since |
399 | they will always be zero for the address. To get the address, | 399 | they will always be zero for the address. To get the address, |
400 | simply mask out the flags. | 400 | simply mask out the flags. |
401 | 401 | ||
@@ -460,7 +460,7 @@ When the reader tries to swap the page with the ring buffer, it | |||
460 | will also use cmpxchg. If the flag bit in the pointer to the | 460 | will also use cmpxchg. If the flag bit in the pointer to the |
461 | head page does not have the HEADER flag set, the compare will fail | 461 | head page does not have the HEADER flag set, the compare will fail |
462 | and the reader will need to look for the new head page and try again. | 462 | and the reader will need to look for the new head page and try again. |
463 | Note, the flag UPDATE and HEADER are never set at the same time. | 463 | Note, the flags UPDATE and HEADER are never set at the same time. |
464 | 464 | ||
465 | The reader swaps the reader page as follows: | 465 | The reader swaps the reader page as follows: |
466 | 466 | ||
@@ -539,7 +539,7 @@ updated to the reader page. | |||
539 | | +-----------------------------+ | | 539 | | +-----------------------------+ | |
540 | +------------------------------------+ | 540 | +------------------------------------+ |
541 | 541 | ||
542 | Another important point. The page that the reader page points back to | 542 | Another important point: The page that the reader page points back to |
543 | by its previous pointer (the one that now points to the new head page) | 543 | by its previous pointer (the one that now points to the new head page) |
544 | never points back to the reader page. That is because the reader page is | 544 | never points back to the reader page. That is because the reader page is |
545 | not part of the ring buffer. Traversing the ring buffer via the next pointers | 545 | not part of the ring buffer. Traversing the ring buffer via the next pointers |
@@ -572,7 +572,7 @@ not be able to swap the head page from the buffer, nor will it be able to | |||
572 | move the head page, until the writer is finished with the move. | 572 | move the head page, until the writer is finished with the move. |
573 | 573 | ||
574 | This eliminates any races that the reader can have on the writer. The reader | 574 | This eliminates any races that the reader can have on the writer. The reader |
575 | must spin, and this is why the reader can not preempt the writer. | 575 | must spin, and this is why the reader cannot preempt the writer. |
576 | 576 | ||
577 | tail page | 577 | tail page |
578 | | | 578 | | |
@@ -659,9 +659,9 @@ before pushing the head page. If it is, then it can be assumed that the | |||
659 | tail page wrapped the buffer, and we must drop new writes. | 659 | tail page wrapped the buffer, and we must drop new writes. |
660 | 660 | ||
661 | This is not a race condition, because the commit page can only be moved | 661 | This is not a race condition, because the commit page can only be moved |
662 | by the outter most writer (the writer that was preempted). | 662 | by the outermost writer (the writer that was preempted). |
663 | This means that the commit will not move while a writer is moving the | 663 | This means that the commit will not move while a writer is moving the |
664 | tail page. The reader can not swap the reader page if it is also being | 664 | tail page. The reader cannot swap the reader page if it is also being |
665 | used as the commit page. The reader can simply check that the commit | 665 | used as the commit page. The reader can simply check that the commit |
666 | is off the reader page. Once the commit page leaves the reader page | 666 | is off the reader page. Once the commit page leaves the reader page |
667 | it will never go back on it unless a reader does another swap with the | 667 | it will never go back on it unless a reader does another swap with the |
@@ -733,7 +733,7 @@ The write converts the head page pointer to UPDATE. | |||
733 | --->| |<---| |<---| |<---| |<--- | 733 | --->| |<---| |<---| |<---| |<--- |
734 | +---+ +---+ +---+ +---+ | 734 | +---+ +---+ +---+ +---+ |
735 | 735 | ||
736 | But if a nested writer preempts here. It will see that the next | 736 | But if a nested writer preempts here, it will see that the next |
737 | page is a head page, but it is also nested. It will detect that | 737 | page is a head page, but it is also nested. It will detect that |
738 | it is nested and will save that information. The detection is the | 738 | it is nested and will save that information. The detection is the |
739 | fact that it sees the UPDATE flag instead of a HEADER or NORMAL | 739 | fact that it sees the UPDATE flag instead of a HEADER or NORMAL |
@@ -761,7 +761,7 @@ to NORMAL. | |||
761 | --->| |<---| |<---| |<---| |<--- | 761 | --->| |<---| |<---| |<---| |<--- |
762 | +---+ +---+ +---+ +---+ | 762 | +---+ +---+ +---+ +---+ |
763 | 763 | ||
764 | After the nested writer finishes, the outer most writer will convert | 764 | After the nested writer finishes, the outermost writer will convert |
765 | the UPDATE pointer to NORMAL. | 765 | the UPDATE pointer to NORMAL. |
766 | 766 | ||
767 | 767 | ||
@@ -812,7 +812,7 @@ head page. | |||
812 | +---+ +---+ +---+ +---+ | 812 | +---+ +---+ +---+ +---+ |
813 | 813 | ||
814 | The nested writer moves the tail page forward. But does not set the old | 814 | The nested writer moves the tail page forward. But does not set the old |
815 | update page to NORMAL because it is not the outer most writer. | 815 | update page to NORMAL because it is not the outermost writer. |
816 | 816 | ||
817 | tail page | 817 | tail page |
818 | | | 818 | | |
@@ -892,7 +892,7 @@ It will return to the first writer. | |||
892 | --->| |<---| |<---| |<---| |<--- | 892 | --->| |<---| |<---| |<---| |<--- |
893 | +---+ +---+ +---+ +---+ | 893 | +---+ +---+ +---+ +---+ |
894 | 894 | ||
895 | The first writer can not know atomically test if the tail page moved | 895 | The first writer cannot know atomically if the tail page moved |
896 | while it updates the HEAD page. It will then update the head page to | 896 | while it updates the HEAD page. It will then update the head page to |
897 | what it thinks is the new head page. | 897 | what it thinks is the new head page. |
898 | 898 | ||
@@ -923,9 +923,9 @@ if the tail page is either where it use to be or on the next page: | |||
923 | --->| |<---| |<---| |<---| |<--- | 923 | --->| |<---| |<---| |<---| |<--- |
924 | +---+ +---+ +---+ +---+ | 924 | +---+ +---+ +---+ +---+ |
925 | 925 | ||
926 | If tail page != A and tail page does not equal B, then it must reset the | 926 | If tail page != A and tail page != B, then it must reset the pointer |
927 | pointer back to NORMAL. The fact that it only needs to worry about | 927 | back to NORMAL. The fact that it only needs to worry about nested |
928 | nested writers, it only needs to check this after setting the HEAD page. | 928 | writers means that it only needs to check this after setting the HEAD page. |
929 | 929 | ||
930 | 930 | ||
931 | (first writer) | 931 | (first writer) |
@@ -939,7 +939,7 @@ nested writers, it only needs to check this after setting the HEAD page. | |||
939 | +---+ +---+ +---+ +---+ | 939 | +---+ +---+ +---+ +---+ |
940 | 940 | ||
941 | Now the writer can update the head page. This is also why the head page must | 941 | Now the writer can update the head page. This is also why the head page must |
942 | remain in UPDATE and only reset by the outer most writer. This prevents | 942 | remain in UPDATE and only reset by the outermost writer. This prevents |
943 | the reader from seeing the incorrect head page. | 943 | the reader from seeing the incorrect head page. |
944 | 944 | ||
945 | 945 | ||
diff --git a/Documentation/trace/tracepoint-analysis.txt b/Documentation/trace/tracepoint-analysis.txt index 5eb4e487e667..87bee3c129ba 100644 --- a/Documentation/trace/tracepoint-analysis.txt +++ b/Documentation/trace/tracepoint-analysis.txt | |||
@@ -10,8 +10,8 @@ Tracepoints (see Documentation/trace/tracepoints.txt) can be used without | |||
10 | creating custom kernel modules to register probe functions using the event | 10 | creating custom kernel modules to register probe functions using the event |
11 | tracing infrastructure. | 11 | tracing infrastructure. |
12 | 12 | ||
13 | Simplistically, tracepoints will represent an important event that when can | 13 | Simplistically, tracepoints represent important events that can be |
14 | be taken in conjunction with other tracepoints to build a "Big Picture" of | 14 | taken in conjunction with other tracepoints to build a "Big Picture" of |
15 | what is going on within the system. There are a large number of methods for | 15 | what is going on within the system. There are a large number of methods for |
16 | gathering and interpreting these events. Lacking any current Best Practises, | 16 | gathering and interpreting these events. Lacking any current Best Practises, |
17 | this document describes some of the methods that can be used. | 17 | this document describes some of the methods that can be used. |
@@ -33,12 +33,12 @@ calling | |||
33 | 33 | ||
34 | will give a fair indication of the number of events available. | 34 | will give a fair indication of the number of events available. |
35 | 35 | ||
36 | 2.2 PCL | 36 | 2.2 PCL (Performance Counters for Linux) |
37 | ------- | 37 | ------- |
38 | 38 | ||
39 | Discovery and enumeration of all counters and events, including tracepoints | 39 | Discovery and enumeration of all counters and events, including tracepoints, |
40 | are available with the perf tool. Getting a list of available events is a | 40 | are available with the perf tool. Getting a list of available events is a |
41 | simple case of | 41 | simple case of: |
42 | 42 | ||
43 | $ perf list 2>&1 | grep Tracepoint | 43 | $ perf list 2>&1 | grep Tracepoint |
44 | ext4:ext4_free_inode [Tracepoint event] | 44 | ext4:ext4_free_inode [Tracepoint event] |
@@ -49,19 +49,19 @@ simple case of | |||
49 | [ .... remaining output snipped .... ] | 49 | [ .... remaining output snipped .... ] |
50 | 50 | ||
51 | 51 | ||
52 | 2. Enabling Events | 52 | 3. Enabling Events |
53 | ================== | 53 | ================== |
54 | 54 | ||
55 | 2.1 System-Wide Event Enabling | 55 | 3.1 System-Wide Event Enabling |
56 | ------------------------------ | 56 | ------------------------------ |
57 | 57 | ||
58 | See Documentation/trace/events.txt for a proper description on how events | 58 | See Documentation/trace/events.txt for a proper description on how events |
59 | can be enabled system-wide. A short example of enabling all events related | 59 | can be enabled system-wide. A short example of enabling all events related |
60 | to page allocation would look something like | 60 | to page allocation would look something like: |
61 | 61 | ||
62 | $ for i in `find /sys/kernel/debug/tracing/events -name "enable" | grep mm_`; do echo 1 > $i; done | 62 | $ for i in `find /sys/kernel/debug/tracing/events -name "enable" | grep mm_`; do echo 1 > $i; done |
63 | 63 | ||
64 | 2.2 System-Wide Event Enabling with SystemTap | 64 | 3.2 System-Wide Event Enabling with SystemTap |
65 | --------------------------------------------- | 65 | --------------------------------------------- |
66 | 66 | ||
67 | In SystemTap, tracepoints are accessible using the kernel.trace() function | 67 | In SystemTap, tracepoints are accessible using the kernel.trace() function |
@@ -86,7 +86,7 @@ were allocating the pages. | |||
86 | print_count() | 86 | print_count() |
87 | } | 87 | } |
88 | 88 | ||
89 | 2.3 System-Wide Event Enabling with PCL | 89 | 3.3 System-Wide Event Enabling with PCL |
90 | --------------------------------------- | 90 | --------------------------------------- |
91 | 91 | ||
92 | By specifying the -a switch and analysing sleep, the system-wide events | 92 | By specifying the -a switch and analysing sleep, the system-wide events |
@@ -107,16 +107,16 @@ for a duration of time can be examined. | |||
107 | Similarly, one could execute a shell and exit it as desired to get a report | 107 | Similarly, one could execute a shell and exit it as desired to get a report |
108 | at that point. | 108 | at that point. |
109 | 109 | ||
110 | 2.4 Local Event Enabling | 110 | 3.4 Local Event Enabling |
111 | ------------------------ | 111 | ------------------------ |
112 | 112 | ||
113 | Documentation/trace/ftrace.txt describes how to enable events on a per-thread | 113 | Documentation/trace/ftrace.txt describes how to enable events on a per-thread |
114 | basis using set_ftrace_pid. | 114 | basis using set_ftrace_pid. |
115 | 115 | ||
116 | 2.5 Local Event Enablement with PCL | 116 | 3.5 Local Event Enablement with PCL |
117 | ----------------------------------- | 117 | ----------------------------------- |
118 | 118 | ||
119 | Events can be activate and tracked for the duration of a process on a local | 119 | Events can be activated and tracked for the duration of a process on a local |
120 | basis using PCL such as follows. | 120 | basis using PCL such as follows. |
121 | 121 | ||
122 | $ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ | 122 | $ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ |
@@ -131,18 +131,18 @@ basis using PCL such as follows. | |||
131 | 131 | ||
132 | 0.973913387 seconds time elapsed | 132 | 0.973913387 seconds time elapsed |
133 | 133 | ||
134 | 3. Event Filtering | 134 | 4. Event Filtering |
135 | ================== | 135 | ================== |
136 | 136 | ||
137 | Documentation/trace/ftrace.txt covers in-depth how to filter events in | 137 | Documentation/trace/ftrace.txt covers in-depth how to filter events in |
138 | ftrace. Obviously using grep and awk of trace_pipe is an option as well | 138 | ftrace. Obviously using grep and awk of trace_pipe is an option as well |
139 | as any script reading trace_pipe. | 139 | as any script reading trace_pipe. |
140 | 140 | ||
141 | 4. Analysing Event Variances with PCL | 141 | 5. Analysing Event Variances with PCL |
142 | ===================================== | 142 | ===================================== |
143 | 143 | ||
144 | Any workload can exhibit variances between runs and it can be important | 144 | Any workload can exhibit variances between runs and it can be important |
145 | to know what the standard deviation in. By and large, this is left to the | 145 | to know what the standard deviation is. By and large, this is left to the |
146 | performance analyst to do it by hand. In the event that the discrete event | 146 | performance analyst to do it by hand. In the event that the discrete event |
147 | occurrences are useful to the performance analyst, then perf can be used. | 147 | occurrences are useful to the performance analyst, then perf can be used. |
148 | 148 | ||
@@ -166,7 +166,7 @@ In the event that some higher-level event is required that depends on some | |||
166 | aggregation of discrete events, then a script would need to be developed. | 166 | aggregation of discrete events, then a script would need to be developed. |
167 | 167 | ||
168 | Using --repeat, it is also possible to view how events are fluctuating over | 168 | Using --repeat, it is also possible to view how events are fluctuating over |
169 | time on a system wide basis using -a and sleep. | 169 | time on a system-wide basis using -a and sleep. |
170 | 170 | ||
171 | $ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ | 171 | $ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ |
172 | -e kmem:mm_pagevec_free \ | 172 | -e kmem:mm_pagevec_free \ |
@@ -180,7 +180,7 @@ time on a system wide basis using -a and sleep. | |||
180 | 180 | ||
181 | 1.002251757 seconds time elapsed ( +- 0.005% ) | 181 | 1.002251757 seconds time elapsed ( +- 0.005% ) |
182 | 182 | ||
183 | 5. Higher-Level Analysis with Helper Scripts | 183 | 6. Higher-Level Analysis with Helper Scripts |
184 | ============================================ | 184 | ============================================ |
185 | 185 | ||
186 | When events are enabled the events that are triggering can be read from | 186 | When events are enabled the events that are triggering can be read from |
@@ -190,11 +190,11 @@ be gathered on-line as appropriate. Examples of post-processing might include | |||
190 | 190 | ||
191 | o Reading information from /proc for the PID that triggered the event | 191 | o Reading information from /proc for the PID that triggered the event |
192 | o Deriving a higher-level event from a series of lower-level events. | 192 | o Deriving a higher-level event from a series of lower-level events. |
193 | o Calculate latencies between two events | 193 | o Calculating latencies between two events |
194 | 194 | ||
195 | Documentation/trace/postprocess/trace-pagealloc-postprocess.pl is an example | 195 | Documentation/trace/postprocess/trace-pagealloc-postprocess.pl is an example |
196 | script that can read trace_pipe from STDIN or a copy of a trace. When used | 196 | script that can read trace_pipe from STDIN or a copy of a trace. When used |
197 | on-line, it can be interrupted once to generate a report without existing | 197 | on-line, it can be interrupted once to generate a report without exiting |
198 | and twice to exit. | 198 | and twice to exit. |
199 | 199 | ||
200 | Simplistically, the script just reads STDIN and counts up events but it | 200 | Simplistically, the script just reads STDIN and counts up events but it |
@@ -212,12 +212,12 @@ also can do more such as | |||
212 | processes, the parent process responsible for creating all the helpers | 212 | processes, the parent process responsible for creating all the helpers |
213 | can be identified | 213 | can be identified |
214 | 214 | ||
215 | 6. Lower-Level Analysis with PCL | 215 | 7. Lower-Level Analysis with PCL |
216 | ================================ | 216 | ================================ |
217 | 217 | ||
218 | There may also be a requirement to identify what functions with a program | 218 | There may also be a requirement to identify what functions within a program |
219 | were generating events within the kernel. To begin this sort of analysis, the | 219 | were generating events within the kernel. To begin this sort of analysis, the |
220 | data must be recorded. At the time of writing, this required root | 220 | data must be recorded. At the time of writing, this required root: |
221 | 221 | ||
222 | $ perf record -c 1 \ | 222 | $ perf record -c 1 \ |
223 | -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ | 223 | -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ |
@@ -253,11 +253,11 @@ perf report. | |||
253 | # (For more details, try: perf report --sort comm,dso,symbol) | 253 | # (For more details, try: perf report --sort comm,dso,symbol) |
254 | # | 254 | # |
255 | 255 | ||
256 | According to this, the vast majority of events occured triggered on events | 256 | According to this, the vast majority of events triggered on events |
257 | within the VDSO. With simple binaries, this will often be the case so lets | 257 | within the VDSO. With simple binaries, this will often be the case so let's |
258 | take a slightly different example. In the course of writing this, it was | 258 | take a slightly different example. In the course of writing this, it was |
259 | noticed that X was generating an insane amount of page allocations so lets look | 259 | noticed that X was generating an insane amount of page allocations so let's look |
260 | at it | 260 | at it: |
261 | 261 | ||
262 | $ perf record -c 1 -f \ | 262 | $ perf record -c 1 -f \ |
263 | -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ | 263 | -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ |
@@ -280,8 +280,8 @@ This was interrupted after a few seconds and | |||
280 | # (For more details, try: perf report --sort comm,dso,symbol) | 280 | # (For more details, try: perf report --sort comm,dso,symbol) |
281 | # | 281 | # |
282 | 282 | ||
283 | So, almost half of the events are occuring in a library. To get an idea which | 283 | So, almost half of the events are occurring in a library. To get an idea which |
284 | symbol. | 284 | symbol: |
285 | 285 | ||
286 | $ perf report --sort comm,dso,symbol | 286 | $ perf report --sort comm,dso,symbol |
287 | # Samples: 27666 | 287 | # Samples: 27666 |
@@ -297,7 +297,7 @@ symbol. | |||
297 | 0.01% Xorg /opt/gfx-test/lib/libpixman-1.so.0.13.1 [.] get_fast_path | 297 | 0.01% Xorg /opt/gfx-test/lib/libpixman-1.so.0.13.1 [.] get_fast_path |
298 | 0.00% Xorg [kernel] [k] ftrace_trace_userstack | 298 | 0.00% Xorg [kernel] [k] ftrace_trace_userstack |
299 | 299 | ||
300 | To see where within the function pixmanFillsse2 things are going wrong | 300 | To see where within the function pixmanFillsse2 things are going wrong: |
301 | 301 | ||
302 | $ perf annotate pixmanFillsse2 | 302 | $ perf annotate pixmanFillsse2 |
303 | [ ... ] | 303 | [ ... ] |
diff --git a/Documentation/vgaarbiter.txt b/Documentation/vgaarbiter.txt index 987f9b0a5ece..43a9b0694fdd 100644 --- a/Documentation/vgaarbiter.txt +++ b/Documentation/vgaarbiter.txt | |||
@@ -103,7 +103,7 @@ I.2 libpciaccess | |||
103 | ---------------- | 103 | ---------------- |
104 | 104 | ||
105 | To use the vga arbiter char device it was implemented an API inside the | 105 | To use the vga arbiter char device it was implemented an API inside the |
106 | libpciaccess library. One fieldd was added to struct pci_device (each device | 106 | libpciaccess library. One field was added to struct pci_device (each device |
107 | on the system): | 107 | on the system): |
108 | 108 | ||
109 | /* the type of resource decoded by the device */ | 109 | /* the type of resource decoded by the device */ |
diff --git a/MAINTAINERS b/MAINTAINERS index 66f5f7dab285..6914588eef89 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2169,10 +2169,9 @@ F: drivers/hwmon/f75375s.c | |||
2169 | F: include/linux/f75375s.h | 2169 | F: include/linux/f75375s.h |
2170 | 2170 | ||
2171 | FIREWIRE SUBSYSTEM | 2171 | FIREWIRE SUBSYSTEM |
2172 | M: Kristian Hoegsberg <krh@redhat.com> | ||
2173 | M: Stefan Richter <stefanr@s5r6.in-berlin.de> | 2172 | M: Stefan Richter <stefanr@s5r6.in-berlin.de> |
2174 | L: linux1394-devel@lists.sourceforge.net | 2173 | L: linux1394-devel@lists.sourceforge.net |
2175 | W: http://www.linux1394.org/ | 2174 | W: http://ieee1394.wiki.kernel.org/ |
2176 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git | 2175 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git |
2177 | S: Maintained | 2176 | S: Maintained |
2178 | F: drivers/firewire/ | 2177 | F: drivers/firewire/ |
@@ -2705,22 +2704,14 @@ S: Supported | |||
2705 | F: drivers/idle/i7300_idle.c | 2704 | F: drivers/idle/i7300_idle.c |
2706 | 2705 | ||
2707 | IEEE 1394 SUBSYSTEM | 2706 | IEEE 1394 SUBSYSTEM |
2708 | M: Ben Collins <ben.collins@ubuntu.com> | ||
2709 | M: Stefan Richter <stefanr@s5r6.in-berlin.de> | 2707 | M: Stefan Richter <stefanr@s5r6.in-berlin.de> |
2710 | L: linux1394-devel@lists.sourceforge.net | 2708 | L: linux1394-devel@lists.sourceforge.net |
2711 | W: http://www.linux1394.org/ | 2709 | W: http://ieee1394.wiki.kernel.org/ |
2712 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git | 2710 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git |
2713 | S: Maintained | 2711 | S: Obsolete |
2714 | F: Documentation/debugging-via-ohci1394.txt | 2712 | F: Documentation/debugging-via-ohci1394.txt |
2715 | F: drivers/ieee1394/ | 2713 | F: drivers/ieee1394/ |
2716 | 2714 | ||
2717 | IEEE 1394 RAW I/O DRIVER | ||
2718 | M: Dan Dennedy <dan@dennedy.org> | ||
2719 | M: Stefan Richter <stefanr@s5r6.in-berlin.de> | ||
2720 | L: linux1394-devel@lists.sourceforge.net | ||
2721 | S: Maintained | ||
2722 | F: drivers/ieee1394/raw1394* | ||
2723 | |||
2724 | IEEE 802.15.4 SUBSYSTEM | 2715 | IEEE 802.15.4 SUBSYSTEM |
2725 | M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2716 | M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
2726 | M: Sergey Lapin <slapin@ossfans.org> | 2717 | M: Sergey Lapin <slapin@ossfans.org> |
@@ -3882,7 +3873,7 @@ F: drivers/net/ni5010.* | |||
3882 | 3873 | ||
3883 | NILFS2 FILESYSTEM | 3874 | NILFS2 FILESYSTEM |
3884 | M: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp> | 3875 | M: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp> |
3885 | L: users@nilfs.org | 3876 | L: linux-nilfs@vger.kernel.org |
3886 | W: http://www.nilfs.org/en/ | 3877 | W: http://www.nilfs.org/en/ |
3887 | S: Supported | 3878 | S: Supported |
3888 | F: Documentation/filesystems/nilfs2.txt | 3879 | F: Documentation/filesystems/nilfs2.txt |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 33 | 3 | SUBLEVEL = 33 |
4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc3 |
5 | NAME = Man-Eating Seals of Antiquity | 5 | NAME = Man-Eating Seals of Antiquity |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 233a222752c0..c2238cd474c7 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -18,6 +18,8 @@ config ARM | |||
18 | select HAVE_KRETPROBES if (HAVE_KPROBES) | 18 | select HAVE_KRETPROBES if (HAVE_KPROBES) |
19 | select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) | 19 | select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) |
20 | select HAVE_GENERIC_DMA_COHERENT | 20 | select HAVE_GENERIC_DMA_COHERENT |
21 | select HAVE_KERNEL_GZIP | ||
22 | select HAVE_KERNEL_LZO | ||
21 | help | 23 | help |
22 | The ARM series is a line of low-power-consumption RISC chip designs | 24 | The ARM series is a line of low-power-consumption RISC chip designs |
23 | licensed by ARM Ltd and targeted at embedded applications and | 25 | licensed by ARM Ltd and targeted at embedded applications and |
@@ -688,6 +690,7 @@ config ARCH_DAVINCI | |||
688 | select HAVE_IDE | 690 | select HAVE_IDE |
689 | select COMMON_CLKDEV | 691 | select COMMON_CLKDEV |
690 | select GENERIC_ALLOCATOR | 692 | select GENERIC_ALLOCATOR |
693 | select ARCH_HAS_HOLES_MEMORYMODEL | ||
691 | help | 694 | help |
692 | Support for TI's DaVinci platform. | 695 | Support for TI's DaVinci platform. |
693 | 696 | ||
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index ce39dc540085..2d4d88ba73bf 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile | |||
@@ -63,8 +63,12 @@ endif | |||
63 | 63 | ||
64 | SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ | 64 | SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ |
65 | 65 | ||
66 | targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ | 66 | suffix_$(CONFIG_KERNEL_GZIP) = gzip |
67 | head.o misc.o $(OBJS) | 67 | suffix_$(CONFIG_KERNEL_LZO) = lzo |
68 | |||
69 | targets := vmlinux vmlinux.lds \ | ||
70 | piggy.$(suffix_y) piggy.$(suffix_y).o \ | ||
71 | font.o font.c head.o misc.o $(OBJS) | ||
68 | 72 | ||
69 | ifeq ($(CONFIG_FUNCTION_TRACER),y) | 73 | ifeq ($(CONFIG_FUNCTION_TRACER),y) |
70 | ORIG_CFLAGS := $(KBUILD_CFLAGS) | 74 | ORIG_CFLAGS := $(KBUILD_CFLAGS) |
@@ -87,22 +91,34 @@ endif | |||
87 | ifneq ($(PARAMS_PHYS),) | 91 | ifneq ($(PARAMS_PHYS),) |
88 | LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) | 92 | LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) |
89 | endif | 93 | endif |
90 | LDFLAGS_vmlinux += -p --no-undefined -X \ | 94 | # ? |
91 | $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name) -T | 95 | LDFLAGS_vmlinux += -p |
96 | # Report unresolved symbol references | ||
97 | LDFLAGS_vmlinux += --no-undefined | ||
98 | # Delete all temporary local symbols | ||
99 | LDFLAGS_vmlinux += -X | ||
100 | # Next argument is a linker script | ||
101 | LDFLAGS_vmlinux += -T | ||
102 | |||
103 | # For __aeabi_uidivmod | ||
104 | lib1funcs = $(obj)/lib1funcs.o | ||
105 | |||
106 | $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE | ||
107 | $(call cmd,shipped) | ||
92 | 108 | ||
93 | # Don't allow any static data in misc.o, which | 109 | # Don't allow any static data in misc.o, which |
94 | # would otherwise mess up our GOT table | 110 | # would otherwise mess up our GOT table |
95 | CFLAGS_misc.o := -Dstatic= | 111 | CFLAGS_misc.o := -Dstatic= |
96 | 112 | ||
97 | $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \ | 113 | $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ |
98 | $(addprefix $(obj)/, $(OBJS)) FORCE | 114 | $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE |
99 | $(call if_changed,ld) | 115 | $(call if_changed,ld) |
100 | @: | 116 | @: |
101 | 117 | ||
102 | $(obj)/piggy.gz: $(obj)/../Image FORCE | 118 | $(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE |
103 | $(call if_changed,gzip) | 119 | $(call if_changed,$(suffix_y)) |
104 | 120 | ||
105 | $(obj)/piggy.o: $(obj)/piggy.gz FORCE | 121 | $(obj)/piggy.$(suffix_y).o: $(obj)/piggy.$(suffix_y) FORCE |
106 | 122 | ||
107 | CFLAGS_font.o := -Dstatic= | 123 | CFLAGS_font.o := -Dstatic= |
108 | 124 | ||
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 17153b54613b..7e0fe4d42c7b 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c | |||
@@ -18,10 +18,15 @@ | |||
18 | 18 | ||
19 | unsigned int __machine_arch_type; | 19 | unsigned int __machine_arch_type; |
20 | 20 | ||
21 | #define _LINUX_STRING_H_ | ||
22 | |||
21 | #include <linux/compiler.h> /* for inline */ | 23 | #include <linux/compiler.h> /* for inline */ |
22 | #include <linux/types.h> /* for size_t */ | 24 | #include <linux/types.h> /* for size_t */ |
23 | #include <linux/stddef.h> /* for NULL */ | 25 | #include <linux/stddef.h> /* for NULL */ |
24 | #include <asm/string.h> | 26 | #include <asm/string.h> |
27 | #include <linux/linkage.h> | ||
28 | |||
29 | #include <asm/unaligned.h> | ||
25 | 30 | ||
26 | #ifdef STANDALONE_DEBUG | 31 | #ifdef STANDALONE_DEBUG |
27 | #define putstr printf | 32 | #define putstr printf |
@@ -188,34 +193,8 @@ static inline __ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src, | |||
188 | /* | 193 | /* |
189 | * gzip delarations | 194 | * gzip delarations |
190 | */ | 195 | */ |
191 | #define OF(args) args | ||
192 | #define STATIC static | 196 | #define STATIC static |
193 | 197 | ||
194 | typedef unsigned char uch; | ||
195 | typedef unsigned short ush; | ||
196 | typedef unsigned long ulg; | ||
197 | |||
198 | #define WSIZE 0x8000 /* Window size must be at least 32k, */ | ||
199 | /* and a power of two */ | ||
200 | |||
201 | static uch *inbuf; /* input buffer */ | ||
202 | static uch window[WSIZE]; /* Sliding window buffer */ | ||
203 | |||
204 | static unsigned insize; /* valid bytes in inbuf */ | ||
205 | static unsigned inptr; /* index of next byte to be processed in inbuf */ | ||
206 | static unsigned outcnt; /* bytes in output buffer */ | ||
207 | |||
208 | /* gzip flag byte */ | ||
209 | #define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ | ||
210 | #define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ | ||
211 | #define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ | ||
212 | #define ORIG_NAME 0x08 /* bit 3 set: original file name present */ | ||
213 | #define COMMENT 0x10 /* bit 4 set: file comment present */ | ||
214 | #define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ | ||
215 | #define RESERVED 0xC0 /* bit 6,7: reserved */ | ||
216 | |||
217 | #define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) | ||
218 | |||
219 | /* Diagnostic functions */ | 198 | /* Diagnostic functions */ |
220 | #ifdef DEBUG | 199 | #ifdef DEBUG |
221 | # define Assert(cond,msg) {if(!(cond)) error(msg);} | 200 | # define Assert(cond,msg) {if(!(cond)) error(msg);} |
@@ -233,24 +212,20 @@ static unsigned outcnt; /* bytes in output buffer */ | |||
233 | # define Tracecv(c,x) | 212 | # define Tracecv(c,x) |
234 | #endif | 213 | #endif |
235 | 214 | ||
236 | static int fill_inbuf(void); | ||
237 | static void flush_window(void); | ||
238 | static void error(char *m); | 215 | static void error(char *m); |
239 | 216 | ||
240 | extern char input_data[]; | 217 | extern char input_data[]; |
241 | extern char input_data_end[]; | 218 | extern char input_data_end[]; |
242 | 219 | ||
243 | static uch *output_data; | 220 | static unsigned char *output_data; |
244 | static ulg output_ptr; | 221 | static unsigned long output_ptr; |
245 | static ulg bytes_out; | ||
246 | 222 | ||
247 | static void error(char *m); | 223 | static void error(char *m); |
248 | 224 | ||
249 | static void putstr(const char *); | 225 | static void putstr(const char *); |
250 | 226 | ||
251 | extern int end; | 227 | static unsigned long free_mem_ptr; |
252 | static ulg free_mem_ptr; | 228 | static unsigned long free_mem_end_ptr; |
253 | static ulg free_mem_end_ptr; | ||
254 | 229 | ||
255 | #ifdef STANDALONE_DEBUG | 230 | #ifdef STANDALONE_DEBUG |
256 | #define NO_INFLATE_MALLOC | 231 | #define NO_INFLATE_MALLOC |
@@ -258,46 +233,13 @@ static ulg free_mem_end_ptr; | |||
258 | 233 | ||
259 | #define ARCH_HAS_DECOMP_WDOG | 234 | #define ARCH_HAS_DECOMP_WDOG |
260 | 235 | ||
261 | #include "../../../../lib/inflate.c" | 236 | #ifdef CONFIG_KERNEL_GZIP |
262 | 237 | #include "../../../../lib/decompress_inflate.c" | |
263 | /* =========================================================================== | 238 | #endif |
264 | * Fill the input buffer. This is called only when the buffer is empty | ||
265 | * and at least one byte is really needed. | ||
266 | */ | ||
267 | int fill_inbuf(void) | ||
268 | { | ||
269 | if (insize != 0) | ||
270 | error("ran out of input data"); | ||
271 | |||
272 | inbuf = input_data; | ||
273 | insize = &input_data_end[0] - &input_data[0]; | ||
274 | |||
275 | inptr = 1; | ||
276 | return inbuf[0]; | ||
277 | } | ||
278 | 239 | ||
279 | /* =========================================================================== | 240 | #ifdef CONFIG_KERNEL_LZO |
280 | * Write the output window window[0..outcnt-1] and update crc and bytes_out. | 241 | #include "../../../../lib/decompress_unlzo.c" |
281 | * (Used for the decompressed data only.) | 242 | #endif |
282 | */ | ||
283 | void flush_window(void) | ||
284 | { | ||
285 | ulg c = crc; | ||
286 | unsigned n; | ||
287 | uch *in, *out, ch; | ||
288 | |||
289 | in = window; | ||
290 | out = &output_data[output_ptr]; | ||
291 | for (n = 0; n < outcnt; n++) { | ||
292 | ch = *out++ = *in++; | ||
293 | c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); | ||
294 | } | ||
295 | crc = c; | ||
296 | bytes_out += (ulg)outcnt; | ||
297 | output_ptr += (ulg)outcnt; | ||
298 | outcnt = 0; | ||
299 | putstr("."); | ||
300 | } | ||
301 | 243 | ||
302 | #ifndef arch_error | 244 | #ifndef arch_error |
303 | #define arch_error(x) | 245 | #define arch_error(x) |
@@ -314,22 +256,33 @@ static void error(char *x) | |||
314 | while(1); /* Halt */ | 256 | while(1); /* Halt */ |
315 | } | 257 | } |
316 | 258 | ||
259 | asmlinkage void __div0(void) | ||
260 | { | ||
261 | error("Attempting division by 0!"); | ||
262 | } | ||
263 | |||
317 | #ifndef STANDALONE_DEBUG | 264 | #ifndef STANDALONE_DEBUG |
318 | 265 | ||
319 | ulg | 266 | unsigned long |
320 | decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, | 267 | decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, |
321 | int arch_id) | 268 | unsigned long free_mem_ptr_end_p, |
269 | int arch_id) | ||
322 | { | 270 | { |
323 | output_data = (uch *)output_start; /* Points to kernel start */ | 271 | unsigned char *tmp; |
272 | |||
273 | output_data = (unsigned char *)output_start; | ||
324 | free_mem_ptr = free_mem_ptr_p; | 274 | free_mem_ptr = free_mem_ptr_p; |
325 | free_mem_end_ptr = free_mem_ptr_end_p; | 275 | free_mem_end_ptr = free_mem_ptr_end_p; |
326 | __machine_arch_type = arch_id; | 276 | __machine_arch_type = arch_id; |
327 | 277 | ||
328 | arch_decomp_setup(); | 278 | arch_decomp_setup(); |
329 | 279 | ||
330 | makecrc(); | 280 | tmp = (unsigned char *) (((unsigned long)input_data_end) - 4); |
281 | output_ptr = get_unaligned_le32(tmp); | ||
282 | |||
331 | putstr("Uncompressing Linux..."); | 283 | putstr("Uncompressing Linux..."); |
332 | gunzip(); | 284 | decompress(input_data, input_data_end - input_data, |
285 | NULL, NULL, output_data, NULL, error); | ||
333 | putstr(" done, booting the kernel.\n"); | 286 | putstr(" done, booting the kernel.\n"); |
334 | return output_ptr; | 287 | return output_ptr; |
335 | } | 288 | } |
@@ -341,11 +294,10 @@ int main() | |||
341 | { | 294 | { |
342 | output_data = output_buffer; | 295 | output_data = output_buffer; |
343 | 296 | ||
344 | makecrc(); | ||
345 | putstr("Uncompressing Linux..."); | 297 | putstr("Uncompressing Linux..."); |
346 | gunzip(); | 298 | decompress(input_data, input_data_end - input_data, |
299 | NULL, NULL, output_data, NULL, error); | ||
347 | putstr("done.\n"); | 300 | putstr("done.\n"); |
348 | return 0; | 301 | return 0; |
349 | } | 302 | } |
350 | #endif | 303 | #endif |
351 | |||
diff --git a/arch/arm/boot/compressed/piggy.gzip.S b/arch/arm/boot/compressed/piggy.gzip.S new file mode 100644 index 000000000000..a68adf91a165 --- /dev/null +++ b/arch/arm/boot/compressed/piggy.gzip.S | |||
@@ -0,0 +1,6 @@ | |||
1 | .section .piggydata,#alloc | ||
2 | .globl input_data | ||
3 | input_data: | ||
4 | .incbin "arch/arm/boot/compressed/piggy.gzip" | ||
5 | .globl input_data_end | ||
6 | input_data_end: | ||
diff --git a/arch/arm/boot/compressed/piggy.S b/arch/arm/boot/compressed/piggy.lzo.S index 54c951800ebd..a425ad95959a 100644 --- a/arch/arm/boot/compressed/piggy.S +++ b/arch/arm/boot/compressed/piggy.lzo.S | |||
@@ -1,6 +1,6 @@ | |||
1 | .section .piggydata,#alloc | 1 | .section .piggydata,#alloc |
2 | .globl input_data | 2 | .globl input_data |
3 | input_data: | 3 | input_data: |
4 | .incbin "arch/arm/boot/compressed/piggy.gz" | 4 | .incbin "arch/arm/boot/compressed/piggy.lzo" |
5 | .globl input_data_end | 5 | .globl input_data_end |
6 | input_data_end: | 6 | input_data_end: |
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c index a9b650dcc172..077ecf4fecda 100644 --- a/arch/arm/mach-davinci/board-dm355-evm.c +++ b/arch/arm/mach-davinci/board-dm355-evm.c | |||
@@ -236,6 +236,7 @@ static struct vpfe_subdev_info vpfe_sub_devs[] = { | |||
236 | 236 | ||
237 | static struct vpfe_config vpfe_cfg = { | 237 | static struct vpfe_config vpfe_cfg = { |
238 | .num_subdevs = ARRAY_SIZE(vpfe_sub_devs), | 238 | .num_subdevs = ARRAY_SIZE(vpfe_sub_devs), |
239 | .i2c_adapter_id = 1, | ||
239 | .sub_devs = vpfe_sub_devs, | 240 | .sub_devs = vpfe_sub_devs, |
240 | .card_name = "DM355 EVM", | 241 | .card_name = "DM355 EVM", |
241 | .ccdc = "DM355 CCDC", | 242 | .ccdc = "DM355 CCDC", |
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index 289fe1b7d25a..b476395d2cd4 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c | |||
@@ -192,7 +192,11 @@ static struct davinci_i2c_platform_data i2c_pdata = { | |||
192 | .bus_delay = 0 /* usec */, | 192 | .bus_delay = 0 /* usec */, |
193 | }; | 193 | }; |
194 | 194 | ||
195 | #ifdef CONFIG_KEYBOARD_DAVINCI | 195 | static int dm365evm_keyscan_enable(struct device *dev) |
196 | { | ||
197 | return davinci_cfg_reg(DM365_KEYSCAN); | ||
198 | } | ||
199 | |||
196 | static unsigned short dm365evm_keymap[] = { | 200 | static unsigned short dm365evm_keymap[] = { |
197 | KEY_KP2, | 201 | KEY_KP2, |
198 | KEY_LEFT, | 202 | KEY_LEFT, |
@@ -214,6 +218,7 @@ static unsigned short dm365evm_keymap[] = { | |||
214 | }; | 218 | }; |
215 | 219 | ||
216 | static struct davinci_ks_platform_data dm365evm_ks_data = { | 220 | static struct davinci_ks_platform_data dm365evm_ks_data = { |
221 | .device_enable = dm365evm_keyscan_enable, | ||
217 | .keymap = dm365evm_keymap, | 222 | .keymap = dm365evm_keymap, |
218 | .keymapsize = ARRAY_SIZE(dm365evm_keymap), | 223 | .keymapsize = ARRAY_SIZE(dm365evm_keymap), |
219 | .rep = 1, | 224 | .rep = 1, |
@@ -222,7 +227,6 @@ static struct davinci_ks_platform_data dm365evm_ks_data = { | |||
222 | .interval = 0x2, | 227 | .interval = 0x2, |
223 | .matrix_type = DAVINCI_KEYSCAN_MATRIX_4X4, | 228 | .matrix_type = DAVINCI_KEYSCAN_MATRIX_4X4, |
224 | }; | 229 | }; |
225 | #endif | ||
226 | 230 | ||
227 | static int cpld_mmc_get_cd(int module) | 231 | static int cpld_mmc_get_cd(int module) |
228 | { | 232 | { |
@@ -511,10 +515,7 @@ static __init void dm365_evm_init(void) | |||
511 | 515 | ||
512 | dm365_init_asp(&dm365_evm_snd_data); | 516 | dm365_init_asp(&dm365_evm_snd_data); |
513 | dm365_init_rtc(); | 517 | dm365_init_rtc(); |
514 | |||
515 | #ifdef CONFIG_KEYBOARD_DAVINCI | ||
516 | dm365_init_ks(&dm365evm_ks_data); | 518 | dm365_init_ks(&dm365evm_ks_data); |
517 | #endif | ||
518 | } | 519 | } |
519 | 520 | ||
520 | static __init void dm365_evm_irq_init(void) | 521 | static __init void dm365_evm_irq_init(void) |
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index fd0398bc6db3..e9612cf727b7 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c | |||
@@ -247,6 +247,7 @@ static struct vpfe_subdev_info vpfe_sub_devs[] = { | |||
247 | 247 | ||
248 | static struct vpfe_config vpfe_cfg = { | 248 | static struct vpfe_config vpfe_cfg = { |
249 | .num_subdevs = ARRAY_SIZE(vpfe_sub_devs), | 249 | .num_subdevs = ARRAY_SIZE(vpfe_sub_devs), |
250 | .i2c_adapter_id = 1, | ||
250 | .sub_devs = vpfe_sub_devs, | 251 | .sub_devs = vpfe_sub_devs, |
251 | .card_name = "DM6446 EVM", | 252 | .card_name = "DM6446 EVM", |
252 | .ccdc = "DM6446 CCDC", | 253 | .ccdc = "DM6446 CCDC", |
diff --git a/arch/arm/mach-davinci/cp_intc.c b/arch/arm/mach-davinci/cp_intc.c index 52b287cf3a42..37311d1830eb 100644 --- a/arch/arm/mach-davinci/cp_intc.c +++ b/arch/arm/mach-davinci/cp_intc.c | |||
@@ -81,12 +81,23 @@ static int cp_intc_set_irq_type(unsigned int irq, unsigned int flow_type) | |||
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | 83 | ||
84 | /* | ||
85 | * Faking this allows us to to work with suspend functions of | ||
86 | * generic drivers which call {enable|disable}_irq_wake for | ||
87 | * wake up interrupt sources (eg RTC on DA850). | ||
88 | */ | ||
89 | static int cp_intc_set_wake(unsigned int irq, unsigned int on) | ||
90 | { | ||
91 | return 0; | ||
92 | } | ||
93 | |||
84 | static struct irq_chip cp_intc_irq_chip = { | 94 | static struct irq_chip cp_intc_irq_chip = { |
85 | .name = "cp_intc", | 95 | .name = "cp_intc", |
86 | .ack = cp_intc_ack_irq, | 96 | .ack = cp_intc_ack_irq, |
87 | .mask = cp_intc_mask_irq, | 97 | .mask = cp_intc_mask_irq, |
88 | .unmask = cp_intc_unmask_irq, | 98 | .unmask = cp_intc_unmask_irq, |
89 | .set_type = cp_intc_set_irq_type, | 99 | .set_type = cp_intc_set_irq_type, |
100 | .set_wake = cp_intc_set_wake, | ||
90 | }; | 101 | }; |
91 | 102 | ||
92 | void __init cp_intc_init(void __iomem *base, unsigned short num_irq, | 103 | void __init cp_intc_init(void __iomem *base, unsigned short num_irq, |
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index dd2d32c4ce86..a5105f03fd86 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c | |||
@@ -481,11 +481,18 @@ static struct platform_device da8xx_rtc_device = { | |||
481 | 481 | ||
482 | int da8xx_register_rtc(void) | 482 | int da8xx_register_rtc(void) |
483 | { | 483 | { |
484 | int ret; | ||
485 | |||
484 | /* Unlock the rtc's registers */ | 486 | /* Unlock the rtc's registers */ |
485 | __raw_writel(0x83e70b13, IO_ADDRESS(DA8XX_RTC_BASE + 0x6c)); | 487 | __raw_writel(0x83e70b13, IO_ADDRESS(DA8XX_RTC_BASE + 0x6c)); |
486 | __raw_writel(0x95a4f1e0, IO_ADDRESS(DA8XX_RTC_BASE + 0x70)); | 488 | __raw_writel(0x95a4f1e0, IO_ADDRESS(DA8XX_RTC_BASE + 0x70)); |
487 | 489 | ||
488 | return platform_device_register(&da8xx_rtc_device); | 490 | ret = platform_device_register(&da8xx_rtc_device); |
491 | if (!ret) | ||
492 | /* Atleast on DA850, RTC is a wakeup source */ | ||
493 | device_init_wakeup(&da8xx_rtc_device.dev, true); | ||
494 | |||
495 | return ret; | ||
489 | } | 496 | } |
490 | 497 | ||
491 | static struct resource da8xx_cpuidle_resources[] = { | 498 | static struct resource da8xx_cpuidle_resources[] = { |
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index 2ec619ec1657..f53735cb922e 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c | |||
@@ -993,7 +993,6 @@ void __init dm365_init_asp(struct snd_platform_data *pdata) | |||
993 | 993 | ||
994 | void __init dm365_init_ks(struct davinci_ks_platform_data *pdata) | 994 | void __init dm365_init_ks(struct davinci_ks_platform_data *pdata) |
995 | { | 995 | { |
996 | davinci_cfg_reg(DM365_KEYSCAN); | ||
997 | dm365_ks_device.dev.platform_data = pdata; | 996 | dm365_ks_device.dev.platform_data = pdata; |
998 | platform_device_register(&dm365_ks_device); | 997 | platform_device_register(&dm365_ks_device); |
999 | } | 998 | } |
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c index 8f49b2b12608..b22dec4abf78 100644 --- a/arch/arm/mach-mmp/ttc_dkb.c +++ b/arch/arm/mach-mmp/ttc_dkb.c | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | #include "common.h" | 25 | #include "common.h" |
26 | 26 | ||
27 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) | ||
28 | |||
29 | static unsigned long ttc_dkb_pin_config[] __initdata = { | 27 | static unsigned long ttc_dkb_pin_config[] __initdata = { |
30 | /* UART2 */ | 28 | /* UART2 */ |
31 | GPIO47_UART2_RXD, | 29 | GPIO47_UART2_RXD, |
diff --git a/arch/arm/mach-mx2/mxt_td60.c b/arch/arm/mach-mx2/mxt_td60.c index 03dbbdc98955..8bcc1a5b8829 100644 --- a/arch/arm/mach-mx2/mxt_td60.c +++ b/arch/arm/mach-mx2/mxt_td60.c | |||
@@ -58,21 +58,6 @@ static unsigned int mxt_td60_pins[] __initdata = { | |||
58 | PE9_PF_UART3_RXD, | 58 | PE9_PF_UART3_RXD, |
59 | PE10_PF_UART3_CTS, | 59 | PE10_PF_UART3_CTS, |
60 | PE11_PF_UART3_RTS, | 60 | PE11_PF_UART3_RTS, |
61 | /* UART3 */ | ||
62 | PB26_AF_UART4_RTS, | ||
63 | PB28_AF_UART4_TXD, | ||
64 | PB29_AF_UART4_CTS, | ||
65 | PB31_AF_UART4_RXD, | ||
66 | /* UART4 */ | ||
67 | PB18_AF_UART5_TXD, | ||
68 | PB19_AF_UART5_RXD, | ||
69 | PB20_AF_UART5_CTS, | ||
70 | PB21_AF_UART5_RTS, | ||
71 | /* UART5 */ | ||
72 | PB10_AF_UART6_TXD, | ||
73 | PB12_AF_UART6_CTS, | ||
74 | PB11_AF_UART6_RXD, | ||
75 | PB13_AF_UART6_RTS, | ||
76 | /* FEC */ | 61 | /* FEC */ |
77 | PD0_AIN_FEC_TXD0, | 62 | PD0_AIN_FEC_TXD0, |
78 | PD1_AIN_FEC_TXD1, | 63 | PD1_AIN_FEC_TXD1, |
@@ -261,12 +246,6 @@ static struct imxuart_platform_data uart_pdata[] = { | |||
261 | .flags = IMXUART_HAVE_RTSCTS, | 246 | .flags = IMXUART_HAVE_RTSCTS, |
262 | }, { | 247 | }, { |
263 | .flags = IMXUART_HAVE_RTSCTS, | 248 | .flags = IMXUART_HAVE_RTSCTS, |
264 | }, { | ||
265 | .flags = IMXUART_HAVE_RTSCTS, | ||
266 | }, { | ||
267 | .flags = IMXUART_HAVE_RTSCTS, | ||
268 | }, { | ||
269 | .flags = IMXUART_HAVE_RTSCTS, | ||
270 | }, | 249 | }, |
271 | }; | 250 | }; |
272 | 251 | ||
@@ -278,9 +257,6 @@ static void __init mxt_td60_board_init(void) | |||
278 | mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); | 257 | mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); |
279 | mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); | 258 | mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); |
280 | mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); | 259 | mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); |
281 | mxc_register_device(&mxc_uart_device3, &uart_pdata[3]); | ||
282 | mxc_register_device(&mxc_uart_device4, &uart_pdata[4]); | ||
283 | mxc_register_device(&mxc_uart_device5, &uart_pdata[5]); | ||
284 | mxc_register_device(&mxc_nand_device, &mxt_td60_nand_board_info); | 260 | mxc_register_device(&mxc_nand_device, &mxt_td60_nand_board_info); |
285 | 261 | ||
286 | i2c_register_board_info(0, mxt_td60_i2c_devices, | 262 | i2c_register_board_info(0, mxt_td60_i2c_devices, |
diff --git a/arch/arm/mach-mx25/clock.c b/arch/arm/mach-mx25/clock.c index ef26951a5275..6e838b857712 100644 --- a/arch/arm/mach-mx25/clock.c +++ b/arch/arm/mach-mx25/clock.c | |||
@@ -173,6 +173,7 @@ DEFINE_CLOCK(pwm4_clk, 0, CCM_CGCR2, 2, get_rate_ipg, NULL); | |||
173 | DEFINE_CLOCK(kpp_clk, 0, CCM_CGCR1, 28, get_rate_ipg, NULL); | 173 | DEFINE_CLOCK(kpp_clk, 0, CCM_CGCR1, 28, get_rate_ipg, NULL); |
174 | DEFINE_CLOCK(tsc_clk, 0, CCM_CGCR2, 13, get_rate_ipg, NULL); | 174 | DEFINE_CLOCK(tsc_clk, 0, CCM_CGCR2, 13, get_rate_ipg, NULL); |
175 | DEFINE_CLOCK(i2c_clk, 0, CCM_CGCR0, 6, get_rate_i2c, NULL); | 175 | DEFINE_CLOCK(i2c_clk, 0, CCM_CGCR0, 6, get_rate_i2c, NULL); |
176 | DEFINE_CLOCK(fec_clk, 0, CCM_CGCR0, 23, get_rate_ipg, NULL); | ||
176 | 177 | ||
177 | #define _REGISTER_CLOCK(d, n, c) \ | 178 | #define _REGISTER_CLOCK(d, n, c) \ |
178 | { \ | 179 | { \ |
@@ -204,6 +205,7 @@ static struct clk_lookup lookups[] = { | |||
204 | _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) | 205 | _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) |
205 | _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk) | 206 | _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk) |
206 | _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk) | 207 | _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk) |
208 | _REGISTER_CLOCK("fec.0", NULL, fec_clk) | ||
207 | }; | 209 | }; |
208 | 210 | ||
209 | int __init mx25_clocks_init(unsigned long fref) | 211 | int __init mx25_clocks_init(unsigned long fref) |
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c index 63511de3a559..9fdeea1c083b 100644 --- a/arch/arm/mach-mx25/devices.c +++ b/arch/arm/mach-mx25/devices.c | |||
@@ -419,3 +419,22 @@ int __init mxc_register_gpios(void) | |||
419 | return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); | 419 | return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); |
420 | } | 420 | } |
421 | 421 | ||
422 | static struct resource mx25_fec_resources[] = { | ||
423 | { | ||
424 | .start = MX25_FEC_BASE_ADDR, | ||
425 | .end = MX25_FEC_BASE_ADDR + 0xfff, | ||
426 | .flags = IORESOURCE_MEM, | ||
427 | }, | ||
428 | { | ||
429 | .start = MX25_INT_FEC, | ||
430 | .end = MX25_INT_FEC, | ||
431 | .flags = IORESOURCE_IRQ, | ||
432 | }, | ||
433 | }; | ||
434 | |||
435 | struct platform_device mx25_fec_device = { | ||
436 | .name = "fec", | ||
437 | .id = 0, | ||
438 | .num_resources = ARRAY_SIZE(mx25_fec_resources), | ||
439 | .resource = mx25_fec_resources, | ||
440 | }; | ||
diff --git a/arch/arm/mach-mx25/devices.h b/arch/arm/mach-mx25/devices.h index fe6bf88ad1dd..fe5420fcd11f 100644 --- a/arch/arm/mach-mx25/devices.h +++ b/arch/arm/mach-mx25/devices.h | |||
@@ -17,3 +17,4 @@ extern struct platform_device mxc_keypad_device; | |||
17 | extern struct platform_device mxc_i2c_device0; | 17 | extern struct platform_device mxc_i2c_device0; |
18 | extern struct platform_device mxc_i2c_device1; | 18 | extern struct platform_device mxc_i2c_device1; |
19 | extern struct platform_device mxc_i2c_device2; | 19 | extern struct platform_device mxc_i2c_device2; |
20 | extern struct platform_device mx25_fec_device; | ||
diff --git a/arch/arm/mach-mx25/mx25pdk.c b/arch/arm/mach-mx25/mx25pdk.c index d23ae571c03f..921bc99ea231 100644 --- a/arch/arm/mach-mx25/mx25pdk.c +++ b/arch/arm/mach-mx25/mx25pdk.c | |||
@@ -18,10 +18,11 @@ | |||
18 | 18 | ||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/delay.h> | ||
21 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
22 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
23 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
24 | #include <linux/smsc911x.h> | 25 | #include <linux/fec.h> |
25 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
26 | 27 | ||
27 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
@@ -35,16 +36,57 @@ | |||
35 | #include <mach/mx25.h> | 36 | #include <mach/mx25.h> |
36 | #include <mach/mxc_nand.h> | 37 | #include <mach/mxc_nand.h> |
37 | #include "devices.h" | 38 | #include "devices.h" |
38 | #include <mach/iomux-v3.h> | 39 | #include <mach/iomux.h> |
39 | 40 | ||
40 | static struct imxuart_platform_data uart_pdata = { | 41 | static struct imxuart_platform_data uart_pdata = { |
41 | .flags = IMXUART_HAVE_RTSCTS, | 42 | .flags = IMXUART_HAVE_RTSCTS, |
42 | }; | 43 | }; |
43 | 44 | ||
45 | static struct pad_desc mx25pdk_pads[] = { | ||
46 | MX25_PAD_FEC_MDC__FEC_MDC, | ||
47 | MX25_PAD_FEC_MDIO__FEC_MDIO, | ||
48 | MX25_PAD_FEC_TDATA0__FEC_TDATA0, | ||
49 | MX25_PAD_FEC_TDATA1__FEC_TDATA1, | ||
50 | MX25_PAD_FEC_TX_EN__FEC_TX_EN, | ||
51 | MX25_PAD_FEC_RDATA0__FEC_RDATA0, | ||
52 | MX25_PAD_FEC_RDATA1__FEC_RDATA1, | ||
53 | MX25_PAD_FEC_RX_DV__FEC_RX_DV, | ||
54 | MX25_PAD_FEC_TX_CLK__FEC_TX_CLK, | ||
55 | MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */ | ||
56 | MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */ | ||
57 | }; | ||
58 | |||
59 | static struct fec_platform_data mx25_fec_pdata = { | ||
60 | .phy = PHY_INTERFACE_MODE_RMII, | ||
61 | }; | ||
62 | |||
63 | #define FEC_ENABLE_GPIO 35 | ||
64 | #define FEC_RESET_B_GPIO 104 | ||
65 | |||
66 | static void __init mx25pdk_fec_reset(void) | ||
67 | { | ||
68 | gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable"); | ||
69 | gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset"); | ||
70 | |||
71 | gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */ | ||
72 | gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */ | ||
73 | udelay(2); | ||
74 | |||
75 | /* turn on PHY power and lift reset */ | ||
76 | gpio_set_value(FEC_ENABLE_GPIO, 1); | ||
77 | gpio_set_value(FEC_RESET_B_GPIO, 1); | ||
78 | } | ||
79 | |||
44 | static void __init mx25pdk_init(void) | 80 | static void __init mx25pdk_init(void) |
45 | { | 81 | { |
82 | mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads, | ||
83 | ARRAY_SIZE(mx25pdk_pads)); | ||
84 | |||
46 | mxc_register_device(&mxc_uart_device0, &uart_pdata); | 85 | mxc_register_device(&mxc_uart_device0, &uart_pdata); |
47 | mxc_register_device(&mxc_usbh2, NULL); | 86 | mxc_register_device(&mxc_usbh2, NULL); |
87 | |||
88 | mx25pdk_fec_reset(); | ||
89 | mxc_register_device(&mx25_fec_device, &mx25_fec_pdata); | ||
48 | } | 90 | } |
49 | 91 | ||
50 | static void __init mx25pdk_timer_init(void) | 92 | static void __init mx25pdk_timer_init(void) |
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig index ea8ed109a7c2..28294416b0af 100644 --- a/arch/arm/mach-mx3/Kconfig +++ b/arch/arm/mach-mx3/Kconfig | |||
@@ -49,6 +49,7 @@ config MACH_PCM037_EET | |||
49 | config MACH_MX31LITE | 49 | config MACH_MX31LITE |
50 | bool "Support MX31 LITEKIT (LogicPD)" | 50 | bool "Support MX31 LITEKIT (LogicPD)" |
51 | select ARCH_MX31 | 51 | select ARCH_MX31 |
52 | select MXC_ULPI if USB_ULPI | ||
52 | help | 53 | help |
53 | Include support for MX31 LITEKIT platform. This includes specific | 54 | Include support for MX31 LITEKIT platform. This includes specific |
54 | configurations for the board and its peripherals. | 55 | configurations for the board and its peripherals. |
@@ -63,7 +64,7 @@ config MACH_MX31_3DS | |||
63 | config MACH_MX31MOBOARD | 64 | config MACH_MX31MOBOARD |
64 | bool "Support mx31moboard platforms (EPFL Mobots group)" | 65 | bool "Support mx31moboard platforms (EPFL Mobots group)" |
65 | select ARCH_MX31 | 66 | select ARCH_MX31 |
66 | select MXC_ULPI | 67 | select MXC_ULPI if USB_ULPI |
67 | help | 68 | help |
68 | Include support for mx31moboard platform. This includes specific | 69 | Include support for mx31moboard platform. This includes specific |
69 | configurations for the board and its peripherals. | 70 | configurations for the board and its peripherals. |
diff --git a/arch/arm/mach-mx3/mm.c b/arch/arm/mach-mx3/mm.c index bedf5b8d976a..6858a4f9806c 100644 --- a/arch/arm/mach-mx3/mm.c +++ b/arch/arm/mach-mx3/mm.c | |||
@@ -65,6 +65,11 @@ static struct map_desc mxc_io_desc[] __initdata = { | |||
65 | .pfn = __phys_to_pfn(AIPS2_BASE_ADDR), | 65 | .pfn = __phys_to_pfn(AIPS2_BASE_ADDR), |
66 | .length = AIPS2_SIZE, | 66 | .length = AIPS2_SIZE, |
67 | .type = MT_DEVICE_NONSHARED | 67 | .type = MT_DEVICE_NONSHARED |
68 | }, { | ||
69 | .virtual = SPBA0_BASE_ADDR_VIRT, | ||
70 | .pfn = __phys_to_pfn(SPBA0_BASE_ADDR), | ||
71 | .length = SPBA0_SIZE, | ||
72 | .type = MT_DEVICE_NONSHARED | ||
68 | }, | 73 | }, |
69 | }; | 74 | }; |
70 | 75 | ||
diff --git a/arch/arm/mach-mx3/mx31ads.c b/arch/arm/mach-mx3/mx31ads.c index 0497c152be18..3e7bafa2ddbb 100644 --- a/arch/arm/mach-mx3/mx31ads.c +++ b/arch/arm/mach-mx3/mx31ads.c | |||
@@ -494,11 +494,6 @@ static void mxc_init_i2c(void) | |||
494 | */ | 494 | */ |
495 | static struct map_desc mx31ads_io_desc[] __initdata = { | 495 | static struct map_desc mx31ads_io_desc[] __initdata = { |
496 | { | 496 | { |
497 | .virtual = SPBA0_BASE_ADDR_VIRT, | ||
498 | .pfn = __phys_to_pfn(SPBA0_BASE_ADDR), | ||
499 | .length = SPBA0_SIZE, | ||
500 | .type = MT_DEVICE_NONSHARED | ||
501 | }, { | ||
502 | .virtual = CS4_BASE_ADDR_VIRT, | 497 | .virtual = CS4_BASE_ADDR_VIRT, |
503 | .pfn = __phys_to_pfn(CS4_BASE_ADDR), | 498 | .pfn = __phys_to_pfn(CS4_BASE_ADDR), |
504 | .length = CS4_SIZE / 2, | 499 | .length = CS4_SIZE / 2, |
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c index def6b6736594..789b20d1730f 100644 --- a/arch/arm/mach-mx3/mx31lite.c +++ b/arch/arm/mach-mx3/mx31lite.c | |||
@@ -135,6 +135,7 @@ static struct spi_board_info mc13783_spi_dev __initdata = { | |||
135 | * USB | 135 | * USB |
136 | */ | 136 | */ |
137 | 137 | ||
138 | #if defined(CONFIG_USB_ULPI) | ||
138 | #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ | 139 | #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ |
139 | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) | 140 | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) |
140 | 141 | ||
@@ -180,6 +181,7 @@ static struct mxc_usbh_platform_data usbh2_pdata = { | |||
180 | .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, | 181 | .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, |
181 | .flags = MXC_EHCI_POWER_PINS_ENABLED, | 182 | .flags = MXC_EHCI_POWER_PINS_ENABLED, |
182 | }; | 183 | }; |
184 | #endif | ||
183 | 185 | ||
184 | /* | 186 | /* |
185 | * NOR flash | 187 | * NOR flash |
@@ -212,11 +214,6 @@ static struct platform_device physmap_flash_device = { | |||
212 | */ | 214 | */ |
213 | static struct map_desc mx31lite_io_desc[] __initdata = { | 215 | static struct map_desc mx31lite_io_desc[] __initdata = { |
214 | { | 216 | { |
215 | .virtual = SPBA0_BASE_ADDR_VIRT, | ||
216 | .pfn = __phys_to_pfn(SPBA0_BASE_ADDR), | ||
217 | .length = SPBA0_SIZE, | ||
218 | .type = MT_DEVICE_NONSHARED | ||
219 | }, { | ||
220 | .virtual = CS4_BASE_ADDR_VIRT, | 217 | .virtual = CS4_BASE_ADDR_VIRT, |
221 | .pfn = __phys_to_pfn(CS4_BASE_ADDR), | 218 | .pfn = __phys_to_pfn(CS4_BASE_ADDR), |
222 | .length = CS4_SIZE, | 219 | .length = CS4_SIZE, |
@@ -261,11 +258,13 @@ static void __init mxc_board_init(void) | |||
261 | mxc_register_device(&mxc_spi_device1, &spi1_pdata); | 258 | mxc_register_device(&mxc_spi_device1, &spi1_pdata); |
262 | spi_register_board_info(&mc13783_spi_dev, 1); | 259 | spi_register_board_info(&mc13783_spi_dev, 1); |
263 | 260 | ||
261 | #if defined(CONFIG_USB_ULPI) | ||
264 | /* USB */ | 262 | /* USB */ |
265 | usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, | 263 | usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, |
266 | USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT); | 264 | USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT); |
267 | 265 | ||
268 | mxc_register_device(&mxc_usbh2, &usbh2_pdata); | 266 | mxc_register_device(&mxc_usbh2, &usbh2_pdata); |
267 | #endif | ||
269 | 268 | ||
270 | /* SMSC9117 IRQ pin */ | 269 | /* SMSC9117 IRQ pin */ |
271 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); | 270 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); |
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c index 8fc624f141cb..438428eaf769 100644 --- a/arch/arm/mach-mx3/mx31moboard-devboard.c +++ b/arch/arm/mach-mx3/mx31moboard-devboard.c | |||
@@ -179,7 +179,7 @@ static int __init devboard_usbh1_init(void) | |||
179 | 179 | ||
180 | usbh1_pdata.otg = otg; | 180 | usbh1_pdata.otg = otg; |
181 | 181 | ||
182 | return mxc_register_device(&mx31_usbh1, &usbh1_pdata); | 182 | return mxc_register_device(&mxc_usbh1, &usbh1_pdata); |
183 | } | 183 | } |
184 | 184 | ||
185 | /* | 185 | /* |
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c index 85184a35e674..1f44b9ccbb0f 100644 --- a/arch/arm/mach-mx3/mx31moboard-marxbot.c +++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c | |||
@@ -294,7 +294,7 @@ static int __init marxbot_usbh1_init(void) | |||
294 | 294 | ||
295 | usbh1_pdata.otg = otg; | 295 | usbh1_pdata.otg = otg; |
296 | 296 | ||
297 | return mxc_register_device(&mx31_usbh1, &usbh1_pdata); | 297 | return mxc_register_device(&mxc_usbh1, &usbh1_pdata); |
298 | } | 298 | } |
299 | 299 | ||
300 | /* | 300 | /* |
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c index b70529145936..cfd605d078ec 100644 --- a/arch/arm/mach-mx3/mx31moboard.c +++ b/arch/arm/mach-mx3/mx31moboard.c | |||
@@ -346,6 +346,8 @@ static struct fsl_usb2_platform_data usb_pdata = { | |||
346 | .phy_mode = FSL_USB2_PHY_ULPI, | 346 | .phy_mode = FSL_USB2_PHY_ULPI, |
347 | }; | 347 | }; |
348 | 348 | ||
349 | #if defined(CONFIG_USB_ULPI) | ||
350 | |||
349 | #define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6) | 351 | #define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6) |
350 | 352 | ||
351 | static int moboard_usbh2_hw_init(struct platform_device *pdev) | 353 | static int moboard_usbh2_hw_init(struct platform_device *pdev) |
@@ -392,8 +394,11 @@ static int __init moboard_usbh2_init(void) | |||
392 | usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, | 394 | usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, |
393 | USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT); | 395 | USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT); |
394 | 396 | ||
395 | return mxc_register_device(&mx31_usbh2, &usbh2_pdata); | 397 | return mxc_register_device(&mxc_usbh2, &usbh2_pdata); |
396 | } | 398 | } |
399 | #else | ||
400 | static inline int moboard_usbh2_init(void) { return 0; } | ||
401 | #endif | ||
397 | 402 | ||
398 | 403 | ||
399 | static struct gpio_led mx31moboard_leds[] = { | 404 | static struct gpio_led mx31moboard_leds[] = { |
diff --git a/arch/arm/mach-mx3/mx31pdk.c b/arch/arm/mach-mx3/mx31pdk.c index 0f7a2f06bc2d..18715f1aa7eb 100644 --- a/arch/arm/mach-mx3/mx31pdk.c +++ b/arch/arm/mach-mx3/mx31pdk.c | |||
@@ -211,11 +211,6 @@ static int __init mx31pdk_init_expio(void) | |||
211 | */ | 211 | */ |
212 | static struct map_desc mx31pdk_io_desc[] __initdata = { | 212 | static struct map_desc mx31pdk_io_desc[] __initdata = { |
213 | { | 213 | { |
214 | .virtual = SPBA0_BASE_ADDR_VIRT, | ||
215 | .pfn = __phys_to_pfn(SPBA0_BASE_ADDR), | ||
216 | .length = SPBA0_SIZE, | ||
217 | .type = MT_DEVICE_NONSHARED, | ||
218 | }, { | ||
219 | .virtual = CS5_BASE_ADDR_VIRT, | 214 | .virtual = CS5_BASE_ADDR_VIRT, |
220 | .pfn = __phys_to_pfn(CS5_BASE_ADDR), | 215 | .pfn = __phys_to_pfn(CS5_BASE_ADDR), |
221 | .length = CS5_SIZE, | 216 | .length = CS5_SIZE, |
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c index 6cbaabedf386..5be396917c99 100644 --- a/arch/arm/mach-mx3/pcm037.c +++ b/arch/arm/mach-mx3/pcm037.c | |||
@@ -322,16 +322,25 @@ static int pcm037_camera_power(struct device *dev, int on) | |||
322 | return 0; | 322 | return 0; |
323 | } | 323 | } |
324 | 324 | ||
325 | static struct i2c_board_info pcm037_i2c_2_devices[] = { | 325 | static struct i2c_board_info pcm037_i2c_camera[] = { |
326 | { | 326 | { |
327 | I2C_BOARD_INFO("mt9t031", 0x5d), | 327 | I2C_BOARD_INFO("mt9t031", 0x5d), |
328 | }, { | ||
329 | I2C_BOARD_INFO("mt9v022", 0x48), | ||
328 | }, | 330 | }, |
329 | }; | 331 | }; |
330 | 332 | ||
331 | static struct soc_camera_link iclink = { | 333 | static struct soc_camera_link iclink_mt9v022 = { |
334 | .bus_id = 0, /* Must match with the camera ID */ | ||
335 | .board_info = &pcm037_i2c_camera[1], | ||
336 | .i2c_adapter_id = 2, | ||
337 | .module_name = "mt9v022", | ||
338 | }; | ||
339 | |||
340 | static struct soc_camera_link iclink_mt9t031 = { | ||
332 | .bus_id = 0, /* Must match with the camera ID */ | 341 | .bus_id = 0, /* Must match with the camera ID */ |
333 | .power = pcm037_camera_power, | 342 | .power = pcm037_camera_power, |
334 | .board_info = &pcm037_i2c_2_devices[0], | 343 | .board_info = &pcm037_i2c_camera[0], |
335 | .i2c_adapter_id = 2, | 344 | .i2c_adapter_id = 2, |
336 | .module_name = "mt9t031", | 345 | .module_name = "mt9t031", |
337 | }; | 346 | }; |
@@ -345,11 +354,19 @@ static struct i2c_board_info pcm037_i2c_devices[] = { | |||
345 | } | 354 | } |
346 | }; | 355 | }; |
347 | 356 | ||
348 | static struct platform_device pcm037_camera = { | 357 | static struct platform_device pcm037_mt9t031 = { |
349 | .name = "soc-camera-pdrv", | 358 | .name = "soc-camera-pdrv", |
350 | .id = 0, | 359 | .id = 0, |
351 | .dev = { | 360 | .dev = { |
352 | .platform_data = &iclink, | 361 | .platform_data = &iclink_mt9t031, |
362 | }, | ||
363 | }; | ||
364 | |||
365 | static struct platform_device pcm037_mt9v022 = { | ||
366 | .name = "soc-camera-pdrv", | ||
367 | .id = 1, | ||
368 | .dev = { | ||
369 | .platform_data = &iclink_mt9v022, | ||
353 | }, | 370 | }, |
354 | }; | 371 | }; |
355 | 372 | ||
@@ -449,7 +466,8 @@ static int __init pcm037_camera_alloc_dma(const size_t buf_size) | |||
449 | static struct platform_device *devices[] __initdata = { | 466 | static struct platform_device *devices[] __initdata = { |
450 | &pcm037_flash, | 467 | &pcm037_flash, |
451 | &pcm037_sram_device, | 468 | &pcm037_sram_device, |
452 | &pcm037_camera, | 469 | &pcm037_mt9t031, |
470 | &pcm037_mt9v022, | ||
453 | }; | 471 | }; |
454 | 472 | ||
455 | static struct ipu_platform_data mx3_ipu_data = { | 473 | static struct ipu_platform_data mx3_ipu_data = { |
@@ -599,7 +617,7 @@ static void __init mxc_board_init(void) | |||
599 | if (!ret) | 617 | if (!ret) |
600 | gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1); | 618 | gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1); |
601 | else | 619 | else |
602 | iclink.power = NULL; | 620 | iclink_mt9t031.power = NULL; |
603 | 621 | ||
604 | if (!pcm037_camera_alloc_dma(4 * 1024 * 1024)) | 622 | if (!pcm037_camera_alloc_dma(4 * 1024 * 1024)) |
605 | mxc_register_device(&mx3_camera, &camera_pdata); | 623 | mxc_register_device(&mx3_camera, &camera_pdata); |
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index ab995a9c606c..65e7b5b85d83 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c | |||
@@ -599,7 +599,7 @@ static struct clk i2c_ick = { | |||
599 | static struct omap_clk omap_clks[] = { | 599 | static struct omap_clk omap_clks[] = { |
600 | /* non-ULPD clocks */ | 600 | /* non-ULPD clocks */ |
601 | CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX), | 601 | CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
602 | CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310), | 602 | CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
603 | /* CK_GEN1 clocks */ | 603 | /* CK_GEN1 clocks */ |
604 | CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX), | 604 | CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX), |
605 | CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX), | 605 | CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX), |
@@ -627,7 +627,7 @@ static struct omap_clk omap_clks[] = { | |||
627 | CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX), | 627 | CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX), |
628 | CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310), | 628 | CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310), |
629 | CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX), | 629 | CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX), |
630 | CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310), | 630 | CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
631 | CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310), | 631 | CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310), |
632 | CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX), | 632 | CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX), |
633 | CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX), | 633 | CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX), |
@@ -658,6 +658,10 @@ static struct omap_clk omap_clks[] = { | |||
658 | CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310 | CK_7XX), | 658 | CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310 | CK_7XX), |
659 | CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX), | 659 | CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX), |
660 | CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310 | CK_7XX), | 660 | CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310 | CK_7XX), |
661 | CLK("omap1_spi100k.1", "fck", &dummy_ck, CK_7XX), | ||
662 | CLK("omap1_spi100k.1", "ick", &dummy_ck, CK_7XX), | ||
663 | CLK("omap1_spi100k.2", "fck", &dummy_ck, CK_7XX), | ||
664 | CLK("omap1_spi100k.2", "ick", &dummy_ck, CK_7XX), | ||
661 | CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310), | 665 | CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310), |
662 | CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX), | 666 | CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX), |
663 | CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310), | 667 | CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310), |
@@ -674,7 +678,7 @@ static struct omap_clk omap_clks[] = { | |||
674 | * init | 678 | * init |
675 | */ | 679 | */ |
676 | 680 | ||
677 | static struct clk_functions omap1_clk_functions __initdata = { | 681 | static struct clk_functions omap1_clk_functions = { |
678 | .clk_enable = omap1_clk_enable, | 682 | .clk_enable = omap1_clk_enable, |
679 | .clk_disable = omap1_clk_disable, | 683 | .clk_disable = omap1_clk_disable, |
680 | .clk_round_rate = omap1_clk_round_rate, | 684 | .clk_round_rate = omap1_clk_round_rate, |
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index 23ded2d49600..a2d07aa75c9e 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/spi/spi.h> | ||
17 | 18 | ||
18 | #include <mach/hardware.h> | 19 | #include <mach/hardware.h> |
19 | #include <asm/mach/map.h> | 20 | #include <asm/mach/map.h> |
@@ -23,6 +24,7 @@ | |||
23 | #include <plat/mux.h> | 24 | #include <plat/mux.h> |
24 | #include <mach/gpio.h> | 25 | #include <mach/gpio.h> |
25 | #include <plat/mmc.h> | 26 | #include <plat/mmc.h> |
27 | #include <plat/omap7xx.h> | ||
26 | 28 | ||
27 | /*-------------------------------------------------------------------------*/ | 29 | /*-------------------------------------------------------------------------*/ |
28 | 30 | ||
@@ -196,6 +198,38 @@ void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | |||
196 | 198 | ||
197 | /*-------------------------------------------------------------------------*/ | 199 | /*-------------------------------------------------------------------------*/ |
198 | 200 | ||
201 | /* OMAP7xx SPI support */ | ||
202 | #if defined(CONFIG_SPI_OMAP_100K) || defined(CONFIG_SPI_OMAP_100K_MODULE) | ||
203 | |||
204 | struct platform_device omap_spi1 = { | ||
205 | .name = "omap1_spi100k", | ||
206 | .id = 1, | ||
207 | }; | ||
208 | |||
209 | struct platform_device omap_spi2 = { | ||
210 | .name = "omap1_spi100k", | ||
211 | .id = 2, | ||
212 | }; | ||
213 | |||
214 | static void omap_init_spi100k(void) | ||
215 | { | ||
216 | omap_spi1.dev.platform_data = ioremap(OMAP7XX_SPI1_BASE, 0x7ff); | ||
217 | if (omap_spi1.dev.platform_data) | ||
218 | platform_device_register(&omap_spi1); | ||
219 | |||
220 | omap_spi2.dev.platform_data = ioremap(OMAP7XX_SPI2_BASE, 0x7ff); | ||
221 | if (omap_spi2.dev.platform_data) | ||
222 | platform_device_register(&omap_spi2); | ||
223 | } | ||
224 | |||
225 | #else | ||
226 | static inline void omap_init_spi100k(void) | ||
227 | { | ||
228 | } | ||
229 | #endif | ||
230 | |||
231 | /*-------------------------------------------------------------------------*/ | ||
232 | |||
199 | #if defined(CONFIG_OMAP_STI) | 233 | #if defined(CONFIG_OMAP_STI) |
200 | 234 | ||
201 | #define OMAP1_STI_BASE 0xfffea000 | 235 | #define OMAP1_STI_BASE 0xfffea000 |
@@ -263,6 +297,7 @@ static int __init omap1_init_devices(void) | |||
263 | 297 | ||
264 | omap_init_mbox(); | 298 | omap_init_mbox(); |
265 | omap_init_rtc(); | 299 | omap_init_rtc(); |
300 | omap_init_spi100k(); | ||
266 | omap_init_sti(); | 301 | omap_init_sti(); |
267 | 302 | ||
268 | return 0; | 303 | return 0; |
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c index 07212cc621ae..84341377232d 100644 --- a/arch/arm/mach-omap1/mux.c +++ b/arch/arm/mach-omap1/mux.c | |||
@@ -62,6 +62,14 @@ MUX_CFG_7XX("MMC_7XX_DAT0", 2, 17, 0, 16, 1, 0) | |||
62 | /* I2C interface */ | 62 | /* I2C interface */ |
63 | MUX_CFG_7XX("I2C_7XX_SCL", 5, 1, 0, 0, 1, 0) | 63 | MUX_CFG_7XX("I2C_7XX_SCL", 5, 1, 0, 0, 1, 0) |
64 | MUX_CFG_7XX("I2C_7XX_SDA", 5, 5, 0, 0, 1, 0) | 64 | MUX_CFG_7XX("I2C_7XX_SDA", 5, 5, 0, 0, 1, 0) |
65 | |||
66 | /* SPI pins */ | ||
67 | MUX_CFG_7XX("SPI_7XX_1", 6, 5, 4, 4, 1, 0) | ||
68 | MUX_CFG_7XX("SPI_7XX_2", 6, 9, 4, 8, 1, 0) | ||
69 | MUX_CFG_7XX("SPI_7XX_3", 6, 13, 4, 12, 1, 0) | ||
70 | MUX_CFG_7XX("SPI_7XX_4", 6, 17, 4, 16, 1, 0) | ||
71 | MUX_CFG_7XX("SPI_7XX_5", 8, 25, 0, 24, 0, 0) | ||
72 | MUX_CFG_7XX("SPI_7XX_6", 9, 5, 0, 4, 0, 0) | ||
65 | }; | 73 | }; |
66 | #define OMAP7XX_PINS_SZ ARRAY_SIZE(omap7xx_pins) | 74 | #define OMAP7XX_PINS_SZ ARRAY_SIZE(omap7xx_pins) |
67 | #else | 75 | #else |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 10eafa70a909..606bf04f51b6 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -80,6 +80,7 @@ config MACH_OVERO | |||
80 | config MACH_OMAP3EVM | 80 | config MACH_OMAP3EVM |
81 | bool "OMAP 3530 EVM board" | 81 | bool "OMAP 3530 EVM board" |
82 | depends on ARCH_OMAP3 && ARCH_OMAP34XX | 82 | depends on ARCH_OMAP3 && ARCH_OMAP34XX |
83 | select OMAP_PACKAGE_CBB | ||
83 | 84 | ||
84 | config MACH_OMAP3517EVM | 85 | config MACH_OMAP3517EVM |
85 | bool "OMAP3517/ AM3517 EVM board" | 86 | bool "OMAP3517/ AM3517 EVM board" |
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index 8dd277c36661..1e3dfb652acc 100755 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c | |||
@@ -63,21 +63,21 @@ static int board_keymap[] = { | |||
63 | KEY(5, 1, KEY_H), | 63 | KEY(5, 1, KEY_H), |
64 | KEY(5, 2, KEY_J), | 64 | KEY(5, 2, KEY_J), |
65 | KEY(5, 3, KEY_F3), | 65 | KEY(5, 3, KEY_F3), |
66 | KEY(5, 4, KEY_UNKNOWN), | ||
66 | KEY(5, 5, KEY_VOLUMEDOWN), | 67 | KEY(5, 5, KEY_VOLUMEDOWN), |
67 | KEY(5, 6, KEY_M), | 68 | KEY(5, 6, KEY_M), |
68 | KEY(5, 7, KEY_ENTER), | 69 | KEY(5, 7, KEY_RIGHT), |
69 | KEY(6, 0, KEY_Q), | 70 | KEY(6, 0, KEY_Q), |
70 | KEY(6, 1, KEY_A), | 71 | KEY(6, 1, KEY_A), |
71 | KEY(6, 2, KEY_N), | 72 | KEY(6, 2, KEY_N), |
72 | KEY(6, 3, KEY_BACKSPACE), | 73 | KEY(6, 3, KEY_BACKSPACE), |
73 | KEY(6, 6, KEY_P), | 74 | KEY(6, 6, KEY_P), |
74 | KEY(6, 7, KEY_SELECT), | 75 | KEY(6, 7, KEY_UP), |
75 | KEY(7, 0, KEY_PROG1), /*MACRO 1 <User defined> */ | 76 | KEY(7, 0, KEY_PROG1), /*MACRO 1 <User defined> */ |
76 | KEY(7, 1, KEY_PROG2), /*MACRO 2 <User defined> */ | 77 | KEY(7, 1, KEY_PROG2), /*MACRO 2 <User defined> */ |
77 | KEY(7, 2, KEY_PROG3), /*MACRO 3 <User defined> */ | 78 | KEY(7, 2, KEY_PROG3), /*MACRO 3 <User defined> */ |
78 | KEY(7, 3, KEY_PROG4), /*MACRO 4 <User defined> */ | 79 | KEY(7, 3, KEY_PROG4), /*MACRO 4 <User defined> */ |
79 | KEY(7, 5, KEY_RIGHT), | 80 | KEY(7, 6, KEY_SELECT), |
80 | KEY(7, 6, KEY_UP), | ||
81 | KEY(7, 7, KEY_DOWN) | 81 | KEY(7, 7, KEY_DOWN) |
82 | }; | 82 | }; |
83 | 83 | ||
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c index d0e3fb7f9298..5420356eb407 100644 --- a/arch/arm/mach-omap2/clock2xxx.c +++ b/arch/arm/mach-omap2/clock2xxx.c | |||
@@ -449,40 +449,78 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate) | |||
449 | #ifdef CONFIG_CPU_FREQ | 449 | #ifdef CONFIG_CPU_FREQ |
450 | /* | 450 | /* |
451 | * Walk PRCM rate table and fillout cpufreq freq_table | 451 | * Walk PRCM rate table and fillout cpufreq freq_table |
452 | * XXX This should be replaced by an OPP layer in the near future | ||
452 | */ | 453 | */ |
453 | static struct cpufreq_frequency_table freq_table[ARRAY_SIZE(rate_table)]; | 454 | static struct cpufreq_frequency_table *freq_table; |
454 | 455 | ||
455 | void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) | 456 | void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) |
456 | { | 457 | { |
457 | struct prcm_config *prcm; | 458 | const struct prcm_config *prcm; |
459 | long sys_ck_rate; | ||
458 | int i = 0; | 460 | int i = 0; |
461 | int tbl_sz = 0; | ||
462 | |||
463 | sys_ck_rate = clk_get_rate(sclk); | ||
459 | 464 | ||
460 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | 465 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { |
461 | if (!(prcm->flags & cpu_mask)) | 466 | if (!(prcm->flags & cpu_mask)) |
462 | continue; | 467 | continue; |
463 | if (prcm->xtal_speed != sys_ck.rate) | 468 | if (prcm->xtal_speed != sys_ck_rate) |
464 | continue; | 469 | continue; |
465 | 470 | ||
466 | /* don't put bypass rates in table */ | 471 | /* don't put bypass rates in table */ |
467 | if (prcm->dpll_speed == prcm->xtal_speed) | 472 | if (prcm->dpll_speed == prcm->xtal_speed) |
468 | continue; | 473 | continue; |
469 | 474 | ||
470 | freq_table[i].index = i; | 475 | tbl_sz++; |
471 | freq_table[i].frequency = prcm->mpu_speed / 1000; | ||
472 | i++; | ||
473 | } | 476 | } |
474 | 477 | ||
475 | if (i == 0) { | 478 | /* |
476 | printk(KERN_WARNING "%s: failed to initialize frequency " | 479 | * XXX Ensure that we're doing what CPUFreq expects for this error |
477 | "table\n", __func__); | 480 | * case and the following one |
481 | */ | ||
482 | if (tbl_sz == 0) { | ||
483 | pr_warning("%s: no matching entries in rate_table\n", | ||
484 | __func__); | ||
485 | return; | ||
486 | } | ||
487 | |||
488 | /* Include the CPUFREQ_TABLE_END terminator entry */ | ||
489 | tbl_sz++; | ||
490 | |||
491 | freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) * tbl_sz, | ||
492 | GFP_ATOMIC); | ||
493 | if (!freq_table) { | ||
494 | pr_err("%s: could not kzalloc frequency table\n", __func__); | ||
478 | return; | 495 | return; |
479 | } | 496 | } |
480 | 497 | ||
498 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
499 | if (!(prcm->flags & cpu_mask)) | ||
500 | continue; | ||
501 | if (prcm->xtal_speed != sys_ck_rate) | ||
502 | continue; | ||
503 | |||
504 | /* don't put bypass rates in table */ | ||
505 | if (prcm->dpll_speed == prcm->xtal_speed) | ||
506 | continue; | ||
507 | |||
508 | freq_table[i].index = i; | ||
509 | freq_table[i].frequency = prcm->mpu_speed / 1000; | ||
510 | i++; | ||
511 | } | ||
512 | |||
481 | freq_table[i].index = i; | 513 | freq_table[i].index = i; |
482 | freq_table[i].frequency = CPUFREQ_TABLE_END; | 514 | freq_table[i].frequency = CPUFREQ_TABLE_END; |
483 | 515 | ||
484 | *table = &freq_table[0]; | 516 | *table = &freq_table[0]; |
485 | } | 517 | } |
518 | |||
519 | void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table) | ||
520 | { | ||
521 | kfree(freq_table); | ||
522 | } | ||
523 | |||
486 | #endif | 524 | #endif |
487 | 525 | ||
488 | struct clk_functions omap2_clk_functions = { | 526 | struct clk_functions omap2_clk_functions = { |
@@ -494,6 +532,7 @@ struct clk_functions omap2_clk_functions = { | |||
494 | .clk_disable_unused = omap2_clk_disable_unused, | 532 | .clk_disable_unused = omap2_clk_disable_unused, |
495 | #ifdef CONFIG_CPU_FREQ | 533 | #ifdef CONFIG_CPU_FREQ |
496 | .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table, | 534 | .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table, |
535 | .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table, | ||
497 | #endif | 536 | #endif |
498 | }; | 537 | }; |
499 | 538 | ||
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index ded32364f32b..d4217b93e10b 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <asm/div64.h> | 34 | #include <asm/div64.h> |
35 | #include <asm/clkdev.h> | 35 | #include <asm/clkdev.h> |
36 | 36 | ||
37 | #include <plat/sdrc.h> | ||
38 | #include "clock.h" | 37 | #include "clock.h" |
39 | #include "clock34xx.h" | 38 | #include "clock34xx.h" |
40 | #include "sdrc.h" | 39 | #include "sdrc.h" |
diff --git a/arch/arm/mach-omap2/clock34xx_data.c b/arch/arm/mach-omap2/clock34xx_data.c index 8bdcc9cc7f9a..c6031d74d6f6 100644 --- a/arch/arm/mach-omap2/clock34xx_data.c +++ b/arch/arm/mach-omap2/clock34xx_data.c | |||
@@ -776,6 +776,8 @@ static struct clk dpll4_m5_ck = { | |||
776 | .clksel_mask = OMAP3430_CLKSEL_CAM_MASK, | 776 | .clksel_mask = OMAP3430_CLKSEL_CAM_MASK, |
777 | .clksel = div16_dpll4_clksel, | 777 | .clksel = div16_dpll4_clksel, |
778 | .clkdm_name = "dpll4_clkdm", | 778 | .clkdm_name = "dpll4_clkdm", |
779 | .set_rate = &omap2_clksel_set_rate, | ||
780 | .round_rate = &omap2_clksel_round_rate, | ||
779 | .recalc = &omap2_clksel_recalc, | 781 | .recalc = &omap2_clksel_recalc, |
780 | }; | 782 | }; |
781 | 783 | ||
@@ -1500,6 +1502,7 @@ static struct clk uart2_fck = { | |||
1500 | .parent = &core_48m_fck, | 1502 | .parent = &core_48m_fck, |
1501 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | 1503 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), |
1502 | .enable_bit = OMAP3430_EN_UART2_SHIFT, | 1504 | .enable_bit = OMAP3430_EN_UART2_SHIFT, |
1505 | .clkdm_name = "core_l4_clkdm", | ||
1503 | .recalc = &followparent_recalc, | 1506 | .recalc = &followparent_recalc, |
1504 | }; | 1507 | }; |
1505 | 1508 | ||
@@ -1509,6 +1512,7 @@ static struct clk uart1_fck = { | |||
1509 | .parent = &core_48m_fck, | 1512 | .parent = &core_48m_fck, |
1510 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | 1513 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), |
1511 | .enable_bit = OMAP3430_EN_UART1_SHIFT, | 1514 | .enable_bit = OMAP3430_EN_UART1_SHIFT, |
1515 | .clkdm_name = "core_l4_clkdm", | ||
1512 | .recalc = &followparent_recalc, | 1516 | .recalc = &followparent_recalc, |
1513 | }; | 1517 | }; |
1514 | 1518 | ||
@@ -2745,7 +2749,7 @@ static struct clk mcbsp4_ick = { | |||
2745 | }; | 2749 | }; |
2746 | 2750 | ||
2747 | static const struct clksel mcbsp_234_clksel[] = { | 2751 | static const struct clksel mcbsp_234_clksel[] = { |
2748 | { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates }, | 2752 | { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates }, |
2749 | { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, | 2753 | { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, |
2750 | { .parent = NULL } | 2754 | { .parent = NULL } |
2751 | }; | 2755 | }; |
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 1a45ed1e8ba1..dd285f001467 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c | |||
@@ -559,7 +559,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) | |||
559 | * downstream clocks for debugging purposes? | 559 | * downstream clocks for debugging purposes? |
560 | */ | 560 | */ |
561 | 561 | ||
562 | if (!clkdm || !clk) | 562 | if (!clkdm || !clk || !clkdm->clktrctrl_mask) |
563 | return -EINVAL; | 563 | return -EINVAL; |
564 | 564 | ||
565 | if (atomic_inc_return(&clkdm->usecount) > 1) | 565 | if (atomic_inc_return(&clkdm->usecount) > 1) |
@@ -610,7 +610,7 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) | |||
610 | * downstream clocks for debugging purposes? | 610 | * downstream clocks for debugging purposes? |
611 | */ | 611 | */ |
612 | 612 | ||
613 | if (!clkdm || !clk) | 613 | if (!clkdm || !clk || !clkdm->clktrctrl_mask) |
614 | return -EINVAL; | 614 | return -EINVAL; |
615 | 615 | ||
616 | #ifdef DEBUG | 616 | #ifdef DEBUG |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index a8749e8017b9..5a7996402c53 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <plat/sdrc.h> | 33 | #include <plat/sdrc.h> |
34 | #include <plat/gpmc.h> | 34 | #include <plat/gpmc.h> |
35 | #include <plat/serial.h> | 35 | #include <plat/serial.h> |
36 | #include <plat/mux.h> | ||
37 | #include <plat/vram.h> | 36 | #include <plat/vram.h> |
38 | 37 | ||
39 | #include "clock.h" | 38 | #include "clock.h" |
@@ -73,21 +72,21 @@ static struct map_desc omap24xx_io_desc[] __initdata = { | |||
73 | #ifdef CONFIG_ARCH_OMAP2420 | 72 | #ifdef CONFIG_ARCH_OMAP2420 |
74 | static struct map_desc omap242x_io_desc[] __initdata = { | 73 | static struct map_desc omap242x_io_desc[] __initdata = { |
75 | { | 74 | { |
76 | .virtual = DSP_MEM_24XX_VIRT, | 75 | .virtual = DSP_MEM_2420_VIRT, |
77 | .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS), | 76 | .pfn = __phys_to_pfn(DSP_MEM_2420_PHYS), |
78 | .length = DSP_MEM_24XX_SIZE, | 77 | .length = DSP_MEM_2420_SIZE, |
79 | .type = MT_DEVICE | 78 | .type = MT_DEVICE |
80 | }, | 79 | }, |
81 | { | 80 | { |
82 | .virtual = DSP_IPI_24XX_VIRT, | 81 | .virtual = DSP_IPI_2420_VIRT, |
83 | .pfn = __phys_to_pfn(DSP_IPI_24XX_PHYS), | 82 | .pfn = __phys_to_pfn(DSP_IPI_2420_PHYS), |
84 | .length = DSP_IPI_24XX_SIZE, | 83 | .length = DSP_IPI_2420_SIZE, |
85 | .type = MT_DEVICE | 84 | .type = MT_DEVICE |
86 | }, | 85 | }, |
87 | { | 86 | { |
88 | .virtual = DSP_MMU_24XX_VIRT, | 87 | .virtual = DSP_MMU_2420_VIRT, |
89 | .pfn = __phys_to_pfn(DSP_MMU_24XX_PHYS), | 88 | .pfn = __phys_to_pfn(DSP_MMU_2420_PHYS), |
90 | .length = DSP_MMU_24XX_SIZE, | 89 | .length = DSP_MMU_2420_SIZE, |
91 | .type = MT_DEVICE | 90 | .type = MT_DEVICE |
92 | }, | 91 | }, |
93 | }; | 92 | }; |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index e071b3fd1878..459ef23ab8a8 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -994,8 +994,10 @@ int __init omap_mux_init(u32 mux_pbase, u32 mux_size, | |||
994 | } | 994 | } |
995 | 995 | ||
996 | #ifdef CONFIG_OMAP_MUX | 996 | #ifdef CONFIG_OMAP_MUX |
997 | omap_mux_package_fixup(package_subset, superset); | 997 | if (package_subset) |
998 | omap_mux_package_init_balls(package_balls, superset); | 998 | omap_mux_package_fixup(package_subset, superset); |
999 | if (package_balls) | ||
1000 | omap_mux_package_init_balls(package_balls, superset); | ||
999 | omap_mux_set_cmdline_signals(); | 1001 | omap_mux_set_cmdline_signals(); |
1000 | omap_mux_set_board_signals(board_mux); | 1002 | omap_mux_set_board_signals(board_mux); |
1001 | #endif | 1003 | #endif |
diff --git a/arch/arm/mach-omap2/opp2420_data.c b/arch/arm/mach-omap2/opp2420_data.c index 126a9396b3a8..e6dda694fd5c 100644 --- a/arch/arm/mach-omap2/opp2420_data.c +++ b/arch/arm/mach-omap2/opp2420_data.c | |||
@@ -9,45 +9,47 @@ | |||
9 | * The OMAP2 processor can be run at several discrete 'PRCM configurations'. | 9 | * The OMAP2 processor can be run at several discrete 'PRCM configurations'. |
10 | * These configurations are characterized by voltage and speed for clocks. | 10 | * These configurations are characterized by voltage and speed for clocks. |
11 | * The device is only validated for certain combinations. One way to express | 11 | * The device is only validated for certain combinations. One way to express |
12 | * these combinations is via the 'ratio's' which the clocks operate with | 12 | * these combinations is via the 'ratios' which the clocks operate with |
13 | * respect to each other. These ratio sets are for a given voltage/DPLL | 13 | * respect to each other. These ratio sets are for a given voltage/DPLL |
14 | * setting. All configurations can be described by a DPLL setting and a ratio | 14 | * setting. All configurations can be described by a DPLL setting and a ratio. |
15 | * There are 3 ratio sets for the 2430 and X ratio sets for 2420. | ||
16 | * | ||
17 | * 2430 differs from 2420 in that there are no more phase synchronizers used. | ||
18 | * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs | ||
19 | * 2430 (iva2.1, NOdsp, mdm) | ||
20 | * | 15 | * |
21 | * XXX Missing voltage data. | 16 | * XXX Missing voltage data. |
17 | * XXX Missing 19.2MHz sys_clk rate sets (needed for N800/N810) | ||
22 | * | 18 | * |
23 | * THe format described in this file is deprecated. Once a reasonable | 19 | * THe format described in this file is deprecated. Once a reasonable |
24 | * OPP API exists, the data in this file should be converted to use it. | 20 | * OPP API exists, the data in this file should be converted to use it. |
25 | * | 21 | * |
26 | * This is technically part of the OMAP2xxx clock code. | 22 | * This is technically part of the OMAP2xxx clock code. |
23 | * | ||
24 | * Considerable work is still needed to fully support dynamic frequency | ||
25 | * changes on OMAP2xxx-series chips. Readers interested in such a | ||
26 | * project are encouraged to review the Maemo Diablo RX-34 and RX-44 | ||
27 | * kernel source at: | ||
28 | * http://repository.maemo.org/pool/diablo/free/k/kernel-source-diablo/ | ||
27 | */ | 29 | */ |
28 | 30 | ||
29 | #include "opp2xxx.h" | 31 | #include "opp2xxx.h" |
30 | #include "sdrc.h" | 32 | #include "sdrc.h" |
31 | #include "clock.h" | 33 | #include "clock.h" |
32 | 34 | ||
33 | /*------------------------------------------------------------------------- | 35 | /* |
34 | * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. | 36 | * Key dividers which make up a PRCM set. Ratios for a PRCM are mandated. |
35 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU, | 37 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU, |
36 | * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL, | 38 | * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL, |
37 | * CM_CLKSEL2_PLL, CM_CLKSEL_MDM | 39 | * CM_CLKSEL2_PLL, CM_CLKSEL_MDM |
38 | * | 40 | * |
39 | * Filling in table based on H4 boards and 2430-SDPs variants available. | 41 | * Filling in table based on H4 boards available. There are quite a |
40 | * There are quite a few more rates combinations which could be defined. | 42 | * few more rate combinations which could be defined. |
41 | * | 43 | * |
42 | * When multiple values are defined the start up will try and choose the | 44 | * When multiple values are defined the start up will try and choose |
43 | * fastest one. If a 'fast' value is defined, then automatically, the /2 | 45 | * the fastest one. If a 'fast' value is defined, then automatically, |
44 | * one should be included as it can be used. Generally having more that | 46 | * the /2 one should be included as it can be used. Generally having |
45 | * one fast set does not make sense, as static timings need to be changed | 47 | * more than one fast set does not make sense, as static timings need |
46 | * to change the set. The exception is the bypass setting which is | 48 | * to be changed to change the set. The exception is the bypass |
47 | * availble for low power bypass. | 49 | * setting which is available for low power bypass. |
48 | * | 50 | * |
49 | * Note: This table needs to be sorted, fastest to slowest. | 51 | * Note: This table needs to be sorted, fastest to slowest. |
50 | *-------------------------------------------------------------------------*/ | 52 | **/ |
51 | const struct prcm_config omap2420_rate_table[] = { | 53 | const struct prcm_config omap2420_rate_table[] = { |
52 | /* PRCM I - FAST */ | 54 | /* PRCM I - FAST */ |
53 | {S12M, S660M, S330M, RI_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */ | 55 | {S12M, S660M, S330M, RI_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */ |
diff --git a/arch/arm/mach-omap2/opp2430_data.c b/arch/arm/mach-omap2/opp2430_data.c index edb81672c844..1b9596ae201e 100644 --- a/arch/arm/mach-omap2/opp2430_data.c +++ b/arch/arm/mach-omap2/opp2430_data.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * opp2420_data.c - old-style "OPP" table for OMAP2420 | 2 | * opp2430_data.c - old-style "OPP" table for OMAP2430 |
3 | * | 3 | * |
4 | * Copyright (C) 2005-2009 Texas Instruments, Inc. | 4 | * Copyright (C) 2005-2009 Texas Instruments, Inc. |
5 | * Copyright (C) 2004-2009 Nokia Corporation | 5 | * Copyright (C) 2004-2009 Nokia Corporation |
@@ -9,16 +9,16 @@ | |||
9 | * The OMAP2 processor can be run at several discrete 'PRCM configurations'. | 9 | * The OMAP2 processor can be run at several discrete 'PRCM configurations'. |
10 | * These configurations are characterized by voltage and speed for clocks. | 10 | * These configurations are characterized by voltage and speed for clocks. |
11 | * The device is only validated for certain combinations. One way to express | 11 | * The device is only validated for certain combinations. One way to express |
12 | * these combinations is via the 'ratio's' which the clocks operate with | 12 | * these combinations is via the 'ratios' which the clocks operate with |
13 | * respect to each other. These ratio sets are for a given voltage/DPLL | 13 | * respect to each other. These ratio sets are for a given voltage/DPLL |
14 | * setting. All configurations can be described by a DPLL setting and a ratio | 14 | * setting. All configurations can be described by a DPLL setting and a ratio. |
15 | * There are 3 ratio sets for the 2430 and X ratio sets for 2420. | ||
16 | * | 15 | * |
17 | * 2430 differs from 2420 in that there are no more phase synchronizers used. | 16 | * 2430 differs from 2420 in that there are no more phase synchronizers used. |
18 | * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs | 17 | * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs |
19 | * 2430 (iva2.1, NOdsp, mdm) | 18 | * 2430 (iva2.1, NOdsp, mdm) |
20 | * | 19 | * |
21 | * XXX Missing voltage data. | 20 | * XXX Missing voltage data. |
21 | * XXX Missing 19.2MHz sys_clk rate sets. | ||
22 | * | 22 | * |
23 | * THe format described in this file is deprecated. Once a reasonable | 23 | * THe format described in this file is deprecated. Once a reasonable |
24 | * OPP API exists, the data in this file should be converted to use it. | 24 | * OPP API exists, the data in this file should be converted to use it. |
@@ -30,24 +30,24 @@ | |||
30 | #include "sdrc.h" | 30 | #include "sdrc.h" |
31 | #include "clock.h" | 31 | #include "clock.h" |
32 | 32 | ||
33 | /*------------------------------------------------------------------------- | 33 | /* |
34 | * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. | 34 | * Key dividers which make up a PRCM set. Ratios for a PRCM are mandated. |
35 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU, | 35 | * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU, |
36 | * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL, | 36 | * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL, |
37 | * CM_CLKSEL2_PLL, CM_CLKSEL_MDM | 37 | * CM_CLKSEL2_PLL, CM_CLKSEL_MDM |
38 | * | 38 | * |
39 | * Filling in table based on H4 boards and 2430-SDPs variants available. | 39 | * Filling in table based on 2430-SDPs variants available. There are |
40 | * There are quite a few more rates combinations which could be defined. | 40 | * quite a few more rate combinations which could be defined. |
41 | * | 41 | * |
42 | * When multiple values are defined the start up will try and choose the | 42 | * When multiple values are defined the start up will try and choose |
43 | * fastest one. If a 'fast' value is defined, then automatically, the /2 | 43 | * the fastest one. If a 'fast' value is defined, then automatically, |
44 | * one should be included as it can be used. Generally having more that | 44 | * the /2 one should be included as it can be used. Generally having |
45 | * one fast set does not make sense, as static timings need to be changed | 45 | * more than one fast set does not make sense, as static timings need |
46 | * to change the set. The exception is the bypass setting which is | 46 | * to be changed to change the set. The exception is the bypass |
47 | * availble for low power bypass. | 47 | * setting which is available for low power bypass. |
48 | * | 48 | * |
49 | * Note: This table needs to be sorted, fastest to slowest. | 49 | * Note: This table needs to be sorted, fastest to slowest. |
50 | *-------------------------------------------------------------------------*/ | 50 | */ |
51 | const struct prcm_config omap2430_rate_table[] = { | 51 | const struct prcm_config omap2430_rate_table[] = { |
52 | /* PRCM #4 - ratio2 (ES2.1) - FAST */ | 52 | /* PRCM #4 - ratio2 (ES2.1) - FAST */ |
53 | {S13M, S798M, S399M, R2_CM_CLKSEL_MPU_VAL, /* 399MHz ARM */ | 53 | {S13M, S798M, S399M, R2_CM_CLKSEL_MPU_VAL, /* 399MHz ARM */ |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 81ed252a0f8a..c6cc809afb79 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -124,8 +124,8 @@ static void omap3_core_save_context(void) | |||
124 | control_padconf_off |= START_PADCONF_SAVE; | 124 | control_padconf_off |= START_PADCONF_SAVE; |
125 | omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF); | 125 | omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF); |
126 | /* wait for the save to complete */ | 126 | /* wait for the save to complete */ |
127 | while (!omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS) | 127 | while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS) |
128 | & PADCONF_SAVE_DONE) | 128 | & PADCONF_SAVE_DONE)) |
129 | ; | 129 | ; |
130 | /* Save the Interrupt controller context */ | 130 | /* Save the Interrupt controller context */ |
131 | omap_intc_save_context(); | 131 | omap_intc_save_context(); |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 19805a7de06c..8c964bec8159 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -125,6 +125,13 @@ static struct plat_serial8250_port serial_platform_data3[] = { | |||
125 | } | 125 | } |
126 | }; | 126 | }; |
127 | #endif | 127 | #endif |
128 | static inline unsigned int __serial_read_reg(struct uart_port *up, | ||
129 | int offset) | ||
130 | { | ||
131 | offset <<= up->regshift; | ||
132 | return (unsigned int)__raw_readb(up->membase + offset); | ||
133 | } | ||
134 | |||
128 | static inline unsigned int serial_read_reg(struct plat_serial8250_port *up, | 135 | static inline unsigned int serial_read_reg(struct plat_serial8250_port *up, |
129 | int offset) | 136 | int offset) |
130 | { | 137 | { |
@@ -583,11 +590,12 @@ static unsigned int serial_in_override(struct uart_port *up, int offset) | |||
583 | { | 590 | { |
584 | if (UART_RX == offset) { | 591 | if (UART_RX == offset) { |
585 | unsigned int lsr; | 592 | unsigned int lsr; |
586 | lsr = serial_read_reg(omap_uart[up->line].p, UART_LSR); | 593 | lsr = __serial_read_reg(up, UART_LSR); |
587 | if (!(lsr & UART_LSR_DR)) | 594 | if (!(lsr & UART_LSR_DR)) |
588 | return -EPERM; | 595 | return -EPERM; |
589 | } | 596 | } |
590 | return serial_read_reg(omap_uart[up->line].p, offset); | 597 | |
598 | return __serial_read_reg(up, offset); | ||
591 | } | 599 | } |
592 | 600 | ||
593 | void __init omap_serial_early_init(void) | 601 | void __init omap_serial_early_init(void) |
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 8a0837ea0294..dee92182749b 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -37,6 +37,8 @@ config MACH_ZYLONITE320 | |||
37 | config MACH_LITTLETON | 37 | config MACH_LITTLETON |
38 | bool "PXA3xx Form Factor Platform (aka Littleton)" | 38 | bool "PXA3xx Form Factor Platform (aka Littleton)" |
39 | select PXA3xx | 39 | select PXA3xx |
40 | select CPU_PXA300 | ||
41 | select CPU_PXA310 | ||
40 | select PXA_SSP | 42 | select PXA_SSP |
41 | 43 | ||
42 | config MACH_TAVOREVB | 44 | config MACH_TAVOREVB |
diff --git a/arch/arm/mach-pxa/include/mach/zylonite.h b/arch/arm/mach-pxa/include/mach/zylonite.h index bf6785adccf4..9edf645368d6 100644 --- a/arch/arm/mach-pxa/include/mach/zylonite.h +++ b/arch/arm/mach-pxa/include/mach/zylonite.h | |||
@@ -8,13 +8,6 @@ | |||
8 | /* the following variables are processor specific and initialized | 8 | /* the following variables are processor specific and initialized |
9 | * by the corresponding zylonite_pxa3xx_init() | 9 | * by the corresponding zylonite_pxa3xx_init() |
10 | */ | 10 | */ |
11 | struct platform_mmc_slot { | ||
12 | int gpio_cd; | ||
13 | int gpio_wp; | ||
14 | }; | ||
15 | |||
16 | extern struct platform_mmc_slot zylonite_mmc_slot[]; | ||
17 | |||
18 | extern int gpio_eth_irq; | 11 | extern int gpio_eth_irq; |
19 | extern int gpio_debug_led1; | 12 | extern int gpio_debug_led1; |
20 | extern int gpio_debug_led2; | 13 | extern int gpio_debug_led2; |
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c index f28c1715b910..fa527b258d61 100644 --- a/arch/arm/mach-pxa/littleton.c +++ b/arch/arm/mach-pxa/littleton.c | |||
@@ -110,6 +110,12 @@ static mfp_cfg_t littleton_mfp_cfg[] __initdata = { | |||
110 | GPIO7_MMC1_CLK, | 110 | GPIO7_MMC1_CLK, |
111 | GPIO8_MMC1_CMD, | 111 | GPIO8_MMC1_CMD, |
112 | GPIO15_GPIO, /* card detect */ | 112 | GPIO15_GPIO, /* card detect */ |
113 | |||
114 | /* UART3 */ | ||
115 | GPIO107_UART3_CTS, | ||
116 | GPIO108_UART3_RTS, | ||
117 | GPIO109_UART3_TXD, | ||
118 | GPIO110_UART3_RXD, | ||
113 | }; | 119 | }; |
114 | 120 | ||
115 | static struct resource smc91x_resources[] = { | 121 | static struct resource smc91x_resources[] = { |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index e5eeb3a62d01..c2b938a4d5c9 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -293,7 +293,7 @@ static struct pxamci_platform_data poodle_mci_platform_data = { | |||
293 | .init = poodle_mci_init, | 293 | .init = poodle_mci_init, |
294 | .setpower = poodle_mci_setpower, | 294 | .setpower = poodle_mci_setpower, |
295 | .exit = poodle_mci_exit, | 295 | .exit = poodle_mci_exit, |
296 | .gpio_card_detect = POODLE_IRQ_GPIO_nSD_DETECT, | 296 | .gpio_card_detect = POODLE_GPIO_nSD_DETECT, |
297 | .gpio_card_ro = POODLE_GPIO_nSD_WP, | 297 | .gpio_card_ro = POODLE_GPIO_nSD_WP, |
298 | .gpio_power = -1, | 298 | .gpio_power = -1, |
299 | }; | 299 | }; |
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c index 5b986a8bd9e6..75f2a37f945d 100644 --- a/arch/arm/mach-pxa/zeus.c +++ b/arch/arm/mach-pxa/zeus.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/mtd/physmap.h> | 25 | #include <linux/mtd/physmap.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/i2c/pca953x.h> | 27 | #include <linux/i2c/pca953x.h> |
28 | #include <linux/apm-emulation.h> | ||
28 | 29 | ||
29 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
30 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
@@ -626,8 +627,27 @@ static void zeus_power_off(void) | |||
626 | pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP); | 627 | pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP); |
627 | } | 628 | } |
628 | 629 | ||
629 | int zeus_get_pcb_info(struct i2c_client *client, unsigned gpio, | 630 | #ifdef CONFIG_APM_EMULATION |
630 | unsigned ngpio, void *context) | 631 | static void zeus_get_power_status(struct apm_power_info *info) |
632 | { | ||
633 | /* Power supply is always present */ | ||
634 | info->ac_line_status = APM_AC_ONLINE; | ||
635 | info->battery_status = APM_BATTERY_STATUS_NOT_PRESENT; | ||
636 | info->battery_flag = APM_BATTERY_FLAG_NOT_PRESENT; | ||
637 | } | ||
638 | |||
639 | static inline void zeus_setup_apm(void) | ||
640 | { | ||
641 | apm_get_power_status = zeus_get_power_status; | ||
642 | } | ||
643 | #else | ||
644 | static inline void zeus_setup_apm(void) | ||
645 | { | ||
646 | } | ||
647 | #endif | ||
648 | |||
649 | static int zeus_get_pcb_info(struct i2c_client *client, unsigned gpio, | ||
650 | unsigned ngpio, void *context) | ||
631 | { | 651 | { |
632 | int i; | 652 | int i; |
633 | u8 pcb_info = 0; | 653 | u8 pcb_info = 0; |
@@ -726,9 +746,18 @@ static mfp_cfg_t zeus_pin_config[] __initdata = { | |||
726 | GPIO99_GPIO, /* CF RDY */ | 746 | GPIO99_GPIO, /* CF RDY */ |
727 | }; | 747 | }; |
728 | 748 | ||
749 | /* | ||
750 | * DM9k MSCx settings: SRAM, 16 bits | ||
751 | * 17 cycles delay first access | ||
752 | * 5 cycles delay next access | ||
753 | * 13 cycles recovery time | ||
754 | * faster device | ||
755 | */ | ||
756 | #define DM9K_MSC_VALUE 0xe4c9 | ||
757 | |||
729 | static void __init zeus_init(void) | 758 | static void __init zeus_init(void) |
730 | { | 759 | { |
731 | u16 dm9000_msc = 0xe279; | 760 | u16 dm9000_msc = DM9K_MSC_VALUE; |
732 | 761 | ||
733 | system_rev = __raw_readw(ZEUS_CPLD_VERSION); | 762 | system_rev = __raw_readw(ZEUS_CPLD_VERSION); |
734 | pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f)); | 763 | pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f)); |
@@ -738,6 +767,7 @@ static void __init zeus_init(void) | |||
738 | MSC1 = (MSC1 & 0xffff0000) | dm9000_msc; | 767 | MSC1 = (MSC1 & 0xffff0000) | dm9000_msc; |
739 | 768 | ||
740 | pm_power_off = zeus_power_off; | 769 | pm_power_off = zeus_power_off; |
770 | zeus_setup_apm(); | ||
741 | 771 | ||
742 | pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config)); | 772 | pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config)); |
743 | 773 | ||
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index b66e9e2d06e7..2b4043c04d0c 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c | |||
@@ -36,9 +36,6 @@ | |||
36 | #include "devices.h" | 36 | #include "devices.h" |
37 | #include "generic.h" | 37 | #include "generic.h" |
38 | 38 | ||
39 | #define MAX_SLOTS 3 | ||
40 | struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS]; | ||
41 | |||
42 | int gpio_eth_irq; | 39 | int gpio_eth_irq; |
43 | int gpio_debug_led1; | 40 | int gpio_debug_led1; |
44 | int gpio_debug_led2; | 41 | int gpio_debug_led2; |
@@ -220,84 +217,28 @@ static inline void zylonite_init_lcd(void) {} | |||
220 | #endif | 217 | #endif |
221 | 218 | ||
222 | #if defined(CONFIG_MMC) | 219 | #if defined(CONFIG_MMC) |
223 | static int zylonite_mci_ro(struct device *dev) | ||
224 | { | ||
225 | struct platform_device *pdev = to_platform_device(dev); | ||
226 | |||
227 | return gpio_get_value(zylonite_mmc_slot[pdev->id].gpio_wp); | ||
228 | } | ||
229 | |||
230 | static int zylonite_mci_init(struct device *dev, | ||
231 | irq_handler_t zylonite_detect_int, | ||
232 | void *data) | ||
233 | { | ||
234 | struct platform_device *pdev = to_platform_device(dev); | ||
235 | int err, cd_irq, gpio_cd, gpio_wp; | ||
236 | |||
237 | cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd); | ||
238 | gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd; | ||
239 | gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp; | ||
240 | |||
241 | /* | ||
242 | * setup GPIO for Zylonite MMC controller | ||
243 | */ | ||
244 | err = gpio_request(gpio_cd, "mmc card detect"); | ||
245 | if (err) | ||
246 | goto err_request_cd; | ||
247 | gpio_direction_input(gpio_cd); | ||
248 | |||
249 | err = gpio_request(gpio_wp, "mmc write protect"); | ||
250 | if (err) | ||
251 | goto err_request_wp; | ||
252 | gpio_direction_input(gpio_wp); | ||
253 | |||
254 | err = request_irq(cd_irq, zylonite_detect_int, | ||
255 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
256 | "MMC card detect", data); | ||
257 | if (err) { | ||
258 | printk(KERN_ERR "%s: MMC/SD/SDIO: " | ||
259 | "can't request card detect IRQ\n", __func__); | ||
260 | goto err_request_irq; | ||
261 | } | ||
262 | |||
263 | return 0; | ||
264 | |||
265 | err_request_irq: | ||
266 | gpio_free(gpio_wp); | ||
267 | err_request_wp: | ||
268 | gpio_free(gpio_cd); | ||
269 | err_request_cd: | ||
270 | return err; | ||
271 | } | ||
272 | |||
273 | static void zylonite_mci_exit(struct device *dev, void *data) | ||
274 | { | ||
275 | struct platform_device *pdev = to_platform_device(dev); | ||
276 | int cd_irq, gpio_cd, gpio_wp; | ||
277 | |||
278 | cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd); | ||
279 | gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd; | ||
280 | gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp; | ||
281 | |||
282 | free_irq(cd_irq, data); | ||
283 | gpio_free(gpio_cd); | ||
284 | gpio_free(gpio_wp); | ||
285 | } | ||
286 | |||
287 | static struct pxamci_platform_data zylonite_mci_platform_data = { | 220 | static struct pxamci_platform_data zylonite_mci_platform_data = { |
288 | .detect_delay = 20, | 221 | .detect_delay = 20, |
289 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 222 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
290 | .init = zylonite_mci_init, | 223 | .gpio_card_detect = EXT_GPIO(0), |
291 | .exit = zylonite_mci_exit, | 224 | .gpio_card_ro = EXT_GPIO(2), |
292 | .get_ro = zylonite_mci_ro, | ||
293 | .gpio_card_detect = -1, | ||
294 | .gpio_card_ro = -1, | ||
295 | .gpio_power = -1, | 225 | .gpio_power = -1, |
296 | }; | 226 | }; |
297 | 227 | ||
298 | static struct pxamci_platform_data zylonite_mci2_platform_data = { | 228 | static struct pxamci_platform_data zylonite_mci2_platform_data = { |
299 | .detect_delay = 20, | 229 | .detect_delay = 20, |
300 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 230 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
231 | .gpio_card_detect = EXT_GPIO(1), | ||
232 | .gpio_card_ro = EXT_GPIO(3), | ||
233 | .gpio_power = -1, | ||
234 | }; | ||
235 | |||
236 | static struct pxamci_platform_data zylonite_mci3_platform_data = { | ||
237 | .detect_delay = 20, | ||
238 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | ||
239 | .gpio_card_detect = EXT_GPIO(30), | ||
240 | .gpio_card_ro = EXT_GPIO(31), | ||
241 | .gpio_power = -1, | ||
301 | }; | 242 | }; |
302 | 243 | ||
303 | static void __init zylonite_init_mmc(void) | 244 | static void __init zylonite_init_mmc(void) |
@@ -305,7 +246,7 @@ static void __init zylonite_init_mmc(void) | |||
305 | pxa_set_mci_info(&zylonite_mci_platform_data); | 246 | pxa_set_mci_info(&zylonite_mci_platform_data); |
306 | pxa3xx_set_mci2_info(&zylonite_mci2_platform_data); | 247 | pxa3xx_set_mci2_info(&zylonite_mci2_platform_data); |
307 | if (cpu_is_pxa310()) | 248 | if (cpu_is_pxa310()) |
308 | pxa3xx_set_mci3_info(&zylonite_mci_platform_data); | 249 | pxa3xx_set_mci3_info(&zylonite_mci3_platform_data); |
309 | } | 250 | } |
310 | #else | 251 | #else |
311 | static inline void zylonite_init_mmc(void) {} | 252 | static inline void zylonite_init_mmc(void) {} |
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c index 84095440a878..3aa73b3e33f2 100644 --- a/arch/arm/mach-pxa/zylonite_pxa300.c +++ b/arch/arm/mach-pxa/zylonite_pxa300.c | |||
@@ -129,8 +129,8 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = { | |||
129 | GPIO22_I2C_SDA, | 129 | GPIO22_I2C_SDA, |
130 | 130 | ||
131 | /* GPIO */ | 131 | /* GPIO */ |
132 | GPIO18_GPIO, /* GPIO Expander #0 INT_N */ | 132 | GPIO18_GPIO | MFP_PULL_HIGH, /* GPIO Expander #0 INT_N */ |
133 | GPIO19_GPIO, /* GPIO Expander #1 INT_N */ | 133 | GPIO19_GPIO | MFP_PULL_HIGH, /* GPIO Expander #1 INT_N */ |
134 | }; | 134 | }; |
135 | 135 | ||
136 | static mfp_cfg_t pxa300_mfp_cfg[] __initdata = { | 136 | static mfp_cfg_t pxa300_mfp_cfg[] __initdata = { |
@@ -258,10 +258,6 @@ void __init zylonite_pxa300_init(void) | |||
258 | /* detect LCD panel */ | 258 | /* detect LCD panel */ |
259 | zylonite_detect_lcd_panel(); | 259 | zylonite_detect_lcd_panel(); |
260 | 260 | ||
261 | /* MMC card detect & write protect for controller 0 */ | ||
262 | zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0); | ||
263 | zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2); | ||
264 | |||
265 | /* WM9713 IRQ */ | 261 | /* WM9713 IRQ */ |
266 | wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26); | 262 | wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26); |
267 | 263 | ||
@@ -276,10 +272,6 @@ void __init zylonite_pxa300_init(void) | |||
276 | if (cpu_is_pxa310()) { | 272 | if (cpu_is_pxa310()) { |
277 | pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg)); | 273 | pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg)); |
278 | gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO102); | 274 | gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO102); |
279 | |||
280 | /* MMC card detect & write protect for controller 2 */ | ||
281 | zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30); | ||
282 | zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31); | ||
283 | } | 275 | } |
284 | 276 | ||
285 | /* GPIOs for Debug LEDs */ | 277 | /* GPIOs for Debug LEDs */ |
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c index 60d08f23f5e4..9942bac4cf7d 100644 --- a/arch/arm/mach-pxa/zylonite_pxa320.c +++ b/arch/arm/mach-pxa/zylonite_pxa320.c | |||
@@ -209,10 +209,6 @@ void __init zylonite_pxa320_init(void) | |||
209 | gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2); | 209 | gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2); |
210 | gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2); | 210 | gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2); |
211 | 211 | ||
212 | /* MMC card detect & write protect for controller 0 */ | ||
213 | zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1); | ||
214 | zylonite_mmc_slot[0].gpio_wp = mfp_to_gpio(MFP_PIN_GPIO5); | ||
215 | |||
216 | /* WM9713 IRQ */ | 212 | /* WM9713 IRQ */ |
217 | wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15); | 213 | wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15); |
218 | } | 214 | } |
diff --git a/arch/arm/mach-s3c2410/include/mach/ts.h b/arch/arm/mach-s3c2410/include/mach/ts.h new file mode 100644 index 000000000000..dc361700d695 --- /dev/null +++ b/arch/arm/mach-s3c2410/include/mach/ts.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* linux/include/asm/arch-s3c2410/ts.h | ||
2 | * | ||
3 | * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #ifndef __ASM_ARM_TS_H | ||
11 | #define __ASM_ARM_TS_H | ||
12 | |||
13 | struct s3c2410_ts_mach_info { | ||
14 | int delay; | ||
15 | int presc; | ||
16 | int oversampling_shift; | ||
17 | }; | ||
18 | |||
19 | extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *); | ||
20 | |||
21 | #endif /* __ASM_ARM_TS_H */ | ||
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c index 4c79ac8a6c33..97162fdd0590 100644 --- a/arch/arm/mach-s3c2410/mach-bast.c +++ b/arch/arm/mach-s3c2410/mach-bast.c | |||
@@ -279,6 +279,7 @@ static struct s3c2410_nand_set __initdata bast_nand_sets[] = { | |||
279 | .name = "SmartMedia", | 279 | .name = "SmartMedia", |
280 | .nr_chips = 1, | 280 | .nr_chips = 1, |
281 | .nr_map = smartmedia_map, | 281 | .nr_map = smartmedia_map, |
282 | .options = NAND_SCAN_SILENT_NODEV, | ||
282 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), | 283 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), |
283 | .partitions = bast_default_nand_part, | 284 | .partitions = bast_default_nand_part, |
284 | }, | 285 | }, |
@@ -293,6 +294,7 @@ static struct s3c2410_nand_set __initdata bast_nand_sets[] = { | |||
293 | .name = "chip1", | 294 | .name = "chip1", |
294 | .nr_chips = 1, | 295 | .nr_chips = 1, |
295 | .nr_map = chip1_map, | 296 | .nr_map = chip1_map, |
297 | .options = NAND_SCAN_SILENT_NODEV, | ||
296 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), | 298 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), |
297 | .partitions = bast_default_nand_part, | 299 | .partitions = bast_default_nand_part, |
298 | }, | 300 | }, |
@@ -300,6 +302,7 @@ static struct s3c2410_nand_set __initdata bast_nand_sets[] = { | |||
300 | .name = "chip2", | 302 | .name = "chip2", |
301 | .nr_chips = 1, | 303 | .nr_chips = 1, |
302 | .nr_map = chip2_map, | 304 | .nr_map = chip2_map, |
305 | .options = NAND_SCAN_SILENT_NODEV, | ||
303 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), | 306 | .nr_partitions = ARRAY_SIZE(bast_default_nand_part), |
304 | .partitions = bast_default_nand_part, | 307 | .partitions = bast_default_nand_part, |
305 | } | 308 | } |
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c index 49053254c98d..1e34abe1a19e 100644 --- a/arch/arm/mach-s3c2410/mach-h1940.c +++ b/arch/arm/mach-s3c2410/mach-h1940.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <mach/h1940.h> | 46 | #include <mach/h1940.h> |
47 | #include <mach/h1940-latch.h> | 47 | #include <mach/h1940-latch.h> |
48 | #include <mach/fb.h> | 48 | #include <mach/fb.h> |
49 | #include <mach/ts.h> | ||
49 | #include <plat/udc.h> | 50 | #include <plat/udc.h> |
50 | #include <plat/iic.h> | 51 | #include <plat/iic.h> |
51 | 52 | ||
@@ -140,6 +141,11 @@ static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = { | |||
140 | .vbus_pin_inverted = 1, | 141 | .vbus_pin_inverted = 1, |
141 | }; | 142 | }; |
142 | 143 | ||
144 | static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = { | ||
145 | .delay = 10000, | ||
146 | .presc = 49, | ||
147 | .oversampling_shift = 2, | ||
148 | }; | ||
143 | 149 | ||
144 | /** | 150 | /** |
145 | * Set lcd on or off | 151 | * Set lcd on or off |
@@ -265,6 +271,7 @@ static struct platform_device h1940_lcd_powerdev = { | |||
265 | }; | 271 | }; |
266 | 272 | ||
267 | static struct platform_device *h1940_devices[] __initdata = { | 273 | static struct platform_device *h1940_devices[] __initdata = { |
274 | &s3c_device_ts, | ||
268 | &s3c_device_usb, | 275 | &s3c_device_usb, |
269 | &s3c_device_lcd, | 276 | &s3c_device_lcd, |
270 | &s3c_device_wdt, | 277 | &s3c_device_wdt, |
@@ -305,6 +312,7 @@ static void __init h1940_init(void) | |||
305 | 312 | ||
306 | s3c24xx_fb_set_platdata(&h1940_fb_info); | 313 | s3c24xx_fb_set_platdata(&h1940_fb_info); |
307 | s3c24xx_udc_set_platdata(&h1940_udc_cfg); | 314 | s3c24xx_udc_set_platdata(&h1940_udc_cfg); |
315 | s3c24xx_ts_set_platdata(&h1940_ts_cfg); | ||
308 | s3c_i2c0_set_platdata(NULL); | 316 | s3c_i2c0_set_platdata(NULL); |
309 | 317 | ||
310 | s3c_device_sdi.dev.platform_data = &h1940_mmc_cfg; | 318 | s3c_device_sdi.dev.platform_data = &h1940_mmc_cfg; |
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c index 015dfb2a80da..f35371db33f5 100644 --- a/arch/arm/mach-s3c2440/mach-osiris.c +++ b/arch/arm/mach-s3c2440/mach-osiris.c | |||
@@ -208,6 +208,7 @@ static struct s3c2410_nand_set __initdata osiris_nand_sets[] = { | |||
208 | .name = "External", | 208 | .name = "External", |
209 | .nr_chips = 1, | 209 | .nr_chips = 1, |
210 | .nr_map = external_map, | 210 | .nr_map = external_map, |
211 | .options = NAND_SCAN_SILENT_NODEV, | ||
211 | .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), | 212 | .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), |
212 | .partitions = osiris_default_nand_part, | 213 | .partitions = osiris_default_nand_part, |
213 | }, | 214 | }, |
@@ -222,6 +223,7 @@ static struct s3c2410_nand_set __initdata osiris_nand_sets[] = { | |||
222 | .name = "chip1", | 223 | .name = "chip1", |
223 | .nr_chips = 1, | 224 | .nr_chips = 1, |
224 | .nr_map = chip1_map, | 225 | .nr_map = chip1_map, |
226 | .options = NAND_SCAN_SILENT_NODEV, | ||
225 | .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), | 227 | .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), |
226 | .partitions = osiris_default_nand_part, | 228 | .partitions = osiris_default_nand_part, |
227 | }, | 229 | }, |
diff --git a/arch/arm/mach-w90x900/include/mach/system.h b/arch/arm/mach-w90x900/include/mach/system.h index 940640066857..ce228bdc66dd 100644 --- a/arch/arm/mach-w90x900/include/mach/system.h +++ b/arch/arm/mach-w90x900/include/mach/system.h | |||
@@ -15,7 +15,15 @@ | |||
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/io.h> | ||
18 | #include <asm/proc-fns.h> | 19 | #include <asm/proc-fns.h> |
20 | #include <mach/map.h> | ||
21 | #include <mach/regs-timer.h> | ||
22 | |||
23 | #define WTCR (TMR_BA + 0x1C) | ||
24 | #define WTCLK (1 << 10) | ||
25 | #define WTE (1 << 7) | ||
26 | #define WTRE (1 << 1) | ||
19 | 27 | ||
20 | static void arch_idle(void) | 28 | static void arch_idle(void) |
21 | { | 29 | { |
@@ -23,6 +31,11 @@ static void arch_idle(void) | |||
23 | 31 | ||
24 | static void arch_reset(char mode, const char *cmd) | 32 | static void arch_reset(char mode, const char *cmd) |
25 | { | 33 | { |
26 | cpu_reset(0); | 34 | if (mode == 's') { |
35 | /* Jump into ROM at address 0 */ | ||
36 | cpu_reset(0); | ||
37 | } else { | ||
38 | __raw_writel(WTE | WTRE | WTCLK, WTCR); | ||
39 | } | ||
27 | } | 40 | } |
28 | 41 | ||
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c index 4128af870b41..b80f769bc135 100644 --- a/arch/arm/mach-w90x900/time.c +++ b/arch/arm/mach-w90x900/time.c | |||
@@ -42,7 +42,10 @@ | |||
42 | #define TICKS_PER_SEC 100 | 42 | #define TICKS_PER_SEC 100 |
43 | #define PRESCALE 0x63 /* Divider = prescale + 1 */ | 43 | #define PRESCALE 0x63 /* Divider = prescale + 1 */ |
44 | 44 | ||
45 | unsigned int timer0_load; | 45 | #define TDR_SHIFT 24 |
46 | #define TDR_MASK ((1 << TDR_SHIFT) - 1) | ||
47 | |||
48 | static unsigned int timer0_load; | ||
46 | 49 | ||
47 | static void nuc900_clockevent_setmode(enum clock_event_mode mode, | 50 | static void nuc900_clockevent_setmode(enum clock_event_mode mode, |
48 | struct clock_event_device *clk) | 51 | struct clock_event_device *clk) |
@@ -88,7 +91,7 @@ static int nuc900_clockevent_setnextevent(unsigned long evt, | |||
88 | static struct clock_event_device nuc900_clockevent_device = { | 91 | static struct clock_event_device nuc900_clockevent_device = { |
89 | .name = "nuc900-timer0", | 92 | .name = "nuc900-timer0", |
90 | .shift = 32, | 93 | .shift = 32, |
91 | .features = CLOCK_EVT_MODE_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 94 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
92 | .set_mode = nuc900_clockevent_setmode, | 95 | .set_mode = nuc900_clockevent_setmode, |
93 | .set_next_event = nuc900_clockevent_setnextevent, | 96 | .set_next_event = nuc900_clockevent_setnextevent, |
94 | .rating = 300, | 97 | .rating = 300, |
@@ -112,8 +115,23 @@ static struct irqaction nuc900_timer0_irq = { | |||
112 | .handler = nuc900_timer0_interrupt, | 115 | .handler = nuc900_timer0_interrupt, |
113 | }; | 116 | }; |
114 | 117 | ||
115 | static void __init nuc900_clockevents_init(unsigned int rate) | 118 | static void __init nuc900_clockevents_init(void) |
116 | { | 119 | { |
120 | unsigned int rate; | ||
121 | struct clk *clk = clk_get(NULL, "timer0"); | ||
122 | |||
123 | BUG_ON(IS_ERR(clk)); | ||
124 | |||
125 | __raw_writel(0x00, REG_TCSR0); | ||
126 | |||
127 | clk_enable(clk); | ||
128 | rate = clk_get_rate(clk) / (PRESCALE + 1); | ||
129 | |||
130 | timer0_load = (rate / TICKS_PER_SEC); | ||
131 | |||
132 | __raw_writel(RESETINT, REG_TISR); | ||
133 | setup_irq(IRQ_TIMER0, &nuc900_timer0_irq); | ||
134 | |||
117 | nuc900_clockevent_device.mult = div_sc(rate, NSEC_PER_SEC, | 135 | nuc900_clockevent_device.mult = div_sc(rate, NSEC_PER_SEC, |
118 | nuc900_clockevent_device.shift); | 136 | nuc900_clockevent_device.shift); |
119 | nuc900_clockevent_device.max_delta_ns = clockevent_delta2ns(0xffffffff, | 137 | nuc900_clockevent_device.max_delta_ns = clockevent_delta2ns(0xffffffff, |
@@ -127,26 +145,35 @@ static void __init nuc900_clockevents_init(unsigned int rate) | |||
127 | 145 | ||
128 | static cycle_t nuc900_get_cycles(struct clocksource *cs) | 146 | static cycle_t nuc900_get_cycles(struct clocksource *cs) |
129 | { | 147 | { |
130 | return ~__raw_readl(REG_TDR1); | 148 | return (~__raw_readl(REG_TDR1)) & TDR_MASK; |
131 | } | 149 | } |
132 | 150 | ||
133 | static struct clocksource clocksource_nuc900 = { | 151 | static struct clocksource clocksource_nuc900 = { |
134 | .name = "nuc900-timer1", | 152 | .name = "nuc900-timer1", |
135 | .rating = 200, | 153 | .rating = 200, |
136 | .read = nuc900_get_cycles, | 154 | .read = nuc900_get_cycles, |
137 | .mask = CLOCKSOURCE_MASK(32), | 155 | .mask = CLOCKSOURCE_MASK(TDR_SHIFT), |
138 | .shift = 20, | 156 | .shift = 10, |
139 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 157 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
140 | }; | 158 | }; |
141 | 159 | ||
142 | static void __init nuc900_clocksource_init(unsigned int rate) | 160 | static void __init nuc900_clocksource_init(void) |
143 | { | 161 | { |
144 | unsigned int val; | 162 | unsigned int val; |
163 | unsigned int rate; | ||
164 | struct clk *clk = clk_get(NULL, "timer1"); | ||
165 | |||
166 | BUG_ON(IS_ERR(clk)); | ||
167 | |||
168 | __raw_writel(0x00, REG_TCSR1); | ||
169 | |||
170 | clk_enable(clk); | ||
171 | rate = clk_get_rate(clk) / (PRESCALE + 1); | ||
145 | 172 | ||
146 | __raw_writel(0xffffffff, REG_TICR1); | 173 | __raw_writel(0xffffffff, REG_TICR1); |
147 | 174 | ||
148 | val = __raw_readl(REG_TCSR1); | 175 | val = __raw_readl(REG_TCSR1); |
149 | val |= (COUNTEN | PERIOD); | 176 | val |= (COUNTEN | PERIOD | PRESCALE); |
150 | __raw_writel(val, REG_TCSR1); | 177 | __raw_writel(val, REG_TCSR1); |
151 | 178 | ||
152 | clocksource_nuc900.mult = | 179 | clocksource_nuc900.mult = |
@@ -156,25 +183,8 @@ static void __init nuc900_clocksource_init(unsigned int rate) | |||
156 | 183 | ||
157 | static void __init nuc900_timer_init(void) | 184 | static void __init nuc900_timer_init(void) |
158 | { | 185 | { |
159 | struct clk *ck_ext = clk_get(NULL, "ext"); | 186 | nuc900_clocksource_init(); |
160 | unsigned int rate; | 187 | nuc900_clockevents_init(); |
161 | |||
162 | BUG_ON(IS_ERR(ck_ext)); | ||
163 | |||
164 | rate = clk_get_rate(ck_ext); | ||
165 | clk_put(ck_ext); | ||
166 | rate = rate / (PRESCALE + 0x01); | ||
167 | |||
168 | /* set a known state */ | ||
169 | __raw_writel(0x00, REG_TCSR0); | ||
170 | __raw_writel(0x00, REG_TCSR1); | ||
171 | __raw_writel(RESETINT, REG_TISR); | ||
172 | timer0_load = (rate / TICKS_PER_SEC); | ||
173 | |||
174 | setup_irq(IRQ_TIMER0, &nuc900_timer0_irq); | ||
175 | |||
176 | nuc900_clocksource_init(rate); | ||
177 | nuc900_clockevents_init(rate); | ||
178 | } | 188 | } |
179 | 189 | ||
180 | struct sys_timer nuc900_timer = { | 190 | struct sys_timer nuc900_timer = { |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 52c40d155672..a04ffbbbe253 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -616,7 +616,7 @@ void __init mem_init(void) | |||
616 | "%dK data, %dK init, %luK highmem)\n", | 616 | "%dK data, %dK init, %luK highmem)\n", |
617 | nr_free_pages() << (PAGE_SHIFT-10), codesize >> 10, | 617 | nr_free_pages() << (PAGE_SHIFT-10), codesize >> 10, |
618 | datasize >> 10, initsize >> 10, | 618 | datasize >> 10, initsize >> 10, |
619 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); | 619 | totalhigh_pages << (PAGE_SHIFT-10)); |
620 | 620 | ||
621 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { | 621 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { |
622 | extern int sysctl_overcommit_memory; | 622 | extern int sysctl_overcommit_memory; |
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S index a26a605b73bd..0cb1848bd876 100644 --- a/arch/arm/mm/tlb-v7.S +++ b/arch/arm/mm/tlb-v7.S | |||
@@ -40,7 +40,6 @@ ENTRY(v7wbi_flush_user_tlb_range) | |||
40 | asid r3, r3 @ mask ASID | 40 | asid r3, r3 @ mask ASID |
41 | orr r0, r3, r0, lsl #PAGE_SHIFT @ Create initial MVA | 41 | orr r0, r3, r0, lsl #PAGE_SHIFT @ Create initial MVA |
42 | mov r1, r1, lsl #PAGE_SHIFT | 42 | mov r1, r1, lsl #PAGE_SHIFT |
43 | vma_vm_flags r2, r2 @ get vma->vm_flags | ||
44 | 1: | 43 | 1: |
45 | #ifdef CONFIG_SMP | 44 | #ifdef CONFIG_SMP |
46 | mcr p15, 0, r0, c8, c3, 1 @ TLB invalidate U MVA (shareable) | 45 | mcr p15, 0, r0, c8, c3, 1 @ TLB invalidate U MVA (shareable) |
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx25.h b/arch/arm/plat-mxc/include/mach/iomux-mx25.h index 810c47f56e77..9af494f0ab3d 100644 --- a/arch/arm/plat-mxc/include/mach/iomux-mx25.h +++ b/arch/arm/plat-mxc/include/mach/iomux-mx25.h | |||
@@ -58,19 +58,19 @@ | |||
58 | 58 | ||
59 | #define MX25_PAD_A18__A18 IOMUX_PAD(0x23c, 0x020, 0x10, 0, 0, NO_PAD_CTRL) | 59 | #define MX25_PAD_A18__A18 IOMUX_PAD(0x23c, 0x020, 0x10, 0, 0, NO_PAD_CTRL) |
60 | #define MX25_PAD_A18__GPIO_2_4 IOMUX_PAD(0x23c, 0x020, 0x15, 0, 0, NO_PAD_CTRL) | 60 | #define MX25_PAD_A18__GPIO_2_4 IOMUX_PAD(0x23c, 0x020, 0x15, 0, 0, NO_PAD_CTRL) |
61 | #define MX25_PAD_A18__FEC_COL IOMUX_PAD(0x23c, 0x020, 0x17, 0x504, 0, NO_PAD_CTL) | 61 | #define MX25_PAD_A18__FEC_COL IOMUX_PAD(0x23c, 0x020, 0x17, 0x504, 0, NO_PAD_CTRL) |
62 | 62 | ||
63 | #define MX25_PAD_A19__A19 IOMUX_PAD(0x240, 0x024, 0x10, 0, 0, NO_PAD_CTRL) | 63 | #define MX25_PAD_A19__A19 IOMUX_PAD(0x240, 0x024, 0x10, 0, 0, NO_PAD_CTRL) |
64 | #define MX25_PAD_A19__FEC_RX_ER IOMUX_PAD(0x240, 0x024, 0x17, 0x518, 0, NO_PAD_CTL) | 64 | #define MX25_PAD_A19__FEC_RX_ER IOMUX_PAD(0x240, 0x024, 0x17, 0x518, 0, NO_PAD_CTRL) |
65 | #define MX25_PAD_A19__GPIO_2_5 IOMUX_PAD(0x240, 0x024, 0x15, 0, 0, NO_PAD_CTRL) | 65 | #define MX25_PAD_A19__GPIO_2_5 IOMUX_PAD(0x240, 0x024, 0x15, 0, 0, NO_PAD_CTRL) |
66 | 66 | ||
67 | #define MX25_PAD_A20__A20 IOMUX_PAD(0x244, 0x028, 0x10, 0, 0, NO_PAD_CTRL) | 67 | #define MX25_PAD_A20__A20 IOMUX_PAD(0x244, 0x028, 0x10, 0, 0, NO_PAD_CTRL) |
68 | #define MX25_PAD_A20__GPIO_2_6 IOMUX_PAD(0x244, 0x028, 0x15, 0, 0, NO_PAD_CTRL) | 68 | #define MX25_PAD_A20__GPIO_2_6 IOMUX_PAD(0x244, 0x028, 0x15, 0, 0, NO_PAD_CTRL) |
69 | #define MX25_PAD_A20__FEC_RDATA2 IOMUX_PAD(0x244, 0x028, 0x17, 0x50c, 0, NO_PAD_CTL) | 69 | #define MX25_PAD_A20__FEC_RDATA2 IOMUX_PAD(0x244, 0x028, 0x17, 0x50c, 0, NO_PAD_CTRL) |
70 | 70 | ||
71 | #define MX25_PAD_A21__A21 IOMUX_PAD(0x248, 0x02c, 0x10, 0, 0, NO_PAD_CTRL) | 71 | #define MX25_PAD_A21__A21 IOMUX_PAD(0x248, 0x02c, 0x10, 0, 0, NO_PAD_CTRL) |
72 | #define MX25_PAD_A21__GPIO_2_7 IOMUX_PAD(0x248, 0x02c, 0x15, 0, 0, NO_PAD_CTRL) | 72 | #define MX25_PAD_A21__GPIO_2_7 IOMUX_PAD(0x248, 0x02c, 0x15, 0, 0, NO_PAD_CTRL) |
73 | #define MX25_PAD_A21__FEC_RDATA3 IOMUX_PAD(0x248, 0x02c, 0x17, 0x510, 0, NO_PAD_CTL) | 73 | #define MX25_PAD_A21__FEC_RDATA3 IOMUX_PAD(0x248, 0x02c, 0x17, 0x510, 0, NO_PAD_CTRL) |
74 | 74 | ||
75 | #define MX25_PAD_A22__A22 IOMUX_PAD(0x000, 0x030, 0x10, 0, 0, NO_PAD_CTRL) | 75 | #define MX25_PAD_A22__A22 IOMUX_PAD(0x000, 0x030, 0x10, 0, 0, NO_PAD_CTRL) |
76 | #define MX25_PAD_A22__GPIO_2_8 IOMUX_PAD(0x000, 0x030, 0x15, 0, 0, NO_PAD_CTRL) | 76 | #define MX25_PAD_A22__GPIO_2_8 IOMUX_PAD(0x000, 0x030, 0x15, 0, 0, NO_PAD_CTRL) |
@@ -80,11 +80,11 @@ | |||
80 | 80 | ||
81 | #define MX25_PAD_A24__A24 IOMUX_PAD(0x250, 0x038, 0x10, 0, 0, NO_PAD_CTRL) | 81 | #define MX25_PAD_A24__A24 IOMUX_PAD(0x250, 0x038, 0x10, 0, 0, NO_PAD_CTRL) |
82 | #define MX25_PAD_A24__GPIO_2_10 IOMUX_PAD(0x250, 0x038, 0x15, 0, 0, NO_PAD_CTRL) | 82 | #define MX25_PAD_A24__GPIO_2_10 IOMUX_PAD(0x250, 0x038, 0x15, 0, 0, NO_PAD_CTRL) |
83 | #define MX25_PAD_A24__FEC_RX_CLK IOMUX_PAD(0x250, 0x038, 0x17, 0x514, 0, NO_PAD_CTL) | 83 | #define MX25_PAD_A24__FEC_RX_CLK IOMUX_PAD(0x250, 0x038, 0x17, 0x514, 0, NO_PAD_CTRL) |
84 | 84 | ||
85 | #define MX25_PAD_A25__A25 IOMUX_PAD(0x254, 0x03c, 0x10, 0, 0, NO_PAD_CTRL) | 85 | #define MX25_PAD_A25__A25 IOMUX_PAD(0x254, 0x03c, 0x10, 0, 0, NO_PAD_CTRL) |
86 | #define MX25_PAD_A25__GPIO_2_11 IOMUX_PAD(0x254, 0x03c, 0x15, 0, 0, NO_PAD_CTRL) | 86 | #define MX25_PAD_A25__GPIO_2_11 IOMUX_PAD(0x254, 0x03c, 0x15, 0, 0, NO_PAD_CTRL) |
87 | #define MX25_PAD_A25__FEC_CRS IOMUX_PAD(0x254, 0x03c, 0x17, 0x508, 0, NO_PAD_CTL) | 87 | #define MX25_PAD_A25__FEC_CRS IOMUX_PAD(0x254, 0x03c, 0x17, 0x508, 0, NO_PAD_CTRL) |
88 | 88 | ||
89 | #define MX25_PAD_EB0__EB0 IOMUX_PAD(0x258, 0x040, 0x10, 0, 0, NO_PAD_CTRL) | 89 | #define MX25_PAD_EB0__EB0 IOMUX_PAD(0x258, 0x040, 0x10, 0, 0, NO_PAD_CTRL) |
90 | #define MX25_PAD_EB0__AUD4_TXD IOMUX_PAD(0x258, 0x040, 0x14, 0x464, 0, NO_PAD_CTRL) | 90 | #define MX25_PAD_EB0__AUD4_TXD IOMUX_PAD(0x258, 0x040, 0x14, 0x464, 0, NO_PAD_CTRL) |
@@ -112,7 +112,7 @@ | |||
112 | #define MX25_PAD_CS5__UART5_RTS IOMUX_PAD(0x268, 0x058, 0x13, 0x574, 0, NO_PAD_CTRL) | 112 | #define MX25_PAD_CS5__UART5_RTS IOMUX_PAD(0x268, 0x058, 0x13, 0x574, 0, NO_PAD_CTRL) |
113 | #define MX25_PAD_CS5__GPIO_3_21 IOMUX_PAD(0x268, 0x058, 0x15, 0, 0, NO_PAD_CTRL) | 113 | #define MX25_PAD_CS5__GPIO_3_21 IOMUX_PAD(0x268, 0x058, 0x15, 0, 0, NO_PAD_CTRL) |
114 | 114 | ||
115 | #define MX25_PAD_NF_CE0__NF_CE0 IOMUX_PAD(0x26c, 0x05c, 0x10, 0, 0, NO_PAD_CTL) | 115 | #define MX25_PAD_NF_CE0__NF_CE0 IOMUX_PAD(0x26c, 0x05c, 0x10, 0, 0, NO_PAD_CTRL) |
116 | #define MX25_PAD_NF_CE0__GPIO_3_22 IOMUX_PAD(0x26c, 0x05c, 0x15, 0, 0, NO_PAD_CTRL) | 116 | #define MX25_PAD_NF_CE0__GPIO_3_22 IOMUX_PAD(0x26c, 0x05c, 0x15, 0, 0, NO_PAD_CTRL) |
117 | 117 | ||
118 | #define MX25_PAD_ECB__ECB IOMUX_PAD(0x270, 0x060, 0x10, 0, 0, NO_PAD_CTRL) | 118 | #define MX25_PAD_ECB__ECB IOMUX_PAD(0x270, 0x060, 0x10, 0, 0, NO_PAD_CTRL) |
@@ -229,28 +229,28 @@ | |||
229 | #define MX25_PAD_LD7__GPIO_1_21 IOMUX_PAD(0x2dc, 0x0e4, 0x15, 0, 0, NO_PAD_CTRL) | 229 | #define MX25_PAD_LD7__GPIO_1_21 IOMUX_PAD(0x2dc, 0x0e4, 0x15, 0, 0, NO_PAD_CTRL) |
230 | 230 | ||
231 | #define MX25_PAD_LD8__LD8 IOMUX_PAD(0x2e0, 0x0e8, 0x10, 0, 0, NO_PAD_CTRL) | 231 | #define MX25_PAD_LD8__LD8 IOMUX_PAD(0x2e0, 0x0e8, 0x10, 0, 0, NO_PAD_CTRL) |
232 | #define MX25_PAD_LD8__FEC_TX_ERR IOMUX_PAD(0x2e0, 0x0e8, 0x15, 0, 0, NO_PAD_CTL) | 232 | #define MX25_PAD_LD8__FEC_TX_ERR IOMUX_PAD(0x2e0, 0x0e8, 0x15, 0, 0, NO_PAD_CTRL) |
233 | 233 | ||
234 | #define MX25_PAD_LD9__LD9 IOMUX_PAD(0x2e4, 0x0ec, 0x10, 0, 0, NO_PAD_CTRL) | 234 | #define MX25_PAD_LD9__LD9 IOMUX_PAD(0x2e4, 0x0ec, 0x10, 0, 0, NO_PAD_CTRL) |
235 | #define MX25_PAD_LD9__FEC_COL IOMUX_PAD(0x2e4, 0x0ec, 0x15, 0x504, 1, NO_PAD_CTL) | 235 | #define MX25_PAD_LD9__FEC_COL IOMUX_PAD(0x2e4, 0x0ec, 0x15, 0x504, 1, NO_PAD_CTRL) |
236 | 236 | ||
237 | #define MX25_PAD_LD10__LD10 IOMUX_PAD(0x2e8, 0x0f0, 0x10, 0, 0, NO_PAD_CTRL) | 237 | #define MX25_PAD_LD10__LD10 IOMUX_PAD(0x2e8, 0x0f0, 0x10, 0, 0, NO_PAD_CTRL) |
238 | #define MX25_PAD_LD10__FEC_RX_ER IOMUX_PAD(0x2e8, 0x0f0, 0x15, 0x518, 1, NO_PAD_CTL) | 238 | #define MX25_PAD_LD10__FEC_RX_ER IOMUX_PAD(0x2e8, 0x0f0, 0x15, 0x518, 1, NO_PAD_CTRL) |
239 | 239 | ||
240 | #define MX25_PAD_LD11__LD11 IOMUX_PAD(0x2ec, 0x0f4, 0x10, 0, 0, NO_PAD_CTRL) | 240 | #define MX25_PAD_LD11__LD11 IOMUX_PAD(0x2ec, 0x0f4, 0x10, 0, 0, NO_PAD_CTRL) |
241 | #define MX25_PAD_LD11__FEC_RDATA2 IOMUX_PAD(0x2ec, 0x0f4, 0x15, 0x50c, 1, NO_PAD_CTL) | 241 | #define MX25_PAD_LD11__FEC_RDATA2 IOMUX_PAD(0x2ec, 0x0f4, 0x15, 0x50c, 1, NO_PAD_CTRL) |
242 | 242 | ||
243 | #define MX25_PAD_LD12__LD12 IOMUX_PAD(0x2f0, 0x0f8, 0x10, 0, 0, NO_PAD_CTRL) | 243 | #define MX25_PAD_LD12__LD12 IOMUX_PAD(0x2f0, 0x0f8, 0x10, 0, 0, NO_PAD_CTRL) |
244 | #define MX25_PAD_LD12__FEC_RDATA3 IOMUX_PAD(0x2f0, 0x0f8, 0x15, 0x510, 1, NO_PAD_CTL) | 244 | #define MX25_PAD_LD12__FEC_RDATA3 IOMUX_PAD(0x2f0, 0x0f8, 0x15, 0x510, 1, NO_PAD_CTRL) |
245 | 245 | ||
246 | #define MX25_PAD_LD13__LD13 IOMUX_PAD(0x2f4, 0x0fc, 0x10, 0, 0, NO_PAD_CTRL) | 246 | #define MX25_PAD_LD13__LD13 IOMUX_PAD(0x2f4, 0x0fc, 0x10, 0, 0, NO_PAD_CTRL) |
247 | #define MX25_PAD_LD13__FEC_TDATA2 IOMUX_PAD(0x2f4, 0x0fc, 0x15, 0, 0, NO_PAD_CTL) | 247 | #define MX25_PAD_LD13__FEC_TDATA2 IOMUX_PAD(0x2f4, 0x0fc, 0x15, 0, 0, NO_PAD_CTRL) |
248 | 248 | ||
249 | #define MX25_PAD_LD14__LD14 IOMUX_PAD(0x2f8, 0x100, 0x10, 0, 0, NO_PAD_CTRL) | 249 | #define MX25_PAD_LD14__LD14 IOMUX_PAD(0x2f8, 0x100, 0x10, 0, 0, NO_PAD_CTRL) |
250 | #define MX25_PAD_LD14__FEC_TDATA3 IOMUX_PAD(0x2f8, 0x100, 0x15, 0, 0, NO_PAD_CTL) | 250 | #define MX25_PAD_LD14__FEC_TDATA3 IOMUX_PAD(0x2f8, 0x100, 0x15, 0, 0, NO_PAD_CTRL) |
251 | 251 | ||
252 | #define MX25_PAD_LD15__LD15 IOMUX_PAD(0x2fc, 0x104, 0x10, 0, 0, NO_PAD_CTRL) | 252 | #define MX25_PAD_LD15__LD15 IOMUX_PAD(0x2fc, 0x104, 0x10, 0, 0, NO_PAD_CTRL) |
253 | #define MX25_PAD_LD15__FEC_RX_CLK IOMUX_PAD(0x2fc, 0x104, 0x15, 0x514, 1, NO_PAD_CTL) | 253 | #define MX25_PAD_LD15__FEC_RX_CLK IOMUX_PAD(0x2fc, 0x104, 0x15, 0x514, 1, NO_PAD_CTRL) |
254 | 254 | ||
255 | #define MX25_PAD_HSYNC__HSYNC IOMUX_PAD(0x300, 0x108, 0x10, 0, 0, NO_PAD_CTRL) | 255 | #define MX25_PAD_HSYNC__HSYNC IOMUX_PAD(0x300, 0x108, 0x10, 0, 0, NO_PAD_CTRL) |
256 | #define MX25_PAD_HSYNC__GPIO_1_22 IOMUX_PAD(0x300, 0x108, 0x15, 0, 0, NO_PAD_CTRL) | 256 | #define MX25_PAD_HSYNC__GPIO_1_22 IOMUX_PAD(0x300, 0x108, 0x15, 0, 0, NO_PAD_CTRL) |
@@ -265,7 +265,7 @@ | |||
265 | #define MX25_PAD_OE_ACD__GPIO_1_25 IOMUX_PAD(0x30c, 0x114, 0x15, 0, 0, NO_PAD_CTRL) | 265 | #define MX25_PAD_OE_ACD__GPIO_1_25 IOMUX_PAD(0x30c, 0x114, 0x15, 0, 0, NO_PAD_CTRL) |
266 | 266 | ||
267 | #define MX25_PAD_CONTRAST__CONTRAST IOMUX_PAD(0x310, 0x118, 0x10, 0, 0, NO_PAD_CTRL) | 267 | #define MX25_PAD_CONTRAST__CONTRAST IOMUX_PAD(0x310, 0x118, 0x10, 0, 0, NO_PAD_CTRL) |
268 | #define MX25_PAD_CONTRAST__FEC_CRS IOMUX_PAD(0x310, 0x118, 0x15, 0x508, 1, NO_PAD_CTL) | 268 | #define MX25_PAD_CONTRAST__FEC_CRS IOMUX_PAD(0x310, 0x118, 0x15, 0x508, 1, NO_PAD_CTRL) |
269 | 269 | ||
270 | #define MX25_PAD_PWM__PWM IOMUX_PAD(0x314, 0x11c, 0x10, 0, 0, NO_PAD_CTRL) | 270 | #define MX25_PAD_PWM__PWM IOMUX_PAD(0x314, 0x11c, 0x10, 0, 0, NO_PAD_CTRL) |
271 | #define MX25_PAD_PWM__GPIO_1_26 IOMUX_PAD(0x314, 0x11c, 0x15, 0, 0, NO_PAD_CTRL) | 271 | #define MX25_PAD_PWM__GPIO_1_26 IOMUX_PAD(0x314, 0x11c, 0x15, 0, 0, NO_PAD_CTRL) |
@@ -354,19 +354,19 @@ | |||
354 | #define MX25_PAD_UART2_TXD__GPIO_4_27 IOMUX_PAD(0x37c, 0x184, 0x15, 0, 0, NO_PAD_CTRL) | 354 | #define MX25_PAD_UART2_TXD__GPIO_4_27 IOMUX_PAD(0x37c, 0x184, 0x15, 0, 0, NO_PAD_CTRL) |
355 | 355 | ||
356 | #define MX25_PAD_UART2_RTS__UART2_RTS IOMUX_PAD(0x380, 0x188, 0x10, 0, 0, NO_PAD_CTRL) | 356 | #define MX25_PAD_UART2_RTS__UART2_RTS IOMUX_PAD(0x380, 0x188, 0x10, 0, 0, NO_PAD_CTRL) |
357 | #define MX25_PAD_UART2_RTS__FEC_COL IOMUX_PAD(0x380, 0x188, 0x12, 0x504, 2, NO_PAD_CTL) | 357 | #define MX25_PAD_UART2_RTS__FEC_COL IOMUX_PAD(0x380, 0x188, 0x12, 0x504, 2, NO_PAD_CTRL) |
358 | #define MX25_PAD_UART2_RTS__GPIO_4_28 IOMUX_PAD(0x380, 0x188, 0x15, 0, 0, NO_PAD_CTRL) | 358 | #define MX25_PAD_UART2_RTS__GPIO_4_28 IOMUX_PAD(0x380, 0x188, 0x15, 0, 0, NO_PAD_CTRL) |
359 | 359 | ||
360 | #define MX25_PAD_UART2_CTS__FEC_RX_ER IOMUX_PAD(0x384, 0x18c, 0x12, 0x518, 2, NO_PAD_CTL) | 360 | #define MX25_PAD_UART2_CTS__FEC_RX_ER IOMUX_PAD(0x384, 0x18c, 0x12, 0x518, 2, NO_PAD_CTRL) |
361 | #define MX25_PAD_UART2_CTS__UART2_CTS IOMUX_PAD(0x384, 0x18c, 0x10, 0, 0, NO_PAD_CTRL) | 361 | #define MX25_PAD_UART2_CTS__UART2_CTS IOMUX_PAD(0x384, 0x18c, 0x10, 0, 0, NO_PAD_CTRL) |
362 | #define MX25_PAD_UART2_CTS__GPIO_4_29 IOMUX_PAD(0x384, 0x18c, 0x15, 0, 0, NO_PAD_CTRL) | 362 | #define MX25_PAD_UART2_CTS__GPIO_4_29 IOMUX_PAD(0x384, 0x18c, 0x15, 0, 0, NO_PAD_CTRL) |
363 | 363 | ||
364 | #define MX25_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x388, 0x190, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) | 364 | #define MX25_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x388, 0x190, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) |
365 | #define MX25_PAD_SD1_CMD__FEC_RDATA2 IOMUX_PAD(0x388, 0x190, 0x12, 0x50c, 2, NO_PAD_CTL) | 365 | #define MX25_PAD_SD1_CMD__FEC_RDATA2 IOMUX_PAD(0x388, 0x190, 0x12, 0x50c, 2, NO_PAD_CTRL) |
366 | #define MX25_PAD_SD1_CMD__GPIO_2_23 IOMUX_PAD(0x388, 0x190, 0x15, 0, 0, NO_PAD_CTRL) | 366 | #define MX25_PAD_SD1_CMD__GPIO_2_23 IOMUX_PAD(0x388, 0x190, 0x15, 0, 0, NO_PAD_CTRL) |
367 | 367 | ||
368 | #define MX25_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x38c, 0x194, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) | 368 | #define MX25_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x38c, 0x194, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) |
369 | #define MX25_PAD_SD1_CLK__FEC_RDATA3 IOMUX_PAD(0x38c, 0x194, 0x12, 0x510, 2, NO_PAD_CTL) | 369 | #define MX25_PAD_SD1_CLK__FEC_RDATA3 IOMUX_PAD(0x38c, 0x194, 0x12, 0x510, 2, NO_PAD_CTRL) |
370 | #define MX25_PAD_SD1_CLK__GPIO_2_24 IOMUX_PAD(0x38c, 0x194, 0x15, 0, 0, NO_PAD_CTRL) | 370 | #define MX25_PAD_SD1_CLK__GPIO_2_24 IOMUX_PAD(0x38c, 0x194, 0x15, 0, 0, NO_PAD_CTRL) |
371 | 371 | ||
372 | #define MX25_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x390, 0x198, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) | 372 | #define MX25_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x390, 0x198, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) |
@@ -377,11 +377,11 @@ | |||
377 | #define MX25_PAD_SD1_DATA1__GPIO_2_26 IOMUX_PAD(0x394, 0x19c, 0x15, 0, 0, NO_PAD_CTRL) | 377 | #define MX25_PAD_SD1_DATA1__GPIO_2_26 IOMUX_PAD(0x394, 0x19c, 0x15, 0, 0, NO_PAD_CTRL) |
378 | 378 | ||
379 | #define MX25_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x398, 0x1a0, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) | 379 | #define MX25_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x398, 0x1a0, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) |
380 | #define MX25_PAD_SD1_DATA2__FEC_RX_CLK IOMUX_PAD(0x398, 0x1a0, 0x15, 0x514, 2, NO_PAD_CTL) | 380 | #define MX25_PAD_SD1_DATA2__FEC_RX_CLK IOMUX_PAD(0x398, 0x1a0, 0x15, 0x514, 2, NO_PAD_CTRL) |
381 | #define MX25_PAD_SD1_DATA2__GPIO_2_27 IOMUX_PAD(0x398, 0x1a0, 0x15, 0, 0, NO_PAD_CTRL) | 381 | #define MX25_PAD_SD1_DATA2__GPIO_2_27 IOMUX_PAD(0x398, 0x1a0, 0x15, 0, 0, NO_PAD_CTRL) |
382 | 382 | ||
383 | #define MX25_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x39c, 0x1a4, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) | 383 | #define MX25_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x39c, 0x1a4, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) |
384 | #define MX25_PAD_SD1_DATA3__FEC_CRS IOMUX_PAD(0x39c, 0x1a4, 0x10, 0x508, 2, NO_PAD_CTL) | 384 | #define MX25_PAD_SD1_DATA3__FEC_CRS IOMUX_PAD(0x39c, 0x1a4, 0x10, 0x508, 2, NO_PAD_CTRL) |
385 | #define MX25_PAD_SD1_DATA3__GPIO_2_28 IOMUX_PAD(0x39c, 0x1a4, 0x15, 0, 0, NO_PAD_CTRL) | 385 | #define MX25_PAD_SD1_DATA3__GPIO_2_28 IOMUX_PAD(0x39c, 0x1a4, 0x15, 0, 0, NO_PAD_CTRL) |
386 | 386 | ||
387 | #define MX25_PAD_KPP_ROW0__KPP_ROW0 IOMUX_PAD(0x3a0, 0x1a8, 0x10, 0, 0, PAD_CTL_PKE) | 387 | #define MX25_PAD_KPP_ROW0__KPP_ROW0 IOMUX_PAD(0x3a0, 0x1a8, 0x10, 0, 0, PAD_CTL_PKE) |
@@ -410,7 +410,7 @@ | |||
410 | #define MX25_PAD_KPP_COL3__KPP_COL3 IOMUX_PAD(0x3bc, 0x1c4, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE) | 410 | #define MX25_PAD_KPP_COL3__KPP_COL3 IOMUX_PAD(0x3bc, 0x1c4, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE) |
411 | #define MX25_PAD_KPP_COL3__GPIO_3_4 IOMUX_PAD(0x3bc, 0x1c4, 0x15, 0, 0, NO_PAD_CTRL) | 411 | #define MX25_PAD_KPP_COL3__GPIO_3_4 IOMUX_PAD(0x3bc, 0x1c4, 0x15, 0, 0, NO_PAD_CTRL) |
412 | 412 | ||
413 | #define MX25_PAD_FEC_MDC__FEC_MDC IOMUX_PAD(0x3c0, 0x1c8, 0x10, 0, 0, NO_PAD_CTL) | 413 | #define MX25_PAD_FEC_MDC__FEC_MDC IOMUX_PAD(0x3c0, 0x1c8, 0x10, 0, 0, NO_PAD_CTRL) |
414 | #define MX25_PAD_FEC_MDC__AUD4_TXD IOMUX_PAD(0x3c0, 0x1c8, 0x12, 0x464, 1, NO_PAD_CTRL) | 414 | #define MX25_PAD_FEC_MDC__AUD4_TXD IOMUX_PAD(0x3c0, 0x1c8, 0x12, 0x464, 1, NO_PAD_CTRL) |
415 | #define MX25_PAD_FEC_MDC__GPIO_3_5 IOMUX_PAD(0x3c0, 0x1c8, 0x15, 0, 0, NO_PAD_CTRL) | 415 | #define MX25_PAD_FEC_MDC__GPIO_3_5 IOMUX_PAD(0x3c0, 0x1c8, 0x15, 0, 0, NO_PAD_CTRL) |
416 | 416 | ||
@@ -418,23 +418,23 @@ | |||
418 | #define MX25_PAD_FEC_MDIO__AUD4_RXD IOMUX_PAD(0x3c4, 0x1cc, 0x12, 0x460, 1, NO_PAD_CTRL) | 418 | #define MX25_PAD_FEC_MDIO__AUD4_RXD IOMUX_PAD(0x3c4, 0x1cc, 0x12, 0x460, 1, NO_PAD_CTRL) |
419 | #define MX25_PAD_FEC_MDIO__GPIO_3_6 IOMUX_PAD(0x3c4, 0x1cc, 0x15, 0, 0, NO_PAD_CTRL) | 419 | #define MX25_PAD_FEC_MDIO__GPIO_3_6 IOMUX_PAD(0x3c4, 0x1cc, 0x15, 0, 0, NO_PAD_CTRL) |
420 | 420 | ||
421 | #define MX25_PAD_FEC_TDATA0__FEC_TDATA0 IOMUX_PAD(0x3c8, 0x1d0, 0x10, 0, 0, NO_PAD_CTL) | 421 | #define MX25_PAD_FEC_TDATA0__FEC_TDATA0 IOMUX_PAD(0x3c8, 0x1d0, 0x10, 0, 0, NO_PAD_CTRL) |
422 | #define MX25_PAD_FEC_TDATA0__GPIO_3_7 IOMUX_PAD(0x3c8, 0x1d0, 0x15, 0, 0, NO_PAD_CTRL) | 422 | #define MX25_PAD_FEC_TDATA0__GPIO_3_7 IOMUX_PAD(0x3c8, 0x1d0, 0x15, 0, 0, NO_PAD_CTRL) |
423 | 423 | ||
424 | #define MX25_PAD_FEC_TDATA1__FEC_TDATA1 IOMUX_PAD(0x3cc, 0x1d4, 0x10, 0, 0, NO_PAD_CTL) | 424 | #define MX25_PAD_FEC_TDATA1__FEC_TDATA1 IOMUX_PAD(0x3cc, 0x1d4, 0x10, 0, 0, NO_PAD_CTRL) |
425 | #define MX25_PAD_FEC_TDATA1__AUD4_TXFS IOMUX_PAD(0x3cc, 0x1d4, 0x12, 0x474, 1, NO_PAD_CTRL) | 425 | #define MX25_PAD_FEC_TDATA1__AUD4_TXFS IOMUX_PAD(0x3cc, 0x1d4, 0x12, 0x474, 1, NO_PAD_CTRL) |
426 | #define MX25_PAD_FEC_TDATA1__GPIO_3_8 IOMUX_PAD(0x3cc, 0x1d4, 0x15, 0, 0, NO_PAD_CTRL) | 426 | #define MX25_PAD_FEC_TDATA1__GPIO_3_8 IOMUX_PAD(0x3cc, 0x1d4, 0x15, 0, 0, NO_PAD_CTRL) |
427 | 427 | ||
428 | #define MX25_PAD_FEC_TX_EN__FEC_TX_EN IOMUX_PAD(0x3d0, 0x1d8, 0x10, 0, 0, NO_PAD_CTL) | 428 | #define MX25_PAD_FEC_TX_EN__FEC_TX_EN IOMUX_PAD(0x3d0, 0x1d8, 0x10, 0, 0, NO_PAD_CTRL) |
429 | #define MX25_PAD_FEC_TX_EN__GPIO_3_9 IOMUX_PAD(0x3d0, 0x1d8, 0x15, 0, 0, NO_PAD_CTRL) | 429 | #define MX25_PAD_FEC_TX_EN__GPIO_3_9 IOMUX_PAD(0x3d0, 0x1d8, 0x15, 0, 0, NO_PAD_CTRL) |
430 | 430 | ||
431 | #define MX25_PAD_FEC_RDATA0__FEC_RDATA0 IOMUX_PAD(0x3d4, 0x1dc, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTL) | 431 | #define MX25_PAD_FEC_RDATA0__FEC_RDATA0 IOMUX_PAD(0x3d4, 0x1dc, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTRL) |
432 | #define MX25_PAD_FEC_RDATA0__GPIO_3_10 IOMUX_PAD(0x3d4, 0x1dc, 0x15, 0, 0, NO_PAD_CTRL) | 432 | #define MX25_PAD_FEC_RDATA0__GPIO_3_10 IOMUX_PAD(0x3d4, 0x1dc, 0x15, 0, 0, NO_PAD_CTRL) |
433 | 433 | ||
434 | #define MX25_PAD_FEC_RDATA1__FEC_RDATA1 IOMUX_PAD(0x3d8, 0x1e0, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTL) | 434 | #define MX25_PAD_FEC_RDATA1__FEC_RDATA1 IOMUX_PAD(0x3d8, 0x1e0, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTRL) |
435 | #define MX25_PAD_FEC_RDATA1__GPIO_3_11 IOMUX_PAD(0x3d8, 0x1e0, 0x15, 0, 0, NO_PAD_CTRL) | 435 | #define MX25_PAD_FEC_RDATA1__GPIO_3_11 IOMUX_PAD(0x3d8, 0x1e0, 0x15, 0, 0, NO_PAD_CTRL) |
436 | 436 | ||
437 | #define MX25_PAD_FEC_RX_DV__FEC_RX_DV IOMUX_PAD(0x3dc, 0x1e4, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTL) | 437 | #define MX25_PAD_FEC_RX_DV__FEC_RX_DV IOMUX_PAD(0x3dc, 0x1e4, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTRL) |
438 | #define MX25_PAD_FEC_RX_DV__CAN2_RX IOMUX_PAD(0x3dc, 0x1e4, 0x14, 0x484, 0, PAD_CTL_PUS_22K_UP) | 438 | #define MX25_PAD_FEC_RX_DV__CAN2_RX IOMUX_PAD(0x3dc, 0x1e4, 0x14, 0x484, 0, PAD_CTL_PUS_22K_UP) |
439 | #define MX25_PAD_FEC_RX_DV__GPIO_3_12 IOMUX_PAD(0x3dc, 0x1e4, 0x15, 0, 0, NO_PAD_CTRL) | 439 | #define MX25_PAD_FEC_RX_DV__GPIO_3_12 IOMUX_PAD(0x3dc, 0x1e4, 0x15, 0, 0, NO_PAD_CTRL) |
440 | 440 | ||
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h index 91e738144804..854e2dc58481 100644 --- a/arch/arm/plat-mxc/include/mach/mx25.h +++ b/arch/arm/plat-mxc/include/mach/mx25.h | |||
@@ -41,4 +41,8 @@ | |||
41 | #define UART1_BASE_ADDR 0x43f90000 | 41 | #define UART1_BASE_ADDR 0x43f90000 |
42 | #define UART2_BASE_ADDR 0x43f94000 | 42 | #define UART2_BASE_ADDR 0x43f94000 |
43 | 43 | ||
44 | #define MX25_FEC_BASE_ADDR 0x50038000 | ||
45 | |||
46 | #define MX25_INT_FEC 57 | ||
47 | |||
44 | #endif /* __MACH_MX25_H__ */ | 48 | #endif /* __MACH_MX25_H__ */ |
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 89cafc937249..d9f8c844c385 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -36,10 +36,6 @@ static struct clk_functions *arch_clock; | |||
36 | * Standard clock functions defined in include/linux/clk.h | 36 | * Standard clock functions defined in include/linux/clk.h |
37 | *-------------------------------------------------------------------------*/ | 37 | *-------------------------------------------------------------------------*/ |
38 | 38 | ||
39 | /* This functions is moved to arch/arm/common/clkdev.c. For OMAP4 since | ||
40 | * clock framework is not up , it is defined here to avoid rework in | ||
41 | * every driver. Also dummy prcm reset function is added */ | ||
42 | |||
43 | int clk_enable(struct clk *clk) | 39 | int clk_enable(struct clk *clk) |
44 | { | 40 | { |
45 | unsigned long flags; | 41 | unsigned long flags; |
@@ -305,7 +301,6 @@ void clk_enable_init_clocks(void) | |||
305 | clk_enable(clkp); | 301 | clk_enable(clkp); |
306 | } | 302 | } |
307 | } | 303 | } |
308 | EXPORT_SYMBOL(clk_enable_init_clocks); | ||
309 | 304 | ||
310 | /* | 305 | /* |
311 | * Low level helpers | 306 | * Low level helpers |
@@ -334,7 +329,16 @@ void clk_init_cpufreq_table(struct cpufreq_frequency_table **table) | |||
334 | arch_clock->clk_init_cpufreq_table(table); | 329 | arch_clock->clk_init_cpufreq_table(table); |
335 | spin_unlock_irqrestore(&clockfw_lock, flags); | 330 | spin_unlock_irqrestore(&clockfw_lock, flags); |
336 | } | 331 | } |
337 | EXPORT_SYMBOL(clk_init_cpufreq_table); | 332 | |
333 | void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table) | ||
334 | { | ||
335 | unsigned long flags; | ||
336 | |||
337 | spin_lock_irqsave(&clockfw_lock, flags); | ||
338 | if (arch_clock->clk_exit_cpufreq_table) | ||
339 | arch_clock->clk_exit_cpufreq_table(table); | ||
340 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
341 | } | ||
338 | #endif | 342 | #endif |
339 | 343 | ||
340 | /*-------------------------------------------------------------------------*/ | 344 | /*-------------------------------------------------------------------------*/ |
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c index f8ddbdd8b076..6d3d33360056 100644 --- a/arch/arm/plat-omap/cpu-omap.c +++ b/arch/arm/plat-omap/cpu-omap.c | |||
@@ -134,6 +134,7 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy) | |||
134 | 134 | ||
135 | static int omap_cpu_exit(struct cpufreq_policy *policy) | 135 | static int omap_cpu_exit(struct cpufreq_policy *policy) |
136 | { | 136 | { |
137 | clk_exit_cpufreq_table(&freq_table); | ||
137 | clk_put(mpu_clk); | 138 | clk_put(mpu_clk); |
138 | return 0; | 139 | return 0; |
139 | } | 140 | } |
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 04846811d0aa..d17620c50c28 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
@@ -192,6 +192,7 @@ struct gpio_bank { | |||
192 | u32 saved_risingdetect; | 192 | u32 saved_risingdetect; |
193 | #endif | 193 | #endif |
194 | u32 level_mask; | 194 | u32 level_mask; |
195 | u32 toggle_mask; | ||
195 | spinlock_t lock; | 196 | spinlock_t lock; |
196 | struct gpio_chip chip; | 197 | struct gpio_chip chip; |
197 | struct clk *dbck; | 198 | struct clk *dbck; |
@@ -749,6 +750,44 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
749 | } | 750 | } |
750 | #endif | 751 | #endif |
751 | 752 | ||
753 | /* | ||
754 | * This only applies to chips that can't do both rising and falling edge | ||
755 | * detection at once. For all other chips, this function is a noop. | ||
756 | */ | ||
757 | static void _toggle_gpio_edge_triggering(struct gpio_bank *bank, int gpio) | ||
758 | { | ||
759 | void __iomem *reg = bank->base; | ||
760 | u32 l = 0; | ||
761 | |||
762 | switch (bank->method) { | ||
763 | #ifdef CONFIG_ARCH_OMAP1 | ||
764 | case METHOD_MPUIO: | ||
765 | reg += OMAP_MPUIO_GPIO_INT_EDGE; | ||
766 | break; | ||
767 | #endif | ||
768 | #ifdef CONFIG_ARCH_OMAP15XX | ||
769 | case METHOD_GPIO_1510: | ||
770 | reg += OMAP1510_GPIO_INT_CONTROL; | ||
771 | break; | ||
772 | #endif | ||
773 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) | ||
774 | case METHOD_GPIO_7XX: | ||
775 | reg += OMAP7XX_GPIO_INT_CONTROL; | ||
776 | break; | ||
777 | #endif | ||
778 | default: | ||
779 | return; | ||
780 | } | ||
781 | |||
782 | l = __raw_readl(reg); | ||
783 | if ((l >> gpio) & 1) | ||
784 | l &= ~(1 << gpio); | ||
785 | else | ||
786 | l |= 1 << gpio; | ||
787 | |||
788 | __raw_writel(l, reg); | ||
789 | } | ||
790 | |||
752 | static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) | 791 | static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) |
753 | { | 792 | { |
754 | void __iomem *reg = bank->base; | 793 | void __iomem *reg = bank->base; |
@@ -759,6 +798,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) | |||
759 | case METHOD_MPUIO: | 798 | case METHOD_MPUIO: |
760 | reg += OMAP_MPUIO_GPIO_INT_EDGE; | 799 | reg += OMAP_MPUIO_GPIO_INT_EDGE; |
761 | l = __raw_readl(reg); | 800 | l = __raw_readl(reg); |
801 | if (trigger & IRQ_TYPE_EDGE_BOTH) | ||
802 | bank->toggle_mask |= 1 << gpio; | ||
762 | if (trigger & IRQ_TYPE_EDGE_RISING) | 803 | if (trigger & IRQ_TYPE_EDGE_RISING) |
763 | l |= 1 << gpio; | 804 | l |= 1 << gpio; |
764 | else if (trigger & IRQ_TYPE_EDGE_FALLING) | 805 | else if (trigger & IRQ_TYPE_EDGE_FALLING) |
@@ -771,6 +812,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) | |||
771 | case METHOD_GPIO_1510: | 812 | case METHOD_GPIO_1510: |
772 | reg += OMAP1510_GPIO_INT_CONTROL; | 813 | reg += OMAP1510_GPIO_INT_CONTROL; |
773 | l = __raw_readl(reg); | 814 | l = __raw_readl(reg); |
815 | if (trigger & IRQ_TYPE_EDGE_BOTH) | ||
816 | bank->toggle_mask |= 1 << gpio; | ||
774 | if (trigger & IRQ_TYPE_EDGE_RISING) | 817 | if (trigger & IRQ_TYPE_EDGE_RISING) |
775 | l |= 1 << gpio; | 818 | l |= 1 << gpio; |
776 | else if (trigger & IRQ_TYPE_EDGE_FALLING) | 819 | else if (trigger & IRQ_TYPE_EDGE_FALLING) |
@@ -803,6 +846,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) | |||
803 | case METHOD_GPIO_7XX: | 846 | case METHOD_GPIO_7XX: |
804 | reg += OMAP7XX_GPIO_INT_CONTROL; | 847 | reg += OMAP7XX_GPIO_INT_CONTROL; |
805 | l = __raw_readl(reg); | 848 | l = __raw_readl(reg); |
849 | if (trigger & IRQ_TYPE_EDGE_BOTH) | ||
850 | bank->toggle_mask |= 1 << gpio; | ||
806 | if (trigger & IRQ_TYPE_EDGE_RISING) | 851 | if (trigger & IRQ_TYPE_EDGE_RISING) |
807 | l |= 1 << gpio; | 852 | l |= 1 << gpio; |
808 | else if (trigger & IRQ_TYPE_EDGE_FALLING) | 853 | else if (trigger & IRQ_TYPE_EDGE_FALLING) |
@@ -1072,7 +1117,7 @@ static inline void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int ena | |||
1072 | */ | 1117 | */ |
1073 | static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) | 1118 | static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) |
1074 | { | 1119 | { |
1075 | unsigned long flags; | 1120 | unsigned long uninitialized_var(flags); |
1076 | 1121 | ||
1077 | switch (bank->method) { | 1122 | switch (bank->method) { |
1078 | #ifdef CONFIG_ARCH_OMAP16XX | 1123 | #ifdef CONFIG_ARCH_OMAP16XX |
@@ -1217,7 +1262,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
1217 | { | 1262 | { |
1218 | void __iomem *isr_reg = NULL; | 1263 | void __iomem *isr_reg = NULL; |
1219 | u32 isr; | 1264 | u32 isr; |
1220 | unsigned int gpio_irq; | 1265 | unsigned int gpio_irq, gpio_index; |
1221 | struct gpio_bank *bank; | 1266 | struct gpio_bank *bank; |
1222 | u32 retrigger = 0; | 1267 | u32 retrigger = 0; |
1223 | int unmasked = 0; | 1268 | int unmasked = 0; |
@@ -1284,9 +1329,23 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
1284 | 1329 | ||
1285 | gpio_irq = bank->virtual_irq_start; | 1330 | gpio_irq = bank->virtual_irq_start; |
1286 | for (; isr != 0; isr >>= 1, gpio_irq++) { | 1331 | for (; isr != 0; isr >>= 1, gpio_irq++) { |
1332 | gpio_index = get_gpio_index(irq_to_gpio(gpio_irq)); | ||
1333 | |||
1287 | if (!(isr & 1)) | 1334 | if (!(isr & 1)) |
1288 | continue; | 1335 | continue; |
1289 | 1336 | ||
1337 | #ifdef CONFIG_ARCH_OMAP1 | ||
1338 | /* | ||
1339 | * Some chips can't respond to both rising and falling | ||
1340 | * at the same time. If this irq was requested with | ||
1341 | * both flags, we need to flip the ICR data for the IRQ | ||
1342 | * to respond to the IRQ for the opposite direction. | ||
1343 | * This will be indicated in the bank toggle_mask. | ||
1344 | */ | ||
1345 | if (bank->toggle_mask & (1 << gpio_index)) | ||
1346 | _toggle_gpio_edge_triggering(bank, gpio_index); | ||
1347 | #endif | ||
1348 | |||
1290 | generic_handle_irq(gpio_irq); | 1349 | generic_handle_irq(gpio_irq); |
1291 | } | 1350 | } |
1292 | } | 1351 | } |
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h index 376ce18216ff..5cd622039da0 100644 --- a/arch/arm/plat-omap/include/plat/board.h +++ b/arch/arm/plat-omap/include/plat/board.h | |||
@@ -99,7 +99,6 @@ struct fb_info; | |||
99 | struct omap_backlight_config { | 99 | struct omap_backlight_config { |
100 | int default_intensity; | 100 | int default_intensity; |
101 | int (*set_power)(struct device *dev, int state); | 101 | int (*set_power)(struct device *dev, int state); |
102 | int (*check_fb)(struct fb_info *fb); | ||
103 | }; | 102 | }; |
104 | 103 | ||
105 | struct omap_fbmem_config { | 104 | struct omap_fbmem_config { |
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h index 309b6d1dccdb..94fe2a0ce40a 100644 --- a/arch/arm/plat-omap/include/plat/clock.h +++ b/arch/arm/plat-omap/include/plat/clock.h | |||
@@ -119,6 +119,7 @@ struct clk_functions { | |||
119 | void (*clk_disable_unused)(struct clk *clk); | 119 | void (*clk_disable_unused)(struct clk *clk); |
120 | #ifdef CONFIG_CPU_FREQ | 120 | #ifdef CONFIG_CPU_FREQ |
121 | void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **); | 121 | void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **); |
122 | void (*clk_exit_cpufreq_table)(struct cpufreq_frequency_table **); | ||
122 | #endif | 123 | #endif |
123 | }; | 124 | }; |
124 | 125 | ||
@@ -135,6 +136,7 @@ extern unsigned long followparent_recalc(struct clk *clk); | |||
135 | extern void clk_enable_init_clocks(void); | 136 | extern void clk_enable_init_clocks(void); |
136 | #ifdef CONFIG_CPU_FREQ | 137 | #ifdef CONFIG_CPU_FREQ |
137 | extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table); | 138 | extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table); |
139 | extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table); | ||
138 | #endif | 140 | #endif |
139 | 141 | ||
140 | extern const struct clkops clkops_null; | 142 | extern const struct clkops clkops_null; |
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/plat-omap/include/plat/control.h index 2ae884378638..a745d62fad0d 100644 --- a/arch/arm/plat-omap/include/plat/control.h +++ b/arch/arm/plat-omap/include/plat/control.h | |||
@@ -147,7 +147,7 @@ | |||
147 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) | 147 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) |
148 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) | 148 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) |
149 | #define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \ | 149 | #define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \ |
150 | + ((i) >> 1) * 4 + (!(i) & 1) * 2) | 150 | + ((i) >> 1) * 4 + (!((i) & 1)) * 2) |
151 | #define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4) | 151 | #define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4) |
152 | #define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8) | 152 | #define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8) |
153 | #define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0) | 153 | #define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0) |
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h index 7e5319f907d1..a3e7b471bcba 100644 --- a/arch/arm/plat-omap/include/plat/io.h +++ b/arch/arm/plat-omap/include/plat/io.h | |||
@@ -122,16 +122,21 @@ | |||
122 | #define OMAP243X_SMS_VIRT (OMAP243X_SMS_PHYS + OMAP2_L3_IO_OFFSET) | 122 | #define OMAP243X_SMS_VIRT (OMAP243X_SMS_PHYS + OMAP2_L3_IO_OFFSET) |
123 | #define OMAP243X_SMS_SIZE SZ_1M | 123 | #define OMAP243X_SMS_SIZE SZ_1M |
124 | 124 | ||
125 | /* DSP */ | 125 | /* 2420 IVA */ |
126 | #define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */ | 126 | #define DSP_MEM_2420_PHYS OMAP2420_DSP_MEM_BASE |
127 | #define DSP_MEM_24XX_VIRT 0xe0000000 | 127 | /* 0x58000000 --> 0xfc100000 */ |
128 | #define DSP_MEM_24XX_SIZE 0x28000 | 128 | #define DSP_MEM_2420_VIRT 0xfc100000 |
129 | #define DSP_IPI_24XX_PHYS OMAP2420_DSP_IPI_BASE /* 0x59000000 */ | 129 | #define DSP_MEM_2420_SIZE 0x28000 |
130 | #define DSP_IPI_24XX_VIRT 0xe1000000 | 130 | #define DSP_IPI_2420_PHYS OMAP2420_DSP_IPI_BASE |
131 | #define DSP_IPI_24XX_SIZE SZ_4K | 131 | /* 0x59000000 --> 0xfc128000 */ |
132 | #define DSP_MMU_24XX_PHYS OMAP2420_DSP_MMU_BASE /* 0x5a000000 */ | 132 | #define DSP_IPI_2420_VIRT 0xfc128000 |
133 | #define DSP_MMU_24XX_VIRT 0xe2000000 | 133 | #define DSP_IPI_2420_SIZE SZ_4K |
134 | #define DSP_MMU_24XX_SIZE SZ_4K | 134 | #define DSP_MMU_2420_PHYS OMAP2420_DSP_MMU_BASE |
135 | /* 0x5a000000 --> 0xfc129000 */ | ||
136 | #define DSP_MMU_2420_VIRT 0xfc129000 | ||
137 | #define DSP_MMU_2420_SIZE SZ_4K | ||
138 | |||
139 | /* 2430 IVA2.1 - currently unmapped */ | ||
135 | 140 | ||
136 | /* | 141 | /* |
137 | * ---------------------------------------------------------------------------- | 142 | * ---------------------------------------------------------------------------- |
@@ -182,16 +187,7 @@ | |||
182 | #define OMAP343X_SDRC_VIRT (OMAP343X_SDRC_PHYS + OMAP2_L3_IO_OFFSET) | 187 | #define OMAP343X_SDRC_VIRT (OMAP343X_SDRC_PHYS + OMAP2_L3_IO_OFFSET) |
183 | #define OMAP343X_SDRC_SIZE SZ_1M | 188 | #define OMAP343X_SDRC_SIZE SZ_1M |
184 | 189 | ||
185 | /* DSP */ | 190 | /* 3430 IVA - currently unmapped */ |
186 | #define DSP_MEM_34XX_PHYS OMAP34XX_DSP_MEM_BASE /* 0x58000000 */ | ||
187 | #define DSP_MEM_34XX_VIRT 0xe0000000 | ||
188 | #define DSP_MEM_34XX_SIZE 0x28000 | ||
189 | #define DSP_IPI_34XX_PHYS OMAP34XX_DSP_IPI_BASE /* 0x59000000 */ | ||
190 | #define DSP_IPI_34XX_VIRT 0xe1000000 | ||
191 | #define DSP_IPI_34XX_SIZE SZ_4K | ||
192 | #define DSP_MMU_34XX_PHYS OMAP34XX_DSP_MMU_BASE /* 0x5a000000 */ | ||
193 | #define DSP_MMU_34XX_VIRT 0xe2000000 | ||
194 | #define DSP_MMU_34XX_SIZE SZ_4K | ||
195 | 191 | ||
196 | /* | 192 | /* |
197 | * ---------------------------------------------------------------------------- | 193 | * ---------------------------------------------------------------------------- |
diff --git a/arch/arm/plat-omap/include/plat/mux.h b/arch/arm/plat-omap/include/plat/mux.h index 8f069cc80350..692c90e89ac3 100644 --- a/arch/arm/plat-omap/include/plat/mux.h +++ b/arch/arm/plat-omap/include/plat/mux.h | |||
@@ -183,6 +183,14 @@ enum omap7xx_index { | |||
183 | /* I2C */ | 183 | /* I2C */ |
184 | I2C_7XX_SCL, | 184 | I2C_7XX_SCL, |
185 | I2C_7XX_SDA, | 185 | I2C_7XX_SDA, |
186 | |||
187 | /* SPI */ | ||
188 | SPI_7XX_1, | ||
189 | SPI_7XX_2, | ||
190 | SPI_7XX_3, | ||
191 | SPI_7XX_4, | ||
192 | SPI_7XX_5, | ||
193 | SPI_7XX_6, | ||
186 | }; | 194 | }; |
187 | 195 | ||
188 | enum omap1xxx_index { | 196 | enum omap1xxx_index { |
diff --git a/arch/arm/plat-omap/include/plat/omap7xx.h b/arch/arm/plat-omap/include/plat/omap7xx.h index 53f52414b0e9..48e4757e1e30 100644 --- a/arch/arm/plat-omap/include/plat/omap7xx.h +++ b/arch/arm/plat-omap/include/plat/omap7xx.h | |||
@@ -46,6 +46,9 @@ | |||
46 | #define OMAP7XX_DSPREG_SIZE SZ_128K | 46 | #define OMAP7XX_DSPREG_SIZE SZ_128K |
47 | #define OMAP7XX_DSPREG_START 0xE1000000 | 47 | #define OMAP7XX_DSPREG_START 0xE1000000 |
48 | 48 | ||
49 | #define OMAP7XX_SPI1_BASE 0xfffc0800 | ||
50 | #define OMAP7XX_SPI2_BASE 0xfffc1000 | ||
51 | |||
49 | /* | 52 | /* |
50 | * ---------------------------------------------------------------------------- | 53 | * ---------------------------------------------------------------------------- |
51 | * OMAP7XX specific configuration registers | 54 | * OMAP7XX specific configuration registers |
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c index 11f5d7961c73..0cfd54f519c4 100644 --- a/arch/arm/plat-omap/io.c +++ b/arch/arm/plat-omap/io.c | |||
@@ -66,12 +66,12 @@ void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type) | |||
66 | return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT); | 66 | return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT); |
67 | } | 67 | } |
68 | if (cpu_is_omap2420()) { | 68 | if (cpu_is_omap2420()) { |
69 | if (BETWEEN(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_SIZE)) | 69 | if (BETWEEN(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_SIZE)) |
70 | return XLATE(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_VIRT); | 70 | return XLATE(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_VIRT); |
71 | if (BETWEEN(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE)) | 71 | if (BETWEEN(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE)) |
72 | return XLATE(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE); | 72 | return XLATE(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE); |
73 | if (BETWEEN(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_SIZE)) | 73 | if (BETWEEN(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_SIZE)) |
74 | return XLATE(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_VIRT); | 74 | return XLATE(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_VIRT); |
75 | } | 75 | } |
76 | if (cpu_is_omap2430()) { | 76 | if (cpu_is_omap2430()) { |
77 | if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE)) | 77 | if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE)) |
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c index c0ff1e39d893..463d6386aff2 100644 --- a/arch/arm/plat-omap/iommu.c +++ b/arch/arm/plat-omap/iommu.c | |||
@@ -827,7 +827,7 @@ EXPORT_SYMBOL_GPL(iommu_get); | |||
827 | **/ | 827 | **/ |
828 | void iommu_put(struct iommu *obj) | 828 | void iommu_put(struct iommu *obj) |
829 | { | 829 | { |
830 | if (!obj && IS_ERR(obj)) | 830 | if (!obj || IS_ERR(obj)) |
831 | return; | 831 | return; |
832 | 832 | ||
833 | mutex_lock(&obj->iommu_lock); | 833 | mutex_lock(&obj->iommu_lock); |
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index 2cc1cc328bac..f75767278fc3 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
@@ -436,7 +436,7 @@ int omap_mcbsp_request(unsigned int id) | |||
436 | dev_err(mcbsp->dev, "Unable to request TX IRQ %d " | 436 | dev_err(mcbsp->dev, "Unable to request TX IRQ %d " |
437 | "for McBSP%d\n", mcbsp->tx_irq, | 437 | "for McBSP%d\n", mcbsp->tx_irq, |
438 | mcbsp->id); | 438 | mcbsp->id); |
439 | return err; | 439 | goto error; |
440 | } | 440 | } |
441 | 441 | ||
442 | init_completion(&mcbsp->rx_irq_completion); | 442 | init_completion(&mcbsp->rx_irq_completion); |
@@ -446,12 +446,26 @@ int omap_mcbsp_request(unsigned int id) | |||
446 | dev_err(mcbsp->dev, "Unable to request RX IRQ %d " | 446 | dev_err(mcbsp->dev, "Unable to request RX IRQ %d " |
447 | "for McBSP%d\n", mcbsp->rx_irq, | 447 | "for McBSP%d\n", mcbsp->rx_irq, |
448 | mcbsp->id); | 448 | mcbsp->id); |
449 | free_irq(mcbsp->tx_irq, (void *)mcbsp); | 449 | goto tx_irq; |
450 | return err; | ||
451 | } | 450 | } |
452 | } | 451 | } |
453 | 452 | ||
454 | return 0; | 453 | return 0; |
454 | tx_irq: | ||
455 | free_irq(mcbsp->tx_irq, (void *)mcbsp); | ||
456 | error: | ||
457 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) | ||
458 | mcbsp->pdata->ops->free(id); | ||
459 | |||
460 | /* Do procedure specific to omap34xx arch, if applicable */ | ||
461 | omap34xx_mcbsp_free(mcbsp); | ||
462 | |||
463 | clk_disable(mcbsp->fclk); | ||
464 | clk_disable(mcbsp->iclk); | ||
465 | |||
466 | mcbsp->free = 1; | ||
467 | |||
468 | return err; | ||
455 | } | 469 | } |
456 | EXPORT_SYMBOL(omap_mcbsp_request); | 470 | EXPORT_SYMBOL(omap_mcbsp_request); |
457 | 471 | ||
diff --git a/arch/arm/plat-pxa/pwm.c b/arch/arm/plat-pxa/pwm.c index a9eabdcfa163..51dc5c8106c0 100644 --- a/arch/arm/plat-pxa/pwm.c +++ b/arch/arm/plat-pxa/pwm.c | |||
@@ -204,14 +204,14 @@ static int __devinit pwm_probe(struct platform_device *pdev) | |||
204 | goto err_free_clk; | 204 | goto err_free_clk; |
205 | } | 205 | } |
206 | 206 | ||
207 | r = request_mem_region(r->start, r->end - r->start + 1, pdev->name); | 207 | r = request_mem_region(r->start, resource_size(r), pdev->name); |
208 | if (r == NULL) { | 208 | if (r == NULL) { |
209 | dev_err(&pdev->dev, "failed to request memory resource\n"); | 209 | dev_err(&pdev->dev, "failed to request memory resource\n"); |
210 | ret = -EBUSY; | 210 | ret = -EBUSY; |
211 | goto err_free_clk; | 211 | goto err_free_clk; |
212 | } | 212 | } |
213 | 213 | ||
214 | pwm->mmio_base = ioremap(r->start, r->end - r->start + 1); | 214 | pwm->mmio_base = ioremap(r->start, resource_size(r)); |
215 | if (pwm->mmio_base == NULL) { | 215 | if (pwm->mmio_base == NULL) { |
216 | dev_err(&pdev->dev, "failed to ioremap() registers\n"); | 216 | dev_err(&pdev->dev, "failed to ioremap() registers\n"); |
217 | ret = -ENODEV; | 217 | ret = -ENODEV; |
@@ -241,7 +241,7 @@ static int __devinit pwm_probe(struct platform_device *pdev) | |||
241 | return 0; | 241 | return 0; |
242 | 242 | ||
243 | err_free_mem: | 243 | err_free_mem: |
244 | release_mem_region(r->start, r->end - r->start + 1); | 244 | release_mem_region(r->start, resource_size(r)); |
245 | err_free_clk: | 245 | err_free_clk: |
246 | clk_put(pwm->clk); | 246 | clk_put(pwm->clk); |
247 | err_free: | 247 | err_free: |
@@ -271,7 +271,7 @@ static int __devexit pwm_remove(struct platform_device *pdev) | |||
271 | iounmap(pwm->mmio_base); | 271 | iounmap(pwm->mmio_base); |
272 | 272 | ||
273 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 273 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
274 | release_mem_region(r->start, r->end - r->start + 1); | 274 | release_mem_region(r->start, resource_size(r)); |
275 | 275 | ||
276 | clk_put(pwm->clk); | 276 | clk_put(pwm->clk); |
277 | kfree(pwm); | 277 | kfree(pwm); |
diff --git a/arch/arm/plat-s3c/dev-nand.c b/arch/arm/plat-s3c/dev-nand.c index e771e77dcd54..84808ccda70e 100644 --- a/arch/arm/plat-s3c/dev-nand.c +++ b/arch/arm/plat-s3c/dev-nand.c | |||
@@ -114,7 +114,7 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand) | |||
114 | 114 | ||
115 | for (i = 0; i < npd->nr_sets; i++) { | 115 | for (i = 0; i < npd->nr_sets; i++) { |
116 | ret = s3c_nand_copy_set(to); | 116 | ret = s3c_nand_copy_set(to); |
117 | if (!ret) { | 117 | if (ret) { |
118 | printk(KERN_ERR "%s: failed to copy set %d\n", | 118 | printk(KERN_ERR "%s: failed to copy set %d\n", |
119 | __func__, i); | 119 | __func__, i); |
120 | return; | 120 | return; |
@@ -122,6 +122,8 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand) | |||
122 | to++; | 122 | to++; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | |||
126 | s3c_device_nand.dev.platform_data = npd; | ||
125 | } | 127 | } |
126 | 128 | ||
127 | EXPORT_SYMBOL_GPL(s3c_nand_set_platdata); | 129 | EXPORT_SYMBOL_GPL(s3c_nand_set_platdata); |
diff --git a/arch/arm/plat-s3c/include/plat/devs.h b/arch/arm/plat-s3c/include/plat/devs.h index 932cbbbb4273..c1c20b023917 100644 --- a/arch/arm/plat-s3c/include/plat/devs.h +++ b/arch/arm/plat-s3c/include/plat/devs.h | |||
@@ -31,6 +31,7 @@ extern struct platform_device s3c64xx_device_iisv4; | |||
31 | extern struct platform_device s3c64xx_device_pcm0; | 31 | extern struct platform_device s3c64xx_device_pcm0; |
32 | extern struct platform_device s3c64xx_device_pcm1; | 32 | extern struct platform_device s3c64xx_device_pcm1; |
33 | 33 | ||
34 | extern struct platform_device s3c_device_ts; | ||
34 | extern struct platform_device s3c_device_fb; | 35 | extern struct platform_device s3c_device_fb; |
35 | extern struct platform_device s3c_device_usb; | 36 | extern struct platform_device s3c_device_usb; |
36 | extern struct platform_device s3c_device_lcd; | 37 | extern struct platform_device s3c_device_lcd; |
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c index f52a92ce8dda..7f686a31e672 100644 --- a/arch/arm/plat-s3c24xx/devs.c +++ b/arch/arm/plat-s3c24xx/devs.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <plat/cpu.h> | 37 | #include <plat/cpu.h> |
38 | #include <plat/regs-spi.h> | 38 | #include <plat/regs-spi.h> |
39 | 39 | ||
40 | #include <mach/ts.h> | ||
41 | |||
40 | /* Serial port registrations */ | 42 | /* Serial port registrations */ |
41 | 43 | ||
42 | static struct resource s3c2410_uart0_resource[] = { | 44 | static struct resource s3c2410_uart0_resource[] = { |
@@ -182,6 +184,22 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd) | |||
182 | } | 184 | } |
183 | } | 185 | } |
184 | 186 | ||
187 | /* Touchscreen */ | ||
188 | struct platform_device s3c_device_ts = { | ||
189 | .name = "s3c2410-ts", | ||
190 | .id = -1, | ||
191 | }; | ||
192 | EXPORT_SYMBOL(s3c_device_ts); | ||
193 | |||
194 | static struct s3c2410_ts_mach_info s3c2410ts_info; | ||
195 | |||
196 | void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info) | ||
197 | { | ||
198 | memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info)); | ||
199 | s3c_device_ts.dev.platform_data = &s3c2410ts_info; | ||
200 | } | ||
201 | EXPORT_SYMBOL(s3c24xx_ts_set_platdata); | ||
202 | |||
185 | /* USB Device (Gadget)*/ | 203 | /* USB Device (Gadget)*/ |
186 | 204 | ||
187 | static struct resource s3c_usbgadget_resource[] = { | 205 | static struct resource s3c_usbgadget_resource[] = { |
diff --git a/arch/arm/plat-s3c24xx/s3c244x.c b/arch/arm/plat-s3c24xx/s3c244x.c index 1364317d421e..12623a474b54 100644 --- a/arch/arm/plat-s3c24xx/s3c244x.c +++ b/arch/arm/plat-s3c24xx/s3c244x.c | |||
@@ -70,6 +70,7 @@ void __init s3c244x_map_io(void) | |||
70 | s3c_device_sdi.name = "s3c2440-sdi"; | 70 | s3c_device_sdi.name = "s3c2440-sdi"; |
71 | s3c_device_i2c0.name = "s3c2440-i2c"; | 71 | s3c_device_i2c0.name = "s3c2440-i2c"; |
72 | s3c_device_nand.name = "s3c2440-nand"; | 72 | s3c_device_nand.name = "s3c2440-nand"; |
73 | s3c_device_ts.name = "s3c2440-ts"; | ||
73 | s3c_device_usbgadget.name = "s3c2440-usbgadget"; | 74 | s3c_device_usbgadget.name = "s3c2440-usbgadget"; |
74 | } | 75 | } |
75 | 76 | ||
diff --git a/arch/arm/plat-s3c64xx/s3c6400-clock.c b/arch/arm/plat-s3c64xx/s3c6400-clock.c index 6ffa21eb1b91..ffd56deb9e81 100644 --- a/arch/arm/plat-s3c64xx/s3c6400-clock.c +++ b/arch/arm/plat-s3c64xx/s3c6400-clock.c | |||
@@ -46,6 +46,7 @@ static struct clk clk_ext_xtal_mux = { | |||
46 | #define clk_fin_epll clk_ext_xtal_mux | 46 | #define clk_fin_epll clk_ext_xtal_mux |
47 | 47 | ||
48 | #define clk_fout_mpll clk_mpll | 48 | #define clk_fout_mpll clk_mpll |
49 | #define clk_fout_epll clk_epll | ||
49 | 50 | ||
50 | struct clk_sources { | 51 | struct clk_sources { |
51 | unsigned int nr_sources; | 52 | unsigned int nr_sources; |
@@ -88,11 +89,6 @@ static struct clksrc_clk clk_mout_apll = { | |||
88 | .sources = &clk_src_apll, | 89 | .sources = &clk_src_apll, |
89 | }; | 90 | }; |
90 | 91 | ||
91 | static struct clk clk_fout_epll = { | ||
92 | .name = "fout_epll", | ||
93 | .id = -1, | ||
94 | }; | ||
95 | |||
96 | static struct clk *clk_src_epll_list[] = { | 92 | static struct clk *clk_src_epll_list[] = { |
97 | [0] = &clk_fin_epll, | 93 | [0] = &clk_fin_epll, |
98 | [1] = &clk_fout_epll, | 94 | [1] = &clk_fout_epll, |
@@ -715,7 +711,6 @@ static struct clk *clks[] __initdata = { | |||
715 | &clk_iis_cd1, | 711 | &clk_iis_cd1, |
716 | &clk_pcm_cd, | 712 | &clk_pcm_cd, |
717 | &clk_mout_epll.clk, | 713 | &clk_mout_epll.clk, |
718 | &clk_fout_epll, | ||
719 | &clk_mout_mpll.clk, | 714 | &clk_mout_mpll.clk, |
720 | &clk_dout_mpll, | 715 | &clk_dout_mpll, |
721 | &clk_mmc0.clk, | 716 | &clk_mmc0.clk, |
@@ -760,7 +755,4 @@ void __init s3c6400_register_clocks(unsigned armclk_divlimit) | |||
760 | clkp->name, ret); | 755 | clkp->name, ret); |
761 | } | 756 | } |
762 | } | 757 | } |
763 | |||
764 | clk_mpll.parent = &clk_mout_mpll.clk; | ||
765 | clk_epll.parent = &clk_mout_epll.clk; | ||
766 | } | 758 | } |
diff --git a/arch/blackfin/include/asm/page.h b/arch/blackfin/include/asm/page.h index 944a07c6cfd6..1d04e4078340 100644 --- a/arch/blackfin/include/asm/page.h +++ b/arch/blackfin/include/asm/page.h | |||
@@ -10,4 +10,9 @@ | |||
10 | #include <asm-generic/page.h> | 10 | #include <asm-generic/page.h> |
11 | #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) | 11 | #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) |
12 | 12 | ||
13 | #define VM_DATA_DEFAULT_FLAGS \ | ||
14 | (VM_READ | VM_WRITE | \ | ||
15 | ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ | ||
16 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
17 | |||
13 | #endif | 18 | #endif |
diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c index f1036b6b9293..34c7c3ed2c9c 100644 --- a/arch/blackfin/kernel/kgdb.c +++ b/arch/blackfin/kernel/kgdb.c | |||
@@ -6,23 +6,9 @@ | |||
6 | * Licensed under the GPL-2 or later. | 6 | * Licensed under the GPL-2 or later. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/string.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/sched.h> | ||
12 | #include <linux/smp.h> | ||
13 | #include <linux/spinlock.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/ptrace.h> /* for linux pt_regs struct */ | 9 | #include <linux/ptrace.h> /* for linux pt_regs struct */ |
16 | #include <linux/kgdb.h> | 10 | #include <linux/kgdb.h> |
17 | #include <linux/console.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/errno.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/uaccess.h> | 11 | #include <linux/uaccess.h> |
22 | #include <asm/system.h> | ||
23 | #include <asm/traps.h> | ||
24 | #include <asm/blackfin.h> | ||
25 | #include <asm/dma.h> | ||
26 | 12 | ||
27 | void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) | 13 | void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) |
28 | { | 14 | { |
@@ -147,7 +133,7 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) | |||
147 | regs->lb1 = gdb_regs[BFIN_LB1]; | 133 | regs->lb1 = gdb_regs[BFIN_LB1]; |
148 | regs->usp = gdb_regs[BFIN_USP]; | 134 | regs->usp = gdb_regs[BFIN_USP]; |
149 | regs->syscfg = gdb_regs[BFIN_SYSCFG]; | 135 | regs->syscfg = gdb_regs[BFIN_SYSCFG]; |
150 | regs->retx = gdb_regs[BFIN_PC]; | 136 | regs->retx = gdb_regs[BFIN_RETX]; |
151 | regs->retn = gdb_regs[BFIN_RETN]; | 137 | regs->retn = gdb_regs[BFIN_RETN]; |
152 | regs->rete = gdb_regs[BFIN_RETE]; | 138 | regs->rete = gdb_regs[BFIN_RETE]; |
153 | regs->pc = gdb_regs[BFIN_PC]; | 139 | regs->pc = gdb_regs[BFIN_PC]; |
@@ -424,182 +410,6 @@ struct kgdb_arch arch_kgdb_ops = { | |||
424 | .correct_hw_break = bfin_correct_hw_break, | 410 | .correct_hw_break = bfin_correct_hw_break, |
425 | }; | 411 | }; |
426 | 412 | ||
427 | static int hex(char ch) | ||
428 | { | ||
429 | if ((ch >= 'a') && (ch <= 'f')) | ||
430 | return ch - 'a' + 10; | ||
431 | if ((ch >= '0') && (ch <= '9')) | ||
432 | return ch - '0'; | ||
433 | if ((ch >= 'A') && (ch <= 'F')) | ||
434 | return ch - 'A' + 10; | ||
435 | return -1; | ||
436 | } | ||
437 | |||
438 | static int validate_memory_access_address(unsigned long addr, int size) | ||
439 | { | ||
440 | if (size < 0 || addr == 0) | ||
441 | return -EFAULT; | ||
442 | return bfin_mem_access_type(addr, size); | ||
443 | } | ||
444 | |||
445 | static int bfin_probe_kernel_read(char *dst, char *src, int size) | ||
446 | { | ||
447 | unsigned long lsrc = (unsigned long)src; | ||
448 | int mem_type; | ||
449 | |||
450 | mem_type = validate_memory_access_address(lsrc, size); | ||
451 | if (mem_type < 0) | ||
452 | return mem_type; | ||
453 | |||
454 | if (lsrc >= SYSMMR_BASE) { | ||
455 | if (size == 2 && lsrc % 2 == 0) { | ||
456 | u16 mmr = bfin_read16(src); | ||
457 | memcpy(dst, &mmr, sizeof(mmr)); | ||
458 | return 0; | ||
459 | } else if (size == 4 && lsrc % 4 == 0) { | ||
460 | u32 mmr = bfin_read32(src); | ||
461 | memcpy(dst, &mmr, sizeof(mmr)); | ||
462 | return 0; | ||
463 | } | ||
464 | } else { | ||
465 | switch (mem_type) { | ||
466 | case BFIN_MEM_ACCESS_CORE: | ||
467 | case BFIN_MEM_ACCESS_CORE_ONLY: | ||
468 | return probe_kernel_read(dst, src, size); | ||
469 | /* XXX: should support IDMA here with SMP */ | ||
470 | case BFIN_MEM_ACCESS_DMA: | ||
471 | if (dma_memcpy(dst, src, size)) | ||
472 | return 0; | ||
473 | break; | ||
474 | case BFIN_MEM_ACCESS_ITEST: | ||
475 | if (isram_memcpy(dst, src, size)) | ||
476 | return 0; | ||
477 | break; | ||
478 | } | ||
479 | } | ||
480 | |||
481 | return -EFAULT; | ||
482 | } | ||
483 | |||
484 | static int bfin_probe_kernel_write(char *dst, char *src, int size) | ||
485 | { | ||
486 | unsigned long ldst = (unsigned long)dst; | ||
487 | int mem_type; | ||
488 | |||
489 | mem_type = validate_memory_access_address(ldst, size); | ||
490 | if (mem_type < 0) | ||
491 | return mem_type; | ||
492 | |||
493 | if (ldst >= SYSMMR_BASE) { | ||
494 | if (size == 2 && ldst % 2 == 0) { | ||
495 | u16 mmr; | ||
496 | memcpy(&mmr, src, sizeof(mmr)); | ||
497 | bfin_write16(dst, mmr); | ||
498 | return 0; | ||
499 | } else if (size == 4 && ldst % 4 == 0) { | ||
500 | u32 mmr; | ||
501 | memcpy(&mmr, src, sizeof(mmr)); | ||
502 | bfin_write32(dst, mmr); | ||
503 | return 0; | ||
504 | } | ||
505 | } else { | ||
506 | switch (mem_type) { | ||
507 | case BFIN_MEM_ACCESS_CORE: | ||
508 | case BFIN_MEM_ACCESS_CORE_ONLY: | ||
509 | return probe_kernel_write(dst, src, size); | ||
510 | /* XXX: should support IDMA here with SMP */ | ||
511 | case BFIN_MEM_ACCESS_DMA: | ||
512 | if (dma_memcpy(dst, src, size)) | ||
513 | return 0; | ||
514 | break; | ||
515 | case BFIN_MEM_ACCESS_ITEST: | ||
516 | if (isram_memcpy(dst, src, size)) | ||
517 | return 0; | ||
518 | break; | ||
519 | } | ||
520 | } | ||
521 | |||
522 | return -EFAULT; | ||
523 | } | ||
524 | |||
525 | /* | ||
526 | * Convert the memory pointed to by mem into hex, placing result in buf. | ||
527 | * Return a pointer to the last char put in buf (null). May return an error. | ||
528 | */ | ||
529 | int kgdb_mem2hex(char *mem, char *buf, int count) | ||
530 | { | ||
531 | char *tmp; | ||
532 | int err; | ||
533 | |||
534 | /* | ||
535 | * We use the upper half of buf as an intermediate buffer for the | ||
536 | * raw memory copy. Hex conversion will work against this one. | ||
537 | */ | ||
538 | tmp = buf + count; | ||
539 | |||
540 | err = bfin_probe_kernel_read(tmp, mem, count); | ||
541 | if (!err) { | ||
542 | while (count > 0) { | ||
543 | buf = pack_hex_byte(buf, *tmp); | ||
544 | tmp++; | ||
545 | count--; | ||
546 | } | ||
547 | |||
548 | *buf = 0; | ||
549 | } | ||
550 | |||
551 | return err; | ||
552 | } | ||
553 | |||
554 | /* | ||
555 | * Copy the binary array pointed to by buf into mem. Fix $, #, and | ||
556 | * 0x7d escaped with 0x7d. Return a pointer to the character after | ||
557 | * the last byte written. | ||
558 | */ | ||
559 | int kgdb_ebin2mem(char *buf, char *mem, int count) | ||
560 | { | ||
561 | char *tmp_old, *tmp_new; | ||
562 | int size; | ||
563 | |||
564 | tmp_old = tmp_new = buf; | ||
565 | |||
566 | for (size = 0; size < count; ++size) { | ||
567 | if (*tmp_old == 0x7d) | ||
568 | *tmp_new = *(++tmp_old) ^ 0x20; | ||
569 | else | ||
570 | *tmp_new = *tmp_old; | ||
571 | tmp_new++; | ||
572 | tmp_old++; | ||
573 | } | ||
574 | |||
575 | return bfin_probe_kernel_write(mem, buf, count); | ||
576 | } | ||
577 | |||
578 | /* | ||
579 | * Convert the hex array pointed to by buf into binary to be placed in mem. | ||
580 | * Return a pointer to the character AFTER the last byte written. | ||
581 | * May return an error. | ||
582 | */ | ||
583 | int kgdb_hex2mem(char *buf, char *mem, int count) | ||
584 | { | ||
585 | char *tmp_raw, *tmp_hex; | ||
586 | |||
587 | /* | ||
588 | * We use the upper half of buf as an intermediate buffer for the | ||
589 | * raw memory that is converted from hex. | ||
590 | */ | ||
591 | tmp_raw = buf + count * 2; | ||
592 | |||
593 | tmp_hex = tmp_raw - 1; | ||
594 | while (tmp_hex >= buf) { | ||
595 | tmp_raw--; | ||
596 | *tmp_raw = hex(*tmp_hex--); | ||
597 | *tmp_raw |= hex(*tmp_hex--) << 4; | ||
598 | } | ||
599 | |||
600 | return bfin_probe_kernel_write(mem, tmp_raw, count); | ||
601 | } | ||
602 | |||
603 | #define IN_MEM(addr, size, l1_addr, l1_size) \ | 413 | #define IN_MEM(addr, size, l1_addr, l1_size) \ |
604 | ({ \ | 414 | ({ \ |
605 | unsigned long __addr = (unsigned long)(addr); \ | 415 | unsigned long __addr = (unsigned long)(addr); \ |
@@ -629,21 +439,6 @@ int kgdb_validate_break_address(unsigned long addr) | |||
629 | return -EFAULT; | 439 | return -EFAULT; |
630 | } | 440 | } |
631 | 441 | ||
632 | int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr) | ||
633 | { | ||
634 | int err = bfin_probe_kernel_read(saved_instr, (char *)addr, | ||
635 | BREAK_INSTR_SIZE); | ||
636 | if (err) | ||
637 | return err; | ||
638 | return bfin_probe_kernel_write((char *)addr, arch_kgdb_ops.gdb_bpt_instr, | ||
639 | BREAK_INSTR_SIZE); | ||
640 | } | ||
641 | |||
642 | int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle) | ||
643 | { | ||
644 | return bfin_probe_kernel_write((char *)addr, bundle, BREAK_INSTR_SIZE); | ||
645 | } | ||
646 | |||
647 | int kgdb_arch_init(void) | 442 | int kgdb_arch_init(void) |
648 | { | 443 | { |
649 | kgdb_single_step = 0; | 444 | kgdb_single_step = 0; |
diff --git a/arch/blackfin/mm/Makefile b/arch/blackfin/mm/Makefile index d489f894f4b1..4c011b1f661f 100644 --- a/arch/blackfin/mm/Makefile +++ b/arch/blackfin/mm/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # arch/blackfin/mm/Makefile | 2 | # arch/blackfin/mm/Makefile |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := sram-alloc.o isram-driver.o init.o | 5 | obj-y := sram-alloc.o isram-driver.o init.o maccess.o |
diff --git a/arch/blackfin/mm/maccess.c b/arch/blackfin/mm/maccess.c new file mode 100644 index 000000000000..b71cebc1f8a3 --- /dev/null +++ b/arch/blackfin/mm/maccess.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * safe read and write memory routines callable while atomic | ||
3 | * | ||
4 | * Copyright 2005-2008 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #include <linux/uaccess.h> | ||
10 | #include <asm/dma.h> | ||
11 | |||
12 | static int validate_memory_access_address(unsigned long addr, int size) | ||
13 | { | ||
14 | if (size < 0 || addr == 0) | ||
15 | return -EFAULT; | ||
16 | return bfin_mem_access_type(addr, size); | ||
17 | } | ||
18 | |||
19 | long probe_kernel_read(void *dst, void *src, size_t size) | ||
20 | { | ||
21 | unsigned long lsrc = (unsigned long)src; | ||
22 | int mem_type; | ||
23 | |||
24 | mem_type = validate_memory_access_address(lsrc, size); | ||
25 | if (mem_type < 0) | ||
26 | return mem_type; | ||
27 | |||
28 | if (lsrc >= SYSMMR_BASE) { | ||
29 | if (size == 2 && lsrc % 2 == 0) { | ||
30 | u16 mmr = bfin_read16(src); | ||
31 | memcpy(dst, &mmr, sizeof(mmr)); | ||
32 | return 0; | ||
33 | } else if (size == 4 && lsrc % 4 == 0) { | ||
34 | u32 mmr = bfin_read32(src); | ||
35 | memcpy(dst, &mmr, sizeof(mmr)); | ||
36 | return 0; | ||
37 | } | ||
38 | } else { | ||
39 | switch (mem_type) { | ||
40 | case BFIN_MEM_ACCESS_CORE: | ||
41 | case BFIN_MEM_ACCESS_CORE_ONLY: | ||
42 | return __probe_kernel_read(dst, src, size); | ||
43 | /* XXX: should support IDMA here with SMP */ | ||
44 | case BFIN_MEM_ACCESS_DMA: | ||
45 | if (dma_memcpy(dst, src, size)) | ||
46 | return 0; | ||
47 | break; | ||
48 | case BFIN_MEM_ACCESS_ITEST: | ||
49 | if (isram_memcpy(dst, src, size)) | ||
50 | return 0; | ||
51 | break; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | return -EFAULT; | ||
56 | } | ||
57 | |||
58 | long probe_kernel_write(void *dst, void *src, size_t size) | ||
59 | { | ||
60 | unsigned long ldst = (unsigned long)dst; | ||
61 | int mem_type; | ||
62 | |||
63 | mem_type = validate_memory_access_address(ldst, size); | ||
64 | if (mem_type < 0) | ||
65 | return mem_type; | ||
66 | |||
67 | if (ldst >= SYSMMR_BASE) { | ||
68 | if (size == 2 && ldst % 2 == 0) { | ||
69 | u16 mmr; | ||
70 | memcpy(&mmr, src, sizeof(mmr)); | ||
71 | bfin_write16(dst, mmr); | ||
72 | return 0; | ||
73 | } else if (size == 4 && ldst % 4 == 0) { | ||
74 | u32 mmr; | ||
75 | memcpy(&mmr, src, sizeof(mmr)); | ||
76 | bfin_write32(dst, mmr); | ||
77 | return 0; | ||
78 | } | ||
79 | } else { | ||
80 | switch (mem_type) { | ||
81 | case BFIN_MEM_ACCESS_CORE: | ||
82 | case BFIN_MEM_ACCESS_CORE_ONLY: | ||
83 | return __probe_kernel_write(dst, src, size); | ||
84 | /* XXX: should support IDMA here with SMP */ | ||
85 | case BFIN_MEM_ACCESS_DMA: | ||
86 | if (dma_memcpy(dst, src, size)) | ||
87 | return 0; | ||
88 | break; | ||
89 | case BFIN_MEM_ACCESS_ITEST: | ||
90 | if (isram_memcpy(dst, src, size)) | ||
91 | return 0; | ||
92 | break; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | return -EFAULT; | ||
97 | } | ||
diff --git a/arch/frv/include/asm/page.h b/arch/frv/include/asm/page.h index 25c6a5002355..8c97068ac8fc 100644 --- a/arch/frv/include/asm/page.h +++ b/arch/frv/include/asm/page.h | |||
@@ -63,12 +63,10 @@ extern unsigned long max_pfn; | |||
63 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 63 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
64 | 64 | ||
65 | 65 | ||
66 | #ifdef CONFIG_MMU | ||
67 | #define VM_DATA_DEFAULT_FLAGS \ | 66 | #define VM_DATA_DEFAULT_FLAGS \ |
68 | (VM_READ | VM_WRITE | \ | 67 | (VM_READ | VM_WRITE | \ |
69 | ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ | 68 | ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ |
70 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | 69 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
71 | #endif | ||
72 | 70 | ||
73 | #endif /* __ASSEMBLY__ */ | 71 | #endif /* __ASSEMBLY__ */ |
74 | 72 | ||
diff --git a/arch/ia64/include/asm/ftrace.h b/arch/ia64/include/asm/ftrace.h index d20db3c2a656..fbd1a2470cae 100644 --- a/arch/ia64/include/asm/ftrace.h +++ b/arch/ia64/include/asm/ftrace.h | |||
@@ -8,7 +8,6 @@ | |||
8 | extern void _mcount(unsigned long pfs, unsigned long r1, unsigned long b0, unsigned long r0); | 8 | extern void _mcount(unsigned long pfs, unsigned long r1, unsigned long b0, unsigned long r0); |
9 | #define mcount _mcount | 9 | #define mcount _mcount |
10 | 10 | ||
11 | #include <asm/kprobes.h> | ||
12 | /* In IA64, MCOUNT_ADDR is set in link time, so it's not a constant at compile time */ | 11 | /* In IA64, MCOUNT_ADDR is set in link time, so it's not a constant at compile time */ |
13 | #define MCOUNT_ADDR (((struct fnptr *)mcount)->ip) | 12 | #define MCOUNT_ADDR (((struct fnptr *)mcount)->ip) |
14 | #define FTRACE_ADDR (((struct fnptr *)ftrace_caller)->ip) | 13 | #define FTRACE_ADDR (((struct fnptr *)ftrace_caller)->ip) |
diff --git a/arch/ia64/include/asm/kprobes.h b/arch/ia64/include/asm/kprobes.h index dbf83fb28db3..d5505d6f2382 100644 --- a/arch/ia64/include/asm/kprobes.h +++ b/arch/ia64/include/asm/kprobes.h | |||
@@ -103,11 +103,6 @@ typedef struct kprobe_opcode { | |||
103 | bundle_t bundle; | 103 | bundle_t bundle; |
104 | } kprobe_opcode_t; | 104 | } kprobe_opcode_t; |
105 | 105 | ||
106 | struct fnptr { | ||
107 | unsigned long ip; | ||
108 | unsigned long gp; | ||
109 | }; | ||
110 | |||
111 | /* Architecture specific copy of original instruction*/ | 106 | /* Architecture specific copy of original instruction*/ |
112 | struct arch_specific_insn { | 107 | struct arch_specific_insn { |
113 | /* copy of the instruction to be emulated */ | 108 | /* copy of the instruction to be emulated */ |
diff --git a/arch/ia64/include/asm/tlb.h b/arch/ia64/include/asm/tlb.h index 85d965cb19a0..23cce999eb1c 100644 --- a/arch/ia64/include/asm/tlb.h +++ b/arch/ia64/include/asm/tlb.h | |||
@@ -74,7 +74,7 @@ struct ia64_tr_entry { | |||
74 | extern int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size); | 74 | extern int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size); |
75 | extern void ia64_ptr_entry(u64 target_mask, int slot); | 75 | extern void ia64_ptr_entry(u64 target_mask, int slot); |
76 | 76 | ||
77 | extern struct ia64_tr_entry __per_cpu_idtrs[NR_CPUS][2][IA64_TR_ALLOC_MAX]; | 77 | extern struct ia64_tr_entry *ia64_idtrs[NR_CPUS]; |
78 | 78 | ||
79 | /* | 79 | /* |
80 | region register macros | 80 | region register macros |
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h index 3ddb4e709dba..d323071d0f91 100644 --- a/arch/ia64/include/asm/topology.h +++ b/arch/ia64/include/asm/topology.h | |||
@@ -33,7 +33,9 @@ | |||
33 | /* | 33 | /* |
34 | * Returns a bitmask of CPUs on Node 'node'. | 34 | * Returns a bitmask of CPUs on Node 'node'. |
35 | */ | 35 | */ |
36 | #define cpumask_of_node(node) (&node_to_cpu_mask[node]) | 36 | #define cpumask_of_node(node) ((node) == -1 ? \ |
37 | cpu_all_mask : \ | ||
38 | &node_to_cpu_mask[node]) | ||
37 | 39 | ||
38 | /* | 40 | /* |
39 | * Returns the number of the node containing Node 'nid'. | 41 | * Returns the number of the node containing Node 'nid'. |
diff --git a/arch/ia64/include/asm/types.h b/arch/ia64/include/asm/types.h index bcd260e597de..93773fd37be0 100644 --- a/arch/ia64/include/asm/types.h +++ b/arch/ia64/include/asm/types.h | |||
@@ -35,6 +35,11 @@ typedef unsigned int umode_t; | |||
35 | */ | 35 | */ |
36 | # ifdef __KERNEL__ | 36 | # ifdef __KERNEL__ |
37 | 37 | ||
38 | struct fnptr { | ||
39 | unsigned long ip; | ||
40 | unsigned long gp; | ||
41 | }; | ||
42 | |||
38 | /* DMA addresses are 64-bits wide, in general. */ | 43 | /* DMA addresses are 64-bits wide, in general. */ |
39 | typedef u64 dma_addr_t; | 44 | typedef u64 dma_addr_t; |
40 | 45 | ||
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c index 32f2639e9b0a..378b4833024f 100644 --- a/arch/ia64/kernel/mca.c +++ b/arch/ia64/kernel/mca.c | |||
@@ -1225,9 +1225,12 @@ static void mca_insert_tr(u64 iord) | |||
1225 | unsigned long psr; | 1225 | unsigned long psr; |
1226 | int cpu = smp_processor_id(); | 1226 | int cpu = smp_processor_id(); |
1227 | 1227 | ||
1228 | if (!ia64_idtrs[cpu]) | ||
1229 | return; | ||
1230 | |||
1228 | psr = ia64_clear_ic(); | 1231 | psr = ia64_clear_ic(); |
1229 | for (i = IA64_TR_ALLOC_BASE; i < IA64_TR_ALLOC_MAX; i++) { | 1232 | for (i = IA64_TR_ALLOC_BASE; i < IA64_TR_ALLOC_MAX; i++) { |
1230 | p = &__per_cpu_idtrs[cpu][iord-1][i]; | 1233 | p = ia64_idtrs[cpu] + (iord - 1) * IA64_TR_ALLOC_MAX; |
1231 | if (p->pte & 0x1) { | 1234 | if (p->pte & 0x1) { |
1232 | old_rr = ia64_get_rr(p->ifa); | 1235 | old_rr = ia64_get_rr(p->ifa); |
1233 | if (old_rr != p->rr) { | 1236 | if (old_rr != p->rr) { |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 5246285a95fb..6bcbe215b9a4 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -2293,7 +2293,7 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t | |||
2293 | * if ((mm->total_vm << PAGE_SHIFT) + len> task->rlim[RLIMIT_AS].rlim_cur) | 2293 | * if ((mm->total_vm << PAGE_SHIFT) + len> task->rlim[RLIMIT_AS].rlim_cur) |
2294 | * return -ENOMEM; | 2294 | * return -ENOMEM; |
2295 | */ | 2295 | */ |
2296 | if (size > task->signal->rlim[RLIMIT_MEMLOCK].rlim_cur) | 2296 | if (size > task_rlimit(task, RLIMIT_MEMLOCK)) |
2297 | return -ENOMEM; | 2297 | return -ENOMEM; |
2298 | 2298 | ||
2299 | /* | 2299 | /* |
diff --git a/arch/ia64/kvm/vcpu.h b/arch/ia64/kvm/vcpu.h index 360724d3ae69..988911b4cc7a 100644 --- a/arch/ia64/kvm/vcpu.h +++ b/arch/ia64/kvm/vcpu.h | |||
@@ -388,6 +388,9 @@ static inline u64 __gpfn_is_io(u64 gpfn) | |||
388 | #define _vmm_raw_spin_lock(x) do {}while(0) | 388 | #define _vmm_raw_spin_lock(x) do {}while(0) |
389 | #define _vmm_raw_spin_unlock(x) do {}while(0) | 389 | #define _vmm_raw_spin_unlock(x) do {}while(0) |
390 | #else | 390 | #else |
391 | typedef struct { | ||
392 | volatile unsigned int lock; | ||
393 | } vmm_spinlock_t; | ||
391 | #define _vmm_raw_spin_lock(x) \ | 394 | #define _vmm_raw_spin_lock(x) \ |
392 | do { \ | 395 | do { \ |
393 | __u32 *ia64_spinlock_ptr = (__u32 *) (x); \ | 396 | __u32 *ia64_spinlock_ptr = (__u32 *) (x); \ |
@@ -405,12 +408,12 @@ static inline u64 __gpfn_is_io(u64 gpfn) | |||
405 | 408 | ||
406 | #define _vmm_raw_spin_unlock(x) \ | 409 | #define _vmm_raw_spin_unlock(x) \ |
407 | do { barrier(); \ | 410 | do { barrier(); \ |
408 | ((spinlock_t *)x)->raw_lock.lock = 0; } \ | 411 | ((vmm_spinlock_t *)x)->lock = 0; } \ |
409 | while (0) | 412 | while (0) |
410 | #endif | 413 | #endif |
411 | 414 | ||
412 | void vmm_spin_lock(spinlock_t *lock); | 415 | void vmm_spin_lock(vmm_spinlock_t *lock); |
413 | void vmm_spin_unlock(spinlock_t *lock); | 416 | void vmm_spin_unlock(vmm_spinlock_t *lock); |
414 | enum { | 417 | enum { |
415 | I_TLB = 1, | 418 | I_TLB = 1, |
416 | D_TLB = 2 | 419 | D_TLB = 2 |
diff --git a/arch/ia64/kvm/vmm.c b/arch/ia64/kvm/vmm.c index f4b4c899bb6c..7a62f75778c5 100644 --- a/arch/ia64/kvm/vmm.c +++ b/arch/ia64/kvm/vmm.c | |||
@@ -60,12 +60,12 @@ static void __exit kvm_vmm_exit(void) | |||
60 | return ; | 60 | return ; |
61 | } | 61 | } |
62 | 62 | ||
63 | void vmm_spin_lock(spinlock_t *lock) | 63 | void vmm_spin_lock(vmm_spinlock_t *lock) |
64 | { | 64 | { |
65 | _vmm_raw_spin_lock(lock); | 65 | _vmm_raw_spin_lock(lock); |
66 | } | 66 | } |
67 | 67 | ||
68 | void vmm_spin_unlock(spinlock_t *lock) | 68 | void vmm_spin_unlock(vmm_spinlock_t *lock) |
69 | { | 69 | { |
70 | _vmm_raw_spin_unlock(lock); | 70 | _vmm_raw_spin_unlock(lock); |
71 | } | 71 | } |
diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c index 20b3852f7a6e..4332f7ee5203 100644 --- a/arch/ia64/kvm/vtlb.c +++ b/arch/ia64/kvm/vtlb.c | |||
@@ -182,7 +182,7 @@ void mark_pages_dirty(struct kvm_vcpu *v, u64 pte, u64 ps) | |||
182 | { | 182 | { |
183 | u64 i, dirty_pages = 1; | 183 | u64 i, dirty_pages = 1; |
184 | u64 base_gfn = (pte&_PAGE_PPN_MASK) >> PAGE_SHIFT; | 184 | u64 base_gfn = (pte&_PAGE_PPN_MASK) >> PAGE_SHIFT; |
185 | spinlock_t *lock = __kvm_va(v->arch.dirty_log_lock_pa); | 185 | vmm_spinlock_t *lock = __kvm_va(v->arch.dirty_log_lock_pa); |
186 | void *dirty_bitmap = (void *)KVM_MEM_DIRTY_LOG_BASE; | 186 | void *dirty_bitmap = (void *)KVM_MEM_DIRTY_LOG_BASE; |
187 | 187 | ||
188 | dirty_pages <<= ps <= PAGE_SHIFT ? 0 : ps - PAGE_SHIFT; | 188 | dirty_pages <<= ps <= PAGE_SHIFT ? 0 : ps - PAGE_SHIFT; |
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index b9609c69343a..7c0d4814a68d 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c | |||
@@ -91,7 +91,7 @@ dma_mark_clean(void *addr, size_t size) | |||
91 | inline void | 91 | inline void |
92 | ia64_set_rbs_bot (void) | 92 | ia64_set_rbs_bot (void) |
93 | { | 93 | { |
94 | unsigned long stack_size = current->signal->rlim[RLIMIT_STACK].rlim_max & -16; | 94 | unsigned long stack_size = rlimit_max(RLIMIT_STACK) & -16; |
95 | 95 | ||
96 | if (stack_size > MAX_USER_STACK_SIZE) | 96 | if (stack_size > MAX_USER_STACK_SIZE) |
97 | stack_size = MAX_USER_STACK_SIZE; | 97 | stack_size = MAX_USER_STACK_SIZE; |
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c index ee09d261f2e6..f3de9d7a98b4 100644 --- a/arch/ia64/mm/tlb.c +++ b/arch/ia64/mm/tlb.c | |||
@@ -48,7 +48,7 @@ DEFINE_PER_CPU(u8, ia64_need_tlb_flush); | |||
48 | DEFINE_PER_CPU(u8, ia64_tr_num); /*Number of TR slots in current processor*/ | 48 | DEFINE_PER_CPU(u8, ia64_tr_num); /*Number of TR slots in current processor*/ |
49 | DEFINE_PER_CPU(u8, ia64_tr_used); /*Max Slot number used by kernel*/ | 49 | DEFINE_PER_CPU(u8, ia64_tr_used); /*Max Slot number used by kernel*/ |
50 | 50 | ||
51 | struct ia64_tr_entry __per_cpu_idtrs[NR_CPUS][2][IA64_TR_ALLOC_MAX]; | 51 | struct ia64_tr_entry *ia64_idtrs[NR_CPUS]; |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Initializes the ia64_ctx.bitmap array based on max_ctx+1. | 54 | * Initializes the ia64_ctx.bitmap array based on max_ctx+1. |
@@ -429,10 +429,16 @@ int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size) | |||
429 | struct ia64_tr_entry *p; | 429 | struct ia64_tr_entry *p; |
430 | int cpu = smp_processor_id(); | 430 | int cpu = smp_processor_id(); |
431 | 431 | ||
432 | if (!ia64_idtrs[cpu]) { | ||
433 | ia64_idtrs[cpu] = kmalloc(2 * IA64_TR_ALLOC_MAX * | ||
434 | sizeof (struct ia64_tr_entry), GFP_KERNEL); | ||
435 | if (!ia64_idtrs[cpu]) | ||
436 | return -ENOMEM; | ||
437 | } | ||
432 | r = -EINVAL; | 438 | r = -EINVAL; |
433 | /*Check overlap with existing TR entries*/ | 439 | /*Check overlap with existing TR entries*/ |
434 | if (target_mask & 0x1) { | 440 | if (target_mask & 0x1) { |
435 | p = &__per_cpu_idtrs[cpu][0][0]; | 441 | p = ia64_idtrs[cpu]; |
436 | for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu); | 442 | for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu); |
437 | i++, p++) { | 443 | i++, p++) { |
438 | if (p->pte & 0x1) | 444 | if (p->pte & 0x1) |
@@ -444,7 +450,7 @@ int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size) | |||
444 | } | 450 | } |
445 | } | 451 | } |
446 | if (target_mask & 0x2) { | 452 | if (target_mask & 0x2) { |
447 | p = &__per_cpu_idtrs[cpu][1][0]; | 453 | p = ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX; |
448 | for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu); | 454 | for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu); |
449 | i++, p++) { | 455 | i++, p++) { |
450 | if (p->pte & 0x1) | 456 | if (p->pte & 0x1) |
@@ -459,16 +465,16 @@ int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size) | |||
459 | for (i = IA64_TR_ALLOC_BASE; i < per_cpu(ia64_tr_num, cpu); i++) { | 465 | for (i = IA64_TR_ALLOC_BASE; i < per_cpu(ia64_tr_num, cpu); i++) { |
460 | switch (target_mask & 0x3) { | 466 | switch (target_mask & 0x3) { |
461 | case 1: | 467 | case 1: |
462 | if (!(__per_cpu_idtrs[cpu][0][i].pte & 0x1)) | 468 | if (!((ia64_idtrs[cpu] + i)->pte & 0x1)) |
463 | goto found; | 469 | goto found; |
464 | continue; | 470 | continue; |
465 | case 2: | 471 | case 2: |
466 | if (!(__per_cpu_idtrs[cpu][1][i].pte & 0x1)) | 472 | if (!((ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + i)->pte & 0x1)) |
467 | goto found; | 473 | goto found; |
468 | continue; | 474 | continue; |
469 | case 3: | 475 | case 3: |
470 | if (!(__per_cpu_idtrs[cpu][0][i].pte & 0x1) && | 476 | if (!((ia64_idtrs[cpu] + i)->pte & 0x1) && |
471 | !(__per_cpu_idtrs[cpu][1][i].pte & 0x1)) | 477 | !((ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + i)->pte & 0x1)) |
472 | goto found; | 478 | goto found; |
473 | continue; | 479 | continue; |
474 | default: | 480 | default: |
@@ -488,7 +494,7 @@ found: | |||
488 | if (target_mask & 0x1) { | 494 | if (target_mask & 0x1) { |
489 | ia64_itr(0x1, i, va, pte, log_size); | 495 | ia64_itr(0x1, i, va, pte, log_size); |
490 | ia64_srlz_i(); | 496 | ia64_srlz_i(); |
491 | p = &__per_cpu_idtrs[cpu][0][i]; | 497 | p = ia64_idtrs[cpu] + i; |
492 | p->ifa = va; | 498 | p->ifa = va; |
493 | p->pte = pte; | 499 | p->pte = pte; |
494 | p->itir = log_size << 2; | 500 | p->itir = log_size << 2; |
@@ -497,7 +503,7 @@ found: | |||
497 | if (target_mask & 0x2) { | 503 | if (target_mask & 0x2) { |
498 | ia64_itr(0x2, i, va, pte, log_size); | 504 | ia64_itr(0x2, i, va, pte, log_size); |
499 | ia64_srlz_i(); | 505 | ia64_srlz_i(); |
500 | p = &__per_cpu_idtrs[cpu][1][i]; | 506 | p = ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + i; |
501 | p->ifa = va; | 507 | p->ifa = va; |
502 | p->pte = pte; | 508 | p->pte = pte; |
503 | p->itir = log_size << 2; | 509 | p->itir = log_size << 2; |
@@ -528,7 +534,7 @@ void ia64_ptr_entry(u64 target_mask, int slot) | |||
528 | return; | 534 | return; |
529 | 535 | ||
530 | if (target_mask & 0x1) { | 536 | if (target_mask & 0x1) { |
531 | p = &__per_cpu_idtrs[cpu][0][slot]; | 537 | p = ia64_idtrs[cpu] + slot; |
532 | if ((p->pte&0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) { | 538 | if ((p->pte&0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) { |
533 | p->pte = 0; | 539 | p->pte = 0; |
534 | ia64_ptr(0x1, p->ifa, p->itir>>2); | 540 | ia64_ptr(0x1, p->ifa, p->itir>>2); |
@@ -537,7 +543,7 @@ void ia64_ptr_entry(u64 target_mask, int slot) | |||
537 | } | 543 | } |
538 | 544 | ||
539 | if (target_mask & 0x2) { | 545 | if (target_mask & 0x2) { |
540 | p = &__per_cpu_idtrs[cpu][1][slot]; | 546 | p = ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + slot; |
541 | if ((p->pte & 0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) { | 547 | if ((p->pte & 0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) { |
542 | p->pte = 0; | 548 | p->pte = 0; |
543 | ia64_ptr(0x2, p->ifa, p->itir>>2); | 549 | ia64_ptr(0x2, p->ifa, p->itir>>2); |
@@ -546,8 +552,8 @@ void ia64_ptr_entry(u64 target_mask, int slot) | |||
546 | } | 552 | } |
547 | 553 | ||
548 | for (i = per_cpu(ia64_tr_used, cpu); i >= IA64_TR_ALLOC_BASE; i--) { | 554 | for (i = per_cpu(ia64_tr_used, cpu); i >= IA64_TR_ALLOC_BASE; i--) { |
549 | if ((__per_cpu_idtrs[cpu][0][i].pte & 0x1) || | 555 | if (((ia64_idtrs[cpu] + i)->pte & 0x1) || |
550 | (__per_cpu_idtrs[cpu][1][i].pte & 0x1)) | 556 | ((ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + i)->pte & 0x1)) |
551 | break; | 557 | break; |
552 | } | 558 | } |
553 | per_cpu(ia64_tr_used, cpu) = i; | 559 | per_cpu(ia64_tr_used, cpu) = i; |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 9e8d00389eef..1651942f7feb 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -424,7 +424,7 @@ void __init mem_init(void) | |||
424 | reservedpages << (PAGE_SHIFT-10), | 424 | reservedpages << (PAGE_SHIFT-10), |
425 | datasize >> 10, | 425 | datasize >> 10, |
426 | initsize >> 10, | 426 | initsize >> 10, |
427 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); | 427 | totalhigh_pages << (PAGE_SHIFT-10)); |
428 | } | 428 | } |
429 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | 429 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ |
430 | 430 | ||
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index f61c164d1e67..bc1297109cc5 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c | |||
@@ -505,5 +505,5 @@ void __init mem_init(void) | |||
505 | (num_physpages - tmp) << (PAGE_SHIFT-10), | 505 | (num_physpages - tmp) << (PAGE_SHIFT-10), |
506 | datasize >> 10, | 506 | datasize >> 10, |
507 | initsize >> 10, | 507 | initsize >> 10, |
508 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); | 508 | totalhigh_pages << (PAGE_SHIFT-10)); |
509 | } | 509 | } |
diff --git a/arch/mn10300/Makefile b/arch/mn10300/Makefile index dd0c8ff52a68..ac5c6bdb2f05 100644 --- a/arch/mn10300/Makefile +++ b/arch/mn10300/Makefile | |||
@@ -19,7 +19,7 @@ CCDIR := $(strip $(patsubst %/specs,%,$(CCSPECS))) | |||
19 | KBUILD_CPPFLAGS += -nostdinc -I$(CCDIR)/include | 19 | KBUILD_CPPFLAGS += -nostdinc -I$(CCDIR)/include |
20 | 20 | ||
21 | LDFLAGS := | 21 | LDFLAGS := |
22 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | 22 | OBJCOPYFLAGS := -O binary -R .note -R .comment -R .GCC-command-line -R .note.gnu.build-id -S |
23 | #LDFLAGS_vmlinux := -Map linkmap.txt | 23 | #LDFLAGS_vmlinux := -Map linkmap.txt |
24 | CHECKFLAGS += | 24 | CHECKFLAGS += |
25 | 25 | ||
diff --git a/arch/mn10300/configs/asb2303_defconfig b/arch/mn10300/configs/asb2303_defconfig index 3acce23708b0..441920d8ff58 100644 --- a/arch/mn10300/configs/asb2303_defconfig +++ b/arch/mn10300/configs/asb2303_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.30-rc2 | 3 | # Linux kernel version: 2.6.33-rc1 |
4 | # Sat Apr 18 11:13:22 2009 | 4 | # Tue Dec 22 19:26:25 2009 |
5 | # | 5 | # |
6 | CONFIG_MN10300=y | 6 | CONFIG_MN10300=y |
7 | CONFIG_AM33=y | 7 | CONFIG_AM33=y |
@@ -22,6 +22,7 @@ CONFIG_GENERIC_HARDIRQS=y | |||
22 | # CONFIG_HOTPLUG_CPU is not set | 22 | # CONFIG_HOTPLUG_CPU is not set |
23 | CONFIG_HZ=1000 | 23 | CONFIG_HZ=1000 |
24 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 24 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
25 | CONFIG_CONSTRUCTORS=y | ||
25 | 26 | ||
26 | # | 27 | # |
27 | # General setup | 28 | # General setup |
@@ -43,11 +44,10 @@ CONFIG_BSD_PROCESS_ACCT=y | |||
43 | # | 44 | # |
44 | # RCU Subsystem | 45 | # RCU Subsystem |
45 | # | 46 | # |
46 | CONFIG_CLASSIC_RCU=y | ||
47 | # CONFIG_TREE_RCU is not set | 47 | # CONFIG_TREE_RCU is not set |
48 | # CONFIG_PREEMPT_RCU is not set | 48 | # CONFIG_TREE_PREEMPT_RCU is not set |
49 | CONFIG_TINY_RCU=y | ||
49 | # CONFIG_TREE_RCU_TRACE is not set | 50 | # CONFIG_TREE_RCU_TRACE is not set |
50 | # CONFIG_PREEMPT_RCU_TRACE is not set | ||
51 | # CONFIG_IKCONFIG is not set | 51 | # CONFIG_IKCONFIG is not set |
52 | CONFIG_LOG_BUF_SHIFT=14 | 52 | CONFIG_LOG_BUF_SHIFT=14 |
53 | # CONFIG_GROUP_SCHED is not set | 53 | # CONFIG_GROUP_SCHED is not set |
@@ -62,7 +62,6 @@ CONFIG_ANON_INODES=y | |||
62 | CONFIG_EMBEDDED=y | 62 | CONFIG_EMBEDDED=y |
63 | CONFIG_SYSCTL_SYSCALL=y | 63 | CONFIG_SYSCTL_SYSCALL=y |
64 | # CONFIG_KALLSYMS is not set | 64 | # CONFIG_KALLSYMS is not set |
65 | CONFIG_STRIP_ASM_SYMS=y | ||
66 | # CONFIG_HOTPLUG is not set | 65 | # CONFIG_HOTPLUG is not set |
67 | CONFIG_PRINTK=y | 66 | CONFIG_PRINTK=y |
68 | CONFIG_BUG=y | 67 | CONFIG_BUG=y |
@@ -75,14 +74,22 @@ CONFIG_TIMERFD=y | |||
75 | CONFIG_EVENTFD=y | 74 | CONFIG_EVENTFD=y |
76 | CONFIG_SHMEM=y | 75 | CONFIG_SHMEM=y |
77 | CONFIG_AIO=y | 76 | CONFIG_AIO=y |
77 | |||
78 | # | ||
79 | # Kernel Performance Events And Counters | ||
80 | # | ||
78 | # CONFIG_VM_EVENT_COUNTERS is not set | 81 | # CONFIG_VM_EVENT_COUNTERS is not set |
79 | CONFIG_COMPAT_BRK=y | 82 | CONFIG_COMPAT_BRK=y |
80 | CONFIG_SLAB=y | 83 | CONFIG_SLAB=y |
81 | # CONFIG_SLUB is not set | 84 | # CONFIG_SLUB is not set |
82 | # CONFIG_SLOB is not set | 85 | # CONFIG_SLOB is not set |
83 | CONFIG_PROFILING=y | 86 | CONFIG_PROFILING=y |
84 | # CONFIG_MARKERS is not set | ||
85 | CONFIG_HAVE_OPROFILE=y | 87 | CONFIG_HAVE_OPROFILE=y |
88 | CONFIG_HAVE_ARCH_TRACEHOOK=y | ||
89 | |||
90 | # | ||
91 | # GCOV-based kernel profiling | ||
92 | # | ||
86 | # CONFIG_SLOW_WORK is not set | 93 | # CONFIG_SLOW_WORK is not set |
87 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | 94 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set |
88 | CONFIG_SLABINFO=y | 95 | CONFIG_SLABINFO=y |
@@ -90,6 +97,35 @@ CONFIG_RT_MUTEXES=y | |||
90 | CONFIG_BASE_SMALL=0 | 97 | CONFIG_BASE_SMALL=0 |
91 | # CONFIG_MODULES is not set | 98 | # CONFIG_MODULES is not set |
92 | # CONFIG_BLOCK is not set | 99 | # CONFIG_BLOCK is not set |
100 | # CONFIG_INLINE_SPIN_TRYLOCK is not set | ||
101 | # CONFIG_INLINE_SPIN_TRYLOCK_BH is not set | ||
102 | # CONFIG_INLINE_SPIN_LOCK is not set | ||
103 | # CONFIG_INLINE_SPIN_LOCK_BH is not set | ||
104 | # CONFIG_INLINE_SPIN_LOCK_IRQ is not set | ||
105 | # CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set | ||
106 | # CONFIG_INLINE_SPIN_UNLOCK is not set | ||
107 | # CONFIG_INLINE_SPIN_UNLOCK_BH is not set | ||
108 | # CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set | ||
109 | # CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set | ||
110 | # CONFIG_INLINE_READ_TRYLOCK is not set | ||
111 | # CONFIG_INLINE_READ_LOCK is not set | ||
112 | # CONFIG_INLINE_READ_LOCK_BH is not set | ||
113 | # CONFIG_INLINE_READ_LOCK_IRQ is not set | ||
114 | # CONFIG_INLINE_READ_LOCK_IRQSAVE is not set | ||
115 | # CONFIG_INLINE_READ_UNLOCK is not set | ||
116 | # CONFIG_INLINE_READ_UNLOCK_BH is not set | ||
117 | # CONFIG_INLINE_READ_UNLOCK_IRQ is not set | ||
118 | # CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set | ||
119 | # CONFIG_INLINE_WRITE_TRYLOCK is not set | ||
120 | # CONFIG_INLINE_WRITE_LOCK is not set | ||
121 | # CONFIG_INLINE_WRITE_LOCK_BH is not set | ||
122 | # CONFIG_INLINE_WRITE_LOCK_IRQ is not set | ||
123 | # CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set | ||
124 | # CONFIG_INLINE_WRITE_UNLOCK is not set | ||
125 | # CONFIG_INLINE_WRITE_UNLOCK_BH is not set | ||
126 | # CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set | ||
127 | # CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set | ||
128 | # CONFIG_MUTEX_SPIN_ON_OWNER is not set | ||
93 | # CONFIG_FREEZER is not set | 129 | # CONFIG_FREEZER is not set |
94 | 130 | ||
95 | # | 131 | # |
@@ -145,9 +181,8 @@ CONFIG_SPLIT_PTLOCK_CPUS=4 | |||
145 | CONFIG_ZONE_DMA_FLAG=0 | 181 | CONFIG_ZONE_DMA_FLAG=0 |
146 | CONFIG_NR_QUICK=1 | 182 | CONFIG_NR_QUICK=1 |
147 | CONFIG_VIRT_TO_BUS=y | 183 | CONFIG_VIRT_TO_BUS=y |
148 | CONFIG_UNEVICTABLE_LRU=y | 184 | # CONFIG_KSM is not set |
149 | CONFIG_HAVE_MLOCK=y | 185 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 |
150 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | ||
151 | 186 | ||
152 | # | 187 | # |
153 | # Power management options | 188 | # Power management options |
@@ -202,6 +237,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic" | |||
202 | # CONFIG_NETFILTER is not set | 237 | # CONFIG_NETFILTER is not set |
203 | # CONFIG_IP_DCCP is not set | 238 | # CONFIG_IP_DCCP is not set |
204 | # CONFIG_IP_SCTP is not set | 239 | # CONFIG_IP_SCTP is not set |
240 | # CONFIG_RDS is not set | ||
205 | # CONFIG_TIPC is not set | 241 | # CONFIG_TIPC is not set |
206 | # CONFIG_ATM is not set | 242 | # CONFIG_ATM is not set |
207 | # CONFIG_BRIDGE is not set | 243 | # CONFIG_BRIDGE is not set |
@@ -216,6 +252,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic" | |||
216 | # CONFIG_ECONET is not set | 252 | # CONFIG_ECONET is not set |
217 | # CONFIG_WAN_ROUTER is not set | 253 | # CONFIG_WAN_ROUTER is not set |
218 | # CONFIG_PHONET is not set | 254 | # CONFIG_PHONET is not set |
255 | # CONFIG_IEEE802154 is not set | ||
219 | # CONFIG_NET_SCHED is not set | 256 | # CONFIG_NET_SCHED is not set |
220 | # CONFIG_DCB is not set | 257 | # CONFIG_DCB is not set |
221 | 258 | ||
@@ -341,7 +378,6 @@ CONFIG_MISC_DEVICES=y | |||
341 | # CONFIG_SCSI_DMA is not set | 378 | # CONFIG_SCSI_DMA is not set |
342 | # CONFIG_SCSI_NETLINK is not set | 379 | # CONFIG_SCSI_NETLINK is not set |
343 | CONFIG_NETDEVICES=y | 380 | CONFIG_NETDEVICES=y |
344 | CONFIG_COMPAT_NET_DEV_OPS=y | ||
345 | # CONFIG_DUMMY is not set | 381 | # CONFIG_DUMMY is not set |
346 | # CONFIG_BONDING is not set | 382 | # CONFIG_BONDING is not set |
347 | # CONFIG_MACVLAN is not set | 383 | # CONFIG_MACVLAN is not set |
@@ -362,14 +398,11 @@ CONFIG_SMC91X=y | |||
362 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | 398 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set |
363 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | 399 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set |
364 | # CONFIG_B44 is not set | 400 | # CONFIG_B44 is not set |
401 | # CONFIG_KS8842 is not set | ||
402 | # CONFIG_KS8851_MLL is not set | ||
365 | # CONFIG_NETDEV_1000 is not set | 403 | # CONFIG_NETDEV_1000 is not set |
366 | # CONFIG_NETDEV_10000 is not set | 404 | # CONFIG_NETDEV_10000 is not set |
367 | 405 | # CONFIG_WLAN is not set | |
368 | # | ||
369 | # Wireless LAN | ||
370 | # | ||
371 | # CONFIG_WLAN_PRE80211 is not set | ||
372 | # CONFIG_WLAN_80211 is not set | ||
373 | 406 | ||
374 | # | 407 | # |
375 | # Enable WiMAX (Networking options) to see the WiMAX drivers | 408 | # Enable WiMAX (Networking options) to see the WiMAX drivers |
@@ -430,11 +463,15 @@ CONFIG_RTC=y | |||
430 | # CONFIG_TCG_TPM is not set | 463 | # CONFIG_TCG_TPM is not set |
431 | # CONFIG_I2C is not set | 464 | # CONFIG_I2C is not set |
432 | # CONFIG_SPI is not set | 465 | # CONFIG_SPI is not set |
466 | |||
467 | # | ||
468 | # PPS support | ||
469 | # | ||
470 | # CONFIG_PPS is not set | ||
433 | # CONFIG_W1 is not set | 471 | # CONFIG_W1 is not set |
434 | # CONFIG_POWER_SUPPLY is not set | 472 | # CONFIG_POWER_SUPPLY is not set |
435 | # CONFIG_HWMON is not set | 473 | # CONFIG_HWMON is not set |
436 | # CONFIG_THERMAL is not set | 474 | # CONFIG_THERMAL is not set |
437 | # CONFIG_THERMAL_HWMON is not set | ||
438 | # CONFIG_WATCHDOG is not set | 475 | # CONFIG_WATCHDOG is not set |
439 | CONFIG_SSB_POSSIBLE=y | 476 | CONFIG_SSB_POSSIBLE=y |
440 | 477 | ||
@@ -451,22 +488,7 @@ CONFIG_SSB_POSSIBLE=y | |||
451 | # CONFIG_HTC_PASIC3 is not set | 488 | # CONFIG_HTC_PASIC3 is not set |
452 | # CONFIG_MFD_TMIO is not set | 489 | # CONFIG_MFD_TMIO is not set |
453 | # CONFIG_REGULATOR is not set | 490 | # CONFIG_REGULATOR is not set |
454 | 491 | # CONFIG_MEDIA_SUPPORT is not set | |
455 | # | ||
456 | # Multimedia devices | ||
457 | # | ||
458 | |||
459 | # | ||
460 | # Multimedia core support | ||
461 | # | ||
462 | # CONFIG_VIDEO_DEV is not set | ||
463 | # CONFIG_DVB_CORE is not set | ||
464 | # CONFIG_VIDEO_MEDIA is not set | ||
465 | |||
466 | # | ||
467 | # Multimedia drivers | ||
468 | # | ||
469 | # CONFIG_DAB is not set | ||
470 | 492 | ||
471 | # | 493 | # |
472 | # Graphics support | 494 | # Graphics support |
@@ -490,11 +512,17 @@ CONFIG_SSB_POSSIBLE=y | |||
490 | # CONFIG_DMADEVICES is not set | 512 | # CONFIG_DMADEVICES is not set |
491 | # CONFIG_AUXDISPLAY is not set | 513 | # CONFIG_AUXDISPLAY is not set |
492 | # CONFIG_UIO is not set | 514 | # CONFIG_UIO is not set |
515 | |||
516 | # | ||
517 | # TI VLYNQ | ||
518 | # | ||
493 | # CONFIG_STAGING is not set | 519 | # CONFIG_STAGING is not set |
494 | 520 | ||
495 | # | 521 | # |
496 | # File systems | 522 | # File systems |
497 | # | 523 | # |
524 | CONFIG_FILE_LOCKING=y | ||
525 | CONFIG_FSNOTIFY=y | ||
498 | CONFIG_DNOTIFY=y | 526 | CONFIG_DNOTIFY=y |
499 | CONFIG_INOTIFY=y | 527 | CONFIG_INOTIFY=y |
500 | CONFIG_INOTIFY_USER=y | 528 | CONFIG_INOTIFY_USER=y |
@@ -539,6 +567,7 @@ CONFIG_NFS_V3=y | |||
539 | # CONFIG_NFS_V3_ACL is not set | 567 | # CONFIG_NFS_V3_ACL is not set |
540 | # CONFIG_NFS_V4 is not set | 568 | # CONFIG_NFS_V4 is not set |
541 | CONFIG_ROOT_NFS=y | 569 | CONFIG_ROOT_NFS=y |
570 | # CONFIG_NFSD is not set | ||
542 | CONFIG_LOCKD=y | 571 | CONFIG_LOCKD=y |
543 | CONFIG_LOCKD_V4=y | 572 | CONFIG_LOCKD_V4=y |
544 | CONFIG_NFS_COMMON=y | 573 | CONFIG_NFS_COMMON=y |
@@ -561,13 +590,13 @@ CONFIG_ENABLE_WARN_DEPRECATED=y | |||
561 | CONFIG_ENABLE_MUST_CHECK=y | 590 | CONFIG_ENABLE_MUST_CHECK=y |
562 | CONFIG_FRAME_WARN=1024 | 591 | CONFIG_FRAME_WARN=1024 |
563 | CONFIG_MAGIC_SYSRQ=y | 592 | CONFIG_MAGIC_SYSRQ=y |
593 | CONFIG_STRIP_ASM_SYMS=y | ||
564 | # CONFIG_UNUSED_SYMBOLS is not set | 594 | # CONFIG_UNUSED_SYMBOLS is not set |
565 | # CONFIG_DEBUG_FS is not set | 595 | # CONFIG_DEBUG_FS is not set |
566 | # CONFIG_HEADERS_CHECK is not set | 596 | # CONFIG_HEADERS_CHECK is not set |
567 | # CONFIG_DEBUG_KERNEL is not set | 597 | # CONFIG_DEBUG_KERNEL is not set |
568 | # CONFIG_DEBUG_BUGVERBOSE is not set | 598 | CONFIG_DEBUG_BUGVERBOSE=y |
569 | # CONFIG_DEBUG_MEMORY_INIT is not set | 599 | # CONFIG_DEBUG_MEMORY_INIT is not set |
570 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
571 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set | 600 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set |
572 | # CONFIG_SAMPLES is not set | 601 | # CONFIG_SAMPLES is not set |
573 | 602 | ||
@@ -577,7 +606,11 @@ CONFIG_MAGIC_SYSRQ=y | |||
577 | # CONFIG_KEYS is not set | 606 | # CONFIG_KEYS is not set |
578 | # CONFIG_SECURITY is not set | 607 | # CONFIG_SECURITY is not set |
579 | # CONFIG_SECURITYFS is not set | 608 | # CONFIG_SECURITYFS is not set |
580 | # CONFIG_SECURITY_FILE_CAPABILITIES is not set | 609 | # CONFIG_DEFAULT_SECURITY_SELINUX is not set |
610 | # CONFIG_DEFAULT_SECURITY_SMACK is not set | ||
611 | # CONFIG_DEFAULT_SECURITY_TOMOYO is not set | ||
612 | CONFIG_DEFAULT_SECURITY_DAC=y | ||
613 | CONFIG_DEFAULT_SECURITY="" | ||
581 | # CONFIG_CRYPTO is not set | 614 | # CONFIG_CRYPTO is not set |
582 | # CONFIG_BINARY_PRINTF is not set | 615 | # CONFIG_BINARY_PRINTF is not set |
583 | 616 | ||
diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h index 0b610f482abb..f49ac49e09ad 100644 --- a/arch/mn10300/include/asm/bitops.h +++ b/arch/mn10300/include/asm/bitops.h | |||
@@ -165,7 +165,7 @@ static inline __attribute__((const)) | |||
165 | unsigned long __ffs(unsigned long x) | 165 | unsigned long __ffs(unsigned long x) |
166 | { | 166 | { |
167 | int bit; | 167 | int bit; |
168 | asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(x & -x)); | 168 | asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(x & -x) : "cc"); |
169 | return bit; | 169 | return bit; |
170 | } | 170 | } |
171 | 171 | ||
@@ -177,7 +177,7 @@ static inline __attribute__((const)) | |||
177 | int __ilog2_u32(u32 n) | 177 | int __ilog2_u32(u32 n) |
178 | { | 178 | { |
179 | int bit; | 179 | int bit; |
180 | asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(n)); | 180 | asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(n) : "cc"); |
181 | return bit; | 181 | return bit; |
182 | } | 182 | } |
183 | 183 | ||
diff --git a/arch/mn10300/include/asm/div64.h b/arch/mn10300/include/asm/div64.h index 3a8329b3e869..34dcb8e68309 100644 --- a/arch/mn10300/include/asm/div64.h +++ b/arch/mn10300/include/asm/div64.h | |||
@@ -72,6 +72,7 @@ unsigned __muldiv64u(unsigned val, unsigned mult, unsigned div) | |||
72 | * MDR = MDR:val%div */ | 72 | * MDR = MDR:val%div */ |
73 | : "=r"(result) | 73 | : "=r"(result) |
74 | : "0"(val), "ir"(mult), "r"(div) | 74 | : "0"(val), "ir"(mult), "r"(div) |
75 | : "cc" | ||
75 | ); | 76 | ); |
76 | 77 | ||
77 | return result; | 78 | return result; |
@@ -92,6 +93,7 @@ signed __muldiv64s(signed val, signed mult, signed div) | |||
92 | * MDR = MDR:val%div */ | 93 | * MDR = MDR:val%div */ |
93 | : "=r"(result) | 94 | : "=r"(result) |
94 | : "0"(val), "ir"(mult), "r"(div) | 95 | : "0"(val), "ir"(mult), "r"(div) |
96 | : "cc" | ||
95 | ); | 97 | ); |
96 | 98 | ||
97 | return result; | 99 | return result; |
diff --git a/arch/mn10300/include/asm/system.h b/arch/mn10300/include/asm/system.h index 8214fb7e7fe4..3636c054dcd5 100644 --- a/arch/mn10300/include/asm/system.h +++ b/arch/mn10300/include/asm/system.h | |||
@@ -143,6 +143,7 @@ do { \ | |||
143 | " mov %0,epsw \n" \ | 143 | " mov %0,epsw \n" \ |
144 | : "=&d"(tmp) \ | 144 | : "=&d"(tmp) \ |
145 | : "i"(~EPSW_IM), "r"(__mn10300_irq_enabled_epsw) \ | 145 | : "i"(~EPSW_IM), "r"(__mn10300_irq_enabled_epsw) \ |
146 | : "cc" \ | ||
146 | ); \ | 147 | ); \ |
147 | } while (0) | 148 | } while (0) |
148 | 149 | ||
diff --git a/arch/mn10300/include/asm/tlbflush.h b/arch/mn10300/include/asm/tlbflush.h index e0239865abcb..1a7e29281c5d 100644 --- a/arch/mn10300/include/asm/tlbflush.h +++ b/arch/mn10300/include/asm/tlbflush.h | |||
@@ -22,7 +22,7 @@ do { \ | |||
22 | " mov %0,%1 \n" \ | 22 | " mov %0,%1 \n" \ |
23 | : "=d"(w) \ | 23 | : "=d"(w) \ |
24 | : "m"(MMUCTR), "i"(MMUCTR_IIV|MMUCTR_DIV) \ | 24 | : "m"(MMUCTR), "i"(MMUCTR_IIV|MMUCTR_DIV) \ |
25 | : "memory" \ | 25 | : "cc", "memory" \ |
26 | ); \ | 26 | ); \ |
27 | } while (0) | 27 | } while (0) |
28 | 28 | ||
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index 167e10ff06d9..197a7af3dd8a 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h | |||
@@ -316,7 +316,7 @@ do { \ | |||
316 | " .previous\n" \ | 316 | " .previous\n" \ |
317 | : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\ | 317 | : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\ |
318 | : "0"(__from), "1"(__to), "2"(size) \ | 318 | : "0"(__from), "1"(__to), "2"(size) \ |
319 | : "memory"); \ | 319 | : "cc", "memory"); \ |
320 | } \ | 320 | } \ |
321 | } while (0) | 321 | } while (0) |
322 | 322 | ||
@@ -352,7 +352,7 @@ do { \ | |||
352 | " .previous\n" \ | 352 | " .previous\n" \ |
353 | : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\ | 353 | : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\ |
354 | : "0"(__from), "1"(__to), "2"(size) \ | 354 | : "0"(__from), "1"(__to), "2"(size) \ |
355 | : "memory"); \ | 355 | : "cc", "memory"); \ |
356 | } \ | 356 | } \ |
357 | } while (0) | 357 | } while (0) |
358 | 358 | ||
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h index 2a983931c11f..c05acb95c2a9 100644 --- a/arch/mn10300/include/asm/unistd.h +++ b/arch/mn10300/include/asm/unistd.h | |||
@@ -348,10 +348,11 @@ | |||
348 | #define __NR_pwritev 335 | 348 | #define __NR_pwritev 335 |
349 | #define __NR_rt_tgsigqueueinfo 336 | 349 | #define __NR_rt_tgsigqueueinfo 336 |
350 | #define __NR_perf_event_open 337 | 350 | #define __NR_perf_event_open 337 |
351 | #define __NR_recvmmsg 338 | ||
351 | 352 | ||
352 | #ifdef __KERNEL__ | 353 | #ifdef __KERNEL__ |
353 | 354 | ||
354 | #define NR_syscalls 338 | 355 | #define NR_syscalls 339 |
355 | 356 | ||
356 | /* | 357 | /* |
357 | * specify the deprecated syscalls we want to support on this arch | 358 | * specify the deprecated syscalls we want to support on this arch |
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S index c9ee6c009d79..88e3e1c3cc21 100644 --- a/arch/mn10300/kernel/entry.S +++ b/arch/mn10300/kernel/entry.S | |||
@@ -724,6 +724,7 @@ ENTRY(sys_call_table) | |||
724 | .long sys_pwritev /* 335 */ | 724 | .long sys_pwritev /* 335 */ |
725 | .long sys_rt_tgsigqueueinfo | 725 | .long sys_rt_tgsigqueueinfo |
726 | .long sys_perf_event_open | 726 | .long sys_perf_event_open |
727 | .long sys_recvmmsg | ||
727 | 728 | ||
728 | 729 | ||
729 | nr_syscalls=(.-sys_call_table)/4 | 730 | nr_syscalls=(.-sys_call_table)/4 |
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c index 229b710fc5d5..ef34d5a0f8bd 100644 --- a/arch/mn10300/kernel/mn10300-serial.c +++ b/arch/mn10300/kernel/mn10300-serial.c | |||
@@ -380,7 +380,8 @@ static int mask_test_and_clear(volatile u8 *ptr, u8 mask) | |||
380 | u32 epsw; | 380 | u32 epsw; |
381 | asm volatile(" bclr %1,(%2) \n" | 381 | asm volatile(" bclr %1,(%2) \n" |
382 | " mov epsw,%0 \n" | 382 | " mov epsw,%0 \n" |
383 | : "=d"(epsw) : "d"(mask), "a"(ptr)); | 383 | : "=d"(epsw) : "d"(mask), "a"(ptr) |
384 | : "cc", "memory"); | ||
384 | return !(epsw & EPSW_FLAG_Z); | 385 | return !(epsw & EPSW_FLAG_Z); |
385 | } | 386 | } |
386 | 387 | ||
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index a21f43bc68e2..717db14c2cc3 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
@@ -264,7 +264,7 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, | |||
264 | 264 | ||
265 | /* this is the X/Open sanctioned signal stack switching. */ | 265 | /* this is the X/Open sanctioned signal stack switching. */ |
266 | if (ka->sa.sa_flags & SA_ONSTACK) { | 266 | if (ka->sa.sa_flags & SA_ONSTACK) { |
267 | if (!on_sig_stack(sp)) | 267 | if (sas_ss_flags(sp) == 0) |
268 | sp = current->sas_ss_sp + current->sas_ss_size; | 268 | sp = current->sas_ss_sp + current->sas_ss_size; |
269 | } | 269 | } |
270 | 270 | ||
diff --git a/arch/mn10300/lib/checksum.c b/arch/mn10300/lib/checksum.c index 274f29ec33c1..b6580f5d89ee 100644 --- a/arch/mn10300/lib/checksum.c +++ b/arch/mn10300/lib/checksum.c | |||
@@ -22,6 +22,7 @@ static inline unsigned short from32to16(__wsum sum) | |||
22 | " addc 0xffff,%0 \n" | 22 | " addc 0xffff,%0 \n" |
23 | : "=r" (sum) | 23 | : "=r" (sum) |
24 | : "r" (sum << 16), "0" (sum & 0xffff0000) | 24 | : "r" (sum << 16), "0" (sum & 0xffff0000) |
25 | : "cc" | ||
25 | ); | 26 | ); |
26 | return sum >> 16; | 27 | return sum >> 16; |
27 | } | 28 | } |
diff --git a/arch/mn10300/lib/delay.c b/arch/mn10300/lib/delay.c index cce66bc0822d..fdf6f710f94e 100644 --- a/arch/mn10300/lib/delay.c +++ b/arch/mn10300/lib/delay.c | |||
@@ -28,7 +28,8 @@ void __delay(unsigned long loops) | |||
28 | "2: add -1,%0 \n" | 28 | "2: add -1,%0 \n" |
29 | " bne 2b \n" | 29 | " bne 2b \n" |
30 | : "=&d" (d0) | 30 | : "=&d" (d0) |
31 | : "0" (loops)); | 31 | : "0" (loops) |
32 | : "cc"); | ||
32 | } | 33 | } |
33 | EXPORT_SYMBOL(__delay); | 34 | EXPORT_SYMBOL(__delay); |
34 | 35 | ||
diff --git a/arch/mn10300/lib/usercopy.c b/arch/mn10300/lib/usercopy.c index a75b203059c1..7826e6c364e7 100644 --- a/arch/mn10300/lib/usercopy.c +++ b/arch/mn10300/lib/usercopy.c | |||
@@ -62,7 +62,7 @@ do { \ | |||
62 | " .previous" \ | 62 | " .previous" \ |
63 | :"=&r"(res), "=r"(count), "=&r"(w) \ | 63 | :"=&r"(res), "=r"(count), "=&r"(w) \ |
64 | :"i"(-EFAULT), "1"(count), "a"(src), "a"(dst) \ | 64 | :"i"(-EFAULT), "1"(count), "a"(src), "a"(dst) \ |
65 | :"memory"); \ | 65 | : "memory", "cc"); \ |
66 | } while (0) | 66 | } while (0) |
67 | 67 | ||
68 | long | 68 | long |
@@ -109,7 +109,7 @@ do { \ | |||
109 | ".previous\n" \ | 109 | ".previous\n" \ |
110 | : "+r"(size), "=&r"(w) \ | 110 | : "+r"(size), "=&r"(w) \ |
111 | : "a"(addr), "d"(0) \ | 111 | : "a"(addr), "d"(0) \ |
112 | : "memory"); \ | 112 | : "memory", "cc"); \ |
113 | } while (0) | 113 | } while (0) |
114 | 114 | ||
115 | unsigned long | 115 | unsigned long |
@@ -161,6 +161,6 @@ long strnlen_user(const char *s, long n) | |||
161 | ".previous\n" | 161 | ".previous\n" |
162 | :"=d"(res), "=&r"(w) | 162 | :"=d"(res), "=&r"(w) |
163 | :"0"(0), "a"(s), "r"(n) | 163 | :"0"(0), "a"(s), "r"(n) |
164 | :"memory"); | 164 | : "memory", "cc"); |
165 | return res; | 165 | return res; |
166 | } | 166 | } |
diff --git a/arch/mn10300/mm/dma-alloc.c b/arch/mn10300/mm/dma-alloc.c index f3649d8f50e3..ee82d624b3c6 100644 --- a/arch/mn10300/mm/dma-alloc.c +++ b/arch/mn10300/mm/dma-alloc.c | |||
@@ -16,12 +16,24 @@ | |||
16 | #include <linux/pci.h> | 16 | #include <linux/pci.h> |
17 | #include <asm/io.h> | 17 | #include <asm/io.h> |
18 | 18 | ||
19 | static unsigned long pci_sram_allocated = 0xbc000000; | ||
20 | |||
19 | void *dma_alloc_coherent(struct device *dev, size_t size, | 21 | void *dma_alloc_coherent(struct device *dev, size_t size, |
20 | dma_addr_t *dma_handle, int gfp) | 22 | dma_addr_t *dma_handle, int gfp) |
21 | { | 23 | { |
22 | unsigned long addr; | 24 | unsigned long addr; |
23 | void *ret; | 25 | void *ret; |
24 | 26 | ||
27 | printk("dma_alloc_coherent(%s,%zu,,%x)\n", dev_name(dev), size, gfp); | ||
28 | |||
29 | if (0xbe000000 - pci_sram_allocated >= size) { | ||
30 | size = (size + 255) & ~255; | ||
31 | addr = pci_sram_allocated; | ||
32 | pci_sram_allocated += size; | ||
33 | ret = (void *) addr; | ||
34 | goto done; | ||
35 | } | ||
36 | |||
25 | /* ignore region specifiers */ | 37 | /* ignore region specifiers */ |
26 | gfp &= ~(__GFP_DMA | __GFP_HIGHMEM); | 38 | gfp &= ~(__GFP_DMA | __GFP_HIGHMEM); |
27 | 39 | ||
@@ -41,7 +53,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, | |||
41 | /* write back and evict all cache lines covering this region */ | 53 | /* write back and evict all cache lines covering this region */ |
42 | mn10300_dcache_flush_inv_range2(virt_to_phys((void *) addr), PAGE_SIZE); | 54 | mn10300_dcache_flush_inv_range2(virt_to_phys((void *) addr), PAGE_SIZE); |
43 | 55 | ||
56 | done: | ||
44 | *dma_handle = virt_to_bus((void *) addr); | 57 | *dma_handle = virt_to_bus((void *) addr); |
58 | printk("dma_alloc_coherent() = %p [%x]\n", ret, *dma_handle); | ||
45 | return ret; | 59 | return ret; |
46 | } | 60 | } |
47 | EXPORT_SYMBOL(dma_alloc_coherent); | 61 | EXPORT_SYMBOL(dma_alloc_coherent); |
@@ -51,6 +65,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr, | |||
51 | { | 65 | { |
52 | unsigned long addr = (unsigned long) vaddr & ~0x20000000; | 66 | unsigned long addr = (unsigned long) vaddr & ~0x20000000; |
53 | 67 | ||
68 | if (addr >= 0x9c000000) | ||
69 | return; | ||
70 | |||
54 | free_pages(addr, get_order(size)); | 71 | free_pages(addr, get_order(size)); |
55 | } | 72 | } |
56 | EXPORT_SYMBOL(dma_free_coherent); | 73 | EXPORT_SYMBOL(dma_free_coherent); |
diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c index ec1420562dc7..dd27a9a35152 100644 --- a/arch/mn10300/mm/init.c +++ b/arch/mn10300/mm/init.c | |||
@@ -118,8 +118,7 @@ void __init mem_init(void) | |||
118 | reservedpages << (PAGE_SHIFT - 10), | 118 | reservedpages << (PAGE_SHIFT - 10), |
119 | datasize >> 10, | 119 | datasize >> 10, |
120 | initsize >> 10, | 120 | initsize >> 10, |
121 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT - 10)) | 121 | totalhigh_pages << (PAGE_SHIFT - 10)); |
122 | ); | ||
123 | } | 122 | } |
124 | 123 | ||
125 | /* | 124 | /* |
diff --git a/arch/mn10300/mm/misalignment.c b/arch/mn10300/mm/misalignment.c index 30016251f658..6dffbf97ac26 100644 --- a/arch/mn10300/mm/misalignment.c +++ b/arch/mn10300/mm/misalignment.c | |||
@@ -633,13 +633,13 @@ static int misalignment_addr(unsigned long *registers, unsigned long sp, | |||
633 | goto displace_or_inc; | 633 | goto displace_or_inc; |
634 | case SD24: | 634 | case SD24: |
635 | tmp = disp << 8; | 635 | tmp = disp << 8; |
636 | asm("asr 8,%0" : "=r"(tmp) : "0"(tmp)); | 636 | asm("asr 8,%0" : "=r"(tmp) : "0"(tmp) : "cc"); |
637 | disp = (long) tmp; | 637 | disp = (long) tmp; |
638 | goto displace_or_inc; | 638 | goto displace_or_inc; |
639 | case SIMM4_2: | 639 | case SIMM4_2: |
640 | tmp = opcode >> 4 & 0x0f; | 640 | tmp = opcode >> 4 & 0x0f; |
641 | tmp <<= 28; | 641 | tmp <<= 28; |
642 | asm("asr 28,%0" : "=r"(tmp) : "0"(tmp)); | 642 | asm("asr 28,%0" : "=r"(tmp) : "0"(tmp) : "cc"); |
643 | disp = (long) tmp; | 643 | disp = (long) tmp; |
644 | goto displace_or_inc; | 644 | goto displace_or_inc; |
645 | case IMM8: | 645 | case IMM8: |
diff --git a/arch/mn10300/unit-asb2305/include/unit/serial.h b/arch/mn10300/unit-asb2305/include/unit/serial.h index 3bfc90938787..8086cc092cec 100644 --- a/arch/mn10300/unit-asb2305/include/unit/serial.h +++ b/arch/mn10300/unit-asb2305/include/unit/serial.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #ifndef _ASM_UNIT_SERIAL_H | 11 | #ifndef _ASM_UNIT_SERIAL_H |
12 | #define _ASM_UNIT_SERIAL_H | 12 | #define _ASM_UNIT_SERIAL_H |
13 | 13 | ||
14 | #include <asm/cpu/cpu-regs.h> | 14 | #include <asm/cpu-regs.h> |
15 | #include <proc/irq.h> | 15 | #include <proc/irq.h> |
16 | #include <linux/serial_reg.h> | 16 | #include <linux/serial_reg.h> |
17 | 17 | ||
diff --git a/arch/mn10300/unit-asb2305/include/unit/timex.h b/arch/mn10300/unit-asb2305/include/unit/timex.h index a71c49aa85eb..d1c72d59fa9f 100644 --- a/arch/mn10300/unit-asb2305/include/unit/timex.h +++ b/arch/mn10300/unit-asb2305/include/unit/timex.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/irq.h> | 15 | #include <linux/irq.h> |
16 | #endif /* __ASSEMBLY__ */ | 16 | #endif /* __ASSEMBLY__ */ |
17 | 17 | ||
18 | #include <asm/cpu/timer-regs.h> | 18 | #include <asm/timer-regs.h> |
19 | #include <unit/clock.h> | 19 | #include <unit/clock.h> |
20 | 20 | ||
21 | /* | 21 | /* |
diff --git a/arch/mn10300/unit-asb2305/leds.c b/arch/mn10300/unit-asb2305/leds.c index d345ff9042d5..6f8de9954026 100644 --- a/arch/mn10300/unit-asb2305/leds.c +++ b/arch/mn10300/unit-asb2305/leds.c | |||
@@ -13,8 +13,8 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <asm/io.h> | 14 | #include <asm/io.h> |
15 | #include <asm/processor.h> | 15 | #include <asm/processor.h> |
16 | #include <asm/cpu/intctl-regs.h> | 16 | #include <asm/intctl-regs.h> |
17 | #include <asm/cpu/rtc-regs.h> | 17 | #include <asm/rtc-regs.h> |
18 | #include <unit/leds.h> | 18 | #include <unit/leds.h> |
19 | 19 | ||
20 | static const u8 asb2305_led_hex_tbl[16] = { | 20 | static const u8 asb2305_led_hex_tbl[16] = { |
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c index d100ca788468..78cd134ddf7d 100644 --- a/arch/mn10300/unit-asb2305/pci-asb2305.c +++ b/arch/mn10300/unit-asb2305/pci-asb2305.c | |||
@@ -218,45 +218,6 @@ void __init pcibios_resource_survey(void) | |||
218 | pcibios_allocate_resources(1); | 218 | pcibios_allocate_resources(1); |
219 | } | 219 | } |
220 | 220 | ||
221 | int pcibios_enable_resources(struct pci_dev *dev, int mask) | ||
222 | { | ||
223 | u16 cmd, old_cmd; | ||
224 | int idx; | ||
225 | struct resource *r; | ||
226 | |||
227 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
228 | old_cmd = cmd; | ||
229 | |||
230 | for (idx = 0; idx < 6; idx++) { | ||
231 | /* Only set up the requested stuff */ | ||
232 | if (!(mask & (1 << idx))) | ||
233 | continue; | ||
234 | |||
235 | r = &dev->resource[idx]; | ||
236 | |||
237 | if (!r->start && r->end) { | ||
238 | printk(KERN_ERR | ||
239 | "PCI: Device %s not available because of" | ||
240 | " resource collisions\n", | ||
241 | pci_name(dev)); | ||
242 | return -EINVAL; | ||
243 | } | ||
244 | |||
245 | if (r->flags & IORESOURCE_IO) | ||
246 | cmd |= PCI_COMMAND_IO; | ||
247 | if (r->flags & IORESOURCE_MEM) | ||
248 | cmd |= PCI_COMMAND_MEMORY; | ||
249 | } | ||
250 | |||
251 | if (dev->resource[PCI_ROM_RESOURCE].start) | ||
252 | cmd |= PCI_COMMAND_MEMORY; | ||
253 | |||
254 | if (cmd != old_cmd) | ||
255 | pci_write_config_word(dev, PCI_COMMAND, cmd); | ||
256 | |||
257 | return 0; | ||
258 | } | ||
259 | |||
260 | /* | 221 | /* |
261 | * If we set up a device for bus mastering, we need to check the latency | 222 | * If we set up a device for bus mastering, we need to check the latency |
262 | * timer as certain crappy BIOSes forget to set it properly. | 223 | * timer as certain crappy BIOSes forget to set it properly. |
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.h b/arch/mn10300/unit-asb2305/pci-asb2305.h index 9763d1ce343a..c3fa294b6e28 100644 --- a/arch/mn10300/unit-asb2305/pci-asb2305.h +++ b/arch/mn10300/unit-asb2305/pci-asb2305.h | |||
@@ -34,7 +34,6 @@ extern unsigned int pci_probe; | |||
34 | extern unsigned int pcibios_max_latency; | 34 | extern unsigned int pcibios_max_latency; |
35 | 35 | ||
36 | extern void pcibios_resource_survey(void); | 36 | extern void pcibios_resource_survey(void); |
37 | extern int pcibios_enable_resources(struct pci_dev *dev, int mask); | ||
38 | 37 | ||
39 | /* pci.c */ | 38 | /* pci.c */ |
40 | 39 | ||
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c index 07dbbcda3b2e..2cb7e75ba1c0 100644 --- a/arch/mn10300/unit-asb2305/pci.c +++ b/arch/mn10300/unit-asb2305/pci.c | |||
@@ -27,6 +27,29 @@ struct pci_bus *pci_root_bus; | |||
27 | struct pci_ops *pci_root_ops; | 27 | struct pci_ops *pci_root_ops; |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * The accessible PCI window does not cover the entire CPU address space, but | ||
31 | * there are devices we want to access outside of that window, so we need to | ||
32 | * insert specific PCI bus resources instead of using the platform-level bus | ||
33 | * resources directly for the PCI root bus. | ||
34 | * | ||
35 | * These are configured and inserted by pcibios_init() and are attached to the | ||
36 | * root bus by pcibios_fixup_bus(). | ||
37 | */ | ||
38 | static struct resource pci_ioport_resource = { | ||
39 | .name = "PCI IO", | ||
40 | .start = 0xbe000000, | ||
41 | .end = 0xbe03ffff, | ||
42 | .flags = IORESOURCE_IO, | ||
43 | }; | ||
44 | |||
45 | static struct resource pci_iomem_resource = { | ||
46 | .name = "PCI mem", | ||
47 | .start = 0xb8000000, | ||
48 | .end = 0xbbffffff, | ||
49 | .flags = IORESOURCE_MEM, | ||
50 | }; | ||
51 | |||
52 | /* | ||
30 | * Functions for accessing PCI configuration space | 53 | * Functions for accessing PCI configuration space |
31 | */ | 54 | */ |
32 | 55 | ||
@@ -279,7 +302,7 @@ static int __init pci_sanity_check(struct pci_ops *o) | |||
279 | (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) | 302 | (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) |
280 | return 1; | 303 | return 1; |
281 | 304 | ||
282 | printk(KERN_ERROR "PCI: Sanity check failed\n"); | 305 | printk(KERN_ERR "PCI: Sanity check failed\n"); |
283 | return 0; | 306 | return 0; |
284 | } | 307 | } |
285 | 308 | ||
@@ -297,6 +320,7 @@ static int __init pci_check_direct(void) | |||
297 | printk(KERN_INFO "PCI: Using configuration ampci\n"); | 320 | printk(KERN_INFO "PCI: Using configuration ampci\n"); |
298 | request_mem_region(0xBE040000, 256, "AMPCI bridge"); | 321 | request_mem_region(0xBE040000, 256, "AMPCI bridge"); |
299 | request_mem_region(0xBFFFFFF4, 12, "PCI ampci"); | 322 | request_mem_region(0xBFFFFFF4, 12, "PCI ampci"); |
323 | request_mem_region(0xBC000000, 32 * 1024 * 1024, "PCI SRAM"); | ||
300 | return 0; | 324 | return 0; |
301 | } | 325 | } |
302 | 326 | ||
@@ -358,6 +382,11 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus) | |||
358 | { | 382 | { |
359 | struct pci_dev *dev; | 383 | struct pci_dev *dev; |
360 | 384 | ||
385 | if (bus->number == 0) { | ||
386 | bus->resource[0] = &pci_ioport_resource; | ||
387 | bus->resource[1] = &pci_iomem_resource; | ||
388 | } | ||
389 | |||
361 | if (bus->self) { | 390 | if (bus->self) { |
362 | pci_read_bridge_bases(bus); | 391 | pci_read_bridge_bases(bus); |
363 | pcibios_fixup_device_resources(bus->self); | 392 | pcibios_fixup_device_resources(bus->self); |
@@ -380,6 +409,11 @@ static int __init pcibios_init(void) | |||
380 | iomem_resource.start = 0xA0000000; | 409 | iomem_resource.start = 0xA0000000; |
381 | iomem_resource.end = 0xDFFFFFFF; | 410 | iomem_resource.end = 0xDFFFFFFF; |
382 | 411 | ||
412 | if (insert_resource(&iomem_resource, &pci_iomem_resource) < 0) | ||
413 | panic("Unable to insert PCI IOMEM resource\n"); | ||
414 | if (insert_resource(&ioport_resource, &pci_ioport_resource) < 0) | ||
415 | panic("Unable to insert PCI IOPORT resource\n"); | ||
416 | |||
383 | if (!pci_probe) | 417 | if (!pci_probe) |
384 | return 0; | 418 | return 0; |
385 | 419 | ||
@@ -391,32 +425,11 @@ static int __init pcibios_init(void) | |||
391 | printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n", | 425 | printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n", |
392 | MEM_PAGING_REG); | 426 | MEM_PAGING_REG); |
393 | 427 | ||
394 | { | 428 | pci_root_bus = pci_scan_bus(0, &pci_direct_ampci, NULL); |
395 | #if 0 | ||
396 | static struct pci_bus am33_root_bus = { | ||
397 | .children = LIST_HEAD_INIT(am33_root_bus.children), | ||
398 | .devices = LIST_HEAD_INIT(am33_root_bus.devices), | ||
399 | .number = 0, | ||
400 | .secondary = 0, | ||
401 | .resource = { &ioport_resource, &iomem_resource }, | ||
402 | }; | ||
403 | |||
404 | am33_root_bus.ops = pci_root_ops; | ||
405 | list_add_tail(&am33_root_bus.node, &pci_root_buses); | ||
406 | |||
407 | am33_root_bus.subordinate = pci_do_scan_bus(0); | ||
408 | |||
409 | pci_root_bus = &am33_root_bus; | ||
410 | #else | ||
411 | pci_root_bus = pci_scan_bus(0, &pci_direct_ampci, NULL); | ||
412 | #endif | ||
413 | } | ||
414 | 429 | ||
415 | pcibios_irq_init(); | 430 | pcibios_irq_init(); |
416 | pcibios_fixup_irqs(); | 431 | pcibios_fixup_irqs(); |
417 | #if 0 | ||
418 | pcibios_resource_survey(); | 432 | pcibios_resource_survey(); |
419 | #endif | ||
420 | return 0; | 433 | return 0; |
421 | } | 434 | } |
422 | 435 | ||
@@ -440,7 +453,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
440 | { | 453 | { |
441 | int err; | 454 | int err; |
442 | 455 | ||
443 | err = pcibios_enable_resources(dev, mask); | 456 | err = pci_enable_resources(dev, mask); |
444 | if (err == 0) | 457 | if (err == 0) |
445 | pcibios_enable_irq(dev); | 458 | pcibios_enable_irq(dev); |
446 | return err; | 459 | return err; |
@@ -455,6 +468,7 @@ static void __init unit_disable_pcnet(struct pci_bus *bus, struct pci_ops *o) | |||
455 | 468 | ||
456 | bus->number = 0; | 469 | bus->number = 0; |
457 | 470 | ||
471 | o->read (bus, PCI_DEVFN(2, 0), PCI_VENDOR_ID, 4, &x); | ||
458 | o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); | 472 | o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); |
459 | x |= PCI_COMMAND_MASTER | | 473 | x |= PCI_COMMAND_MASTER | |
460 | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | | 474 | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | |
diff --git a/arch/mn10300/unit-asb2305/unit-init.c b/arch/mn10300/unit-asb2305/unit-init.c index 1c452cc3f6e9..a76c8e0ab90f 100644 --- a/arch/mn10300/unit-asb2305/unit-init.c +++ b/arch/mn10300/unit-asb2305/unit-init.c | |||
@@ -15,9 +15,8 @@ | |||
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | #include <asm/setup.h> | 16 | #include <asm/setup.h> |
17 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
18 | #include <asm/cpu/intctl-regs.h> | 18 | #include <asm/intctl-regs.h> |
19 | #include <asm/cpu/rtc-regs.h> | 19 | #include <asm/serial-regs.h> |
20 | #include <asm/cpu/serial-regs.h> | ||
21 | #include <unit/serial.h> | 20 | #include <unit/serial.h> |
22 | 21 | ||
23 | /* | 22 | /* |
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index bb2465bcb327..826a30a00f59 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -20,7 +20,7 @@ | |||
20 | all: $(obj)/zImage | 20 | all: $(obj)/zImage |
21 | 21 | ||
22 | BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 22 | BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
23 | -fno-strict-aliasing -Os -msoft-float -pipe \ | 23 | -fno-strict-aliasing -Os -msoft-float -pipe -D__KERNEL__\ |
24 | -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ | 24 | -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ |
25 | -isystem $(shell $(CROSS32CC) -print-file-name=include) | 25 | -isystem $(shell $(CROSS32CC) -print-file-name=include) |
26 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc | 26 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc |
@@ -34,6 +34,8 @@ BOOTCFLAGS += -fno-stack-protector | |||
34 | endif | 34 | endif |
35 | 35 | ||
36 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) | 36 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) |
37 | BOOTCFLAGS += -include include/linux/autoconf.h -Iarch/powerpc/include | ||
38 | BOOTCFLAGS += -Iinclude | ||
37 | 39 | ||
38 | DTS_FLAGS ?= -p 1024 | 40 | DTS_FLAGS ?= -p 1024 |
39 | 41 | ||
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index e8dfdbd9327a..cadbed679fbb 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -1107,6 +1107,12 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus) | |||
1107 | list_for_each_entry(dev, &bus->devices, bus_list) { | 1107 | list_for_each_entry(dev, &bus->devices, bus_list) { |
1108 | struct dev_archdata *sd = &dev->dev.archdata; | 1108 | struct dev_archdata *sd = &dev->dev.archdata; |
1109 | 1109 | ||
1110 | /* Cardbus can call us to add new devices to a bus, so ignore | ||
1111 | * those who are already fully discovered | ||
1112 | */ | ||
1113 | if (dev->is_added) | ||
1114 | continue; | ||
1115 | |||
1110 | /* Setup OF node pointer in archdata */ | 1116 | /* Setup OF node pointer in archdata */ |
1111 | sd->of_node = pci_device_to_OF_node(dev); | 1117 | sd->of_node = pci_device_to_OF_node(dev); |
1112 | 1118 | ||
@@ -1147,6 +1153,13 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus) | |||
1147 | } | 1153 | } |
1148 | EXPORT_SYMBOL(pcibios_fixup_bus); | 1154 | EXPORT_SYMBOL(pcibios_fixup_bus); |
1149 | 1155 | ||
1156 | void __devinit pci_fixup_cardbus(struct pci_bus *bus) | ||
1157 | { | ||
1158 | /* Now fixup devices on that bus */ | ||
1159 | pcibios_setup_bus_devices(bus); | ||
1160 | } | ||
1161 | |||
1162 | |||
1150 | static int skip_isa_ioresource_align(struct pci_dev *dev) | 1163 | static int skip_isa_ioresource_align(struct pci_dev *dev) |
1151 | { | 1164 | { |
1152 | if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && | 1165 | if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && |
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c index 5598f88f142e..e4beeb371a73 100644 --- a/arch/powerpc/kvm/book3s_64_mmu.c +++ b/arch/powerpc/kvm/book3s_64_mmu.c | |||
@@ -390,6 +390,26 @@ static void kvmppc_mmu_book3s_64_mtsrin(struct kvm_vcpu *vcpu, u32 srnum, | |||
390 | { | 390 | { |
391 | u64 rb = 0, rs = 0; | 391 | u64 rb = 0, rs = 0; |
392 | 392 | ||
393 | /* | ||
394 | * According to Book3 2.01 mtsrin is implemented as: | ||
395 | * | ||
396 | * The SLB entry specified by (RB)32:35 is loaded from register | ||
397 | * RS, as follows. | ||
398 | * | ||
399 | * SLBE Bit Source SLB Field | ||
400 | * | ||
401 | * 0:31 0x0000_0000 ESID-0:31 | ||
402 | * 32:35 (RB)32:35 ESID-32:35 | ||
403 | * 36 0b1 V | ||
404 | * 37:61 0x00_0000|| 0b0 VSID-0:24 | ||
405 | * 62:88 (RS)37:63 VSID-25:51 | ||
406 | * 89:91 (RS)33:35 Ks Kp N | ||
407 | * 92 (RS)36 L ((RS)36 must be 0b0) | ||
408 | * 93 0b0 C | ||
409 | */ | ||
410 | |||
411 | dprintk("KVM MMU: mtsrin(0x%x, 0x%lx)\n", srnum, value); | ||
412 | |||
393 | /* ESID = srnum */ | 413 | /* ESID = srnum */ |
394 | rb |= (srnum & 0xf) << 28; | 414 | rb |= (srnum & 0xf) << 28; |
395 | /* Set the valid bit */ | 415 | /* Set the valid bit */ |
@@ -400,7 +420,7 @@ static void kvmppc_mmu_book3s_64_mtsrin(struct kvm_vcpu *vcpu, u32 srnum, | |||
400 | /* VSID = VSID */ | 420 | /* VSID = VSID */ |
401 | rs |= (value & 0xfffffff) << 12; | 421 | rs |= (value & 0xfffffff) << 12; |
402 | /* flags = flags */ | 422 | /* flags = flags */ |
403 | rs |= ((value >> 27) & 0xf) << 9; | 423 | rs |= ((value >> 28) & 0x7) << 9; |
404 | 424 | ||
405 | kvmppc_mmu_book3s_64_slbmte(vcpu, rs, rb); | 425 | kvmppc_mmu_book3s_64_slbmte(vcpu, rs, rb); |
406 | } | 426 | } |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index f4e53c6708dc..b416aa11b91e 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.31 | 3 | # Linux kernel version: 2.6.33-rc2 |
4 | # Tue Sep 22 17:43:13 2009 | 4 | # Mon Jan 4 09:03:07 2010 |
5 | # | 5 | # |
6 | CONFIG_SCHED_MC=y | 6 | CONFIG_SCHED_MC=y |
7 | CONFIG_MMU=y | 7 | CONFIG_MMU=y |
@@ -51,6 +51,7 @@ CONFIG_AUDIT=y | |||
51 | # | 51 | # |
52 | CONFIG_TREE_RCU=y | 52 | CONFIG_TREE_RCU=y |
53 | # CONFIG_TREE_PREEMPT_RCU is not set | 53 | # CONFIG_TREE_PREEMPT_RCU is not set |
54 | # CONFIG_TINY_RCU is not set | ||
54 | # CONFIG_RCU_TRACE is not set | 55 | # CONFIG_RCU_TRACE is not set |
55 | CONFIG_RCU_FANOUT=64 | 56 | CONFIG_RCU_FANOUT=64 |
56 | # CONFIG_RCU_FANOUT_EXACT is not set | 57 | # CONFIG_RCU_FANOUT_EXACT is not set |
@@ -113,7 +114,6 @@ CONFIG_HAVE_PERF_EVENTS=y | |||
113 | # CONFIG_PERF_EVENTS is not set | 114 | # CONFIG_PERF_EVENTS is not set |
114 | # CONFIG_PERF_COUNTERS is not set | 115 | # CONFIG_PERF_COUNTERS is not set |
115 | CONFIG_VM_EVENT_COUNTERS=y | 116 | CONFIG_VM_EVENT_COUNTERS=y |
116 | # CONFIG_STRIP_ASM_SYMS is not set | ||
117 | # CONFIG_COMPAT_BRK is not set | 117 | # CONFIG_COMPAT_BRK is not set |
118 | CONFIG_SLAB=y | 118 | CONFIG_SLAB=y |
119 | # CONFIG_SLUB is not set | 119 | # CONFIG_SLUB is not set |
@@ -149,21 +149,78 @@ CONFIG_STOP_MACHINE=y | |||
149 | CONFIG_BLOCK=y | 149 | CONFIG_BLOCK=y |
150 | CONFIG_BLK_DEV_BSG=y | 150 | CONFIG_BLK_DEV_BSG=y |
151 | # CONFIG_BLK_DEV_INTEGRITY is not set | 151 | # CONFIG_BLK_DEV_INTEGRITY is not set |
152 | # CONFIG_BLK_CGROUP is not set | ||
152 | CONFIG_BLOCK_COMPAT=y | 153 | CONFIG_BLOCK_COMPAT=y |
153 | 154 | ||
154 | # | 155 | # |
155 | # IO Schedulers | 156 | # IO Schedulers |
156 | # | 157 | # |
157 | CONFIG_IOSCHED_NOOP=y | 158 | CONFIG_IOSCHED_NOOP=y |
158 | CONFIG_IOSCHED_AS=y | ||
159 | CONFIG_IOSCHED_DEADLINE=y | 159 | CONFIG_IOSCHED_DEADLINE=y |
160 | CONFIG_IOSCHED_CFQ=y | 160 | CONFIG_IOSCHED_CFQ=y |
161 | # CONFIG_DEFAULT_AS is not set | 161 | # CONFIG_CFQ_GROUP_IOSCHED is not set |
162 | CONFIG_DEFAULT_DEADLINE=y | 162 | CONFIG_DEFAULT_DEADLINE=y |
163 | # CONFIG_DEFAULT_CFQ is not set | 163 | # CONFIG_DEFAULT_CFQ is not set |
164 | # CONFIG_DEFAULT_NOOP is not set | 164 | # CONFIG_DEFAULT_NOOP is not set |
165 | CONFIG_DEFAULT_IOSCHED="deadline" | 165 | CONFIG_DEFAULT_IOSCHED="deadline" |
166 | CONFIG_PREEMPT_NOTIFIERS=y | 166 | CONFIG_PREEMPT_NOTIFIERS=y |
167 | CONFIG_ARCH_INLINE_SPIN_TRYLOCK=y | ||
168 | CONFIG_ARCH_INLINE_SPIN_TRYLOCK_BH=y | ||
169 | CONFIG_ARCH_INLINE_SPIN_LOCK=y | ||
170 | CONFIG_ARCH_INLINE_SPIN_LOCK_BH=y | ||
171 | CONFIG_ARCH_INLINE_SPIN_LOCK_IRQ=y | ||
172 | CONFIG_ARCH_INLINE_SPIN_LOCK_IRQSAVE=y | ||
173 | CONFIG_ARCH_INLINE_SPIN_UNLOCK=y | ||
174 | CONFIG_ARCH_INLINE_SPIN_UNLOCK_BH=y | ||
175 | CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQ=y | ||
176 | CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE=y | ||
177 | CONFIG_ARCH_INLINE_READ_TRYLOCK=y | ||
178 | CONFIG_ARCH_INLINE_READ_LOCK=y | ||
179 | CONFIG_ARCH_INLINE_READ_LOCK_BH=y | ||
180 | CONFIG_ARCH_INLINE_READ_LOCK_IRQ=y | ||
181 | CONFIG_ARCH_INLINE_READ_LOCK_IRQSAVE=y | ||
182 | CONFIG_ARCH_INLINE_READ_UNLOCK=y | ||
183 | CONFIG_ARCH_INLINE_READ_UNLOCK_BH=y | ||
184 | CONFIG_ARCH_INLINE_READ_UNLOCK_IRQ=y | ||
185 | CONFIG_ARCH_INLINE_READ_UNLOCK_IRQRESTORE=y | ||
186 | CONFIG_ARCH_INLINE_WRITE_TRYLOCK=y | ||
187 | CONFIG_ARCH_INLINE_WRITE_LOCK=y | ||
188 | CONFIG_ARCH_INLINE_WRITE_LOCK_BH=y | ||
189 | CONFIG_ARCH_INLINE_WRITE_LOCK_IRQ=y | ||
190 | CONFIG_ARCH_INLINE_WRITE_LOCK_IRQSAVE=y | ||
191 | CONFIG_ARCH_INLINE_WRITE_UNLOCK=y | ||
192 | CONFIG_ARCH_INLINE_WRITE_UNLOCK_BH=y | ||
193 | CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQ=y | ||
194 | CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE=y | ||
195 | # CONFIG_INLINE_SPIN_TRYLOCK is not set | ||
196 | # CONFIG_INLINE_SPIN_TRYLOCK_BH is not set | ||
197 | # CONFIG_INLINE_SPIN_LOCK is not set | ||
198 | # CONFIG_INLINE_SPIN_LOCK_BH is not set | ||
199 | # CONFIG_INLINE_SPIN_LOCK_IRQ is not set | ||
200 | # CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set | ||
201 | # CONFIG_INLINE_SPIN_UNLOCK is not set | ||
202 | # CONFIG_INLINE_SPIN_UNLOCK_BH is not set | ||
203 | # CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set | ||
204 | # CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set | ||
205 | # CONFIG_INLINE_READ_TRYLOCK is not set | ||
206 | # CONFIG_INLINE_READ_LOCK is not set | ||
207 | # CONFIG_INLINE_READ_LOCK_BH is not set | ||
208 | # CONFIG_INLINE_READ_LOCK_IRQ is not set | ||
209 | # CONFIG_INLINE_READ_LOCK_IRQSAVE is not set | ||
210 | # CONFIG_INLINE_READ_UNLOCK is not set | ||
211 | # CONFIG_INLINE_READ_UNLOCK_BH is not set | ||
212 | # CONFIG_INLINE_READ_UNLOCK_IRQ is not set | ||
213 | # CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set | ||
214 | # CONFIG_INLINE_WRITE_TRYLOCK is not set | ||
215 | # CONFIG_INLINE_WRITE_LOCK is not set | ||
216 | # CONFIG_INLINE_WRITE_LOCK_BH is not set | ||
217 | # CONFIG_INLINE_WRITE_LOCK_IRQ is not set | ||
218 | # CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set | ||
219 | # CONFIG_INLINE_WRITE_UNLOCK is not set | ||
220 | # CONFIG_INLINE_WRITE_UNLOCK_BH is not set | ||
221 | # CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set | ||
222 | # CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set | ||
223 | # CONFIG_MUTEX_SPIN_ON_OWNER is not set | ||
167 | CONFIG_FREEZER=y | 224 | CONFIG_FREEZER=y |
168 | 225 | ||
169 | # | 226 | # |
@@ -227,14 +284,13 @@ CONFIG_MEMORY_HOTPLUG=y | |||
227 | CONFIG_MEMORY_HOTPLUG_SPARSE=y | 284 | CONFIG_MEMORY_HOTPLUG_SPARSE=y |
228 | CONFIG_MEMORY_HOTREMOVE=y | 285 | CONFIG_MEMORY_HOTREMOVE=y |
229 | CONFIG_PAGEFLAGS_EXTENDED=y | 286 | CONFIG_PAGEFLAGS_EXTENDED=y |
230 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 287 | CONFIG_SPLIT_PTLOCK_CPUS=999999 |
231 | CONFIG_MIGRATION=y | 288 | CONFIG_MIGRATION=y |
232 | CONFIG_PHYS_ADDR_T_64BIT=y | 289 | CONFIG_PHYS_ADDR_T_64BIT=y |
233 | CONFIG_ZONE_DMA_FLAG=1 | 290 | CONFIG_ZONE_DMA_FLAG=1 |
234 | CONFIG_BOUNCE=y | 291 | CONFIG_BOUNCE=y |
235 | CONFIG_VIRT_TO_BUS=y | 292 | CONFIG_VIRT_TO_BUS=y |
236 | CONFIG_HAVE_MLOCK=y | 293 | # CONFIG_KSM is not set |
237 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | ||
238 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 | 294 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 |
239 | 295 | ||
240 | # | 296 | # |
@@ -339,6 +395,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y | |||
339 | CONFIG_INET6_XFRM_MODE_BEET=y | 395 | CONFIG_INET6_XFRM_MODE_BEET=y |
340 | # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set | 396 | # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set |
341 | CONFIG_IPV6_SIT=y | 397 | CONFIG_IPV6_SIT=y |
398 | # CONFIG_IPV6_SIT_6RD is not set | ||
342 | CONFIG_IPV6_NDISC_NODETYPE=y | 399 | CONFIG_IPV6_NDISC_NODETYPE=y |
343 | # CONFIG_IPV6_TUNNEL is not set | 400 | # CONFIG_IPV6_TUNNEL is not set |
344 | # CONFIG_IPV6_MULTIPLE_TABLES is not set | 401 | # CONFIG_IPV6_MULTIPLE_TABLES is not set |
@@ -504,6 +561,10 @@ CONFIG_BLK_DEV=y | |||
504 | # CONFIG_BLK_DEV_COW_COMMON is not set | 561 | # CONFIG_BLK_DEV_COW_COMMON is not set |
505 | CONFIG_BLK_DEV_LOOP=m | 562 | CONFIG_BLK_DEV_LOOP=m |
506 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | 563 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set |
564 | |||
565 | # | ||
566 | # DRBD disabled because PROC_FS, INET or CONNECTOR not selected | ||
567 | # | ||
507 | CONFIG_BLK_DEV_NBD=m | 568 | CONFIG_BLK_DEV_NBD=m |
508 | # CONFIG_BLK_DEV_OSD is not set | 569 | # CONFIG_BLK_DEV_OSD is not set |
509 | CONFIG_BLK_DEV_RAM=y | 570 | CONFIG_BLK_DEV_RAM=y |
@@ -710,7 +771,6 @@ CONFIG_S390_VMUR=m | |||
710 | # CONFIG_PPS is not set | 771 | # CONFIG_PPS is not set |
711 | # CONFIG_POWER_SUPPLY is not set | 772 | # CONFIG_POWER_SUPPLY is not set |
712 | # CONFIG_THERMAL is not set | 773 | # CONFIG_THERMAL is not set |
713 | # CONFIG_THERMAL_HWMON is not set | ||
714 | # CONFIG_WATCHDOG is not set | 774 | # CONFIG_WATCHDOG is not set |
715 | # CONFIG_REGULATOR is not set | 775 | # CONFIG_REGULATOR is not set |
716 | # CONFIG_MEMSTICK is not set | 776 | # CONFIG_MEMSTICK is not set |
@@ -864,6 +924,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y | |||
864 | CONFIG_ENABLE_MUST_CHECK=y | 924 | CONFIG_ENABLE_MUST_CHECK=y |
865 | CONFIG_FRAME_WARN=2048 | 925 | CONFIG_FRAME_WARN=2048 |
866 | CONFIG_MAGIC_SYSRQ=y | 926 | CONFIG_MAGIC_SYSRQ=y |
927 | # CONFIG_STRIP_ASM_SYMS is not set | ||
867 | # CONFIG_UNUSED_SYMBOLS is not set | 928 | # CONFIG_UNUSED_SYMBOLS is not set |
868 | CONFIG_DEBUG_FS=y | 929 | CONFIG_DEBUG_FS=y |
869 | # CONFIG_HEADERS_CHECK is not set | 930 | # CONFIG_HEADERS_CHECK is not set |
@@ -931,7 +992,6 @@ CONFIG_BRANCH_PROFILE_NONE=y | |||
931 | CONFIG_SAMPLES=y | 992 | CONFIG_SAMPLES=y |
932 | # CONFIG_SAMPLE_KOBJECT is not set | 993 | # CONFIG_SAMPLE_KOBJECT is not set |
933 | # CONFIG_SAMPLE_KPROBES is not set | 994 | # CONFIG_SAMPLE_KPROBES is not set |
934 | # CONFIG_KMEMCHECK is not set | ||
935 | 995 | ||
936 | # | 996 | # |
937 | # Security options | 997 | # Security options |
@@ -939,7 +999,11 @@ CONFIG_SAMPLES=y | |||
939 | # CONFIG_KEYS is not set | 999 | # CONFIG_KEYS is not set |
940 | # CONFIG_SECURITY is not set | 1000 | # CONFIG_SECURITY is not set |
941 | # CONFIG_SECURITYFS is not set | 1001 | # CONFIG_SECURITYFS is not set |
942 | # CONFIG_SECURITY_FILE_CAPABILITIES is not set | 1002 | # CONFIG_DEFAULT_SECURITY_SELINUX is not set |
1003 | # CONFIG_DEFAULT_SECURITY_SMACK is not set | ||
1004 | # CONFIG_DEFAULT_SECURITY_TOMOYO is not set | ||
1005 | CONFIG_DEFAULT_SECURITY_DAC=y | ||
1006 | CONFIG_DEFAULT_SECURITY="" | ||
943 | CONFIG_CRYPTO=y | 1007 | CONFIG_CRYPTO=y |
944 | 1008 | ||
945 | # | 1009 | # |
diff --git a/arch/s390/include/asm/param.h b/arch/s390/include/asm/param.h index 34aaa4603347..c616821bf2ac 100644 --- a/arch/s390/include/asm/param.h +++ b/arch/s390/include/asm/param.h | |||
@@ -1,30 +1,6 @@ | |||
1 | /* | ||
2 | * include/asm-s390/param.h | ||
3 | * | ||
4 | * S390 version | ||
5 | * | ||
6 | * Derived from "include/asm-i386/param.h" | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASMS390_PARAM_H | 1 | #ifndef _ASMS390_PARAM_H |
10 | #define _ASMS390_PARAM_H | 2 | #define _ASMS390_PARAM_H |
11 | 3 | ||
12 | #ifdef __KERNEL__ | 4 | #include <asm-generic/param.h> |
13 | # define HZ CONFIG_HZ /* Internal kernel timer frequency */ | ||
14 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | ||
15 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | ||
16 | #endif | ||
17 | |||
18 | #ifndef HZ | ||
19 | #define HZ 100 | ||
20 | #endif | ||
21 | |||
22 | #define EXEC_PAGESIZE 4096 | ||
23 | |||
24 | #ifndef NOGROUP | ||
25 | #define NOGROUP (-1) | ||
26 | #endif | ||
27 | |||
28 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
29 | 5 | ||
30 | #endif | 6 | #endif /* _ASMS390_PARAM_H */ |
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c index 8c15b2c85d5a..dfaf458d6702 100644 --- a/arch/score/mm/init.c +++ b/arch/score/mm/init.c | |||
@@ -106,7 +106,7 @@ void __init mem_init(void) | |||
106 | ram << (PAGE_SHIFT-10), codesize >> 10, | 106 | ram << (PAGE_SHIFT-10), codesize >> 10, |
107 | reservedpages << (PAGE_SHIFT-10), datasize >> 10, | 107 | reservedpages << (PAGE_SHIFT-10), datasize >> 10, |
108 | initsize >> 10, | 108 | initsize >> 10, |
109 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); | 109 | totalhigh_pages << (PAGE_SHIFT-10)); |
110 | } | 110 | } |
111 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | 111 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ |
112 | 112 | ||
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 812395e7c4d7..4eaf3401a15e 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -728,8 +728,9 @@ config GUSA_RB | |||
728 | disabling interrupts around the atomic sequence. | 728 | disabling interrupts around the atomic sequence. |
729 | 729 | ||
730 | config SPARSE_IRQ | 730 | config SPARSE_IRQ |
731 | bool "Support sparse irq numbering" | 731 | def_bool y |
732 | depends on EXPERIMENTAL | 732 | depends on SUPERH32 && !SH_DREAMCAST && !SH_HIGHLANDER && \ |
733 | !SH_RTS7751R2D && !HD64461 && !SH_7724_SOLUTION_ENGINE | ||
733 | help | 734 | help |
734 | This enables support for sparse irqs. This is useful in general | 735 | This enables support for sparse irqs. This is useful in general |
735 | as most CPUs have a fairly sparse array of IRQ vectors, which | 736 | as most CPUs have a fairly sparse array of IRQ vectors, which |
diff --git a/arch/sh/boards/mach-se/7343/irq.c b/arch/sh/boards/mach-se/7343/irq.c index 051c29d4eae0..c60fd13608d0 100644 --- a/arch/sh/boards/mach-se/7343/irq.c +++ b/arch/sh/boards/mach-se/7343/irq.c | |||
@@ -16,15 +16,17 @@ | |||
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <mach-se/mach/se7343.h> | 17 | #include <mach-se/mach/se7343.h> |
18 | 18 | ||
19 | unsigned int se7343_fpga_irq[SE7343_FPGA_IRQ_NR] = { 0, }; | ||
20 | |||
19 | static void disable_se7343_irq(unsigned int irq) | 21 | static void disable_se7343_irq(unsigned int irq) |
20 | { | 22 | { |
21 | unsigned int bit = irq - SE7343_FPGA_IRQ_BASE; | 23 | unsigned int bit = (unsigned int)get_irq_chip_data(irq); |
22 | ctrl_outw(ctrl_inw(PA_CPLD_IMSK) | 1 << bit, PA_CPLD_IMSK); | 24 | ctrl_outw(ctrl_inw(PA_CPLD_IMSK) | 1 << bit, PA_CPLD_IMSK); |
23 | } | 25 | } |
24 | 26 | ||
25 | static void enable_se7343_irq(unsigned int irq) | 27 | static void enable_se7343_irq(unsigned int irq) |
26 | { | 28 | { |
27 | unsigned int bit = irq - SE7343_FPGA_IRQ_BASE; | 29 | unsigned int bit = (unsigned int)get_irq_chip_data(irq); |
28 | ctrl_outw(ctrl_inw(PA_CPLD_IMSK) & ~(1 << bit), PA_CPLD_IMSK); | 30 | ctrl_outw(ctrl_inw(PA_CPLD_IMSK) & ~(1 << bit), PA_CPLD_IMSK); |
29 | } | 31 | } |
30 | 32 | ||
@@ -38,18 +40,15 @@ static struct irq_chip se7343_irq_chip __read_mostly = { | |||
38 | static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc) | 40 | static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc) |
39 | { | 41 | { |
40 | unsigned short intv = ctrl_inw(PA_CPLD_ST); | 42 | unsigned short intv = ctrl_inw(PA_CPLD_ST); |
41 | struct irq_desc *ext_desc; | 43 | unsigned int ext_irq = 0; |
42 | unsigned int ext_irq = SE7343_FPGA_IRQ_BASE; | ||
43 | 44 | ||
44 | intv &= (1 << SE7343_FPGA_IRQ_NR) - 1; | 45 | intv &= (1 << SE7343_FPGA_IRQ_NR) - 1; |
45 | 46 | ||
46 | while (intv) { | 47 | for (; intv; intv >>= 1, ext_irq++) { |
47 | if (intv & 1) { | 48 | if (!(intv & 1)) |
48 | ext_desc = irq_desc + ext_irq; | 49 | continue; |
49 | handle_level_irq(ext_irq, ext_desc); | 50 | |
50 | } | 51 | generic_handle_irq(se7343_fpga_irq[ext_irq]); |
51 | intv >>= 1; | ||
52 | ext_irq++; | ||
53 | } | 52 | } |
54 | } | 53 | } |
55 | 54 | ||
@@ -58,16 +57,24 @@ static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
58 | */ | 57 | */ |
59 | void __init init_7343se_IRQ(void) | 58 | void __init init_7343se_IRQ(void) |
60 | { | 59 | { |
61 | int i; | 60 | int i, irq; |
62 | 61 | ||
63 | ctrl_outw(0, PA_CPLD_IMSK); /* disable all irqs */ | 62 | ctrl_outw(0, PA_CPLD_IMSK); /* disable all irqs */ |
64 | ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */ | 63 | ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */ |
65 | 64 | ||
66 | for (i = 0; i < SE7343_FPGA_IRQ_NR; i++) | 65 | for (i = 0; i < SE7343_FPGA_IRQ_NR; i++) { |
67 | set_irq_chip_and_handler_name(SE7343_FPGA_IRQ_BASE + i, | 66 | irq = create_irq(); |
67 | if (irq < 0) | ||
68 | return; | ||
69 | se7343_fpga_irq[i] = irq; | ||
70 | |||
71 | set_irq_chip_and_handler_name(se7343_fpga_irq[i], | ||
68 | &se7343_irq_chip, | 72 | &se7343_irq_chip, |
69 | handle_level_irq, "level"); | 73 | handle_level_irq, "level"); |
70 | 74 | ||
75 | set_irq_chip_data(se7343_fpga_irq[i], (void *)i); | ||
76 | } | ||
77 | |||
71 | set_irq_chained_handler(IRQ0_IRQ, se7343_irq_demux); | 78 | set_irq_chained_handler(IRQ0_IRQ, se7343_irq_demux); |
72 | set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW); | 79 | set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW); |
73 | set_irq_chained_handler(IRQ1_IRQ, se7343_irq_demux); | 80 | set_irq_chained_handler(IRQ1_IRQ, se7343_irq_demux); |
diff --git a/arch/sh/boards/mach-se/7343/setup.c b/arch/sh/boards/mach-se/7343/setup.c index 4de56f35f419..292cc47d853f 100644 --- a/arch/sh/boards/mach-se/7343/setup.c +++ b/arch/sh/boards/mach-se/7343/setup.c | |||
@@ -82,7 +82,6 @@ static struct plat_serial8250_port serial_platform_data[] = { | |||
82 | .mapbase = 0x16000000, | 82 | .mapbase = 0x16000000, |
83 | .regshift = 1, | 83 | .regshift = 1, |
84 | .flags = ST16C2550C_FLAGS, | 84 | .flags = ST16C2550C_FLAGS, |
85 | .irq = UARTA_IRQ, | ||
86 | .uartclk = 7372800, | 85 | .uartclk = 7372800, |
87 | }, | 86 | }, |
88 | [1] = { | 87 | [1] = { |
@@ -90,7 +89,6 @@ static struct plat_serial8250_port serial_platform_data[] = { | |||
90 | .mapbase = 0x17000000, | 89 | .mapbase = 0x17000000, |
91 | .regshift = 1, | 90 | .regshift = 1, |
92 | .flags = ST16C2550C_FLAGS, | 91 | .flags = ST16C2550C_FLAGS, |
93 | .irq = UARTB_IRQ, | ||
94 | .uartclk = 7372800, | 92 | .uartclk = 7372800, |
95 | }, | 93 | }, |
96 | { }, | 94 | { }, |
@@ -121,7 +119,7 @@ static struct resource usb_resources[] = { | |||
121 | .flags = IORESOURCE_MEM, | 119 | .flags = IORESOURCE_MEM, |
122 | }, | 120 | }, |
123 | [2] = { | 121 | [2] = { |
124 | .start = USB_IRQ, | 122 | /* Filled in later */ |
125 | .flags = IORESOURCE_IRQ, | 123 | .flags = IORESOURCE_IRQ, |
126 | }, | 124 | }, |
127 | }; | 125 | }; |
@@ -138,8 +136,8 @@ static struct isp116x_platform_data usb_platform_data = { | |||
138 | static struct platform_device usb_device = { | 136 | static struct platform_device usb_device = { |
139 | .name = "isp116x-hcd", | 137 | .name = "isp116x-hcd", |
140 | .id = -1, | 138 | .id = -1, |
141 | .num_resources = ARRAY_SIZE(usb_resources), | 139 | .num_resources = ARRAY_SIZE(usb_resources), |
142 | .resource = usb_resources, | 140 | .resource = usb_resources, |
143 | .dev = { | 141 | .dev = { |
144 | .platform_data = &usb_platform_data, | 142 | .platform_data = &usb_platform_data, |
145 | }, | 143 | }, |
@@ -155,6 +153,13 @@ static struct platform_device *sh7343se_platform_devices[] __initdata = { | |||
155 | 153 | ||
156 | static int __init sh7343se_devices_setup(void) | 154 | static int __init sh7343se_devices_setup(void) |
157 | { | 155 | { |
156 | /* Wire-up dynamic vectors */ | ||
157 | serial_platform_data[0].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTA]; | ||
158 | serial_platform_data[1].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTB]; | ||
159 | |||
160 | usb_resources[2].start = usb_resources[2].end = | ||
161 | se7343_fpga_irq[SE7343_FPGA_IRQ_USB]; | ||
162 | |||
158 | return platform_add_devices(sh7343se_platform_devices, | 163 | return platform_add_devices(sh7343se_platform_devices, |
159 | ARRAY_SIZE(sh7343se_platform_devices)); | 164 | ARRAY_SIZE(sh7343se_platform_devices)); |
160 | } | 165 | } |
@@ -179,6 +184,5 @@ static void __init sh7343se_setup(char **cmdline_p) | |||
179 | static struct sh_machine_vector mv_7343se __initmv = { | 184 | static struct sh_machine_vector mv_7343se __initmv = { |
180 | .mv_name = "SolutionEngine 7343", | 185 | .mv_name = "SolutionEngine 7343", |
181 | .mv_setup = sh7343se_setup, | 186 | .mv_setup = sh7343se_setup, |
182 | .mv_nr_irqs = SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_NR, | ||
183 | .mv_init_irq = init_7343se_IRQ, | 187 | .mv_init_irq = init_7343se_IRQ, |
184 | }; | 188 | }; |
diff --git a/arch/sh/include/asm/alignment.h b/arch/sh/include/asm/alignment.h new file mode 100644 index 000000000000..b12efecf5294 --- /dev/null +++ b/arch/sh/include/asm/alignment.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __ASM_SH_ALIGNMENT_H | ||
2 | #define __ASM_SH_ALIGNMENT_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | extern void inc_unaligned_byte_access(void); | ||
7 | extern void inc_unaligned_word_access(void); | ||
8 | extern void inc_unaligned_dword_access(void); | ||
9 | extern void inc_unaligned_multi_access(void); | ||
10 | extern void inc_unaligned_user_access(void); | ||
11 | extern void inc_unaligned_kernel_access(void); | ||
12 | |||
13 | #define UM_WARN (1 << 0) | ||
14 | #define UM_FIXUP (1 << 1) | ||
15 | #define UM_SIGNAL (1 << 2) | ||
16 | |||
17 | extern unsigned int unaligned_user_action(void); | ||
18 | |||
19 | extern void unaligned_fixups_notify(struct task_struct *, insn_size_t, struct pt_regs *); | ||
20 | |||
21 | #endif /* __ASM_SH_ALIGNMENT_H */ | ||
diff --git a/arch/sh/include/asm/atomic-grb.h b/arch/sh/include/asm/atomic-grb.h index 4c5b7dbfcedb..a273c88578fc 100644 --- a/arch/sh/include/asm/atomic-grb.h +++ b/arch/sh/include/asm/atomic-grb.h | |||
@@ -120,50 +120,4 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | |||
120 | : "memory" , "r0", "r1"); | 120 | : "memory" , "r0", "r1"); |
121 | } | 121 | } |
122 | 122 | ||
123 | static inline int atomic_cmpxchg(atomic_t *v, int old, int new) | ||
124 | { | ||
125 | int ret; | ||
126 | |||
127 | __asm__ __volatile__ ( | ||
128 | " .align 2 \n\t" | ||
129 | " mova 1f, r0 \n\t" | ||
130 | " nop \n\t" | ||
131 | " mov r15, r1 \n\t" | ||
132 | " mov #-8, r15 \n\t" | ||
133 | " mov.l @%1, %0 \n\t" | ||
134 | " cmp/eq %2, %0 \n\t" | ||
135 | " bf 1f \n\t" | ||
136 | " mov.l %3, @%1 \n\t" | ||
137 | "1: mov r1, r15 \n\t" | ||
138 | : "=&r" (ret) | ||
139 | : "r" (v), "r" (old), "r" (new) | ||
140 | : "memory" , "r0", "r1" , "t"); | ||
141 | |||
142 | return ret; | ||
143 | } | ||
144 | |||
145 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | ||
146 | { | ||
147 | int ret; | ||
148 | unsigned long tmp; | ||
149 | |||
150 | __asm__ __volatile__ ( | ||
151 | " .align 2 \n\t" | ||
152 | " mova 1f, r0 \n\t" | ||
153 | " nop \n\t" | ||
154 | " mov r15, r1 \n\t" | ||
155 | " mov #-12, r15 \n\t" | ||
156 | " mov.l @%2, %1 \n\t" | ||
157 | " mov %1, %0 \n\t" | ||
158 | " cmp/eq %4, %0 \n\t" | ||
159 | " bt/s 1f \n\t" | ||
160 | " add %3, %1 \n\t" | ||
161 | " mov.l %1, @%2 \n\t" | ||
162 | "1: mov r1, r15 \n\t" | ||
163 | : "=&r" (ret), "=&r" (tmp) | ||
164 | : "r" (v), "r" (a), "r" (u) | ||
165 | : "memory" , "r0", "r1" , "t"); | ||
166 | |||
167 | return ret != u; | ||
168 | } | ||
169 | #endif /* __ASM_SH_ATOMIC_GRB_H */ | 123 | #endif /* __ASM_SH_ATOMIC_GRB_H */ |
diff --git a/arch/sh/include/asm/atomic-llsc.h b/arch/sh/include/asm/atomic-llsc.h index b040e1e08610..4b00b78e3f4f 100644 --- a/arch/sh/include/asm/atomic-llsc.h +++ b/arch/sh/include/asm/atomic-llsc.h | |||
@@ -104,31 +104,4 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v) | |||
104 | : "t"); | 104 | : "t"); |
105 | } | 105 | } |
106 | 106 | ||
107 | #define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) | ||
108 | |||
109 | /** | ||
110 | * atomic_add_unless - add unless the number is a given value | ||
111 | * @v: pointer of type atomic_t | ||
112 | * @a: the amount to add to v... | ||
113 | * @u: ...unless v is equal to u. | ||
114 | * | ||
115 | * Atomically adds @a to @v, so long as it was not @u. | ||
116 | * Returns non-zero if @v was not @u, and zero otherwise. | ||
117 | */ | ||
118 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | ||
119 | { | ||
120 | int c, old; | ||
121 | c = atomic_read(v); | ||
122 | for (;;) { | ||
123 | if (unlikely(c == (u))) | ||
124 | break; | ||
125 | old = atomic_cmpxchg((v), c, c + (a)); | ||
126 | if (likely(old == c)) | ||
127 | break; | ||
128 | c = old; | ||
129 | } | ||
130 | |||
131 | return c != (u); | ||
132 | } | ||
133 | |||
134 | #endif /* __ASM_SH_ATOMIC_LLSC_H */ | 107 | #endif /* __ASM_SH_ATOMIC_LLSC_H */ |
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h index b16388d71954..275a448ae8c2 100644 --- a/arch/sh/include/asm/atomic.h +++ b/arch/sh/include/asm/atomic.h | |||
@@ -25,58 +25,43 @@ | |||
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) | 27 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) |
28 | #define atomic_dec_return(v) atomic_sub_return(1, (v)) | ||
29 | #define atomic_inc_return(v) atomic_add_return(1, (v)) | ||
30 | #define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) | ||
31 | #define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) | ||
32 | #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) | ||
33 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | ||
28 | 34 | ||
29 | #define atomic_dec_return(v) atomic_sub_return(1,(v)) | 35 | #define atomic_inc(v) atomic_add(1, (v)) |
30 | #define atomic_inc_return(v) atomic_add_return(1,(v)) | 36 | #define atomic_dec(v) atomic_sub(1, (v)) |
31 | 37 | ||
32 | /* | 38 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) |
33 | * atomic_inc_and_test - increment and test | 39 | #define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) |
40 | |||
41 | /** | ||
42 | * atomic_add_unless - add unless the number is a given value | ||
34 | * @v: pointer of type atomic_t | 43 | * @v: pointer of type atomic_t |
44 | * @a: the amount to add to v... | ||
45 | * @u: ...unless v is equal to u. | ||
35 | * | 46 | * |
36 | * Atomically increments @v by 1 | 47 | * Atomically adds @a to @v, so long as it was not @u. |
37 | * and returns true if the result is zero, or false for all | 48 | * Returns non-zero if @v was not @u, and zero otherwise. |
38 | * other cases. | ||
39 | */ | 49 | */ |
40 | #define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) | ||
41 | |||
42 | #define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) | ||
43 | #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) | ||
44 | |||
45 | #define atomic_inc(v) atomic_add(1,(v)) | ||
46 | #define atomic_dec(v) atomic_sub(1,(v)) | ||
47 | |||
48 | #if !defined(CONFIG_GUSA_RB) && !defined(CONFIG_CPU_SH4A) | ||
49 | static inline int atomic_cmpxchg(atomic_t *v, int old, int new) | ||
50 | { | ||
51 | int ret; | ||
52 | unsigned long flags; | ||
53 | |||
54 | local_irq_save(flags); | ||
55 | ret = v->counter; | ||
56 | if (likely(ret == old)) | ||
57 | v->counter = new; | ||
58 | local_irq_restore(flags); | ||
59 | |||
60 | return ret; | ||
61 | } | ||
62 | |||
63 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | 50 | static inline int atomic_add_unless(atomic_t *v, int a, int u) |
64 | { | 51 | { |
65 | int ret; | 52 | int c, old; |
66 | unsigned long flags; | 53 | c = atomic_read(v); |
67 | 54 | for (;;) { | |
68 | local_irq_save(flags); | 55 | if (unlikely(c == (u))) |
69 | ret = v->counter; | 56 | break; |
70 | if (ret != u) | 57 | old = atomic_cmpxchg((v), c, c + (a)); |
71 | v->counter += a; | 58 | if (likely(old == c)) |
72 | local_irq_restore(flags); | 59 | break; |
73 | 60 | c = old; | |
74 | return ret != u; | 61 | } |
62 | |||
63 | return c != (u); | ||
75 | } | 64 | } |
76 | #endif /* !CONFIG_GUSA_RB && !CONFIG_CPU_SH4A */ | ||
77 | |||
78 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | ||
79 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | ||
80 | 65 | ||
81 | #define smp_mb__before_atomic_dec() smp_mb() | 66 | #define smp_mb__before_atomic_dec() smp_mb() |
82 | #define smp_mb__after_atomic_dec() smp_mb() | 67 | #define smp_mb__after_atomic_dec() smp_mb() |
diff --git a/arch/sh/include/asm/fpu.h b/arch/sh/include/asm/fpu.h index fb6bbb9b1cc8..06c4281aab65 100644 --- a/arch/sh/include/asm/fpu.h +++ b/arch/sh/include/asm/fpu.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define __ASM_SH_FPU_H | 2 | #define __ASM_SH_FPU_H |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
5 | #include <linux/preempt.h> | 5 | |
6 | #include <asm/ptrace.h> | 6 | struct task_struct; |
7 | 7 | ||
8 | #ifdef CONFIG_SH_FPU | 8 | #ifdef CONFIG_SH_FPU |
9 | static inline void release_fpu(struct pt_regs *regs) | 9 | static inline void release_fpu(struct pt_regs *regs) |
@@ -16,22 +16,23 @@ static inline void grab_fpu(struct pt_regs *regs) | |||
16 | regs->sr &= ~SR_FD; | 16 | regs->sr &= ~SR_FD; |
17 | } | 17 | } |
18 | 18 | ||
19 | struct task_struct; | ||
20 | |||
21 | extern void save_fpu(struct task_struct *__tsk); | 19 | extern void save_fpu(struct task_struct *__tsk); |
22 | void fpu_state_restore(struct pt_regs *regs); | 20 | extern void restore_fpu(struct task_struct *__tsk); |
21 | extern void fpu_state_restore(struct pt_regs *regs); | ||
22 | extern void __fpu_state_restore(void); | ||
23 | #else | 23 | #else |
24 | 24 | #define save_fpu(tsk) do { } while (0) | |
25 | #define save_fpu(tsk) do { } while (0) | 25 | #define restore_fpu(tsk) do { } while (0) |
26 | #define release_fpu(regs) do { } while (0) | 26 | #define release_fpu(regs) do { } while (0) |
27 | #define grab_fpu(regs) do { } while (0) | 27 | #define grab_fpu(regs) do { } while (0) |
28 | #define fpu_state_restore(regs) do { } while (0) | 28 | #define fpu_state_restore(regs) do { } while (0) |
29 | 29 | #define __fpu_state_restore(regs) do { } while (0) | |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | struct user_regset; | 32 | struct user_regset; |
33 | 33 | ||
34 | extern int do_fpu_inst(unsigned short, struct pt_regs *); | 34 | extern int do_fpu_inst(unsigned short, struct pt_regs *); |
35 | extern int init_fpu(struct task_struct *); | ||
35 | 36 | ||
36 | extern int fpregs_get(struct task_struct *target, | 37 | extern int fpregs_get(struct task_struct *target, |
37 | const struct user_regset *regset, | 38 | const struct user_regset *regset, |
@@ -65,18 +66,6 @@ static inline void clear_fpu(struct task_struct *tsk, struct pt_regs *regs) | |||
65 | preempt_enable(); | 66 | preempt_enable(); |
66 | } | 67 | } |
67 | 68 | ||
68 | static inline int init_fpu(struct task_struct *tsk) | ||
69 | { | ||
70 | if (tsk_used_math(tsk)) { | ||
71 | if ((boot_cpu_data.flags & CPU_HAS_FPU) && tsk == current) | ||
72 | unlazy_fpu(tsk, task_pt_regs(tsk)); | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | set_stopped_child_used_math(tsk); | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | #endif /* __ASSEMBLY__ */ | 69 | #endif /* __ASSEMBLY__ */ |
81 | 70 | ||
82 | #endif /* __ASM_SH_FPU_H */ | 71 | #endif /* __ASM_SH_FPU_H */ |
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h index 259112cecbdf..5fd83125fb89 100644 --- a/arch/sh/include/asm/processor_32.h +++ b/arch/sh/include/asm/processor_32.h | |||
@@ -91,11 +91,15 @@ struct sh_fpu_soft_struct { | |||
91 | unsigned long entry_pc; | 91 | unsigned long entry_pc; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | union sh_fpu_union { | 94 | union thread_xstate { |
95 | struct sh_fpu_hard_struct hard; | 95 | struct sh_fpu_hard_struct hardfpu; |
96 | struct sh_fpu_soft_struct soft; | 96 | struct sh_fpu_soft_struct softfpu; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | extern unsigned int xstate_size; | ||
100 | extern void free_thread_xstate(struct task_struct *); | ||
101 | extern struct kmem_cache *task_xstate_cachep; | ||
102 | |||
99 | struct thread_struct { | 103 | struct thread_struct { |
100 | /* Saved registers when thread is descheduled */ | 104 | /* Saved registers when thread is descheduled */ |
101 | unsigned long sp; | 105 | unsigned long sp; |
@@ -104,32 +108,23 @@ struct thread_struct { | |||
104 | /* Save middle states of ptrace breakpoints */ | 108 | /* Save middle states of ptrace breakpoints */ |
105 | struct perf_event *ptrace_bps[HBP_NUM]; | 109 | struct perf_event *ptrace_bps[HBP_NUM]; |
106 | 110 | ||
107 | /* floating point info */ | ||
108 | union sh_fpu_union fpu; | ||
109 | |||
110 | #ifdef CONFIG_SH_DSP | 111 | #ifdef CONFIG_SH_DSP |
111 | /* Dsp status information */ | 112 | /* Dsp status information */ |
112 | struct sh_dsp_struct dsp_status; | 113 | struct sh_dsp_struct dsp_status; |
113 | #endif | 114 | #endif |
115 | |||
116 | /* Extended processor state */ | ||
117 | union thread_xstate *xstate; | ||
114 | }; | 118 | }; |
115 | 119 | ||
116 | #define INIT_THREAD { \ | 120 | #define INIT_THREAD { \ |
117 | .sp = sizeof(init_stack) + (long) &init_stack, \ | 121 | .sp = sizeof(init_stack) + (long) &init_stack, \ |
118 | } | 122 | } |
119 | 123 | ||
120 | /* | ||
121 | * Do necessary setup to start up a newly executed thread. | ||
122 | */ | ||
123 | #define start_thread(_regs, new_pc, new_sp) \ | ||
124 | set_fs(USER_DS); \ | ||
125 | _regs->pr = 0; \ | ||
126 | _regs->sr = SR_FD; /* User mode. */ \ | ||
127 | _regs->pc = new_pc; \ | ||
128 | _regs->regs[15] = new_sp | ||
129 | |||
130 | /* Forward declaration, a strange C thing */ | 124 | /* Forward declaration, a strange C thing */ |
131 | struct task_struct; | 125 | struct task_struct; |
132 | struct mm_struct; | 126 | |
127 | extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned long new_sp); | ||
133 | 128 | ||
134 | /* Free all resources held by a thread. */ | 129 | /* Free all resources held by a thread. */ |
135 | extern void release_thread(struct task_struct *); | 130 | extern void release_thread(struct task_struct *); |
diff --git a/arch/sh/include/asm/setup.h b/arch/sh/include/asm/setup.h index ce3743599b27..4758325bb24a 100644 --- a/arch/sh/include/asm/setup.h +++ b/arch/sh/include/asm/setup.h | |||
@@ -18,7 +18,6 @@ | |||
18 | /* ... */ | 18 | /* ... */ |
19 | #define COMMAND_LINE ((char *) (PARAM+0x100)) | 19 | #define COMMAND_LINE ((char *) (PARAM+0x100)) |
20 | 20 | ||
21 | int setup_early_printk(char *); | ||
22 | void sh_mv_setup(void); | 21 | void sh_mv_setup(void); |
23 | 22 | ||
24 | #endif /* __KERNEL__ */ | 23 | #endif /* __KERNEL__ */ |
diff --git a/arch/sh/include/asm/sh_bios.h b/arch/sh/include/asm/sh_bios.h index d9c96d7cf6c7..95714c28422b 100644 --- a/arch/sh/include/asm/sh_bios.h +++ b/arch/sh/include/asm/sh_bios.h | |||
@@ -1,18 +1,27 @@ | |||
1 | #ifndef __ASM_SH_BIOS_H | 1 | #ifndef __ASM_SH_BIOS_H |
2 | #define __ASM_SH_BIOS_H | 2 | #define __ASM_SH_BIOS_H |
3 | 3 | ||
4 | #ifdef CONFIG_SH_STANDARD_BIOS | ||
5 | |||
4 | /* | 6 | /* |
5 | * Copyright (C) 2000 Greg Banks, Mitch Davis | 7 | * Copyright (C) 2000 Greg Banks, Mitch Davis |
6 | * C API to interface to the standard LinuxSH BIOS | 8 | * C API to interface to the standard LinuxSH BIOS |
7 | * usually from within the early stages of kernel boot. | 9 | * usually from within the early stages of kernel boot. |
8 | */ | 10 | */ |
9 | |||
10 | |||
11 | extern void sh_bios_console_write(const char *buf, unsigned int len); | 11 | extern void sh_bios_console_write(const char *buf, unsigned int len); |
12 | extern void sh_bios_char_out(char ch); | ||
13 | extern void sh_bios_gdb_detach(void); | 12 | extern void sh_bios_gdb_detach(void); |
14 | 13 | ||
15 | extern void sh_bios_get_node_addr(unsigned char *node_addr); | 14 | extern void sh_bios_get_node_addr(unsigned char *node_addr); |
16 | extern void sh_bios_shutdown(unsigned int how); | 15 | extern void sh_bios_shutdown(unsigned int how); |
17 | 16 | ||
17 | extern void sh_bios_vbr_init(void); | ||
18 | extern void sh_bios_vbr_reload(void); | ||
19 | |||
20 | #else | ||
21 | |||
22 | static inline void sh_bios_vbr_init(void) { } | ||
23 | static inline void sh_bios_vbr_reload(void) { } | ||
24 | |||
25 | #endif /* CONFIG_SH_STANDARD_BIOS */ | ||
26 | |||
18 | #endif /* __ASM_SH_BIOS_H */ | 27 | #endif /* __ASM_SH_BIOS_H */ |
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h index 91b173fd37a6..62e4fc1e4409 100644 --- a/arch/sh/include/asm/system.h +++ b/arch/sh/include/asm/system.h | |||
@@ -32,7 +32,7 @@ | |||
32 | #define mb() __asm__ __volatile__ ("synco": : :"memory") | 32 | #define mb() __asm__ __volatile__ ("synco": : :"memory") |
33 | #define rmb() mb() | 33 | #define rmb() mb() |
34 | #define wmb() __asm__ __volatile__ ("synco": : :"memory") | 34 | #define wmb() __asm__ __volatile__ ("synco": : :"memory") |
35 | #define ctrl_barrier() __icbi(0xa8000000) | 35 | #define ctrl_barrier() __icbi(PAGE_OFFSET) |
36 | #define read_barrier_depends() do { } while(0) | 36 | #define read_barrier_depends() do { } while(0) |
37 | #else | 37 | #else |
38 | #define mb() __asm__ __volatile__ ("": : :"memory") | 38 | #define mb() __asm__ __volatile__ ("": : :"memory") |
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h index 1f3d927e2265..55a36fef6875 100644 --- a/arch/sh/include/asm/thread_info.h +++ b/arch/sh/include/asm/thread_info.h | |||
@@ -93,14 +93,16 @@ static inline struct thread_info *current_thread_info(void) | |||
93 | 93 | ||
94 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) | 94 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) |
95 | 95 | ||
96 | #else /* THREAD_SHIFT < PAGE_SHIFT */ | 96 | #endif |
97 | |||
98 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
99 | 97 | ||
100 | extern struct thread_info *alloc_thread_info(struct task_struct *tsk); | 98 | extern struct thread_info *alloc_thread_info(struct task_struct *tsk); |
101 | extern void free_thread_info(struct thread_info *ti); | 99 | extern void free_thread_info(struct thread_info *ti); |
100 | extern void arch_task_cache_init(void); | ||
101 | #define arch_task_cache_init arch_task_cache_init | ||
102 | extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); | ||
103 | extern void init_thread_xstate(void); | ||
102 | 104 | ||
103 | #endif /* THREAD_SHIFT < PAGE_SHIFT */ | 105 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR |
104 | 106 | ||
105 | #endif /* __ASSEMBLY__ */ | 107 | #endif /* __ASSEMBLY__ */ |
106 | 108 | ||
diff --git a/arch/sh/include/mach-se/mach/se7343.h b/arch/sh/include/mach-se/mach/se7343.h index 749914b400fb..8d8170d6cc43 100644 --- a/arch/sh/include/mach-se/mach/se7343.h +++ b/arch/sh/include/mach-se/mach/se7343.h | |||
@@ -94,26 +94,26 @@ | |||
94 | 94 | ||
95 | #define PORT_DRVCR 0xA4050180 | 95 | #define PORT_DRVCR 0xA4050180 |
96 | 96 | ||
97 | #define PORT_PADR 0xA4050120 | 97 | #define PORT_PADR 0xA4050120 |
98 | #define PORT_PBDR 0xA4050122 | 98 | #define PORT_PBDR 0xA4050122 |
99 | #define PORT_PCDR 0xA4050124 | 99 | #define PORT_PCDR 0xA4050124 |
100 | #define PORT_PDDR 0xA4050126 | 100 | #define PORT_PDDR 0xA4050126 |
101 | #define PORT_PEDR 0xA4050128 | 101 | #define PORT_PEDR 0xA4050128 |
102 | #define PORT_PFDR 0xA405012A | 102 | #define PORT_PFDR 0xA405012A |
103 | #define PORT_PGDR 0xA405012C | 103 | #define PORT_PGDR 0xA405012C |
104 | #define PORT_PHDR 0xA405012E | 104 | #define PORT_PHDR 0xA405012E |
105 | #define PORT_PJDR 0xA4050130 | 105 | #define PORT_PJDR 0xA4050130 |
106 | #define PORT_PKDR 0xA4050132 | 106 | #define PORT_PKDR 0xA4050132 |
107 | #define PORT_PLDR 0xA4050134 | 107 | #define PORT_PLDR 0xA4050134 |
108 | #define PORT_PMDR 0xA4050136 | 108 | #define PORT_PMDR 0xA4050136 |
109 | #define PORT_PNDR 0xA4050138 | 109 | #define PORT_PNDR 0xA4050138 |
110 | #define PORT_PQDR 0xA405013A | 110 | #define PORT_PQDR 0xA405013A |
111 | #define PORT_PRDR 0xA405013C | 111 | #define PORT_PRDR 0xA405013C |
112 | #define PORT_PTDR 0xA4050160 | 112 | #define PORT_PTDR 0xA4050160 |
113 | #define PORT_PUDR 0xA4050162 | 113 | #define PORT_PUDR 0xA4050162 |
114 | #define PORT_PVDR 0xA4050164 | 114 | #define PORT_PVDR 0xA4050164 |
115 | #define PORT_PWDR 0xA4050166 | 115 | #define PORT_PWDR 0xA4050166 |
116 | #define PORT_PYDR 0xA4050168 | 116 | #define PORT_PYDR 0xA4050168 |
117 | 117 | ||
118 | #define FPGA_IN 0xb1400000 | 118 | #define FPGA_IN 0xb1400000 |
119 | #define FPGA_OUT 0xb1400002 | 119 | #define FPGA_OUT 0xb1400002 |
@@ -133,18 +133,10 @@ | |||
133 | #define SE7343_FPGA_IRQ_UARTB 11 | 133 | #define SE7343_FPGA_IRQ_UARTB 11 |
134 | 134 | ||
135 | #define SE7343_FPGA_IRQ_NR 12 | 135 | #define SE7343_FPGA_IRQ_NR 12 |
136 | #define SE7343_FPGA_IRQ_BASE 120 | ||
137 | |||
138 | #define MRSHPC_IRQ3 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC3) | ||
139 | #define MRSHPC_IRQ2 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC2) | ||
140 | #define MRSHPC_IRQ1 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC1) | ||
141 | #define MRSHPC_IRQ0 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC0) | ||
142 | #define SMC_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_SMC) | ||
143 | #define USB_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_USB) | ||
144 | #define UARTA_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_UARTA) | ||
145 | #define UARTB_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_UARTB) | ||
146 | 136 | ||
147 | /* arch/sh/boards/se/7343/irq.c */ | 137 | /* arch/sh/boards/se/7343/irq.c */ |
138 | extern unsigned int se7343_fpga_irq[]; | ||
139 | |||
148 | void init_7343se_IRQ(void); | 140 | void init_7343se_IRQ(void); |
149 | 141 | ||
150 | #endif /* __ASM_SH_HITACHI_SE7343_H */ | 142 | #endif /* __ASM_SH_HITACHI_SE7343_H */ |
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile index 160b8435e30f..56704a6d723a 100644 --- a/arch/sh/kernel/Makefile +++ b/arch/sh/kernel/Makefile | |||
@@ -13,8 +13,8 @@ CFLAGS_REMOVE_return_address.o = -pg | |||
13 | 13 | ||
14 | obj-y := debugtraps.o dma-nommu.o dumpstack.o \ | 14 | obj-y := debugtraps.o dma-nommu.o dumpstack.o \ |
15 | idle.o io.o io_generic.o irq.o \ | 15 | idle.o io.o io_generic.o irq.o \ |
16 | irq_$(BITS).o machvec.o nmi_debug.o process_$(BITS).o \ | 16 | irq_$(BITS).o machvec.o nmi_debug.o process.o \ |
17 | ptrace_$(BITS).o return_address.o \ | 17 | process_$(BITS).o ptrace_$(BITS).o return_address.o \ |
18 | setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o \ | 18 | setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o \ |
19 | syscalls_$(BITS).o time.o topology.o traps.o \ | 19 | syscalls_$(BITS).o time.o topology.o traps.o \ |
20 | traps_$(BITS).o unwinder.o | 20 | traps_$(BITS).o unwinder.o |
@@ -22,7 +22,7 @@ obj-y := debugtraps.o dma-nommu.o dumpstack.o \ | |||
22 | obj-y += cpu/ | 22 | obj-y += cpu/ |
23 | obj-$(CONFIG_VSYSCALL) += vsyscall/ | 23 | obj-$(CONFIG_VSYSCALL) += vsyscall/ |
24 | obj-$(CONFIG_SMP) += smp.o | 24 | obj-$(CONFIG_SMP) += smp.o |
25 | obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o early_printk.o | 25 | obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o |
26 | obj-$(CONFIG_KGDB) += kgdb.o | 26 | obj-$(CONFIG_KGDB) += kgdb.o |
27 | obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o | 27 | obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o |
28 | obj-$(CONFIG_MODULES) += sh_ksyms_$(BITS).o module.o | 28 | obj-$(CONFIG_MODULES) += sh_ksyms_$(BITS).o module.o |
diff --git a/arch/sh/kernel/cpu/Makefile b/arch/sh/kernel/cpu/Makefile index d97c803719ec..0e48bc61c272 100644 --- a/arch/sh/kernel/cpu/Makefile +++ b/arch/sh/kernel/cpu/Makefile | |||
@@ -17,5 +17,7 @@ obj-$(CONFIG_ARCH_SHMOBILE) += shmobile/ | |||
17 | 17 | ||
18 | obj-$(CONFIG_SH_ADC) += adc.o | 18 | obj-$(CONFIG_SH_ADC) += adc.o |
19 | obj-$(CONFIG_SH_CLK_CPG) += clock-cpg.o | 19 | obj-$(CONFIG_SH_CLK_CPG) += clock-cpg.o |
20 | obj-$(CONFIG_SH_FPU) += fpu.o | ||
21 | obj-$(CONFIG_SH_FPU_EMU) += fpu.o | ||
20 | 22 | ||
21 | obj-y += irq/ init.o clock.o hwblk.o | 23 | obj-y += irq/ init.o clock.o hwblk.o |
diff --git a/arch/sh/kernel/cpu/fpu.c b/arch/sh/kernel/cpu/fpu.c new file mode 100644 index 000000000000..c23e6727002a --- /dev/null +++ b/arch/sh/kernel/cpu/fpu.c | |||
@@ -0,0 +1,82 @@ | |||
1 | #include <linux/sched.h> | ||
2 | #include <asm/processor.h> | ||
3 | #include <asm/fpu.h> | ||
4 | |||
5 | int init_fpu(struct task_struct *tsk) | ||
6 | { | ||
7 | if (tsk_used_math(tsk)) { | ||
8 | if ((boot_cpu_data.flags & CPU_HAS_FPU) && tsk == current) | ||
9 | unlazy_fpu(tsk, task_pt_regs(tsk)); | ||
10 | return 0; | ||
11 | } | ||
12 | |||
13 | /* | ||
14 | * Memory allocation at the first usage of the FPU and other state. | ||
15 | */ | ||
16 | if (!tsk->thread.xstate) { | ||
17 | tsk->thread.xstate = kmem_cache_alloc(task_xstate_cachep, | ||
18 | GFP_KERNEL); | ||
19 | if (!tsk->thread.xstate) | ||
20 | return -ENOMEM; | ||
21 | } | ||
22 | |||
23 | if (boot_cpu_data.flags & CPU_HAS_FPU) { | ||
24 | struct sh_fpu_hard_struct *fp = &tsk->thread.xstate->hardfpu; | ||
25 | memset(fp, 0, xstate_size); | ||
26 | fp->fpscr = FPSCR_INIT; | ||
27 | } else { | ||
28 | struct sh_fpu_soft_struct *fp = &tsk->thread.xstate->softfpu; | ||
29 | memset(fp, 0, xstate_size); | ||
30 | fp->fpscr = FPSCR_INIT; | ||
31 | } | ||
32 | |||
33 | set_stopped_child_used_math(tsk); | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | #ifdef CONFIG_SH_FPU | ||
38 | void __fpu_state_restore(void) | ||
39 | { | ||
40 | struct task_struct *tsk = current; | ||
41 | |||
42 | restore_fpu(tsk); | ||
43 | |||
44 | task_thread_info(tsk)->status |= TS_USEDFPU; | ||
45 | tsk->fpu_counter++; | ||
46 | } | ||
47 | |||
48 | void fpu_state_restore(struct pt_regs *regs) | ||
49 | { | ||
50 | struct task_struct *tsk = current; | ||
51 | |||
52 | if (unlikely(!user_mode(regs))) { | ||
53 | printk(KERN_ERR "BUG: FPU is used in kernel mode.\n"); | ||
54 | BUG(); | ||
55 | return; | ||
56 | } | ||
57 | |||
58 | if (!tsk_used_math(tsk)) { | ||
59 | /* | ||
60 | * does a slab alloc which can sleep | ||
61 | */ | ||
62 | if (init_fpu(tsk)) { | ||
63 | /* | ||
64 | * ran out of memory! | ||
65 | */ | ||
66 | do_group_exit(SIGKILL); | ||
67 | return; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | grab_fpu(regs); | ||
72 | |||
73 | __fpu_state_restore(); | ||
74 | } | ||
75 | |||
76 | BUILD_TRAP_HANDLER(fpu_state_restore) | ||
77 | { | ||
78 | TRAP_HANDLER_DECL; | ||
79 | |||
80 | fpu_state_restore(regs); | ||
81 | } | ||
82 | #endif /* CONFIG_SH_FPU */ | ||
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c index 39b93828c872..a5bb0550bbf3 100644 --- a/arch/sh/kernel/cpu/init.c +++ b/arch/sh/kernel/cpu/init.c | |||
@@ -25,18 +25,30 @@ | |||
25 | #include <asm/io.h> | 25 | #include <asm/io.h> |
26 | #include <asm/smp.h> | 26 | #include <asm/smp.h> |
27 | 27 | ||
28 | #ifdef CONFIG_SH_FPU | ||
29 | #define cpu_has_fpu 1 | ||
30 | #else | ||
31 | #define cpu_has_fpu 0 | ||
32 | #endif | ||
33 | |||
34 | #ifdef CONFIG_SH_DSP | ||
35 | #define cpu_has_dsp 1 | ||
36 | #else | ||
37 | #define cpu_has_dsp 0 | ||
38 | #endif | ||
39 | |||
28 | /* | 40 | /* |
29 | * Generic wrapper for command line arguments to disable on-chip | 41 | * Generic wrapper for command line arguments to disable on-chip |
30 | * peripherals (nofpu, nodsp, and so forth). | 42 | * peripherals (nofpu, nodsp, and so forth). |
31 | */ | 43 | */ |
32 | #define onchip_setup(x) \ | 44 | #define onchip_setup(x) \ |
33 | static int x##_disabled __initdata = 0; \ | 45 | static int x##_disabled __initdata = !cpu_has_##x; \ |
34 | \ | 46 | \ |
35 | static int __init x##_setup(char *opts) \ | 47 | static int __init x##_setup(char *opts) \ |
36 | { \ | 48 | { \ |
37 | x##_disabled = 1; \ | 49 | x##_disabled = 1; \ |
38 | return 1; \ | 50 | return 1; \ |
39 | } \ | 51 | } \ |
40 | __setup("no" __stringify(x), x##_setup); | 52 | __setup("no" __stringify(x), x##_setup); |
41 | 53 | ||
42 | onchip_setup(fpu); | 54 | onchip_setup(fpu); |
@@ -204,6 +216,18 @@ static void detect_cache_shape(void) | |||
204 | l2_cache_shape = -1; /* No S-cache */ | 216 | l2_cache_shape = -1; /* No S-cache */ |
205 | } | 217 | } |
206 | 218 | ||
219 | static void __init fpu_init(void) | ||
220 | { | ||
221 | /* Disable the FPU */ | ||
222 | if (fpu_disabled && (current_cpu_data.flags & CPU_HAS_FPU)) { | ||
223 | printk("FPU Disabled\n"); | ||
224 | current_cpu_data.flags &= ~CPU_HAS_FPU; | ||
225 | } | ||
226 | |||
227 | disable_fpu(); | ||
228 | clear_used_math(); | ||
229 | } | ||
230 | |||
207 | #ifdef CONFIG_SH_DSP | 231 | #ifdef CONFIG_SH_DSP |
208 | static void __init release_dsp(void) | 232 | static void __init release_dsp(void) |
209 | { | 233 | { |
@@ -241,9 +265,17 @@ static void __init dsp_init(void) | |||
241 | if (sr & SR_DSP) | 265 | if (sr & SR_DSP) |
242 | current_cpu_data.flags |= CPU_HAS_DSP; | 266 | current_cpu_data.flags |= CPU_HAS_DSP; |
243 | 267 | ||
268 | /* Disable the DSP */ | ||
269 | if (dsp_disabled && (current_cpu_data.flags & CPU_HAS_DSP)) { | ||
270 | printk("DSP Disabled\n"); | ||
271 | current_cpu_data.flags &= ~CPU_HAS_DSP; | ||
272 | } | ||
273 | |||
244 | /* Now that we've determined the DSP status, clear the DSP bit. */ | 274 | /* Now that we've determined the DSP status, clear the DSP bit. */ |
245 | release_dsp(); | 275 | release_dsp(); |
246 | } | 276 | } |
277 | #else | ||
278 | static inline void __init dsp_init(void) { } | ||
247 | #endif /* CONFIG_SH_DSP */ | 279 | #endif /* CONFIG_SH_DSP */ |
248 | 280 | ||
249 | /** | 281 | /** |
@@ -298,18 +330,8 @@ asmlinkage void __init sh_cpu_init(void) | |||
298 | detect_cache_shape(); | 330 | detect_cache_shape(); |
299 | } | 331 | } |
300 | 332 | ||
301 | /* Disable the FPU */ | 333 | fpu_init(); |
302 | if (fpu_disabled) { | 334 | dsp_init(); |
303 | printk("FPU Disabled\n"); | ||
304 | current_cpu_data.flags &= ~CPU_HAS_FPU; | ||
305 | } | ||
306 | |||
307 | /* FPU initialization */ | ||
308 | disable_fpu(); | ||
309 | if ((current_cpu_data.flags & CPU_HAS_FPU)) { | ||
310 | current_thread_info()->status &= ~TS_USEDFPU; | ||
311 | clear_used_math(); | ||
312 | } | ||
313 | 335 | ||
314 | /* | 336 | /* |
315 | * Initialize the per-CPU ASID cache very early, since the | 337 | * Initialize the per-CPU ASID cache very early, since the |
@@ -317,18 +339,12 @@ asmlinkage void __init sh_cpu_init(void) | |||
317 | */ | 339 | */ |
318 | current_cpu_data.asid_cache = NO_CONTEXT; | 340 | current_cpu_data.asid_cache = NO_CONTEXT; |
319 | 341 | ||
320 | #ifdef CONFIG_SH_DSP | ||
321 | /* Probe for DSP */ | ||
322 | dsp_init(); | ||
323 | |||
324 | /* Disable the DSP */ | ||
325 | if (dsp_disabled) { | ||
326 | printk("DSP Disabled\n"); | ||
327 | current_cpu_data.flags &= ~CPU_HAS_DSP; | ||
328 | release_dsp(); | ||
329 | } | ||
330 | #endif | ||
331 | |||
332 | speculative_execution_init(); | 342 | speculative_execution_init(); |
333 | expmask_init(); | 343 | expmask_init(); |
344 | |||
345 | /* | ||
346 | * Boot processor to setup the FP and extended state context info. | ||
347 | */ | ||
348 | if (raw_smp_processor_id() == 0) | ||
349 | init_thread_xstate(); | ||
334 | } | 350 | } |
diff --git a/arch/sh/kernel/cpu/sh2a/fpu.c b/arch/sh/kernel/cpu/sh2a/fpu.c index d395ce5740e7..488d24e0cdf0 100644 --- a/arch/sh/kernel/cpu/sh2a/fpu.c +++ b/arch/sh/kernel/cpu/sh2a/fpu.c | |||
@@ -26,8 +26,7 @@ | |||
26 | /* | 26 | /* |
27 | * Save FPU registers onto task structure. | 27 | * Save FPU registers onto task structure. |
28 | */ | 28 | */ |
29 | void | 29 | void save_fpu(struct task_struct *tsk) |
30 | save_fpu(struct task_struct *tsk) | ||
31 | { | 30 | { |
32 | unsigned long dummy; | 31 | unsigned long dummy; |
33 | 32 | ||
@@ -52,7 +51,7 @@ save_fpu(struct task_struct *tsk) | |||
52 | "fmov.s fr0, @-%0\n\t" | 51 | "fmov.s fr0, @-%0\n\t" |
53 | "lds %3, fpscr\n\t" | 52 | "lds %3, fpscr\n\t" |
54 | : "=r" (dummy) | 53 | : "=r" (dummy) |
55 | : "0" ((char *)(&tsk->thread.fpu.hard.status)), | 54 | : "0" ((char *)(&tsk->thread.xstate->hardfpu.status)), |
56 | "r" (FPSCR_RCHG), | 55 | "r" (FPSCR_RCHG), |
57 | "r" (FPSCR_INIT) | 56 | "r" (FPSCR_INIT) |
58 | : "memory"); | 57 | : "memory"); |
@@ -60,8 +59,7 @@ save_fpu(struct task_struct *tsk) | |||
60 | disable_fpu(); | 59 | disable_fpu(); |
61 | } | 60 | } |
62 | 61 | ||
63 | static void | 62 | void restore_fpu(struct task_struct *tsk) |
64 | restore_fpu(struct task_struct *tsk) | ||
65 | { | 63 | { |
66 | unsigned long dummy; | 64 | unsigned long dummy; |
67 | 65 | ||
@@ -85,45 +83,12 @@ restore_fpu(struct task_struct *tsk) | |||
85 | "lds.l @%0+, fpscr\n\t" | 83 | "lds.l @%0+, fpscr\n\t" |
86 | "lds.l @%0+, fpul\n\t" | 84 | "lds.l @%0+, fpul\n\t" |
87 | : "=r" (dummy) | 85 | : "=r" (dummy) |
88 | : "0" (&tsk->thread.fpu), "r" (FPSCR_RCHG) | 86 | : "0" (tsk->thread.xstate), "r" (FPSCR_RCHG) |
89 | : "memory"); | 87 | : "memory"); |
90 | disable_fpu(); | 88 | disable_fpu(); |
91 | } | 89 | } |
92 | 90 | ||
93 | /* | 91 | /* |
94 | * Load the FPU with signalling NANS. This bit pattern we're using | ||
95 | * has the property that no matter wether considered as single or as | ||
96 | * double precission represents signaling NANS. | ||
97 | */ | ||
98 | |||
99 | static void | ||
100 | fpu_init(void) | ||
101 | { | ||
102 | enable_fpu(); | ||
103 | asm volatile("lds %0, fpul\n\t" | ||
104 | "fsts fpul, fr0\n\t" | ||
105 | "fsts fpul, fr1\n\t" | ||
106 | "fsts fpul, fr2\n\t" | ||
107 | "fsts fpul, fr3\n\t" | ||
108 | "fsts fpul, fr4\n\t" | ||
109 | "fsts fpul, fr5\n\t" | ||
110 | "fsts fpul, fr6\n\t" | ||
111 | "fsts fpul, fr7\n\t" | ||
112 | "fsts fpul, fr8\n\t" | ||
113 | "fsts fpul, fr9\n\t" | ||
114 | "fsts fpul, fr10\n\t" | ||
115 | "fsts fpul, fr11\n\t" | ||
116 | "fsts fpul, fr12\n\t" | ||
117 | "fsts fpul, fr13\n\t" | ||
118 | "fsts fpul, fr14\n\t" | ||
119 | "fsts fpul, fr15\n\t" | ||
120 | "lds %2, fpscr\n\t" | ||
121 | : /* no output */ | ||
122 | : "r" (0), "r" (FPSCR_RCHG), "r" (FPSCR_INIT)); | ||
123 | disable_fpu(); | ||
124 | } | ||
125 | |||
126 | /* | ||
127 | * Emulate arithmetic ops on denormalized number for some FPU insns. | 92 | * Emulate arithmetic ops on denormalized number for some FPU insns. |
128 | */ | 93 | */ |
129 | 94 | ||
@@ -490,9 +455,9 @@ ieee_fpe_handler (struct pt_regs *regs) | |||
490 | if ((finsn & 0xf1ff) == 0xf0ad) { /* fcnvsd */ | 455 | if ((finsn & 0xf1ff) == 0xf0ad) { /* fcnvsd */ |
491 | struct task_struct *tsk = current; | 456 | struct task_struct *tsk = current; |
492 | 457 | ||
493 | if ((tsk->thread.fpu.hard.fpscr & FPSCR_FPU_ERROR)) { | 458 | if ((tsk->thread.xstate->hardfpu.fpscr & FPSCR_FPU_ERROR)) { |
494 | /* FPU error */ | 459 | /* FPU error */ |
495 | denormal_to_double (&tsk->thread.fpu.hard, | 460 | denormal_to_double (&tsk->thread.xstate->hardfpu, |
496 | (finsn >> 8) & 0xf); | 461 | (finsn >> 8) & 0xf); |
497 | } else | 462 | } else |
498 | return 0; | 463 | return 0; |
@@ -507,9 +472,9 @@ ieee_fpe_handler (struct pt_regs *regs) | |||
507 | 472 | ||
508 | n = (finsn >> 8) & 0xf; | 473 | n = (finsn >> 8) & 0xf; |
509 | m = (finsn >> 4) & 0xf; | 474 | m = (finsn >> 4) & 0xf; |
510 | hx = tsk->thread.fpu.hard.fp_regs[n]; | 475 | hx = tsk->thread.xstate->hardfpu.fp_regs[n]; |
511 | hy = tsk->thread.fpu.hard.fp_regs[m]; | 476 | hy = tsk->thread.xstate->hardfpu.fp_regs[m]; |
512 | fpscr = tsk->thread.fpu.hard.fpscr; | 477 | fpscr = tsk->thread.xstate->hardfpu.fpscr; |
513 | prec = fpscr & (1 << 19); | 478 | prec = fpscr & (1 << 19); |
514 | 479 | ||
515 | if ((fpscr & FPSCR_FPU_ERROR) | 480 | if ((fpscr & FPSCR_FPU_ERROR) |
@@ -519,15 +484,15 @@ ieee_fpe_handler (struct pt_regs *regs) | |||
519 | 484 | ||
520 | /* FPU error because of denormal */ | 485 | /* FPU error because of denormal */ |
521 | llx = ((long long) hx << 32) | 486 | llx = ((long long) hx << 32) |
522 | | tsk->thread.fpu.hard.fp_regs[n+1]; | 487 | | tsk->thread.xstate->hardfpu.fp_regs[n+1]; |
523 | lly = ((long long) hy << 32) | 488 | lly = ((long long) hy << 32) |
524 | | tsk->thread.fpu.hard.fp_regs[m+1]; | 489 | | tsk->thread.xstate->hardfpu.fp_regs[m+1]; |
525 | if ((hx & 0x7fffffff) >= 0x00100000) | 490 | if ((hx & 0x7fffffff) >= 0x00100000) |
526 | llx = denormal_muld(lly, llx); | 491 | llx = denormal_muld(lly, llx); |
527 | else | 492 | else |
528 | llx = denormal_muld(llx, lly); | 493 | llx = denormal_muld(llx, lly); |
529 | tsk->thread.fpu.hard.fp_regs[n] = llx >> 32; | 494 | tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32; |
530 | tsk->thread.fpu.hard.fp_regs[n+1] = llx & 0xffffffff; | 495 | tsk->thread.xstate->hardfpu.fp_regs[n+1] = llx & 0xffffffff; |
531 | } else if ((fpscr & FPSCR_FPU_ERROR) | 496 | } else if ((fpscr & FPSCR_FPU_ERROR) |
532 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 | 497 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 |
533 | || (hy & 0x7fffffff) < 0x00800000))) { | 498 | || (hy & 0x7fffffff) < 0x00800000))) { |
@@ -536,7 +501,7 @@ ieee_fpe_handler (struct pt_regs *regs) | |||
536 | hx = denormal_mulf(hy, hx); | 501 | hx = denormal_mulf(hy, hx); |
537 | else | 502 | else |
538 | hx = denormal_mulf(hx, hy); | 503 | hx = denormal_mulf(hx, hy); |
539 | tsk->thread.fpu.hard.fp_regs[n] = hx; | 504 | tsk->thread.xstate->hardfpu.fp_regs[n] = hx; |
540 | } else | 505 | } else |
541 | return 0; | 506 | return 0; |
542 | 507 | ||
@@ -550,9 +515,9 @@ ieee_fpe_handler (struct pt_regs *regs) | |||
550 | 515 | ||
551 | n = (finsn >> 8) & 0xf; | 516 | n = (finsn >> 8) & 0xf; |
552 | m = (finsn >> 4) & 0xf; | 517 | m = (finsn >> 4) & 0xf; |
553 | hx = tsk->thread.fpu.hard.fp_regs[n]; | 518 | hx = tsk->thread.xstate->hardfpu.fp_regs[n]; |
554 | hy = tsk->thread.fpu.hard.fp_regs[m]; | 519 | hy = tsk->thread.xstate->hardfpu.fp_regs[m]; |
555 | fpscr = tsk->thread.fpu.hard.fpscr; | 520 | fpscr = tsk->thread.xstate->hardfpu.fpscr; |
556 | prec = fpscr & (1 << 19); | 521 | prec = fpscr & (1 << 19); |
557 | 522 | ||
558 | if ((fpscr & FPSCR_FPU_ERROR) | 523 | if ((fpscr & FPSCR_FPU_ERROR) |
@@ -562,15 +527,15 @@ ieee_fpe_handler (struct pt_regs *regs) | |||
562 | 527 | ||
563 | /* FPU error because of denormal */ | 528 | /* FPU error because of denormal */ |
564 | llx = ((long long) hx << 32) | 529 | llx = ((long long) hx << 32) |
565 | | tsk->thread.fpu.hard.fp_regs[n+1]; | 530 | | tsk->thread.xstate->hardfpu.fp_regs[n+1]; |
566 | lly = ((long long) hy << 32) | 531 | lly = ((long long) hy << 32) |
567 | | tsk->thread.fpu.hard.fp_regs[m+1]; | 532 | | tsk->thread.xstate->hardfpu.fp_regs[m+1]; |
568 | if ((finsn & 0xf00f) == 0xf000) | 533 | if ((finsn & 0xf00f) == 0xf000) |
569 | llx = denormal_addd(llx, lly); | 534 | llx = denormal_addd(llx, lly); |
570 | else | 535 | else |
571 | llx = denormal_addd(llx, lly ^ (1LL << 63)); | 536 | llx = denormal_addd(llx, lly ^ (1LL << 63)); |
572 | tsk->thread.fpu.hard.fp_regs[n] = llx >> 32; | 537 | tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32; |
573 | tsk->thread.fpu.hard.fp_regs[n+1] = llx & 0xffffffff; | 538 | tsk->thread.xstate->hardfpu.fp_regs[n+1] = llx & 0xffffffff; |
574 | } else if ((fpscr & FPSCR_FPU_ERROR) | 539 | } else if ((fpscr & FPSCR_FPU_ERROR) |
575 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 | 540 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 |
576 | || (hy & 0x7fffffff) < 0x00800000))) { | 541 | || (hy & 0x7fffffff) < 0x00800000))) { |
@@ -579,7 +544,7 @@ ieee_fpe_handler (struct pt_regs *regs) | |||
579 | hx = denormal_addf(hx, hy); | 544 | hx = denormal_addf(hx, hy); |
580 | else | 545 | else |
581 | hx = denormal_addf(hx, hy ^ 0x80000000); | 546 | hx = denormal_addf(hx, hy ^ 0x80000000); |
582 | tsk->thread.fpu.hard.fp_regs[n] = hx; | 547 | tsk->thread.xstate->hardfpu.fp_regs[n] = hx; |
583 | } else | 548 | } else |
584 | return 0; | 549 | return 0; |
585 | 550 | ||
@@ -597,7 +562,7 @@ BUILD_TRAP_HANDLER(fpu_error) | |||
597 | 562 | ||
598 | __unlazy_fpu(tsk, regs); | 563 | __unlazy_fpu(tsk, regs); |
599 | if (ieee_fpe_handler(regs)) { | 564 | if (ieee_fpe_handler(regs)) { |
600 | tsk->thread.fpu.hard.fpscr &= | 565 | tsk->thread.xstate->hardfpu.fpscr &= |
601 | ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK); | 566 | ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK); |
602 | grab_fpu(regs); | 567 | grab_fpu(regs); |
603 | restore_fpu(tsk); | 568 | restore_fpu(tsk); |
@@ -607,33 +572,3 @@ BUILD_TRAP_HANDLER(fpu_error) | |||
607 | 572 | ||
608 | force_sig(SIGFPE, tsk); | 573 | force_sig(SIGFPE, tsk); |
609 | } | 574 | } |
610 | |||
611 | void fpu_state_restore(struct pt_regs *regs) | ||
612 | { | ||
613 | struct task_struct *tsk = current; | ||
614 | |||
615 | grab_fpu(regs); | ||
616 | if (unlikely(!user_mode(regs))) { | ||
617 | printk(KERN_ERR "BUG: FPU is used in kernel mode.\n"); | ||
618 | BUG(); | ||
619 | return; | ||
620 | } | ||
621 | |||
622 | if (likely(used_math())) { | ||
623 | /* Using the FPU again. */ | ||
624 | restore_fpu(tsk); | ||
625 | } else { | ||
626 | /* First time FPU user. */ | ||
627 | fpu_init(); | ||
628 | set_used_math(); | ||
629 | } | ||
630 | task_thread_info(tsk)->status |= TS_USEDFPU; | ||
631 | tsk->fpu_counter++; | ||
632 | } | ||
633 | |||
634 | BUILD_TRAP_HANDLER(fpu_state_restore) | ||
635 | { | ||
636 | TRAP_HANDLER_DECL; | ||
637 | |||
638 | fpu_state_restore(regs); | ||
639 | } | ||
diff --git a/arch/sh/kernel/cpu/sh4/fpu.c b/arch/sh/kernel/cpu/sh4/fpu.c index e97857aec8a0..447482d7f65e 100644 --- a/arch/sh/kernel/cpu/sh4/fpu.c +++ b/arch/sh/kernel/cpu/sh4/fpu.c | |||
@@ -85,14 +85,14 @@ void save_fpu(struct task_struct *tsk) | |||
85 | "fmov.s fr1, @-%0\n\t" | 85 | "fmov.s fr1, @-%0\n\t" |
86 | "fmov.s fr0, @-%0\n\t" | 86 | "fmov.s fr0, @-%0\n\t" |
87 | "lds %3, fpscr\n\t":"=r" (dummy) | 87 | "lds %3, fpscr\n\t":"=r" (dummy) |
88 | :"0"((char *)(&tsk->thread.fpu.hard.status)), | 88 | :"0"((char *)(&tsk->thread.xstate->hardfpu.status)), |
89 | "r"(FPSCR_RCHG), "r"(FPSCR_INIT) | 89 | "r"(FPSCR_RCHG), "r"(FPSCR_INIT) |
90 | :"memory"); | 90 | :"memory"); |
91 | 91 | ||
92 | disable_fpu(); | 92 | disable_fpu(); |
93 | } | 93 | } |
94 | 94 | ||
95 | static void restore_fpu(struct task_struct *tsk) | 95 | void restore_fpu(struct task_struct *tsk) |
96 | { | 96 | { |
97 | unsigned long dummy; | 97 | unsigned long dummy; |
98 | 98 | ||
@@ -135,62 +135,11 @@ static void restore_fpu(struct task_struct *tsk) | |||
135 | "lds.l @%0+, fpscr\n\t" | 135 | "lds.l @%0+, fpscr\n\t" |
136 | "lds.l @%0+, fpul\n\t" | 136 | "lds.l @%0+, fpul\n\t" |
137 | :"=r" (dummy) | 137 | :"=r" (dummy) |
138 | :"0"(&tsk->thread.fpu), "r"(FPSCR_RCHG) | 138 | :"0" (tsk->thread.xstate), "r" (FPSCR_RCHG) |
139 | :"memory"); | 139 | :"memory"); |
140 | disable_fpu(); | 140 | disable_fpu(); |
141 | } | 141 | } |
142 | 142 | ||
143 | /* | ||
144 | * Load the FPU with signalling NANS. This bit pattern we're using | ||
145 | * has the property that no matter wether considered as single or as | ||
146 | * double precision represents signaling NANS. | ||
147 | */ | ||
148 | |||
149 | static void fpu_init(void) | ||
150 | { | ||
151 | enable_fpu(); | ||
152 | asm volatile ( "lds %0, fpul\n\t" | ||
153 | "lds %1, fpscr\n\t" | ||
154 | "fsts fpul, fr0\n\t" | ||
155 | "fsts fpul, fr1\n\t" | ||
156 | "fsts fpul, fr2\n\t" | ||
157 | "fsts fpul, fr3\n\t" | ||
158 | "fsts fpul, fr4\n\t" | ||
159 | "fsts fpul, fr5\n\t" | ||
160 | "fsts fpul, fr6\n\t" | ||
161 | "fsts fpul, fr7\n\t" | ||
162 | "fsts fpul, fr8\n\t" | ||
163 | "fsts fpul, fr9\n\t" | ||
164 | "fsts fpul, fr10\n\t" | ||
165 | "fsts fpul, fr11\n\t" | ||
166 | "fsts fpul, fr12\n\t" | ||
167 | "fsts fpul, fr13\n\t" | ||
168 | "fsts fpul, fr14\n\t" | ||
169 | "fsts fpul, fr15\n\t" | ||
170 | "frchg\n\t" | ||
171 | "fsts fpul, fr0\n\t" | ||
172 | "fsts fpul, fr1\n\t" | ||
173 | "fsts fpul, fr2\n\t" | ||
174 | "fsts fpul, fr3\n\t" | ||
175 | "fsts fpul, fr4\n\t" | ||
176 | "fsts fpul, fr5\n\t" | ||
177 | "fsts fpul, fr6\n\t" | ||
178 | "fsts fpul, fr7\n\t" | ||
179 | "fsts fpul, fr8\n\t" | ||
180 | "fsts fpul, fr9\n\t" | ||
181 | "fsts fpul, fr10\n\t" | ||
182 | "fsts fpul, fr11\n\t" | ||
183 | "fsts fpul, fr12\n\t" | ||
184 | "fsts fpul, fr13\n\t" | ||
185 | "fsts fpul, fr14\n\t" | ||
186 | "fsts fpul, fr15\n\t" | ||
187 | "frchg\n\t" | ||
188 | "lds %2, fpscr\n\t" | ||
189 | : /* no output */ | ||
190 | :"r" (0), "r"(FPSCR_RCHG), "r"(FPSCR_INIT)); | ||
191 | disable_fpu(); | ||
192 | } | ||
193 | |||
194 | /** | 143 | /** |
195 | * denormal_to_double - Given denormalized float number, | 144 | * denormal_to_double - Given denormalized float number, |
196 | * store double float | 145 | * store double float |
@@ -282,9 +231,9 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
282 | /* fcnvsd */ | 231 | /* fcnvsd */ |
283 | struct task_struct *tsk = current; | 232 | struct task_struct *tsk = current; |
284 | 233 | ||
285 | if ((tsk->thread.fpu.hard.fpscr & FPSCR_CAUSE_ERROR)) | 234 | if ((tsk->thread.xstate->hardfpu.fpscr & FPSCR_CAUSE_ERROR)) |
286 | /* FPU error */ | 235 | /* FPU error */ |
287 | denormal_to_double(&tsk->thread.fpu.hard, | 236 | denormal_to_double(&tsk->thread.xstate->hardfpu, |
288 | (finsn >> 8) & 0xf); | 237 | (finsn >> 8) & 0xf); |
289 | else | 238 | else |
290 | return 0; | 239 | return 0; |
@@ -300,9 +249,9 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
300 | 249 | ||
301 | n = (finsn >> 8) & 0xf; | 250 | n = (finsn >> 8) & 0xf; |
302 | m = (finsn >> 4) & 0xf; | 251 | m = (finsn >> 4) & 0xf; |
303 | hx = tsk->thread.fpu.hard.fp_regs[n]; | 252 | hx = tsk->thread.xstate->hardfpu.fp_regs[n]; |
304 | hy = tsk->thread.fpu.hard.fp_regs[m]; | 253 | hy = tsk->thread.xstate->hardfpu.fp_regs[m]; |
305 | fpscr = tsk->thread.fpu.hard.fpscr; | 254 | fpscr = tsk->thread.xstate->hardfpu.fpscr; |
306 | prec = fpscr & FPSCR_DBL_PRECISION; | 255 | prec = fpscr & FPSCR_DBL_PRECISION; |
307 | 256 | ||
308 | if ((fpscr & FPSCR_CAUSE_ERROR) | 257 | if ((fpscr & FPSCR_CAUSE_ERROR) |
@@ -312,18 +261,18 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
312 | 261 | ||
313 | /* FPU error because of denormal (doubles) */ | 262 | /* FPU error because of denormal (doubles) */ |
314 | llx = ((long long)hx << 32) | 263 | llx = ((long long)hx << 32) |
315 | | tsk->thread.fpu.hard.fp_regs[n + 1]; | 264 | | tsk->thread.xstate->hardfpu.fp_regs[n + 1]; |
316 | lly = ((long long)hy << 32) | 265 | lly = ((long long)hy << 32) |
317 | | tsk->thread.fpu.hard.fp_regs[m + 1]; | 266 | | tsk->thread.xstate->hardfpu.fp_regs[m + 1]; |
318 | llx = float64_mul(llx, lly); | 267 | llx = float64_mul(llx, lly); |
319 | tsk->thread.fpu.hard.fp_regs[n] = llx >> 32; | 268 | tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32; |
320 | tsk->thread.fpu.hard.fp_regs[n + 1] = llx & 0xffffffff; | 269 | tsk->thread.xstate->hardfpu.fp_regs[n + 1] = llx & 0xffffffff; |
321 | } else if ((fpscr & FPSCR_CAUSE_ERROR) | 270 | } else if ((fpscr & FPSCR_CAUSE_ERROR) |
322 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 | 271 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 |
323 | || (hy & 0x7fffffff) < 0x00800000))) { | 272 | || (hy & 0x7fffffff) < 0x00800000))) { |
324 | /* FPU error because of denormal (floats) */ | 273 | /* FPU error because of denormal (floats) */ |
325 | hx = float32_mul(hx, hy); | 274 | hx = float32_mul(hx, hy); |
326 | tsk->thread.fpu.hard.fp_regs[n] = hx; | 275 | tsk->thread.xstate->hardfpu.fp_regs[n] = hx; |
327 | } else | 276 | } else |
328 | return 0; | 277 | return 0; |
329 | 278 | ||
@@ -338,9 +287,9 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
338 | 287 | ||
339 | n = (finsn >> 8) & 0xf; | 288 | n = (finsn >> 8) & 0xf; |
340 | m = (finsn >> 4) & 0xf; | 289 | m = (finsn >> 4) & 0xf; |
341 | hx = tsk->thread.fpu.hard.fp_regs[n]; | 290 | hx = tsk->thread.xstate->hardfpu.fp_regs[n]; |
342 | hy = tsk->thread.fpu.hard.fp_regs[m]; | 291 | hy = tsk->thread.xstate->hardfpu.fp_regs[m]; |
343 | fpscr = tsk->thread.fpu.hard.fpscr; | 292 | fpscr = tsk->thread.xstate->hardfpu.fpscr; |
344 | prec = fpscr & FPSCR_DBL_PRECISION; | 293 | prec = fpscr & FPSCR_DBL_PRECISION; |
345 | 294 | ||
346 | if ((fpscr & FPSCR_CAUSE_ERROR) | 295 | if ((fpscr & FPSCR_CAUSE_ERROR) |
@@ -350,15 +299,15 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
350 | 299 | ||
351 | /* FPU error because of denormal (doubles) */ | 300 | /* FPU error because of denormal (doubles) */ |
352 | llx = ((long long)hx << 32) | 301 | llx = ((long long)hx << 32) |
353 | | tsk->thread.fpu.hard.fp_regs[n + 1]; | 302 | | tsk->thread.xstate->hardfpu.fp_regs[n + 1]; |
354 | lly = ((long long)hy << 32) | 303 | lly = ((long long)hy << 32) |
355 | | tsk->thread.fpu.hard.fp_regs[m + 1]; | 304 | | tsk->thread.xstate->hardfpu.fp_regs[m + 1]; |
356 | if ((finsn & 0xf00f) == 0xf000) | 305 | if ((finsn & 0xf00f) == 0xf000) |
357 | llx = float64_add(llx, lly); | 306 | llx = float64_add(llx, lly); |
358 | else | 307 | else |
359 | llx = float64_sub(llx, lly); | 308 | llx = float64_sub(llx, lly); |
360 | tsk->thread.fpu.hard.fp_regs[n] = llx >> 32; | 309 | tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32; |
361 | tsk->thread.fpu.hard.fp_regs[n + 1] = llx & 0xffffffff; | 310 | tsk->thread.xstate->hardfpu.fp_regs[n + 1] = llx & 0xffffffff; |
362 | } else if ((fpscr & FPSCR_CAUSE_ERROR) | 311 | } else if ((fpscr & FPSCR_CAUSE_ERROR) |
363 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 | 312 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 |
364 | || (hy & 0x7fffffff) < 0x00800000))) { | 313 | || (hy & 0x7fffffff) < 0x00800000))) { |
@@ -367,7 +316,7 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
367 | hx = float32_add(hx, hy); | 316 | hx = float32_add(hx, hy); |
368 | else | 317 | else |
369 | hx = float32_sub(hx, hy); | 318 | hx = float32_sub(hx, hy); |
370 | tsk->thread.fpu.hard.fp_regs[n] = hx; | 319 | tsk->thread.xstate->hardfpu.fp_regs[n] = hx; |
371 | } else | 320 | } else |
372 | return 0; | 321 | return 0; |
373 | 322 | ||
@@ -382,9 +331,9 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
382 | 331 | ||
383 | n = (finsn >> 8) & 0xf; | 332 | n = (finsn >> 8) & 0xf; |
384 | m = (finsn >> 4) & 0xf; | 333 | m = (finsn >> 4) & 0xf; |
385 | hx = tsk->thread.fpu.hard.fp_regs[n]; | 334 | hx = tsk->thread.xstate->hardfpu.fp_regs[n]; |
386 | hy = tsk->thread.fpu.hard.fp_regs[m]; | 335 | hy = tsk->thread.xstate->hardfpu.fp_regs[m]; |
387 | fpscr = tsk->thread.fpu.hard.fpscr; | 336 | fpscr = tsk->thread.xstate->hardfpu.fpscr; |
388 | prec = fpscr & FPSCR_DBL_PRECISION; | 337 | prec = fpscr & FPSCR_DBL_PRECISION; |
389 | 338 | ||
390 | if ((fpscr & FPSCR_CAUSE_ERROR) | 339 | if ((fpscr & FPSCR_CAUSE_ERROR) |
@@ -394,20 +343,20 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
394 | 343 | ||
395 | /* FPU error because of denormal (doubles) */ | 344 | /* FPU error because of denormal (doubles) */ |
396 | llx = ((long long)hx << 32) | 345 | llx = ((long long)hx << 32) |
397 | | tsk->thread.fpu.hard.fp_regs[n + 1]; | 346 | | tsk->thread.xstate->hardfpu.fp_regs[n + 1]; |
398 | lly = ((long long)hy << 32) | 347 | lly = ((long long)hy << 32) |
399 | | tsk->thread.fpu.hard.fp_regs[m + 1]; | 348 | | tsk->thread.xstate->hardfpu.fp_regs[m + 1]; |
400 | 349 | ||
401 | llx = float64_div(llx, lly); | 350 | llx = float64_div(llx, lly); |
402 | 351 | ||
403 | tsk->thread.fpu.hard.fp_regs[n] = llx >> 32; | 352 | tsk->thread.xstate->hardfpu.fp_regs[n] = llx >> 32; |
404 | tsk->thread.fpu.hard.fp_regs[n + 1] = llx & 0xffffffff; | 353 | tsk->thread.xstate->hardfpu.fp_regs[n + 1] = llx & 0xffffffff; |
405 | } else if ((fpscr & FPSCR_CAUSE_ERROR) | 354 | } else if ((fpscr & FPSCR_CAUSE_ERROR) |
406 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 | 355 | && (!prec && ((hx & 0x7fffffff) < 0x00800000 |
407 | || (hy & 0x7fffffff) < 0x00800000))) { | 356 | || (hy & 0x7fffffff) < 0x00800000))) { |
408 | /* FPU error because of denormal (floats) */ | 357 | /* FPU error because of denormal (floats) */ |
409 | hx = float32_div(hx, hy); | 358 | hx = float32_div(hx, hy); |
410 | tsk->thread.fpu.hard.fp_regs[n] = hx; | 359 | tsk->thread.xstate->hardfpu.fp_regs[n] = hx; |
411 | } else | 360 | } else |
412 | return 0; | 361 | return 0; |
413 | 362 | ||
@@ -420,17 +369,17 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
420 | unsigned int hx; | 369 | unsigned int hx; |
421 | 370 | ||
422 | m = (finsn >> 8) & 0x7; | 371 | m = (finsn >> 8) & 0x7; |
423 | hx = tsk->thread.fpu.hard.fp_regs[m]; | 372 | hx = tsk->thread.xstate->hardfpu.fp_regs[m]; |
424 | 373 | ||
425 | if ((tsk->thread.fpu.hard.fpscr & FPSCR_CAUSE_ERROR) | 374 | if ((tsk->thread.xstate->hardfpu.fpscr & FPSCR_CAUSE_ERROR) |
426 | && ((hx & 0x7fffffff) < 0x00100000)) { | 375 | && ((hx & 0x7fffffff) < 0x00100000)) { |
427 | /* subnormal double to float conversion */ | 376 | /* subnormal double to float conversion */ |
428 | long long llx; | 377 | long long llx; |
429 | 378 | ||
430 | llx = ((long long)tsk->thread.fpu.hard.fp_regs[m] << 32) | 379 | llx = ((long long)tsk->thread.xstate->hardfpu.fp_regs[m] << 32) |
431 | | tsk->thread.fpu.hard.fp_regs[m + 1]; | 380 | | tsk->thread.xstate->hardfpu.fp_regs[m + 1]; |
432 | 381 | ||
433 | tsk->thread.fpu.hard.fpul = float64_to_float32(llx); | 382 | tsk->thread.xstate->hardfpu.fpul = float64_to_float32(llx); |
434 | } else | 383 | } else |
435 | return 0; | 384 | return 0; |
436 | 385 | ||
@@ -449,7 +398,7 @@ void float_raise(unsigned int flags) | |||
449 | int float_rounding_mode(void) | 398 | int float_rounding_mode(void) |
450 | { | 399 | { |
451 | struct task_struct *tsk = current; | 400 | struct task_struct *tsk = current; |
452 | int roundingMode = FPSCR_ROUNDING_MODE(tsk->thread.fpu.hard.fpscr); | 401 | int roundingMode = FPSCR_ROUNDING_MODE(tsk->thread.xstate->hardfpu.fpscr); |
453 | return roundingMode; | 402 | return roundingMode; |
454 | } | 403 | } |
455 | 404 | ||
@@ -461,16 +410,16 @@ BUILD_TRAP_HANDLER(fpu_error) | |||
461 | __unlazy_fpu(tsk, regs); | 410 | __unlazy_fpu(tsk, regs); |
462 | fpu_exception_flags = 0; | 411 | fpu_exception_flags = 0; |
463 | if (ieee_fpe_handler(regs)) { | 412 | if (ieee_fpe_handler(regs)) { |
464 | tsk->thread.fpu.hard.fpscr &= | 413 | tsk->thread.xstate->hardfpu.fpscr &= |
465 | ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK); | 414 | ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK); |
466 | tsk->thread.fpu.hard.fpscr |= fpu_exception_flags; | 415 | tsk->thread.xstate->hardfpu.fpscr |= fpu_exception_flags; |
467 | /* Set the FPSCR flag as well as cause bits - simply | 416 | /* Set the FPSCR flag as well as cause bits - simply |
468 | * replicate the cause */ | 417 | * replicate the cause */ |
469 | tsk->thread.fpu.hard.fpscr |= (fpu_exception_flags >> 10); | 418 | tsk->thread.xstate->hardfpu.fpscr |= (fpu_exception_flags >> 10); |
470 | grab_fpu(regs); | 419 | grab_fpu(regs); |
471 | restore_fpu(tsk); | 420 | restore_fpu(tsk); |
472 | task_thread_info(tsk)->status |= TS_USEDFPU; | 421 | task_thread_info(tsk)->status |= TS_USEDFPU; |
473 | if ((((tsk->thread.fpu.hard.fpscr & FPSCR_ENABLE_MASK) >> 7) & | 422 | if ((((tsk->thread.xstate->hardfpu.fpscr & FPSCR_ENABLE_MASK) >> 7) & |
474 | (fpu_exception_flags >> 2)) == 0) { | 423 | (fpu_exception_flags >> 2)) == 0) { |
475 | return; | 424 | return; |
476 | } | 425 | } |
@@ -478,33 +427,3 @@ BUILD_TRAP_HANDLER(fpu_error) | |||
478 | 427 | ||
479 | force_sig(SIGFPE, tsk); | 428 | force_sig(SIGFPE, tsk); |
480 | } | 429 | } |
481 | |||
482 | void fpu_state_restore(struct pt_regs *regs) | ||
483 | { | ||
484 | struct task_struct *tsk = current; | ||
485 | |||
486 | grab_fpu(regs); | ||
487 | if (unlikely(!user_mode(regs))) { | ||
488 | printk(KERN_ERR "BUG: FPU is used in kernel mode.\n"); | ||
489 | BUG(); | ||
490 | return; | ||
491 | } | ||
492 | |||
493 | if (likely(used_math())) { | ||
494 | /* Using the FPU again. */ | ||
495 | restore_fpu(tsk); | ||
496 | } else { | ||
497 | /* First time FPU user. */ | ||
498 | fpu_init(); | ||
499 | set_used_math(); | ||
500 | } | ||
501 | task_thread_info(tsk)->status |= TS_USEDFPU; | ||
502 | tsk->fpu_counter++; | ||
503 | } | ||
504 | |||
505 | BUILD_TRAP_HANDLER(fpu_state_restore) | ||
506 | { | ||
507 | TRAP_HANDLER_DECL; | ||
508 | |||
509 | fpu_state_restore(regs); | ||
510 | } | ||
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c deleted file mode 100644 index f8bb50c6e050..000000000000 --- a/arch/sh/kernel/early_printk.c +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | /* | ||
2 | * arch/sh/kernel/early_printk.c | ||
3 | * | ||
4 | * Copyright (C) 1999, 2000 Niibe Yutaka | ||
5 | * Copyright (C) 2002 M. R. Brown | ||
6 | * Copyright (C) 2004 - 2007 Paul Mundt | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | #include <linux/console.h> | ||
13 | #include <linux/tty.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/delay.h> | ||
17 | |||
18 | #include <asm/sh_bios.h> | ||
19 | |||
20 | /* | ||
21 | * Print a string through the BIOS | ||
22 | */ | ||
23 | static void sh_console_write(struct console *co, const char *s, | ||
24 | unsigned count) | ||
25 | { | ||
26 | sh_bios_console_write(s, count); | ||
27 | } | ||
28 | |||
29 | /* | ||
30 | * Setup initial baud/bits/parity. We do two things here: | ||
31 | * - construct a cflag setting for the first rs_open() | ||
32 | * - initialize the serial port | ||
33 | * Return non-zero if we didn't find a serial port. | ||
34 | */ | ||
35 | static int __init sh_console_setup(struct console *co, char *options) | ||
36 | { | ||
37 | int cflag = CREAD | HUPCL | CLOCAL; | ||
38 | |||
39 | /* | ||
40 | * Now construct a cflag setting. | ||
41 | * TODO: this is a totally bogus cflag, as we have | ||
42 | * no idea what serial settings the BIOS is using, or | ||
43 | * even if its using the serial port at all. | ||
44 | */ | ||
45 | cflag |= B115200 | CS8 | /*no parity*/0; | ||
46 | |||
47 | co->cflag = cflag; | ||
48 | |||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static struct console bios_console = { | ||
53 | .name = "bios", | ||
54 | .write = sh_console_write, | ||
55 | .setup = sh_console_setup, | ||
56 | .flags = CON_PRINTBUFFER, | ||
57 | .index = -1, | ||
58 | }; | ||
59 | |||
60 | static struct console *early_console; | ||
61 | |||
62 | static int __init setup_early_printk(char *buf) | ||
63 | { | ||
64 | int keep_early = 0; | ||
65 | |||
66 | if (!buf) | ||
67 | return 0; | ||
68 | |||
69 | if (strstr(buf, "keep")) | ||
70 | keep_early = 1; | ||
71 | |||
72 | if (!strncmp(buf, "bios", 4)) | ||
73 | early_console = &bios_console; | ||
74 | |||
75 | if (likely(early_console)) { | ||
76 | if (keep_early) | ||
77 | early_console->flags &= ~CON_BOOT; | ||
78 | else | ||
79 | early_console->flags |= CON_BOOT; | ||
80 | register_console(early_console); | ||
81 | } | ||
82 | |||
83 | return 0; | ||
84 | } | ||
85 | early_param("earlyprintk", setup_early_printk); | ||
diff --git a/arch/sh/kernel/head_64.S b/arch/sh/kernel/head_64.S index 3ea765844c74..defd851abefa 100644 --- a/arch/sh/kernel/head_64.S +++ b/arch/sh/kernel/head_64.S | |||
@@ -220,7 +220,6 @@ clear_DTLB: | |||
220 | add.l r22, r63, r22 /* Sign extend */ | 220 | add.l r22, r63, r22 /* Sign extend */ |
221 | putcfg r21, 0, r22 /* Set MMUDR[0].PTEH */ | 221 | putcfg r21, 0, r22 /* Set MMUDR[0].PTEH */ |
222 | 222 | ||
223 | #ifdef CONFIG_EARLY_PRINTK | ||
224 | /* | 223 | /* |
225 | * Setup a DTLB translation for SCIF phys. | 224 | * Setup a DTLB translation for SCIF phys. |
226 | */ | 225 | */ |
@@ -231,7 +230,6 @@ clear_DTLB: | |||
231 | movi 0xfa03, r22 /* 0xfa030000, fixed SCIF virt */ | 230 | movi 0xfa03, r22 /* 0xfa030000, fixed SCIF virt */ |
232 | shori 0x0003, r22 | 231 | shori 0x0003, r22 |
233 | putcfg r21, 0, r22 /* PTEH last */ | 232 | putcfg r21, 0, r22 /* PTEH last */ |
234 | #endif | ||
235 | 233 | ||
236 | /* | 234 | /* |
237 | * Set cache behaviours. | 235 | * Set cache behaviours. |
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c index 76f280223ebd..f52d8ed69e12 100644 --- a/arch/sh/kernel/machine_kexec.c +++ b/arch/sh/kernel/machine_kexec.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/mmu_context.h> | 21 | #include <asm/mmu_context.h> |
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <asm/cacheflush.h> | 23 | #include <asm/cacheflush.h> |
24 | #include <asm/sh_bios.h> | ||
24 | 25 | ||
25 | typedef void (*relocate_new_kernel_t)(unsigned long indirection_page, | 26 | typedef void (*relocate_new_kernel_t)(unsigned long indirection_page, |
26 | unsigned long reboot_code_buffer, | 27 | unsigned long reboot_code_buffer, |
@@ -28,7 +29,6 @@ typedef void (*relocate_new_kernel_t)(unsigned long indirection_page, | |||
28 | 29 | ||
29 | extern const unsigned char relocate_new_kernel[]; | 30 | extern const unsigned char relocate_new_kernel[]; |
30 | extern const unsigned int relocate_new_kernel_size; | 31 | extern const unsigned int relocate_new_kernel_size; |
31 | extern void *gdb_vbr_vector; | ||
32 | extern void *vbr_base; | 32 | extern void *vbr_base; |
33 | 33 | ||
34 | void machine_shutdown(void) | 34 | void machine_shutdown(void) |
@@ -117,11 +117,7 @@ void machine_kexec(struct kimage *image) | |||
117 | kexec_info(image); | 117 | kexec_info(image); |
118 | flush_cache_all(); | 118 | flush_cache_all(); |
119 | 119 | ||
120 | #if defined(CONFIG_SH_STANDARD_BIOS) | 120 | sh_bios_vbr_reload(); |
121 | asm volatile("ldc %0, vbr" : | ||
122 | : "r" (((unsigned long) gdb_vbr_vector) - 0x100) | ||
123 | : "memory"); | ||
124 | #endif | ||
125 | 121 | ||
126 | /* now call it */ | 122 | /* now call it */ |
127 | rnk = (relocate_new_kernel_t) reboot_code_buffer; | 123 | rnk = (relocate_new_kernel_t) reboot_code_buffer; |
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c new file mode 100644 index 000000000000..81add9b9ea6e --- /dev/null +++ b/arch/sh/kernel/process.c | |||
@@ -0,0 +1,100 @@ | |||
1 | #include <linux/mm.h> | ||
2 | #include <linux/kernel.h> | ||
3 | #include <linux/sched.h> | ||
4 | |||
5 | struct kmem_cache *task_xstate_cachep = NULL; | ||
6 | unsigned int xstate_size; | ||
7 | |||
8 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | ||
9 | { | ||
10 | *dst = *src; | ||
11 | |||
12 | if (src->thread.xstate) { | ||
13 | dst->thread.xstate = kmem_cache_alloc(task_xstate_cachep, | ||
14 | GFP_KERNEL); | ||
15 | if (!dst->thread.xstate) | ||
16 | return -ENOMEM; | ||
17 | memcpy(dst->thread.xstate, src->thread.xstate, xstate_size); | ||
18 | } | ||
19 | |||
20 | return 0; | ||
21 | } | ||
22 | |||
23 | void free_thread_xstate(struct task_struct *tsk) | ||
24 | { | ||
25 | if (tsk->thread.xstate) { | ||
26 | kmem_cache_free(task_xstate_cachep, tsk->thread.xstate); | ||
27 | tsk->thread.xstate = NULL; | ||
28 | } | ||
29 | } | ||
30 | |||
31 | #if THREAD_SHIFT < PAGE_SHIFT | ||
32 | static struct kmem_cache *thread_info_cache; | ||
33 | |||
34 | struct thread_info *alloc_thread_info(struct task_struct *tsk) | ||
35 | { | ||
36 | struct thread_info *ti; | ||
37 | |||
38 | ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL); | ||
39 | if (unlikely(ti == NULL)) | ||
40 | return NULL; | ||
41 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
42 | memset(ti, 0, THREAD_SIZE); | ||
43 | #endif | ||
44 | return ti; | ||
45 | } | ||
46 | |||
47 | void free_thread_info(struct thread_info *ti) | ||
48 | { | ||
49 | free_thread_xstate(ti->task); | ||
50 | kmem_cache_free(thread_info_cache, ti); | ||
51 | } | ||
52 | |||
53 | void thread_info_cache_init(void) | ||
54 | { | ||
55 | thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE, | ||
56 | THREAD_SIZE, SLAB_PANIC, NULL); | ||
57 | } | ||
58 | #else | ||
59 | struct thread_info *alloc_thread_info(struct task_struct *tsk) | ||
60 | { | ||
61 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
62 | gfp_t mask = GFP_KERNEL | __GFP_ZERO; | ||
63 | #else | ||
64 | gfp_t mask = GFP_KERNEL; | ||
65 | #endif | ||
66 | return (struct thread_info *)__get_free_pages(mask, THREAD_SIZE_ORDER); | ||
67 | } | ||
68 | |||
69 | void free_thread_info(struct thread_info *ti) | ||
70 | { | ||
71 | free_thread_xstate(ti->task); | ||
72 | free_pages((unsigned long)ti, THREAD_SIZE_ORDER); | ||
73 | } | ||
74 | #endif /* THREAD_SHIFT < PAGE_SHIFT */ | ||
75 | |||
76 | void arch_task_cache_init(void) | ||
77 | { | ||
78 | if (!xstate_size) | ||
79 | return; | ||
80 | |||
81 | task_xstate_cachep = kmem_cache_create("task_xstate", xstate_size, | ||
82 | __alignof__(union thread_xstate), | ||
83 | SLAB_PANIC | SLAB_NOTRACK, NULL); | ||
84 | } | ||
85 | |||
86 | #ifdef CONFIG_SH_FPU_EMU | ||
87 | # define HAVE_SOFTFP 1 | ||
88 | #else | ||
89 | # define HAVE_SOFTFP 0 | ||
90 | #endif | ||
91 | |||
92 | void init_thread_xstate(void) | ||
93 | { | ||
94 | if (boot_cpu_data.flags & CPU_HAS_FPU) | ||
95 | xstate_size = sizeof(struct sh_fpu_hard_struct); | ||
96 | else if (HAVE_SOFTFP) | ||
97 | xstate_size = sizeof(struct sh_fpu_soft_struct); | ||
98 | else | ||
99 | xstate_size = 0; | ||
100 | } | ||
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index b94f9d96ac95..856010f9ebc9 100644 --- a/arch/sh/kernel/process_32.c +++ b/arch/sh/kernel/process_32.c | |||
@@ -145,6 +145,20 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) | |||
145 | } | 145 | } |
146 | EXPORT_SYMBOL(kernel_thread); | 146 | EXPORT_SYMBOL(kernel_thread); |
147 | 147 | ||
148 | void start_thread(struct pt_regs *regs, unsigned long new_pc, | ||
149 | unsigned long new_sp) | ||
150 | { | ||
151 | set_fs(USER_DS); | ||
152 | |||
153 | regs->pr = 0; | ||
154 | regs->sr = SR_FD; | ||
155 | regs->pc = new_pc; | ||
156 | regs->regs[15] = new_sp; | ||
157 | |||
158 | free_thread_xstate(current); | ||
159 | } | ||
160 | EXPORT_SYMBOL(start_thread); | ||
161 | |||
148 | /* | 162 | /* |
149 | * Free current thread data structures etc.. | 163 | * Free current thread data structures etc.. |
150 | */ | 164 | */ |
@@ -258,7 +272,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next) | |||
258 | 272 | ||
259 | /* we're going to use this soon, after a few expensive things */ | 273 | /* we're going to use this soon, after a few expensive things */ |
260 | if (next->fpu_counter > 5) | 274 | if (next->fpu_counter > 5) |
261 | prefetch(&next_t->fpu.hard); | 275 | prefetch(next_t->xstate); |
262 | 276 | ||
263 | #ifdef CONFIG_MMU | 277 | #ifdef CONFIG_MMU |
264 | /* | 278 | /* |
@@ -276,7 +290,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next) | |||
276 | * chances of needing FPU soon are obviously high now | 290 | * chances of needing FPU soon are obviously high now |
277 | */ | 291 | */ |
278 | if (next->fpu_counter > 5) | 292 | if (next->fpu_counter > 5) |
279 | fpu_state_restore(task_pt_regs(next)); | 293 | __fpu_state_restore(); |
280 | 294 | ||
281 | return prev; | 295 | return prev; |
282 | } | 296 | } |
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c index 8e094c4c7bb4..c625cdab76dd 100644 --- a/arch/sh/kernel/ptrace_32.c +++ b/arch/sh/kernel/ptrace_32.c | |||
@@ -195,10 +195,10 @@ int fpregs_get(struct task_struct *target, | |||
195 | 195 | ||
196 | if ((boot_cpu_data.flags & CPU_HAS_FPU)) | 196 | if ((boot_cpu_data.flags & CPU_HAS_FPU)) |
197 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, | 197 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
198 | &target->thread.fpu.hard, 0, -1); | 198 | &target->thread.xstate->hardfpu, 0, -1); |
199 | 199 | ||
200 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, | 200 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
201 | &target->thread.fpu.soft, 0, -1); | 201 | &target->thread.xstate->softfpu, 0, -1); |
202 | } | 202 | } |
203 | 203 | ||
204 | static int fpregs_set(struct task_struct *target, | 204 | static int fpregs_set(struct task_struct *target, |
@@ -216,10 +216,10 @@ static int fpregs_set(struct task_struct *target, | |||
216 | 216 | ||
217 | if ((boot_cpu_data.flags & CPU_HAS_FPU)) | 217 | if ((boot_cpu_data.flags & CPU_HAS_FPU)) |
218 | return user_regset_copyin(&pos, &count, &kbuf, &ubuf, | 218 | return user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
219 | &target->thread.fpu.hard, 0, -1); | 219 | &target->thread.xstate->hardfpu, 0, -1); |
220 | 220 | ||
221 | return user_regset_copyin(&pos, &count, &kbuf, &ubuf, | 221 | return user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
222 | &target->thread.fpu.soft, 0, -1); | 222 | &target->thread.xstate->softfpu, 0, -1); |
223 | } | 223 | } |
224 | 224 | ||
225 | static int fpregs_active(struct task_struct *target, | 225 | static int fpregs_active(struct task_struct *target, |
@@ -365,7 +365,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
365 | else | 365 | else |
366 | tmp = 0; | 366 | tmp = 0; |
367 | } else | 367 | } else |
368 | tmp = ((long *)&child->thread.fpu) | 368 | tmp = ((long *)child->thread.xstate) |
369 | [(addr - (long)&dummy->fpu) >> 2]; | 369 | [(addr - (long)&dummy->fpu) >> 2]; |
370 | } else if (addr == (long) &dummy->u_fpvalid) | 370 | } else if (addr == (long) &dummy->u_fpvalid) |
371 | tmp = !!tsk_used_math(child); | 371 | tmp = !!tsk_used_math(child); |
@@ -394,7 +394,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
394 | else if (addr >= (long) &dummy->fpu && | 394 | else if (addr >= (long) &dummy->fpu && |
395 | addr < (long) &dummy->u_fpvalid) { | 395 | addr < (long) &dummy->u_fpvalid) { |
396 | set_stopped_child_used_math(child); | 396 | set_stopped_child_used_math(child); |
397 | ((long *)&child->thread.fpu) | 397 | ((long *)child->thread.xstate) |
398 | [(addr - (long)&dummy->fpu) >> 2] = data; | 398 | [(addr - (long)&dummy->fpu) >> 2] = data; |
399 | ret = 0; | 399 | ret = 0; |
400 | } else if (addr == (long) &dummy->u_fpvalid) { | 400 | } else if (addr == (long) &dummy->u_fpvalid) { |
diff --git a/arch/sh/kernel/sh_bios.c b/arch/sh/kernel/sh_bios.c index c852f7805728..47475cca068a 100644 --- a/arch/sh/kernel/sh_bios.c +++ b/arch/sh/kernel/sh_bios.c | |||
@@ -1,19 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/sh/kernel/sh_bios.c | ||
3 | * C interface for trapping into the standard LinuxSH BIOS. | 2 | * C interface for trapping into the standard LinuxSH BIOS. |
4 | * | 3 | * |
5 | * Copyright (C) 2000 Greg Banks, Mitch Davis | 4 | * Copyright (C) 2000 Greg Banks, Mitch Davis |
5 | * Copyright (C) 1999, 2000 Niibe Yutaka | ||
6 | * Copyright (C) 2002 M. R. Brown | ||
7 | * Copyright (C) 2004 - 2010 Paul Mundt | ||
6 | * | 8 | * |
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file "COPYING" in the main directory of this archive | ||
11 | * for more details. | ||
7 | */ | 12 | */ |
8 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/console.h> | ||
15 | #include <linux/tty.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/delay.h> | ||
9 | #include <asm/sh_bios.h> | 19 | #include <asm/sh_bios.h> |
10 | 20 | ||
11 | #define BIOS_CALL_CONSOLE_WRITE 0 | 21 | #define BIOS_CALL_CONSOLE_WRITE 0 |
12 | #define BIOS_CALL_ETH_NODE_ADDR 10 | 22 | #define BIOS_CALL_ETH_NODE_ADDR 10 |
13 | #define BIOS_CALL_SHUTDOWN 11 | 23 | #define BIOS_CALL_SHUTDOWN 11 |
14 | #define BIOS_CALL_CHAR_OUT 0x1f /* TODO: hack */ | ||
15 | #define BIOS_CALL_GDB_DETACH 0xff | 24 | #define BIOS_CALL_GDB_DETACH 0xff |
16 | 25 | ||
26 | void *gdb_vbr_vector = NULL; | ||
27 | |||
17 | static inline long sh_bios_call(long func, long arg0, long arg1, long arg2, | 28 | static inline long sh_bios_call(long func, long arg0, long arg1, long arg2, |
18 | long arg3) | 29 | long arg3) |
19 | { | 30 | { |
@@ -23,6 +34,9 @@ static inline long sh_bios_call(long func, long arg0, long arg1, long arg2, | |||
23 | register long r6 __asm__("r6") = arg2; | 34 | register long r6 __asm__("r6") = arg2; |
24 | register long r7 __asm__("r7") = arg3; | 35 | register long r7 __asm__("r7") = arg3; |
25 | 36 | ||
37 | if (!gdb_vbr_vector) | ||
38 | return -ENOSYS; | ||
39 | |||
26 | __asm__ __volatile__("trapa #0x3f":"=z"(r0) | 40 | __asm__ __volatile__("trapa #0x3f":"=z"(r0) |
27 | :"0"(r0), "r"(r4), "r"(r5), "r"(r6), "r"(r7) | 41 | :"0"(r0), "r"(r4), "r"(r5), "r"(r6), "r"(r7) |
28 | :"memory"); | 42 | :"memory"); |
@@ -34,11 +48,6 @@ void sh_bios_console_write(const char *buf, unsigned int len) | |||
34 | sh_bios_call(BIOS_CALL_CONSOLE_WRITE, (long)buf, (long)len, 0, 0); | 48 | sh_bios_call(BIOS_CALL_CONSOLE_WRITE, (long)buf, (long)len, 0, 0); |
35 | } | 49 | } |
36 | 50 | ||
37 | void sh_bios_char_out(char ch) | ||
38 | { | ||
39 | sh_bios_call(BIOS_CALL_CHAR_OUT, ch, 0, 0, 0); | ||
40 | } | ||
41 | |||
42 | void sh_bios_gdb_detach(void) | 51 | void sh_bios_gdb_detach(void) |
43 | { | 52 | { |
44 | sh_bios_call(BIOS_CALL_GDB_DETACH, 0, 0, 0, 0); | 53 | sh_bios_call(BIOS_CALL_GDB_DETACH, 0, 0, 0, 0); |
@@ -55,3 +64,109 @@ void sh_bios_shutdown(unsigned int how) | |||
55 | { | 64 | { |
56 | sh_bios_call(BIOS_CALL_SHUTDOWN, how, 0, 0, 0); | 65 | sh_bios_call(BIOS_CALL_SHUTDOWN, how, 0, 0, 0); |
57 | } | 66 | } |
67 | |||
68 | /* | ||
69 | * Read the old value of the VBR register to initialise the vector | ||
70 | * through which debug and BIOS traps are delegated by the Linux trap | ||
71 | * handler. | ||
72 | */ | ||
73 | void sh_bios_vbr_init(void) | ||
74 | { | ||
75 | unsigned long vbr; | ||
76 | |||
77 | if (unlikely(gdb_vbr_vector)) | ||
78 | return; | ||
79 | |||
80 | __asm__ __volatile__ ("stc vbr, %0" : "=r" (vbr)); | ||
81 | |||
82 | if (vbr) { | ||
83 | gdb_vbr_vector = (void *)(vbr + 0x100); | ||
84 | printk(KERN_NOTICE "Setting GDB trap vector to %p\n", | ||
85 | gdb_vbr_vector); | ||
86 | } else | ||
87 | printk(KERN_NOTICE "SH-BIOS not detected\n"); | ||
88 | } | ||
89 | |||
90 | /** | ||
91 | * sh_bios_vbr_reload - Re-load the system VBR from the BIOS vector. | ||
92 | * | ||
93 | * This can be used by save/restore code to reinitialize the system VBR | ||
94 | * from the fixed BIOS VBR. A no-op if no BIOS VBR is known. | ||
95 | */ | ||
96 | void sh_bios_vbr_reload(void) | ||
97 | { | ||
98 | if (gdb_vbr_vector) | ||
99 | __asm__ __volatile__ ( | ||
100 | "ldc %0, vbr" | ||
101 | : | ||
102 | : "r" (((unsigned long) gdb_vbr_vector) - 0x100) | ||
103 | : "memory" | ||
104 | ); | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * Print a string through the BIOS | ||
109 | */ | ||
110 | static void sh_console_write(struct console *co, const char *s, | ||
111 | unsigned count) | ||
112 | { | ||
113 | sh_bios_console_write(s, count); | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * Setup initial baud/bits/parity. We do two things here: | ||
118 | * - construct a cflag setting for the first rs_open() | ||
119 | * - initialize the serial port | ||
120 | * Return non-zero if we didn't find a serial port. | ||
121 | */ | ||
122 | static int __init sh_console_setup(struct console *co, char *options) | ||
123 | { | ||
124 | int cflag = CREAD | HUPCL | CLOCAL; | ||
125 | |||
126 | /* | ||
127 | * Now construct a cflag setting. | ||
128 | * TODO: this is a totally bogus cflag, as we have | ||
129 | * no idea what serial settings the BIOS is using, or | ||
130 | * even if its using the serial port at all. | ||
131 | */ | ||
132 | cflag |= B115200 | CS8 | /*no parity*/0; | ||
133 | |||
134 | co->cflag = cflag; | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static struct console bios_console = { | ||
140 | .name = "bios", | ||
141 | .write = sh_console_write, | ||
142 | .setup = sh_console_setup, | ||
143 | .flags = CON_PRINTBUFFER, | ||
144 | .index = -1, | ||
145 | }; | ||
146 | |||
147 | static struct console *early_console; | ||
148 | |||
149 | static int __init setup_early_printk(char *buf) | ||
150 | { | ||
151 | int keep_early = 0; | ||
152 | |||
153 | if (!buf) | ||
154 | return 0; | ||
155 | |||
156 | if (strstr(buf, "keep")) | ||
157 | keep_early = 1; | ||
158 | |||
159 | if (!strncmp(buf, "bios", 4)) | ||
160 | early_console = &bios_console; | ||
161 | |||
162 | if (likely(early_console)) { | ||
163 | if (keep_early) | ||
164 | early_console->flags &= ~CON_BOOT; | ||
165 | else | ||
166 | early_console->flags |= CON_BOOT; | ||
167 | register_console(early_console); | ||
168 | } | ||
169 | |||
170 | return 0; | ||
171 | } | ||
172 | early_param("earlyprintk", setup_early_printk); | ||
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index 12815ce01ecd..6a7cce79eb4e 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -150,7 +150,7 @@ static inline int restore_sigcontext_fpu(struct sigcontext __user *sc) | |||
150 | return 0; | 150 | return 0; |
151 | 151 | ||
152 | set_used_math(); | 152 | set_used_math(); |
153 | return __copy_from_user(&tsk->thread.fpu.hard, &sc->sc_fpregs[0], | 153 | return __copy_from_user(&tsk->thread.xstate->hardfpu, &sc->sc_fpregs[0], |
154 | sizeof(long)*(16*2+2)); | 154 | sizeof(long)*(16*2+2)); |
155 | } | 155 | } |
156 | 156 | ||
@@ -175,7 +175,7 @@ static inline int save_sigcontext_fpu(struct sigcontext __user *sc, | |||
175 | clear_used_math(); | 175 | clear_used_math(); |
176 | 176 | ||
177 | unlazy_fpu(tsk, regs); | 177 | unlazy_fpu(tsk, regs); |
178 | return __copy_to_user(&sc->sc_fpregs[0], &tsk->thread.fpu.hard, | 178 | return __copy_to_user(&sc->sc_fpregs[0], &tsk->thread.xstate->hardfpu, |
179 | sizeof(long)*(16*2+2)); | 179 | sizeof(long)*(16*2+2)); |
180 | } | 180 | } |
181 | #endif /* CONFIG_SH_FPU */ | 181 | #endif /* CONFIG_SH_FPU */ |
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c index 706c1c18a2f2..9c090cb68878 100644 --- a/arch/sh/kernel/traps_32.c +++ b/arch/sh/kernel/traps_32.c | |||
@@ -24,13 +24,13 @@ | |||
24 | #include <linux/kdebug.h> | 24 | #include <linux/kdebug.h> |
25 | #include <linux/kexec.h> | 25 | #include <linux/kexec.h> |
26 | #include <linux/limits.h> | 26 | #include <linux/limits.h> |
27 | #include <linux/proc_fs.h> | ||
28 | #include <linux/seq_file.h> | ||
29 | #include <linux/sysfs.h> | 27 | #include <linux/sysfs.h> |
28 | #include <linux/uaccess.h> | ||
30 | #include <asm/system.h> | 29 | #include <asm/system.h> |
31 | #include <asm/uaccess.h> | 30 | #include <asm/alignment.h> |
32 | #include <asm/fpu.h> | 31 | #include <asm/fpu.h> |
33 | #include <asm/kprobes.h> | 32 | #include <asm/kprobes.h> |
33 | #include <asm/sh_bios.h> | ||
34 | 34 | ||
35 | #ifdef CONFIG_CPU_SH2 | 35 | #ifdef CONFIG_CPU_SH2 |
36 | # define TRAP_RESERVED_INST 4 | 36 | # define TRAP_RESERVED_INST 4 |
@@ -47,73 +47,6 @@ | |||
47 | #define TRAP_ILLEGAL_SLOT_INST 13 | 47 | #define TRAP_ILLEGAL_SLOT_INST 13 |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | static unsigned long se_user; | ||
51 | static unsigned long se_sys; | ||
52 | static unsigned long se_half; | ||
53 | static unsigned long se_word; | ||
54 | static unsigned long se_dword; | ||
55 | static unsigned long se_multi; | ||
56 | /* bitfield: 1: warn 2: fixup 4: signal -> combinations 2|4 && 1|2|4 are not | ||
57 | valid! */ | ||
58 | static int se_usermode = 3; | ||
59 | /* 0: no warning 1: print a warning message, disabled by default */ | ||
60 | static int se_kernmode_warn; | ||
61 | |||
62 | #ifdef CONFIG_PROC_FS | ||
63 | static const char *se_usermode_action[] = { | ||
64 | "ignored", | ||
65 | "warn", | ||
66 | "fixup", | ||
67 | "fixup+warn", | ||
68 | "signal", | ||
69 | "signal+warn" | ||
70 | }; | ||
71 | |||
72 | static int alignment_proc_show(struct seq_file *m, void *v) | ||
73 | { | ||
74 | seq_printf(m, "User:\t\t%lu\n", se_user); | ||
75 | seq_printf(m, "System:\t\t%lu\n", se_sys); | ||
76 | seq_printf(m, "Half:\t\t%lu\n", se_half); | ||
77 | seq_printf(m, "Word:\t\t%lu\n", se_word); | ||
78 | seq_printf(m, "DWord:\t\t%lu\n", se_dword); | ||
79 | seq_printf(m, "Multi:\t\t%lu\n", se_multi); | ||
80 | seq_printf(m, "User faults:\t%i (%s)\n", se_usermode, | ||
81 | se_usermode_action[se_usermode]); | ||
82 | seq_printf(m, "Kernel faults:\t%i (fixup%s)\n", se_kernmode_warn, | ||
83 | se_kernmode_warn ? "+warn" : ""); | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static int alignment_proc_open(struct inode *inode, struct file *file) | ||
88 | { | ||
89 | return single_open(file, alignment_proc_show, NULL); | ||
90 | } | ||
91 | |||
92 | static ssize_t alignment_proc_write(struct file *file, | ||
93 | const char __user *buffer, size_t count, loff_t *pos) | ||
94 | { | ||
95 | int *data = PDE(file->f_path.dentry->d_inode)->data; | ||
96 | char mode; | ||
97 | |||
98 | if (count > 0) { | ||
99 | if (get_user(mode, buffer)) | ||
100 | return -EFAULT; | ||
101 | if (mode >= '0' && mode <= '5') | ||
102 | *data = mode - '0'; | ||
103 | } | ||
104 | return count; | ||
105 | } | ||
106 | |||
107 | static const struct file_operations alignment_proc_fops = { | ||
108 | .owner = THIS_MODULE, | ||
109 | .open = alignment_proc_open, | ||
110 | .read = seq_read, | ||
111 | .llseek = seq_lseek, | ||
112 | .release = single_release, | ||
113 | .write = alignment_proc_write, | ||
114 | }; | ||
115 | #endif | ||
116 | |||
117 | static void dump_mem(const char *str, unsigned long bottom, unsigned long top) | 50 | static void dump_mem(const char *str, unsigned long bottom, unsigned long top) |
118 | { | 51 | { |
119 | unsigned long p; | 52 | unsigned long p; |
@@ -265,10 +198,10 @@ static int handle_unaligned_ins(insn_size_t instruction, struct pt_regs *regs, | |||
265 | count = 1<<(instruction&3); | 198 | count = 1<<(instruction&3); |
266 | 199 | ||
267 | switch (count) { | 200 | switch (count) { |
268 | case 1: se_half += 1; break; | 201 | case 1: inc_unaligned_byte_access(); break; |
269 | case 2: se_word += 1; break; | 202 | case 2: inc_unaligned_word_access(); break; |
270 | case 4: se_dword += 1; break; | 203 | case 4: inc_unaligned_dword_access(); break; |
271 | case 8: se_multi += 1; break; /* ??? */ | 204 | case 8: inc_unaligned_multi_access(); break; |
272 | } | 205 | } |
273 | 206 | ||
274 | ret = -EFAULT; | 207 | ret = -EFAULT; |
@@ -452,18 +385,8 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, | |||
452 | rm = regs->regs[index]; | 385 | rm = regs->regs[index]; |
453 | 386 | ||
454 | /* shout about fixups */ | 387 | /* shout about fixups */ |
455 | if (!expected) { | 388 | if (!expected) |
456 | if (user_mode(regs) && (se_usermode & 1) && printk_ratelimit()) | 389 | unaligned_fixups_notify(current, instruction, regs); |
457 | pr_notice("Fixing up unaligned userspace access " | ||
458 | "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", | ||
459 | current->comm, task_pid_nr(current), | ||
460 | (void *)regs->pc, instruction); | ||
461 | else if (se_kernmode_warn && printk_ratelimit()) | ||
462 | pr_notice("Fixing up unaligned kernel access " | ||
463 | "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", | ||
464 | current->comm, task_pid_nr(current), | ||
465 | (void *)regs->pc, instruction); | ||
466 | } | ||
467 | 390 | ||
468 | ret = -EFAULT; | 391 | ret = -EFAULT; |
469 | switch (instruction&0xF000) { | 392 | switch (instruction&0xF000) { |
@@ -616,10 +539,10 @@ asmlinkage void do_address_error(struct pt_regs *regs, | |||
616 | 539 | ||
617 | if (user_mode(regs)) { | 540 | if (user_mode(regs)) { |
618 | int si_code = BUS_ADRERR; | 541 | int si_code = BUS_ADRERR; |
542 | unsigned int user_action; | ||
619 | 543 | ||
620 | local_irq_enable(); | 544 | local_irq_enable(); |
621 | 545 | inc_unaligned_user_access(); | |
622 | se_user += 1; | ||
623 | 546 | ||
624 | set_fs(USER_DS); | 547 | set_fs(USER_DS); |
625 | if (copy_from_user(&instruction, (insn_size_t *)(regs->pc & ~1), | 548 | if (copy_from_user(&instruction, (insn_size_t *)(regs->pc & ~1), |
@@ -630,16 +553,12 @@ asmlinkage void do_address_error(struct pt_regs *regs, | |||
630 | set_fs(oldfs); | 553 | set_fs(oldfs); |
631 | 554 | ||
632 | /* shout about userspace fixups */ | 555 | /* shout about userspace fixups */ |
633 | if (se_usermode & 1) | 556 | unaligned_fixups_notify(current, instruction, regs); |
634 | printk(KERN_NOTICE "Unaligned userspace access " | ||
635 | "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", | ||
636 | current->comm, current->pid, (void *)regs->pc, | ||
637 | instruction); | ||
638 | 557 | ||
639 | if (se_usermode & 2) | 558 | user_action = unaligned_user_action(); |
559 | if (user_action & UM_FIXUP) | ||
640 | goto fixup; | 560 | goto fixup; |
641 | 561 | if (user_action & UM_SIGNAL) | |
642 | if (se_usermode & 4) | ||
643 | goto uspace_segv; | 562 | goto uspace_segv; |
644 | else { | 563 | else { |
645 | /* ignore */ | 564 | /* ignore */ |
@@ -659,7 +578,7 @@ fixup: | |||
659 | &user_mem_access, 0); | 578 | &user_mem_access, 0); |
660 | set_fs(oldfs); | 579 | set_fs(oldfs); |
661 | 580 | ||
662 | if (tmp==0) | 581 | if (tmp == 0) |
663 | return; /* sorted */ | 582 | return; /* sorted */ |
664 | uspace_segv: | 583 | uspace_segv: |
665 | printk(KERN_NOTICE "Sending SIGBUS to \"%s\" due to unaligned " | 584 | printk(KERN_NOTICE "Sending SIGBUS to \"%s\" due to unaligned " |
@@ -672,7 +591,7 @@ uspace_segv: | |||
672 | info.si_addr = (void __user *)address; | 591 | info.si_addr = (void __user *)address; |
673 | force_sig_info(SIGBUS, &info, current); | 592 | force_sig_info(SIGBUS, &info, current); |
674 | } else { | 593 | } else { |
675 | se_sys += 1; | 594 | inc_unaligned_kernel_access(); |
676 | 595 | ||
677 | if (regs->pc & 1) | 596 | if (regs->pc & 1) |
678 | die("unaligned program counter", regs, error_code); | 597 | die("unaligned program counter", regs, error_code); |
@@ -687,11 +606,7 @@ uspace_segv: | |||
687 | die("insn faulting in do_address_error", regs, 0); | 606 | die("insn faulting in do_address_error", regs, 0); |
688 | } | 607 | } |
689 | 608 | ||
690 | if (se_kernmode_warn) | 609 | unaligned_fixups_notify(current, instruction, regs); |
691 | printk(KERN_NOTICE "Unaligned kernel access " | ||
692 | "on behalf of \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", | ||
693 | current->comm, current->pid, (void *)regs->pc, | ||
694 | instruction); | ||
695 | 610 | ||
696 | handle_unaligned_access(instruction, regs, | 611 | handle_unaligned_access(instruction, regs, |
697 | &user_mem_access, 0); | 612 | &user_mem_access, 0); |
@@ -876,35 +791,10 @@ asmlinkage void do_exception_error(unsigned long r4, unsigned long r5, | |||
876 | die_if_kernel("exception", regs, ex); | 791 | die_if_kernel("exception", regs, ex); |
877 | } | 792 | } |
878 | 793 | ||
879 | #if defined(CONFIG_SH_STANDARD_BIOS) | ||
880 | void *gdb_vbr_vector; | ||
881 | |||
882 | static inline void __init gdb_vbr_init(void) | ||
883 | { | ||
884 | register unsigned long vbr; | ||
885 | |||
886 | /* | ||
887 | * Read the old value of the VBR register to initialise | ||
888 | * the vector through which debug and BIOS traps are | ||
889 | * delegated by the Linux trap handler. | ||
890 | */ | ||
891 | asm volatile("stc vbr, %0" : "=r" (vbr)); | ||
892 | |||
893 | gdb_vbr_vector = (void *)(vbr + 0x100); | ||
894 | printk("Setting GDB trap vector to 0x%08lx\n", | ||
895 | (unsigned long)gdb_vbr_vector); | ||
896 | } | ||
897 | #endif | ||
898 | |||
899 | void __cpuinit per_cpu_trap_init(void) | 794 | void __cpuinit per_cpu_trap_init(void) |
900 | { | 795 | { |
901 | extern void *vbr_base; | 796 | extern void *vbr_base; |
902 | 797 | ||
903 | #ifdef CONFIG_SH_STANDARD_BIOS | ||
904 | if (raw_smp_processor_id() == 0) | ||
905 | gdb_vbr_init(); | ||
906 | #endif | ||
907 | |||
908 | /* NOTE: The VBR value should be at P1 | 798 | /* NOTE: The VBR value should be at P1 |
909 | (or P2, virtural "fixed" address space). | 799 | (or P2, virtural "fixed" address space). |
910 | It's definitely should not in physical address. */ | 800 | It's definitely should not in physical address. */ |
@@ -959,6 +849,9 @@ void __init trap_init(void) | |||
959 | set_exception_table_vec(TRAP_UBC, breakpoint_trap_handler); | 849 | set_exception_table_vec(TRAP_UBC, breakpoint_trap_handler); |
960 | #endif | 850 | #endif |
961 | 851 | ||
852 | /* Save off the BIOS VBR, if there is one */ | ||
853 | sh_bios_vbr_init(); | ||
854 | |||
962 | /* Setup VBR for boot cpu */ | 855 | /* Setup VBR for boot cpu */ |
963 | per_cpu_trap_init(); | 856 | per_cpu_trap_init(); |
964 | } | 857 | } |
@@ -985,34 +878,3 @@ void dump_stack(void) | |||
985 | show_stack(NULL, NULL); | 878 | show_stack(NULL, NULL); |
986 | } | 879 | } |
987 | EXPORT_SYMBOL(dump_stack); | 880 | EXPORT_SYMBOL(dump_stack); |
988 | |||
989 | #ifdef CONFIG_PROC_FS | ||
990 | /* | ||
991 | * This needs to be done after sysctl_init, otherwise sys/ will be | ||
992 | * overwritten. Actually, this shouldn't be in sys/ at all since | ||
993 | * it isn't a sysctl, and it doesn't contain sysctl information. | ||
994 | * We now locate it in /proc/cpu/alignment instead. | ||
995 | */ | ||
996 | static int __init alignment_init(void) | ||
997 | { | ||
998 | struct proc_dir_entry *dir, *res; | ||
999 | |||
1000 | dir = proc_mkdir("cpu", NULL); | ||
1001 | if (!dir) | ||
1002 | return -ENOMEM; | ||
1003 | |||
1004 | res = proc_create_data("alignment", S_IWUSR | S_IRUGO, dir, | ||
1005 | &alignment_proc_fops, &se_usermode); | ||
1006 | if (!res) | ||
1007 | return -ENOMEM; | ||
1008 | |||
1009 | res = proc_create_data("kernel_alignment", S_IWUSR | S_IRUGO, dir, | ||
1010 | &alignment_proc_fops, &se_kernmode_warn); | ||
1011 | if (!res) | ||
1012 | return -ENOMEM; | ||
1013 | |||
1014 | return 0; | ||
1015 | } | ||
1016 | |||
1017 | fs_initcall(alignment_init); | ||
1018 | #endif | ||
diff --git a/arch/sh/math-emu/math.c b/arch/sh/math-emu/math.c index d6c15cae0912..1fcdb1220975 100644 --- a/arch/sh/math-emu/math.c +++ b/arch/sh/math-emu/math.c | |||
@@ -471,10 +471,10 @@ static int fpu_emulate(u16 code, struct sh_fpu_soft_struct *fregs, struct pt_reg | |||
471 | * denormal_to_double - Given denormalized float number, | 471 | * denormal_to_double - Given denormalized float number, |
472 | * store double float | 472 | * store double float |
473 | * | 473 | * |
474 | * @fpu: Pointer to sh_fpu_hard structure | 474 | * @fpu: Pointer to sh_fpu_soft structure |
475 | * @n: Index to FP register | 475 | * @n: Index to FP register |
476 | */ | 476 | */ |
477 | static void denormal_to_double(struct sh_fpu_hard_struct *fpu, int n) | 477 | static void denormal_to_double(struct sh_fpu_soft_struct *fpu, int n) |
478 | { | 478 | { |
479 | unsigned long du, dl; | 479 | unsigned long du, dl; |
480 | unsigned long x = fpu->fpul; | 480 | unsigned long x = fpu->fpul; |
@@ -552,11 +552,11 @@ static int ieee_fpe_handler(struct pt_regs *regs) | |||
552 | if ((finsn & 0xf1ff) == 0xf0ad) { /* fcnvsd */ | 552 | if ((finsn & 0xf1ff) == 0xf0ad) { /* fcnvsd */ |
553 | struct task_struct *tsk = current; | 553 | struct task_struct *tsk = current; |
554 | 554 | ||
555 | if ((tsk->thread.fpu.hard.fpscr & (1 << 17))) { | 555 | if ((tsk->thread.xstate->softfpu.fpscr & (1 << 17))) { |
556 | /* FPU error */ | 556 | /* FPU error */ |
557 | denormal_to_double (&tsk->thread.fpu.hard, | 557 | denormal_to_double (&tsk->thread.xstate->softfpu, |
558 | (finsn >> 8) & 0xf); | 558 | (finsn >> 8) & 0xf); |
559 | tsk->thread.fpu.hard.fpscr &= | 559 | tsk->thread.xstate->softfpu.fpscr &= |
560 | ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK); | 560 | ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK); |
561 | task_thread_info(tsk)->status |= TS_USEDFPU; | 561 | task_thread_info(tsk)->status |= TS_USEDFPU; |
562 | } else { | 562 | } else { |
@@ -617,7 +617,7 @@ static void fpu_init(struct sh_fpu_soft_struct *fpu) | |||
617 | int do_fpu_inst(unsigned short inst, struct pt_regs *regs) | 617 | int do_fpu_inst(unsigned short inst, struct pt_regs *regs) |
618 | { | 618 | { |
619 | struct task_struct *tsk = current; | 619 | struct task_struct *tsk = current; |
620 | struct sh_fpu_soft_struct *fpu = &(tsk->thread.fpu.soft); | 620 | struct sh_fpu_soft_struct *fpu = &(tsk->thread.xstate->softfpu); |
621 | 621 | ||
622 | if (!(task_thread_info(tsk)->status & TS_USEDFPU)) { | 622 | if (!(task_thread_info(tsk)->status & TS_USEDFPU)) { |
623 | /* initialize once. */ | 623 | /* initialize once. */ |
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile index dd5010c708e0..9fa11d655044 100644 --- a/arch/sh/mm/Makefile +++ b/arch/sh/mm/Makefile | |||
@@ -2,7 +2,7 @@ | |||
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 := cache.o init.o consistent.o mmap.o | 5 | obj-y := alignment.o cache.o init.o consistent.o mmap.o |
6 | 6 | ||
7 | cacheops-$(CONFIG_CPU_SH2) := cache-sh2.o | 7 | cacheops-$(CONFIG_CPU_SH2) := cache-sh2.o |
8 | cacheops-$(CONFIG_CPU_SH2A) := cache-sh2a.o | 8 | cacheops-$(CONFIG_CPU_SH2A) := cache-sh2a.o |
diff --git a/arch/sh/mm/alignment.c b/arch/sh/mm/alignment.c new file mode 100644 index 000000000000..e615151eac3b --- /dev/null +++ b/arch/sh/mm/alignment.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * Alignment access counters and corresponding user-space interfaces. | ||
3 | * | ||
4 | * Copyright (C) 2009 ST Microelectronics | ||
5 | * Copyright (C) 2009 - 2010 Paul Mundt | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/seq_file.h> | ||
14 | #include <linux/proc_fs.h> | ||
15 | #include <linux/uaccess.h> | ||
16 | #include <asm/alignment.h> | ||
17 | |||
18 | static unsigned long se_user; | ||
19 | static unsigned long se_sys; | ||
20 | static unsigned long se_half; | ||
21 | static unsigned long se_word; | ||
22 | static unsigned long se_dword; | ||
23 | static unsigned long se_multi; | ||
24 | /* bitfield: 1: warn 2: fixup 4: signal -> combinations 2|4 && 1|2|4 are not | ||
25 | valid! */ | ||
26 | static int se_usermode = UM_WARN | UM_FIXUP; | ||
27 | /* 0: no warning 1: print a warning message, disabled by default */ | ||
28 | static int se_kernmode_warn; | ||
29 | |||
30 | void inc_unaligned_byte_access(void) | ||
31 | { | ||
32 | se_half++; | ||
33 | } | ||
34 | |||
35 | void inc_unaligned_word_access(void) | ||
36 | { | ||
37 | se_word++; | ||
38 | } | ||
39 | |||
40 | void inc_unaligned_dword_access(void) | ||
41 | { | ||
42 | se_dword++; | ||
43 | } | ||
44 | |||
45 | void inc_unaligned_multi_access(void) | ||
46 | { | ||
47 | se_multi++; | ||
48 | } | ||
49 | |||
50 | void inc_unaligned_user_access(void) | ||
51 | { | ||
52 | se_user++; | ||
53 | } | ||
54 | |||
55 | void inc_unaligned_kernel_access(void) | ||
56 | { | ||
57 | se_sys++; | ||
58 | } | ||
59 | |||
60 | unsigned int unaligned_user_action(void) | ||
61 | { | ||
62 | return se_usermode; | ||
63 | } | ||
64 | |||
65 | void unaligned_fixups_notify(struct task_struct *tsk, insn_size_t insn, | ||
66 | struct pt_regs *regs) | ||
67 | { | ||
68 | if (user_mode(regs) && (se_usermode & UM_WARN) && printk_ratelimit()) | ||
69 | pr_notice("Fixing up unaligned userspace access " | ||
70 | "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", | ||
71 | tsk->comm, task_pid_nr(tsk), | ||
72 | (void *)regs->pc, insn); | ||
73 | else if (se_kernmode_warn && printk_ratelimit()) | ||
74 | pr_notice("Fixing up unaligned kernel access " | ||
75 | "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", | ||
76 | tsk->comm, task_pid_nr(tsk), | ||
77 | (void *)regs->pc, insn); | ||
78 | } | ||
79 | |||
80 | static const char *se_usermode_action[] = { | ||
81 | "ignored", | ||
82 | "warn", | ||
83 | "fixup", | ||
84 | "fixup+warn", | ||
85 | "signal", | ||
86 | "signal+warn" | ||
87 | }; | ||
88 | |||
89 | static int alignment_proc_show(struct seq_file *m, void *v) | ||
90 | { | ||
91 | seq_printf(m, "User:\t\t%lu\n", se_user); | ||
92 | seq_printf(m, "System:\t\t%lu\n", se_sys); | ||
93 | seq_printf(m, "Half:\t\t%lu\n", se_half); | ||
94 | seq_printf(m, "Word:\t\t%lu\n", se_word); | ||
95 | seq_printf(m, "DWord:\t\t%lu\n", se_dword); | ||
96 | seq_printf(m, "Multi:\t\t%lu\n", se_multi); | ||
97 | seq_printf(m, "User faults:\t%i (%s)\n", se_usermode, | ||
98 | se_usermode_action[se_usermode]); | ||
99 | seq_printf(m, "Kernel faults:\t%i (fixup%s)\n", se_kernmode_warn, | ||
100 | se_kernmode_warn ? "+warn" : ""); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static int alignment_proc_open(struct inode *inode, struct file *file) | ||
105 | { | ||
106 | return single_open(file, alignment_proc_show, NULL); | ||
107 | } | ||
108 | |||
109 | static ssize_t alignment_proc_write(struct file *file, | ||
110 | const char __user *buffer, size_t count, loff_t *pos) | ||
111 | { | ||
112 | int *data = PDE(file->f_path.dentry->d_inode)->data; | ||
113 | char mode; | ||
114 | |||
115 | if (count > 0) { | ||
116 | if (get_user(mode, buffer)) | ||
117 | return -EFAULT; | ||
118 | if (mode >= '0' && mode <= '5') | ||
119 | *data = mode - '0'; | ||
120 | } | ||
121 | return count; | ||
122 | } | ||
123 | |||
124 | static const struct file_operations alignment_proc_fops = { | ||
125 | .owner = THIS_MODULE, | ||
126 | .open = alignment_proc_open, | ||
127 | .read = seq_read, | ||
128 | .llseek = seq_lseek, | ||
129 | .release = single_release, | ||
130 | .write = alignment_proc_write, | ||
131 | }; | ||
132 | |||
133 | /* | ||
134 | * This needs to be done after sysctl_init, otherwise sys/ will be | ||
135 | * overwritten. Actually, this shouldn't be in sys/ at all since | ||
136 | * it isn't a sysctl, and it doesn't contain sysctl information. | ||
137 | * We now locate it in /proc/cpu/alignment instead. | ||
138 | */ | ||
139 | static int __init alignment_init(void) | ||
140 | { | ||
141 | struct proc_dir_entry *dir, *res; | ||
142 | |||
143 | dir = proc_mkdir("cpu", NULL); | ||
144 | if (!dir) | ||
145 | return -ENOMEM; | ||
146 | |||
147 | res = proc_create_data("alignment", S_IWUSR | S_IRUGO, dir, | ||
148 | &alignment_proc_fops, &se_usermode); | ||
149 | if (!res) | ||
150 | return -ENOMEM; | ||
151 | |||
152 | res = proc_create_data("kernel_alignment", S_IWUSR | S_IRUGO, dir, | ||
153 | &alignment_proc_fops, &se_kernmode_warn); | ||
154 | if (!res) | ||
155 | return -ENOMEM; | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | fs_initcall(alignment_init); | ||
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 761910d142f8..d5fb014279ad 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -283,35 +283,6 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
283 | } | 283 | } |
284 | #endif | 284 | #endif |
285 | 285 | ||
286 | #if THREAD_SHIFT < PAGE_SHIFT | ||
287 | static struct kmem_cache *thread_info_cache; | ||
288 | |||
289 | struct thread_info *alloc_thread_info(struct task_struct *tsk) | ||
290 | { | ||
291 | struct thread_info *ti; | ||
292 | |||
293 | ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL); | ||
294 | if (unlikely(ti == NULL)) | ||
295 | return NULL; | ||
296 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
297 | memset(ti, 0, THREAD_SIZE); | ||
298 | #endif | ||
299 | return ti; | ||
300 | } | ||
301 | |||
302 | void free_thread_info(struct thread_info *ti) | ||
303 | { | ||
304 | kmem_cache_free(thread_info_cache, ti); | ||
305 | } | ||
306 | |||
307 | void thread_info_cache_init(void) | ||
308 | { | ||
309 | thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE, | ||
310 | THREAD_SIZE, 0, NULL); | ||
311 | BUG_ON(thread_info_cache == NULL); | ||
312 | } | ||
313 | #endif /* THREAD_SHIFT < PAGE_SHIFT */ | ||
314 | |||
315 | #ifdef CONFIG_MEMORY_HOTPLUG | 286 | #ifdef CONFIG_MEMORY_HOTPLUG |
316 | int arch_add_memory(int nid, u64 start, u64 size) | 287 | int arch_add_memory(int nid, u64 start, u64 size) |
317 | { | 288 | { |
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c index f30f4a1ead23..d242a7340541 100644 --- a/arch/sparc/kernel/nmi.c +++ b/arch/sparc/kernel/nmi.c | |||
@@ -96,7 +96,6 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs) | |||
96 | int cpu = smp_processor_id(); | 96 | int cpu = smp_processor_id(); |
97 | 97 | ||
98 | clear_softint(1 << irq); | 98 | clear_softint(1 << irq); |
99 | pcr_ops->write(PCR_PIC_PRIV); | ||
100 | 99 | ||
101 | local_cpu_data().__nmi_count++; | 100 | local_cpu_data().__nmi_count++; |
102 | 101 | ||
@@ -105,6 +104,8 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs) | |||
105 | if (notify_die(DIE_NMI, "nmi", regs, 0, | 104 | if (notify_die(DIE_NMI, "nmi", regs, 0, |
106 | pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP) | 105 | pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP) |
107 | touched = 1; | 106 | touched = 1; |
107 | else | ||
108 | pcr_ops->write(PCR_PIC_PRIV); | ||
108 | 109 | ||
109 | sum = kstat_irqs_cpu(0, cpu); | 110 | sum = kstat_irqs_cpu(0, cpu); |
110 | if (__get_cpu_var(nmi_touch)) { | 111 | if (__get_cpu_var(nmi_touch)) { |
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index fa5936e1c3b9..198fb4e79ba2 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
@@ -986,6 +986,17 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self, | |||
986 | data.addr = 0; | 986 | data.addr = 0; |
987 | 987 | ||
988 | cpuc = &__get_cpu_var(cpu_hw_events); | 988 | cpuc = &__get_cpu_var(cpu_hw_events); |
989 | |||
990 | /* If the PMU has the TOE IRQ enable bits, we need to do a | ||
991 | * dummy write to the %pcr to clear the overflow bits and thus | ||
992 | * the interrupt. | ||
993 | * | ||
994 | * Do this before we peek at the counters to determine | ||
995 | * overflow so we don't lose any events. | ||
996 | */ | ||
997 | if (sparc_pmu->irq_bit) | ||
998 | pcr_ops->write(cpuc->pcr); | ||
999 | |||
989 | for (idx = 0; idx < MAX_HWEVENTS; idx++) { | 1000 | for (idx = 0; idx < MAX_HWEVENTS; idx++) { |
990 | struct perf_event *event = cpuc->events[idx]; | 1001 | struct perf_event *event = cpuc->events[idx]; |
991 | struct hw_perf_event *hwc; | 1002 | struct hw_perf_event *hwc; |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 55298e891571..cbcbfdee3ee0 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -49,6 +49,7 @@ config X86 | |||
49 | select HAVE_KERNEL_GZIP | 49 | select HAVE_KERNEL_GZIP |
50 | select HAVE_KERNEL_BZIP2 | 50 | select HAVE_KERNEL_BZIP2 |
51 | select HAVE_KERNEL_LZMA | 51 | select HAVE_KERNEL_LZMA |
52 | select HAVE_KERNEL_LZO | ||
52 | select HAVE_HW_BREAKPOINT | 53 | select HAVE_HW_BREAKPOINT |
53 | select PERF_EVENTS | 54 | select PERF_EVENTS |
54 | select ANON_INODES | 55 | select ANON_INODES |
@@ -1246,6 +1247,11 @@ config ARCH_MEMORY_PROBE | |||
1246 | def_bool X86_64 | 1247 | def_bool X86_64 |
1247 | depends on MEMORY_HOTPLUG | 1248 | depends on MEMORY_HOTPLUG |
1248 | 1249 | ||
1250 | config ILLEGAL_POINTER_VALUE | ||
1251 | hex | ||
1252 | default 0 if X86_32 | ||
1253 | default 0xdead000000000000 if X86_64 | ||
1254 | |||
1249 | source "mm/Kconfig" | 1255 | source "mm/Kconfig" |
1250 | 1256 | ||
1251 | config HIGHPTE | 1257 | config HIGHPTE |
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index 08e442bc3ab9..f20ddf84a893 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
@@ -396,7 +396,7 @@ config X86_TSC | |||
396 | 396 | ||
397 | config X86_CMPXCHG64 | 397 | config X86_CMPXCHG64 |
398 | def_bool y | 398 | def_bool y |
399 | depends on !M386 && !M486 | 399 | depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MATOM |
400 | 400 | ||
401 | # this should be set for all -march=.. options where the compiler | 401 | # this should be set for all -march=.. options where the compiler |
402 | # generates cmov. | 402 | # generates cmov. |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index f8ed0658404c..fbb47daf2459 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -4,11 +4,12 @@ | |||
4 | # create a compressed vmlinux image from the original vmlinux | 4 | # create a compressed vmlinux image from the original vmlinux |
5 | # | 5 | # |
6 | 6 | ||
7 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o | 7 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo head_$(BITS).o misc.o piggy.o |
8 | 8 | ||
9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 | 9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 |
10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC | 10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC |
11 | KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING | 11 | KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING |
12 | cflags-$(CONFIG_X86_32) := -march=i386 | ||
12 | cflags-$(CONFIG_X86_64) := -mcmodel=small | 13 | cflags-$(CONFIG_X86_64) := -mcmodel=small |
13 | KBUILD_CFLAGS += $(cflags-y) | 14 | KBUILD_CFLAGS += $(cflags-y) |
14 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) | 15 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) |
@@ -48,10 +49,13 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE | |||
48 | $(call if_changed,bzip2) | 49 | $(call if_changed,bzip2) |
49 | $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE | 50 | $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE |
50 | $(call if_changed,lzma) | 51 | $(call if_changed,lzma) |
52 | $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE | ||
53 | $(call if_changed,lzo) | ||
51 | 54 | ||
52 | suffix-$(CONFIG_KERNEL_GZIP) := gz | 55 | suffix-$(CONFIG_KERNEL_GZIP) := gz |
53 | suffix-$(CONFIG_KERNEL_BZIP2) := bz2 | 56 | suffix-$(CONFIG_KERNEL_BZIP2) := bz2 |
54 | suffix-$(CONFIG_KERNEL_LZMA) := lzma | 57 | suffix-$(CONFIG_KERNEL_LZMA) := lzma |
58 | suffix-$(CONFIG_KERNEL_LZO) := lzo | ||
55 | 59 | ||
56 | quiet_cmd_mkpiggy = MKPIGGY $@ | 60 | quiet_cmd_mkpiggy = MKPIGGY $@ |
57 | cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) | 61 | cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) |
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 842b2a36174a..3b22fe8ab91b 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
@@ -162,6 +162,10 @@ static int lines, cols; | |||
162 | #include "../../../../lib/decompress_unlzma.c" | 162 | #include "../../../../lib/decompress_unlzma.c" |
163 | #endif | 163 | #endif |
164 | 164 | ||
165 | #ifdef CONFIG_KERNEL_LZO | ||
166 | #include "../../../../lib/decompress_unlzo.c" | ||
167 | #endif | ||
168 | |||
165 | static void scroll(void) | 169 | static void scroll(void) |
166 | { | 170 | { |
167 | int i; | 171 | int i; |
diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h index 950df434763f..f46b79f6c16c 100644 --- a/arch/x86/include/asm/kvm.h +++ b/arch/x86/include/asm/kvm.h | |||
@@ -254,6 +254,10 @@ struct kvm_reinject_control { | |||
254 | __u8 reserved[31]; | 254 | __u8 reserved[31]; |
255 | }; | 255 | }; |
256 | 256 | ||
257 | /* When set in flags, include corresponding fields on KVM_SET_VCPU_EVENTS */ | ||
258 | #define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001 | ||
259 | #define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002 | ||
260 | |||
257 | /* for KVM_GET/SET_VCPU_EVENTS */ | 261 | /* for KVM_GET/SET_VCPU_EVENTS */ |
258 | struct kvm_vcpu_events { | 262 | struct kvm_vcpu_events { |
259 | struct { | 263 | struct { |
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h index 0c9825e97f36..088d09fb1615 100644 --- a/arch/x86/include/asm/uaccess_32.h +++ b/arch/x86/include/asm/uaccess_32.h | |||
@@ -205,14 +205,13 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
205 | unsigned long n) | 205 | unsigned long n) |
206 | { | 206 | { |
207 | int sz = __compiletime_object_size(to); | 207 | int sz = __compiletime_object_size(to); |
208 | int ret = -EFAULT; | ||
209 | 208 | ||
210 | if (likely(sz == -1 || sz >= n)) | 209 | if (likely(sz == -1 || sz >= n)) |
211 | ret = _copy_from_user(to, from, n); | 210 | n = _copy_from_user(to, from, n); |
212 | else | 211 | else |
213 | copy_from_user_overflow(); | 212 | copy_from_user_overflow(); |
214 | 213 | ||
215 | return ret; | 214 | return n; |
216 | } | 215 | } |
217 | 216 | ||
218 | long __must_check strncpy_from_user(char *dst, const char __user *src, | 217 | long __must_check strncpy_from_user(char *dst, const char __user *src, |
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h index 46324c6a4f6e..535e421498f6 100644 --- a/arch/x86/include/asm/uaccess_64.h +++ b/arch/x86/include/asm/uaccess_64.h | |||
@@ -30,16 +30,15 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
30 | unsigned long n) | 30 | unsigned long n) |
31 | { | 31 | { |
32 | int sz = __compiletime_object_size(to); | 32 | int sz = __compiletime_object_size(to); |
33 | int ret = -EFAULT; | ||
34 | 33 | ||
35 | might_fault(); | 34 | might_fault(); |
36 | if (likely(sz == -1 || sz >= n)) | 35 | if (likely(sz == -1 || sz >= n)) |
37 | ret = _copy_from_user(to, from, n); | 36 | n = _copy_from_user(to, from, n); |
38 | #ifdef CONFIG_DEBUG_VM | 37 | #ifdef CONFIG_DEBUG_VM |
39 | else | 38 | else |
40 | WARN(1, "Buffer overflow detected!\n"); | 39 | WARN(1, "Buffer overflow detected!\n"); |
41 | #endif | 40 | #endif |
42 | return ret; | 41 | return n; |
43 | } | 42 | } |
44 | 43 | ||
45 | static __always_inline __must_check | 44 | static __always_inline __must_check |
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h index 811bfabc80b7..bc54fa965af3 100644 --- a/arch/x86/include/asm/uv/uv_hub.h +++ b/arch/x86/include/asm/uv/uv_hub.h | |||
@@ -31,20 +31,20 @@ | |||
31 | * contiguous (although various IO spaces may punch holes in | 31 | * contiguous (although various IO spaces may punch holes in |
32 | * it).. | 32 | * it).. |
33 | * | 33 | * |
34 | * N - Number of bits in the node portion of a socket physical | 34 | * N - Number of bits in the node portion of a socket physical |
35 | * address. | 35 | * address. |
36 | * | 36 | * |
37 | * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of | 37 | * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of |
38 | * routers always have low bit of 1, C/MBricks have low bit | 38 | * routers always have low bit of 1, C/MBricks have low bit |
39 | * equal to 0. Most addressing macros that target UV hub chips | 39 | * equal to 0. Most addressing macros that target UV hub chips |
40 | * right shift the NASID by 1 to exclude the always-zero bit. | 40 | * right shift the NASID by 1 to exclude the always-zero bit. |
41 | * NASIDs contain up to 15 bits. | 41 | * NASIDs contain up to 15 bits. |
42 | * | 42 | * |
43 | * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead | 43 | * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead |
44 | * of nasids. | 44 | * of nasids. |
45 | * | 45 | * |
46 | * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant | 46 | * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant |
47 | * of the nasid for socket usage. | 47 | * of the nasid for socket usage. |
48 | * | 48 | * |
49 | * | 49 | * |
50 | * NumaLink Global Physical Address Format: | 50 | * NumaLink Global Physical Address Format: |
@@ -71,12 +71,12 @@ | |||
71 | * | 71 | * |
72 | * | 72 | * |
73 | * APICID format | 73 | * APICID format |
74 | * NOTE!!!!!! This is the current format of the APICID. However, code | 74 | * NOTE!!!!!! This is the current format of the APICID. However, code |
75 | * should assume that this will change in the future. Use functions | 75 | * should assume that this will change in the future. Use functions |
76 | * in this file for all APICID bit manipulations and conversion. | 76 | * in this file for all APICID bit manipulations and conversion. |
77 | * | 77 | * |
78 | * 1111110000000000 | 78 | * 1111110000000000 |
79 | * 5432109876543210 | 79 | * 5432109876543210 |
80 | * pppppppppplc0cch | 80 | * pppppppppplc0cch |
81 | * sssssssssss | 81 | * sssssssssss |
82 | * | 82 | * |
@@ -89,9 +89,9 @@ | |||
89 | * Note: Processor only supports 12 bits in the APICID register. The ACPI | 89 | * Note: Processor only supports 12 bits in the APICID register. The ACPI |
90 | * tables hold all 16 bits. Software needs to be aware of this. | 90 | * tables hold all 16 bits. Software needs to be aware of this. |
91 | * | 91 | * |
92 | * Unless otherwise specified, all references to APICID refer to | 92 | * Unless otherwise specified, all references to APICID refer to |
93 | * the FULL value contained in ACPI tables, not the subset in the | 93 | * the FULL value contained in ACPI tables, not the subset in the |
94 | * processor APICID register. | 94 | * processor APICID register. |
95 | */ | 95 | */ |
96 | 96 | ||
97 | 97 | ||
@@ -151,16 +151,16 @@ struct uv_hub_info_s { | |||
151 | }; | 151 | }; |
152 | 152 | ||
153 | DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); | 153 | DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); |
154 | #define uv_hub_info (&__get_cpu_var(__uv_hub_info)) | 154 | #define uv_hub_info (&__get_cpu_var(__uv_hub_info)) |
155 | #define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu)) | 155 | #define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu)) |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * Local & Global MMR space macros. | 158 | * Local & Global MMR space macros. |
159 | * Note: macros are intended to be used ONLY by inline functions | 159 | * Note: macros are intended to be used ONLY by inline functions |
160 | * in this file - not by other kernel code. | 160 | * in this file - not by other kernel code. |
161 | * n - NASID (full 15-bit global nasid) | 161 | * n - NASID (full 15-bit global nasid) |
162 | * g - GNODE (full 15-bit global nasid, right shifted 1) | 162 | * g - GNODE (full 15-bit global nasid, right shifted 1) |
163 | * p - PNODE (local part of nsids, right shifted 1) | 163 | * p - PNODE (local part of nsids, right shifted 1) |
164 | */ | 164 | */ |
165 | #define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask) | 165 | #define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask) |
166 | #define UV_PNODE_TO_GNODE(p) ((p) |uv_hub_info->gnode_extra) | 166 | #define UV_PNODE_TO_GNODE(p) ((p) |uv_hub_info->gnode_extra) |
@@ -215,8 +215,8 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); | |||
215 | /* | 215 | /* |
216 | * Macros for converting between kernel virtual addresses, socket local physical | 216 | * Macros for converting between kernel virtual addresses, socket local physical |
217 | * addresses, and UV global physical addresses. | 217 | * addresses, and UV global physical addresses. |
218 | * Note: use the standard __pa() & __va() macros for converting | 218 | * Note: use the standard __pa() & __va() macros for converting |
219 | * between socket virtual and socket physical addresses. | 219 | * between socket virtual and socket physical addresses. |
220 | */ | 220 | */ |
221 | 221 | ||
222 | /* socket phys RAM --> UV global physical address */ | 222 | /* socket phys RAM --> UV global physical address */ |
@@ -287,21 +287,18 @@ static inline int uv_apicid_to_pnode(int apicid) | |||
287 | * Access global MMRs using the low memory MMR32 space. This region supports | 287 | * Access global MMRs using the low memory MMR32 space. This region supports |
288 | * faster MMR access but not all MMRs are accessible in this space. | 288 | * faster MMR access but not all MMRs are accessible in this space. |
289 | */ | 289 | */ |
290 | static inline unsigned long *uv_global_mmr32_address(int pnode, | 290 | static inline unsigned long *uv_global_mmr32_address(int pnode, unsigned long offset) |
291 | unsigned long offset) | ||
292 | { | 291 | { |
293 | return __va(UV_GLOBAL_MMR32_BASE | | 292 | return __va(UV_GLOBAL_MMR32_BASE | |
294 | UV_GLOBAL_MMR32_PNODE_BITS(pnode) | offset); | 293 | UV_GLOBAL_MMR32_PNODE_BITS(pnode) | offset); |
295 | } | 294 | } |
296 | 295 | ||
297 | static inline void uv_write_global_mmr32(int pnode, unsigned long offset, | 296 | static inline void uv_write_global_mmr32(int pnode, unsigned long offset, unsigned long val) |
298 | unsigned long val) | ||
299 | { | 297 | { |
300 | writeq(val, uv_global_mmr32_address(pnode, offset)); | 298 | writeq(val, uv_global_mmr32_address(pnode, offset)); |
301 | } | 299 | } |
302 | 300 | ||
303 | static inline unsigned long uv_read_global_mmr32(int pnode, | 301 | static inline unsigned long uv_read_global_mmr32(int pnode, unsigned long offset) |
304 | unsigned long offset) | ||
305 | { | 302 | { |
306 | return readq(uv_global_mmr32_address(pnode, offset)); | 303 | return readq(uv_global_mmr32_address(pnode, offset)); |
307 | } | 304 | } |
@@ -310,21 +307,18 @@ static inline unsigned long uv_read_global_mmr32(int pnode, | |||
310 | * Access Global MMR space using the MMR space located at the top of physical | 307 | * Access Global MMR space using the MMR space located at the top of physical |
311 | * memory. | 308 | * memory. |
312 | */ | 309 | */ |
313 | static inline unsigned long *uv_global_mmr64_address(int pnode, | 310 | static inline unsigned long *uv_global_mmr64_address(int pnode, unsigned long offset) |
314 | unsigned long offset) | ||
315 | { | 311 | { |
316 | return __va(UV_GLOBAL_MMR64_BASE | | 312 | return __va(UV_GLOBAL_MMR64_BASE | |
317 | UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset); | 313 | UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset); |
318 | } | 314 | } |
319 | 315 | ||
320 | static inline void uv_write_global_mmr64(int pnode, unsigned long offset, | 316 | static inline void uv_write_global_mmr64(int pnode, unsigned long offset, unsigned long val) |
321 | unsigned long val) | ||
322 | { | 317 | { |
323 | writeq(val, uv_global_mmr64_address(pnode, offset)); | 318 | writeq(val, uv_global_mmr64_address(pnode, offset)); |
324 | } | 319 | } |
325 | 320 | ||
326 | static inline unsigned long uv_read_global_mmr64(int pnode, | 321 | static inline unsigned long uv_read_global_mmr64(int pnode, unsigned long offset) |
327 | unsigned long offset) | ||
328 | { | 322 | { |
329 | return readq(uv_global_mmr64_address(pnode, offset)); | 323 | return readq(uv_global_mmr64_address(pnode, offset)); |
330 | } | 324 | } |
@@ -338,6 +332,16 @@ static inline unsigned long uv_global_gru_mmr_address(int pnode, unsigned long o | |||
338 | return UV_GLOBAL_GRU_MMR_BASE | offset | (pnode << uv_hub_info->m_val); | 332 | return UV_GLOBAL_GRU_MMR_BASE | offset | (pnode << uv_hub_info->m_val); |
339 | } | 333 | } |
340 | 334 | ||
335 | static inline void uv_write_global_mmr8(int pnode, unsigned long offset, unsigned char val) | ||
336 | { | ||
337 | writeb(val, uv_global_mmr64_address(pnode, offset)); | ||
338 | } | ||
339 | |||
340 | static inline unsigned char uv_read_global_mmr8(int pnode, unsigned long offset) | ||
341 | { | ||
342 | return readb(uv_global_mmr64_address(pnode, offset)); | ||
343 | } | ||
344 | |||
341 | /* | 345 | /* |
342 | * Access hub local MMRs. Faster than using global space but only local MMRs | 346 | * Access hub local MMRs. Faster than using global space but only local MMRs |
343 | * are accessible. | 347 | * are accessible. |
@@ -457,11 +461,17 @@ static inline void uv_set_scir_bits(unsigned char value) | |||
457 | } | 461 | } |
458 | } | 462 | } |
459 | 463 | ||
464 | static inline unsigned long uv_scir_offset(int apicid) | ||
465 | { | ||
466 | return SCIR_LOCAL_MMR_BASE | (apicid & 0x3f); | ||
467 | } | ||
468 | |||
460 | static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value) | 469 | static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value) |
461 | { | 470 | { |
462 | if (uv_cpu_hub_info(cpu)->scir.state != value) { | 471 | if (uv_cpu_hub_info(cpu)->scir.state != value) { |
472 | uv_write_global_mmr8(uv_cpu_to_pnode(cpu), | ||
473 | uv_cpu_hub_info(cpu)->scir.offset, value); | ||
463 | uv_cpu_hub_info(cpu)->scir.state = value; | 474 | uv_cpu_hub_info(cpu)->scir.state = value; |
464 | uv_write_local_mmr8(uv_cpu_hub_info(cpu)->scir.offset, value); | ||
465 | } | 475 | } |
466 | } | 476 | } |
467 | 477 | ||
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index 82e508677b91..f9961034e557 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c | |||
@@ -162,6 +162,8 @@ static int __init acpi_sleep_setup(char *str) | |||
162 | #endif | 162 | #endif |
163 | if (strncmp(str, "old_ordering", 12) == 0) | 163 | if (strncmp(str, "old_ordering", 12) == 0) |
164 | acpi_old_suspend_ordering(); | 164 | acpi_old_suspend_ordering(); |
165 | if (strncmp(str, "sci_force_enable", 16) == 0) | ||
166 | acpi_set_sci_en_on_resume(); | ||
165 | str = strchr(str, ','); | 167 | str = strchr(str, ','); |
166 | if (str != NULL) | 168 | if (str != NULL) |
167 | str += strspn(str, ", \t"); | 169 | str += strspn(str, ", \t"); |
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 1dca9c34eaeb..fb490ce7dd55 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -138,6 +138,11 @@ int amd_iommus_present; | |||
138 | bool amd_iommu_np_cache __read_mostly; | 138 | bool amd_iommu_np_cache __read_mostly; |
139 | 139 | ||
140 | /* | 140 | /* |
141 | * Set to true if ACPI table parsing and hardware intialization went properly | ||
142 | */ | ||
143 | static bool amd_iommu_initialized; | ||
144 | |||
145 | /* | ||
141 | * List of protection domains - used during resume | 146 | * List of protection domains - used during resume |
142 | */ | 147 | */ |
143 | LIST_HEAD(amd_iommu_pd_list); | 148 | LIST_HEAD(amd_iommu_pd_list); |
@@ -929,6 +934,8 @@ static int __init init_iommu_all(struct acpi_table_header *table) | |||
929 | } | 934 | } |
930 | WARN_ON(p != end); | 935 | WARN_ON(p != end); |
931 | 936 | ||
937 | amd_iommu_initialized = true; | ||
938 | |||
932 | return 0; | 939 | return 0; |
933 | } | 940 | } |
934 | 941 | ||
@@ -1263,6 +1270,9 @@ static int __init amd_iommu_init(void) | |||
1263 | if (acpi_table_parse("IVRS", init_iommu_all) != 0) | 1270 | if (acpi_table_parse("IVRS", init_iommu_all) != 0) |
1264 | goto free; | 1271 | goto free; |
1265 | 1272 | ||
1273 | if (!amd_iommu_initialized) | ||
1274 | goto free; | ||
1275 | |||
1266 | if (acpi_table_parse("IVRS", init_memory_definitions) != 0) | 1276 | if (acpi_table_parse("IVRS", init_memory_definitions) != 0) |
1267 | goto free; | 1277 | goto free; |
1268 | 1278 | ||
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index aa57c079c98f..e80f291472a4 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -62,7 +62,7 @@ unsigned int boot_cpu_physical_apicid = -1U; | |||
62 | /* | 62 | /* |
63 | * The highest APIC ID seen during enumeration. | 63 | * The highest APIC ID seen during enumeration. |
64 | * | 64 | * |
65 | * On AMD, this determines the messaging protocol we can use: if all APIC IDs | 65 | * This determines the messaging protocol we can use: if all APIC IDs |
66 | * are in the 0 ... 7 range, then we can use logical addressing which | 66 | * are in the 0 ... 7 range, then we can use logical addressing which |
67 | * has some performance advantages (better broadcasting). | 67 | * has some performance advantages (better broadcasting). |
68 | * | 68 | * |
@@ -1898,14 +1898,24 @@ void __cpuinit generic_processor_info(int apicid, int version) | |||
1898 | max_physical_apicid = apicid; | 1898 | max_physical_apicid = apicid; |
1899 | 1899 | ||
1900 | #ifdef CONFIG_X86_32 | 1900 | #ifdef CONFIG_X86_32 |
1901 | switch (boot_cpu_data.x86_vendor) { | 1901 | /* |
1902 | case X86_VENDOR_INTEL: | 1902 | * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y |
1903 | if (num_processors > 8) | 1903 | * but we need to work other dependencies like SMP_SUSPEND etc |
1904 | def_to_bigsmp = 1; | 1904 | * before this can be done without some confusion. |
1905 | break; | 1905 | * if (CPU_HOTPLUG_ENABLED || num_processors > 8) |
1906 | case X86_VENDOR_AMD: | 1906 | * - Ashok Raj <ashok.raj@intel.com> |
1907 | if (max_physical_apicid >= 8) | 1907 | */ |
1908 | if (max_physical_apicid >= 8) { | ||
1909 | switch (boot_cpu_data.x86_vendor) { | ||
1910 | case X86_VENDOR_INTEL: | ||
1911 | if (!APIC_XAPIC(version)) { | ||
1912 | def_to_bigsmp = 0; | ||
1913 | break; | ||
1914 | } | ||
1915 | /* If P4 and above fall through */ | ||
1916 | case X86_VENDOR_AMD: | ||
1908 | def_to_bigsmp = 1; | 1917 | def_to_bigsmp = 1; |
1918 | } | ||
1909 | } | 1919 | } |
1910 | #endif | 1920 | #endif |
1911 | 1921 | ||
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index de00c4619a55..53243ca7816d 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -2434,6 +2434,13 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void) | |||
2434 | cfg = irq_cfg(irq); | 2434 | cfg = irq_cfg(irq); |
2435 | raw_spin_lock(&desc->lock); | 2435 | raw_spin_lock(&desc->lock); |
2436 | 2436 | ||
2437 | /* | ||
2438 | * Check if the irq migration is in progress. If so, we | ||
2439 | * haven't received the cleanup request yet for this irq. | ||
2440 | */ | ||
2441 | if (cfg->move_in_progress) | ||
2442 | goto unlock; | ||
2443 | |||
2437 | if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain)) | 2444 | if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain)) |
2438 | goto unlock; | 2445 | goto unlock; |
2439 | 2446 | ||
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c index c4cbd3080c1c..65edc180fc82 100644 --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c | |||
@@ -64,23 +64,16 @@ void __init default_setup_apic_routing(void) | |||
64 | apic = &apic_x2apic_phys; | 64 | apic = &apic_x2apic_phys; |
65 | else | 65 | else |
66 | apic = &apic_x2apic_cluster; | 66 | apic = &apic_x2apic_cluster; |
67 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); | ||
67 | } | 68 | } |
68 | #endif | 69 | #endif |
69 | 70 | ||
70 | if (apic == &apic_flat) { | 71 | if (apic == &apic_flat) { |
71 | switch (boot_cpu_data.x86_vendor) { | 72 | if (max_physical_apicid >= 8) |
72 | case X86_VENDOR_INTEL: | 73 | apic = &apic_physflat; |
73 | if (num_processors > 8) | 74 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); |
74 | apic = &apic_physflat; | ||
75 | break; | ||
76 | case X86_VENDOR_AMD: | ||
77 | if (max_physical_apicid >= 8) | ||
78 | apic = &apic_physflat; | ||
79 | } | ||
80 | } | 75 | } |
81 | 76 | ||
82 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); | ||
83 | |||
84 | if (is_vsmp_box()) { | 77 | if (is_vsmp_box()) { |
85 | /* need to update phys_pkg_id */ | 78 | /* need to update phys_pkg_id */ |
86 | apic->phys_pkg_id = apicid_phys_pkg_id; | 79 | apic->phys_pkg_id = apicid_phys_pkg_id; |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index d56b0efb2057..5f92494dab61 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -629,8 +629,10 @@ void __init uv_system_init(void) | |||
629 | uv_rtc_init(); | 629 | uv_rtc_init(); |
630 | 630 | ||
631 | for_each_present_cpu(cpu) { | 631 | for_each_present_cpu(cpu) { |
632 | int apicid = per_cpu(x86_cpu_to_apicid, cpu); | ||
633 | |||
632 | nid = cpu_to_node(cpu); | 634 | nid = cpu_to_node(cpu); |
633 | pnode = uv_apicid_to_pnode(per_cpu(x86_cpu_to_apicid, cpu)); | 635 | pnode = uv_apicid_to_pnode(apicid); |
634 | blade = boot_pnode_to_blade(pnode); | 636 | blade = boot_pnode_to_blade(pnode); |
635 | lcpu = uv_blade_info[blade].nr_possible_cpus; | 637 | lcpu = uv_blade_info[blade].nr_possible_cpus; |
636 | uv_blade_info[blade].nr_possible_cpus++; | 638 | uv_blade_info[blade].nr_possible_cpus++; |
@@ -651,15 +653,13 @@ void __init uv_system_init(void) | |||
651 | uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra; | 653 | uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra; |
652 | uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base; | 654 | uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base; |
653 | uv_cpu_hub_info(cpu)->coherency_domain_number = sn_coherency_id; | 655 | uv_cpu_hub_info(cpu)->coherency_domain_number = sn_coherency_id; |
654 | uv_cpu_hub_info(cpu)->scir.offset = SCIR_LOCAL_MMR_BASE + lcpu; | 656 | uv_cpu_hub_info(cpu)->scir.offset = uv_scir_offset(apicid); |
655 | uv_node_to_blade[nid] = blade; | 657 | uv_node_to_blade[nid] = blade; |
656 | uv_cpu_to_blade[cpu] = blade; | 658 | uv_cpu_to_blade[cpu] = blade; |
657 | max_pnode = max(pnode, max_pnode); | 659 | max_pnode = max(pnode, max_pnode); |
658 | 660 | ||
659 | printk(KERN_DEBUG "UV: cpu %d, apicid 0x%x, pnode %d, nid %d, " | 661 | printk(KERN_DEBUG "UV: cpu %d, apicid 0x%x, pnode %d, nid %d, lcpu %d, blade %d\n", |
660 | "lcpu %d, blade %d\n", | 662 | cpu, apicid, pnode, nid, lcpu, blade); |
661 | cpu, per_cpu(x86_cpu_to_apicid, cpu), pnode, nid, | ||
662 | lcpu, blade); | ||
663 | } | 663 | } |
664 | 664 | ||
665 | /* Add blade/pnode info for nodes without cpus */ | 665 | /* Add blade/pnode info for nodes without cpus */ |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index c223b7e895d9..d616c06e99b4 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -2347,7 +2347,7 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry) | |||
2347 | callchain_store(entry, PERF_CONTEXT_KERNEL); | 2347 | callchain_store(entry, PERF_CONTEXT_KERNEL); |
2348 | callchain_store(entry, regs->ip); | 2348 | callchain_store(entry, regs->ip); |
2349 | 2349 | ||
2350 | dump_trace(NULL, regs, NULL, 0, &backtrace_ops, entry); | 2350 | dump_trace(NULL, regs, NULL, regs->bp, &backtrace_ops, entry); |
2351 | } | 2351 | } |
2352 | 2352 | ||
2353 | /* | 2353 | /* |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 05ed7ab2ca48..a1a7876cadcb 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -733,13 +733,13 @@ struct early_res { | |||
733 | }; | 733 | }; |
734 | static struct early_res early_res[MAX_EARLY_RES] __initdata = { | 734 | static struct early_res early_res[MAX_EARLY_RES] __initdata = { |
735 | { 0, PAGE_SIZE, "BIOS data page", 1 }, /* BIOS data page */ | 735 | { 0, PAGE_SIZE, "BIOS data page", 1 }, /* BIOS data page */ |
736 | #ifdef CONFIG_X86_32 | 736 | #if defined(CONFIG_X86_32) && defined(CONFIG_X86_TRAMPOLINE) |
737 | /* | 737 | /* |
738 | * But first pinch a few for the stack/trampoline stuff | 738 | * But first pinch a few for the stack/trampoline stuff |
739 | * FIXME: Don't need the extra page at 4K, but need to fix | 739 | * FIXME: Don't need the extra page at 4K, but need to fix |
740 | * trampoline before removing it. (see the GDT stuff) | 740 | * trampoline before removing it. (see the GDT stuff) |
741 | */ | 741 | */ |
742 | { PAGE_SIZE, PAGE_SIZE, "EX TRAMPOLINE", 1 }, | 742 | { PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE", 1 }, |
743 | #endif | 743 | #endif |
744 | 744 | ||
745 | {} | 745 | {} |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 98c2cdeb599e..c6ee241c8a98 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -103,8 +103,8 @@ void show_regs_common(void) | |||
103 | if (!product) | 103 | if (!product) |
104 | product = ""; | 104 | product = ""; |
105 | 105 | ||
106 | printk("\n"); | 106 | printk(KERN_CONT "\n"); |
107 | printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s %s/%s\n", | 107 | printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s/%s\n", |
108 | current->pid, current->comm, print_tainted(), | 108 | current->pid, current->comm, print_tainted(), |
109 | init_utsname()->release, | 109 | init_utsname()->release, |
110 | (int)strcspn(init_utsname()->version, " "), | 110 | (int)strcspn(init_utsname()->version, " "), |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 9c517b5858f0..37ad1e046aae 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -139,16 +139,16 @@ void __show_regs(struct pt_regs *regs, int all) | |||
139 | 139 | ||
140 | show_regs_common(); | 140 | show_regs_common(); |
141 | 141 | ||
142 | printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", | 142 | printk(KERN_DEFAULT "EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", |
143 | (u16)regs->cs, regs->ip, regs->flags, | 143 | (u16)regs->cs, regs->ip, regs->flags, |
144 | smp_processor_id()); | 144 | smp_processor_id()); |
145 | print_symbol("EIP is at %s\n", regs->ip); | 145 | print_symbol("EIP is at %s\n", regs->ip); |
146 | 146 | ||
147 | printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", | 147 | printk(KERN_DEFAULT "EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", |
148 | regs->ax, regs->bx, regs->cx, regs->dx); | 148 | regs->ax, regs->bx, regs->cx, regs->dx); |
149 | printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", | 149 | printk(KERN_DEFAULT "ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", |
150 | regs->si, regs->di, regs->bp, sp); | 150 | regs->si, regs->di, regs->bp, sp); |
151 | printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", | 151 | printk(KERN_DEFAULT " DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", |
152 | (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss); | 152 | (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss); |
153 | 153 | ||
154 | if (!all) | 154 | if (!all) |
@@ -158,19 +158,19 @@ void __show_regs(struct pt_regs *regs, int all) | |||
158 | cr2 = read_cr2(); | 158 | cr2 = read_cr2(); |
159 | cr3 = read_cr3(); | 159 | cr3 = read_cr3(); |
160 | cr4 = read_cr4_safe(); | 160 | cr4 = read_cr4_safe(); |
161 | printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", | 161 | printk(KERN_DEFAULT "CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", |
162 | cr0, cr2, cr3, cr4); | 162 | cr0, cr2, cr3, cr4); |
163 | 163 | ||
164 | get_debugreg(d0, 0); | 164 | get_debugreg(d0, 0); |
165 | get_debugreg(d1, 1); | 165 | get_debugreg(d1, 1); |
166 | get_debugreg(d2, 2); | 166 | get_debugreg(d2, 2); |
167 | get_debugreg(d3, 3); | 167 | get_debugreg(d3, 3); |
168 | printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", | 168 | printk(KERN_DEFAULT "DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", |
169 | d0, d1, d2, d3); | 169 | d0, d1, d2, d3); |
170 | 170 | ||
171 | get_debugreg(d6, 6); | 171 | get_debugreg(d6, 6); |
172 | get_debugreg(d7, 7); | 172 | get_debugreg(d7, 7); |
173 | printk("DR6: %08lx DR7: %08lx\n", | 173 | printk(KERN_DEFAULT "DR6: %08lx DR7: %08lx\n", |
174 | d6, d7); | 174 | d6, d7); |
175 | } | 175 | } |
176 | 176 | ||
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 52fbd0c60198..f9e033150cdf 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -161,19 +161,19 @@ void __show_regs(struct pt_regs *regs, int all) | |||
161 | unsigned int ds, cs, es; | 161 | unsigned int ds, cs, es; |
162 | 162 | ||
163 | show_regs_common(); | 163 | show_regs_common(); |
164 | printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); | 164 | printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); |
165 | printk_address(regs->ip, 1); | 165 | printk_address(regs->ip, 1); |
166 | printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, | 166 | printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, |
167 | regs->sp, regs->flags); | 167 | regs->sp, regs->flags); |
168 | printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n", | 168 | printk(KERN_DEFAULT "RAX: %016lx RBX: %016lx RCX: %016lx\n", |
169 | regs->ax, regs->bx, regs->cx); | 169 | regs->ax, regs->bx, regs->cx); |
170 | printk(KERN_INFO "RDX: %016lx RSI: %016lx RDI: %016lx\n", | 170 | printk(KERN_DEFAULT "RDX: %016lx RSI: %016lx RDI: %016lx\n", |
171 | regs->dx, regs->si, regs->di); | 171 | regs->dx, regs->si, regs->di); |
172 | printk(KERN_INFO "RBP: %016lx R08: %016lx R09: %016lx\n", | 172 | printk(KERN_DEFAULT "RBP: %016lx R08: %016lx R09: %016lx\n", |
173 | regs->bp, regs->r8, regs->r9); | 173 | regs->bp, regs->r8, regs->r9); |
174 | printk(KERN_INFO "R10: %016lx R11: %016lx R12: %016lx\n", | 174 | printk(KERN_DEFAULT "R10: %016lx R11: %016lx R12: %016lx\n", |
175 | regs->r10, regs->r11, regs->r12); | 175 | regs->r10, regs->r11, regs->r12); |
176 | printk(KERN_INFO "R13: %016lx R14: %016lx R15: %016lx\n", | 176 | printk(KERN_DEFAULT "R13: %016lx R14: %016lx R15: %016lx\n", |
177 | regs->r13, regs->r14, regs->r15); | 177 | regs->r13, regs->r14, regs->r15); |
178 | 178 | ||
179 | asm("movl %%ds,%0" : "=r" (ds)); | 179 | asm("movl %%ds,%0" : "=r" (ds)); |
@@ -194,21 +194,21 @@ void __show_regs(struct pt_regs *regs, int all) | |||
194 | cr3 = read_cr3(); | 194 | cr3 = read_cr3(); |
195 | cr4 = read_cr4(); | 195 | cr4 = read_cr4(); |
196 | 196 | ||
197 | printk(KERN_INFO "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", | 197 | printk(KERN_DEFAULT "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", |
198 | fs, fsindex, gs, gsindex, shadowgs); | 198 | fs, fsindex, gs, gsindex, shadowgs); |
199 | printk(KERN_INFO "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, | 199 | printk(KERN_DEFAULT "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, |
200 | es, cr0); | 200 | es, cr0); |
201 | printk(KERN_INFO "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, | 201 | printk(KERN_DEFAULT "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, |
202 | cr4); | 202 | cr4); |
203 | 203 | ||
204 | get_debugreg(d0, 0); | 204 | get_debugreg(d0, 0); |
205 | get_debugreg(d1, 1); | 205 | get_debugreg(d1, 1); |
206 | get_debugreg(d2, 2); | 206 | get_debugreg(d2, 2); |
207 | printk(KERN_INFO "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); | 207 | printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); |
208 | get_debugreg(d3, 3); | 208 | get_debugreg(d3, 3); |
209 | get_debugreg(d6, 6); | 209 | get_debugreg(d6, 6); |
210 | get_debugreg(d7, 7); | 210 | get_debugreg(d7, 7); |
211 | printk(KERN_INFO "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); | 211 | printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); |
212 | } | 212 | } |
213 | 213 | ||
214 | void show_regs(struct pt_regs *regs) | 214 | void show_regs(struct pt_regs *regs) |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index cd60c0bd1b32..3063a0c4858b 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -1150,6 +1150,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu) | |||
1150 | hrtimer_cancel(&apic->lapic_timer.timer); | 1150 | hrtimer_cancel(&apic->lapic_timer.timer); |
1151 | update_divide_count(apic); | 1151 | update_divide_count(apic); |
1152 | start_apic_timer(apic); | 1152 | start_apic_timer(apic); |
1153 | apic->irr_pending = true; | ||
1153 | } | 1154 | } |
1154 | 1155 | ||
1155 | void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu) | 1156 | void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index a6017132fba8..58a0f1e88596 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -455,8 +455,6 @@ out_unlock: | |||
455 | static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) | 455 | static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) |
456 | { | 456 | { |
457 | struct kvm_shadow_walk_iterator iterator; | 457 | struct kvm_shadow_walk_iterator iterator; |
458 | pt_element_t gpte; | ||
459 | gpa_t pte_gpa = -1; | ||
460 | int level; | 458 | int level; |
461 | u64 *sptep; | 459 | u64 *sptep; |
462 | int need_flush = 0; | 460 | int need_flush = 0; |
@@ -470,10 +468,6 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) | |||
470 | if (level == PT_PAGE_TABLE_LEVEL || | 468 | if (level == PT_PAGE_TABLE_LEVEL || |
471 | ((level == PT_DIRECTORY_LEVEL && is_large_pte(*sptep))) || | 469 | ((level == PT_DIRECTORY_LEVEL && is_large_pte(*sptep))) || |
472 | ((level == PT_PDPE_LEVEL && is_large_pte(*sptep)))) { | 470 | ((level == PT_PDPE_LEVEL && is_large_pte(*sptep)))) { |
473 | struct kvm_mmu_page *sp = page_header(__pa(sptep)); | ||
474 | |||
475 | pte_gpa = (sp->gfn << PAGE_SHIFT); | ||
476 | pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t); | ||
477 | 471 | ||
478 | if (is_shadow_present_pte(*sptep)) { | 472 | if (is_shadow_present_pte(*sptep)) { |
479 | rmap_remove(vcpu->kvm, sptep); | 473 | rmap_remove(vcpu->kvm, sptep); |
@@ -492,18 +486,6 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) | |||
492 | if (need_flush) | 486 | if (need_flush) |
493 | kvm_flush_remote_tlbs(vcpu->kvm); | 487 | kvm_flush_remote_tlbs(vcpu->kvm); |
494 | spin_unlock(&vcpu->kvm->mmu_lock); | 488 | spin_unlock(&vcpu->kvm->mmu_lock); |
495 | |||
496 | if (pte_gpa == -1) | ||
497 | return; | ||
498 | if (kvm_read_guest_atomic(vcpu->kvm, pte_gpa, &gpte, | ||
499 | sizeof(pt_element_t))) | ||
500 | return; | ||
501 | if (is_present_gpte(gpte) && (gpte & PT_ACCESSED_MASK)) { | ||
502 | if (mmu_topup_memory_caches(vcpu)) | ||
503 | return; | ||
504 | kvm_mmu_pte_write(vcpu, pte_gpa, (const u8 *)&gpte, | ||
505 | sizeof(pt_element_t), 0); | ||
506 | } | ||
507 | } | 489 | } |
508 | 490 | ||
509 | static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr) | 491 | static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 9d068966fb2a..6651dbf58675 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1913,7 +1913,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, | |||
1913 | 1913 | ||
1914 | events->sipi_vector = vcpu->arch.sipi_vector; | 1914 | events->sipi_vector = vcpu->arch.sipi_vector; |
1915 | 1915 | ||
1916 | events->flags = 0; | 1916 | events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING |
1917 | | KVM_VCPUEVENT_VALID_SIPI_VECTOR); | ||
1917 | 1918 | ||
1918 | vcpu_put(vcpu); | 1919 | vcpu_put(vcpu); |
1919 | } | 1920 | } |
@@ -1921,7 +1922,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, | |||
1921 | static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, | 1922 | static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, |
1922 | struct kvm_vcpu_events *events) | 1923 | struct kvm_vcpu_events *events) |
1923 | { | 1924 | { |
1924 | if (events->flags) | 1925 | if (events->flags & ~(KVM_VCPUEVENT_VALID_NMI_PENDING |
1926 | | KVM_VCPUEVENT_VALID_SIPI_VECTOR)) | ||
1925 | return -EINVAL; | 1927 | return -EINVAL; |
1926 | 1928 | ||
1927 | vcpu_load(vcpu); | 1929 | vcpu_load(vcpu); |
@@ -1938,10 +1940,12 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, | |||
1938 | kvm_pic_clear_isr_ack(vcpu->kvm); | 1940 | kvm_pic_clear_isr_ack(vcpu->kvm); |
1939 | 1941 | ||
1940 | vcpu->arch.nmi_injected = events->nmi.injected; | 1942 | vcpu->arch.nmi_injected = events->nmi.injected; |
1941 | vcpu->arch.nmi_pending = events->nmi.pending; | 1943 | if (events->flags & KVM_VCPUEVENT_VALID_NMI_PENDING) |
1944 | vcpu->arch.nmi_pending = events->nmi.pending; | ||
1942 | kvm_x86_ops->set_nmi_mask(vcpu, events->nmi.masked); | 1945 | kvm_x86_ops->set_nmi_mask(vcpu, events->nmi.masked); |
1943 | 1946 | ||
1944 | vcpu->arch.sipi_vector = events->sipi_vector; | 1947 | if (events->flags & KVM_VCPUEVENT_VALID_SIPI_VECTOR) |
1948 | vcpu->arch.sipi_vector = events->sipi_vector; | ||
1945 | 1949 | ||
1946 | vcpu_put(vcpu); | 1950 | vcpu_put(vcpu); |
1947 | 1951 | ||
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index c973f8e2a6cf..9a0c258a86be 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -892,8 +892,7 @@ void __init mem_init(void) | |||
892 | reservedpages << (PAGE_SHIFT-10), | 892 | reservedpages << (PAGE_SHIFT-10), |
893 | datasize >> 10, | 893 | datasize >> 10, |
894 | initsize >> 10, | 894 | initsize >> 10, |
895 | (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) | 895 | totalhigh_pages << (PAGE_SHIFT-10)); |
896 | ); | ||
897 | 896 | ||
898 | printk(KERN_INFO "virtual kernel memory layout:\n" | 897 | printk(KERN_INFO "virtual kernel memory layout:\n" |
899 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" | 898 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" |
diff --git a/arch/x86/mm/kmemcheck/error.c b/arch/x86/mm/kmemcheck/error.c index 4901d0dafda6..af3b6c8a436f 100644 --- a/arch/x86/mm/kmemcheck/error.c +++ b/arch/x86/mm/kmemcheck/error.c | |||
@@ -106,26 +106,25 @@ void kmemcheck_error_recall(void) | |||
106 | 106 | ||
107 | switch (e->type) { | 107 | switch (e->type) { |
108 | case KMEMCHECK_ERROR_INVALID_ACCESS: | 108 | case KMEMCHECK_ERROR_INVALID_ACCESS: |
109 | printk(KERN_ERR "WARNING: kmemcheck: Caught %d-bit read " | 109 | printk(KERN_WARNING "WARNING: kmemcheck: Caught %d-bit read from %s memory (%p)\n", |
110 | "from %s memory (%p)\n", | ||
111 | 8 * e->size, e->state < ARRAY_SIZE(desc) ? | 110 | 8 * e->size, e->state < ARRAY_SIZE(desc) ? |
112 | desc[e->state] : "(invalid shadow state)", | 111 | desc[e->state] : "(invalid shadow state)", |
113 | (void *) e->address); | 112 | (void *) e->address); |
114 | 113 | ||
115 | printk(KERN_INFO); | 114 | printk(KERN_WARNING); |
116 | for (i = 0; i < SHADOW_COPY_SIZE; ++i) | 115 | for (i = 0; i < SHADOW_COPY_SIZE; ++i) |
117 | printk("%02x", e->memory_copy[i]); | 116 | printk(KERN_CONT "%02x", e->memory_copy[i]); |
118 | printk("\n"); | 117 | printk(KERN_CONT "\n"); |
119 | 118 | ||
120 | printk(KERN_INFO); | 119 | printk(KERN_WARNING); |
121 | for (i = 0; i < SHADOW_COPY_SIZE; ++i) { | 120 | for (i = 0; i < SHADOW_COPY_SIZE; ++i) { |
122 | if (e->shadow_copy[i] < ARRAY_SIZE(short_desc)) | 121 | if (e->shadow_copy[i] < ARRAY_SIZE(short_desc)) |
123 | printk(" %c", short_desc[e->shadow_copy[i]]); | 122 | printk(KERN_CONT " %c", short_desc[e->shadow_copy[i]]); |
124 | else | 123 | else |
125 | printk(" ?"); | 124 | printk(KERN_CONT " ?"); |
126 | } | 125 | } |
127 | printk("\n"); | 126 | printk(KERN_CONT "\n"); |
128 | printk(KERN_INFO "%*c\n", 2 + 2 | 127 | printk(KERN_WARNING "%*c\n", 2 + 2 |
129 | * (int) (e->address & (SHADOW_COPY_SIZE - 1)), '^'); | 128 | * (int) (e->address & (SHADOW_COPY_SIZE - 1)), '^'); |
130 | break; | 129 | break; |
131 | case KMEMCHECK_ERROR_BUG: | 130 | case KMEMCHECK_ERROR_BUG: |
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c index 145df00e0387..f939d603adfa 100644 --- a/arch/x86/pci/bus_numa.c +++ b/arch/x86/pci/bus_numa.c | |||
@@ -51,7 +51,7 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b) | |||
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | void __init update_res(struct pci_root_info *info, size_t start, | 54 | void __devinit update_res(struct pci_root_info *info, size_t start, |
55 | size_t end, unsigned long flags, int merge) | 55 | size_t end, unsigned long flags, int merge) |
56 | { | 56 | { |
57 | int i; | 57 | int i; |
diff --git a/arch/x86/pci/intel_bus.c b/arch/x86/pci/intel_bus.c index b7a55dc55d13..f81a2fa8fe25 100644 --- a/arch/x86/pci/intel_bus.c +++ b/arch/x86/pci/intel_bus.c | |||
@@ -49,6 +49,10 @@ static void __devinit pci_root_bus_res(struct pci_dev *dev) | |||
49 | u64 mmioh_base, mmioh_end; | 49 | u64 mmioh_base, mmioh_end; |
50 | int bus_base, bus_end; | 50 | int bus_base, bus_end; |
51 | 51 | ||
52 | /* some sys doesn't get mmconf enabled */ | ||
53 | if (dev->cfg_size < 0x120) | ||
54 | return; | ||
55 | |||
52 | if (pci_root_num >= PCI_ROOT_NR) { | 56 | if (pci_root_num >= PCI_ROOT_NR) { |
53 | printk(KERN_DEBUG "intel_bus.c: PCI_ROOT_NR is too small\n"); | 57 | printk(KERN_DEBUG "intel_bus.c: PCI_ROOT_NR is too small\n"); |
54 | return; | 58 | return; |
diff --git a/arch/x86/tools/chkobjdump.awk b/arch/x86/tools/chkobjdump.awk index 5bbb5a33f220..fd1ab80be0de 100644 --- a/arch/x86/tools/chkobjdump.awk +++ b/arch/x86/tools/chkobjdump.awk | |||
@@ -8,14 +8,24 @@ BEGIN { | |||
8 | od_sver = 19; | 8 | od_sver = 19; |
9 | } | 9 | } |
10 | 10 | ||
11 | /^GNU/ { | 11 | /^GNU objdump/ { |
12 | split($3, ver, "."); | 12 | verstr = "" |
13 | for (i = 3; i <= NF; i++) | ||
14 | if (match($(i), "^[0-9]")) { | ||
15 | verstr = $(i); | ||
16 | break; | ||
17 | } | ||
18 | if (verstr == "") { | ||
19 | printf("Warning: Failed to find objdump version number.\n"); | ||
20 | exit 0; | ||
21 | } | ||
22 | split(verstr, ver, "."); | ||
13 | if (ver[1] > od_ver || | 23 | if (ver[1] > od_ver || |
14 | (ver[1] == od_ver && ver[2] >= od_sver)) { | 24 | (ver[1] == od_ver && ver[2] >= od_sver)) { |
15 | exit 1; | 25 | exit 1; |
16 | } else { | 26 | } else { |
17 | printf("Warning: objdump version %s is older than %d.%d\n", | 27 | printf("Warning: objdump version %s is older than %d.%d\n", |
18 | $4, od_ver, od_sver); | 28 | verstr, od_ver, od_sver); |
19 | print("Warning: Skipping posttest."); | 29 | print("Warning: Skipping posttest."); |
20 | # Logic is inverted, because we just skip test without error. | 30 | # Logic is inverted, because we just skip test without error. |
21 | exit 0; | 31 | exit 0; |
diff --git a/block/blk-barrier.c b/block/blk-barrier.c index 8873b9b439ff..8618d8996fea 100644 --- a/block/blk-barrier.c +++ b/block/blk-barrier.c | |||
@@ -402,7 +402,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
402 | * our current implementations need. If we'll ever need | 402 | * our current implementations need. If we'll ever need |
403 | * more the interface will need revisiting. | 403 | * more the interface will need revisiting. |
404 | */ | 404 | */ |
405 | page = alloc_page(GFP_KERNEL | __GFP_ZERO); | 405 | page = alloc_page(gfp_mask | __GFP_ZERO); |
406 | if (!page) | 406 | if (!page) |
407 | goto out_free_bio; | 407 | goto out_free_bio; |
408 | if (bio_add_pc_page(q, bio, page, sector_size, 0) < sector_size) | 408 | if (bio_add_pc_page(q, bio, page, sector_size, 0) < sector_size) |
diff --git a/block/blk-settings.c b/block/blk-settings.c index 6ae118d6e193..d52d4adc440b 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -505,21 +505,30 @@ static unsigned int lcm(unsigned int a, unsigned int b) | |||
505 | 505 | ||
506 | /** | 506 | /** |
507 | * blk_stack_limits - adjust queue_limits for stacked devices | 507 | * blk_stack_limits - adjust queue_limits for stacked devices |
508 | * @t: the stacking driver limits (top) | 508 | * @t: the stacking driver limits (top device) |
509 | * @b: the underlying queue limits (bottom) | 509 | * @b: the underlying queue limits (bottom, component device) |
510 | * @offset: offset to beginning of data within component device | 510 | * @offset: offset to beginning of data within component device |
511 | * | 511 | * |
512 | * Description: | 512 | * Description: |
513 | * Merges two queue_limit structs. Returns 0 if alignment didn't | 513 | * This function is used by stacking drivers like MD and DM to ensure |
514 | * change. Returns -1 if adding the bottom device caused | 514 | * that all component devices have compatible block sizes and |
515 | * misalignment. | 515 | * alignments. The stacking driver must provide a queue_limits |
516 | * struct (top) and then iteratively call the stacking function for | ||
517 | * all component (bottom) devices. The stacking function will | ||
518 | * attempt to combine the values and ensure proper alignment. | ||
519 | * | ||
520 | * Returns 0 if the top and bottom queue_limits are compatible. The | ||
521 | * top device's block sizes and alignment offsets may be adjusted to | ||
522 | * ensure alignment with the bottom device. If no compatible sizes | ||
523 | * and alignments exist, -1 is returned and the resulting top | ||
524 | * queue_limits will have the misaligned flag set to indicate that | ||
525 | * the alignment_offset is undefined. | ||
516 | */ | 526 | */ |
517 | int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | 527 | int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, |
518 | sector_t offset) | 528 | sector_t offset) |
519 | { | 529 | { |
520 | int ret; | 530 | sector_t alignment; |
521 | 531 | unsigned int top, bottom; | |
522 | ret = 0; | ||
523 | 532 | ||
524 | t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); | 533 | t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); |
525 | t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); | 534 | t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); |
@@ -537,6 +546,22 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
537 | t->max_segment_size = min_not_zero(t->max_segment_size, | 546 | t->max_segment_size = min_not_zero(t->max_segment_size, |
538 | b->max_segment_size); | 547 | b->max_segment_size); |
539 | 548 | ||
549 | alignment = queue_limit_alignment_offset(b, offset); | ||
550 | |||
551 | /* Bottom device has different alignment. Check that it is | ||
552 | * compatible with the current top alignment. | ||
553 | */ | ||
554 | if (t->alignment_offset != alignment) { | ||
555 | |||
556 | top = max(t->physical_block_size, t->io_min) | ||
557 | + t->alignment_offset; | ||
558 | bottom = max(b->physical_block_size, b->io_min) + alignment; | ||
559 | |||
560 | /* Verify that top and bottom intervals line up */ | ||
561 | if (max(top, bottom) & (min(top, bottom) - 1)) | ||
562 | t->misaligned = 1; | ||
563 | } | ||
564 | |||
540 | t->logical_block_size = max(t->logical_block_size, | 565 | t->logical_block_size = max(t->logical_block_size, |
541 | b->logical_block_size); | 566 | b->logical_block_size); |
542 | 567 | ||
@@ -544,54 +569,64 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
544 | b->physical_block_size); | 569 | b->physical_block_size); |
545 | 570 | ||
546 | t->io_min = max(t->io_min, b->io_min); | 571 | t->io_min = max(t->io_min, b->io_min); |
572 | t->io_opt = lcm(t->io_opt, b->io_opt); | ||
573 | |||
547 | t->no_cluster |= b->no_cluster; | 574 | t->no_cluster |= b->no_cluster; |
548 | t->discard_zeroes_data &= b->discard_zeroes_data; | 575 | t->discard_zeroes_data &= b->discard_zeroes_data; |
549 | 576 | ||
550 | /* Bottom device offset aligned? */ | 577 | /* Physical block size a multiple of the logical block size? */ |
551 | if (offset && | 578 | if (t->physical_block_size & (t->logical_block_size - 1)) { |
552 | (offset & (b->physical_block_size - 1)) != b->alignment_offset) { | 579 | t->physical_block_size = t->logical_block_size; |
553 | t->misaligned = 1; | 580 | t->misaligned = 1; |
554 | ret = -1; | ||
555 | } | 581 | } |
556 | 582 | ||
557 | /* | 583 | /* Minimum I/O a multiple of the physical block size? */ |
558 | * Temporarily disable discard granularity. It's currently buggy | 584 | if (t->io_min & (t->physical_block_size - 1)) { |
559 | * since we default to 0 for discard_granularity, hence this | 585 | t->io_min = t->physical_block_size; |
560 | * "failure" will always trigger for non-zero offsets. | 586 | t->misaligned = 1; |
561 | */ | ||
562 | #if 0 | ||
563 | if (offset && | ||
564 | (offset & (b->discard_granularity - 1)) != b->discard_alignment) { | ||
565 | t->discard_misaligned = 1; | ||
566 | ret = -1; | ||
567 | } | 587 | } |
568 | #endif | ||
569 | |||
570 | /* If top has no alignment offset, inherit from bottom */ | ||
571 | if (!t->alignment_offset) | ||
572 | t->alignment_offset = | ||
573 | b->alignment_offset & (b->physical_block_size - 1); | ||
574 | 588 | ||
575 | if (!t->discard_alignment) | 589 | /* Optimal I/O a multiple of the physical block size? */ |
576 | t->discard_alignment = | 590 | if (t->io_opt & (t->physical_block_size - 1)) { |
577 | b->discard_alignment & (b->discard_granularity - 1); | 591 | t->io_opt = 0; |
578 | |||
579 | /* Top device aligned on logical block boundary? */ | ||
580 | if (t->alignment_offset & (t->logical_block_size - 1)) { | ||
581 | t->misaligned = 1; | 592 | t->misaligned = 1; |
582 | ret = -1; | ||
583 | } | 593 | } |
584 | 594 | ||
585 | /* Find lcm() of optimal I/O size and granularity */ | 595 | /* Find lowest common alignment_offset */ |
586 | t->io_opt = lcm(t->io_opt, b->io_opt); | 596 | t->alignment_offset = lcm(t->alignment_offset, alignment) |
587 | t->discard_granularity = lcm(t->discard_granularity, | 597 | & (max(t->physical_block_size, t->io_min) - 1); |
588 | b->discard_granularity); | ||
589 | 598 | ||
590 | /* Verify that optimal I/O size is a multiple of io_min */ | 599 | /* Verify that new alignment_offset is on a logical block boundary */ |
591 | if (t->io_min && t->io_opt % t->io_min) | 600 | if (t->alignment_offset & (t->logical_block_size - 1)) |
592 | ret = -1; | 601 | t->misaligned = 1; |
602 | |||
603 | /* Discard alignment and granularity */ | ||
604 | if (b->discard_granularity) { | ||
605 | unsigned int granularity = b->discard_granularity; | ||
606 | offset &= granularity - 1; | ||
607 | |||
608 | alignment = (granularity + b->discard_alignment - offset) | ||
609 | & (granularity - 1); | ||
610 | |||
611 | if (t->discard_granularity != 0 && | ||
612 | t->discard_alignment != alignment) { | ||
613 | top = t->discard_granularity + t->discard_alignment; | ||
614 | bottom = b->discard_granularity + alignment; | ||
615 | |||
616 | /* Verify that top and bottom intervals line up */ | ||
617 | if (max(top, bottom) & (min(top, bottom) - 1)) | ||
618 | t->discard_misaligned = 1; | ||
619 | } | ||
620 | |||
621 | t->max_discard_sectors = min_not_zero(t->max_discard_sectors, | ||
622 | b->max_discard_sectors); | ||
623 | t->discard_granularity = max(t->discard_granularity, | ||
624 | b->discard_granularity); | ||
625 | t->discard_alignment = lcm(t->discard_alignment, alignment) & | ||
626 | (t->discard_granularity - 1); | ||
627 | } | ||
593 | 628 | ||
594 | return ret; | 629 | return t->misaligned ? -1 : 0; |
595 | } | 630 | } |
596 | EXPORT_SYMBOL(blk_stack_limits); | 631 | EXPORT_SYMBOL(blk_stack_limits); |
597 | 632 | ||
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index e2f80463ed0d..918c7fd9aeb1 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -208,8 +208,6 @@ struct cfq_data { | |||
208 | /* Root service tree for cfq_groups */ | 208 | /* Root service tree for cfq_groups */ |
209 | struct cfq_rb_root grp_service_tree; | 209 | struct cfq_rb_root grp_service_tree; |
210 | struct cfq_group root_group; | 210 | struct cfq_group root_group; |
211 | /* Number of active cfq groups on group service tree */ | ||
212 | int nr_groups; | ||
213 | 211 | ||
214 | /* | 212 | /* |
215 | * The priority currently being served | 213 | * The priority currently being served |
@@ -294,8 +292,7 @@ static struct cfq_group *cfq_get_next_cfqg(struct cfq_data *cfqd); | |||
294 | 292 | ||
295 | static struct cfq_rb_root *service_tree_for(struct cfq_group *cfqg, | 293 | static struct cfq_rb_root *service_tree_for(struct cfq_group *cfqg, |
296 | enum wl_prio_t prio, | 294 | enum wl_prio_t prio, |
297 | enum wl_type_t type, | 295 | enum wl_type_t type) |
298 | struct cfq_data *cfqd) | ||
299 | { | 296 | { |
300 | if (!cfqg) | 297 | if (!cfqg) |
301 | return NULL; | 298 | return NULL; |
@@ -842,7 +839,6 @@ cfq_group_service_tree_add(struct cfq_data *cfqd, struct cfq_group *cfqg) | |||
842 | 839 | ||
843 | __cfq_group_service_tree_add(st, cfqg); | 840 | __cfq_group_service_tree_add(st, cfqg); |
844 | cfqg->on_st = true; | 841 | cfqg->on_st = true; |
845 | cfqd->nr_groups++; | ||
846 | st->total_weight += cfqg->weight; | 842 | st->total_weight += cfqg->weight; |
847 | } | 843 | } |
848 | 844 | ||
@@ -863,7 +859,6 @@ cfq_group_service_tree_del(struct cfq_data *cfqd, struct cfq_group *cfqg) | |||
863 | 859 | ||
864 | cfq_log_cfqg(cfqd, cfqg, "del_from_rr group"); | 860 | cfq_log_cfqg(cfqd, cfqg, "del_from_rr group"); |
865 | cfqg->on_st = false; | 861 | cfqg->on_st = false; |
866 | cfqd->nr_groups--; | ||
867 | st->total_weight -= cfqg->weight; | 862 | st->total_weight -= cfqg->weight; |
868 | if (!RB_EMPTY_NODE(&cfqg->rb_node)) | 863 | if (!RB_EMPTY_NODE(&cfqg->rb_node)) |
869 | cfq_rb_erase(&cfqg->rb_node, st); | 864 | cfq_rb_erase(&cfqg->rb_node, st); |
@@ -1150,7 +1145,7 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1150 | #endif | 1145 | #endif |
1151 | 1146 | ||
1152 | service_tree = service_tree_for(cfqq->cfqg, cfqq_prio(cfqq), | 1147 | service_tree = service_tree_for(cfqq->cfqg, cfqq_prio(cfqq), |
1153 | cfqq_type(cfqq), cfqd); | 1148 | cfqq_type(cfqq)); |
1154 | if (cfq_class_idle(cfqq)) { | 1149 | if (cfq_class_idle(cfqq)) { |
1155 | rb_key = CFQ_IDLE_DELAY; | 1150 | rb_key = CFQ_IDLE_DELAY; |
1156 | parent = rb_last(&service_tree->rb); | 1151 | parent = rb_last(&service_tree->rb); |
@@ -1513,9 +1508,6 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq, | |||
1513 | struct cfq_io_context *cic; | 1508 | struct cfq_io_context *cic; |
1514 | struct cfq_queue *cfqq; | 1509 | struct cfq_queue *cfqq; |
1515 | 1510 | ||
1516 | /* Deny merge if bio and rq don't belong to same cfq group */ | ||
1517 | if ((RQ_CFQQ(rq))->cfqg != cfq_get_cfqg(cfqd, 0)) | ||
1518 | return false; | ||
1519 | /* | 1511 | /* |
1520 | * Disallow merge of a sync bio into an async request. | 1512 | * Disallow merge of a sync bio into an async request. |
1521 | */ | 1513 | */ |
@@ -1616,7 +1608,7 @@ static struct cfq_queue *cfq_get_next_queue(struct cfq_data *cfqd) | |||
1616 | { | 1608 | { |
1617 | struct cfq_rb_root *service_tree = | 1609 | struct cfq_rb_root *service_tree = |
1618 | service_tree_for(cfqd->serving_group, cfqd->serving_prio, | 1610 | service_tree_for(cfqd->serving_group, cfqd->serving_prio, |
1619 | cfqd->serving_type, cfqd); | 1611 | cfqd->serving_type); |
1620 | 1612 | ||
1621 | if (!cfqd->rq_queued) | 1613 | if (!cfqd->rq_queued) |
1622 | return NULL; | 1614 | return NULL; |
@@ -1675,13 +1667,17 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd, | |||
1675 | #define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR) | 1667 | #define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR) |
1676 | 1668 | ||
1677 | static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, | 1669 | static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, |
1678 | struct request *rq) | 1670 | struct request *rq, bool for_preempt) |
1679 | { | 1671 | { |
1680 | sector_t sdist = cfqq->seek_mean; | 1672 | sector_t sdist = cfqq->seek_mean; |
1681 | 1673 | ||
1682 | if (!sample_valid(cfqq->seek_samples)) | 1674 | if (!sample_valid(cfqq->seek_samples)) |
1683 | sdist = CFQQ_SEEK_THR; | 1675 | sdist = CFQQ_SEEK_THR; |
1684 | 1676 | ||
1677 | /* if seek_mean is big, using it as close criteria is meaningless */ | ||
1678 | if (sdist > CFQQ_SEEK_THR && !for_preempt) | ||
1679 | sdist = CFQQ_SEEK_THR; | ||
1680 | |||
1685 | return cfq_dist_from_last(cfqd, rq) <= sdist; | 1681 | return cfq_dist_from_last(cfqd, rq) <= sdist; |
1686 | } | 1682 | } |
1687 | 1683 | ||
@@ -1709,7 +1705,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, | |||
1709 | * will contain the closest sector. | 1705 | * will contain the closest sector. |
1710 | */ | 1706 | */ |
1711 | __cfqq = rb_entry(parent, struct cfq_queue, p_node); | 1707 | __cfqq = rb_entry(parent, struct cfq_queue, p_node); |
1712 | if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) | 1708 | if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) |
1713 | return __cfqq; | 1709 | return __cfqq; |
1714 | 1710 | ||
1715 | if (blk_rq_pos(__cfqq->next_rq) < sector) | 1711 | if (blk_rq_pos(__cfqq->next_rq) < sector) |
@@ -1720,7 +1716,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, | |||
1720 | return NULL; | 1716 | return NULL; |
1721 | 1717 | ||
1722 | __cfqq = rb_entry(node, struct cfq_queue, p_node); | 1718 | __cfqq = rb_entry(node, struct cfq_queue, p_node); |
1723 | if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) | 1719 | if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) |
1724 | return __cfqq; | 1720 | return __cfqq; |
1725 | 1721 | ||
1726 | return NULL; | 1722 | return NULL; |
@@ -1963,8 +1959,7 @@ static void cfq_setup_merge(struct cfq_queue *cfqq, struct cfq_queue *new_cfqq) | |||
1963 | } | 1959 | } |
1964 | 1960 | ||
1965 | static enum wl_type_t cfq_choose_wl(struct cfq_data *cfqd, | 1961 | static enum wl_type_t cfq_choose_wl(struct cfq_data *cfqd, |
1966 | struct cfq_group *cfqg, enum wl_prio_t prio, | 1962 | struct cfq_group *cfqg, enum wl_prio_t prio) |
1967 | bool prio_changed) | ||
1968 | { | 1963 | { |
1969 | struct cfq_queue *queue; | 1964 | struct cfq_queue *queue; |
1970 | int i; | 1965 | int i; |
@@ -1972,24 +1967,9 @@ static enum wl_type_t cfq_choose_wl(struct cfq_data *cfqd, | |||
1972 | unsigned long lowest_key = 0; | 1967 | unsigned long lowest_key = 0; |
1973 | enum wl_type_t cur_best = SYNC_NOIDLE_WORKLOAD; | 1968 | enum wl_type_t cur_best = SYNC_NOIDLE_WORKLOAD; |
1974 | 1969 | ||
1975 | if (prio_changed) { | 1970 | for (i = 0; i <= SYNC_WORKLOAD; ++i) { |
1976 | /* | 1971 | /* select the one with lowest rb_key */ |
1977 | * When priorities switched, we prefer starting | 1972 | queue = cfq_rb_first(service_tree_for(cfqg, prio, i)); |
1978 | * from SYNC_NOIDLE (first choice), or just SYNC | ||
1979 | * over ASYNC | ||
1980 | */ | ||
1981 | if (service_tree_for(cfqg, prio, cur_best, cfqd)->count) | ||
1982 | return cur_best; | ||
1983 | cur_best = SYNC_WORKLOAD; | ||
1984 | if (service_tree_for(cfqg, prio, cur_best, cfqd)->count) | ||
1985 | return cur_best; | ||
1986 | |||
1987 | return ASYNC_WORKLOAD; | ||
1988 | } | ||
1989 | |||
1990 | for (i = 0; i < 3; ++i) { | ||
1991 | /* otherwise, select the one with lowest rb_key */ | ||
1992 | queue = cfq_rb_first(service_tree_for(cfqg, prio, i, cfqd)); | ||
1993 | if (queue && | 1973 | if (queue && |
1994 | (!key_valid || time_before(queue->rb_key, lowest_key))) { | 1974 | (!key_valid || time_before(queue->rb_key, lowest_key))) { |
1995 | lowest_key = queue->rb_key; | 1975 | lowest_key = queue->rb_key; |
@@ -2003,8 +1983,6 @@ static enum wl_type_t cfq_choose_wl(struct cfq_data *cfqd, | |||
2003 | 1983 | ||
2004 | static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg) | 1984 | static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg) |
2005 | { | 1985 | { |
2006 | enum wl_prio_t previous_prio = cfqd->serving_prio; | ||
2007 | bool prio_changed; | ||
2008 | unsigned slice; | 1986 | unsigned slice; |
2009 | unsigned count; | 1987 | unsigned count; |
2010 | struct cfq_rb_root *st; | 1988 | struct cfq_rb_root *st; |
@@ -2032,24 +2010,19 @@ static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg) | |||
2032 | * (SYNC, SYNC_NOIDLE, ASYNC), and to compute a workload | 2010 | * (SYNC, SYNC_NOIDLE, ASYNC), and to compute a workload |
2033 | * expiration time | 2011 | * expiration time |
2034 | */ | 2012 | */ |
2035 | prio_changed = (cfqd->serving_prio != previous_prio); | 2013 | st = service_tree_for(cfqg, cfqd->serving_prio, cfqd->serving_type); |
2036 | st = service_tree_for(cfqg, cfqd->serving_prio, cfqd->serving_type, | ||
2037 | cfqd); | ||
2038 | count = st->count; | 2014 | count = st->count; |
2039 | 2015 | ||
2040 | /* | 2016 | /* |
2041 | * If priority didn't change, check workload expiration, | 2017 | * check workload expiration, and that we still have other queues ready |
2042 | * and that we still have other queues ready | ||
2043 | */ | 2018 | */ |
2044 | if (!prio_changed && count && | 2019 | if (count && !time_after(jiffies, cfqd->workload_expires)) |
2045 | !time_after(jiffies, cfqd->workload_expires)) | ||
2046 | return; | 2020 | return; |
2047 | 2021 | ||
2048 | /* otherwise select new workload type */ | 2022 | /* otherwise select new workload type */ |
2049 | cfqd->serving_type = | 2023 | cfqd->serving_type = |
2050 | cfq_choose_wl(cfqd, cfqg, cfqd->serving_prio, prio_changed); | 2024 | cfq_choose_wl(cfqd, cfqg, cfqd->serving_prio); |
2051 | st = service_tree_for(cfqg, cfqd->serving_prio, cfqd->serving_type, | 2025 | st = service_tree_for(cfqg, cfqd->serving_prio, cfqd->serving_type); |
2052 | cfqd); | ||
2053 | count = st->count; | 2026 | count = st->count; |
2054 | 2027 | ||
2055 | /* | 2028 | /* |
@@ -3143,7 +3116,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, | |||
3143 | * if this request is as-good as one we would expect from the | 3116 | * if this request is as-good as one we would expect from the |
3144 | * current cfqq, let it preempt | 3117 | * current cfqq, let it preempt |
3145 | */ | 3118 | */ |
3146 | if (cfq_rq_close(cfqd, cfqq, rq)) | 3119 | if (cfq_rq_close(cfqd, cfqq, rq, true)) |
3147 | return true; | 3120 | return true; |
3148 | 3121 | ||
3149 | return false; | 3122 | return false; |
diff --git a/crypto/async_tx/raid6test.c b/crypto/async_tx/raid6test.c index 3ec27c7e62ea..f84f6b4301d9 100644 --- a/crypto/async_tx/raid6test.c +++ b/crypto/async_tx/raid6test.c | |||
@@ -214,6 +214,13 @@ static int raid6_test(void) | |||
214 | err += test(4, &tests); | 214 | err += test(4, &tests); |
215 | if (NDISKS > 5) | 215 | if (NDISKS > 5) |
216 | err += test(5, &tests); | 216 | err += test(5, &tests); |
217 | /* the 11 and 12 disk cases are special for ioatdma (p-disabled | ||
218 | * q-continuation without extended descriptor) | ||
219 | */ | ||
220 | if (NDISKS > 12) { | ||
221 | err += test(11, &tests); | ||
222 | err += test(12, &tests); | ||
223 | } | ||
217 | err += test(NDISKS, &tests); | 224 | err += test(NDISKS, &tests); |
218 | 225 | ||
219 | pr("\n"); | 226 | pr("\n"); |
diff --git a/drivers/Kconfig b/drivers/Kconfig index 8a07363417ed..368ae6d3a096 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -28,7 +28,7 @@ source "drivers/md/Kconfig" | |||
28 | 28 | ||
29 | source "drivers/message/fusion/Kconfig" | 29 | source "drivers/message/fusion/Kconfig" |
30 | 30 | ||
31 | source "drivers/ieee1394/Kconfig" | 31 | source "drivers/firewire/Kconfig" |
32 | 32 | ||
33 | source "drivers/message/i2o/Kconfig" | 33 | source "drivers/message/i2o/Kconfig" |
34 | 34 | ||
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 5f2c379ab7bf..79d33d908b5a 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -81,6 +81,23 @@ static int acpi_sleep_prepare(u32 acpi_state) | |||
81 | #ifdef CONFIG_ACPI_SLEEP | 81 | #ifdef CONFIG_ACPI_SLEEP |
82 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | 82 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; |
83 | /* | 83 | /* |
84 | * According to the ACPI specification the BIOS should make sure that ACPI is | ||
85 | * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still, | ||
86 | * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI | ||
87 | * on such systems during resume. Unfortunately that doesn't help in | ||
88 | * particularly pathological cases in which SCI_EN has to be set directly on | ||
89 | * resume, although the specification states very clearly that this flag is | ||
90 | * owned by the hardware. The set_sci_en_on_resume variable will be set in such | ||
91 | * cases. | ||
92 | */ | ||
93 | static bool set_sci_en_on_resume; | ||
94 | |||
95 | void __init acpi_set_sci_en_on_resume(void) | ||
96 | { | ||
97 | set_sci_en_on_resume = true; | ||
98 | } | ||
99 | |||
100 | /* | ||
84 | * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the | 101 | * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the |
85 | * user to request that behavior by using the 'acpi_old_suspend_ordering' | 102 | * user to request that behavior by using the 'acpi_old_suspend_ordering' |
86 | * kernel command line option that causes the following variable to be set. | 103 | * kernel command line option that causes the following variable to be set. |
@@ -170,18 +187,6 @@ static void acpi_pm_end(void) | |||
170 | #endif /* CONFIG_ACPI_SLEEP */ | 187 | #endif /* CONFIG_ACPI_SLEEP */ |
171 | 188 | ||
172 | #ifdef CONFIG_SUSPEND | 189 | #ifdef CONFIG_SUSPEND |
173 | /* | ||
174 | * According to the ACPI specification the BIOS should make sure that ACPI is | ||
175 | * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still, | ||
176 | * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI | ||
177 | * on such systems during resume. Unfortunately that doesn't help in | ||
178 | * particularly pathological cases in which SCI_EN has to be set directly on | ||
179 | * resume, although the specification states very clearly that this flag is | ||
180 | * owned by the hardware. The set_sci_en_on_resume variable will be set in such | ||
181 | * cases. | ||
182 | */ | ||
183 | static bool set_sci_en_on_resume; | ||
184 | |||
185 | extern void do_suspend_lowlevel(void); | 190 | extern void do_suspend_lowlevel(void); |
186 | 191 | ||
187 | static u32 acpi_suspend_states[] = { | 192 | static u32 acpi_suspend_states[] = { |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 05dff631591c..72e76b4b6538 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -999,8 +999,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
999 | sprintf(name, "acpi_video%d", count++); | 999 | sprintf(name, "acpi_video%d", count++); |
1000 | device->backlight = backlight_device_register(name, | 1000 | device->backlight = backlight_device_register(name, |
1001 | NULL, device, &acpi_backlight_ops); | 1001 | NULL, device, &acpi_backlight_ops); |
1002 | device->backlight->props.max_brightness = device->brightness->count-3; | ||
1003 | kfree(name); | 1002 | kfree(name); |
1003 | if (IS_ERR(device->backlight)) | ||
1004 | return; | ||
1005 | device->backlight->props.max_brightness = device->brightness->count-3; | ||
1004 | 1006 | ||
1005 | result = sysfs_create_link(&device->backlight->dev.kobj, | 1007 | result = sysfs_create_link(&device->backlight->dev.kobj, |
1006 | &device->dev->dev.kobj, "device"); | 1008 | &device->dev->dev.kobj, "device"); |
@@ -1979,6 +1981,10 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) | |||
1979 | unsigned long long level_current, level_next; | 1981 | unsigned long long level_current, level_next; |
1980 | int result = -EINVAL; | 1982 | int result = -EINVAL; |
1981 | 1983 | ||
1984 | /* no warning message if acpi_backlight=vendor is used */ | ||
1985 | if (!acpi_video_backlight_support()) | ||
1986 | return 0; | ||
1987 | |||
1982 | if (!device->brightness) | 1988 | if (!device->brightness) |
1983 | goto out; | 1989 | goto out; |
1984 | 1990 | ||
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 48adf80926a0..a5142bddef41 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -446,8 +446,8 @@ EXPORT_SYMBOL_GPL(dpm_resume_noirq); | |||
446 | 446 | ||
447 | /** | 447 | /** |
448 | * legacy_resume - Execute a legacy (bus or class) resume callback for device. | 448 | * legacy_resume - Execute a legacy (bus or class) resume callback for device. |
449 | * dev: Device to resume. | 449 | * @dev: Device to resume. |
450 | * cb: Resume callback to execute. | 450 | * @cb: Resume callback to execute. |
451 | */ | 451 | */ |
452 | static int legacy_resume(struct device *dev, int (*cb)(struct device *dev)) | 452 | static int legacy_resume(struct device *dev, int (*cb)(struct device *dev)) |
453 | { | 453 | { |
@@ -711,8 +711,9 @@ EXPORT_SYMBOL_GPL(dpm_suspend_noirq); | |||
711 | 711 | ||
712 | /** | 712 | /** |
713 | * legacy_suspend - Execute a legacy (bus or class) suspend callback for device. | 713 | * legacy_suspend - Execute a legacy (bus or class) suspend callback for device. |
714 | * dev: Device to suspend. | 714 | * @dev: Device to suspend. |
715 | * cb: Suspend callback to execute. | 715 | * @state: PM transition of the system being carried out. |
716 | * @cb: Suspend callback to execute. | ||
716 | */ | 717 | */ |
717 | static int legacy_suspend(struct device *dev, pm_message_t state, | 718 | static int legacy_suspend(struct device *dev, pm_message_t state, |
718 | int (*cb)(struct device *dev, pm_message_t state)) | 719 | int (*cb)(struct device *dev, pm_message_t state)) |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index eb4fa1943944..ce1fa923c414 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -7101,7 +7101,7 @@ static struct DAC960_privdata DAC960_BA_privdata = { | |||
7101 | 7101 | ||
7102 | static struct DAC960_privdata DAC960_LP_privdata = { | 7102 | static struct DAC960_privdata DAC960_LP_privdata = { |
7103 | .HardwareType = DAC960_LP_Controller, | 7103 | .HardwareType = DAC960_LP_Controller, |
7104 | .FirmwareType = DAC960_LP_Controller, | 7104 | .FirmwareType = DAC960_V2_Controller, |
7105 | .InterruptHandler = DAC960_LP_InterruptHandler, | 7105 | .InterruptHandler = DAC960_LP_InterruptHandler, |
7106 | .MemoryWindowSize = DAC960_LP_RegisterWindowSize, | 7106 | .MemoryWindowSize = DAC960_LP_RegisterWindowSize, |
7107 | }; | 7107 | }; |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 13bb69d2abb3..64a223b0cc22 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -735,21 +735,6 @@ diskstats(struct gendisk *disk, struct bio *bio, ulong duration, sector_t sector | |||
735 | part_stat_unlock(); | 735 | part_stat_unlock(); |
736 | } | 736 | } |
737 | 737 | ||
738 | /* | ||
739 | * Ensure we don't create aliases in VI caches | ||
740 | */ | ||
741 | static inline void | ||
742 | killalias(struct bio *bio) | ||
743 | { | ||
744 | struct bio_vec *bv; | ||
745 | int i; | ||
746 | |||
747 | if (bio_data_dir(bio) == READ) | ||
748 | __bio_for_each_segment(bv, bio, i, 0) { | ||
749 | flush_dcache_page(bv->bv_page); | ||
750 | } | ||
751 | } | ||
752 | |||
753 | void | 738 | void |
754 | aoecmd_ata_rsp(struct sk_buff *skb) | 739 | aoecmd_ata_rsp(struct sk_buff *skb) |
755 | { | 740 | { |
@@ -871,7 +856,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
871 | if (buf->flags & BUFFL_FAIL) | 856 | if (buf->flags & BUFFL_FAIL) |
872 | bio_endio(buf->bio, -EIO); | 857 | bio_endio(buf->bio, -EIO); |
873 | else { | 858 | else { |
874 | killalias(buf->bio); | 859 | bio_flush_dcache_pages(buf->bio); |
875 | bio_endio(buf->bio, 0); | 860 | bio_endio(buf->bio, 0); |
876 | } | 861 | } |
877 | mempool_free(buf, d->bufpool); | 862 | mempool_free(buf, d->bufpool); |
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 2312d782fe99..c97558763430 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -1490,7 +1490,7 @@ void drbd_bump_write_ordering(struct drbd_conf *mdev, enum write_ordering_e wo); | |||
1490 | 1490 | ||
1491 | /* drbd_proc.c */ | 1491 | /* drbd_proc.c */ |
1492 | extern struct proc_dir_entry *drbd_proc; | 1492 | extern struct proc_dir_entry *drbd_proc; |
1493 | extern struct file_operations drbd_proc_fops; | 1493 | extern const struct file_operations drbd_proc_fops; |
1494 | extern const char *drbd_conn_str(enum drbd_conns s); | 1494 | extern const char *drbd_conn_str(enum drbd_conns s); |
1495 | extern const char *drbd_role_str(enum drbd_role s); | 1495 | extern const char *drbd_role_str(enum drbd_role s); |
1496 | 1496 | ||
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 157d1e4343c2..9348f33f6242 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -27,7 +27,6 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/version.h> | ||
31 | #include <linux/drbd.h> | 30 | #include <linux/drbd.h> |
32 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
33 | #include <asm/types.h> | 32 | #include <asm/types.h> |
@@ -151,7 +150,7 @@ wait_queue_head_t drbd_pp_wait; | |||
151 | 150 | ||
152 | DEFINE_RATELIMIT_STATE(drbd_ratelimit_state, 5 * HZ, 5); | 151 | DEFINE_RATELIMIT_STATE(drbd_ratelimit_state, 5 * HZ, 5); |
153 | 152 | ||
154 | static struct block_device_operations drbd_ops = { | 153 | static const struct block_device_operations drbd_ops = { |
155 | .owner = THIS_MODULE, | 154 | .owner = THIS_MODULE, |
156 | .open = drbd_open, | 155 | .open = drbd_open, |
157 | .release = drbd_release, | 156 | .release = drbd_release, |
@@ -3623,7 +3622,7 @@ _drbd_fault_random(struct fault_random_state *rsp) | |||
3623 | { | 3622 | { |
3624 | long refresh; | 3623 | long refresh; |
3625 | 3624 | ||
3626 | if (--rsp->count < 0) { | 3625 | if (!rsp->count--) { |
3627 | get_random_bytes(&refresh, sizeof(refresh)); | 3626 | get_random_bytes(&refresh, sizeof(refresh)); |
3628 | rsp->state += refresh; | 3627 | rsp->state += refresh; |
3629 | rsp->count = FAULT_RANDOM_REFRESH; | 3628 | rsp->count = FAULT_RANDOM_REFRESH; |
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c index bdd0b4943b10..df8ad9660d8f 100644 --- a/drivers/block/drbd/drbd_proc.c +++ b/drivers/block/drbd/drbd_proc.c | |||
@@ -38,7 +38,7 @@ static int drbd_proc_open(struct inode *inode, struct file *file); | |||
38 | 38 | ||
39 | 39 | ||
40 | struct proc_dir_entry *drbd_proc; | 40 | struct proc_dir_entry *drbd_proc; |
41 | struct file_operations drbd_proc_fops = { | 41 | const struct file_operations drbd_proc_fops = { |
42 | .owner = THIS_MODULE, | 42 | .owner = THIS_MODULE, |
43 | .open = drbd_proc_open, | 43 | .open = drbd_proc_open, |
44 | .read = seq_read, | 44 | .read = seq_read, |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index c548f24f54a1..259c1351b152 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
29 | #include <net/sock.h> | 29 | #include <net/sock.h> |
30 | 30 | ||
31 | #include <linux/version.h> | ||
32 | #include <linux/drbd.h> | 31 | #include <linux/drbd.h> |
33 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
34 | #include <linux/file.h> | 33 | #include <linux/file.h> |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index ed8796f1112d..b453c2bca3be 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -24,7 +24,6 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/version.h> | ||
28 | #include <linux/drbd.h> | 27 | #include <linux/drbd.h> |
29 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
30 | #include <linux/smp_lock.h> | 29 | #include <linux/smp_lock.h> |
@@ -34,7 +33,6 @@ | |||
34 | #include <linux/mm_inline.h> | 33 | #include <linux/mm_inline.h> |
35 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
36 | #include <linux/random.h> | 35 | #include <linux/random.h> |
37 | #include <linux/mm.h> | ||
38 | #include <linux/string.h> | 36 | #include <linux/string.h> |
39 | #include <linux/scatterlist.h> | 37 | #include <linux/scatterlist.h> |
40 | 38 | ||
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index e0339aaa1815..02b2583df7fc 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c | |||
@@ -860,7 +860,7 @@ static int mg_probe(struct platform_device *plat_dev) | |||
860 | err = -EINVAL; | 860 | err = -EINVAL; |
861 | goto probe_err_2; | 861 | goto probe_err_2; |
862 | } | 862 | } |
863 | host->dev_base = ioremap(rsc->start , rsc->end + 1); | 863 | host->dev_base = ioremap(rsc->start, resource_size(rsc)); |
864 | if (!host->dev_base) { | 864 | if (!host->dev_base) { |
865 | printk(KERN_ERR "%s:%d ioremap fail\n", | 865 | printk(KERN_ERR "%s:%d ioremap fail\n", |
866 | __func__, __LINE__); | 866 | __func__, __LINE__); |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 2fb2e6cc322a..5aa7a586a7ff 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -725,9 +725,14 @@ static struct pci_driver agp_amd64_pci_driver = { | |||
725 | int __init agp_amd64_init(void) | 725 | int __init agp_amd64_init(void) |
726 | { | 726 | { |
727 | int err = 0; | 727 | int err = 0; |
728 | static int done = 0; | ||
728 | 729 | ||
729 | if (agp_off) | 730 | if (agp_off) |
730 | return -EINVAL; | 731 | return -EINVAL; |
732 | |||
733 | if (done++) | ||
734 | return agp_bridges_found ? 0 : -ENODEV; | ||
735 | |||
731 | err = pci_register_driver(&agp_amd64_pci_driver); | 736 | err = pci_register_driver(&agp_amd64_pci_driver); |
732 | if (err < 0) | 737 | if (err < 0) |
733 | return err; | 738 | return err; |
@@ -771,12 +776,8 @@ static void __exit agp_amd64_cleanup(void) | |||
771 | pci_unregister_driver(&agp_amd64_pci_driver); | 776 | pci_unregister_driver(&agp_amd64_pci_driver); |
772 | } | 777 | } |
773 | 778 | ||
774 | /* On AMD64 the PCI driver needs to initialize this driver early | ||
775 | for the IOMMU, so it has to be called via a backdoor. */ | ||
776 | #ifndef CONFIG_GART_IOMMU | ||
777 | module_init(agp_amd64_init); | 779 | module_init(agp_amd64_init); |
778 | module_exit(agp_amd64_cleanup); | 780 | module_exit(agp_amd64_cleanup); |
779 | #endif | ||
780 | 781 | ||
781 | MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); | 782 | MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); |
782 | module_param(agp_try_unsupported, bool, 0); | 783 | module_param(agp_try_unsupported, bool, 0); |
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index a56ca080e108..c3ab46da51a3 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c | |||
@@ -285,18 +285,22 @@ int agp_add_bridge(struct agp_bridge_data *bridge) | |||
285 | { | 285 | { |
286 | int error; | 286 | int error; |
287 | 287 | ||
288 | if (agp_off) | 288 | if (agp_off) { |
289 | return -ENODEV; | 289 | error = -ENODEV; |
290 | goto err_put_bridge; | ||
291 | } | ||
290 | 292 | ||
291 | if (!bridge->dev) { | 293 | if (!bridge->dev) { |
292 | printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n"); | 294 | printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n"); |
293 | return -EINVAL; | 295 | error = -EINVAL; |
296 | goto err_put_bridge; | ||
294 | } | 297 | } |
295 | 298 | ||
296 | /* Grab reference on the chipset driver. */ | 299 | /* Grab reference on the chipset driver. */ |
297 | if (!try_module_get(bridge->driver->owner)) { | 300 | if (!try_module_get(bridge->driver->owner)) { |
298 | dev_info(&bridge->dev->dev, "can't lock chipset driver\n"); | 301 | dev_info(&bridge->dev->dev, "can't lock chipset driver\n"); |
299 | return -EINVAL; | 302 | error = -EINVAL; |
303 | goto err_put_bridge; | ||
300 | } | 304 | } |
301 | 305 | ||
302 | error = agp_backend_initialize(bridge); | 306 | error = agp_backend_initialize(bridge); |
@@ -326,6 +330,7 @@ frontend_err: | |||
326 | agp_backend_cleanup(bridge); | 330 | agp_backend_cleanup(bridge); |
327 | err_out: | 331 | err_out: |
328 | module_put(bridge->driver->owner); | 332 | module_put(bridge->driver->owner); |
333 | err_put_bridge: | ||
329 | agp_put_bridge(bridge); | 334 | agp_put_bridge(bridge); |
330 | return error; | 335 | return error; |
331 | } | 336 | } |
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c index 9047b2714653..58752b70efea 100644 --- a/drivers/char/agp/hp-agp.c +++ b/drivers/char/agp/hp-agp.c | |||
@@ -488,9 +488,8 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) | |||
488 | handle = obj; | 488 | handle = obj; |
489 | do { | 489 | do { |
490 | status = acpi_get_object_info(handle, &info); | 490 | status = acpi_get_object_info(handle, &info); |
491 | if (ACPI_SUCCESS(status)) { | 491 | if (ACPI_SUCCESS(status) && (info->valid & ACPI_VALID_HID)) { |
492 | /* TBD check _CID also */ | 492 | /* TBD check _CID also */ |
493 | info->hardware_id.string[sizeof(info->hardware_id.length)-1] = '\0'; | ||
494 | match = (strcmp(info->hardware_id.string, "HWP0001") == 0); | 493 | match = (strcmp(info->hardware_id.string, "HWP0001") == 0); |
495 | kfree(info); | 494 | kfree(info); |
496 | if (match) { | 495 | if (match) { |
@@ -509,6 +508,9 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) | |||
509 | handle = parent; | 508 | handle = parent; |
510 | } while (ACPI_SUCCESS(status)); | 509 | } while (ACPI_SUCCESS(status)); |
511 | 510 | ||
511 | if (ACPI_FAILURE(status)) | ||
512 | return AE_OK; /* found no enclosing IOC */ | ||
513 | |||
512 | if (hp_zx1_setup(sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa)) | 514 | if (hp_zx1_setup(sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa)) |
513 | return AE_OK; | 515 | return AE_OK; |
514 | 516 | ||
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index e989f67bb61f..3d9c61e5acbf 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -158,10 +158,11 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf, | |||
158 | goto out; | 158 | goto out; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | out_unlock: | ||
162 | mutex_unlock(&rng_mutex); | ||
163 | out: | 161 | out: |
164 | return ret ? : err; | 162 | return ret ? : err; |
163 | out_unlock: | ||
164 | mutex_unlock(&rng_mutex); | ||
165 | goto out; | ||
165 | } | 166 | } |
166 | 167 | ||
167 | 168 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 679cd08b80b4..176f1751237f 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -3204,7 +3204,7 @@ static __devinit int init_ipmi_si(void) | |||
3204 | #ifdef CONFIG_ACPI | 3204 | #ifdef CONFIG_ACPI |
3205 | spmi_find_bmc(); | 3205 | spmi_find_bmc(); |
3206 | #endif | 3206 | #endif |
3207 | #ifdef CONFIG_PNP | 3207 | #ifdef CONFIG_ACPI |
3208 | pnp_register_driver(&ipmi_pnp_driver); | 3208 | pnp_register_driver(&ipmi_pnp_driver); |
3209 | #endif | 3209 | #endif |
3210 | 3210 | ||
@@ -3330,7 +3330,7 @@ static __exit void cleanup_ipmi_si(void) | |||
3330 | #ifdef CONFIG_PCI | 3330 | #ifdef CONFIG_PCI |
3331 | pci_unregister_driver(&ipmi_pci_driver); | 3331 | pci_unregister_driver(&ipmi_pci_driver); |
3332 | #endif | 3332 | #endif |
3333 | #ifdef CONFIG_PNP | 3333 | #ifdef CONFIG_ACPI |
3334 | pnp_unregister_driver(&ipmi_pnp_driver); | 3334 | pnp_unregister_driver(&ipmi_pnp_driver); |
3335 | #endif | 3335 | #endif |
3336 | 3336 | ||
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 0798754a607c..bba727c3807e 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <linux/err.h> | 50 | #include <linux/err.h> |
51 | #include <linux/kfifo.h> | 51 | #include <linux/kfifo.h> |
52 | #include <linux/platform_device.h> | 52 | #include <linux/platform_device.h> |
53 | #include <linux/smp_lock.h> | ||
54 | 53 | ||
55 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
56 | #include <asm/io.h> | 55 | #include <asm/io.h> |
@@ -905,14 +904,13 @@ static int sonypi_misc_release(struct inode *inode, struct file *file) | |||
905 | 904 | ||
906 | static int sonypi_misc_open(struct inode *inode, struct file *file) | 905 | static int sonypi_misc_open(struct inode *inode, struct file *file) |
907 | { | 906 | { |
908 | lock_kernel(); | ||
909 | mutex_lock(&sonypi_device.lock); | 907 | mutex_lock(&sonypi_device.lock); |
910 | /* Flush input queue on first open */ | 908 | /* Flush input queue on first open */ |
911 | if (!sonypi_device.open_count) | 909 | if (!sonypi_device.open_count) |
912 | kfifo_reset(&sonypi_device.fifo); | 910 | kfifo_reset(&sonypi_device.fifo); |
913 | sonypi_device.open_count++; | 911 | sonypi_device.open_count++; |
914 | mutex_unlock(&sonypi_device.lock); | 912 | mutex_unlock(&sonypi_device.lock); |
915 | unlock_kernel(); | 913 | |
916 | return 0; | 914 | return 0; |
917 | } | 915 | } |
918 | 916 | ||
@@ -955,10 +953,10 @@ static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait) | |||
955 | return 0; | 953 | return 0; |
956 | } | 954 | } |
957 | 955 | ||
958 | static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, | 956 | static long sonypi_misc_ioctl(struct file *fp, |
959 | unsigned int cmd, unsigned long arg) | 957 | unsigned int cmd, unsigned long arg) |
960 | { | 958 | { |
961 | int ret = 0; | 959 | long ret = 0; |
962 | void __user *argp = (void __user *)arg; | 960 | void __user *argp = (void __user *)arg; |
963 | u8 val8; | 961 | u8 val8; |
964 | u16 val16; | 962 | u16 val16; |
@@ -1074,7 +1072,8 @@ static const struct file_operations sonypi_misc_fops = { | |||
1074 | .open = sonypi_misc_open, | 1072 | .open = sonypi_misc_open, |
1075 | .release = sonypi_misc_release, | 1073 | .release = sonypi_misc_release, |
1076 | .fasync = sonypi_misc_fasync, | 1074 | .fasync = sonypi_misc_fasync, |
1077 | .ioctl = sonypi_misc_ioctl, | 1075 | .unlocked_ioctl = sonypi_misc_ioctl, |
1076 | .llseek = no_llseek, | ||
1078 | }; | 1077 | }; |
1079 | 1078 | ||
1080 | static struct miscdevice sonypi_misc_device = { | 1079 | static struct miscdevice sonypi_misc_device = { |
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index 663cd15d7c78..f8bc79f6de34 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c | |||
@@ -68,7 +68,7 @@ | |||
68 | #include <linux/stat.h> | 68 | #include <linux/stat.h> |
69 | #include <linux/proc_fs.h> | 69 | #include <linux/proc_fs.h> |
70 | #include <linux/seq_file.h> | 70 | #include <linux/seq_file.h> |
71 | 71 | #include <linux/smp_lock.h> | |
72 | #include <linux/toshiba.h> | 72 | #include <linux/toshiba.h> |
73 | 73 | ||
74 | #define TOSH_MINOR_DEV 181 | 74 | #define TOSH_MINOR_DEV 181 |
@@ -88,13 +88,13 @@ static int tosh_date; | |||
88 | static int tosh_sci; | 88 | static int tosh_sci; |
89 | static int tosh_fan; | 89 | static int tosh_fan; |
90 | 90 | ||
91 | static int tosh_ioctl(struct inode *, struct file *, unsigned int, | 91 | static long tosh_ioctl(struct file *, unsigned int, |
92 | unsigned long); | 92 | unsigned long); |
93 | 93 | ||
94 | 94 | ||
95 | static const struct file_operations tosh_fops = { | 95 | static const struct file_operations tosh_fops = { |
96 | .owner = THIS_MODULE, | 96 | .owner = THIS_MODULE, |
97 | .ioctl = tosh_ioctl, | 97 | .unlocked_ioctl = tosh_ioctl, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | static struct miscdevice tosh_device = { | 100 | static struct miscdevice tosh_device = { |
@@ -252,8 +252,7 @@ int tosh_smm(SMMRegisters *regs) | |||
252 | EXPORT_SYMBOL(tosh_smm); | 252 | EXPORT_SYMBOL(tosh_smm); |
253 | 253 | ||
254 | 254 | ||
255 | static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, | 255 | static long tosh_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) |
256 | unsigned long arg) | ||
257 | { | 256 | { |
258 | SMMRegisters regs; | 257 | SMMRegisters regs; |
259 | SMMRegisters __user *argp = (SMMRegisters __user *)arg; | 258 | SMMRegisters __user *argp = (SMMRegisters __user *)arg; |
@@ -275,13 +274,16 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, | |||
275 | return -EINVAL; | 274 | return -EINVAL; |
276 | 275 | ||
277 | /* do we need to emulate the fan ? */ | 276 | /* do we need to emulate the fan ? */ |
277 | lock_kernel(); | ||
278 | if (tosh_fan==1) { | 278 | if (tosh_fan==1) { |
279 | if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) { | 279 | if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) { |
280 | err = tosh_emulate_fan(®s); | 280 | err = tosh_emulate_fan(®s); |
281 | unlock_kernel(); | ||
281 | break; | 282 | break; |
282 | } | 283 | } |
283 | } | 284 | } |
284 | err = tosh_smm(®s); | 285 | err = tosh_smm(®s); |
286 | unlock_kernel(); | ||
285 | break; | 287 | break; |
286 | default: | 288 | default: |
287 | return -EINVAL; | 289 | return -EINVAL; |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 68104434ebb5..73655aeb3a60 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/hrtimer.h> | 18 | #include <linux/hrtimer.h> |
19 | #include <linux/tick.h> | 19 | #include <linux/tick.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/math64.h> | ||
21 | 22 | ||
22 | #define BUCKETS 12 | 23 | #define BUCKETS 12 |
23 | #define RESOLUTION 1024 | 24 | #define RESOLUTION 1024 |
@@ -169,6 +170,12 @@ static DEFINE_PER_CPU(struct menu_device, menu_devices); | |||
169 | 170 | ||
170 | static void menu_update(struct cpuidle_device *dev); | 171 | static void menu_update(struct cpuidle_device *dev); |
171 | 172 | ||
173 | /* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */ | ||
174 | static u64 div_round64(u64 dividend, u32 divisor) | ||
175 | { | ||
176 | return div_u64(dividend + (divisor / 2), divisor); | ||
177 | } | ||
178 | |||
172 | /** | 179 | /** |
173 | * menu_select - selects the next idle state to enter | 180 | * menu_select - selects the next idle state to enter |
174 | * @dev: the CPU | 181 | * @dev: the CPU |
@@ -209,9 +216,8 @@ static int menu_select(struct cpuidle_device *dev) | |||
209 | data->correction_factor[data->bucket] = RESOLUTION * DECAY; | 216 | data->correction_factor[data->bucket] = RESOLUTION * DECAY; |
210 | 217 | ||
211 | /* Make sure to round up for half microseconds */ | 218 | /* Make sure to round up for half microseconds */ |
212 | data->predicted_us = DIV_ROUND_CLOSEST( | 219 | data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket], |
213 | data->expected_us * data->correction_factor[data->bucket], | 220 | RESOLUTION * DECAY); |
214 | RESOLUTION * DECAY); | ||
215 | 221 | ||
216 | /* | 222 | /* |
217 | * We want to default to C1 (hlt), not to busy polling | 223 | * We want to default to C1 (hlt), not to busy polling |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index f15112569c1d..efc1a61ca231 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
@@ -815,7 +815,7 @@ atc_is_tx_complete(struct dma_chan *chan, | |||
815 | dev_vdbg(chan2dev(chan), "is_tx_complete: %d (d%d, u%d)\n", | 815 | dev_vdbg(chan2dev(chan), "is_tx_complete: %d (d%d, u%d)\n", |
816 | cookie, done ? *done : 0, used ? *used : 0); | 816 | cookie, done ? *done : 0, used ? *used : 0); |
817 | 817 | ||
818 | spin_lock_bh(atchan->lock); | 818 | spin_lock_bh(&atchan->lock); |
819 | 819 | ||
820 | last_complete = atchan->completed_cookie; | 820 | last_complete = atchan->completed_cookie; |
821 | last_used = chan->cookie; | 821 | last_used = chan->cookie; |
@@ -830,7 +830,7 @@ atc_is_tx_complete(struct dma_chan *chan, | |||
830 | ret = dma_async_is_complete(cookie, last_complete, last_used); | 830 | ret = dma_async_is_complete(cookie, last_complete, last_used); |
831 | } | 831 | } |
832 | 832 | ||
833 | spin_unlock_bh(atchan->lock); | 833 | spin_unlock_bh(&atchan->lock); |
834 | 834 | ||
835 | if (done) | 835 | if (done) |
836 | *done = last_complete; | 836 | *done = last_complete; |
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index 4a99cd94536b..b5f2ee0f8e2c 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c | |||
@@ -1294,8 +1294,8 @@ static int __exit coh901318_remove(struct platform_device *pdev) | |||
1294 | dma_async_device_unregister(&base->dma_slave); | 1294 | dma_async_device_unregister(&base->dma_slave); |
1295 | coh901318_pool_destroy(&base->pool); | 1295 | coh901318_pool_destroy(&base->pool); |
1296 | free_irq(platform_get_irq(pdev, 0), base); | 1296 | free_irq(platform_get_irq(pdev, 0), base); |
1297 | kfree(base); | ||
1298 | iounmap(base->virtbase); | 1297 | iounmap(base->virtbase); |
1298 | kfree(base); | ||
1299 | release_mem_region(pdev->resource->start, | 1299 | release_mem_region(pdev->resource->start, |
1300 | resource_size(pdev->resource)); | 1300 | resource_size(pdev->resource)); |
1301 | return 0; | 1301 | return 0; |
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 285bed0fe17b..d28369f7afd2 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
@@ -1270,8 +1270,6 @@ static int __init dw_probe(struct platform_device *pdev) | |||
1270 | goto err_kfree; | 1270 | goto err_kfree; |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | memset(dw, 0, sizeof *dw); | ||
1274 | |||
1275 | dw->regs = ioremap(io->start, DW_REGLEN); | 1273 | dw->regs = ioremap(io->start, DW_REGLEN); |
1276 | if (!dw->regs) { | 1274 | if (!dw->regs) { |
1277 | err = -ENOMEM; | 1275 | err = -ENOMEM; |
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index c524d36d3c2e..dcc4ab78b32b 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
@@ -1032,7 +1032,7 @@ int __devinit ioat_probe(struct ioatdma_device *device) | |||
1032 | dma->dev = &pdev->dev; | 1032 | dma->dev = &pdev->dev; |
1033 | 1033 | ||
1034 | if (!dma->chancnt) { | 1034 | if (!dma->chancnt) { |
1035 | dev_err(dev, "zero channels detected\n"); | 1035 | dev_err(dev, "channel enumeration error\n"); |
1036 | goto err_setup_interrupts; | 1036 | goto err_setup_interrupts; |
1037 | } | 1037 | } |
1038 | 1038 | ||
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index 45edde996480..bbc3e78ef333 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
@@ -60,6 +60,7 @@ | |||
60 | * @dca: direct cache access context | 60 | * @dca: direct cache access context |
61 | * @intr_quirk: interrupt setup quirk (for ioat_v1 devices) | 61 | * @intr_quirk: interrupt setup quirk (for ioat_v1 devices) |
62 | * @enumerate_channels: hw version specific channel enumeration | 62 | * @enumerate_channels: hw version specific channel enumeration |
63 | * @reset_hw: hw version specific channel (re)initialization | ||
63 | * @cleanup_tasklet: select between the v2 and v3 cleanup routines | 64 | * @cleanup_tasklet: select between the v2 and v3 cleanup routines |
64 | * @timer_fn: select between the v2 and v3 timer watchdog routines | 65 | * @timer_fn: select between the v2 and v3 timer watchdog routines |
65 | * @self_test: hardware version specific self test for each supported op type | 66 | * @self_test: hardware version specific self test for each supported op type |
@@ -78,6 +79,7 @@ struct ioatdma_device { | |||
78 | struct dca_provider *dca; | 79 | struct dca_provider *dca; |
79 | void (*intr_quirk)(struct ioatdma_device *device); | 80 | void (*intr_quirk)(struct ioatdma_device *device); |
80 | int (*enumerate_channels)(struct ioatdma_device *device); | 81 | int (*enumerate_channels)(struct ioatdma_device *device); |
82 | int (*reset_hw)(struct ioat_chan_common *chan); | ||
81 | void (*cleanup_tasklet)(unsigned long data); | 83 | void (*cleanup_tasklet)(unsigned long data); |
82 | void (*timer_fn)(unsigned long data); | 84 | void (*timer_fn)(unsigned long data); |
83 | int (*self_test)(struct ioatdma_device *device); | 85 | int (*self_test)(struct ioatdma_device *device); |
@@ -264,6 +266,22 @@ static inline void ioat_suspend(struct ioat_chan_common *chan) | |||
264 | writeb(IOAT_CHANCMD_SUSPEND, chan->reg_base + IOAT_CHANCMD_OFFSET(ver)); | 266 | writeb(IOAT_CHANCMD_SUSPEND, chan->reg_base + IOAT_CHANCMD_OFFSET(ver)); |
265 | } | 267 | } |
266 | 268 | ||
269 | static inline void ioat_reset(struct ioat_chan_common *chan) | ||
270 | { | ||
271 | u8 ver = chan->device->version; | ||
272 | |||
273 | writeb(IOAT_CHANCMD_RESET, chan->reg_base + IOAT_CHANCMD_OFFSET(ver)); | ||
274 | } | ||
275 | |||
276 | static inline bool ioat_reset_pending(struct ioat_chan_common *chan) | ||
277 | { | ||
278 | u8 ver = chan->device->version; | ||
279 | u8 cmd; | ||
280 | |||
281 | cmd = readb(chan->reg_base + IOAT_CHANCMD_OFFSET(ver)); | ||
282 | return (cmd & IOAT_CHANCMD_RESET) == IOAT_CHANCMD_RESET; | ||
283 | } | ||
284 | |||
267 | static inline void ioat_set_chainaddr(struct ioat_dma_chan *ioat, u64 addr) | 285 | static inline void ioat_set_chainaddr(struct ioat_dma_chan *ioat, u64 addr) |
268 | { | 286 | { |
269 | struct ioat_chan_common *chan = &ioat->base; | 287 | struct ioat_chan_common *chan = &ioat->base; |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 8f1f7f05deaa..5f7a500e18d0 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -239,20 +239,50 @@ void __ioat2_restart_chan(struct ioat2_dma_chan *ioat) | |||
239 | __ioat2_start_null_desc(ioat); | 239 | __ioat2_start_null_desc(ioat); |
240 | } | 240 | } |
241 | 241 | ||
242 | static void ioat2_restart_channel(struct ioat2_dma_chan *ioat) | 242 | int ioat2_quiesce(struct ioat_chan_common *chan, unsigned long tmo) |
243 | { | 243 | { |
244 | struct ioat_chan_common *chan = &ioat->base; | 244 | unsigned long end = jiffies + tmo; |
245 | unsigned long phys_complete; | 245 | int err = 0; |
246 | u32 status; | 246 | u32 status; |
247 | 247 | ||
248 | status = ioat_chansts(chan); | 248 | status = ioat_chansts(chan); |
249 | if (is_ioat_active(status) || is_ioat_idle(status)) | 249 | if (is_ioat_active(status) || is_ioat_idle(status)) |
250 | ioat_suspend(chan); | 250 | ioat_suspend(chan); |
251 | while (is_ioat_active(status) || is_ioat_idle(status)) { | 251 | while (is_ioat_active(status) || is_ioat_idle(status)) { |
252 | if (end && time_after(jiffies, end)) { | ||
253 | err = -ETIMEDOUT; | ||
254 | break; | ||
255 | } | ||
252 | status = ioat_chansts(chan); | 256 | status = ioat_chansts(chan); |
253 | cpu_relax(); | 257 | cpu_relax(); |
254 | } | 258 | } |
255 | 259 | ||
260 | return err; | ||
261 | } | ||
262 | |||
263 | int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo) | ||
264 | { | ||
265 | unsigned long end = jiffies + tmo; | ||
266 | int err = 0; | ||
267 | |||
268 | ioat_reset(chan); | ||
269 | while (ioat_reset_pending(chan)) { | ||
270 | if (end && time_after(jiffies, end)) { | ||
271 | err = -ETIMEDOUT; | ||
272 | break; | ||
273 | } | ||
274 | cpu_relax(); | ||
275 | } | ||
276 | |||
277 | return err; | ||
278 | } | ||
279 | |||
280 | static void ioat2_restart_channel(struct ioat2_dma_chan *ioat) | ||
281 | { | ||
282 | struct ioat_chan_common *chan = &ioat->base; | ||
283 | unsigned long phys_complete; | ||
284 | |||
285 | ioat2_quiesce(chan, 0); | ||
256 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 286 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
257 | __cleanup(ioat, phys_complete); | 287 | __cleanup(ioat, phys_complete); |
258 | 288 | ||
@@ -318,6 +348,19 @@ void ioat2_timer_event(unsigned long data) | |||
318 | spin_unlock_bh(&chan->cleanup_lock); | 348 | spin_unlock_bh(&chan->cleanup_lock); |
319 | } | 349 | } |
320 | 350 | ||
351 | static int ioat2_reset_hw(struct ioat_chan_common *chan) | ||
352 | { | ||
353 | /* throw away whatever the channel was doing and get it initialized */ | ||
354 | u32 chanerr; | ||
355 | |||
356 | ioat2_quiesce(chan, msecs_to_jiffies(100)); | ||
357 | |||
358 | chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); | ||
359 | writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET); | ||
360 | |||
361 | return ioat2_reset_sync(chan, msecs_to_jiffies(200)); | ||
362 | } | ||
363 | |||
321 | /** | 364 | /** |
322 | * ioat2_enumerate_channels - find and initialize the device's channels | 365 | * ioat2_enumerate_channels - find and initialize the device's channels |
323 | * @device: the device to be enumerated | 366 | * @device: the device to be enumerated |
@@ -360,6 +403,10 @@ int ioat2_enumerate_channels(struct ioatdma_device *device) | |||
360 | (unsigned long) ioat); | 403 | (unsigned long) ioat); |
361 | ioat->xfercap_log = xfercap_log; | 404 | ioat->xfercap_log = xfercap_log; |
362 | spin_lock_init(&ioat->ring_lock); | 405 | spin_lock_init(&ioat->ring_lock); |
406 | if (device->reset_hw(&ioat->base)) { | ||
407 | i = 0; | ||
408 | break; | ||
409 | } | ||
363 | } | 410 | } |
364 | dma->chancnt = i; | 411 | dma->chancnt = i; |
365 | return i; | 412 | return i; |
@@ -467,7 +514,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c) | |||
467 | struct ioat2_dma_chan *ioat = to_ioat2_chan(c); | 514 | struct ioat2_dma_chan *ioat = to_ioat2_chan(c); |
468 | struct ioat_chan_common *chan = &ioat->base; | 515 | struct ioat_chan_common *chan = &ioat->base; |
469 | struct ioat_ring_ent **ring; | 516 | struct ioat_ring_ent **ring; |
470 | u32 chanerr; | ||
471 | int order; | 517 | int order; |
472 | 518 | ||
473 | /* have we already been set up? */ | 519 | /* have we already been set up? */ |
@@ -477,12 +523,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c) | |||
477 | /* Setup register to interrupt and write completion status on error */ | 523 | /* Setup register to interrupt and write completion status on error */ |
478 | writew(IOAT_CHANCTRL_RUN, chan->reg_base + IOAT_CHANCTRL_OFFSET); | 524 | writew(IOAT_CHANCTRL_RUN, chan->reg_base + IOAT_CHANCTRL_OFFSET); |
479 | 525 | ||
480 | chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); | ||
481 | if (chanerr) { | ||
482 | dev_err(to_dev(chan), "CHANERR = %x, clearing\n", chanerr); | ||
483 | writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET); | ||
484 | } | ||
485 | |||
486 | /* allocate a completion writeback area */ | 526 | /* allocate a completion writeback area */ |
487 | /* doing 2 32bit writes to mmio since 1 64b write doesn't work */ | 527 | /* doing 2 32bit writes to mmio since 1 64b write doesn't work */ |
488 | chan->completion = pci_pool_alloc(chan->device->completion_pool, | 528 | chan->completion = pci_pool_alloc(chan->device->completion_pool, |
@@ -746,13 +786,7 @@ void ioat2_free_chan_resources(struct dma_chan *c) | |||
746 | tasklet_disable(&chan->cleanup_task); | 786 | tasklet_disable(&chan->cleanup_task); |
747 | del_timer_sync(&chan->timer); | 787 | del_timer_sync(&chan->timer); |
748 | device->cleanup_tasklet((unsigned long) ioat); | 788 | device->cleanup_tasklet((unsigned long) ioat); |
749 | 789 | device->reset_hw(chan); | |
750 | /* Delay 100ms after reset to allow internal DMA logic to quiesce | ||
751 | * before removing DMA descriptor resources. | ||
752 | */ | ||
753 | writeb(IOAT_CHANCMD_RESET, | ||
754 | chan->reg_base + IOAT_CHANCMD_OFFSET(chan->device->version)); | ||
755 | mdelay(100); | ||
756 | 790 | ||
757 | spin_lock_bh(&ioat->ring_lock); | 791 | spin_lock_bh(&ioat->ring_lock); |
758 | descs = ioat2_ring_space(ioat); | 792 | descs = ioat2_ring_space(ioat); |
@@ -839,6 +873,7 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca) | |||
839 | int err; | 873 | int err; |
840 | 874 | ||
841 | device->enumerate_channels = ioat2_enumerate_channels; | 875 | device->enumerate_channels = ioat2_enumerate_channels; |
876 | device->reset_hw = ioat2_reset_hw; | ||
842 | device->cleanup_tasklet = ioat2_cleanup_tasklet; | 877 | device->cleanup_tasklet = ioat2_cleanup_tasklet; |
843 | device->timer_fn = ioat2_timer_event; | 878 | device->timer_fn = ioat2_timer_event; |
844 | device->self_test = ioat_dma_self_test; | 879 | device->self_test = ioat_dma_self_test; |
diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h index 1d849ef74d5f..3afad8da43cc 100644 --- a/drivers/dma/ioat/dma_v2.h +++ b/drivers/dma/ioat/dma_v2.h | |||
@@ -185,6 +185,8 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order); | |||
185 | void __ioat2_issue_pending(struct ioat2_dma_chan *ioat); | 185 | void __ioat2_issue_pending(struct ioat2_dma_chan *ioat); |
186 | void ioat2_cleanup_tasklet(unsigned long data); | 186 | void ioat2_cleanup_tasklet(unsigned long data); |
187 | void ioat2_timer_event(unsigned long data); | 187 | void ioat2_timer_event(unsigned long data); |
188 | int ioat2_quiesce(struct ioat_chan_common *chan, unsigned long tmo); | ||
189 | int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo); | ||
188 | extern struct kobj_type ioat2_ktype; | 190 | extern struct kobj_type ioat2_ktype; |
189 | extern struct kmem_cache *ioat2_cache; | 191 | extern struct kmem_cache *ioat2_cache; |
190 | #endif /* IOATDMA_V2_H */ | 192 | #endif /* IOATDMA_V2_H */ |
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 42f6f10fb0cc..9908c9e94b2d 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -650,9 +650,11 @@ __ioat3_prep_pq_lock(struct dma_chan *c, enum sum_check_flags *result, | |||
650 | 650 | ||
651 | num_descs = ioat2_xferlen_to_descs(ioat, len); | 651 | num_descs = ioat2_xferlen_to_descs(ioat, len); |
652 | /* we need 2x the number of descriptors to cover greater than 3 | 652 | /* we need 2x the number of descriptors to cover greater than 3 |
653 | * sources | 653 | * sources (we need 1 extra source in the q-only continuation |
654 | * case and 3 extra sources in the p+q continuation case. | ||
654 | */ | 655 | */ |
655 | if (src_cnt > 3 || flags & DMA_PREP_CONTINUE) { | 656 | if (src_cnt + dmaf_p_disabled_continue(flags) > 3 || |
657 | (dmaf_continue(flags) && !dmaf_p_disabled_continue(flags))) { | ||
656 | with_ext = 1; | 658 | with_ext = 1; |
657 | num_descs *= 2; | 659 | num_descs *= 2; |
658 | } else | 660 | } else |
@@ -1128,6 +1130,45 @@ static int __devinit ioat3_dma_self_test(struct ioatdma_device *device) | |||
1128 | return 0; | 1130 | return 0; |
1129 | } | 1131 | } |
1130 | 1132 | ||
1133 | static int ioat3_reset_hw(struct ioat_chan_common *chan) | ||
1134 | { | ||
1135 | /* throw away whatever the channel was doing and get it | ||
1136 | * initialized, with ioat3 specific workarounds | ||
1137 | */ | ||
1138 | struct ioatdma_device *device = chan->device; | ||
1139 | struct pci_dev *pdev = device->pdev; | ||
1140 | u32 chanerr; | ||
1141 | u16 dev_id; | ||
1142 | int err; | ||
1143 | |||
1144 | ioat2_quiesce(chan, msecs_to_jiffies(100)); | ||
1145 | |||
1146 | chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); | ||
1147 | writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET); | ||
1148 | |||
1149 | /* -= IOAT ver.3 workarounds =- */ | ||
1150 | /* Write CHANERRMSK_INT with 3E07h to mask out the errors | ||
1151 | * that can cause stability issues for IOAT ver.3, and clear any | ||
1152 | * pending errors | ||
1153 | */ | ||
1154 | pci_write_config_dword(pdev, IOAT_PCI_CHANERRMASK_INT_OFFSET, 0x3e07); | ||
1155 | err = pci_read_config_dword(pdev, IOAT_PCI_CHANERR_INT_OFFSET, &chanerr); | ||
1156 | if (err) { | ||
1157 | dev_err(&pdev->dev, "channel error register unreachable\n"); | ||
1158 | return err; | ||
1159 | } | ||
1160 | pci_write_config_dword(pdev, IOAT_PCI_CHANERR_INT_OFFSET, chanerr); | ||
1161 | |||
1162 | /* Clear DMAUNCERRSTS Cfg-Reg Parity Error status bit | ||
1163 | * (workaround for spurious config parity error after restart) | ||
1164 | */ | ||
1165 | pci_read_config_word(pdev, IOAT_PCI_DEVICE_ID_OFFSET, &dev_id); | ||
1166 | if (dev_id == PCI_DEVICE_ID_INTEL_IOAT_TBG0) | ||
1167 | pci_write_config_dword(pdev, IOAT_PCI_DMAUNCERRSTS_OFFSET, 0x10); | ||
1168 | |||
1169 | return ioat2_reset_sync(chan, msecs_to_jiffies(200)); | ||
1170 | } | ||
1171 | |||
1131 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | 1172 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) |
1132 | { | 1173 | { |
1133 | struct pci_dev *pdev = device->pdev; | 1174 | struct pci_dev *pdev = device->pdev; |
@@ -1137,10 +1178,10 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
1137 | struct ioat_chan_common *chan; | 1178 | struct ioat_chan_common *chan; |
1138 | bool is_raid_device = false; | 1179 | bool is_raid_device = false; |
1139 | int err; | 1180 | int err; |
1140 | u16 dev_id; | ||
1141 | u32 cap; | 1181 | u32 cap; |
1142 | 1182 | ||
1143 | device->enumerate_channels = ioat2_enumerate_channels; | 1183 | device->enumerate_channels = ioat2_enumerate_channels; |
1184 | device->reset_hw = ioat3_reset_hw; | ||
1144 | device->self_test = ioat3_dma_self_test; | 1185 | device->self_test = ioat3_dma_self_test; |
1145 | dma = &device->common; | 1186 | dma = &device->common; |
1146 | dma->device_prep_dma_memcpy = ioat2_dma_prep_memcpy_lock; | 1187 | dma->device_prep_dma_memcpy = ioat2_dma_prep_memcpy_lock; |
@@ -1216,19 +1257,6 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
1216 | dma->device_prep_dma_xor_val = NULL; | 1257 | dma->device_prep_dma_xor_val = NULL; |
1217 | #endif | 1258 | #endif |
1218 | 1259 | ||
1219 | /* -= IOAT ver.3 workarounds =- */ | ||
1220 | /* Write CHANERRMSK_INT with 3E07h to mask out the errors | ||
1221 | * that can cause stability issues for IOAT ver.3 | ||
1222 | */ | ||
1223 | pci_write_config_dword(pdev, IOAT_PCI_CHANERRMASK_INT_OFFSET, 0x3e07); | ||
1224 | |||
1225 | /* Clear DMAUNCERRSTS Cfg-Reg Parity Error status bit | ||
1226 | * (workaround for spurious config parity error after restart) | ||
1227 | */ | ||
1228 | pci_read_config_word(pdev, IOAT_PCI_DEVICE_ID_OFFSET, &dev_id); | ||
1229 | if (dev_id == PCI_DEVICE_ID_INTEL_IOAT_TBG0) | ||
1230 | pci_write_config_dword(pdev, IOAT_PCI_DMAUNCERRSTS_OFFSET, 0x10); | ||
1231 | |||
1232 | err = ioat_probe(device); | 1260 | err = ioat_probe(device); |
1233 | if (err) | 1261 | if (err) |
1234 | return err; | 1262 | return err; |
diff --git a/drivers/dma/ioat/registers.h b/drivers/dma/ioat/registers.h index f015ec196700..e8ae63baf588 100644 --- a/drivers/dma/ioat/registers.h +++ b/drivers/dma/ioat/registers.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #define IOAT_PCI_DEVICE_ID_OFFSET 0x02 | 28 | #define IOAT_PCI_DEVICE_ID_OFFSET 0x02 |
29 | #define IOAT_PCI_DMAUNCERRSTS_OFFSET 0x148 | 29 | #define IOAT_PCI_DMAUNCERRSTS_OFFSET 0x148 |
30 | #define IOAT_PCI_CHANERR_INT_OFFSET 0x180 | ||
30 | #define IOAT_PCI_CHANERRMASK_INT_OFFSET 0x184 | 31 | #define IOAT_PCI_CHANERRMASK_INT_OFFSET 0x184 |
31 | 32 | ||
32 | /* MMIO Device Registers */ | 33 | /* MMIO Device Registers */ |
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 2e4a54c8afeb..d10cc899c460 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -23,16 +23,19 @@ | |||
23 | #include <linux/dmaengine.h> | 23 | #include <linux/dmaengine.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
26 | #include <linux/dmapool.h> | ||
27 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
28 | #include <cpu/dma.h> | 27 | #include <cpu/dma.h> |
29 | #include <asm/dma-sh.h> | 28 | #include <asm/dma-sh.h> |
30 | #include "shdma.h" | 29 | #include "shdma.h" |
31 | 30 | ||
32 | /* DMA descriptor control */ | 31 | /* DMA descriptor control */ |
33 | #define DESC_LAST (-1) | 32 | enum sh_dmae_desc_status { |
34 | #define DESC_COMP (1) | 33 | DESC_IDLE, |
35 | #define DESC_NCOMP (0) | 34 | DESC_PREPARED, |
35 | DESC_SUBMITTED, | ||
36 | DESC_COMPLETED, /* completed, have to call callback */ | ||
37 | DESC_WAITING, /* callback called, waiting for ack / re-submit */ | ||
38 | }; | ||
36 | 39 | ||
37 | #define NR_DESCS_PER_CHANNEL 32 | 40 | #define NR_DESCS_PER_CHANNEL 32 |
38 | /* | 41 | /* |
@@ -45,6 +48,8 @@ | |||
45 | */ | 48 | */ |
46 | #define RS_DEFAULT (RS_DUAL) | 49 | #define RS_DEFAULT (RS_DUAL) |
47 | 50 | ||
51 | static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all); | ||
52 | |||
48 | #define SH_DMAC_CHAN_BASE(id) (dma_base_addr[id]) | 53 | #define SH_DMAC_CHAN_BASE(id) (dma_base_addr[id]) |
49 | static void sh_dmae_writel(struct sh_dmae_chan *sh_dc, u32 data, u32 reg) | 54 | static void sh_dmae_writel(struct sh_dmae_chan *sh_dc, u32 data, u32 reg) |
50 | { | 55 | { |
@@ -106,11 +111,11 @@ static inline unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan) | |||
106 | return ts_shift[(chcr & CHCR_TS_MASK) >> CHCR_TS_SHIFT]; | 111 | return ts_shift[(chcr & CHCR_TS_MASK) >> CHCR_TS_SHIFT]; |
107 | } | 112 | } |
108 | 113 | ||
109 | static void dmae_set_reg(struct sh_dmae_chan *sh_chan, struct sh_dmae_regs hw) | 114 | static void dmae_set_reg(struct sh_dmae_chan *sh_chan, struct sh_dmae_regs *hw) |
110 | { | 115 | { |
111 | sh_dmae_writel(sh_chan, hw.sar, SAR); | 116 | sh_dmae_writel(sh_chan, hw->sar, SAR); |
112 | sh_dmae_writel(sh_chan, hw.dar, DAR); | 117 | sh_dmae_writel(sh_chan, hw->dar, DAR); |
113 | sh_dmae_writel(sh_chan, hw.tcr >> calc_xmit_shift(sh_chan), TCR); | 118 | sh_dmae_writel(sh_chan, hw->tcr >> calc_xmit_shift(sh_chan), TCR); |
114 | } | 119 | } |
115 | 120 | ||
116 | static void dmae_start(struct sh_dmae_chan *sh_chan) | 121 | static void dmae_start(struct sh_dmae_chan *sh_chan) |
@@ -184,8 +189,9 @@ static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val) | |||
184 | 189 | ||
185 | static dma_cookie_t sh_dmae_tx_submit(struct dma_async_tx_descriptor *tx) | 190 | static dma_cookie_t sh_dmae_tx_submit(struct dma_async_tx_descriptor *tx) |
186 | { | 191 | { |
187 | struct sh_desc *desc = tx_to_sh_desc(tx); | 192 | struct sh_desc *desc = tx_to_sh_desc(tx), *chunk, *last = desc, *c; |
188 | struct sh_dmae_chan *sh_chan = to_sh_chan(tx->chan); | 193 | struct sh_dmae_chan *sh_chan = to_sh_chan(tx->chan); |
194 | dma_async_tx_callback callback = tx->callback; | ||
189 | dma_cookie_t cookie; | 195 | dma_cookie_t cookie; |
190 | 196 | ||
191 | spin_lock_bh(&sh_chan->desc_lock); | 197 | spin_lock_bh(&sh_chan->desc_lock); |
@@ -195,45 +201,53 @@ static dma_cookie_t sh_dmae_tx_submit(struct dma_async_tx_descriptor *tx) | |||
195 | if (cookie < 0) | 201 | if (cookie < 0) |
196 | cookie = 1; | 202 | cookie = 1; |
197 | 203 | ||
198 | /* If desc only in the case of 1 */ | 204 | sh_chan->common.cookie = cookie; |
199 | if (desc->async_tx.cookie != -EBUSY) | 205 | tx->cookie = cookie; |
200 | desc->async_tx.cookie = cookie; | 206 | |
201 | sh_chan->common.cookie = desc->async_tx.cookie; | 207 | /* Mark all chunks of this descriptor as submitted, move to the queue */ |
208 | list_for_each_entry_safe(chunk, c, desc->node.prev, node) { | ||
209 | /* | ||
210 | * All chunks are on the global ld_free, so, we have to find | ||
211 | * the end of the chain ourselves | ||
212 | */ | ||
213 | if (chunk != desc && (chunk->mark == DESC_IDLE || | ||
214 | chunk->async_tx.cookie > 0 || | ||
215 | chunk->async_tx.cookie == -EBUSY || | ||
216 | &chunk->node == &sh_chan->ld_free)) | ||
217 | break; | ||
218 | chunk->mark = DESC_SUBMITTED; | ||
219 | /* Callback goes to the last chunk */ | ||
220 | chunk->async_tx.callback = NULL; | ||
221 | chunk->cookie = cookie; | ||
222 | list_move_tail(&chunk->node, &sh_chan->ld_queue); | ||
223 | last = chunk; | ||
224 | } | ||
225 | |||
226 | last->async_tx.callback = callback; | ||
227 | last->async_tx.callback_param = tx->callback_param; | ||
202 | 228 | ||
203 | list_splice_init(&desc->tx_list, sh_chan->ld_queue.prev); | 229 | dev_dbg(sh_chan->dev, "submit #%d@%p on %d: %x[%d] -> %x\n", |
230 | tx->cookie, &last->async_tx, sh_chan->id, | ||
231 | desc->hw.sar, desc->hw.tcr, desc->hw.dar); | ||
204 | 232 | ||
205 | spin_unlock_bh(&sh_chan->desc_lock); | 233 | spin_unlock_bh(&sh_chan->desc_lock); |
206 | 234 | ||
207 | return cookie; | 235 | return cookie; |
208 | } | 236 | } |
209 | 237 | ||
238 | /* Called with desc_lock held */ | ||
210 | static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan) | 239 | static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan) |
211 | { | 240 | { |
212 | struct sh_desc *desc, *_desc, *ret = NULL; | 241 | struct sh_desc *desc; |
213 | 242 | ||
214 | spin_lock_bh(&sh_chan->desc_lock); | 243 | list_for_each_entry(desc, &sh_chan->ld_free, node) |
215 | list_for_each_entry_safe(desc, _desc, &sh_chan->ld_free, node) { | 244 | if (desc->mark != DESC_PREPARED) { |
216 | if (async_tx_test_ack(&desc->async_tx)) { | 245 | BUG_ON(desc->mark != DESC_IDLE); |
217 | list_del(&desc->node); | 246 | list_del(&desc->node); |
218 | ret = desc; | 247 | return desc; |
219 | break; | ||
220 | } | 248 | } |
221 | } | ||
222 | spin_unlock_bh(&sh_chan->desc_lock); | ||
223 | |||
224 | return ret; | ||
225 | } | ||
226 | |||
227 | static void sh_dmae_put_desc(struct sh_dmae_chan *sh_chan, struct sh_desc *desc) | ||
228 | { | ||
229 | if (desc) { | ||
230 | spin_lock_bh(&sh_chan->desc_lock); | ||
231 | |||
232 | list_splice_init(&desc->tx_list, &sh_chan->ld_free); | ||
233 | list_add(&desc->node, &sh_chan->ld_free); | ||
234 | 249 | ||
235 | spin_unlock_bh(&sh_chan->desc_lock); | 250 | return NULL; |
236 | } | ||
237 | } | 251 | } |
238 | 252 | ||
239 | static int sh_dmae_alloc_chan_resources(struct dma_chan *chan) | 253 | static int sh_dmae_alloc_chan_resources(struct dma_chan *chan) |
@@ -252,11 +266,10 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan) | |||
252 | dma_async_tx_descriptor_init(&desc->async_tx, | 266 | dma_async_tx_descriptor_init(&desc->async_tx, |
253 | &sh_chan->common); | 267 | &sh_chan->common); |
254 | desc->async_tx.tx_submit = sh_dmae_tx_submit; | 268 | desc->async_tx.tx_submit = sh_dmae_tx_submit; |
255 | desc->async_tx.flags = DMA_CTRL_ACK; | 269 | desc->mark = DESC_IDLE; |
256 | INIT_LIST_HEAD(&desc->tx_list); | ||
257 | sh_dmae_put_desc(sh_chan, desc); | ||
258 | 270 | ||
259 | spin_lock_bh(&sh_chan->desc_lock); | 271 | spin_lock_bh(&sh_chan->desc_lock); |
272 | list_add(&desc->node, &sh_chan->ld_free); | ||
260 | sh_chan->descs_allocated++; | 273 | sh_chan->descs_allocated++; |
261 | } | 274 | } |
262 | spin_unlock_bh(&sh_chan->desc_lock); | 275 | spin_unlock_bh(&sh_chan->desc_lock); |
@@ -273,7 +286,10 @@ static void sh_dmae_free_chan_resources(struct dma_chan *chan) | |||
273 | struct sh_desc *desc, *_desc; | 286 | struct sh_desc *desc, *_desc; |
274 | LIST_HEAD(list); | 287 | LIST_HEAD(list); |
275 | 288 | ||
276 | BUG_ON(!list_empty(&sh_chan->ld_queue)); | 289 | /* Prepared and not submitted descriptors can still be on the queue */ |
290 | if (!list_empty(&sh_chan->ld_queue)) | ||
291 | sh_dmae_chan_ld_cleanup(sh_chan, true); | ||
292 | |||
277 | spin_lock_bh(&sh_chan->desc_lock); | 293 | spin_lock_bh(&sh_chan->desc_lock); |
278 | 294 | ||
279 | list_splice_init(&sh_chan->ld_free, &list); | 295 | list_splice_init(&sh_chan->ld_free, &list); |
@@ -292,6 +308,8 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy( | |||
292 | struct sh_dmae_chan *sh_chan; | 308 | struct sh_dmae_chan *sh_chan; |
293 | struct sh_desc *first = NULL, *prev = NULL, *new; | 309 | struct sh_desc *first = NULL, *prev = NULL, *new; |
294 | size_t copy_size; | 310 | size_t copy_size; |
311 | LIST_HEAD(tx_list); | ||
312 | int chunks = (len + SH_DMA_TCR_MAX) / (SH_DMA_TCR_MAX + 1); | ||
295 | 313 | ||
296 | if (!chan) | 314 | if (!chan) |
297 | return NULL; | 315 | return NULL; |
@@ -301,108 +319,189 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy( | |||
301 | 319 | ||
302 | sh_chan = to_sh_chan(chan); | 320 | sh_chan = to_sh_chan(chan); |
303 | 321 | ||
322 | /* Have to lock the whole loop to protect against concurrent release */ | ||
323 | spin_lock_bh(&sh_chan->desc_lock); | ||
324 | |||
325 | /* | ||
326 | * Chaining: | ||
327 | * first descriptor is what user is dealing with in all API calls, its | ||
328 | * cookie is at first set to -EBUSY, at tx-submit to a positive | ||
329 | * number | ||
330 | * if more than one chunk is needed further chunks have cookie = -EINVAL | ||
331 | * the last chunk, if not equal to the first, has cookie = -ENOSPC | ||
332 | * all chunks are linked onto the tx_list head with their .node heads | ||
333 | * only during this function, then they are immediately spliced | ||
334 | * back onto the free list in form of a chain | ||
335 | */ | ||
304 | do { | 336 | do { |
305 | /* Allocate the link descriptor from DMA pool */ | 337 | /* Allocate the link descriptor from the free list */ |
306 | new = sh_dmae_get_desc(sh_chan); | 338 | new = sh_dmae_get_desc(sh_chan); |
307 | if (!new) { | 339 | if (!new) { |
308 | dev_err(sh_chan->dev, | 340 | dev_err(sh_chan->dev, |
309 | "No free memory for link descriptor\n"); | 341 | "No free memory for link descriptor\n"); |
310 | goto err_get_desc; | 342 | list_for_each_entry(new, &tx_list, node) |
343 | new->mark = DESC_IDLE; | ||
344 | list_splice(&tx_list, &sh_chan->ld_free); | ||
345 | spin_unlock_bh(&sh_chan->desc_lock); | ||
346 | return NULL; | ||
311 | } | 347 | } |
312 | 348 | ||
313 | copy_size = min(len, (size_t)SH_DMA_TCR_MAX); | 349 | copy_size = min(len, (size_t)SH_DMA_TCR_MAX + 1); |
314 | 350 | ||
315 | new->hw.sar = dma_src; | 351 | new->hw.sar = dma_src; |
316 | new->hw.dar = dma_dest; | 352 | new->hw.dar = dma_dest; |
317 | new->hw.tcr = copy_size; | 353 | new->hw.tcr = copy_size; |
318 | if (!first) | 354 | if (!first) { |
355 | /* First desc */ | ||
356 | new->async_tx.cookie = -EBUSY; | ||
319 | first = new; | 357 | first = new; |
358 | } else { | ||
359 | /* Other desc - invisible to the user */ | ||
360 | new->async_tx.cookie = -EINVAL; | ||
361 | } | ||
320 | 362 | ||
321 | new->mark = DESC_NCOMP; | 363 | dev_dbg(sh_chan->dev, |
322 | async_tx_ack(&new->async_tx); | 364 | "chaining %u of %u with %p, dst %x, cookie %d\n", |
365 | copy_size, len, &new->async_tx, dma_dest, | ||
366 | new->async_tx.cookie); | ||
367 | |||
368 | new->mark = DESC_PREPARED; | ||
369 | new->async_tx.flags = flags; | ||
370 | new->chunks = chunks--; | ||
323 | 371 | ||
324 | prev = new; | 372 | prev = new; |
325 | len -= copy_size; | 373 | len -= copy_size; |
326 | dma_src += copy_size; | 374 | dma_src += copy_size; |
327 | dma_dest += copy_size; | 375 | dma_dest += copy_size; |
328 | /* Insert the link descriptor to the LD ring */ | 376 | /* Insert the link descriptor to the LD ring */ |
329 | list_add_tail(&new->node, &first->tx_list); | 377 | list_add_tail(&new->node, &tx_list); |
330 | } while (len); | 378 | } while (len); |
331 | 379 | ||
332 | new->async_tx.flags = flags; /* client is in control of this ack */ | 380 | if (new != first) |
333 | new->async_tx.cookie = -EBUSY; /* Last desc */ | 381 | new->async_tx.cookie = -ENOSPC; |
334 | 382 | ||
335 | return &first->async_tx; | 383 | /* Put them back on the free list, so, they don't get lost */ |
384 | list_splice_tail(&tx_list, &sh_chan->ld_free); | ||
336 | 385 | ||
337 | err_get_desc: | 386 | spin_unlock_bh(&sh_chan->desc_lock); |
338 | sh_dmae_put_desc(sh_chan, first); | ||
339 | return NULL; | ||
340 | 387 | ||
388 | return &first->async_tx; | ||
341 | } | 389 | } |
342 | 390 | ||
343 | /* | 391 | static dma_async_tx_callback __ld_cleanup(struct sh_dmae_chan *sh_chan, bool all) |
344 | * sh_chan_ld_cleanup - Clean up link descriptors | ||
345 | * | ||
346 | * This function clean up the ld_queue of DMA channel. | ||
347 | */ | ||
348 | static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan) | ||
349 | { | 392 | { |
350 | struct sh_desc *desc, *_desc; | 393 | struct sh_desc *desc, *_desc; |
394 | /* Is the "exposed" head of a chain acked? */ | ||
395 | bool head_acked = false; | ||
396 | dma_cookie_t cookie = 0; | ||
397 | dma_async_tx_callback callback = NULL; | ||
398 | void *param = NULL; | ||
351 | 399 | ||
352 | spin_lock_bh(&sh_chan->desc_lock); | 400 | spin_lock_bh(&sh_chan->desc_lock); |
353 | list_for_each_entry_safe(desc, _desc, &sh_chan->ld_queue, node) { | 401 | list_for_each_entry_safe(desc, _desc, &sh_chan->ld_queue, node) { |
354 | dma_async_tx_callback callback; | 402 | struct dma_async_tx_descriptor *tx = &desc->async_tx; |
355 | void *callback_param; | 403 | |
356 | 404 | BUG_ON(tx->cookie > 0 && tx->cookie != desc->cookie); | |
357 | /* non send data */ | 405 | BUG_ON(desc->mark != DESC_SUBMITTED && |
358 | if (desc->mark == DESC_NCOMP) | 406 | desc->mark != DESC_COMPLETED && |
407 | desc->mark != DESC_WAITING); | ||
408 | |||
409 | /* | ||
410 | * queue is ordered, and we use this loop to (1) clean up all | ||
411 | * completed descriptors, and to (2) update descriptor flags of | ||
412 | * any chunks in a (partially) completed chain | ||
413 | */ | ||
414 | if (!all && desc->mark == DESC_SUBMITTED && | ||
415 | desc->cookie != cookie) | ||
359 | break; | 416 | break; |
360 | 417 | ||
361 | /* send data sesc */ | 418 | if (tx->cookie > 0) |
362 | callback = desc->async_tx.callback; | 419 | cookie = tx->cookie; |
363 | callback_param = desc->async_tx.callback_param; | ||
364 | 420 | ||
365 | /* Remove from ld_queue list */ | 421 | if (desc->mark == DESC_COMPLETED && desc->chunks == 1) { |
366 | list_splice_init(&desc->tx_list, &sh_chan->ld_free); | 422 | BUG_ON(sh_chan->completed_cookie != desc->cookie - 1); |
423 | sh_chan->completed_cookie = desc->cookie; | ||
424 | } | ||
367 | 425 | ||
368 | dev_dbg(sh_chan->dev, "link descriptor %p will be recycle.\n", | 426 | /* Call callback on the last chunk */ |
369 | desc); | 427 | if (desc->mark == DESC_COMPLETED && tx->callback) { |
428 | desc->mark = DESC_WAITING; | ||
429 | callback = tx->callback; | ||
430 | param = tx->callback_param; | ||
431 | dev_dbg(sh_chan->dev, "descriptor #%d@%p on %d callback\n", | ||
432 | tx->cookie, tx, sh_chan->id); | ||
433 | BUG_ON(desc->chunks != 1); | ||
434 | break; | ||
435 | } | ||
370 | 436 | ||
371 | list_move(&desc->node, &sh_chan->ld_free); | 437 | if (tx->cookie > 0 || tx->cookie == -EBUSY) { |
372 | /* Run the link descriptor callback function */ | 438 | if (desc->mark == DESC_COMPLETED) { |
373 | if (callback) { | 439 | BUG_ON(tx->cookie < 0); |
374 | spin_unlock_bh(&sh_chan->desc_lock); | 440 | desc->mark = DESC_WAITING; |
375 | dev_dbg(sh_chan->dev, "link descriptor %p callback\n", | 441 | } |
376 | desc); | 442 | head_acked = async_tx_test_ack(tx); |
377 | callback(callback_param); | 443 | } else { |
378 | spin_lock_bh(&sh_chan->desc_lock); | 444 | switch (desc->mark) { |
445 | case DESC_COMPLETED: | ||
446 | desc->mark = DESC_WAITING; | ||
447 | /* Fall through */ | ||
448 | case DESC_WAITING: | ||
449 | if (head_acked) | ||
450 | async_tx_ack(&desc->async_tx); | ||
451 | } | ||
452 | } | ||
453 | |||
454 | dev_dbg(sh_chan->dev, "descriptor %p #%d completed.\n", | ||
455 | tx, tx->cookie); | ||
456 | |||
457 | if (((desc->mark == DESC_COMPLETED || | ||
458 | desc->mark == DESC_WAITING) && | ||
459 | async_tx_test_ack(&desc->async_tx)) || all) { | ||
460 | /* Remove from ld_queue list */ | ||
461 | desc->mark = DESC_IDLE; | ||
462 | list_move(&desc->node, &sh_chan->ld_free); | ||
379 | } | 463 | } |
380 | } | 464 | } |
381 | spin_unlock_bh(&sh_chan->desc_lock); | 465 | spin_unlock_bh(&sh_chan->desc_lock); |
466 | |||
467 | if (callback) | ||
468 | callback(param); | ||
469 | |||
470 | return callback; | ||
471 | } | ||
472 | |||
473 | /* | ||
474 | * sh_chan_ld_cleanup - Clean up link descriptors | ||
475 | * | ||
476 | * This function cleans up the ld_queue of DMA channel. | ||
477 | */ | ||
478 | static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all) | ||
479 | { | ||
480 | while (__ld_cleanup(sh_chan, all)) | ||
481 | ; | ||
382 | } | 482 | } |
383 | 483 | ||
384 | static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan) | 484 | static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan) |
385 | { | 485 | { |
386 | struct list_head *ld_node; | 486 | struct sh_desc *sd; |
387 | struct sh_dmae_regs hw; | ||
388 | 487 | ||
488 | spin_lock_bh(&sh_chan->desc_lock); | ||
389 | /* DMA work check */ | 489 | /* DMA work check */ |
390 | if (dmae_is_busy(sh_chan)) | 490 | if (dmae_is_busy(sh_chan)) { |
491 | spin_unlock_bh(&sh_chan->desc_lock); | ||
391 | return; | 492 | return; |
493 | } | ||
392 | 494 | ||
393 | /* Find the first un-transfer desciptor */ | 495 | /* Find the first un-transfer desciptor */ |
394 | for (ld_node = sh_chan->ld_queue.next; | 496 | list_for_each_entry(sd, &sh_chan->ld_queue, node) |
395 | (ld_node != &sh_chan->ld_queue) | 497 | if (sd->mark == DESC_SUBMITTED) { |
396 | && (to_sh_desc(ld_node)->mark == DESC_COMP); | 498 | /* Get the ld start address from ld_queue */ |
397 | ld_node = ld_node->next) | 499 | dmae_set_reg(sh_chan, &sd->hw); |
398 | cpu_relax(); | 500 | dmae_start(sh_chan); |
399 | 501 | break; | |
400 | if (ld_node != &sh_chan->ld_queue) { | 502 | } |
401 | /* Get the ld start address from ld_queue */ | 503 | |
402 | hw = to_sh_desc(ld_node)->hw; | 504 | spin_unlock_bh(&sh_chan->desc_lock); |
403 | dmae_set_reg(sh_chan, hw); | ||
404 | dmae_start(sh_chan); | ||
405 | } | ||
406 | } | 505 | } |
407 | 506 | ||
408 | static void sh_dmae_memcpy_issue_pending(struct dma_chan *chan) | 507 | static void sh_dmae_memcpy_issue_pending(struct dma_chan *chan) |
@@ -420,12 +519,11 @@ static enum dma_status sh_dmae_is_complete(struct dma_chan *chan, | |||
420 | dma_cookie_t last_used; | 519 | dma_cookie_t last_used; |
421 | dma_cookie_t last_complete; | 520 | dma_cookie_t last_complete; |
422 | 521 | ||
423 | sh_dmae_chan_ld_cleanup(sh_chan); | 522 | sh_dmae_chan_ld_cleanup(sh_chan, false); |
424 | 523 | ||
425 | last_used = chan->cookie; | 524 | last_used = chan->cookie; |
426 | last_complete = sh_chan->completed_cookie; | 525 | last_complete = sh_chan->completed_cookie; |
427 | if (last_complete == -EBUSY) | 526 | BUG_ON(last_complete < 0); |
428 | last_complete = last_used; | ||
429 | 527 | ||
430 | if (done) | 528 | if (done) |
431 | *done = last_complete; | 529 | *done = last_complete; |
@@ -480,11 +578,13 @@ static irqreturn_t sh_dmae_err(int irq, void *data) | |||
480 | err = sh_dmae_rst(0); | 578 | err = sh_dmae_rst(0); |
481 | if (err) | 579 | if (err) |
482 | return err; | 580 | return err; |
581 | #ifdef SH_DMAC_BASE1 | ||
483 | if (shdev->pdata.mode & SHDMA_DMAOR1) { | 582 | if (shdev->pdata.mode & SHDMA_DMAOR1) { |
484 | err = sh_dmae_rst(1); | 583 | err = sh_dmae_rst(1); |
485 | if (err) | 584 | if (err) |
486 | return err; | 585 | return err; |
487 | } | 586 | } |
587 | #endif | ||
488 | disable_irq(irq); | 588 | disable_irq(irq); |
489 | return IRQ_HANDLED; | 589 | return IRQ_HANDLED; |
490 | } | 590 | } |
@@ -494,35 +594,25 @@ static irqreturn_t sh_dmae_err(int irq, void *data) | |||
494 | static void dmae_do_tasklet(unsigned long data) | 594 | static void dmae_do_tasklet(unsigned long data) |
495 | { | 595 | { |
496 | struct sh_dmae_chan *sh_chan = (struct sh_dmae_chan *)data; | 596 | struct sh_dmae_chan *sh_chan = (struct sh_dmae_chan *)data; |
497 | struct sh_desc *desc, *_desc, *cur_desc = NULL; | 597 | struct sh_desc *desc; |
498 | u32 sar_buf = sh_dmae_readl(sh_chan, SAR); | 598 | u32 sar_buf = sh_dmae_readl(sh_chan, SAR); |
499 | 599 | ||
500 | list_for_each_entry_safe(desc, _desc, | 600 | spin_lock(&sh_chan->desc_lock); |
501 | &sh_chan->ld_queue, node) { | 601 | list_for_each_entry(desc, &sh_chan->ld_queue, node) { |
502 | if ((desc->hw.sar + desc->hw.tcr) == sar_buf) { | 602 | if ((desc->hw.sar + desc->hw.tcr) == sar_buf && |
503 | cur_desc = desc; | 603 | desc->mark == DESC_SUBMITTED) { |
604 | dev_dbg(sh_chan->dev, "done #%d@%p dst %u\n", | ||
605 | desc->async_tx.cookie, &desc->async_tx, | ||
606 | desc->hw.dar); | ||
607 | desc->mark = DESC_COMPLETED; | ||
504 | break; | 608 | break; |
505 | } | 609 | } |
506 | } | 610 | } |
611 | spin_unlock(&sh_chan->desc_lock); | ||
507 | 612 | ||
508 | if (cur_desc) { | ||
509 | switch (cur_desc->async_tx.cookie) { | ||
510 | case 0: /* other desc data */ | ||
511 | break; | ||
512 | case -EBUSY: /* last desc */ | ||
513 | sh_chan->completed_cookie = | ||
514 | cur_desc->async_tx.cookie; | ||
515 | break; | ||
516 | default: /* first desc ( 0 < )*/ | ||
517 | sh_chan->completed_cookie = | ||
518 | cur_desc->async_tx.cookie - 1; | ||
519 | break; | ||
520 | } | ||
521 | cur_desc->mark = DESC_COMP; | ||
522 | } | ||
523 | /* Next desc */ | 613 | /* Next desc */ |
524 | sh_chan_xfer_ld_queue(sh_chan); | 614 | sh_chan_xfer_ld_queue(sh_chan); |
525 | sh_dmae_chan_ld_cleanup(sh_chan); | 615 | sh_dmae_chan_ld_cleanup(sh_chan, false); |
526 | } | 616 | } |
527 | 617 | ||
528 | static unsigned int get_dmae_irq(unsigned int id) | 618 | static unsigned int get_dmae_irq(unsigned int id) |
diff --git a/drivers/dma/shdma.h b/drivers/dma/shdma.h index 60b81e529b42..108f1cffb6f5 100644 --- a/drivers/dma/shdma.h +++ b/drivers/dma/shdma.h | |||
@@ -13,9 +13,9 @@ | |||
13 | #ifndef __DMA_SHDMA_H | 13 | #ifndef __DMA_SHDMA_H |
14 | #define __DMA_SHDMA_H | 14 | #define __DMA_SHDMA_H |
15 | 15 | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/dmapool.h> | ||
18 | #include <linux/dmaengine.h> | 16 | #include <linux/dmaengine.h> |
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/list.h> | ||
19 | 19 | ||
20 | #define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */ | 20 | #define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */ |
21 | 21 | ||
@@ -26,13 +26,16 @@ struct sh_dmae_regs { | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | struct sh_desc { | 28 | struct sh_desc { |
29 | struct list_head tx_list; | ||
30 | struct sh_dmae_regs hw; | 29 | struct sh_dmae_regs hw; |
31 | struct list_head node; | 30 | struct list_head node; |
32 | struct dma_async_tx_descriptor async_tx; | 31 | struct dma_async_tx_descriptor async_tx; |
32 | dma_cookie_t cookie; | ||
33 | int chunks; | ||
33 | int mark; | 34 | int mark; |
34 | }; | 35 | }; |
35 | 36 | ||
37 | struct device; | ||
38 | |||
36 | struct sh_dmae_chan { | 39 | struct sh_dmae_chan { |
37 | dma_cookie_t completed_cookie; /* The maximum cookie completed */ | 40 | dma_cookie_t completed_cookie; /* The maximum cookie completed */ |
38 | spinlock_t desc_lock; /* Descriptor operation lock */ | 41 | spinlock_t desc_lock; /* Descriptor operation lock */ |
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig index 13efcd362072..a9371b36a9b9 100644 --- a/drivers/firewire/Kconfig +++ b/drivers/firewire/Kconfig | |||
@@ -1,5 +1,10 @@ | |||
1 | menu "IEEE 1394 (FireWire) support" | ||
2 | depends on PCI || BROKEN | ||
3 | # firewire-core does not depend on PCI but is | ||
4 | # not useful without PCI controller driver | ||
5 | |||
1 | comment "You can enable one or both FireWire driver stacks." | 6 | comment "You can enable one or both FireWire driver stacks." |
2 | comment "See the help texts for more information." | 7 | comment "The newer stack is recommended." |
3 | 8 | ||
4 | config FIREWIRE | 9 | config FIREWIRE |
5 | tristate "FireWire driver stack" | 10 | tristate "FireWire driver stack" |
@@ -15,16 +20,6 @@ config FIREWIRE | |||
15 | To compile this driver as a module, say M here: the module will be | 20 | To compile this driver as a module, say M here: the module will be |
16 | called firewire-core. | 21 | called firewire-core. |
17 | 22 | ||
18 | This module functionally replaces ieee1394, raw1394, and video1394. | ||
19 | To access it from application programs, you generally need at least | ||
20 | libraw1394 v2. IIDC/DCAM applications need libdc1394 v2. | ||
21 | No libraries are required to access storage devices through the | ||
22 | firewire-sbp2 driver. | ||
23 | |||
24 | NOTE: | ||
25 | FireWire audio devices currently require the old drivers (ieee1394, | ||
26 | ohci1394, raw1394). | ||
27 | |||
28 | config FIREWIRE_OHCI | 23 | config FIREWIRE_OHCI |
29 | tristate "OHCI-1394 controllers" | 24 | tristate "OHCI-1394 controllers" |
30 | depends on PCI && FIREWIRE | 25 | depends on PCI && FIREWIRE |
@@ -34,22 +29,7 @@ config FIREWIRE_OHCI | |||
34 | is the only chipset in use, so say Y here. | 29 | is the only chipset in use, so say Y here. |
35 | 30 | ||
36 | To compile this driver as a module, say M here: The module will be | 31 | To compile this driver as a module, say M here: The module will be |
37 | called firewire-ohci. It replaces ohci1394 of the classic IEEE 1394 | 32 | called firewire-ohci. |
38 | stack. | ||
39 | |||
40 | NOTE: | ||
41 | If you want to install firewire-ohci and ohci1394 together, you | ||
42 | should configure them only as modules and blacklist the driver(s) | ||
43 | which you don't want to have auto-loaded. Add either | ||
44 | |||
45 | blacklist firewire-ohci | ||
46 | or | ||
47 | blacklist ohci1394 | ||
48 | blacklist video1394 | ||
49 | blacklist dv1394 | ||
50 | |||
51 | to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf | ||
52 | depending on your distribution. | ||
53 | 33 | ||
54 | config FIREWIRE_OHCI_DEBUG | 34 | config FIREWIRE_OHCI_DEBUG |
55 | bool | 35 | bool |
@@ -66,8 +46,7 @@ config FIREWIRE_SBP2 | |||
66 | like scanners. | 46 | like scanners. |
67 | 47 | ||
68 | To compile this driver as a module, say M here: The module will be | 48 | To compile this driver as a module, say M here: The module will be |
69 | called firewire-sbp2. It replaces sbp2 of the classic IEEE 1394 | 49 | called firewire-sbp2. |
70 | stack. | ||
71 | 50 | ||
72 | You should also enable support for disks, CD-ROMs, etc. in the SCSI | 51 | You should also enable support for disks, CD-ROMs, etc. in the SCSI |
73 | configuration section. | 52 | configuration section. |
@@ -83,5 +62,8 @@ config FIREWIRE_NET | |||
83 | NOTE, this driver is not stable yet! | 62 | NOTE, this driver is not stable yet! |
84 | 63 | ||
85 | To compile this driver as a module, say M here: The module will be | 64 | To compile this driver as a module, say M here: The module will be |
86 | called firewire-net. It replaces eth1394 of the classic IEEE 1394 | 65 | called firewire-net. |
87 | stack. | 66 | |
67 | source "drivers/ieee1394/Kconfig" | ||
68 | |||
69 | endmenu | ||
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 231e6ee5ba43..e6d63849e78e 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -601,8 +601,9 @@ static void release_request(struct client *client, | |||
601 | struct inbound_transaction_resource *r = container_of(resource, | 601 | struct inbound_transaction_resource *r = container_of(resource, |
602 | struct inbound_transaction_resource, resource); | 602 | struct inbound_transaction_resource, resource); |
603 | 603 | ||
604 | fw_send_response(client->device->card, r->request, | 604 | if (r->request) |
605 | RCODE_CONFLICT_ERROR); | 605 | fw_send_response(client->device->card, r->request, |
606 | RCODE_CONFLICT_ERROR); | ||
606 | kfree(r); | 607 | kfree(r); |
607 | } | 608 | } |
608 | 609 | ||
@@ -645,7 +646,8 @@ static void handle_request(struct fw_card *card, struct fw_request *request, | |||
645 | failed: | 646 | failed: |
646 | kfree(r); | 647 | kfree(r); |
647 | kfree(e); | 648 | kfree(e); |
648 | fw_send_response(card, request, RCODE_CONFLICT_ERROR); | 649 | if (request) |
650 | fw_send_response(card, request, RCODE_CONFLICT_ERROR); | ||
649 | } | 651 | } |
650 | 652 | ||
651 | static void release_address_handler(struct client *client, | 653 | static void release_address_handler(struct client *client, |
@@ -715,15 +717,18 @@ static int ioctl_send_response(struct client *client, void *buffer) | |||
715 | 717 | ||
716 | r = container_of(resource, struct inbound_transaction_resource, | 718 | r = container_of(resource, struct inbound_transaction_resource, |
717 | resource); | 719 | resource); |
718 | if (request->length < r->length) | 720 | if (r->request) { |
719 | r->length = request->length; | 721 | if (request->length < r->length) |
720 | 722 | r->length = request->length; | |
721 | if (copy_from_user(r->data, u64_to_uptr(request->data), r->length)) { | 723 | if (copy_from_user(r->data, u64_to_uptr(request->data), |
722 | ret = -EFAULT; | 724 | r->length)) { |
723 | goto out; | 725 | ret = -EFAULT; |
726 | kfree(r->request); | ||
727 | goto out; | ||
728 | } | ||
729 | fw_send_response(client->device->card, r->request, | ||
730 | request->rcode); | ||
724 | } | 731 | } |
725 | |||
726 | fw_send_response(client->device->card, r->request, request->rcode); | ||
727 | out: | 732 | out: |
728 | kfree(r); | 733 | kfree(r); |
729 | 734 | ||
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index 842739df23e2..495849eb13cc 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c | |||
@@ -432,14 +432,20 @@ static struct fw_address_handler *lookup_overlapping_address_handler( | |||
432 | return NULL; | 432 | return NULL; |
433 | } | 433 | } |
434 | 434 | ||
435 | static bool is_enclosing_handler(struct fw_address_handler *handler, | ||
436 | unsigned long long offset, size_t length) | ||
437 | { | ||
438 | return handler->offset <= offset && | ||
439 | offset + length <= handler->offset + handler->length; | ||
440 | } | ||
441 | |||
435 | static struct fw_address_handler *lookup_enclosing_address_handler( | 442 | static struct fw_address_handler *lookup_enclosing_address_handler( |
436 | struct list_head *list, unsigned long long offset, size_t length) | 443 | struct list_head *list, unsigned long long offset, size_t length) |
437 | { | 444 | { |
438 | struct fw_address_handler *handler; | 445 | struct fw_address_handler *handler; |
439 | 446 | ||
440 | list_for_each_entry(handler, list, link) { | 447 | list_for_each_entry(handler, list, link) { |
441 | if (handler->offset <= offset && | 448 | if (is_enclosing_handler(handler, offset, length)) |
442 | offset + length <= handler->offset + handler->length) | ||
443 | return handler; | 449 | return handler; |
444 | } | 450 | } |
445 | 451 | ||
@@ -465,6 +471,12 @@ const struct fw_address_region fw_unit_space_region = | |||
465 | { .start = 0xfffff0000900ULL, .end = 0x1000000000000ULL, }; | 471 | { .start = 0xfffff0000900ULL, .end = 0x1000000000000ULL, }; |
466 | #endif /* 0 */ | 472 | #endif /* 0 */ |
467 | 473 | ||
474 | static bool is_in_fcp_region(u64 offset, size_t length) | ||
475 | { | ||
476 | return offset >= (CSR_REGISTER_BASE | CSR_FCP_COMMAND) && | ||
477 | offset + length <= (CSR_REGISTER_BASE | CSR_FCP_END); | ||
478 | } | ||
479 | |||
468 | /** | 480 | /** |
469 | * fw_core_add_address_handler - register for incoming requests | 481 | * fw_core_add_address_handler - register for incoming requests |
470 | * @handler: callback | 482 | * @handler: callback |
@@ -477,8 +489,11 @@ const struct fw_address_region fw_unit_space_region = | |||
477 | * give the details of the particular request. | 489 | * give the details of the particular request. |
478 | * | 490 | * |
479 | * Return value: 0 on success, non-zero otherwise. | 491 | * Return value: 0 on success, non-zero otherwise. |
492 | * | ||
480 | * The start offset of the handler's address region is determined by | 493 | * The start offset of the handler's address region is determined by |
481 | * fw_core_add_address_handler() and is returned in handler->offset. | 494 | * fw_core_add_address_handler() and is returned in handler->offset. |
495 | * | ||
496 | * Address allocations are exclusive, except for the FCP registers. | ||
482 | */ | 497 | */ |
483 | int fw_core_add_address_handler(struct fw_address_handler *handler, | 498 | int fw_core_add_address_handler(struct fw_address_handler *handler, |
484 | const struct fw_address_region *region) | 499 | const struct fw_address_region *region) |
@@ -498,10 +513,12 @@ int fw_core_add_address_handler(struct fw_address_handler *handler, | |||
498 | 513 | ||
499 | handler->offset = region->start; | 514 | handler->offset = region->start; |
500 | while (handler->offset + handler->length <= region->end) { | 515 | while (handler->offset + handler->length <= region->end) { |
501 | other = | 516 | if (is_in_fcp_region(handler->offset, handler->length)) |
502 | lookup_overlapping_address_handler(&address_handler_list, | 517 | other = NULL; |
503 | handler->offset, | 518 | else |
504 | handler->length); | 519 | other = lookup_overlapping_address_handler |
520 | (&address_handler_list, | ||
521 | handler->offset, handler->length); | ||
505 | if (other != NULL) { | 522 | if (other != NULL) { |
506 | handler->offset += other->length; | 523 | handler->offset += other->length; |
507 | } else { | 524 | } else { |
@@ -668,6 +685,9 @@ static struct fw_request *allocate_request(struct fw_packet *p) | |||
668 | void fw_send_response(struct fw_card *card, | 685 | void fw_send_response(struct fw_card *card, |
669 | struct fw_request *request, int rcode) | 686 | struct fw_request *request, int rcode) |
670 | { | 687 | { |
688 | if (WARN_ONCE(!request, "invalid for FCP address handlers")) | ||
689 | return; | ||
690 | |||
671 | /* unified transaction or broadcast transaction: don't respond */ | 691 | /* unified transaction or broadcast transaction: don't respond */ |
672 | if (request->ack != ACK_PENDING || | 692 | if (request->ack != ACK_PENDING || |
673 | HEADER_DESTINATION_IS_BROADCAST(request->request_header[0])) { | 693 | HEADER_DESTINATION_IS_BROADCAST(request->request_header[0])) { |
@@ -686,26 +706,15 @@ void fw_send_response(struct fw_card *card, | |||
686 | } | 706 | } |
687 | EXPORT_SYMBOL(fw_send_response); | 707 | EXPORT_SYMBOL(fw_send_response); |
688 | 708 | ||
689 | void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) | 709 | static void handle_exclusive_region_request(struct fw_card *card, |
710 | struct fw_packet *p, | ||
711 | struct fw_request *request, | ||
712 | unsigned long long offset) | ||
690 | { | 713 | { |
691 | struct fw_address_handler *handler; | 714 | struct fw_address_handler *handler; |
692 | struct fw_request *request; | ||
693 | unsigned long long offset; | ||
694 | unsigned long flags; | 715 | unsigned long flags; |
695 | int tcode, destination, source; | 716 | int tcode, destination, source; |
696 | 717 | ||
697 | if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE) | ||
698 | return; | ||
699 | |||
700 | request = allocate_request(p); | ||
701 | if (request == NULL) { | ||
702 | /* FIXME: send statically allocated busy packet. */ | ||
703 | return; | ||
704 | } | ||
705 | |||
706 | offset = | ||
707 | ((unsigned long long) | ||
708 | HEADER_GET_OFFSET_HIGH(p->header[1]) << 32) | p->header[2]; | ||
709 | tcode = HEADER_GET_TCODE(p->header[0]); | 718 | tcode = HEADER_GET_TCODE(p->header[0]); |
710 | destination = HEADER_GET_DESTINATION(p->header[0]); | 719 | destination = HEADER_GET_DESTINATION(p->header[0]); |
711 | source = HEADER_GET_SOURCE(p->header[1]); | 720 | source = HEADER_GET_SOURCE(p->header[1]); |
@@ -732,6 +741,73 @@ void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) | |||
732 | request->data, request->length, | 741 | request->data, request->length, |
733 | handler->callback_data); | 742 | handler->callback_data); |
734 | } | 743 | } |
744 | |||
745 | static void handle_fcp_region_request(struct fw_card *card, | ||
746 | struct fw_packet *p, | ||
747 | struct fw_request *request, | ||
748 | unsigned long long offset) | ||
749 | { | ||
750 | struct fw_address_handler *handler; | ||
751 | unsigned long flags; | ||
752 | int tcode, destination, source; | ||
753 | |||
754 | if ((offset != (CSR_REGISTER_BASE | CSR_FCP_COMMAND) && | ||
755 | offset != (CSR_REGISTER_BASE | CSR_FCP_RESPONSE)) || | ||
756 | request->length > 0x200) { | ||
757 | fw_send_response(card, request, RCODE_ADDRESS_ERROR); | ||
758 | |||
759 | return; | ||
760 | } | ||
761 | |||
762 | tcode = HEADER_GET_TCODE(p->header[0]); | ||
763 | destination = HEADER_GET_DESTINATION(p->header[0]); | ||
764 | source = HEADER_GET_SOURCE(p->header[1]); | ||
765 | |||
766 | if (tcode != TCODE_WRITE_QUADLET_REQUEST && | ||
767 | tcode != TCODE_WRITE_BLOCK_REQUEST) { | ||
768 | fw_send_response(card, request, RCODE_TYPE_ERROR); | ||
769 | |||
770 | return; | ||
771 | } | ||
772 | |||
773 | spin_lock_irqsave(&address_handler_lock, flags); | ||
774 | list_for_each_entry(handler, &address_handler_list, link) { | ||
775 | if (is_enclosing_handler(handler, offset, request->length)) | ||
776 | handler->address_callback(card, NULL, tcode, | ||
777 | destination, source, | ||
778 | p->generation, p->speed, | ||
779 | offset, request->data, | ||
780 | request->length, | ||
781 | handler->callback_data); | ||
782 | } | ||
783 | spin_unlock_irqrestore(&address_handler_lock, flags); | ||
784 | |||
785 | fw_send_response(card, request, RCODE_COMPLETE); | ||
786 | } | ||
787 | |||
788 | void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) | ||
789 | { | ||
790 | struct fw_request *request; | ||
791 | unsigned long long offset; | ||
792 | |||
793 | if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE) | ||
794 | return; | ||
795 | |||
796 | request = allocate_request(p); | ||
797 | if (request == NULL) { | ||
798 | /* FIXME: send statically allocated busy packet. */ | ||
799 | return; | ||
800 | } | ||
801 | |||
802 | offset = ((u64)HEADER_GET_OFFSET_HIGH(p->header[1]) << 32) | | ||
803 | p->header[2]; | ||
804 | |||
805 | if (!is_in_fcp_region(offset, request->length)) | ||
806 | handle_exclusive_region_request(card, p, request, offset); | ||
807 | else | ||
808 | handle_fcp_region_request(card, p, request, offset); | ||
809 | |||
810 | } | ||
735 | EXPORT_SYMBOL(fw_core_handle_request); | 811 | EXPORT_SYMBOL(fw_core_handle_request); |
736 | 812 | ||
737 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) | 813 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 96768e160866..a61571c63c59 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -2226,7 +2226,6 @@ static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, | |||
2226 | if (rest == 0) | 2226 | if (rest == 0) |
2227 | return -EINVAL; | 2227 | return -EINVAL; |
2228 | 2228 | ||
2229 | /* FIXME: make packet-per-buffer/dual-buffer a context option */ | ||
2230 | while (rest > 0) { | 2229 | while (rest > 0) { |
2231 | d = context_get_descriptors(&ctx->context, | 2230 | d = context_get_descriptors(&ctx->context, |
2232 | z + header_z, &d_bus); | 2231 | z + header_z, &d_bus); |
@@ -2470,7 +2469,10 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2470 | } | 2469 | } |
2471 | 2470 | ||
2472 | version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; | 2471 | version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; |
2472 | #if 0 | ||
2473 | /* FIXME: make it a context option or remove dual-buffer mode */ | ||
2473 | ohci->use_dualbuffer = version >= OHCI_VERSION_1_1; | 2474 | ohci->use_dualbuffer = version >= OHCI_VERSION_1_1; |
2475 | #endif | ||
2474 | 2476 | ||
2475 | /* dual-buffer mode is broken if more than one IR context is active */ | 2477 | /* dual-buffer mode is broken if more than one IR context is active */ |
2476 | if (dev->vendor == PCI_VENDOR_ID_AGERE && | 2478 | if (dev->vendor == PCI_VENDOR_ID_AGERE && |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index a019b49ecc9b..1f1d88ae68d6 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -172,6 +172,15 @@ config GPIO_ADP5520 | |||
172 | To compile this driver as a module, choose M here: the module will | 172 | To compile this driver as a module, choose M here: the module will |
173 | be called adp5520-gpio. | 173 | be called adp5520-gpio. |
174 | 174 | ||
175 | config GPIO_ADP5588 | ||
176 | tristate "ADP5588 I2C GPIO expander" | ||
177 | depends on I2C | ||
178 | help | ||
179 | This option enables support for 18 GPIOs found | ||
180 | on Analog Devices ADP5588 GPIO Expanders. | ||
181 | To compile this driver as a module, choose M here: the module will be | ||
182 | called adp5588-gpio. | ||
183 | |||
175 | comment "PCI GPIO expanders:" | 184 | comment "PCI GPIO expanders:" |
176 | 185 | ||
177 | config GPIO_CS5535 | 186 | config GPIO_CS5535 |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 52fe4cf734c7..48687238edb1 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -5,6 +5,7 @@ ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG | |||
5 | obj-$(CONFIG_GPIOLIB) += gpiolib.o | 5 | obj-$(CONFIG_GPIOLIB) += gpiolib.o |
6 | 6 | ||
7 | obj-$(CONFIG_GPIO_ADP5520) += adp5520-gpio.o | 7 | obj-$(CONFIG_GPIO_ADP5520) += adp5520-gpio.o |
8 | obj-$(CONFIG_GPIO_ADP5588) += adp5588-gpio.o | ||
8 | obj-$(CONFIG_GPIO_LANGWELL) += langwell_gpio.o | 9 | obj-$(CONFIG_GPIO_LANGWELL) += langwell_gpio.o |
9 | obj-$(CONFIG_GPIO_MAX7301) += max7301.o | 10 | obj-$(CONFIG_GPIO_MAX7301) += max7301.o |
10 | obj-$(CONFIG_GPIO_MAX732X) += max732x.o | 11 | obj-$(CONFIG_GPIO_MAX732X) += max732x.o |
diff --git a/drivers/gpio/adp5588-gpio.c b/drivers/gpio/adp5588-gpio.c new file mode 100644 index 000000000000..afc097a16b33 --- /dev/null +++ b/drivers/gpio/adp5588-gpio.c | |||
@@ -0,0 +1,266 @@ | |||
1 | /* | ||
2 | * GPIO Chip driver for Analog Devices | ||
3 | * ADP5588 I/O Expander and QWERTY Keypad Controller | ||
4 | * | ||
5 | * Copyright 2009 Analog Devices Inc. | ||
6 | * | ||
7 | * Licensed under the GPL-2 or later. | ||
8 | */ | ||
9 | |||
10 | #include <linux/module.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/i2c.h> | ||
14 | #include <linux/gpio.h> | ||
15 | |||
16 | #include <linux/i2c/adp5588.h> | ||
17 | |||
18 | #define DRV_NAME "adp5588-gpio" | ||
19 | #define MAXGPIO 18 | ||
20 | #define ADP_BANK(offs) ((offs) >> 3) | ||
21 | #define ADP_BIT(offs) (1u << ((offs) & 0x7)) | ||
22 | |||
23 | struct adp5588_gpio { | ||
24 | struct i2c_client *client; | ||
25 | struct gpio_chip gpio_chip; | ||
26 | struct mutex lock; /* protect cached dir, dat_out */ | ||
27 | unsigned gpio_start; | ||
28 | uint8_t dat_out[3]; | ||
29 | uint8_t dir[3]; | ||
30 | }; | ||
31 | |||
32 | static int adp5588_gpio_read(struct i2c_client *client, u8 reg) | ||
33 | { | ||
34 | int ret = i2c_smbus_read_byte_data(client, reg); | ||
35 | |||
36 | if (ret < 0) | ||
37 | dev_err(&client->dev, "Read Error\n"); | ||
38 | |||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | static int adp5588_gpio_write(struct i2c_client *client, u8 reg, u8 val) | ||
43 | { | ||
44 | int ret = i2c_smbus_write_byte_data(client, reg, val); | ||
45 | |||
46 | if (ret < 0) | ||
47 | dev_err(&client->dev, "Write Error\n"); | ||
48 | |||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) | ||
53 | { | ||
54 | struct adp5588_gpio *dev = | ||
55 | container_of(chip, struct adp5588_gpio, gpio_chip); | ||
56 | |||
57 | return !!(adp5588_gpio_read(dev->client, GPIO_DAT_STAT1 + ADP_BANK(off)) | ||
58 | & ADP_BIT(off)); | ||
59 | } | ||
60 | |||
61 | static void adp5588_gpio_set_value(struct gpio_chip *chip, | ||
62 | unsigned off, int val) | ||
63 | { | ||
64 | unsigned bank, bit; | ||
65 | struct adp5588_gpio *dev = | ||
66 | container_of(chip, struct adp5588_gpio, gpio_chip); | ||
67 | |||
68 | bank = ADP_BANK(off); | ||
69 | bit = ADP_BIT(off); | ||
70 | |||
71 | mutex_lock(&dev->lock); | ||
72 | if (val) | ||
73 | dev->dat_out[bank] |= bit; | ||
74 | else | ||
75 | dev->dat_out[bank] &= ~bit; | ||
76 | |||
77 | adp5588_gpio_write(dev->client, GPIO_DAT_OUT1 + bank, | ||
78 | dev->dat_out[bank]); | ||
79 | mutex_unlock(&dev->lock); | ||
80 | } | ||
81 | |||
82 | static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off) | ||
83 | { | ||
84 | int ret; | ||
85 | unsigned bank; | ||
86 | struct adp5588_gpio *dev = | ||
87 | container_of(chip, struct adp5588_gpio, gpio_chip); | ||
88 | |||
89 | bank = ADP_BANK(off); | ||
90 | |||
91 | mutex_lock(&dev->lock); | ||
92 | dev->dir[bank] &= ~ADP_BIT(off); | ||
93 | ret = adp5588_gpio_write(dev->client, GPIO_DIR1 + bank, dev->dir[bank]); | ||
94 | mutex_unlock(&dev->lock); | ||
95 | |||
96 | return ret; | ||
97 | } | ||
98 | |||
99 | static int adp5588_gpio_direction_output(struct gpio_chip *chip, | ||
100 | unsigned off, int val) | ||
101 | { | ||
102 | int ret; | ||
103 | unsigned bank, bit; | ||
104 | struct adp5588_gpio *dev = | ||
105 | container_of(chip, struct adp5588_gpio, gpio_chip); | ||
106 | |||
107 | bank = ADP_BANK(off); | ||
108 | bit = ADP_BIT(off); | ||
109 | |||
110 | mutex_lock(&dev->lock); | ||
111 | dev->dir[bank] |= bit; | ||
112 | |||
113 | if (val) | ||
114 | dev->dat_out[bank] |= bit; | ||
115 | else | ||
116 | dev->dat_out[bank] &= ~bit; | ||
117 | |||
118 | ret = adp5588_gpio_write(dev->client, GPIO_DAT_OUT1 + bank, | ||
119 | dev->dat_out[bank]); | ||
120 | ret |= adp5588_gpio_write(dev->client, GPIO_DIR1 + bank, | ||
121 | dev->dir[bank]); | ||
122 | mutex_unlock(&dev->lock); | ||
123 | |||
124 | return ret; | ||
125 | } | ||
126 | |||
127 | static int __devinit adp5588_gpio_probe(struct i2c_client *client, | ||
128 | const struct i2c_device_id *id) | ||
129 | { | ||
130 | struct adp5588_gpio_platform_data *pdata = client->dev.platform_data; | ||
131 | struct adp5588_gpio *dev; | ||
132 | struct gpio_chip *gc; | ||
133 | int ret, i, revid; | ||
134 | |||
135 | if (pdata == NULL) { | ||
136 | dev_err(&client->dev, "missing platform data\n"); | ||
137 | return -ENODEV; | ||
138 | } | ||
139 | |||
140 | if (!i2c_check_functionality(client->adapter, | ||
141 | I2C_FUNC_SMBUS_BYTE_DATA)) { | ||
142 | dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); | ||
143 | return -EIO; | ||
144 | } | ||
145 | |||
146 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
147 | if (dev == NULL) { | ||
148 | dev_err(&client->dev, "failed to alloc memory\n"); | ||
149 | return -ENOMEM; | ||
150 | } | ||
151 | |||
152 | dev->client = client; | ||
153 | |||
154 | gc = &dev->gpio_chip; | ||
155 | gc->direction_input = adp5588_gpio_direction_input; | ||
156 | gc->direction_output = adp5588_gpio_direction_output; | ||
157 | gc->get = adp5588_gpio_get_value; | ||
158 | gc->set = adp5588_gpio_set_value; | ||
159 | gc->can_sleep = 1; | ||
160 | |||
161 | gc->base = pdata->gpio_start; | ||
162 | gc->ngpio = MAXGPIO; | ||
163 | gc->label = client->name; | ||
164 | gc->owner = THIS_MODULE; | ||
165 | |||
166 | mutex_init(&dev->lock); | ||
167 | |||
168 | |||
169 | ret = adp5588_gpio_read(dev->client, DEV_ID); | ||
170 | if (ret < 0) | ||
171 | goto err; | ||
172 | |||
173 | revid = ret & ADP5588_DEVICE_ID_MASK; | ||
174 | |||
175 | for (i = 0, ret = 0; i <= ADP_BANK(MAXGPIO); i++) { | ||
176 | dev->dat_out[i] = adp5588_gpio_read(client, GPIO_DAT_OUT1 + i); | ||
177 | dev->dir[i] = adp5588_gpio_read(client, GPIO_DIR1 + i); | ||
178 | ret |= adp5588_gpio_write(client, KP_GPIO1 + i, 0); | ||
179 | ret |= adp5588_gpio_write(client, GPIO_PULL1 + i, | ||
180 | (pdata->pullup_dis_mask >> (8 * i)) & 0xFF); | ||
181 | |||
182 | if (ret) | ||
183 | goto err; | ||
184 | } | ||
185 | |||
186 | ret = gpiochip_add(&dev->gpio_chip); | ||
187 | if (ret) | ||
188 | goto err; | ||
189 | |||
190 | dev_info(&client->dev, "gpios %d..%d on a %s Rev. %d\n", | ||
191 | gc->base, gc->base + gc->ngpio - 1, | ||
192 | client->name, revid); | ||
193 | |||
194 | if (pdata->setup) { | ||
195 | ret = pdata->setup(client, gc->base, gc->ngpio, pdata->context); | ||
196 | if (ret < 0) | ||
197 | dev_warn(&client->dev, "setup failed, %d\n", ret); | ||
198 | } | ||
199 | |||
200 | i2c_set_clientdata(client, dev); | ||
201 | return 0; | ||
202 | |||
203 | err: | ||
204 | kfree(dev); | ||
205 | return ret; | ||
206 | } | ||
207 | |||
208 | static int __devexit adp5588_gpio_remove(struct i2c_client *client) | ||
209 | { | ||
210 | struct adp5588_gpio_platform_data *pdata = client->dev.platform_data; | ||
211 | struct adp5588_gpio *dev = i2c_get_clientdata(client); | ||
212 | int ret; | ||
213 | |||
214 | if (pdata->teardown) { | ||
215 | ret = pdata->teardown(client, | ||
216 | dev->gpio_chip.base, dev->gpio_chip.ngpio, | ||
217 | pdata->context); | ||
218 | if (ret < 0) { | ||
219 | dev_err(&client->dev, "teardown failed %d\n", ret); | ||
220 | return ret; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | ret = gpiochip_remove(&dev->gpio_chip); | ||
225 | if (ret) { | ||
226 | dev_err(&client->dev, "gpiochip_remove failed %d\n", ret); | ||
227 | return ret; | ||
228 | } | ||
229 | |||
230 | kfree(dev); | ||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static const struct i2c_device_id adp5588_gpio_id[] = { | ||
235 | {DRV_NAME, 0}, | ||
236 | {} | ||
237 | }; | ||
238 | |||
239 | MODULE_DEVICE_TABLE(i2c, adp5588_gpio_id); | ||
240 | |||
241 | static struct i2c_driver adp5588_gpio_driver = { | ||
242 | .driver = { | ||
243 | .name = DRV_NAME, | ||
244 | }, | ||
245 | .probe = adp5588_gpio_probe, | ||
246 | .remove = __devexit_p(adp5588_gpio_remove), | ||
247 | .id_table = adp5588_gpio_id, | ||
248 | }; | ||
249 | |||
250 | static int __init adp5588_gpio_init(void) | ||
251 | { | ||
252 | return i2c_add_driver(&adp5588_gpio_driver); | ||
253 | } | ||
254 | |||
255 | module_init(adp5588_gpio_init); | ||
256 | |||
257 | static void __exit adp5588_gpio_exit(void) | ||
258 | { | ||
259 | i2c_del_driver(&adp5588_gpio_driver); | ||
260 | } | ||
261 | |||
262 | module_exit(adp5588_gpio_exit); | ||
263 | |||
264 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | ||
265 | MODULE_DESCRIPTION("GPIO ADP5588 Driver"); | ||
266 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a25ad284a272..350842ad3632 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -858,8 +858,6 @@ int gpio_sysfs_set_active_low(unsigned gpio, int value) | |||
858 | desc = &gpio_desc[gpio]; | 858 | desc = &gpio_desc[gpio]; |
859 | 859 | ||
860 | if (test_bit(FLAG_EXPORT, &desc->flags)) { | 860 | if (test_bit(FLAG_EXPORT, &desc->flags)) { |
861 | struct device *dev; | ||
862 | |||
863 | dev = class_find_device(&gpio_class, NULL, desc, match_export); | 861 | dev = class_find_device(&gpio_class, NULL, desc, match_export); |
864 | if (dev == NULL) { | 862 | if (dev == NULL) { |
865 | status = -ENODEV; | 863 | status = -ENODEV; |
diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c index 628eae3e9b83..a1fce68e3bbe 100644 --- a/drivers/gpu/drm/ati_pcigart.c +++ b/drivers/gpu/drm/ati_pcigart.c | |||
@@ -39,8 +39,7 @@ static int drm_ati_alloc_pcigart_table(struct drm_device *dev, | |||
39 | struct drm_ati_pcigart_info *gart_info) | 39 | struct drm_ati_pcigart_info *gart_info) |
40 | { | 40 | { |
41 | gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size, | 41 | gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size, |
42 | PAGE_SIZE, | 42 | PAGE_SIZE); |
43 | gart_info->table_mask); | ||
44 | if (gart_info->table_handle == NULL) | 43 | if (gart_info->table_handle == NULL) |
45 | return -ENOMEM; | 44 | return -ENOMEM; |
46 | 45 | ||
@@ -112,6 +111,13 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
112 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { | 111 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { |
113 | DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); | 112 | DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); |
114 | 113 | ||
114 | if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) { | ||
115 | DRM_ERROR("fail to set dma mask to 0x%Lx\n", | ||
116 | gart_info->table_mask); | ||
117 | ret = 1; | ||
118 | goto done; | ||
119 | } | ||
120 | |||
115 | ret = drm_ati_alloc_pcigart_table(dev, gart_info); | 121 | ret = drm_ati_alloc_pcigart_table(dev, gart_info); |
116 | if (ret) { | 122 | if (ret) { |
117 | DRM_ERROR("cannot allocate PCI GART page!\n"); | 123 | DRM_ERROR("cannot allocate PCI GART page!\n"); |
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 3d09e304f6f4..8417cc4c43f1 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -326,7 +326,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, | |||
326 | * As we're limiting the address to 2^32-1 (or less), | 326 | * As we're limiting the address to 2^32-1 (or less), |
327 | * casting it down to 32 bits is no problem, but we | 327 | * casting it down to 32 bits is no problem, but we |
328 | * need to point to a 64bit variable first. */ | 328 | * need to point to a 64bit variable first. */ |
329 | dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL); | 329 | dmah = drm_pci_alloc(dev, map->size, map->size); |
330 | if (!dmah) { | 330 | if (!dmah) { |
331 | kfree(map); | 331 | kfree(map); |
332 | return -ENOMEM; | 332 | return -ENOMEM; |
@@ -885,7 +885,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) | |||
885 | 885 | ||
886 | while (entry->buf_count < count) { | 886 | while (entry->buf_count < count) { |
887 | 887 | ||
888 | dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000, 0xfffffffful); | 888 | dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000); |
889 | 889 | ||
890 | if (!dmah) { | 890 | if (!dmah) { |
891 | /* Set count correctly so we free the proper amount. */ | 891 | /* Set count correctly so we free the proper amount. */ |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 5124401f266a..d91fb8c0b7b3 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -158,6 +158,7 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = | |||
158 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, | 158 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, |
159 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, | 159 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, |
160 | { DRM_MODE_CONNECTOR_TV, "TV", 0 }, | 160 | { DRM_MODE_CONNECTOR_TV, "TV", 0 }, |
161 | { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort", 0 }, | ||
161 | }; | 162 | }; |
162 | 163 | ||
163 | static struct drm_prop_enum_list drm_encoder_enum_list[] = | 164 | static struct drm_prop_enum_list drm_encoder_enum_list[] = |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 4231d6db72ec..077313f0d47f 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -216,7 +216,7 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc) | |||
216 | EXPORT_SYMBOL(drm_helper_crtc_in_use); | 216 | EXPORT_SYMBOL(drm_helper_crtc_in_use); |
217 | 217 | ||
218 | /** | 218 | /** |
219 | * drm_disable_unused_functions - disable unused objects | 219 | * drm_helper_disable_unused_functions - disable unused objects |
220 | * @dev: DRM device | 220 | * @dev: DRM device |
221 | * | 221 | * |
222 | * LOCKING: | 222 | * LOCKING: |
@@ -1032,7 +1032,7 @@ bool drm_helper_initial_config(struct drm_device *dev) | |||
1032 | /* | 1032 | /* |
1033 | * we shouldn't end up with no modes here. | 1033 | * we shouldn't end up with no modes here. |
1034 | */ | 1034 | */ |
1035 | WARN(!count, "No connectors reported connected with modes\n"); | 1035 | printk(KERN_INFO "No connectors reported conncted with modes\n"); |
1036 | 1036 | ||
1037 | drm_setup_crtcs(dev); | 1037 | drm_setup_crtcs(dev); |
1038 | 1038 | ||
@@ -1162,6 +1162,9 @@ EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct); | |||
1162 | int drm_helper_resume_force_mode(struct drm_device *dev) | 1162 | int drm_helper_resume_force_mode(struct drm_device *dev) |
1163 | { | 1163 | { |
1164 | struct drm_crtc *crtc; | 1164 | struct drm_crtc *crtc; |
1165 | struct drm_encoder *encoder; | ||
1166 | struct drm_encoder_helper_funcs *encoder_funcs; | ||
1167 | struct drm_crtc_helper_funcs *crtc_funcs; | ||
1165 | int ret; | 1168 | int ret; |
1166 | 1169 | ||
1167 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 1170 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
@@ -1174,6 +1177,25 @@ int drm_helper_resume_force_mode(struct drm_device *dev) | |||
1174 | 1177 | ||
1175 | if (ret == false) | 1178 | if (ret == false) |
1176 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); | 1179 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); |
1180 | |||
1181 | /* Turn off outputs that were already powered off */ | ||
1182 | if (drm_helper_choose_crtc_dpms(crtc)) { | ||
1183 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
1184 | |||
1185 | if(encoder->crtc != crtc) | ||
1186 | continue; | ||
1187 | |||
1188 | encoder_funcs = encoder->helper_private; | ||
1189 | if (encoder_funcs->dpms) | ||
1190 | (*encoder_funcs->dpms) (encoder, | ||
1191 | drm_helper_choose_encoder_dpms(encoder)); | ||
1192 | |||
1193 | crtc_funcs = crtc->helper_private; | ||
1194 | if (crtc_funcs->dpms) | ||
1195 | (*crtc_funcs->dpms) (crtc, | ||
1196 | drm_helper_choose_crtc_dpms(crtc)); | ||
1197 | } | ||
1198 | } | ||
1177 | } | 1199 | } |
1178 | /* disable the unused connectors while restoring the modesetting */ | 1200 | /* disable the unused connectors while restoring the modesetting */ |
1179 | drm_helper_disable_unused_functions(dev); | 1201 | drm_helper_disable_unused_functions(dev); |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5c9f79877cbf..defcaf108460 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -911,23 +911,27 @@ static int drm_cvt_modes(struct drm_connector *connector, | |||
911 | struct drm_device *dev = connector->dev; | 911 | struct drm_device *dev = connector->dev; |
912 | struct cvt_timing *cvt; | 912 | struct cvt_timing *cvt; |
913 | const int rates[] = { 60, 85, 75, 60, 50 }; | 913 | const int rates[] = { 60, 85, 75, 60, 50 }; |
914 | const u8 empty[3] = { 0, 0, 0 }; | ||
914 | 915 | ||
915 | for (i = 0; i < 4; i++) { | 916 | for (i = 0; i < 4; i++) { |
916 | int uninitialized_var(width), height; | 917 | int uninitialized_var(width), height; |
917 | cvt = &(timing->data.other_data.data.cvt[i]); | 918 | cvt = &(timing->data.other_data.data.cvt[i]); |
918 | 919 | ||
919 | height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2; | 920 | if (!memcmp(cvt->code, empty, 3)) |
920 | switch (cvt->code[1] & 0xc0) { | 921 | continue; |
922 | |||
923 | height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2; | ||
924 | switch (cvt->code[1] & 0x0c) { | ||
921 | case 0x00: | 925 | case 0x00: |
922 | width = height * 4 / 3; | 926 | width = height * 4 / 3; |
923 | break; | 927 | break; |
924 | case 0x40: | 928 | case 0x04: |
925 | width = height * 16 / 9; | 929 | width = height * 16 / 9; |
926 | break; | 930 | break; |
927 | case 0x80: | 931 | case 0x08: |
928 | width = height * 16 / 10; | 932 | width = height * 16 / 10; |
929 | break; | 933 | break; |
930 | case 0xc0: | 934 | case 0x0c: |
931 | width = height * 15 / 9; | 935 | width = height * 15 / 9; |
932 | break; | 936 | break; |
933 | } | 937 | } |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 1b49fa055f4f..1c2b7d44ec05 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -156,7 +156,7 @@ static bool drm_fb_helper_connector_parse_command_line(struct drm_connector *con | |||
156 | force = DRM_FORCE_ON; | 156 | force = DRM_FORCE_ON; |
157 | break; | 157 | break; |
158 | case 'D': | 158 | case 'D': |
159 | if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) || | 159 | if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) && |
160 | (connector->connector_type != DRM_MODE_CONNECTOR_HDMIB)) | 160 | (connector->connector_type != DRM_MODE_CONNECTOR_HDMIB)) |
161 | force = DRM_FORCE_ON; | 161 | force = DRM_FORCE_ON; |
162 | else | 162 | else |
@@ -606,11 +606,10 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, | |||
606 | return -EINVAL; | 606 | return -EINVAL; |
607 | 607 | ||
608 | /* Need to resize the fb object !!! */ | 608 | /* Need to resize the fb object !!! */ |
609 | if (var->xres > fb->width || var->yres > fb->height) { | 609 | if (var->bits_per_pixel > fb->bits_per_pixel || var->xres > fb->width || var->yres > fb->height) { |
610 | DRM_ERROR("Requested width/height is greater than current fb " | 610 | DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " |
611 | "object %dx%d > %dx%d\n", var->xres, var->yres, | 611 | "object %dx%d-%d > %dx%d-%d\n", var->xres, var->yres, var->bits_per_pixel, |
612 | fb->width, fb->height); | 612 | fb->width, fb->height, fb->bits_per_pixel); |
613 | DRM_ERROR("Need resizing code.\n"); | ||
614 | return -EINVAL; | 613 | return -EINVAL; |
615 | } | 614 | } |
616 | 615 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 7998ee66b317..b98384dbd9a7 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -115,6 +115,7 @@ void drm_vblank_cleanup(struct drm_device *dev) | |||
115 | 115 | ||
116 | dev->num_crtcs = 0; | 116 | dev->num_crtcs = 0; |
117 | } | 117 | } |
118 | EXPORT_SYMBOL(drm_vblank_cleanup); | ||
118 | 119 | ||
119 | int drm_vblank_init(struct drm_device *dev, int num_crtcs) | 120 | int drm_vblank_init(struct drm_device *dev, int num_crtcs) |
120 | { | 121 | { |
@@ -163,7 +164,6 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs) | |||
163 | } | 164 | } |
164 | 165 | ||
165 | dev->vblank_disable_allowed = 0; | 166 | dev->vblank_disable_allowed = 0; |
166 | |||
167 | return 0; | 167 | return 0; |
168 | 168 | ||
169 | err: | 169 | err: |
@@ -493,6 +493,9 @@ EXPORT_SYMBOL(drm_vblank_off); | |||
493 | */ | 493 | */ |
494 | void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) | 494 | void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) |
495 | { | 495 | { |
496 | /* vblank is not initialized (IRQ not installed ?) */ | ||
497 | if (!dev->num_crtcs) | ||
498 | return; | ||
496 | /* | 499 | /* |
497 | * To avoid all the problems that might happen if interrupts | 500 | * To avoid all the problems that might happen if interrupts |
498 | * were enabled/disabled around or between these calls, we just | 501 | * were enabled/disabled around or between these calls, we just |
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 577094fb1995..e68ebf92fa2a 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -47,8 +47,7 @@ | |||
47 | /** | 47 | /** |
48 | * \brief Allocate a PCI consistent memory block, for DMA. | 48 | * \brief Allocate a PCI consistent memory block, for DMA. |
49 | */ | 49 | */ |
50 | drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align, | 50 | drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align) |
51 | dma_addr_t maxaddr) | ||
52 | { | 51 | { |
53 | drm_dma_handle_t *dmah; | 52 | drm_dma_handle_t *dmah; |
54 | #if 1 | 53 | #if 1 |
@@ -63,11 +62,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali | |||
63 | if (align > size) | 62 | if (align > size) |
64 | return NULL; | 63 | return NULL; |
65 | 64 | ||
66 | if (pci_set_dma_mask(dev->pdev, maxaddr) != 0) { | ||
67 | DRM_ERROR("Setting pci dma mask failed\n"); | ||
68 | return NULL; | ||
69 | } | ||
70 | |||
71 | dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL); | 65 | dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL); |
72 | if (!dmah) | 66 | if (!dmah) |
73 | return NULL; | 67 | return NULL; |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 18476bf0b580..9c9998c4dceb 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -272,7 +272,7 @@ static void i915_dump_pages(struct seq_file *m, struct page **pages, int page_co | |||
272 | mem = kmap_atomic(pages[page], KM_USER0); | 272 | mem = kmap_atomic(pages[page], KM_USER0); |
273 | for (i = 0; i < PAGE_SIZE; i += 4) | 273 | for (i = 0; i < PAGE_SIZE; i += 4) |
274 | seq_printf(m, "%08x : %08x\n", i, mem[i / 4]); | 274 | seq_printf(m, "%08x : %08x\n", i, mem[i / 4]); |
275 | kunmap_atomic(pages[page], KM_USER0); | 275 | kunmap_atomic(mem, KM_USER0); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
@@ -386,34 +386,6 @@ out: | |||
386 | return 0; | 386 | return 0; |
387 | } | 387 | } |
388 | 388 | ||
389 | static int i915_registers_info(struct seq_file *m, void *data) { | ||
390 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
391 | struct drm_device *dev = node->minor->dev; | ||
392 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
393 | uint32_t reg; | ||
394 | |||
395 | #define DUMP_RANGE(start, end) \ | ||
396 | for (reg=start; reg < end; reg += 4) \ | ||
397 | seq_printf(m, "%08x\t%08x\n", reg, I915_READ(reg)); | ||
398 | |||
399 | DUMP_RANGE(0x00000, 0x00fff); /* VGA registers */ | ||
400 | DUMP_RANGE(0x02000, 0x02fff); /* instruction, memory, interrupt control registers */ | ||
401 | DUMP_RANGE(0x03000, 0x031ff); /* FENCE and PPGTT control registers */ | ||
402 | DUMP_RANGE(0x03200, 0x03fff); /* frame buffer compression registers */ | ||
403 | DUMP_RANGE(0x05000, 0x05fff); /* I/O control registers */ | ||
404 | DUMP_RANGE(0x06000, 0x06fff); /* clock control registers */ | ||
405 | DUMP_RANGE(0x07000, 0x07fff); /* 3D internal debug registers */ | ||
406 | DUMP_RANGE(0x07400, 0x088ff); /* GPE debug registers */ | ||
407 | DUMP_RANGE(0x0a000, 0x0afff); /* display palette registers */ | ||
408 | DUMP_RANGE(0x10000, 0x13fff); /* MMIO MCHBAR */ | ||
409 | DUMP_RANGE(0x30000, 0x3ffff); /* overlay registers */ | ||
410 | DUMP_RANGE(0x60000, 0x6ffff); /* display engine pipeline registers */ | ||
411 | DUMP_RANGE(0x70000, 0x72fff); /* display and cursor registers */ | ||
412 | DUMP_RANGE(0x73000, 0x73fff); /* performance counters */ | ||
413 | |||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | static int | 389 | static int |
418 | i915_wedged_open(struct inode *inode, | 390 | i915_wedged_open(struct inode *inode, |
419 | struct file *filp) | 391 | struct file *filp) |
@@ -519,7 +491,6 @@ static int i915_wedged_create(struct dentry *root, struct drm_minor *minor) | |||
519 | } | 491 | } |
520 | 492 | ||
521 | static struct drm_info_list i915_debugfs_list[] = { | 493 | static struct drm_info_list i915_debugfs_list[] = { |
522 | {"i915_regs", i915_registers_info, 0}, | ||
523 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, | 494 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, |
524 | {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST}, | 495 | {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST}, |
525 | {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST}, | 496 | {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST}, |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 701bfeac7f57..bbe47812e4b6 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -123,7 +123,7 @@ static int i915_init_phys_hws(struct drm_device *dev) | |||
123 | drm_i915_private_t *dev_priv = dev->dev_private; | 123 | drm_i915_private_t *dev_priv = dev->dev_private; |
124 | /* Program Hardware Status Page */ | 124 | /* Program Hardware Status Page */ |
125 | dev_priv->status_page_dmah = | 125 | dev_priv->status_page_dmah = |
126 | drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff); | 126 | drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE); |
127 | 127 | ||
128 | if (!dev_priv->status_page_dmah) { | 128 | if (!dev_priv->status_page_dmah) { |
129 | DRM_ERROR("Can not allocate hardware status page\n"); | 129 | DRM_ERROR("Can not allocate hardware status page\n"); |
@@ -813,9 +813,13 @@ static int i915_getparam(struct drm_device *dev, void *data, | |||
813 | case I915_PARAM_HAS_PAGEFLIPPING: | 813 | case I915_PARAM_HAS_PAGEFLIPPING: |
814 | value = 1; | 814 | value = 1; |
815 | break; | 815 | break; |
816 | case I915_PARAM_HAS_EXECBUF2: | ||
817 | /* depends on GEM */ | ||
818 | value = dev_priv->has_gem; | ||
819 | break; | ||
816 | default: | 820 | default: |
817 | DRM_DEBUG_DRIVER("Unknown parameter %d\n", | 821 | DRM_DEBUG_DRIVER("Unknown parameter %d\n", |
818 | param->param); | 822 | param->param); |
819 | return -EINVAL; | 823 | return -EINVAL; |
820 | } | 824 | } |
821 | 825 | ||
@@ -1117,7 +1121,8 @@ static void i915_setup_compression(struct drm_device *dev, int size) | |||
1117 | { | 1121 | { |
1118 | struct drm_i915_private *dev_priv = dev->dev_private; | 1122 | struct drm_i915_private *dev_priv = dev->dev_private; |
1119 | struct drm_mm_node *compressed_fb, *compressed_llb; | 1123 | struct drm_mm_node *compressed_fb, *compressed_llb; |
1120 | unsigned long cfb_base, ll_base; | 1124 | unsigned long cfb_base; |
1125 | unsigned long ll_base = 0; | ||
1121 | 1126 | ||
1122 | /* Leave 1M for line length buffer & misc. */ | 1127 | /* Leave 1M for line length buffer & misc. */ |
1123 | compressed_fb = drm_mm_search_free(&dev_priv->vram, size, 4096, 0); | 1128 | compressed_fb = drm_mm_search_free(&dev_priv->vram, size, 4096, 0); |
@@ -1200,14 +1205,6 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1200 | dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & | 1205 | dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & |
1201 | 0xff000000; | 1206 | 0xff000000; |
1202 | 1207 | ||
1203 | if (IS_MOBILE(dev) || IS_I9XX(dev)) | ||
1204 | dev_priv->cursor_needs_physical = true; | ||
1205 | else | ||
1206 | dev_priv->cursor_needs_physical = false; | ||
1207 | |||
1208 | if (IS_I965G(dev) || IS_G33(dev)) | ||
1209 | dev_priv->cursor_needs_physical = false; | ||
1210 | |||
1211 | /* Basic memrange allocator for stolen space (aka vram) */ | 1208 | /* Basic memrange allocator for stolen space (aka vram) */ |
1212 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); | 1209 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); |
1213 | DRM_INFO("set up %ldM of stolen space\n", prealloc_size / (1024*1024)); | 1210 | DRM_INFO("set up %ldM of stolen space\n", prealloc_size / (1024*1024)); |
@@ -1257,6 +1254,8 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1257 | if (ret) | 1254 | if (ret) |
1258 | goto destroy_ringbuffer; | 1255 | goto destroy_ringbuffer; |
1259 | 1256 | ||
1257 | intel_modeset_init(dev); | ||
1258 | |||
1260 | ret = drm_irq_install(dev); | 1259 | ret = drm_irq_install(dev); |
1261 | if (ret) | 1260 | if (ret) |
1262 | goto destroy_ringbuffer; | 1261 | goto destroy_ringbuffer; |
@@ -1271,8 +1270,6 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1271 | 1270 | ||
1272 | I915_WRITE(INSTPM, (1 << 5) | (1 << 21)); | 1271 | I915_WRITE(INSTPM, (1 << 5) | (1 << 21)); |
1273 | 1272 | ||
1274 | intel_modeset_init(dev); | ||
1275 | |||
1276 | drm_helper_initial_config(dev); | 1273 | drm_helper_initial_config(dev); |
1277 | 1274 | ||
1278 | return 0; | 1275 | return 0; |
@@ -1360,7 +1357,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1360 | { | 1357 | { |
1361 | struct drm_i915_private *dev_priv = dev->dev_private; | 1358 | struct drm_i915_private *dev_priv = dev->dev_private; |
1362 | resource_size_t base, size; | 1359 | resource_size_t base, size; |
1363 | int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; | 1360 | int ret = 0, mmio_bar; |
1364 | uint32_t agp_size, prealloc_size, prealloc_start; | 1361 | uint32_t agp_size, prealloc_size, prealloc_start; |
1365 | 1362 | ||
1366 | /* i915 has 4 more counters */ | 1363 | /* i915 has 4 more counters */ |
@@ -1376,8 +1373,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1376 | 1373 | ||
1377 | dev->dev_private = (void *)dev_priv; | 1374 | dev->dev_private = (void *)dev_priv; |
1378 | dev_priv->dev = dev; | 1375 | dev_priv->dev = dev; |
1376 | dev_priv->info = (struct intel_device_info *) flags; | ||
1379 | 1377 | ||
1380 | /* Add register map (needed for suspend/resume) */ | 1378 | /* Add register map (needed for suspend/resume) */ |
1379 | mmio_bar = IS_I9XX(dev) ? 0 : 1; | ||
1381 | base = drm_get_resource_start(dev, mmio_bar); | 1380 | base = drm_get_resource_start(dev, mmio_bar); |
1382 | size = drm_get_resource_len(dev, mmio_bar); | 1381 | size = drm_get_resource_len(dev, mmio_bar); |
1383 | 1382 | ||
@@ -1652,6 +1651,7 @@ struct drm_ioctl_desc i915_ioctls[] = { | |||
1652 | DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 1651 | DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1653 | DRM_IOCTL_DEF(DRM_I915_GEM_INIT, i915_gem_init_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 1652 | DRM_IOCTL_DEF(DRM_I915_GEM_INIT, i915_gem_init_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1654 | DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), | 1653 | DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), |
1654 | DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER2, i915_gem_execbuffer2, DRM_AUTH), | ||
1655 | DRM_IOCTL_DEF(DRM_I915_GEM_PIN, i915_gem_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), | 1655 | DRM_IOCTL_DEF(DRM_I915_GEM_PIN, i915_gem_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), |
1656 | DRM_IOCTL_DEF(DRM_I915_GEM_UNPIN, i915_gem_unpin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), | 1656 | DRM_IOCTL_DEF(DRM_I915_GEM_UNPIN, i915_gem_unpin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), |
1657 | DRM_IOCTL_DEF(DRM_I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH), | 1657 | DRM_IOCTL_DEF(DRM_I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH), |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 24286ca168fc..be631cc3e4dc 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "i915_drm.h" | 33 | #include "i915_drm.h" |
34 | #include "i915_drv.h" | 34 | #include "i915_drv.h" |
35 | 35 | ||
36 | #include "drm_pciids.h" | ||
37 | #include <linux/console.h> | 36 | #include <linux/console.h> |
38 | #include "drm_crtc_helper.h" | 37 | #include "drm_crtc_helper.h" |
39 | 38 | ||
@@ -48,8 +47,124 @@ module_param_named(powersave, i915_powersave, int, 0400); | |||
48 | 47 | ||
49 | static struct drm_driver driver; | 48 | static struct drm_driver driver; |
50 | 49 | ||
51 | static struct pci_device_id pciidlist[] = { | 50 | #define INTEL_VGA_DEVICE(id, info) { \ |
52 | i915_PCI_IDS | 51 | .class = PCI_CLASS_DISPLAY_VGA << 8, \ |
52 | .class_mask = 0xffff00, \ | ||
53 | .vendor = 0x8086, \ | ||
54 | .device = id, \ | ||
55 | .subvendor = PCI_ANY_ID, \ | ||
56 | .subdevice = PCI_ANY_ID, \ | ||
57 | .driver_data = (unsigned long) info } | ||
58 | |||
59 | const static struct intel_device_info intel_i830_info = { | ||
60 | .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1, | ||
61 | }; | ||
62 | |||
63 | const static struct intel_device_info intel_845g_info = { | ||
64 | .is_i8xx = 1, | ||
65 | }; | ||
66 | |||
67 | const static struct intel_device_info intel_i85x_info = { | ||
68 | .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1, | ||
69 | }; | ||
70 | |||
71 | const static struct intel_device_info intel_i865g_info = { | ||
72 | .is_i8xx = 1, | ||
73 | }; | ||
74 | |||
75 | const static struct intel_device_info intel_i915g_info = { | ||
76 | .is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1, | ||
77 | }; | ||
78 | const static struct intel_device_info intel_i915gm_info = { | ||
79 | .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1, | ||
80 | .cursor_needs_physical = 1, | ||
81 | }; | ||
82 | const static struct intel_device_info intel_i945g_info = { | ||
83 | .is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1, | ||
84 | }; | ||
85 | const static struct intel_device_info intel_i945gm_info = { | ||
86 | .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1, | ||
87 | .has_hotplug = 1, .cursor_needs_physical = 1, | ||
88 | }; | ||
89 | |||
90 | const static struct intel_device_info intel_i965g_info = { | ||
91 | .is_i965g = 1, .is_i9xx = 1, .has_hotplug = 1, | ||
92 | }; | ||
93 | |||
94 | const static struct intel_device_info intel_i965gm_info = { | ||
95 | .is_i965g = 1, .is_mobile = 1, .is_i965gm = 1, .is_i9xx = 1, | ||
96 | .is_mobile = 1, .has_fbc = 1, .has_rc6 = 1, | ||
97 | .has_hotplug = 1, | ||
98 | }; | ||
99 | |||
100 | const static struct intel_device_info intel_g33_info = { | ||
101 | .is_g33 = 1, .is_i9xx = 1, .need_gfx_hws = 1, | ||
102 | .has_hotplug = 1, | ||
103 | }; | ||
104 | |||
105 | const static struct intel_device_info intel_g45_info = { | ||
106 | .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, .need_gfx_hws = 1, | ||
107 | .has_pipe_cxsr = 1, | ||
108 | .has_hotplug = 1, | ||
109 | }; | ||
110 | |||
111 | const static struct intel_device_info intel_gm45_info = { | ||
112 | .is_i965g = 1, .is_mobile = 1, .is_g4x = 1, .is_i9xx = 1, | ||
113 | .is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, | ||
114 | .has_pipe_cxsr = 1, | ||
115 | .has_hotplug = 1, | ||
116 | }; | ||
117 | |||
118 | const static struct intel_device_info intel_pineview_info = { | ||
119 | .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1, | ||
120 | .has_pipe_cxsr = 1, | ||
121 | .has_hotplug = 1, | ||
122 | }; | ||
123 | |||
124 | const static struct intel_device_info intel_ironlake_d_info = { | ||
125 | .is_ironlake = 1, .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1, | ||
126 | .has_pipe_cxsr = 1, | ||
127 | .has_hotplug = 1, | ||
128 | }; | ||
129 | |||
130 | const static struct intel_device_info intel_ironlake_m_info = { | ||
131 | .is_ironlake = 1, .is_mobile = 1, .is_i965g = 1, .is_i9xx = 1, | ||
132 | .need_gfx_hws = 1, .has_rc6 = 1, | ||
133 | .has_hotplug = 1, | ||
134 | }; | ||
135 | |||
136 | const static struct pci_device_id pciidlist[] = { | ||
137 | INTEL_VGA_DEVICE(0x3577, &intel_i830_info), | ||
138 | INTEL_VGA_DEVICE(0x2562, &intel_845g_info), | ||
139 | INTEL_VGA_DEVICE(0x3582, &intel_i85x_info), | ||
140 | INTEL_VGA_DEVICE(0x35e8, &intel_i85x_info), | ||
141 | INTEL_VGA_DEVICE(0x2572, &intel_i865g_info), | ||
142 | INTEL_VGA_DEVICE(0x2582, &intel_i915g_info), | ||
143 | INTEL_VGA_DEVICE(0x258a, &intel_i915g_info), | ||
144 | INTEL_VGA_DEVICE(0x2592, &intel_i915gm_info), | ||
145 | INTEL_VGA_DEVICE(0x2772, &intel_i945g_info), | ||
146 | INTEL_VGA_DEVICE(0x27a2, &intel_i945gm_info), | ||
147 | INTEL_VGA_DEVICE(0x27ae, &intel_i945gm_info), | ||
148 | INTEL_VGA_DEVICE(0x2972, &intel_i965g_info), | ||
149 | INTEL_VGA_DEVICE(0x2982, &intel_i965g_info), | ||
150 | INTEL_VGA_DEVICE(0x2992, &intel_i965g_info), | ||
151 | INTEL_VGA_DEVICE(0x29a2, &intel_i965g_info), | ||
152 | INTEL_VGA_DEVICE(0x29b2, &intel_g33_info), | ||
153 | INTEL_VGA_DEVICE(0x29c2, &intel_g33_info), | ||
154 | INTEL_VGA_DEVICE(0x29d2, &intel_g33_info), | ||
155 | INTEL_VGA_DEVICE(0x2a02, &intel_i965gm_info), | ||
156 | INTEL_VGA_DEVICE(0x2a12, &intel_i965gm_info), | ||
157 | INTEL_VGA_DEVICE(0x2a42, &intel_gm45_info), | ||
158 | INTEL_VGA_DEVICE(0x2e02, &intel_g45_info), | ||
159 | INTEL_VGA_DEVICE(0x2e12, &intel_g45_info), | ||
160 | INTEL_VGA_DEVICE(0x2e22, &intel_g45_info), | ||
161 | INTEL_VGA_DEVICE(0x2e32, &intel_g45_info), | ||
162 | INTEL_VGA_DEVICE(0x2e42, &intel_g45_info), | ||
163 | INTEL_VGA_DEVICE(0xa001, &intel_pineview_info), | ||
164 | INTEL_VGA_DEVICE(0xa011, &intel_pineview_info), | ||
165 | INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info), | ||
166 | INTEL_VGA_DEVICE(0x0046, &intel_ironlake_m_info), | ||
167 | {0, 0, 0} | ||
53 | }; | 168 | }; |
54 | 169 | ||
55 | #if defined(CONFIG_DRM_I915_KMS) | 170 | #if defined(CONFIG_DRM_I915_KMS) |
@@ -284,6 +399,52 @@ i915_pci_resume(struct pci_dev *pdev) | |||
284 | return i915_resume(dev); | 399 | return i915_resume(dev); |
285 | } | 400 | } |
286 | 401 | ||
402 | static int | ||
403 | i915_pm_suspend(struct device *dev) | ||
404 | { | ||
405 | return i915_pci_suspend(to_pci_dev(dev), PMSG_SUSPEND); | ||
406 | } | ||
407 | |||
408 | static int | ||
409 | i915_pm_resume(struct device *dev) | ||
410 | { | ||
411 | return i915_pci_resume(to_pci_dev(dev)); | ||
412 | } | ||
413 | |||
414 | static int | ||
415 | i915_pm_freeze(struct device *dev) | ||
416 | { | ||
417 | return i915_pci_suspend(to_pci_dev(dev), PMSG_FREEZE); | ||
418 | } | ||
419 | |||
420 | static int | ||
421 | i915_pm_thaw(struct device *dev) | ||
422 | { | ||
423 | /* thaw during hibernate, do nothing! */ | ||
424 | return 0; | ||
425 | } | ||
426 | |||
427 | static int | ||
428 | i915_pm_poweroff(struct device *dev) | ||
429 | { | ||
430 | return i915_pci_suspend(to_pci_dev(dev), PMSG_HIBERNATE); | ||
431 | } | ||
432 | |||
433 | static int | ||
434 | i915_pm_restore(struct device *dev) | ||
435 | { | ||
436 | return i915_pci_resume(to_pci_dev(dev)); | ||
437 | } | ||
438 | |||
439 | const struct dev_pm_ops i915_pm_ops = { | ||
440 | .suspend = i915_pm_suspend, | ||
441 | .resume = i915_pm_resume, | ||
442 | .freeze = i915_pm_freeze, | ||
443 | .thaw = i915_pm_thaw, | ||
444 | .poweroff = i915_pm_poweroff, | ||
445 | .restore = i915_pm_restore, | ||
446 | }; | ||
447 | |||
287 | static struct vm_operations_struct i915_gem_vm_ops = { | 448 | static struct vm_operations_struct i915_gem_vm_ops = { |
288 | .fault = i915_gem_fault, | 449 | .fault = i915_gem_fault, |
289 | .open = drm_gem_vm_open, | 450 | .open = drm_gem_vm_open, |
@@ -344,10 +505,7 @@ static struct drm_driver driver = { | |||
344 | .id_table = pciidlist, | 505 | .id_table = pciidlist, |
345 | .probe = i915_pci_probe, | 506 | .probe = i915_pci_probe, |
346 | .remove = i915_pci_remove, | 507 | .remove = i915_pci_remove, |
347 | #ifdef CONFIG_PM | 508 | .driver.pm = &i915_pm_ops, |
348 | .resume = i915_pci_resume, | ||
349 | .suspend = i915_pci_suspend, | ||
350 | #endif | ||
351 | }, | 509 | }, |
352 | 510 | ||
353 | .name = DRIVER_NAME, | 511 | .name = DRIVER_NAME, |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index fbecac72f5bb..29dd67626967 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -172,9 +172,31 @@ struct drm_i915_display_funcs { | |||
172 | 172 | ||
173 | struct intel_overlay; | 173 | struct intel_overlay; |
174 | 174 | ||
175 | struct intel_device_info { | ||
176 | u8 is_mobile : 1; | ||
177 | u8 is_i8xx : 1; | ||
178 | u8 is_i915g : 1; | ||
179 | u8 is_i9xx : 1; | ||
180 | u8 is_i945gm : 1; | ||
181 | u8 is_i965g : 1; | ||
182 | u8 is_i965gm : 1; | ||
183 | u8 is_g33 : 1; | ||
184 | u8 need_gfx_hws : 1; | ||
185 | u8 is_g4x : 1; | ||
186 | u8 is_pineview : 1; | ||
187 | u8 is_ironlake : 1; | ||
188 | u8 has_fbc : 1; | ||
189 | u8 has_rc6 : 1; | ||
190 | u8 has_pipe_cxsr : 1; | ||
191 | u8 has_hotplug : 1; | ||
192 | u8 cursor_needs_physical : 1; | ||
193 | }; | ||
194 | |||
175 | typedef struct drm_i915_private { | 195 | typedef struct drm_i915_private { |
176 | struct drm_device *dev; | 196 | struct drm_device *dev; |
177 | 197 | ||
198 | const struct intel_device_info *info; | ||
199 | |||
178 | int has_gem; | 200 | int has_gem; |
179 | 201 | ||
180 | void __iomem *regs; | 202 | void __iomem *regs; |
@@ -232,8 +254,6 @@ typedef struct drm_i915_private { | |||
232 | int hangcheck_count; | 254 | int hangcheck_count; |
233 | uint32_t last_acthd; | 255 | uint32_t last_acthd; |
234 | 256 | ||
235 | bool cursor_needs_physical; | ||
236 | |||
237 | struct drm_mm vram; | 257 | struct drm_mm vram; |
238 | 258 | ||
239 | unsigned long cfb_size; | 259 | unsigned long cfb_size; |
@@ -287,8 +307,6 @@ typedef struct drm_i915_private { | |||
287 | u32 saveDSPACNTR; | 307 | u32 saveDSPACNTR; |
288 | u32 saveDSPBCNTR; | 308 | u32 saveDSPBCNTR; |
289 | u32 saveDSPARB; | 309 | u32 saveDSPARB; |
290 | u32 saveRENDERSTANDBY; | ||
291 | u32 savePWRCTXA; | ||
292 | u32 saveHWS; | 310 | u32 saveHWS; |
293 | u32 savePIPEACONF; | 311 | u32 savePIPEACONF; |
294 | u32 savePIPEBCONF; | 312 | u32 savePIPEBCONF; |
@@ -561,6 +579,7 @@ typedef struct drm_i915_private { | |||
561 | u16 orig_clock; | 579 | u16 orig_clock; |
562 | int child_dev_num; | 580 | int child_dev_num; |
563 | struct child_device_config *child_dev; | 581 | struct child_device_config *child_dev; |
582 | struct drm_connector *int_lvds_connector; | ||
564 | } drm_i915_private_t; | 583 | } drm_i915_private_t; |
565 | 584 | ||
566 | /** driver private structure attached to each drm_gem_object */ | 585 | /** driver private structure attached to each drm_gem_object */ |
@@ -794,6 +813,8 @@ int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, | |||
794 | struct drm_file *file_priv); | 813 | struct drm_file *file_priv); |
795 | int i915_gem_execbuffer(struct drm_device *dev, void *data, | 814 | int i915_gem_execbuffer(struct drm_device *dev, void *data, |
796 | struct drm_file *file_priv); | 815 | struct drm_file *file_priv); |
816 | int i915_gem_execbuffer2(struct drm_device *dev, void *data, | ||
817 | struct drm_file *file_priv); | ||
797 | int i915_gem_pin_ioctl(struct drm_device *dev, void *data, | 818 | int i915_gem_pin_ioctl(struct drm_device *dev, void *data, |
798 | struct drm_file *file_priv); | 819 | struct drm_file *file_priv); |
799 | int i915_gem_unpin_ioctl(struct drm_device *dev, void *data, | 820 | int i915_gem_unpin_ioctl(struct drm_device *dev, void *data, |
@@ -860,6 +881,9 @@ void i915_gem_shrinker_exit(void); | |||
860 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); | 881 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); |
861 | void i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj); | 882 | void i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj); |
862 | void i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj); | 883 | void i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj); |
884 | bool i915_tiling_ok(struct drm_device *dev, int stride, int size, | ||
885 | int tiling_mode); | ||
886 | bool i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj); | ||
863 | 887 | ||
864 | /* i915_gem_debug.c */ | 888 | /* i915_gem_debug.c */ |
865 | void i915_gem_dump_object(struct drm_gem_object *obj, int len, | 889 | void i915_gem_dump_object(struct drm_gem_object *obj, int len, |
@@ -982,67 +1006,33 @@ extern void g4x_disable_fbc(struct drm_device *dev); | |||
982 | extern int i915_wrap_ring(struct drm_device * dev); | 1006 | extern int i915_wrap_ring(struct drm_device * dev); |
983 | extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | 1007 | extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); |
984 | 1008 | ||
985 | #define IS_I830(dev) ((dev)->pci_device == 0x3577) | 1009 | #define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info) |
986 | #define IS_845G(dev) ((dev)->pci_device == 0x2562) | 1010 | |
987 | #define IS_I85X(dev) ((dev)->pci_device == 0x3582) | 1011 | #define IS_I830(dev) ((dev)->pci_device == 0x3577) |
988 | #define IS_I865G(dev) ((dev)->pci_device == 0x2572) | 1012 | #define IS_845G(dev) ((dev)->pci_device == 0x2562) |
989 | #define IS_I8XX(dev) (IS_I830(dev) || IS_845G(dev) || IS_I85X(dev) || IS_I865G(dev)) | 1013 | #define IS_I85X(dev) ((dev)->pci_device == 0x3582) |
990 | 1014 | #define IS_I865G(dev) ((dev)->pci_device == 0x2572) | |
991 | #define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a) | 1015 | #define IS_I8XX(dev) (INTEL_INFO(dev)->is_i8xx) |
992 | #define IS_I915GM(dev) ((dev)->pci_device == 0x2592) | 1016 | #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g) |
993 | #define IS_I945G(dev) ((dev)->pci_device == 0x2772) | 1017 | #define IS_I915GM(dev) ((dev)->pci_device == 0x2592) |
994 | #define IS_I945GM(dev) ((dev)->pci_device == 0x27A2 ||\ | 1018 | #define IS_I945G(dev) ((dev)->pci_device == 0x2772) |
995 | (dev)->pci_device == 0x27AE) | 1019 | #define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm) |
996 | #define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \ | 1020 | #define IS_I965G(dev) (INTEL_INFO(dev)->is_i965g) |
997 | (dev)->pci_device == 0x2982 || \ | 1021 | #define IS_I965GM(dev) (INTEL_INFO(dev)->is_i965gm) |
998 | (dev)->pci_device == 0x2992 || \ | 1022 | #define IS_GM45(dev) ((dev)->pci_device == 0x2A42) |
999 | (dev)->pci_device == 0x29A2 || \ | 1023 | #define IS_G4X(dev) (INTEL_INFO(dev)->is_g4x) |
1000 | (dev)->pci_device == 0x2A02 || \ | 1024 | #define IS_PINEVIEW_G(dev) ((dev)->pci_device == 0xa001) |
1001 | (dev)->pci_device == 0x2A12 || \ | 1025 | #define IS_PINEVIEW_M(dev) ((dev)->pci_device == 0xa011) |
1002 | (dev)->pci_device == 0x2A42 || \ | 1026 | #define IS_PINEVIEW(dev) (INTEL_INFO(dev)->is_pineview) |
1003 | (dev)->pci_device == 0x2E02 || \ | 1027 | #define IS_G33(dev) (INTEL_INFO(dev)->is_g33) |
1004 | (dev)->pci_device == 0x2E12 || \ | ||
1005 | (dev)->pci_device == 0x2E22 || \ | ||
1006 | (dev)->pci_device == 0x2E32 || \ | ||
1007 | (dev)->pci_device == 0x2E42 || \ | ||
1008 | (dev)->pci_device == 0x0042 || \ | ||
1009 | (dev)->pci_device == 0x0046) | ||
1010 | |||
1011 | #define IS_I965GM(dev) ((dev)->pci_device == 0x2A02 || \ | ||
1012 | (dev)->pci_device == 0x2A12) | ||
1013 | |||
1014 | #define IS_GM45(dev) ((dev)->pci_device == 0x2A42) | ||
1015 | |||
1016 | #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \ | ||
1017 | (dev)->pci_device == 0x2E12 || \ | ||
1018 | (dev)->pci_device == 0x2E22 || \ | ||
1019 | (dev)->pci_device == 0x2E32 || \ | ||
1020 | (dev)->pci_device == 0x2E42 || \ | ||
1021 | IS_GM45(dev)) | ||
1022 | |||
1023 | #define IS_PINEVIEW_G(dev) ((dev)->pci_device == 0xa001) | ||
1024 | #define IS_PINEVIEW_M(dev) ((dev)->pci_device == 0xa011) | ||
1025 | #define IS_PINEVIEW(dev) (IS_PINEVIEW_G(dev) || IS_PINEVIEW_M(dev)) | ||
1026 | |||
1027 | #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \ | ||
1028 | (dev)->pci_device == 0x29B2 || \ | ||
1029 | (dev)->pci_device == 0x29D2 || \ | ||
1030 | (IS_PINEVIEW(dev))) | ||
1031 | |||
1032 | #define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042) | 1028 | #define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042) |
1033 | #define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046) | 1029 | #define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046) |
1034 | #define IS_IRONLAKE(dev) (IS_IRONLAKE_D(dev) || IS_IRONLAKE_M(dev)) | 1030 | #define IS_IRONLAKE(dev) (INTEL_INFO(dev)->is_ironlake) |
1035 | 1031 | #define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx) | |
1036 | #define IS_I9XX(dev) (IS_I915G(dev) || IS_I915GM(dev) || IS_I945G(dev) || \ | 1032 | #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) |
1037 | IS_I945GM(dev) || IS_I965G(dev) || IS_G33(dev) || \ | ||
1038 | IS_IRONLAKE(dev)) | ||
1039 | 1033 | ||
1040 | #define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \ | 1034 | #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws) |
1041 | IS_I945GM(dev) || IS_I965GM(dev) || IS_GM45(dev) || \ | ||
1042 | IS_PINEVIEW(dev) || IS_IRONLAKE_M(dev)) | ||
1043 | 1035 | ||
1044 | #define I915_NEED_GFX_HWS(dev) (IS_G33(dev) || IS_GM45(dev) || IS_G4X(dev) || \ | ||
1045 | IS_IRONLAKE(dev)) | ||
1046 | /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte | 1036 | /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte |
1047 | * rows, which changed the alignment requirements and fence programming. | 1037 | * rows, which changed the alignment requirements and fence programming. |
1048 | */ | 1038 | */ |
@@ -1054,17 +1044,14 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
1054 | #define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev)) | 1044 | #define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev)) |
1055 | #define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \ | 1045 | #define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \ |
1056 | !IS_IRONLAKE(dev) && !IS_PINEVIEW(dev)) | 1046 | !IS_IRONLAKE(dev) && !IS_PINEVIEW(dev)) |
1057 | #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev) || IS_I965G(dev)) | 1047 | #define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug) |
1058 | /* dsparb controlled by hw only */ | 1048 | /* dsparb controlled by hw only */ |
1059 | #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) | 1049 | #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) |
1060 | 1050 | ||
1061 | #define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IRONLAKE(dev)) | 1051 | #define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IRONLAKE(dev)) |
1062 | #define HAS_PIPE_CXSR(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) | 1052 | #define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr) |
1063 | #define I915_HAS_FBC(dev) (IS_MOBILE(dev) && \ | 1053 | #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc) |
1064 | (IS_I9XX(dev) || IS_GM45(dev)) && \ | 1054 | #define I915_HAS_RC6(dev) (INTEL_INFO(dev)->has_rc6) |
1065 | !IS_PINEVIEW(dev) && \ | ||
1066 | !IS_IRONLAKE(dev)) | ||
1067 | #define I915_HAS_RC6(dev) (IS_I965GM(dev) || IS_GM45(dev) || IS_IRONLAKE_M(dev)) | ||
1068 | 1055 | ||
1069 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) | 1056 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) |
1070 | 1057 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 8c463cf2050a..2748609f05b3 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2021,9 +2021,6 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
2021 | /* blow away mappings if mapped through GTT */ | 2021 | /* blow away mappings if mapped through GTT */ |
2022 | i915_gem_release_mmap(obj); | 2022 | i915_gem_release_mmap(obj); |
2023 | 2023 | ||
2024 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | ||
2025 | i915_gem_clear_fence_reg(obj); | ||
2026 | |||
2027 | /* Move the object to the CPU domain to ensure that | 2024 | /* Move the object to the CPU domain to ensure that |
2028 | * any possible CPU writes while it's not in the GTT | 2025 | * any possible CPU writes while it's not in the GTT |
2029 | * are flushed when we go to remap it. This will | 2026 | * are flushed when we go to remap it. This will |
@@ -2039,6 +2036,10 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
2039 | 2036 | ||
2040 | BUG_ON(obj_priv->active); | 2037 | BUG_ON(obj_priv->active); |
2041 | 2038 | ||
2039 | /* release the fence reg _after_ flushing */ | ||
2040 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | ||
2041 | i915_gem_clear_fence_reg(obj); | ||
2042 | |||
2042 | if (obj_priv->agp_mem != NULL) { | 2043 | if (obj_priv->agp_mem != NULL) { |
2043 | drm_unbind_agp(obj_priv->agp_mem); | 2044 | drm_unbind_agp(obj_priv->agp_mem); |
2044 | drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE); | 2045 | drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE); |
@@ -2581,9 +2582,6 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment) | |||
2581 | bool retry_alloc = false; | 2582 | bool retry_alloc = false; |
2582 | int ret; | 2583 | int ret; |
2583 | 2584 | ||
2584 | if (dev_priv->mm.suspended) | ||
2585 | return -EBUSY; | ||
2586 | |||
2587 | if (obj_priv->madv != I915_MADV_WILLNEED) { | 2585 | if (obj_priv->madv != I915_MADV_WILLNEED) { |
2588 | DRM_ERROR("Attempting to bind a purgeable object\n"); | 2586 | DRM_ERROR("Attempting to bind a purgeable object\n"); |
2589 | return -EINVAL; | 2587 | return -EINVAL; |
@@ -3198,7 +3196,7 @@ i915_gem_object_set_cpu_read_domain_range(struct drm_gem_object *obj, | |||
3198 | static int | 3196 | static int |
3199 | i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | 3197 | i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, |
3200 | struct drm_file *file_priv, | 3198 | struct drm_file *file_priv, |
3201 | struct drm_i915_gem_exec_object *entry, | 3199 | struct drm_i915_gem_exec_object2 *entry, |
3202 | struct drm_i915_gem_relocation_entry *relocs) | 3200 | struct drm_i915_gem_relocation_entry *relocs) |
3203 | { | 3201 | { |
3204 | struct drm_device *dev = obj->dev; | 3202 | struct drm_device *dev = obj->dev; |
@@ -3206,12 +3204,35 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
3206 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | 3204 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
3207 | int i, ret; | 3205 | int i, ret; |
3208 | void __iomem *reloc_page; | 3206 | void __iomem *reloc_page; |
3207 | bool need_fence; | ||
3208 | |||
3209 | need_fence = entry->flags & EXEC_OBJECT_NEEDS_FENCE && | ||
3210 | obj_priv->tiling_mode != I915_TILING_NONE; | ||
3211 | |||
3212 | /* Check fence reg constraints and rebind if necessary */ | ||
3213 | if (need_fence && !i915_obj_fenceable(dev, obj)) | ||
3214 | i915_gem_object_unbind(obj); | ||
3209 | 3215 | ||
3210 | /* Choose the GTT offset for our buffer and put it there. */ | 3216 | /* Choose the GTT offset for our buffer and put it there. */ |
3211 | ret = i915_gem_object_pin(obj, (uint32_t) entry->alignment); | 3217 | ret = i915_gem_object_pin(obj, (uint32_t) entry->alignment); |
3212 | if (ret) | 3218 | if (ret) |
3213 | return ret; | 3219 | return ret; |
3214 | 3220 | ||
3221 | /* | ||
3222 | * Pre-965 chips need a fence register set up in order to | ||
3223 | * properly handle blits to/from tiled surfaces. | ||
3224 | */ | ||
3225 | if (need_fence) { | ||
3226 | ret = i915_gem_object_get_fence_reg(obj); | ||
3227 | if (ret != 0) { | ||
3228 | if (ret != -EBUSY && ret != -ERESTARTSYS) | ||
3229 | DRM_ERROR("Failure to install fence: %d\n", | ||
3230 | ret); | ||
3231 | i915_gem_object_unpin(obj); | ||
3232 | return ret; | ||
3233 | } | ||
3234 | } | ||
3235 | |||
3215 | entry->offset = obj_priv->gtt_offset; | 3236 | entry->offset = obj_priv->gtt_offset; |
3216 | 3237 | ||
3217 | /* Apply the relocations, using the GTT aperture to avoid cache | 3238 | /* Apply the relocations, using the GTT aperture to avoid cache |
@@ -3373,7 +3394,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
3373 | */ | 3394 | */ |
3374 | static int | 3395 | static int |
3375 | i915_dispatch_gem_execbuffer(struct drm_device *dev, | 3396 | i915_dispatch_gem_execbuffer(struct drm_device *dev, |
3376 | struct drm_i915_gem_execbuffer *exec, | 3397 | struct drm_i915_gem_execbuffer2 *exec, |
3377 | struct drm_clip_rect *cliprects, | 3398 | struct drm_clip_rect *cliprects, |
3378 | uint64_t exec_offset) | 3399 | uint64_t exec_offset) |
3379 | { | 3400 | { |
@@ -3463,7 +3484,7 @@ i915_gem_ring_throttle(struct drm_device *dev, struct drm_file *file_priv) | |||
3463 | } | 3484 | } |
3464 | 3485 | ||
3465 | static int | 3486 | static int |
3466 | i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list, | 3487 | i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object2 *exec_list, |
3467 | uint32_t buffer_count, | 3488 | uint32_t buffer_count, |
3468 | struct drm_i915_gem_relocation_entry **relocs) | 3489 | struct drm_i915_gem_relocation_entry **relocs) |
3469 | { | 3490 | { |
@@ -3478,8 +3499,10 @@ i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list, | |||
3478 | } | 3499 | } |
3479 | 3500 | ||
3480 | *relocs = drm_calloc_large(reloc_count, sizeof(**relocs)); | 3501 | *relocs = drm_calloc_large(reloc_count, sizeof(**relocs)); |
3481 | if (*relocs == NULL) | 3502 | if (*relocs == NULL) { |
3503 | DRM_ERROR("failed to alloc relocs, count %d\n", reloc_count); | ||
3482 | return -ENOMEM; | 3504 | return -ENOMEM; |
3505 | } | ||
3483 | 3506 | ||
3484 | for (i = 0; i < buffer_count; i++) { | 3507 | for (i = 0; i < buffer_count; i++) { |
3485 | struct drm_i915_gem_relocation_entry __user *user_relocs; | 3508 | struct drm_i915_gem_relocation_entry __user *user_relocs; |
@@ -3503,7 +3526,7 @@ i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list, | |||
3503 | } | 3526 | } |
3504 | 3527 | ||
3505 | static int | 3528 | static int |
3506 | i915_gem_put_relocs_to_user(struct drm_i915_gem_exec_object *exec_list, | 3529 | i915_gem_put_relocs_to_user(struct drm_i915_gem_exec_object2 *exec_list, |
3507 | uint32_t buffer_count, | 3530 | uint32_t buffer_count, |
3508 | struct drm_i915_gem_relocation_entry *relocs) | 3531 | struct drm_i915_gem_relocation_entry *relocs) |
3509 | { | 3532 | { |
@@ -3536,7 +3559,7 @@ err: | |||
3536 | } | 3559 | } |
3537 | 3560 | ||
3538 | static int | 3561 | static int |
3539 | i915_gem_check_execbuffer (struct drm_i915_gem_execbuffer *exec, | 3562 | i915_gem_check_execbuffer (struct drm_i915_gem_execbuffer2 *exec, |
3540 | uint64_t exec_offset) | 3563 | uint64_t exec_offset) |
3541 | { | 3564 | { |
3542 | uint32_t exec_start, exec_len; | 3565 | uint32_t exec_start, exec_len; |
@@ -3589,18 +3612,18 @@ i915_gem_wait_for_pending_flip(struct drm_device *dev, | |||
3589 | } | 3612 | } |
3590 | 3613 | ||
3591 | int | 3614 | int |
3592 | i915_gem_execbuffer(struct drm_device *dev, void *data, | 3615 | i915_gem_do_execbuffer(struct drm_device *dev, void *data, |
3593 | struct drm_file *file_priv) | 3616 | struct drm_file *file_priv, |
3617 | struct drm_i915_gem_execbuffer2 *args, | ||
3618 | struct drm_i915_gem_exec_object2 *exec_list) | ||
3594 | { | 3619 | { |
3595 | drm_i915_private_t *dev_priv = dev->dev_private; | 3620 | drm_i915_private_t *dev_priv = dev->dev_private; |
3596 | struct drm_i915_gem_execbuffer *args = data; | ||
3597 | struct drm_i915_gem_exec_object *exec_list = NULL; | ||
3598 | struct drm_gem_object **object_list = NULL; | 3621 | struct drm_gem_object **object_list = NULL; |
3599 | struct drm_gem_object *batch_obj; | 3622 | struct drm_gem_object *batch_obj; |
3600 | struct drm_i915_gem_object *obj_priv; | 3623 | struct drm_i915_gem_object *obj_priv; |
3601 | struct drm_clip_rect *cliprects = NULL; | 3624 | struct drm_clip_rect *cliprects = NULL; |
3602 | struct drm_i915_gem_relocation_entry *relocs; | 3625 | struct drm_i915_gem_relocation_entry *relocs; |
3603 | int ret, ret2, i, pinned = 0; | 3626 | int ret = 0, ret2, i, pinned = 0; |
3604 | uint64_t exec_offset; | 3627 | uint64_t exec_offset; |
3605 | uint32_t seqno, flush_domains, reloc_index; | 3628 | uint32_t seqno, flush_domains, reloc_index; |
3606 | int pin_tries, flips; | 3629 | int pin_tries, flips; |
@@ -3614,25 +3637,13 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, | |||
3614 | DRM_ERROR("execbuf with %d buffers\n", args->buffer_count); | 3637 | DRM_ERROR("execbuf with %d buffers\n", args->buffer_count); |
3615 | return -EINVAL; | 3638 | return -EINVAL; |
3616 | } | 3639 | } |
3617 | /* Copy in the exec list from userland */ | ||
3618 | exec_list = drm_malloc_ab(sizeof(*exec_list), args->buffer_count); | ||
3619 | object_list = drm_malloc_ab(sizeof(*object_list), args->buffer_count); | 3640 | object_list = drm_malloc_ab(sizeof(*object_list), args->buffer_count); |
3620 | if (exec_list == NULL || object_list == NULL) { | 3641 | if (object_list == NULL) { |
3621 | DRM_ERROR("Failed to allocate exec or object list " | 3642 | DRM_ERROR("Failed to allocate object list for %d buffers\n", |
3622 | "for %d buffers\n", | ||
3623 | args->buffer_count); | 3643 | args->buffer_count); |
3624 | ret = -ENOMEM; | 3644 | ret = -ENOMEM; |
3625 | goto pre_mutex_err; | 3645 | goto pre_mutex_err; |
3626 | } | 3646 | } |
3627 | ret = copy_from_user(exec_list, | ||
3628 | (struct drm_i915_relocation_entry __user *) | ||
3629 | (uintptr_t) args->buffers_ptr, | ||
3630 | sizeof(*exec_list) * args->buffer_count); | ||
3631 | if (ret != 0) { | ||
3632 | DRM_ERROR("copy %d exec entries failed %d\n", | ||
3633 | args->buffer_count, ret); | ||
3634 | goto pre_mutex_err; | ||
3635 | } | ||
3636 | 3647 | ||
3637 | if (args->num_cliprects != 0) { | 3648 | if (args->num_cliprects != 0) { |
3638 | cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects), | 3649 | cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects), |
@@ -3884,20 +3895,6 @@ err: | |||
3884 | 3895 | ||
3885 | mutex_unlock(&dev->struct_mutex); | 3896 | mutex_unlock(&dev->struct_mutex); |
3886 | 3897 | ||
3887 | if (!ret) { | ||
3888 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
3889 | ret = copy_to_user((struct drm_i915_relocation_entry __user *) | ||
3890 | (uintptr_t) args->buffers_ptr, | ||
3891 | exec_list, | ||
3892 | sizeof(*exec_list) * args->buffer_count); | ||
3893 | if (ret) { | ||
3894 | ret = -EFAULT; | ||
3895 | DRM_ERROR("failed to copy %d exec entries " | ||
3896 | "back to user (%d)\n", | ||
3897 | args->buffer_count, ret); | ||
3898 | } | ||
3899 | } | ||
3900 | |||
3901 | /* Copy the updated relocations out regardless of current error | 3898 | /* Copy the updated relocations out regardless of current error |
3902 | * state. Failure to update the relocs would mean that the next | 3899 | * state. Failure to update the relocs would mean that the next |
3903 | * time userland calls execbuf, it would do so with presumed offset | 3900 | * time userland calls execbuf, it would do so with presumed offset |
@@ -3914,12 +3911,158 @@ err: | |||
3914 | 3911 | ||
3915 | pre_mutex_err: | 3912 | pre_mutex_err: |
3916 | drm_free_large(object_list); | 3913 | drm_free_large(object_list); |
3917 | drm_free_large(exec_list); | ||
3918 | kfree(cliprects); | 3914 | kfree(cliprects); |
3919 | 3915 | ||
3920 | return ret; | 3916 | return ret; |
3921 | } | 3917 | } |
3922 | 3918 | ||
3919 | /* | ||
3920 | * Legacy execbuffer just creates an exec2 list from the original exec object | ||
3921 | * list array and passes it to the real function. | ||
3922 | */ | ||
3923 | int | ||
3924 | i915_gem_execbuffer(struct drm_device *dev, void *data, | ||
3925 | struct drm_file *file_priv) | ||
3926 | { | ||
3927 | struct drm_i915_gem_execbuffer *args = data; | ||
3928 | struct drm_i915_gem_execbuffer2 exec2; | ||
3929 | struct drm_i915_gem_exec_object *exec_list = NULL; | ||
3930 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; | ||
3931 | int ret, i; | ||
3932 | |||
3933 | #if WATCH_EXEC | ||
3934 | DRM_INFO("buffers_ptr %d buffer_count %d len %08x\n", | ||
3935 | (int) args->buffers_ptr, args->buffer_count, args->batch_len); | ||
3936 | #endif | ||
3937 | |||
3938 | if (args->buffer_count < 1) { | ||
3939 | DRM_ERROR("execbuf with %d buffers\n", args->buffer_count); | ||
3940 | return -EINVAL; | ||
3941 | } | ||
3942 | |||
3943 | /* Copy in the exec list from userland */ | ||
3944 | exec_list = drm_malloc_ab(sizeof(*exec_list), args->buffer_count); | ||
3945 | exec2_list = drm_malloc_ab(sizeof(*exec2_list), args->buffer_count); | ||
3946 | if (exec_list == NULL || exec2_list == NULL) { | ||
3947 | DRM_ERROR("Failed to allocate exec list for %d buffers\n", | ||
3948 | args->buffer_count); | ||
3949 | drm_free_large(exec_list); | ||
3950 | drm_free_large(exec2_list); | ||
3951 | return -ENOMEM; | ||
3952 | } | ||
3953 | ret = copy_from_user(exec_list, | ||
3954 | (struct drm_i915_relocation_entry __user *) | ||
3955 | (uintptr_t) args->buffers_ptr, | ||
3956 | sizeof(*exec_list) * args->buffer_count); | ||
3957 | if (ret != 0) { | ||
3958 | DRM_ERROR("copy %d exec entries failed %d\n", | ||
3959 | args->buffer_count, ret); | ||
3960 | drm_free_large(exec_list); | ||
3961 | drm_free_large(exec2_list); | ||
3962 | return -EFAULT; | ||
3963 | } | ||
3964 | |||
3965 | for (i = 0; i < args->buffer_count; i++) { | ||
3966 | exec2_list[i].handle = exec_list[i].handle; | ||
3967 | exec2_list[i].relocation_count = exec_list[i].relocation_count; | ||
3968 | exec2_list[i].relocs_ptr = exec_list[i].relocs_ptr; | ||
3969 | exec2_list[i].alignment = exec_list[i].alignment; | ||
3970 | exec2_list[i].offset = exec_list[i].offset; | ||
3971 | if (!IS_I965G(dev)) | ||
3972 | exec2_list[i].flags = EXEC_OBJECT_NEEDS_FENCE; | ||
3973 | else | ||
3974 | exec2_list[i].flags = 0; | ||
3975 | } | ||
3976 | |||
3977 | exec2.buffers_ptr = args->buffers_ptr; | ||
3978 | exec2.buffer_count = args->buffer_count; | ||
3979 | exec2.batch_start_offset = args->batch_start_offset; | ||
3980 | exec2.batch_len = args->batch_len; | ||
3981 | exec2.DR1 = args->DR1; | ||
3982 | exec2.DR4 = args->DR4; | ||
3983 | exec2.num_cliprects = args->num_cliprects; | ||
3984 | exec2.cliprects_ptr = args->cliprects_ptr; | ||
3985 | exec2.flags = 0; | ||
3986 | |||
3987 | ret = i915_gem_do_execbuffer(dev, data, file_priv, &exec2, exec2_list); | ||
3988 | if (!ret) { | ||
3989 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
3990 | for (i = 0; i < args->buffer_count; i++) | ||
3991 | exec_list[i].offset = exec2_list[i].offset; | ||
3992 | /* ... and back out to userspace */ | ||
3993 | ret = copy_to_user((struct drm_i915_relocation_entry __user *) | ||
3994 | (uintptr_t) args->buffers_ptr, | ||
3995 | exec_list, | ||
3996 | sizeof(*exec_list) * args->buffer_count); | ||
3997 | if (ret) { | ||
3998 | ret = -EFAULT; | ||
3999 | DRM_ERROR("failed to copy %d exec entries " | ||
4000 | "back to user (%d)\n", | ||
4001 | args->buffer_count, ret); | ||
4002 | } | ||
4003 | } else { | ||
4004 | DRM_ERROR("i915_gem_do_execbuffer returns %d\n", ret); | ||
4005 | } | ||
4006 | |||
4007 | drm_free_large(exec_list); | ||
4008 | drm_free_large(exec2_list); | ||
4009 | return ret; | ||
4010 | } | ||
4011 | |||
4012 | int | ||
4013 | i915_gem_execbuffer2(struct drm_device *dev, void *data, | ||
4014 | struct drm_file *file_priv) | ||
4015 | { | ||
4016 | struct drm_i915_gem_execbuffer2 *args = data; | ||
4017 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; | ||
4018 | int ret; | ||
4019 | |||
4020 | #if WATCH_EXEC | ||
4021 | DRM_INFO("buffers_ptr %d buffer_count %d len %08x\n", | ||
4022 | (int) args->buffers_ptr, args->buffer_count, args->batch_len); | ||
4023 | #endif | ||
4024 | |||
4025 | if (args->buffer_count < 1) { | ||
4026 | DRM_ERROR("execbuf2 with %d buffers\n", args->buffer_count); | ||
4027 | return -EINVAL; | ||
4028 | } | ||
4029 | |||
4030 | exec2_list = drm_malloc_ab(sizeof(*exec2_list), args->buffer_count); | ||
4031 | if (exec2_list == NULL) { | ||
4032 | DRM_ERROR("Failed to allocate exec list for %d buffers\n", | ||
4033 | args->buffer_count); | ||
4034 | return -ENOMEM; | ||
4035 | } | ||
4036 | ret = copy_from_user(exec2_list, | ||
4037 | (struct drm_i915_relocation_entry __user *) | ||
4038 | (uintptr_t) args->buffers_ptr, | ||
4039 | sizeof(*exec2_list) * args->buffer_count); | ||
4040 | if (ret != 0) { | ||
4041 | DRM_ERROR("copy %d exec entries failed %d\n", | ||
4042 | args->buffer_count, ret); | ||
4043 | drm_free_large(exec2_list); | ||
4044 | return -EFAULT; | ||
4045 | } | ||
4046 | |||
4047 | ret = i915_gem_do_execbuffer(dev, data, file_priv, args, exec2_list); | ||
4048 | if (!ret) { | ||
4049 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
4050 | ret = copy_to_user((struct drm_i915_relocation_entry __user *) | ||
4051 | (uintptr_t) args->buffers_ptr, | ||
4052 | exec2_list, | ||
4053 | sizeof(*exec2_list) * args->buffer_count); | ||
4054 | if (ret) { | ||
4055 | ret = -EFAULT; | ||
4056 | DRM_ERROR("failed to copy %d exec entries " | ||
4057 | "back to user (%d)\n", | ||
4058 | args->buffer_count, ret); | ||
4059 | } | ||
4060 | } | ||
4061 | |||
4062 | drm_free_large(exec2_list); | ||
4063 | return ret; | ||
4064 | } | ||
4065 | |||
3923 | int | 4066 | int |
3924 | i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) | 4067 | i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) |
3925 | { | 4068 | { |
@@ -3933,19 +4076,7 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) | |||
3933 | if (ret) | 4076 | if (ret) |
3934 | return ret; | 4077 | return ret; |
3935 | } | 4078 | } |
3936 | /* | 4079 | |
3937 | * Pre-965 chips need a fence register set up in order to | ||
3938 | * properly handle tiled surfaces. | ||
3939 | */ | ||
3940 | if (!IS_I965G(dev) && obj_priv->tiling_mode != I915_TILING_NONE) { | ||
3941 | ret = i915_gem_object_get_fence_reg(obj); | ||
3942 | if (ret != 0) { | ||
3943 | if (ret != -EBUSY && ret != -ERESTARTSYS) | ||
3944 | DRM_ERROR("Failure to install fence: %d\n", | ||
3945 | ret); | ||
3946 | return ret; | ||
3947 | } | ||
3948 | } | ||
3949 | obj_priv->pin_count++; | 4080 | obj_priv->pin_count++; |
3950 | 4081 | ||
3951 | /* If the object is not active and not pending a flush, | 4082 | /* If the object is not active and not pending a flush, |
@@ -4708,7 +4839,7 @@ int i915_gem_init_phys_object(struct drm_device *dev, | |||
4708 | 4839 | ||
4709 | phys_obj->id = id; | 4840 | phys_obj->id = id; |
4710 | 4841 | ||
4711 | phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff); | 4842 | phys_obj->handle = drm_pci_alloc(dev, size, 0); |
4712 | if (!phys_obj->handle) { | 4843 | if (!phys_obj->handle) { |
4713 | ret = -ENOMEM; | 4844 | ret = -ENOMEM; |
4714 | goto kfree_obj; | 4845 | goto kfree_obj; |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 30d6af6c09bb..df278b2685bf 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -304,35 +304,39 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev) | |||
304 | 304 | ||
305 | 305 | ||
306 | /** | 306 | /** |
307 | * Returns the size of the fence for a tiled object of the given size. | 307 | * Returns whether an object is currently fenceable. If not, it may need |
308 | * to be unbound and have its pitch adjusted. | ||
308 | */ | 309 | */ |
309 | static int | 310 | bool |
310 | i915_get_fence_size(struct drm_device *dev, int size) | 311 | i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj) |
311 | { | 312 | { |
312 | int i; | 313 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
313 | int start; | ||
314 | 314 | ||
315 | if (IS_I965G(dev)) { | 315 | if (IS_I965G(dev)) { |
316 | /* The 965 can have fences at any page boundary. */ | 316 | /* The 965 can have fences at any page boundary. */ |
317 | return ALIGN(size, 4096); | 317 | if (obj->size & 4095) |
318 | return false; | ||
319 | return true; | ||
320 | } else if (IS_I9XX(dev)) { | ||
321 | if (obj_priv->gtt_offset & ~I915_FENCE_START_MASK) | ||
322 | return false; | ||
318 | } else { | 323 | } else { |
319 | /* Align the size to a power of two greater than the smallest | 324 | if (obj_priv->gtt_offset & ~I830_FENCE_START_MASK) |
320 | * fence size. | 325 | return false; |
321 | */ | 326 | } |
322 | if (IS_I9XX(dev)) | ||
323 | start = 1024 * 1024; | ||
324 | else | ||
325 | start = 512 * 1024; | ||
326 | 327 | ||
327 | for (i = start; i < size; i <<= 1) | 328 | /* Power of two sized... */ |
328 | ; | 329 | if (obj->size & (obj->size - 1)) |
330 | return false; | ||
329 | 331 | ||
330 | return i; | 332 | /* Objects must be size aligned as well */ |
331 | } | 333 | if (obj_priv->gtt_offset & (obj->size - 1)) |
334 | return false; | ||
335 | return true; | ||
332 | } | 336 | } |
333 | 337 | ||
334 | /* Check pitch constriants for all chips & tiling formats */ | 338 | /* Check pitch constriants for all chips & tiling formats */ |
335 | static bool | 339 | bool |
336 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | 340 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) |
337 | { | 341 | { |
338 | int tile_width; | 342 | int tile_width; |
@@ -384,12 +388,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | |||
384 | if (stride & (stride - 1)) | 388 | if (stride & (stride - 1)) |
385 | return false; | 389 | return false; |
386 | 390 | ||
387 | /* We don't 0handle the aperture area covered by the fence being bigger | ||
388 | * than the object size. | ||
389 | */ | ||
390 | if (i915_get_fence_size(dev, size) != size) | ||
391 | return false; | ||
392 | |||
393 | return true; | 391 | return true; |
394 | } | 392 | } |
395 | 393 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 85f4c5de97e2..7cd8110051b6 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -313,6 +313,8 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev) | |||
313 | dev_priv->mm.irq_gem_seqno = seqno; | 313 | dev_priv->mm.irq_gem_seqno = seqno; |
314 | trace_i915_gem_request_complete(dev, seqno); | 314 | trace_i915_gem_request_complete(dev, seqno); |
315 | DRM_WAKEUP(&dev_priv->irq_queue); | 315 | DRM_WAKEUP(&dev_priv->irq_queue); |
316 | dev_priv->hangcheck_count = 0; | ||
317 | mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD); | ||
316 | } | 318 | } |
317 | 319 | ||
318 | if (de_iir & DE_GSE) | 320 | if (de_iir & DE_GSE) |
@@ -1084,6 +1086,10 @@ void i915_driver_irq_preinstall(struct drm_device * dev) | |||
1084 | (void) I915_READ(IER); | 1086 | (void) I915_READ(IER); |
1085 | } | 1087 | } |
1086 | 1088 | ||
1089 | /* | ||
1090 | * Must be called after intel_modeset_init or hotplug interrupts won't be | ||
1091 | * enabled correctly. | ||
1092 | */ | ||
1087 | int i915_driver_irq_postinstall(struct drm_device *dev) | 1093 | int i915_driver_irq_postinstall(struct drm_device *dev) |
1088 | { | 1094 | { |
1089 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 1095 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
@@ -1106,19 +1112,23 @@ int i915_driver_irq_postinstall(struct drm_device *dev) | |||
1106 | if (I915_HAS_HOTPLUG(dev)) { | 1112 | if (I915_HAS_HOTPLUG(dev)) { |
1107 | u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN); | 1113 | u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN); |
1108 | 1114 | ||
1109 | /* Leave other bits alone */ | 1115 | /* Note HDMI and DP share bits */ |
1110 | hotplug_en |= HOTPLUG_EN_MASK; | 1116 | if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS) |
1117 | hotplug_en |= HDMIB_HOTPLUG_INT_EN; | ||
1118 | if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS) | ||
1119 | hotplug_en |= HDMIC_HOTPLUG_INT_EN; | ||
1120 | if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS) | ||
1121 | hotplug_en |= HDMID_HOTPLUG_INT_EN; | ||
1122 | if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS) | ||
1123 | hotplug_en |= SDVOC_HOTPLUG_INT_EN; | ||
1124 | if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS) | ||
1125 | hotplug_en |= SDVOB_HOTPLUG_INT_EN; | ||
1126 | if (dev_priv->hotplug_supported_mask & CRT_HOTPLUG_INT_STATUS) | ||
1127 | hotplug_en |= CRT_HOTPLUG_INT_EN; | ||
1128 | /* Ignore TV since it's buggy */ | ||
1129 | |||
1111 | I915_WRITE(PORT_HOTPLUG_EN, hotplug_en); | 1130 | I915_WRITE(PORT_HOTPLUG_EN, hotplug_en); |
1112 | 1131 | ||
1113 | dev_priv->hotplug_supported_mask = CRT_HOTPLUG_INT_STATUS | | ||
1114 | TV_HOTPLUG_INT_STATUS | SDVOC_HOTPLUG_INT_STATUS | | ||
1115 | SDVOB_HOTPLUG_INT_STATUS; | ||
1116 | if (IS_G4X(dev)) { | ||
1117 | dev_priv->hotplug_supported_mask |= | ||
1118 | HDMIB_HOTPLUG_INT_STATUS | | ||
1119 | HDMIC_HOTPLUG_INT_STATUS | | ||
1120 | HDMID_HOTPLUG_INT_STATUS; | ||
1121 | } | ||
1122 | /* Enable in IER... */ | 1132 | /* Enable in IER... */ |
1123 | enable_mask |= I915_DISPLAY_PORT_INTERRUPT; | 1133 | enable_mask |= I915_DISPLAY_PORT_INTERRUPT; |
1124 | /* and unmask in IMR */ | 1134 | /* and unmask in IMR */ |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 974b3cf70618..149d360d64a3 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -879,13 +879,6 @@ | |||
879 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) | 879 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) |
880 | #define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */ | 880 | #define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */ |
881 | #define CRT_FORCE_HOTPLUG_MASK 0xfffffe1f | 881 | #define CRT_FORCE_HOTPLUG_MASK 0xfffffe1f |
882 | #define HOTPLUG_EN_MASK (HDMIB_HOTPLUG_INT_EN | \ | ||
883 | HDMIC_HOTPLUG_INT_EN | \ | ||
884 | HDMID_HOTPLUG_INT_EN | \ | ||
885 | SDVOB_HOTPLUG_INT_EN | \ | ||
886 | SDVOC_HOTPLUG_INT_EN | \ | ||
887 | CRT_HOTPLUG_INT_EN) | ||
888 | |||
889 | 882 | ||
890 | #define PORT_HOTPLUG_STAT 0x61114 | 883 | #define PORT_HOTPLUG_STAT 0x61114 |
891 | #define HDMIB_HOTPLUG_INT_STATUS (1 << 29) | 884 | #define HDMIB_HOTPLUG_INT_STATUS (1 << 29) |
@@ -982,6 +975,8 @@ | |||
982 | #define LVDS_PORT_EN (1 << 31) | 975 | #define LVDS_PORT_EN (1 << 31) |
983 | /* Selects pipe B for LVDS data. Must be set on pre-965. */ | 976 | /* Selects pipe B for LVDS data. Must be set on pre-965. */ |
984 | #define LVDS_PIPEB_SELECT (1 << 30) | 977 | #define LVDS_PIPEB_SELECT (1 << 30) |
978 | /* LVDS dithering flag on 965/g4x platform */ | ||
979 | #define LVDS_ENABLE_DITHER (1 << 25) | ||
985 | /* Enable border for unscaled (or aspect-scaled) display */ | 980 | /* Enable border for unscaled (or aspect-scaled) display */ |
986 | #define LVDS_BORDER_ENABLE (1 << 15) | 981 | #define LVDS_BORDER_ENABLE (1 << 15) |
987 | /* | 982 | /* |
@@ -1751,6 +1746,8 @@ | |||
1751 | 1746 | ||
1752 | /* Display & cursor control */ | 1747 | /* Display & cursor control */ |
1753 | 1748 | ||
1749 | /* dithering flag on Ironlake */ | ||
1750 | #define PIPE_ENABLE_DITHER (1 << 4) | ||
1754 | /* Pipe A */ | 1751 | /* Pipe A */ |
1755 | #define PIPEADSL 0x70000 | 1752 | #define PIPEADSL 0x70000 |
1756 | #define PIPEACONF 0x70008 | 1753 | #define PIPEACONF 0x70008 |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index d5ebb00a9d49..a3b90c9561dc 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -732,12 +732,6 @@ int i915_save_state(struct drm_device *dev) | |||
732 | 732 | ||
733 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | 733 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); |
734 | 734 | ||
735 | /* Render Standby */ | ||
736 | if (I915_HAS_RC6(dev)) { | ||
737 | dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY); | ||
738 | dev_priv->savePWRCTXA = I915_READ(PWRCTXA); | ||
739 | } | ||
740 | |||
741 | /* Hardware status page */ | 735 | /* Hardware status page */ |
742 | dev_priv->saveHWS = I915_READ(HWS_PGA); | 736 | dev_priv->saveHWS = I915_READ(HWS_PGA); |
743 | 737 | ||
@@ -793,12 +787,6 @@ int i915_restore_state(struct drm_device *dev) | |||
793 | 787 | ||
794 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); | 788 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); |
795 | 789 | ||
796 | /* Render Standby */ | ||
797 | if (I915_HAS_RC6(dev)) { | ||
798 | I915_WRITE(MCHBAR_RENDER_STANDBY, dev_priv->saveRENDERSTANDBY); | ||
799 | I915_WRITE(PWRCTXA, dev_priv->savePWRCTXA); | ||
800 | } | ||
801 | |||
802 | /* Hardware status page */ | 790 | /* Hardware status page */ |
803 | I915_WRITE(HWS_PGA, dev_priv->saveHWS); | 791 | I915_WRITE(HWS_PGA, dev_priv->saveHWS); |
804 | 792 | ||
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 9f3d3e563414..ddefc871edfe 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -548,4 +548,6 @@ void intel_crt_init(struct drm_device *dev) | |||
548 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); | 548 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); |
549 | 549 | ||
550 | drm_sysfs_connector_add(connector); | 550 | drm_sysfs_connector_add(connector); |
551 | |||
552 | dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS; | ||
551 | } | 553 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 52cd9b006da2..002612fae717 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -262,6 +262,14 @@ struct intel_limit { | |||
262 | #define IRONLAKE_P2_LVDS_FAST 7 /* double channel */ | 262 | #define IRONLAKE_P2_LVDS_FAST 7 /* double channel */ |
263 | #define IRONLAKE_P2_DOT_LIMIT 225000 /* 225Mhz */ | 263 | #define IRONLAKE_P2_DOT_LIMIT 225000 /* 225Mhz */ |
264 | 264 | ||
265 | #define IRONLAKE_P_DISPLAY_PORT_MIN 10 | ||
266 | #define IRONLAKE_P_DISPLAY_PORT_MAX 20 | ||
267 | #define IRONLAKE_P2_DISPLAY_PORT_FAST 10 | ||
268 | #define IRONLAKE_P2_DISPLAY_PORT_SLOW 10 | ||
269 | #define IRONLAKE_P2_DISPLAY_PORT_LIMIT 0 | ||
270 | #define IRONLAKE_P1_DISPLAY_PORT_MIN 1 | ||
271 | #define IRONLAKE_P1_DISPLAY_PORT_MAX 2 | ||
272 | |||
265 | static bool | 273 | static bool |
266 | intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | 274 | intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, |
267 | int target, int refclk, intel_clock_t *best_clock); | 275 | int target, int refclk, intel_clock_t *best_clock); |
@@ -271,9 +279,6 @@ intel_find_best_reduced_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
271 | static bool | 279 | static bool |
272 | intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | 280 | intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, |
273 | int target, int refclk, intel_clock_t *best_clock); | 281 | int target, int refclk, intel_clock_t *best_clock); |
274 | static bool | ||
275 | intel_ironlake_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | ||
276 | int target, int refclk, intel_clock_t *best_clock); | ||
277 | 282 | ||
278 | static bool | 283 | static bool |
279 | intel_find_pll_g4x_dp(const intel_limit_t *, struct drm_crtc *crtc, | 284 | intel_find_pll_g4x_dp(const intel_limit_t *, struct drm_crtc *crtc, |
@@ -496,7 +501,7 @@ static const intel_limit_t intel_limits_ironlake_sdvo = { | |||
496 | .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, | 501 | .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, |
497 | .p2_slow = IRONLAKE_P2_SDVO_DAC_SLOW, | 502 | .p2_slow = IRONLAKE_P2_SDVO_DAC_SLOW, |
498 | .p2_fast = IRONLAKE_P2_SDVO_DAC_FAST }, | 503 | .p2_fast = IRONLAKE_P2_SDVO_DAC_FAST }, |
499 | .find_pll = intel_ironlake_find_best_PLL, | 504 | .find_pll = intel_g4x_find_best_PLL, |
500 | }; | 505 | }; |
501 | 506 | ||
502 | static const intel_limit_t intel_limits_ironlake_lvds = { | 507 | static const intel_limit_t intel_limits_ironlake_lvds = { |
@@ -511,7 +516,30 @@ static const intel_limit_t intel_limits_ironlake_lvds = { | |||
511 | .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, | 516 | .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, |
512 | .p2_slow = IRONLAKE_P2_LVDS_SLOW, | 517 | .p2_slow = IRONLAKE_P2_LVDS_SLOW, |
513 | .p2_fast = IRONLAKE_P2_LVDS_FAST }, | 518 | .p2_fast = IRONLAKE_P2_LVDS_FAST }, |
514 | .find_pll = intel_ironlake_find_best_PLL, | 519 | .find_pll = intel_g4x_find_best_PLL, |
520 | }; | ||
521 | |||
522 | static const intel_limit_t intel_limits_ironlake_display_port = { | ||
523 | .dot = { .min = IRONLAKE_DOT_MIN, | ||
524 | .max = IRONLAKE_DOT_MAX }, | ||
525 | .vco = { .min = IRONLAKE_VCO_MIN, | ||
526 | .max = IRONLAKE_VCO_MAX}, | ||
527 | .n = { .min = IRONLAKE_N_MIN, | ||
528 | .max = IRONLAKE_N_MAX }, | ||
529 | .m = { .min = IRONLAKE_M_MIN, | ||
530 | .max = IRONLAKE_M_MAX }, | ||
531 | .m1 = { .min = IRONLAKE_M1_MIN, | ||
532 | .max = IRONLAKE_M1_MAX }, | ||
533 | .m2 = { .min = IRONLAKE_M2_MIN, | ||
534 | .max = IRONLAKE_M2_MAX }, | ||
535 | .p = { .min = IRONLAKE_P_DISPLAY_PORT_MIN, | ||
536 | .max = IRONLAKE_P_DISPLAY_PORT_MAX }, | ||
537 | .p1 = { .min = IRONLAKE_P1_DISPLAY_PORT_MIN, | ||
538 | .max = IRONLAKE_P1_DISPLAY_PORT_MAX}, | ||
539 | .p2 = { .dot_limit = IRONLAKE_P2_DISPLAY_PORT_LIMIT, | ||
540 | .p2_slow = IRONLAKE_P2_DISPLAY_PORT_SLOW, | ||
541 | .p2_fast = IRONLAKE_P2_DISPLAY_PORT_FAST }, | ||
542 | .find_pll = intel_find_pll_ironlake_dp, | ||
515 | }; | 543 | }; |
516 | 544 | ||
517 | static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc) | 545 | static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc) |
@@ -519,6 +547,9 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc) | |||
519 | const intel_limit_t *limit; | 547 | const intel_limit_t *limit; |
520 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) | 548 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) |
521 | limit = &intel_limits_ironlake_lvds; | 549 | limit = &intel_limits_ironlake_lvds; |
550 | else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) || | ||
551 | HAS_eDP) | ||
552 | limit = &intel_limits_ironlake_display_port; | ||
522 | else | 553 | else |
523 | limit = &intel_limits_ironlake_sdvo; | 554 | limit = &intel_limits_ironlake_sdvo; |
524 | 555 | ||
@@ -791,7 +822,13 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
791 | found = false; | 822 | found = false; |
792 | 823 | ||
793 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 824 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { |
794 | if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) == | 825 | int lvds_reg; |
826 | |||
827 | if (IS_IRONLAKE(dev)) | ||
828 | lvds_reg = PCH_LVDS; | ||
829 | else | ||
830 | lvds_reg = LVDS; | ||
831 | if ((I915_READ(lvds_reg) & LVDS_CLKB_POWER_MASK) == | ||
795 | LVDS_CLKB_POWER_UP) | 832 | LVDS_CLKB_POWER_UP) |
796 | clock.p2 = limit->p2.p2_fast; | 833 | clock.p2 = limit->p2.p2_fast; |
797 | else | 834 | else |
@@ -839,6 +876,11 @@ intel_find_pll_ironlake_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
839 | { | 876 | { |
840 | struct drm_device *dev = crtc->dev; | 877 | struct drm_device *dev = crtc->dev; |
841 | intel_clock_t clock; | 878 | intel_clock_t clock; |
879 | |||
880 | /* return directly when it is eDP */ | ||
881 | if (HAS_eDP) | ||
882 | return true; | ||
883 | |||
842 | if (target < 200000) { | 884 | if (target < 200000) { |
843 | clock.n = 1; | 885 | clock.n = 1; |
844 | clock.p1 = 2; | 886 | clock.p1 = 2; |
@@ -857,68 +899,6 @@ intel_find_pll_ironlake_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
857 | return true; | 899 | return true; |
858 | } | 900 | } |
859 | 901 | ||
860 | static bool | ||
861 | intel_ironlake_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | ||
862 | int target, int refclk, intel_clock_t *best_clock) | ||
863 | { | ||
864 | struct drm_device *dev = crtc->dev; | ||
865 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
866 | intel_clock_t clock; | ||
867 | int err_most = 47; | ||
868 | int err_min = 10000; | ||
869 | |||
870 | /* eDP has only 2 clock choice, no n/m/p setting */ | ||
871 | if (HAS_eDP) | ||
872 | return true; | ||
873 | |||
874 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) | ||
875 | return intel_find_pll_ironlake_dp(limit, crtc, target, | ||
876 | refclk, best_clock); | ||
877 | |||
878 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | ||
879 | if ((I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) == | ||
880 | LVDS_CLKB_POWER_UP) | ||
881 | clock.p2 = limit->p2.p2_fast; | ||
882 | else | ||
883 | clock.p2 = limit->p2.p2_slow; | ||
884 | } else { | ||
885 | if (target < limit->p2.dot_limit) | ||
886 | clock.p2 = limit->p2.p2_slow; | ||
887 | else | ||
888 | clock.p2 = limit->p2.p2_fast; | ||
889 | } | ||
890 | |||
891 | memset(best_clock, 0, sizeof(*best_clock)); | ||
892 | for (clock.p1 = limit->p1.max; clock.p1 >= limit->p1.min; clock.p1--) { | ||
893 | /* based on hardware requriment prefer smaller n to precision */ | ||
894 | for (clock.n = limit->n.min; clock.n <= limit->n.max; clock.n++) { | ||
895 | /* based on hardware requirment prefere larger m1,m2 */ | ||
896 | for (clock.m1 = limit->m1.max; | ||
897 | clock.m1 >= limit->m1.min; clock.m1--) { | ||
898 | for (clock.m2 = limit->m2.max; | ||
899 | clock.m2 >= limit->m2.min; clock.m2--) { | ||
900 | int this_err; | ||
901 | |||
902 | intel_clock(dev, refclk, &clock); | ||
903 | if (!intel_PLL_is_valid(crtc, &clock)) | ||
904 | continue; | ||
905 | this_err = abs((10000 - (target*10000/clock.dot))); | ||
906 | if (this_err < err_most) { | ||
907 | *best_clock = clock; | ||
908 | /* found on first matching */ | ||
909 | goto out; | ||
910 | } else if (this_err < err_min) { | ||
911 | *best_clock = clock; | ||
912 | err_min = this_err; | ||
913 | } | ||
914 | } | ||
915 | } | ||
916 | } | ||
917 | } | ||
918 | out: | ||
919 | return true; | ||
920 | } | ||
921 | |||
922 | /* DisplayPort has only two frequencies, 162MHz and 270MHz */ | 902 | /* DisplayPort has only two frequencies, 162MHz and 270MHz */ |
923 | static bool | 903 | static bool |
924 | intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | 904 | intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc, |
@@ -1493,6 +1473,10 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1493 | int trans_vsync_reg = (pipe == 0) ? TRANS_VSYNC_A : TRANS_VSYNC_B; | 1473 | int trans_vsync_reg = (pipe == 0) ? TRANS_VSYNC_A : TRANS_VSYNC_B; |
1494 | u32 temp; | 1474 | u32 temp; |
1495 | int tries = 5, j, n; | 1475 | int tries = 5, j, n; |
1476 | u32 pipe_bpc; | ||
1477 | |||
1478 | temp = I915_READ(pipeconf_reg); | ||
1479 | pipe_bpc = temp & PIPE_BPC_MASK; | ||
1496 | 1480 | ||
1497 | /* XXX: When our outputs are all unaware of DPMS modes other than off | 1481 | /* XXX: When our outputs are all unaware of DPMS modes other than off |
1498 | * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC. | 1482 | * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC. |
@@ -1524,6 +1508,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1524 | 1508 | ||
1525 | /* enable PCH FDI RX PLL, wait warmup plus DMI latency */ | 1509 | /* enable PCH FDI RX PLL, wait warmup plus DMI latency */ |
1526 | temp = I915_READ(fdi_rx_reg); | 1510 | temp = I915_READ(fdi_rx_reg); |
1511 | /* | ||
1512 | * make the BPC in FDI Rx be consistent with that in | ||
1513 | * pipeconf reg. | ||
1514 | */ | ||
1515 | temp &= ~(0x7 << 16); | ||
1516 | temp |= (pipe_bpc << 11); | ||
1527 | I915_WRITE(fdi_rx_reg, temp | FDI_RX_PLL_ENABLE | | 1517 | I915_WRITE(fdi_rx_reg, temp | FDI_RX_PLL_ENABLE | |
1528 | FDI_SEL_PCDCLK | | 1518 | FDI_SEL_PCDCLK | |
1529 | FDI_DP_PORT_WIDTH_X4); /* default 4 lanes */ | 1519 | FDI_DP_PORT_WIDTH_X4); /* default 4 lanes */ |
@@ -1666,6 +1656,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1666 | 1656 | ||
1667 | /* enable PCH transcoder */ | 1657 | /* enable PCH transcoder */ |
1668 | temp = I915_READ(transconf_reg); | 1658 | temp = I915_READ(transconf_reg); |
1659 | /* | ||
1660 | * make the BPC in transcoder be consistent with | ||
1661 | * that in pipeconf reg. | ||
1662 | */ | ||
1663 | temp &= ~PIPE_BPC_MASK; | ||
1664 | temp |= pipe_bpc; | ||
1669 | I915_WRITE(transconf_reg, temp | TRANS_ENABLE); | 1665 | I915_WRITE(transconf_reg, temp | TRANS_ENABLE); |
1670 | I915_READ(transconf_reg); | 1666 | I915_READ(transconf_reg); |
1671 | 1667 | ||
@@ -1745,6 +1741,9 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1745 | I915_READ(fdi_tx_reg); | 1741 | I915_READ(fdi_tx_reg); |
1746 | 1742 | ||
1747 | temp = I915_READ(fdi_rx_reg); | 1743 | temp = I915_READ(fdi_rx_reg); |
1744 | /* BPC in FDI rx is consistent with that in pipeconf */ | ||
1745 | temp &= ~(0x07 << 16); | ||
1746 | temp |= (pipe_bpc << 11); | ||
1748 | I915_WRITE(fdi_rx_reg, temp & ~FDI_RX_ENABLE); | 1747 | I915_WRITE(fdi_rx_reg, temp & ~FDI_RX_ENABLE); |
1749 | I915_READ(fdi_rx_reg); | 1748 | I915_READ(fdi_rx_reg); |
1750 | 1749 | ||
@@ -1789,7 +1788,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1789 | } | 1788 | } |
1790 | } | 1789 | } |
1791 | } | 1790 | } |
1792 | 1791 | temp = I915_READ(transconf_reg); | |
1792 | /* BPC in transcoder is consistent with that in pipeconf */ | ||
1793 | temp &= ~PIPE_BPC_MASK; | ||
1794 | temp |= pipe_bpc; | ||
1795 | I915_WRITE(transconf_reg, temp); | ||
1796 | I915_READ(transconf_reg); | ||
1793 | udelay(100); | 1797 | udelay(100); |
1794 | 1798 | ||
1795 | /* disable PCH DPLL */ | 1799 | /* disable PCH DPLL */ |
@@ -2448,7 +2452,7 @@ static void pineview_enable_cxsr(struct drm_device *dev, unsigned long clock, | |||
2448 | * A value of 5us seems to be a good balance; safe for very low end | 2452 | * A value of 5us seems to be a good balance; safe for very low end |
2449 | * platforms but not overly aggressive on lower latency configs. | 2453 | * platforms but not overly aggressive on lower latency configs. |
2450 | */ | 2454 | */ |
2451 | const static int latency_ns = 5000; | 2455 | static const int latency_ns = 5000; |
2452 | 2456 | ||
2453 | static int i9xx_get_fifo_size(struct drm_device *dev, int plane) | 2457 | static int i9xx_get_fifo_size(struct drm_device *dev, int plane) |
2454 | { | 2458 | { |
@@ -2559,7 +2563,7 @@ static void g4x_update_wm(struct drm_device *dev, int planea_clock, | |||
2559 | /* Calc sr entries for one plane configs */ | 2563 | /* Calc sr entries for one plane configs */ |
2560 | if (sr_hdisplay && (!planea_clock || !planeb_clock)) { | 2564 | if (sr_hdisplay && (!planea_clock || !planeb_clock)) { |
2561 | /* self-refresh has much higher latency */ | 2565 | /* self-refresh has much higher latency */ |
2562 | const static int sr_latency_ns = 12000; | 2566 | static const int sr_latency_ns = 12000; |
2563 | 2567 | ||
2564 | sr_clock = planea_clock ? planea_clock : planeb_clock; | 2568 | sr_clock = planea_clock ? planea_clock : planeb_clock; |
2565 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); | 2569 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); |
@@ -2598,7 +2602,7 @@ static void i965_update_wm(struct drm_device *dev, int planea_clock, | |||
2598 | /* Calc sr entries for one plane configs */ | 2602 | /* Calc sr entries for one plane configs */ |
2599 | if (sr_hdisplay && (!planea_clock || !planeb_clock)) { | 2603 | if (sr_hdisplay && (!planea_clock || !planeb_clock)) { |
2600 | /* self-refresh has much higher latency */ | 2604 | /* self-refresh has much higher latency */ |
2601 | const static int sr_latency_ns = 12000; | 2605 | static const int sr_latency_ns = 12000; |
2602 | 2606 | ||
2603 | sr_clock = planea_clock ? planea_clock : planeb_clock; | 2607 | sr_clock = planea_clock ? planea_clock : planeb_clock; |
2604 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); | 2608 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); |
@@ -2667,7 +2671,7 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock, | |||
2667 | if (HAS_FW_BLC(dev) && sr_hdisplay && | 2671 | if (HAS_FW_BLC(dev) && sr_hdisplay && |
2668 | (!planea_clock || !planeb_clock)) { | 2672 | (!planea_clock || !planeb_clock)) { |
2669 | /* self-refresh has much higher latency */ | 2673 | /* self-refresh has much higher latency */ |
2670 | const static int sr_latency_ns = 6000; | 2674 | static const int sr_latency_ns = 6000; |
2671 | 2675 | ||
2672 | sr_clock = planea_clock ? planea_clock : planeb_clock; | 2676 | sr_clock = planea_clock ? planea_clock : planeb_clock; |
2673 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); | 2677 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); |
@@ -2969,6 +2973,18 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
2969 | 2973 | ||
2970 | /* determine panel color depth */ | 2974 | /* determine panel color depth */ |
2971 | temp = I915_READ(pipeconf_reg); | 2975 | temp = I915_READ(pipeconf_reg); |
2976 | temp &= ~PIPE_BPC_MASK; | ||
2977 | if (is_lvds) { | ||
2978 | int lvds_reg = I915_READ(PCH_LVDS); | ||
2979 | /* the BPC will be 6 if it is 18-bit LVDS panel */ | ||
2980 | if ((lvds_reg & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP) | ||
2981 | temp |= PIPE_8BPC; | ||
2982 | else | ||
2983 | temp |= PIPE_6BPC; | ||
2984 | } else | ||
2985 | temp |= PIPE_8BPC; | ||
2986 | I915_WRITE(pipeconf_reg, temp); | ||
2987 | I915_READ(pipeconf_reg); | ||
2972 | 2988 | ||
2973 | switch (temp & PIPE_BPC_MASK) { | 2989 | switch (temp & PIPE_BPC_MASK) { |
2974 | case PIPE_8BPC: | 2990 | case PIPE_8BPC: |
@@ -3195,7 +3211,20 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3195 | * appropriately here, but we need to look more thoroughly into how | 3211 | * appropriately here, but we need to look more thoroughly into how |
3196 | * panels behave in the two modes. | 3212 | * panels behave in the two modes. |
3197 | */ | 3213 | */ |
3198 | 3214 | /* set the dithering flag */ | |
3215 | if (IS_I965G(dev)) { | ||
3216 | if (dev_priv->lvds_dither) { | ||
3217 | if (IS_IRONLAKE(dev)) | ||
3218 | pipeconf |= PIPE_ENABLE_DITHER; | ||
3219 | else | ||
3220 | lvds |= LVDS_ENABLE_DITHER; | ||
3221 | } else { | ||
3222 | if (IS_IRONLAKE(dev)) | ||
3223 | pipeconf &= ~PIPE_ENABLE_DITHER; | ||
3224 | else | ||
3225 | lvds &= ~LVDS_ENABLE_DITHER; | ||
3226 | } | ||
3227 | } | ||
3199 | I915_WRITE(lvds_reg, lvds); | 3228 | I915_WRITE(lvds_reg, lvds); |
3200 | I915_READ(lvds_reg); | 3229 | I915_READ(lvds_reg); |
3201 | } | 3230 | } |
@@ -3385,7 +3414,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
3385 | 3414 | ||
3386 | /* we only need to pin inside GTT if cursor is non-phy */ | 3415 | /* we only need to pin inside GTT if cursor is non-phy */ |
3387 | mutex_lock(&dev->struct_mutex); | 3416 | mutex_lock(&dev->struct_mutex); |
3388 | if (!dev_priv->cursor_needs_physical) { | 3417 | if (!dev_priv->info->cursor_needs_physical) { |
3389 | ret = i915_gem_object_pin(bo, PAGE_SIZE); | 3418 | ret = i915_gem_object_pin(bo, PAGE_SIZE); |
3390 | if (ret) { | 3419 | if (ret) { |
3391 | DRM_ERROR("failed to pin cursor bo\n"); | 3420 | DRM_ERROR("failed to pin cursor bo\n"); |
@@ -3420,7 +3449,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
3420 | I915_WRITE(base, addr); | 3449 | I915_WRITE(base, addr); |
3421 | 3450 | ||
3422 | if (intel_crtc->cursor_bo) { | 3451 | if (intel_crtc->cursor_bo) { |
3423 | if (dev_priv->cursor_needs_physical) { | 3452 | if (dev_priv->info->cursor_needs_physical) { |
3424 | if (intel_crtc->cursor_bo != bo) | 3453 | if (intel_crtc->cursor_bo != bo) |
3425 | i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); | 3454 | i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); |
3426 | } else | 3455 | } else |
@@ -3779,125 +3808,6 @@ static void intel_gpu_idle_timer(unsigned long arg) | |||
3779 | queue_work(dev_priv->wq, &dev_priv->idle_work); | 3808 | queue_work(dev_priv->wq, &dev_priv->idle_work); |
3780 | } | 3809 | } |
3781 | 3810 | ||
3782 | void intel_increase_renderclock(struct drm_device *dev, bool schedule) | ||
3783 | { | ||
3784 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
3785 | |||
3786 | if (IS_IRONLAKE(dev)) | ||
3787 | return; | ||
3788 | |||
3789 | if (!dev_priv->render_reclock_avail) { | ||
3790 | DRM_DEBUG_DRIVER("not reclocking render clock\n"); | ||
3791 | return; | ||
3792 | } | ||
3793 | |||
3794 | /* Restore render clock frequency to original value */ | ||
3795 | if (IS_G4X(dev) || IS_I9XX(dev)) | ||
3796 | pci_write_config_word(dev->pdev, GCFGC, dev_priv->orig_clock); | ||
3797 | else if (IS_I85X(dev)) | ||
3798 | pci_write_config_word(dev->pdev, HPLLCC, dev_priv->orig_clock); | ||
3799 | DRM_DEBUG_DRIVER("increasing render clock frequency\n"); | ||
3800 | |||
3801 | /* Schedule downclock */ | ||
3802 | if (schedule) | ||
3803 | mod_timer(&dev_priv->idle_timer, jiffies + | ||
3804 | msecs_to_jiffies(GPU_IDLE_TIMEOUT)); | ||
3805 | } | ||
3806 | |||
3807 | void intel_decrease_renderclock(struct drm_device *dev) | ||
3808 | { | ||
3809 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
3810 | |||
3811 | if (IS_IRONLAKE(dev)) | ||
3812 | return; | ||
3813 | |||
3814 | if (!dev_priv->render_reclock_avail) { | ||
3815 | DRM_DEBUG_DRIVER("not reclocking render clock\n"); | ||
3816 | return; | ||
3817 | } | ||
3818 | |||
3819 | if (IS_G4X(dev)) { | ||
3820 | u16 gcfgc; | ||
3821 | |||
3822 | /* Adjust render clock... */ | ||
3823 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3824 | |||
3825 | /* Down to minimum... */ | ||
3826 | gcfgc &= ~GM45_GC_RENDER_CLOCK_MASK; | ||
3827 | gcfgc |= GM45_GC_RENDER_CLOCK_266_MHZ; | ||
3828 | |||
3829 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3830 | } else if (IS_I965G(dev)) { | ||
3831 | u16 gcfgc; | ||
3832 | |||
3833 | /* Adjust render clock... */ | ||
3834 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3835 | |||
3836 | /* Down to minimum... */ | ||
3837 | gcfgc &= ~I965_GC_RENDER_CLOCK_MASK; | ||
3838 | gcfgc |= I965_GC_RENDER_CLOCK_267_MHZ; | ||
3839 | |||
3840 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3841 | } else if (IS_I945G(dev) || IS_I945GM(dev)) { | ||
3842 | u16 gcfgc; | ||
3843 | |||
3844 | /* Adjust render clock... */ | ||
3845 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3846 | |||
3847 | /* Down to minimum... */ | ||
3848 | gcfgc &= ~I945_GC_RENDER_CLOCK_MASK; | ||
3849 | gcfgc |= I945_GC_RENDER_CLOCK_166_MHZ; | ||
3850 | |||
3851 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3852 | } else if (IS_I915G(dev)) { | ||
3853 | u16 gcfgc; | ||
3854 | |||
3855 | /* Adjust render clock... */ | ||
3856 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3857 | |||
3858 | /* Down to minimum... */ | ||
3859 | gcfgc &= ~I915_GC_RENDER_CLOCK_MASK; | ||
3860 | gcfgc |= I915_GC_RENDER_CLOCK_166_MHZ; | ||
3861 | |||
3862 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3863 | } else if (IS_I85X(dev)) { | ||
3864 | u16 hpllcc; | ||
3865 | |||
3866 | /* Adjust render clock... */ | ||
3867 | pci_read_config_word(dev->pdev, HPLLCC, &hpllcc); | ||
3868 | |||
3869 | /* Up to maximum... */ | ||
3870 | hpllcc &= ~GC_CLOCK_CONTROL_MASK; | ||
3871 | hpllcc |= GC_CLOCK_133_200; | ||
3872 | |||
3873 | pci_write_config_word(dev->pdev, HPLLCC, hpllcc); | ||
3874 | } | ||
3875 | DRM_DEBUG_DRIVER("decreasing render clock frequency\n"); | ||
3876 | } | ||
3877 | |||
3878 | /* Note that no increase function is needed for this - increase_renderclock() | ||
3879 | * will also rewrite these bits | ||
3880 | */ | ||
3881 | void intel_decrease_displayclock(struct drm_device *dev) | ||
3882 | { | ||
3883 | if (IS_IRONLAKE(dev)) | ||
3884 | return; | ||
3885 | |||
3886 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_I915G(dev) || | ||
3887 | IS_I915GM(dev)) { | ||
3888 | u16 gcfgc; | ||
3889 | |||
3890 | /* Adjust render clock... */ | ||
3891 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3892 | |||
3893 | /* Down to minimum... */ | ||
3894 | gcfgc &= ~0xf0; | ||
3895 | gcfgc |= 0x80; | ||
3896 | |||
3897 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3898 | } | ||
3899 | } | ||
3900 | |||
3901 | #define CRTC_IDLE_TIMEOUT 1000 /* ms */ | 3811 | #define CRTC_IDLE_TIMEOUT 1000 /* ms */ |
3902 | 3812 | ||
3903 | static void intel_crtc_idle_timer(unsigned long arg) | 3813 | static void intel_crtc_idle_timer(unsigned long arg) |
@@ -4011,12 +3921,6 @@ static void intel_idle_update(struct work_struct *work) | |||
4011 | 3921 | ||
4012 | mutex_lock(&dev->struct_mutex); | 3922 | mutex_lock(&dev->struct_mutex); |
4013 | 3923 | ||
4014 | /* GPU isn't processing, downclock it. */ | ||
4015 | if (!dev_priv->busy) { | ||
4016 | intel_decrease_renderclock(dev); | ||
4017 | intel_decrease_displayclock(dev); | ||
4018 | } | ||
4019 | |||
4020 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 3924 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
4021 | /* Skip inactive CRTCs */ | 3925 | /* Skip inactive CRTCs */ |
4022 | if (!crtc->fb) | 3926 | if (!crtc->fb) |
@@ -4050,13 +3954,11 @@ void intel_mark_busy(struct drm_device *dev, struct drm_gem_object *obj) | |||
4050 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 3954 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
4051 | return; | 3955 | return; |
4052 | 3956 | ||
4053 | if (!dev_priv->busy) { | 3957 | if (!dev_priv->busy) |
4054 | dev_priv->busy = true; | 3958 | dev_priv->busy = true; |
4055 | intel_increase_renderclock(dev, true); | 3959 | else |
4056 | } else { | ||
4057 | mod_timer(&dev_priv->idle_timer, jiffies + | 3960 | mod_timer(&dev_priv->idle_timer, jiffies + |
4058 | msecs_to_jiffies(GPU_IDLE_TIMEOUT)); | 3961 | msecs_to_jiffies(GPU_IDLE_TIMEOUT)); |
4059 | } | ||
4060 | 3962 | ||
4061 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 3963 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
4062 | if (!crtc->fb) | 3964 | if (!crtc->fb) |
@@ -4400,29 +4302,43 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
4400 | bool found = false; | 4302 | bool found = false; |
4401 | 4303 | ||
4402 | if (I915_READ(SDVOB) & SDVO_DETECTED) { | 4304 | if (I915_READ(SDVOB) & SDVO_DETECTED) { |
4305 | DRM_DEBUG_KMS("probing SDVOB\n"); | ||
4403 | found = intel_sdvo_init(dev, SDVOB); | 4306 | found = intel_sdvo_init(dev, SDVOB); |
4404 | if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) | 4307 | if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) { |
4308 | DRM_DEBUG_KMS("probing HDMI on SDVOB\n"); | ||
4405 | intel_hdmi_init(dev, SDVOB); | 4309 | intel_hdmi_init(dev, SDVOB); |
4310 | } | ||
4406 | 4311 | ||
4407 | if (!found && SUPPORTS_INTEGRATED_DP(dev)) | 4312 | if (!found && SUPPORTS_INTEGRATED_DP(dev)) { |
4313 | DRM_DEBUG_KMS("probing DP_B\n"); | ||
4408 | intel_dp_init(dev, DP_B); | 4314 | intel_dp_init(dev, DP_B); |
4315 | } | ||
4409 | } | 4316 | } |
4410 | 4317 | ||
4411 | /* Before G4X SDVOC doesn't have its own detect register */ | 4318 | /* Before G4X SDVOC doesn't have its own detect register */ |
4412 | 4319 | ||
4413 | if (I915_READ(SDVOB) & SDVO_DETECTED) | 4320 | if (I915_READ(SDVOB) & SDVO_DETECTED) { |
4321 | DRM_DEBUG_KMS("probing SDVOC\n"); | ||
4414 | found = intel_sdvo_init(dev, SDVOC); | 4322 | found = intel_sdvo_init(dev, SDVOC); |
4323 | } | ||
4415 | 4324 | ||
4416 | if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) { | 4325 | if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) { |
4417 | 4326 | ||
4418 | if (SUPPORTS_INTEGRATED_HDMI(dev)) | 4327 | if (SUPPORTS_INTEGRATED_HDMI(dev)) { |
4328 | DRM_DEBUG_KMS("probing HDMI on SDVOC\n"); | ||
4419 | intel_hdmi_init(dev, SDVOC); | 4329 | intel_hdmi_init(dev, SDVOC); |
4420 | if (SUPPORTS_INTEGRATED_DP(dev)) | 4330 | } |
4331 | if (SUPPORTS_INTEGRATED_DP(dev)) { | ||
4332 | DRM_DEBUG_KMS("probing DP_C\n"); | ||
4421 | intel_dp_init(dev, DP_C); | 4333 | intel_dp_init(dev, DP_C); |
4334 | } | ||
4422 | } | 4335 | } |
4423 | 4336 | ||
4424 | if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED)) | 4337 | if (SUPPORTS_INTEGRATED_DP(dev) && |
4338 | (I915_READ(DP_D) & DP_DETECTED)) { | ||
4339 | DRM_DEBUG_KMS("probing DP_D\n"); | ||
4425 | intel_dp_init(dev, DP_D); | 4340 | intel_dp_init(dev, DP_D); |
4341 | } | ||
4426 | } else if (IS_I8XX(dev)) | 4342 | } else if (IS_I8XX(dev)) |
4427 | intel_dvo_init(dev); | 4343 | intel_dvo_init(dev); |
4428 | 4344 | ||
@@ -4527,6 +4443,42 @@ static const struct drm_mode_config_funcs intel_mode_funcs = { | |||
4527 | .fb_changed = intelfb_probe, | 4443 | .fb_changed = intelfb_probe, |
4528 | }; | 4444 | }; |
4529 | 4445 | ||
4446 | static struct drm_gem_object * | ||
4447 | intel_alloc_power_context(struct drm_device *dev) | ||
4448 | { | ||
4449 | struct drm_gem_object *pwrctx; | ||
4450 | int ret; | ||
4451 | |||
4452 | pwrctx = drm_gem_object_alloc(dev, 4096); | ||
4453 | if (!pwrctx) { | ||
4454 | DRM_DEBUG("failed to alloc power context, RC6 disabled\n"); | ||
4455 | return NULL; | ||
4456 | } | ||
4457 | |||
4458 | mutex_lock(&dev->struct_mutex); | ||
4459 | ret = i915_gem_object_pin(pwrctx, 4096); | ||
4460 | if (ret) { | ||
4461 | DRM_ERROR("failed to pin power context: %d\n", ret); | ||
4462 | goto err_unref; | ||
4463 | } | ||
4464 | |||
4465 | ret = i915_gem_object_set_to_gtt_domain(pwrctx, 1); | ||
4466 | if (ret) { | ||
4467 | DRM_ERROR("failed to set-domain on power context: %d\n", ret); | ||
4468 | goto err_unpin; | ||
4469 | } | ||
4470 | mutex_unlock(&dev->struct_mutex); | ||
4471 | |||
4472 | return pwrctx; | ||
4473 | |||
4474 | err_unpin: | ||
4475 | i915_gem_object_unpin(pwrctx); | ||
4476 | err_unref: | ||
4477 | drm_gem_object_unreference(pwrctx); | ||
4478 | mutex_unlock(&dev->struct_mutex); | ||
4479 | return NULL; | ||
4480 | } | ||
4481 | |||
4530 | void intel_init_clock_gating(struct drm_device *dev) | 4482 | void intel_init_clock_gating(struct drm_device *dev) |
4531 | { | 4483 | { |
4532 | struct drm_i915_private *dev_priv = dev->dev_private; | 4484 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -4579,42 +4531,27 @@ void intel_init_clock_gating(struct drm_device *dev) | |||
4579 | * GPU can automatically power down the render unit if given a page | 4531 | * GPU can automatically power down the render unit if given a page |
4580 | * to save state. | 4532 | * to save state. |
4581 | */ | 4533 | */ |
4582 | if (I915_HAS_RC6(dev)) { | 4534 | if (I915_HAS_RC6(dev) && drm_core_check_feature(dev, DRIVER_MODESET)) { |
4583 | struct drm_gem_object *pwrctx; | 4535 | struct drm_i915_gem_object *obj_priv = NULL; |
4584 | struct drm_i915_gem_object *obj_priv; | ||
4585 | int ret; | ||
4586 | 4536 | ||
4587 | if (dev_priv->pwrctx) { | 4537 | if (dev_priv->pwrctx) { |
4588 | obj_priv = dev_priv->pwrctx->driver_private; | 4538 | obj_priv = dev_priv->pwrctx->driver_private; |
4589 | } else { | 4539 | } else { |
4590 | pwrctx = drm_gem_object_alloc(dev, 4096); | 4540 | struct drm_gem_object *pwrctx; |
4591 | if (!pwrctx) { | ||
4592 | DRM_DEBUG("failed to alloc power context, " | ||
4593 | "RC6 disabled\n"); | ||
4594 | goto out; | ||
4595 | } | ||
4596 | 4541 | ||
4597 | ret = i915_gem_object_pin(pwrctx, 4096); | 4542 | pwrctx = intel_alloc_power_context(dev); |
4598 | if (ret) { | 4543 | if (pwrctx) { |
4599 | DRM_ERROR("failed to pin power context: %d\n", | 4544 | dev_priv->pwrctx = pwrctx; |
4600 | ret); | 4545 | obj_priv = pwrctx->driver_private; |
4601 | drm_gem_object_unreference(pwrctx); | ||
4602 | goto out; | ||
4603 | } | 4546 | } |
4604 | |||
4605 | i915_gem_object_set_to_gtt_domain(pwrctx, 1); | ||
4606 | |||
4607 | dev_priv->pwrctx = pwrctx; | ||
4608 | obj_priv = pwrctx->driver_private; | ||
4609 | } | 4547 | } |
4610 | 4548 | ||
4611 | I915_WRITE(PWRCTXA, obj_priv->gtt_offset | PWRCTX_EN); | 4549 | if (obj_priv) { |
4612 | I915_WRITE(MCHBAR_RENDER_STANDBY, | 4550 | I915_WRITE(PWRCTXA, obj_priv->gtt_offset | PWRCTX_EN); |
4613 | I915_READ(MCHBAR_RENDER_STANDBY) & ~RCX_SW_EXIT); | 4551 | I915_WRITE(MCHBAR_RENDER_STANDBY, |
4552 | I915_READ(MCHBAR_RENDER_STANDBY) & ~RCX_SW_EXIT); | ||
4553 | } | ||
4614 | } | 4554 | } |
4615 | |||
4616 | out: | ||
4617 | return; | ||
4618 | } | 4555 | } |
4619 | 4556 | ||
4620 | /* Set up chip specific display functions */ | 4557 | /* Set up chip specific display functions */ |
@@ -4770,7 +4707,6 @@ void intel_modeset_cleanup(struct drm_device *dev) | |||
4770 | del_timer_sync(&intel_crtc->idle_timer); | 4707 | del_timer_sync(&intel_crtc->idle_timer); |
4771 | } | 4708 | } |
4772 | 4709 | ||
4773 | intel_increase_renderclock(dev, false); | ||
4774 | del_timer_sync(&dev_priv->idle_timer); | 4710 | del_timer_sync(&dev_priv->idle_timer); |
4775 | 4711 | ||
4776 | if (dev_priv->display.disable_fbc) | 4712 | if (dev_priv->display.disable_fbc) |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 4e7aa8b7b938..1349d9fd01c4 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1402,14 +1402,20 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
1402 | break; | 1402 | break; |
1403 | case DP_B: | 1403 | case DP_B: |
1404 | case PCH_DP_B: | 1404 | case PCH_DP_B: |
1405 | dev_priv->hotplug_supported_mask |= | ||
1406 | HDMIB_HOTPLUG_INT_STATUS; | ||
1405 | name = "DPDDC-B"; | 1407 | name = "DPDDC-B"; |
1406 | break; | 1408 | break; |
1407 | case DP_C: | 1409 | case DP_C: |
1408 | case PCH_DP_C: | 1410 | case PCH_DP_C: |
1411 | dev_priv->hotplug_supported_mask |= | ||
1412 | HDMIC_HOTPLUG_INT_STATUS; | ||
1409 | name = "DPDDC-C"; | 1413 | name = "DPDDC-C"; |
1410 | break; | 1414 | break; |
1411 | case DP_D: | 1415 | case DP_D: |
1412 | case PCH_DP_D: | 1416 | case PCH_DP_D: |
1417 | dev_priv->hotplug_supported_mask |= | ||
1418 | HDMID_HOTPLUG_INT_STATUS; | ||
1413 | name = "DPDDC-D"; | 1419 | name = "DPDDC-D"; |
1414 | break; | 1420 | break; |
1415 | } | 1421 | } |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index f04dbbe7d400..06431941b233 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -303,21 +303,26 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | |||
303 | if (sdvox_reg == SDVOB) { | 303 | if (sdvox_reg == SDVOB) { |
304 | intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); | 304 | intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); |
305 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); | 305 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); |
306 | dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; | ||
306 | } else if (sdvox_reg == SDVOC) { | 307 | } else if (sdvox_reg == SDVOC) { |
307 | intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); | 308 | intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); |
308 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); | 309 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); |
310 | dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; | ||
309 | } else if (sdvox_reg == HDMIB) { | 311 | } else if (sdvox_reg == HDMIB) { |
310 | intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); | 312 | intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); |
311 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, | 313 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, |
312 | "HDMIB"); | 314 | "HDMIB"); |
315 | dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; | ||
313 | } else if (sdvox_reg == HDMIC) { | 316 | } else if (sdvox_reg == HDMIC) { |
314 | intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); | 317 | intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); |
315 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, | 318 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, |
316 | "HDMIC"); | 319 | "HDMIC"); |
320 | dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; | ||
317 | } else if (sdvox_reg == HDMID) { | 321 | } else if (sdvox_reg == HDMID) { |
318 | intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); | 322 | intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); |
319 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, | 323 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, |
320 | "HDMID"); | 324 | "HDMID"); |
325 | dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS; | ||
321 | } | 326 | } |
322 | if (!intel_output->ddc_bus) | 327 | if (!intel_output->ddc_bus) |
323 | goto err_connector; | 328 | goto err_connector; |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 3118ce274e67..f4b4aa242df1 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -608,6 +608,13 @@ static const struct dmi_system_id bad_lid_status[] = { | |||
608 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire one"), | 608 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire one"), |
609 | }, | 609 | }, |
610 | }, | 610 | }, |
611 | { | ||
612 | .ident = "PC-81005", | ||
613 | .matches = { | ||
614 | DMI_MATCH(DMI_SYS_VENDOR, "MALATA"), | ||
615 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-81005"), | ||
616 | }, | ||
617 | }, | ||
611 | { } | 618 | { } |
612 | }; | 619 | }; |
613 | 620 | ||
@@ -679,7 +686,14 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val, | |||
679 | struct drm_i915_private *dev_priv = | 686 | struct drm_i915_private *dev_priv = |
680 | container_of(nb, struct drm_i915_private, lid_notifier); | 687 | container_of(nb, struct drm_i915_private, lid_notifier); |
681 | struct drm_device *dev = dev_priv->dev; | 688 | struct drm_device *dev = dev_priv->dev; |
689 | struct drm_connector *connector = dev_priv->int_lvds_connector; | ||
682 | 690 | ||
691 | /* | ||
692 | * check and update the status of LVDS connector after receiving | ||
693 | * the LID nofication event. | ||
694 | */ | ||
695 | if (connector) | ||
696 | connector->status = connector->funcs->detect(connector); | ||
683 | if (!acpi_lid_open()) { | 697 | if (!acpi_lid_open()) { |
684 | dev_priv->modeset_on_lid = 1; | 698 | dev_priv->modeset_on_lid = 1; |
685 | return NOTIFY_OK; | 699 | return NOTIFY_OK; |
@@ -854,65 +868,6 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
854 | { } /* terminating entry */ | 868 | { } /* terminating entry */ |
855 | }; | 869 | }; |
856 | 870 | ||
857 | #ifdef CONFIG_ACPI | ||
858 | /* | ||
859 | * check_lid_device -- check whether @handle is an ACPI LID device. | ||
860 | * @handle: ACPI device handle | ||
861 | * @level : depth in the ACPI namespace tree | ||
862 | * @context: the number of LID device when we find the device | ||
863 | * @rv: a return value to fill if desired (Not use) | ||
864 | */ | ||
865 | static acpi_status | ||
866 | check_lid_device(acpi_handle handle, u32 level, void *context, | ||
867 | void **return_value) | ||
868 | { | ||
869 | struct acpi_device *acpi_dev; | ||
870 | int *lid_present = context; | ||
871 | |||
872 | acpi_dev = NULL; | ||
873 | /* Get the acpi device for device handle */ | ||
874 | if (acpi_bus_get_device(handle, &acpi_dev) || !acpi_dev) { | ||
875 | /* If there is no ACPI device for handle, return */ | ||
876 | return AE_OK; | ||
877 | } | ||
878 | |||
879 | if (!strncmp(acpi_device_hid(acpi_dev), "PNP0C0D", 7)) | ||
880 | *lid_present = 1; | ||
881 | |||
882 | return AE_OK; | ||
883 | } | ||
884 | |||
885 | /** | ||
886 | * check whether there exists the ACPI LID device by enumerating the ACPI | ||
887 | * device tree. | ||
888 | */ | ||
889 | static int intel_lid_present(void) | ||
890 | { | ||
891 | int lid_present = 0; | ||
892 | |||
893 | if (acpi_disabled) { | ||
894 | /* If ACPI is disabled, there is no ACPI device tree to | ||
895 | * check, so assume the LID device would have been present. | ||
896 | */ | ||
897 | return 1; | ||
898 | } | ||
899 | |||
900 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
901 | ACPI_UINT32_MAX, | ||
902 | check_lid_device, NULL, &lid_present, NULL); | ||
903 | |||
904 | return lid_present; | ||
905 | } | ||
906 | #else | ||
907 | static int intel_lid_present(void) | ||
908 | { | ||
909 | /* In the absence of ACPI built in, assume that the LID device would | ||
910 | * have been present. | ||
911 | */ | ||
912 | return 1; | ||
913 | } | ||
914 | #endif | ||
915 | |||
916 | /** | 871 | /** |
917 | * intel_find_lvds_downclock - find the reduced downclock for LVDS in EDID | 872 | * intel_find_lvds_downclock - find the reduced downclock for LVDS in EDID |
918 | * @dev: drm device | 873 | * @dev: drm device |
@@ -1031,12 +986,8 @@ void intel_lvds_init(struct drm_device *dev) | |||
1031 | if (dmi_check_system(intel_no_lvds)) | 986 | if (dmi_check_system(intel_no_lvds)) |
1032 | return; | 987 | return; |
1033 | 988 | ||
1034 | /* | 989 | if (!lvds_is_present_in_vbt(dev)) { |
1035 | * Assume LVDS is present if there's an ACPI lid device or if the | 990 | DRM_DEBUG_KMS("LVDS is not present in VBT\n"); |
1036 | * device is present in the VBT. | ||
1037 | */ | ||
1038 | if (!lvds_is_present_in_vbt(dev) && !intel_lid_present()) { | ||
1039 | DRM_DEBUG_KMS("LVDS is not present in VBT and no lid detected\n"); | ||
1040 | return; | 991 | return; |
1041 | } | 992 | } |
1042 | 993 | ||
@@ -1180,6 +1131,8 @@ out: | |||
1180 | DRM_DEBUG_KMS("lid notifier registration failed\n"); | 1131 | DRM_DEBUG_KMS("lid notifier registration failed\n"); |
1181 | dev_priv->lid_notifier.notifier_call = NULL; | 1132 | dev_priv->lid_notifier.notifier_call = NULL; |
1182 | } | 1133 | } |
1134 | /* keep the LVDS connector */ | ||
1135 | dev_priv->int_lvds_connector = connector; | ||
1183 | drm_sysfs_connector_add(connector); | 1136 | drm_sysfs_connector_add(connector); |
1184 | return; | 1137 | return; |
1185 | 1138 | ||
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 24a3dc99716c..de5144c8c153 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -2662,6 +2662,7 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector) | |||
2662 | 2662 | ||
2663 | bool intel_sdvo_init(struct drm_device *dev, int output_device) | 2663 | bool intel_sdvo_init(struct drm_device *dev, int output_device) |
2664 | { | 2664 | { |
2665 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2665 | struct drm_connector *connector; | 2666 | struct drm_connector *connector; |
2666 | struct intel_output *intel_output; | 2667 | struct intel_output *intel_output; |
2667 | struct intel_sdvo_priv *sdvo_priv; | 2668 | struct intel_sdvo_priv *sdvo_priv; |
@@ -2708,10 +2709,12 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
2708 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS"); | 2709 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS"); |
2709 | sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, | 2710 | sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, |
2710 | "SDVOB/VGA DDC BUS"); | 2711 | "SDVOB/VGA DDC BUS"); |
2712 | dev_priv->hotplug_supported_mask |= SDVOB_HOTPLUG_INT_STATUS; | ||
2711 | } else { | 2713 | } else { |
2712 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS"); | 2714 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS"); |
2713 | sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, | 2715 | sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, |
2714 | "SDVOC/VGA DDC BUS"); | 2716 | "SDVOC/VGA DDC BUS"); |
2717 | dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS; | ||
2715 | } | 2718 | } |
2716 | 2719 | ||
2717 | if (intel_output->ddc_bus == NULL) | 2720 | if (intel_output->ddc_bus == NULL) |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 552ec110b741..1d5b9b7b033f 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -1840,6 +1840,8 @@ intel_tv_init(struct drm_device *dev) | |||
1840 | drm_connector_attach_property(connector, | 1840 | drm_connector_attach_property(connector, |
1841 | dev->mode_config.tv_bottom_margin_property, | 1841 | dev->mode_config.tv_bottom_margin_property, |
1842 | tv_priv->margin[TV_MARGIN_BOTTOM]); | 1842 | tv_priv->margin[TV_MARGIN_BOTTOM]); |
1843 | |||
1844 | dev_priv->hotplug_supported_mask |= TV_HOTPLUG_INT_STATUS; | ||
1843 | out: | 1845 | out: |
1844 | drm_sysfs_connector_add(connector); | 1846 | drm_sysfs_connector_add(connector); |
1845 | } | 1847 | } |
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig index b1bc1ea182b8..1175429da102 100644 --- a/drivers/gpu/drm/nouveau/Kconfig +++ b/drivers/gpu/drm/nouveau/Kconfig | |||
@@ -30,12 +30,11 @@ config DRM_NOUVEAU_DEBUG | |||
30 | via debugfs. | 30 | via debugfs. |
31 | 31 | ||
32 | menu "I2C encoder or helper chips" | 32 | menu "I2C encoder or helper chips" |
33 | depends on DRM && I2C | 33 | depends on DRM && DRM_KMS_HELPER && I2C |
34 | 34 | ||
35 | config DRM_I2C_CH7006 | 35 | config DRM_I2C_CH7006 |
36 | tristate "Chrontel ch7006 TV encoder" | 36 | tristate "Chrontel ch7006 TV encoder" |
37 | depends on DRM_NOUVEAU | 37 | default m if DRM_NOUVEAU |
38 | default m | ||
39 | help | 38 | help |
40 | Support for Chrontel ch7006 and similar TV encoders, found | 39 | Support for Chrontel ch7006 and similar TV encoders, found |
41 | on some nVidia video cards. | 40 | on some nVidia video cards. |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 0cad6d834eb2..e342a418d434 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -33,10 +33,13 @@ | |||
33 | #include "nouveau_drv.h" | 33 | #include "nouveau_drv.h" |
34 | #include "nouveau_dma.h" | 34 | #include "nouveau_dma.h" |
35 | 35 | ||
36 | #include <linux/log2.h> | ||
37 | |||
36 | static void | 38 | static void |
37 | nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | 39 | nouveau_bo_del_ttm(struct ttm_buffer_object *bo) |
38 | { | 40 | { |
39 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | 41 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); |
42 | struct drm_device *dev = dev_priv->dev; | ||
40 | struct nouveau_bo *nvbo = nouveau_bo(bo); | 43 | struct nouveau_bo *nvbo = nouveau_bo(bo); |
41 | 44 | ||
42 | ttm_bo_kunmap(&nvbo->kmap); | 45 | ttm_bo_kunmap(&nvbo->kmap); |
@@ -44,12 +47,87 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | |||
44 | if (unlikely(nvbo->gem)) | 47 | if (unlikely(nvbo->gem)) |
45 | DRM_ERROR("bo %p still attached to GEM object\n", bo); | 48 | DRM_ERROR("bo %p still attached to GEM object\n", bo); |
46 | 49 | ||
50 | if (nvbo->tile) | ||
51 | nv10_mem_expire_tiling(dev, nvbo->tile, NULL); | ||
52 | |||
47 | spin_lock(&dev_priv->ttm.bo_list_lock); | 53 | spin_lock(&dev_priv->ttm.bo_list_lock); |
48 | list_del(&nvbo->head); | 54 | list_del(&nvbo->head); |
49 | spin_unlock(&dev_priv->ttm.bo_list_lock); | 55 | spin_unlock(&dev_priv->ttm.bo_list_lock); |
50 | kfree(nvbo); | 56 | kfree(nvbo); |
51 | } | 57 | } |
52 | 58 | ||
59 | static void | ||
60 | nouveau_bo_fixup_align(struct drm_device *dev, | ||
61 | uint32_t tile_mode, uint32_t tile_flags, | ||
62 | int *align, int *size) | ||
63 | { | ||
64 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
65 | |||
66 | /* | ||
67 | * Some of the tile_flags have a periodic structure of N*4096 bytes, | ||
68 | * align to to that as well as the page size. Overallocate memory to | ||
69 | * avoid corruption of other buffer objects. | ||
70 | */ | ||
71 | if (dev_priv->card_type == NV_50) { | ||
72 | uint32_t block_size = nouveau_mem_fb_amount(dev) >> 15; | ||
73 | int i; | ||
74 | |||
75 | switch (tile_flags) { | ||
76 | case 0x1800: | ||
77 | case 0x2800: | ||
78 | case 0x4800: | ||
79 | case 0x7a00: | ||
80 | *size = roundup(*size, block_size); | ||
81 | if (is_power_of_2(block_size)) { | ||
82 | *size += 3 * block_size; | ||
83 | for (i = 1; i < 10; i++) { | ||
84 | *align = 12 * i * block_size; | ||
85 | if (!(*align % 65536)) | ||
86 | break; | ||
87 | } | ||
88 | } else { | ||
89 | *size += 6 * block_size; | ||
90 | for (i = 1; i < 10; i++) { | ||
91 | *align = 8 * i * block_size; | ||
92 | if (!(*align % 65536)) | ||
93 | break; | ||
94 | } | ||
95 | } | ||
96 | break; | ||
97 | default: | ||
98 | break; | ||
99 | } | ||
100 | |||
101 | } else { | ||
102 | if (tile_mode) { | ||
103 | if (dev_priv->chipset >= 0x40) { | ||
104 | *align = 65536; | ||
105 | *size = roundup(*size, 64 * tile_mode); | ||
106 | |||
107 | } else if (dev_priv->chipset >= 0x30) { | ||
108 | *align = 32768; | ||
109 | *size = roundup(*size, 64 * tile_mode); | ||
110 | |||
111 | } else if (dev_priv->chipset >= 0x20) { | ||
112 | *align = 16384; | ||
113 | *size = roundup(*size, 64 * tile_mode); | ||
114 | |||
115 | } else if (dev_priv->chipset >= 0x10) { | ||
116 | *align = 16384; | ||
117 | *size = roundup(*size, 32 * tile_mode); | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
122 | /* ALIGN works only on powers of two. */ | ||
123 | *size = roundup(*size, PAGE_SIZE); | ||
124 | |||
125 | if (dev_priv->card_type == NV_50) { | ||
126 | *size = roundup(*size, 65536); | ||
127 | *align = max(65536, *align); | ||
128 | } | ||
129 | } | ||
130 | |||
53 | int | 131 | int |
54 | nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | 132 | nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, |
55 | int size, int align, uint32_t flags, uint32_t tile_mode, | 133 | int size, int align, uint32_t flags, uint32_t tile_mode, |
@@ -58,7 +136,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
58 | { | 136 | { |
59 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 137 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
60 | struct nouveau_bo *nvbo; | 138 | struct nouveau_bo *nvbo; |
61 | int ret, n = 0; | 139 | int ret = 0; |
62 | 140 | ||
63 | nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL); | 141 | nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL); |
64 | if (!nvbo) | 142 | if (!nvbo) |
@@ -70,59 +148,14 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
70 | nvbo->tile_mode = tile_mode; | 148 | nvbo->tile_mode = tile_mode; |
71 | nvbo->tile_flags = tile_flags; | 149 | nvbo->tile_flags = tile_flags; |
72 | 150 | ||
73 | /* | 151 | nouveau_bo_fixup_align(dev, tile_mode, tile_flags, &align, &size); |
74 | * Some of the tile_flags have a periodic structure of N*4096 bytes, | ||
75 | * align to to that as well as the page size. Overallocate memory to | ||
76 | * avoid corruption of other buffer objects. | ||
77 | */ | ||
78 | switch (tile_flags) { | ||
79 | case 0x1800: | ||
80 | case 0x2800: | ||
81 | case 0x4800: | ||
82 | case 0x7a00: | ||
83 | if (dev_priv->chipset >= 0xA0) { | ||
84 | /* This is based on high end cards with 448 bits | ||
85 | * memory bus, could be different elsewhere.*/ | ||
86 | size += 6 * 28672; | ||
87 | /* 8 * 28672 is the actual alignment requirement, | ||
88 | * but we must also align to page size. */ | ||
89 | align = 2 * 8 * 28672; | ||
90 | } else if (dev_priv->chipset >= 0x90) { | ||
91 | size += 3 * 16384; | ||
92 | align = 12 * 16834; | ||
93 | } else { | ||
94 | size += 3 * 8192; | ||
95 | /* 12 * 8192 is the actual alignment requirement, | ||
96 | * but we must also align to page size. */ | ||
97 | align = 2 * 12 * 8192; | ||
98 | } | ||
99 | break; | ||
100 | default: | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | align >>= PAGE_SHIFT; | 152 | align >>= PAGE_SHIFT; |
105 | 153 | ||
106 | size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); | ||
107 | if (dev_priv->card_type == NV_50) { | ||
108 | size = (size + 65535) & ~65535; | ||
109 | if (align < (65536 / PAGE_SIZE)) | ||
110 | align = (65536 / PAGE_SIZE); | ||
111 | } | ||
112 | |||
113 | if (flags & TTM_PL_FLAG_VRAM) | ||
114 | nvbo->placements[n++] = TTM_PL_FLAG_VRAM | TTM_PL_MASK_CACHING; | ||
115 | if (flags & TTM_PL_FLAG_TT) | ||
116 | nvbo->placements[n++] = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING; | ||
117 | nvbo->placement.fpfn = 0; | 154 | nvbo->placement.fpfn = 0; |
118 | nvbo->placement.lpfn = mappable ? dev_priv->fb_mappable_pages : 0; | 155 | nvbo->placement.lpfn = mappable ? dev_priv->fb_mappable_pages : 0; |
119 | nvbo->placement.placement = nvbo->placements; | 156 | nouveau_bo_placement_set(nvbo, flags); |
120 | nvbo->placement.busy_placement = nvbo->placements; | ||
121 | nvbo->placement.num_placement = n; | ||
122 | nvbo->placement.num_busy_placement = n; | ||
123 | 157 | ||
124 | nvbo->channel = chan; | 158 | nvbo->channel = chan; |
125 | nouveau_bo_placement_set(nvbo, flags); | ||
126 | ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, | 159 | ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, |
127 | ttm_bo_type_device, &nvbo->placement, align, 0, | 160 | ttm_bo_type_device, &nvbo->placement, align, 0, |
128 | false, NULL, size, nouveau_bo_del_ttm); | 161 | false, NULL, size, nouveau_bo_del_ttm); |
@@ -421,6 +454,7 @@ nouveau_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl) | |||
421 | /* GPU-assisted copy using NV_MEMORY_TO_MEMORY_FORMAT, can access | 454 | /* GPU-assisted copy using NV_MEMORY_TO_MEMORY_FORMAT, can access |
422 | * TTM_PL_{VRAM,TT} directly. | 455 | * TTM_PL_{VRAM,TT} directly. |
423 | */ | 456 | */ |
457 | |||
424 | static int | 458 | static int |
425 | nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan, | 459 | nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan, |
426 | struct nouveau_bo *nvbo, bool evict, bool no_wait, | 460 | struct nouveau_bo *nvbo, bool evict, bool no_wait, |
@@ -455,11 +489,12 @@ nouveau_bo_mem_ctxdma(struct nouveau_bo *nvbo, struct nouveau_channel *chan, | |||
455 | } | 489 | } |
456 | 490 | ||
457 | static int | 491 | static int |
458 | nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, int no_wait, | 492 | nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, |
459 | struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem) | 493 | int no_wait, struct ttm_mem_reg *new_mem) |
460 | { | 494 | { |
461 | struct nouveau_bo *nvbo = nouveau_bo(bo); | 495 | struct nouveau_bo *nvbo = nouveau_bo(bo); |
462 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | 496 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); |
497 | struct ttm_mem_reg *old_mem = &bo->mem; | ||
463 | struct nouveau_channel *chan; | 498 | struct nouveau_channel *chan; |
464 | uint64_t src_offset, dst_offset; | 499 | uint64_t src_offset, dst_offset; |
465 | uint32_t page_count; | 500 | uint32_t page_count; |
@@ -547,7 +582,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
547 | 582 | ||
548 | placement.fpfn = placement.lpfn = 0; | 583 | placement.fpfn = placement.lpfn = 0; |
549 | placement.num_placement = placement.num_busy_placement = 1; | 584 | placement.num_placement = placement.num_busy_placement = 1; |
550 | placement.placement = &placement_memtype; | 585 | placement.placement = placement.busy_placement = &placement_memtype; |
551 | 586 | ||
552 | tmp_mem = *new_mem; | 587 | tmp_mem = *new_mem; |
553 | tmp_mem.mm_node = NULL; | 588 | tmp_mem.mm_node = NULL; |
@@ -559,7 +594,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
559 | if (ret) | 594 | if (ret) |
560 | goto out; | 595 | goto out; |
561 | 596 | ||
562 | ret = nouveau_bo_move_m2mf(bo, true, no_wait, &bo->mem, &tmp_mem); | 597 | ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait, &tmp_mem); |
563 | if (ret) | 598 | if (ret) |
564 | goto out; | 599 | goto out; |
565 | 600 | ||
@@ -585,7 +620,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
585 | 620 | ||
586 | placement.fpfn = placement.lpfn = 0; | 621 | placement.fpfn = placement.lpfn = 0; |
587 | placement.num_placement = placement.num_busy_placement = 1; | 622 | placement.num_placement = placement.num_busy_placement = 1; |
588 | placement.placement = &placement_memtype; | 623 | placement.placement = placement.busy_placement = &placement_memtype; |
589 | 624 | ||
590 | tmp_mem = *new_mem; | 625 | tmp_mem = *new_mem; |
591 | tmp_mem.mm_node = NULL; | 626 | tmp_mem.mm_node = NULL; |
@@ -597,7 +632,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
597 | if (ret) | 632 | if (ret) |
598 | goto out; | 633 | goto out; |
599 | 634 | ||
600 | ret = nouveau_bo_move_m2mf(bo, true, no_wait, &bo->mem, new_mem); | 635 | ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait, new_mem); |
601 | if (ret) | 636 | if (ret) |
602 | goto out; | 637 | goto out; |
603 | 638 | ||
@@ -612,52 +647,106 @@ out: | |||
612 | } | 647 | } |
613 | 648 | ||
614 | static int | 649 | static int |
615 | nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr, | 650 | nouveau_bo_vm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem, |
616 | bool no_wait, struct ttm_mem_reg *new_mem) | 651 | struct nouveau_tile_reg **new_tile) |
617 | { | 652 | { |
618 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | 653 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); |
619 | struct nouveau_bo *nvbo = nouveau_bo(bo); | ||
620 | struct drm_device *dev = dev_priv->dev; | 654 | struct drm_device *dev = dev_priv->dev; |
621 | struct ttm_mem_reg *old_mem = &bo->mem; | 655 | struct nouveau_bo *nvbo = nouveau_bo(bo); |
656 | uint64_t offset; | ||
622 | int ret; | 657 | int ret; |
623 | 658 | ||
624 | if (dev_priv->card_type == NV_50 && new_mem->mem_type == TTM_PL_VRAM && | 659 | if (nvbo->no_vm || new_mem->mem_type != TTM_PL_VRAM) { |
625 | !nvbo->no_vm) { | 660 | /* Nothing to do. */ |
626 | uint64_t offset = new_mem->mm_node->start << PAGE_SHIFT; | 661 | *new_tile = NULL; |
662 | return 0; | ||
663 | } | ||
664 | |||
665 | offset = new_mem->mm_node->start << PAGE_SHIFT; | ||
627 | 666 | ||
667 | if (dev_priv->card_type == NV_50) { | ||
628 | ret = nv50_mem_vm_bind_linear(dev, | 668 | ret = nv50_mem_vm_bind_linear(dev, |
629 | offset + dev_priv->vm_vram_base, | 669 | offset + dev_priv->vm_vram_base, |
630 | new_mem->size, nvbo->tile_flags, | 670 | new_mem->size, nvbo->tile_flags, |
631 | offset); | 671 | offset); |
632 | if (ret) | 672 | if (ret) |
633 | return ret; | 673 | return ret; |
674 | |||
675 | } else if (dev_priv->card_type >= NV_10) { | ||
676 | *new_tile = nv10_mem_set_tiling(dev, offset, new_mem->size, | ||
677 | nvbo->tile_mode); | ||
634 | } | 678 | } |
635 | 679 | ||
680 | return 0; | ||
681 | } | ||
682 | |||
683 | static void | ||
684 | nouveau_bo_vm_cleanup(struct ttm_buffer_object *bo, | ||
685 | struct nouveau_tile_reg *new_tile, | ||
686 | struct nouveau_tile_reg **old_tile) | ||
687 | { | ||
688 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | ||
689 | struct drm_device *dev = dev_priv->dev; | ||
690 | |||
691 | if (dev_priv->card_type >= NV_10 && | ||
692 | dev_priv->card_type < NV_50) { | ||
693 | if (*old_tile) | ||
694 | nv10_mem_expire_tiling(dev, *old_tile, bo->sync_obj); | ||
695 | |||
696 | *old_tile = new_tile; | ||
697 | } | ||
698 | } | ||
699 | |||
700 | static int | ||
701 | nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr, | ||
702 | bool no_wait, struct ttm_mem_reg *new_mem) | ||
703 | { | ||
704 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | ||
705 | struct nouveau_bo *nvbo = nouveau_bo(bo); | ||
706 | struct ttm_mem_reg *old_mem = &bo->mem; | ||
707 | struct nouveau_tile_reg *new_tile = NULL; | ||
708 | int ret = 0; | ||
709 | |||
710 | ret = nouveau_bo_vm_bind(bo, new_mem, &new_tile); | ||
711 | if (ret) | ||
712 | return ret; | ||
713 | |||
714 | /* Software copy if the card isn't up and running yet. */ | ||
636 | if (dev_priv->init_state != NOUVEAU_CARD_INIT_DONE || | 715 | if (dev_priv->init_state != NOUVEAU_CARD_INIT_DONE || |
637 | !dev_priv->channel) | 716 | !dev_priv->channel) { |
638 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | 717 | ret = ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); |
718 | goto out; | ||
719 | } | ||
639 | 720 | ||
721 | /* Fake bo copy. */ | ||
640 | if (old_mem->mem_type == TTM_PL_SYSTEM && !bo->ttm) { | 722 | if (old_mem->mem_type == TTM_PL_SYSTEM && !bo->ttm) { |
641 | BUG_ON(bo->mem.mm_node != NULL); | 723 | BUG_ON(bo->mem.mm_node != NULL); |
642 | bo->mem = *new_mem; | 724 | bo->mem = *new_mem; |
643 | new_mem->mm_node = NULL; | 725 | new_mem->mm_node = NULL; |
644 | return 0; | 726 | goto out; |
645 | } | 727 | } |
646 | 728 | ||
647 | if (new_mem->mem_type == TTM_PL_SYSTEM) { | 729 | /* Hardware assisted copy. */ |
648 | if (old_mem->mem_type == TTM_PL_SYSTEM) | 730 | if (new_mem->mem_type == TTM_PL_SYSTEM) |
649 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | 731 | ret = nouveau_bo_move_flipd(bo, evict, intr, no_wait, new_mem); |
650 | if (nouveau_bo_move_flipd(bo, evict, intr, no_wait, new_mem)) | 732 | else if (old_mem->mem_type == TTM_PL_SYSTEM) |
651 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | 733 | ret = nouveau_bo_move_flips(bo, evict, intr, no_wait, new_mem); |
652 | } else if (old_mem->mem_type == TTM_PL_SYSTEM) { | 734 | else |
653 | if (nouveau_bo_move_flips(bo, evict, intr, no_wait, new_mem)) | 735 | ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait, new_mem); |
654 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | ||
655 | } else { | ||
656 | if (nouveau_bo_move_m2mf(bo, evict, no_wait, old_mem, new_mem)) | ||
657 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | ||
658 | } | ||
659 | 736 | ||
660 | return 0; | 737 | if (!ret) |
738 | goto out; | ||
739 | |||
740 | /* Fallback to software copy. */ | ||
741 | ret = ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | ||
742 | |||
743 | out: | ||
744 | if (ret) | ||
745 | nouveau_bo_vm_cleanup(bo, NULL, &new_tile); | ||
746 | else | ||
747 | nouveau_bo_vm_cleanup(bo, new_tile, &nvbo->tile); | ||
748 | |||
749 | return ret; | ||
661 | } | 750 | } |
662 | 751 | ||
663 | static int | 752 | static int |
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index 9aaa972f8822..343d718a9667 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -158,6 +158,8 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, | |||
158 | return ret; | 158 | return ret; |
159 | } | 159 | } |
160 | 160 | ||
161 | nouveau_dma_pre_init(chan); | ||
162 | |||
161 | /* Locate channel's user control regs */ | 163 | /* Locate channel's user control regs */ |
162 | if (dev_priv->card_type < NV_40) | 164 | if (dev_priv->card_type < NV_40) |
163 | user = NV03_USER(channel); | 165 | user = NV03_USER(channel); |
@@ -235,47 +237,6 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, | |||
235 | return 0; | 237 | return 0; |
236 | } | 238 | } |
237 | 239 | ||
238 | int | ||
239 | nouveau_channel_idle(struct nouveau_channel *chan) | ||
240 | { | ||
241 | struct drm_device *dev = chan->dev; | ||
242 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
243 | struct nouveau_engine *engine = &dev_priv->engine; | ||
244 | uint32_t caches; | ||
245 | int idle; | ||
246 | |||
247 | if (!chan) { | ||
248 | NV_ERROR(dev, "no channel...\n"); | ||
249 | return 1; | ||
250 | } | ||
251 | |||
252 | caches = nv_rd32(dev, NV03_PFIFO_CACHES); | ||
253 | nv_wr32(dev, NV03_PFIFO_CACHES, caches & ~1); | ||
254 | |||
255 | if (engine->fifo.channel_id(dev) != chan->id) { | ||
256 | struct nouveau_gpuobj *ramfc = | ||
257 | chan->ramfc ? chan->ramfc->gpuobj : NULL; | ||
258 | |||
259 | if (!ramfc) { | ||
260 | NV_ERROR(dev, "No RAMFC for channel %d\n", chan->id); | ||
261 | return 1; | ||
262 | } | ||
263 | |||
264 | engine->instmem.prepare_access(dev, false); | ||
265 | if (nv_ro32(dev, ramfc, 0) != nv_ro32(dev, ramfc, 1)) | ||
266 | idle = 0; | ||
267 | else | ||
268 | idle = 1; | ||
269 | engine->instmem.finish_access(dev); | ||
270 | } else { | ||
271 | idle = (nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_GET) == | ||
272 | nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_PUT)); | ||
273 | } | ||
274 | |||
275 | nv_wr32(dev, NV03_PFIFO_CACHES, caches); | ||
276 | return idle; | ||
277 | } | ||
278 | |||
279 | /* stops a fifo */ | 240 | /* stops a fifo */ |
280 | void | 241 | void |
281 | nouveau_channel_free(struct nouveau_channel *chan) | 242 | nouveau_channel_free(struct nouveau_channel *chan) |
@@ -414,7 +375,9 @@ nouveau_ioctl_fifo_alloc(struct drm_device *dev, void *data, | |||
414 | init->subchan[0].grclass = 0x0039; | 375 | init->subchan[0].grclass = 0x0039; |
415 | else | 376 | else |
416 | init->subchan[0].grclass = 0x5039; | 377 | init->subchan[0].grclass = 0x5039; |
417 | init->nr_subchan = 1; | 378 | init->subchan[1].handle = NvSw; |
379 | init->subchan[1].grclass = NV_SW; | ||
380 | init->nr_subchan = 2; | ||
418 | 381 | ||
419 | /* Named memory object area */ | 382 | /* Named memory object area */ |
420 | ret = drm_gem_handle_create(file_priv, chan->notifier_bo->gem, | 383 | ret = drm_gem_handle_create(file_priv, chan->notifier_bo->gem, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index 703553687b20..7afbe8b40d51 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c | |||
@@ -29,12 +29,22 @@ | |||
29 | #include "nouveau_drv.h" | 29 | #include "nouveau_drv.h" |
30 | #include "nouveau_dma.h" | 30 | #include "nouveau_dma.h" |
31 | 31 | ||
32 | void | ||
33 | nouveau_dma_pre_init(struct nouveau_channel *chan) | ||
34 | { | ||
35 | chan->dma.max = (chan->pushbuf_bo->bo.mem.size >> 2) - 2; | ||
36 | chan->dma.put = 0; | ||
37 | chan->dma.cur = chan->dma.put; | ||
38 | chan->dma.free = chan->dma.max - chan->dma.cur; | ||
39 | } | ||
40 | |||
32 | int | 41 | int |
33 | nouveau_dma_init(struct nouveau_channel *chan) | 42 | nouveau_dma_init(struct nouveau_channel *chan) |
34 | { | 43 | { |
35 | struct drm_device *dev = chan->dev; | 44 | struct drm_device *dev = chan->dev; |
36 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 45 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
37 | struct nouveau_gpuobj *m2mf = NULL; | 46 | struct nouveau_gpuobj *m2mf = NULL; |
47 | struct nouveau_gpuobj *nvsw = NULL; | ||
38 | int ret, i; | 48 | int ret, i; |
39 | 49 | ||
40 | /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */ | 50 | /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */ |
@@ -47,6 +57,15 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
47 | if (ret) | 57 | if (ret) |
48 | return ret; | 58 | return ret; |
49 | 59 | ||
60 | /* Create an NV_SW object for various sync purposes */ | ||
61 | ret = nouveau_gpuobj_sw_new(chan, NV_SW, &nvsw); | ||
62 | if (ret) | ||
63 | return ret; | ||
64 | |||
65 | ret = nouveau_gpuobj_ref_add(dev, chan, NvSw, nvsw, NULL); | ||
66 | if (ret) | ||
67 | return ret; | ||
68 | |||
50 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ | 69 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ |
51 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, &chan->m2mf_ntfy); | 70 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, &chan->m2mf_ntfy); |
52 | if (ret) | 71 | if (ret) |
@@ -64,12 +83,6 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
64 | return ret; | 83 | return ret; |
65 | } | 84 | } |
66 | 85 | ||
67 | /* Initialise DMA vars */ | ||
68 | chan->dma.max = (chan->pushbuf_bo->bo.mem.size >> 2) - 2; | ||
69 | chan->dma.put = 0; | ||
70 | chan->dma.cur = chan->dma.put; | ||
71 | chan->dma.free = chan->dma.max - chan->dma.cur; | ||
72 | |||
73 | /* Insert NOPS for NOUVEAU_DMA_SKIPS */ | 86 | /* Insert NOPS for NOUVEAU_DMA_SKIPS */ |
74 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); | 87 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); |
75 | if (ret) | 88 | if (ret) |
@@ -87,6 +100,13 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
87 | BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1); | 100 | BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1); |
88 | OUT_RING(chan, NvNotify0); | 101 | OUT_RING(chan, NvNotify0); |
89 | 102 | ||
103 | /* Initialise NV_SW */ | ||
104 | ret = RING_SPACE(chan, 2); | ||
105 | if (ret) | ||
106 | return ret; | ||
107 | BEGIN_RING(chan, NvSubSw, 0, 1); | ||
108 | OUT_RING(chan, NvSw); | ||
109 | |||
90 | /* Sit back and pray the channel works.. */ | 110 | /* Sit back and pray the channel works.. */ |
91 | FIRE_RING(chan); | 111 | FIRE_RING(chan); |
92 | 112 | ||
@@ -113,7 +133,7 @@ READ_GET(struct nouveau_channel *chan, uint32_t *get) | |||
113 | 133 | ||
114 | val = nvchan_rd32(chan, chan->user_get); | 134 | val = nvchan_rd32(chan, chan->user_get); |
115 | if (val < chan->pushbuf_base || | 135 | if (val < chan->pushbuf_base || |
116 | val >= chan->pushbuf_base + chan->pushbuf_bo->bo.mem.size) { | 136 | val > chan->pushbuf_base + (chan->dma.max << 2)) { |
117 | /* meaningless to dma_wait() except to know whether the | 137 | /* meaningless to dma_wait() except to know whether the |
118 | * GPU has stalled or not | 138 | * GPU has stalled or not |
119 | */ | 139 | */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h index 04e85d8f757e..dabfd655f93e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.h +++ b/drivers/gpu/drm/nouveau/nouveau_dma.h | |||
@@ -46,10 +46,11 @@ | |||
46 | /* Hardcoded object assignments to subchannels (subchannel id). */ | 46 | /* Hardcoded object assignments to subchannels (subchannel id). */ |
47 | enum { | 47 | enum { |
48 | NvSubM2MF = 0, | 48 | NvSubM2MF = 0, |
49 | NvSub2D = 1, | 49 | NvSubSw = 1, |
50 | NvSubCtxSurf2D = 1, | 50 | NvSub2D = 2, |
51 | NvSubGdiRect = 2, | 51 | NvSubCtxSurf2D = 2, |
52 | NvSubImageBlit = 3 | 52 | NvSubGdiRect = 3, |
53 | NvSubImageBlit = 4 | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | /* Object handles. */ | 56 | /* Object handles. */ |
@@ -67,6 +68,7 @@ enum { | |||
67 | NvClipRect = 0x8000000b, | 68 | NvClipRect = 0x8000000b, |
68 | NvGdiRect = 0x8000000c, | 69 | NvGdiRect = 0x8000000c, |
69 | NvImageBlit = 0x8000000d, | 70 | NvImageBlit = 0x8000000d, |
71 | NvSw = 0x8000000e, | ||
70 | 72 | ||
71 | /* G80+ display objects */ | 73 | /* G80+ display objects */ |
72 | NvEvoVRAM = 0x01000000, | 74 | NvEvoVRAM = 0x01000000, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 5f8cbb79c499..026419fe8791 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -59,11 +59,19 @@ struct nouveau_grctx; | |||
59 | #define MAX_NUM_DCB_ENTRIES 16 | 59 | #define MAX_NUM_DCB_ENTRIES 16 |
60 | 60 | ||
61 | #define NOUVEAU_MAX_CHANNEL_NR 128 | 61 | #define NOUVEAU_MAX_CHANNEL_NR 128 |
62 | #define NOUVEAU_MAX_TILE_NR 15 | ||
62 | 63 | ||
63 | #define NV50_VM_MAX_VRAM (2*1024*1024*1024ULL) | 64 | #define NV50_VM_MAX_VRAM (2*1024*1024*1024ULL) |
64 | #define NV50_VM_BLOCK (512*1024*1024ULL) | 65 | #define NV50_VM_BLOCK (512*1024*1024ULL) |
65 | #define NV50_VM_VRAM_NR (NV50_VM_MAX_VRAM / NV50_VM_BLOCK) | 66 | #define NV50_VM_VRAM_NR (NV50_VM_MAX_VRAM / NV50_VM_BLOCK) |
66 | 67 | ||
68 | struct nouveau_tile_reg { | ||
69 | struct nouveau_fence *fence; | ||
70 | uint32_t addr; | ||
71 | uint32_t size; | ||
72 | bool used; | ||
73 | }; | ||
74 | |||
67 | struct nouveau_bo { | 75 | struct nouveau_bo { |
68 | struct ttm_buffer_object bo; | 76 | struct ttm_buffer_object bo; |
69 | struct ttm_placement placement; | 77 | struct ttm_placement placement; |
@@ -83,6 +91,7 @@ struct nouveau_bo { | |||
83 | 91 | ||
84 | uint32_t tile_mode; | 92 | uint32_t tile_mode; |
85 | uint32_t tile_flags; | 93 | uint32_t tile_flags; |
94 | struct nouveau_tile_reg *tile; | ||
86 | 95 | ||
87 | struct drm_gem_object *gem; | 96 | struct drm_gem_object *gem; |
88 | struct drm_file *cpu_filp; | 97 | struct drm_file *cpu_filp; |
@@ -277,8 +286,13 @@ struct nouveau_timer_engine { | |||
277 | }; | 286 | }; |
278 | 287 | ||
279 | struct nouveau_fb_engine { | 288 | struct nouveau_fb_engine { |
289 | int num_tiles; | ||
290 | |||
280 | int (*init)(struct drm_device *dev); | 291 | int (*init)(struct drm_device *dev); |
281 | void (*takedown)(struct drm_device *dev); | 292 | void (*takedown)(struct drm_device *dev); |
293 | |||
294 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, | ||
295 | uint32_t size, uint32_t pitch); | ||
282 | }; | 296 | }; |
283 | 297 | ||
284 | struct nouveau_fifo_engine { | 298 | struct nouveau_fifo_engine { |
@@ -292,6 +306,8 @@ struct nouveau_fifo_engine { | |||
292 | void (*disable)(struct drm_device *); | 306 | void (*disable)(struct drm_device *); |
293 | void (*enable)(struct drm_device *); | 307 | void (*enable)(struct drm_device *); |
294 | bool (*reassign)(struct drm_device *, bool enable); | 308 | bool (*reassign)(struct drm_device *, bool enable); |
309 | bool (*cache_flush)(struct drm_device *dev); | ||
310 | bool (*cache_pull)(struct drm_device *dev, bool enable); | ||
295 | 311 | ||
296 | int (*channel_id)(struct drm_device *); | 312 | int (*channel_id)(struct drm_device *); |
297 | 313 | ||
@@ -330,6 +346,9 @@ struct nouveau_pgraph_engine { | |||
330 | void (*destroy_context)(struct nouveau_channel *); | 346 | void (*destroy_context)(struct nouveau_channel *); |
331 | int (*load_context)(struct nouveau_channel *); | 347 | int (*load_context)(struct nouveau_channel *); |
332 | int (*unload_context)(struct drm_device *); | 348 | int (*unload_context)(struct drm_device *); |
349 | |||
350 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, | ||
351 | uint32_t size, uint32_t pitch); | ||
333 | }; | 352 | }; |
334 | 353 | ||
335 | struct nouveau_engine { | 354 | struct nouveau_engine { |
@@ -548,6 +567,12 @@ struct drm_nouveau_private { | |||
548 | unsigned long sg_handle; | 567 | unsigned long sg_handle; |
549 | } gart_info; | 568 | } gart_info; |
550 | 569 | ||
570 | /* nv10-nv40 tiling regions */ | ||
571 | struct { | ||
572 | struct nouveau_tile_reg reg[NOUVEAU_MAX_TILE_NR]; | ||
573 | spinlock_t lock; | ||
574 | } tile; | ||
575 | |||
551 | /* G8x/G9x virtual address space */ | 576 | /* G8x/G9x virtual address space */ |
552 | uint64_t vm_gart_base; | 577 | uint64_t vm_gart_base; |
553 | uint64_t vm_gart_size; | 578 | uint64_t vm_gart_size; |
@@ -685,6 +710,13 @@ extern void nouveau_mem_release(struct drm_file *, struct mem_block *heap); | |||
685 | extern int nouveau_mem_init(struct drm_device *); | 710 | extern int nouveau_mem_init(struct drm_device *); |
686 | extern int nouveau_mem_init_agp(struct drm_device *); | 711 | extern int nouveau_mem_init_agp(struct drm_device *); |
687 | extern void nouveau_mem_close(struct drm_device *); | 712 | extern void nouveau_mem_close(struct drm_device *); |
713 | extern struct nouveau_tile_reg *nv10_mem_set_tiling(struct drm_device *dev, | ||
714 | uint32_t addr, | ||
715 | uint32_t size, | ||
716 | uint32_t pitch); | ||
717 | extern void nv10_mem_expire_tiling(struct drm_device *dev, | ||
718 | struct nouveau_tile_reg *tile, | ||
719 | struct nouveau_fence *fence); | ||
688 | extern int nv50_mem_vm_bind_linear(struct drm_device *, uint64_t virt, | 720 | extern int nv50_mem_vm_bind_linear(struct drm_device *, uint64_t virt, |
689 | uint32_t size, uint32_t flags, | 721 | uint32_t size, uint32_t flags, |
690 | uint64_t phys); | 722 | uint64_t phys); |
@@ -713,7 +745,6 @@ extern int nouveau_channel_alloc(struct drm_device *dev, | |||
713 | struct drm_file *file_priv, | 745 | struct drm_file *file_priv, |
714 | uint32_t fb_ctxdma, uint32_t tt_ctxdma); | 746 | uint32_t fb_ctxdma, uint32_t tt_ctxdma); |
715 | extern void nouveau_channel_free(struct nouveau_channel *); | 747 | extern void nouveau_channel_free(struct nouveau_channel *); |
716 | extern int nouveau_channel_idle(struct nouveau_channel *chan); | ||
717 | 748 | ||
718 | /* nouveau_object.c */ | 749 | /* nouveau_object.c */ |
719 | extern int nouveau_gpuobj_early_init(struct drm_device *); | 750 | extern int nouveau_gpuobj_early_init(struct drm_device *); |
@@ -756,6 +787,8 @@ extern int nouveau_gpuobj_gart_dma_new(struct nouveau_channel *, | |||
756 | uint32_t *o_ret); | 787 | uint32_t *o_ret); |
757 | extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, int class, | 788 | extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, int class, |
758 | struct nouveau_gpuobj **); | 789 | struct nouveau_gpuobj **); |
790 | extern int nouveau_gpuobj_sw_new(struct nouveau_channel *, int class, | ||
791 | struct nouveau_gpuobj **); | ||
759 | extern int nouveau_ioctl_grobj_alloc(struct drm_device *, void *data, | 792 | extern int nouveau_ioctl_grobj_alloc(struct drm_device *, void *data, |
760 | struct drm_file *); | 793 | struct drm_file *); |
761 | extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data, | 794 | extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data, |
@@ -804,6 +837,7 @@ nouveau_debugfs_channel_fini(struct nouveau_channel *chan) | |||
804 | #endif | 837 | #endif |
805 | 838 | ||
806 | /* nouveau_dma.c */ | 839 | /* nouveau_dma.c */ |
840 | extern void nouveau_dma_pre_init(struct nouveau_channel *); | ||
807 | extern int nouveau_dma_init(struct nouveau_channel *); | 841 | extern int nouveau_dma_init(struct nouveau_channel *); |
808 | extern int nouveau_dma_wait(struct nouveau_channel *, int size); | 842 | extern int nouveau_dma_wait(struct nouveau_channel *, int size); |
809 | 843 | ||
@@ -879,16 +913,22 @@ extern void nv04_fb_takedown(struct drm_device *); | |||
879 | /* nv10_fb.c */ | 913 | /* nv10_fb.c */ |
880 | extern int nv10_fb_init(struct drm_device *); | 914 | extern int nv10_fb_init(struct drm_device *); |
881 | extern void nv10_fb_takedown(struct drm_device *); | 915 | extern void nv10_fb_takedown(struct drm_device *); |
916 | extern void nv10_fb_set_region_tiling(struct drm_device *, int, uint32_t, | ||
917 | uint32_t, uint32_t); | ||
882 | 918 | ||
883 | /* nv40_fb.c */ | 919 | /* nv40_fb.c */ |
884 | extern int nv40_fb_init(struct drm_device *); | 920 | extern int nv40_fb_init(struct drm_device *); |
885 | extern void nv40_fb_takedown(struct drm_device *); | 921 | extern void nv40_fb_takedown(struct drm_device *); |
922 | extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t, | ||
923 | uint32_t, uint32_t); | ||
886 | 924 | ||
887 | /* nv04_fifo.c */ | 925 | /* nv04_fifo.c */ |
888 | extern int nv04_fifo_init(struct drm_device *); | 926 | extern int nv04_fifo_init(struct drm_device *); |
889 | extern void nv04_fifo_disable(struct drm_device *); | 927 | extern void nv04_fifo_disable(struct drm_device *); |
890 | extern void nv04_fifo_enable(struct drm_device *); | 928 | extern void nv04_fifo_enable(struct drm_device *); |
891 | extern bool nv04_fifo_reassign(struct drm_device *, bool); | 929 | extern bool nv04_fifo_reassign(struct drm_device *, bool); |
930 | extern bool nv04_fifo_cache_flush(struct drm_device *); | ||
931 | extern bool nv04_fifo_cache_pull(struct drm_device *, bool); | ||
892 | extern int nv04_fifo_channel_id(struct drm_device *); | 932 | extern int nv04_fifo_channel_id(struct drm_device *); |
893 | extern int nv04_fifo_create_context(struct nouveau_channel *); | 933 | extern int nv04_fifo_create_context(struct nouveau_channel *); |
894 | extern void nv04_fifo_destroy_context(struct nouveau_channel *); | 934 | extern void nv04_fifo_destroy_context(struct nouveau_channel *); |
@@ -941,6 +981,8 @@ extern void nv10_graph_destroy_context(struct nouveau_channel *); | |||
941 | extern int nv10_graph_load_context(struct nouveau_channel *); | 981 | extern int nv10_graph_load_context(struct nouveau_channel *); |
942 | extern int nv10_graph_unload_context(struct drm_device *); | 982 | extern int nv10_graph_unload_context(struct drm_device *); |
943 | extern void nv10_graph_context_switch(struct drm_device *); | 983 | extern void nv10_graph_context_switch(struct drm_device *); |
984 | extern void nv10_graph_set_region_tiling(struct drm_device *, int, uint32_t, | ||
985 | uint32_t, uint32_t); | ||
944 | 986 | ||
945 | /* nv20_graph.c */ | 987 | /* nv20_graph.c */ |
946 | extern struct nouveau_pgraph_object_class nv20_graph_grclass[]; | 988 | extern struct nouveau_pgraph_object_class nv20_graph_grclass[]; |
@@ -952,6 +994,8 @@ extern int nv20_graph_unload_context(struct drm_device *); | |||
952 | extern int nv20_graph_init(struct drm_device *); | 994 | extern int nv20_graph_init(struct drm_device *); |
953 | extern void nv20_graph_takedown(struct drm_device *); | 995 | extern void nv20_graph_takedown(struct drm_device *); |
954 | extern int nv30_graph_init(struct drm_device *); | 996 | extern int nv30_graph_init(struct drm_device *); |
997 | extern void nv20_graph_set_region_tiling(struct drm_device *, int, uint32_t, | ||
998 | uint32_t, uint32_t); | ||
955 | 999 | ||
956 | /* nv40_graph.c */ | 1000 | /* nv40_graph.c */ |
957 | extern struct nouveau_pgraph_object_class nv40_graph_grclass[]; | 1001 | extern struct nouveau_pgraph_object_class nv40_graph_grclass[]; |
@@ -963,6 +1007,8 @@ extern void nv40_graph_destroy_context(struct nouveau_channel *); | |||
963 | extern int nv40_graph_load_context(struct nouveau_channel *); | 1007 | extern int nv40_graph_load_context(struct nouveau_channel *); |
964 | extern int nv40_graph_unload_context(struct drm_device *); | 1008 | extern int nv40_graph_unload_context(struct drm_device *); |
965 | extern void nv40_grctx_init(struct nouveau_grctx *); | 1009 | extern void nv40_grctx_init(struct nouveau_grctx *); |
1010 | extern void nv40_graph_set_region_tiling(struct drm_device *, int, uint32_t, | ||
1011 | uint32_t, uint32_t); | ||
966 | 1012 | ||
967 | /* nv50_graph.c */ | 1013 | /* nv50_graph.c */ |
968 | extern struct nouveau_pgraph_object_class nv50_graph_grclass[]; | 1014 | extern struct nouveau_pgraph_object_class nv50_graph_grclass[]; |
@@ -1030,8 +1076,7 @@ extern long nouveau_compat_ioctl(struct file *file, unsigned int cmd, | |||
1030 | 1076 | ||
1031 | /* nv04_dac.c */ | 1077 | /* nv04_dac.c */ |
1032 | extern int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry); | 1078 | extern int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry); |
1033 | extern enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, | 1079 | extern uint32_t nv17_dac_sample_load(struct drm_encoder *encoder); |
1034 | struct drm_connector *connector); | ||
1035 | extern int nv04_dac_output_offset(struct drm_encoder *encoder); | 1080 | extern int nv04_dac_output_offset(struct drm_encoder *encoder); |
1036 | extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable); | 1081 | extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable); |
1037 | 1082 | ||
@@ -1049,9 +1094,6 @@ extern int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry); | |||
1049 | 1094 | ||
1050 | /* nv17_tv.c */ | 1095 | /* nv17_tv.c */ |
1051 | extern int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry); | 1096 | extern int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry); |
1052 | extern enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder, | ||
1053 | struct drm_connector *connector, | ||
1054 | uint32_t pin_mask); | ||
1055 | 1097 | ||
1056 | /* nv04_display.c */ | 1098 | /* nv04_display.c */ |
1057 | extern int nv04_display_create(struct drm_device *); | 1099 | extern int nv04_display_create(struct drm_device *); |
@@ -1290,14 +1332,14 @@ nv_two_reg_pll(struct drm_device *dev) | |||
1290 | return false; | 1332 | return false; |
1291 | } | 1333 | } |
1292 | 1334 | ||
1293 | #define NV50_NVSW 0x0000506e | 1335 | #define NV_SW 0x0000506e |
1294 | #define NV50_NVSW_DMA_SEMAPHORE 0x00000060 | 1336 | #define NV_SW_DMA_SEMAPHORE 0x00000060 |
1295 | #define NV50_NVSW_SEMAPHORE_OFFSET 0x00000064 | 1337 | #define NV_SW_SEMAPHORE_OFFSET 0x00000064 |
1296 | #define NV50_NVSW_SEMAPHORE_ACQUIRE 0x00000068 | 1338 | #define NV_SW_SEMAPHORE_ACQUIRE 0x00000068 |
1297 | #define NV50_NVSW_SEMAPHORE_RELEASE 0x0000006c | 1339 | #define NV_SW_SEMAPHORE_RELEASE 0x0000006c |
1298 | #define NV50_NVSW_DMA_VBLSEM 0x0000018c | 1340 | #define NV_SW_DMA_VBLSEM 0x0000018c |
1299 | #define NV50_NVSW_VBLSEM_OFFSET 0x00000400 | 1341 | #define NV_SW_VBLSEM_OFFSET 0x00000400 |
1300 | #define NV50_NVSW_VBLSEM_RELEASE_VALUE 0x00000404 | 1342 | #define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404 |
1301 | #define NV50_NVSW_VBLSEM_RELEASE 0x00000408 | 1343 | #define NV_SW_VBLSEM_RELEASE 0x00000408 |
1302 | 1344 | ||
1303 | #endif /* __NOUVEAU_DRV_H__ */ | 1345 | #endif /* __NOUVEAU_DRV_H__ */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 84af25c238b6..0b05c869e0e7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -64,8 +64,7 @@ nouveau_fbcon_sync(struct fb_info *info) | |||
64 | return 0; | 64 | return 0; |
65 | 65 | ||
66 | if (RING_SPACE(chan, 4)) { | 66 | if (RING_SPACE(chan, 4)) { |
67 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 67 | nouveau_fbcon_gpu_lockup(info); |
68 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
69 | return 0; | 68 | return 0; |
70 | } | 69 | } |
71 | 70 | ||
@@ -86,8 +85,7 @@ nouveau_fbcon_sync(struct fb_info *info) | |||
86 | } | 85 | } |
87 | 86 | ||
88 | if (ret) { | 87 | if (ret) { |
89 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 88 | nouveau_fbcon_gpu_lockup(info); |
90 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
91 | return 0; | 89 | return 0; |
92 | } | 90 | } |
93 | 91 | ||
@@ -212,11 +210,11 @@ nouveau_fbcon_create(struct drm_device *dev, uint32_t fb_width, | |||
212 | 210 | ||
213 | mode_cmd.bpp = surface_bpp; | 211 | mode_cmd.bpp = surface_bpp; |
214 | mode_cmd.pitch = mode_cmd.width * (mode_cmd.bpp >> 3); | 212 | mode_cmd.pitch = mode_cmd.width * (mode_cmd.bpp >> 3); |
215 | mode_cmd.pitch = ALIGN(mode_cmd.pitch, 256); | 213 | mode_cmd.pitch = roundup(mode_cmd.pitch, 256); |
216 | mode_cmd.depth = surface_depth; | 214 | mode_cmd.depth = surface_depth; |
217 | 215 | ||
218 | size = mode_cmd.pitch * mode_cmd.height; | 216 | size = mode_cmd.pitch * mode_cmd.height; |
219 | size = ALIGN(size, PAGE_SIZE); | 217 | size = roundup(size, PAGE_SIZE); |
220 | 218 | ||
221 | ret = nouveau_gem_new(dev, dev_priv->channel, size, 0, TTM_PL_FLAG_VRAM, | 219 | ret = nouveau_gem_new(dev, dev_priv->channel, size, 0, TTM_PL_FLAG_VRAM, |
222 | 0, 0x0000, false, true, &nvbo); | 220 | 0, 0x0000, false, true, &nvbo); |
@@ -380,3 +378,12 @@ nouveau_fbcon_remove(struct drm_device *dev, struct drm_framebuffer *fb) | |||
380 | 378 | ||
381 | return 0; | 379 | return 0; |
382 | } | 380 | } |
381 | |||
382 | void nouveau_fbcon_gpu_lockup(struct fb_info *info) | ||
383 | { | ||
384 | struct nouveau_fbcon_par *par = info->par; | ||
385 | struct drm_device *dev = par->dev; | ||
386 | |||
387 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | ||
388 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
389 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.h b/drivers/gpu/drm/nouveau/nouveau_fbcon.h index 8531140fedbc..462e0b87b4bd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.h +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.h | |||
@@ -43,5 +43,6 @@ void nouveau_fbcon_zfill(struct drm_device *dev); | |||
43 | int nv04_fbcon_accel_init(struct fb_info *info); | 43 | int nv04_fbcon_accel_init(struct fb_info *info); |
44 | int nv50_fbcon_accel_init(struct fb_info *info); | 44 | int nv50_fbcon_accel_init(struct fb_info *info); |
45 | 45 | ||
46 | void nouveau_fbcon_gpu_lockup(struct fb_info *info); | ||
46 | #endif /* __NV50_FBCON_H__ */ | 47 | #endif /* __NV50_FBCON_H__ */ |
47 | 48 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index dacac9a0842a..faddf53ff9ed 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -142,7 +142,7 @@ nouveau_fence_emit(struct nouveau_fence *fence) | |||
142 | list_add_tail(&fence->entry, &chan->fence.pending); | 142 | list_add_tail(&fence->entry, &chan->fence.pending); |
143 | spin_unlock_irqrestore(&chan->fence.lock, flags); | 143 | spin_unlock_irqrestore(&chan->fence.lock, flags); |
144 | 144 | ||
145 | BEGIN_RING(chan, NvSubM2MF, USE_REFCNT ? 0x0050 : 0x0150, 1); | 145 | BEGIN_RING(chan, NvSubSw, USE_REFCNT ? 0x0050 : 0x0150, 1); |
146 | OUT_RING(chan, fence->sequence); | 146 | OUT_RING(chan, fence->sequence); |
147 | FIRE_RING(chan); | 147 | FIRE_RING(chan); |
148 | 148 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 18fd8ac9fca7..2009db2426c3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -220,7 +220,6 @@ nouveau_gem_set_domain(struct drm_gem_object *gem, uint32_t read_domains, | |||
220 | } | 220 | } |
221 | 221 | ||
222 | struct validate_op { | 222 | struct validate_op { |
223 | struct nouveau_fence *fence; | ||
224 | struct list_head vram_list; | 223 | struct list_head vram_list; |
225 | struct list_head gart_list; | 224 | struct list_head gart_list; |
226 | struct list_head both_list; | 225 | struct list_head both_list; |
@@ -252,17 +251,11 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence) | |||
252 | } | 251 | } |
253 | 252 | ||
254 | static void | 253 | static void |
255 | validate_fini(struct validate_op *op, bool success) | 254 | validate_fini(struct validate_op *op, struct nouveau_fence* fence) |
256 | { | 255 | { |
257 | struct nouveau_fence *fence = op->fence; | 256 | validate_fini_list(&op->vram_list, fence); |
258 | 257 | validate_fini_list(&op->gart_list, fence); | |
259 | if (unlikely(!success)) | 258 | validate_fini_list(&op->both_list, fence); |
260 | op->fence = NULL; | ||
261 | |||
262 | validate_fini_list(&op->vram_list, op->fence); | ||
263 | validate_fini_list(&op->gart_list, op->fence); | ||
264 | validate_fini_list(&op->both_list, op->fence); | ||
265 | nouveau_fence_unref((void *)&fence); | ||
266 | } | 259 | } |
267 | 260 | ||
268 | static int | 261 | static int |
@@ -420,10 +413,6 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan, | |||
420 | INIT_LIST_HEAD(&op->gart_list); | 413 | INIT_LIST_HEAD(&op->gart_list); |
421 | INIT_LIST_HEAD(&op->both_list); | 414 | INIT_LIST_HEAD(&op->both_list); |
422 | 415 | ||
423 | ret = nouveau_fence_new(chan, &op->fence, false); | ||
424 | if (ret) | ||
425 | return ret; | ||
426 | |||
427 | if (nr_buffers == 0) | 416 | if (nr_buffers == 0) |
428 | return 0; | 417 | return 0; |
429 | 418 | ||
@@ -541,6 +530,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, | |||
541 | struct drm_nouveau_gem_pushbuf_bo *bo = NULL; | 530 | struct drm_nouveau_gem_pushbuf_bo *bo = NULL; |
542 | struct nouveau_channel *chan; | 531 | struct nouveau_channel *chan; |
543 | struct validate_op op; | 532 | struct validate_op op; |
533 | struct nouveau_fence* fence = 0; | ||
544 | uint32_t *pushbuf = NULL; | 534 | uint32_t *pushbuf = NULL; |
545 | int ret = 0, do_reloc = 0, i; | 535 | int ret = 0, do_reloc = 0, i; |
546 | 536 | ||
@@ -597,7 +587,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, | |||
597 | 587 | ||
598 | OUT_RINGp(chan, pushbuf, req->nr_dwords); | 588 | OUT_RINGp(chan, pushbuf, req->nr_dwords); |
599 | 589 | ||
600 | ret = nouveau_fence_emit(op.fence); | 590 | ret = nouveau_fence_new(chan, &fence, true); |
601 | if (ret) { | 591 | if (ret) { |
602 | NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); | 592 | NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); |
603 | WIND_RING(chan); | 593 | WIND_RING(chan); |
@@ -605,7 +595,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, | |||
605 | } | 595 | } |
606 | 596 | ||
607 | if (nouveau_gem_pushbuf_sync(chan)) { | 597 | if (nouveau_gem_pushbuf_sync(chan)) { |
608 | ret = nouveau_fence_wait(op.fence, NULL, false, false); | 598 | ret = nouveau_fence_wait(fence, NULL, false, false); |
609 | if (ret) { | 599 | if (ret) { |
610 | for (i = 0; i < req->nr_dwords; i++) | 600 | for (i = 0; i < req->nr_dwords; i++) |
611 | NV_ERROR(dev, "0x%08x\n", pushbuf[i]); | 601 | NV_ERROR(dev, "0x%08x\n", pushbuf[i]); |
@@ -614,7 +604,8 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, | |||
614 | } | 604 | } |
615 | 605 | ||
616 | out: | 606 | out: |
617 | validate_fini(&op, ret == 0); | 607 | validate_fini(&op, fence); |
608 | nouveau_fence_unref((void**)&fence); | ||
618 | mutex_unlock(&dev->struct_mutex); | 609 | mutex_unlock(&dev->struct_mutex); |
619 | kfree(pushbuf); | 610 | kfree(pushbuf); |
620 | kfree(bo); | 611 | kfree(bo); |
@@ -634,6 +625,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data, | |||
634 | struct drm_gem_object *gem; | 625 | struct drm_gem_object *gem; |
635 | struct nouveau_bo *pbbo; | 626 | struct nouveau_bo *pbbo; |
636 | struct validate_op op; | 627 | struct validate_op op; |
628 | struct nouveau_fence* fence = 0; | ||
637 | int i, ret = 0, do_reloc = 0; | 629 | int i, ret = 0, do_reloc = 0; |
638 | 630 | ||
639 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | 631 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; |
@@ -772,7 +764,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data, | |||
772 | OUT_RING(chan, 0); | 764 | OUT_RING(chan, 0); |
773 | } | 765 | } |
774 | 766 | ||
775 | ret = nouveau_fence_emit(op.fence); | 767 | ret = nouveau_fence_new(chan, &fence, true); |
776 | if (ret) { | 768 | if (ret) { |
777 | NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); | 769 | NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); |
778 | WIND_RING(chan); | 770 | WIND_RING(chan); |
@@ -780,7 +772,8 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data, | |||
780 | } | 772 | } |
781 | 773 | ||
782 | out: | 774 | out: |
783 | validate_fini(&op, ret == 0); | 775 | validate_fini(&op, fence); |
776 | nouveau_fence_unref((void**)&fence); | ||
784 | mutex_unlock(&dev->struct_mutex); | 777 | mutex_unlock(&dev->struct_mutex); |
785 | kfree(bo); | 778 | kfree(bo); |
786 | 779 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 370c72c968d1..919a619ca7fa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
@@ -635,6 +635,7 @@ nv50_pgraph_irq_handler(struct drm_device *dev) | |||
635 | 635 | ||
636 | if ((nv_rd32(dev, 0x400500) & isb) != isb) | 636 | if ((nv_rd32(dev, 0x400500) & isb) != isb) |
637 | nv_wr32(dev, 0x400500, nv_rd32(dev, 0x400500) | isb); | 637 | nv_wr32(dev, 0x400500, nv_rd32(dev, 0x400500) | isb); |
638 | nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31)); | ||
638 | } | 639 | } |
639 | 640 | ||
640 | nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); | 641 | nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 5158a12f7844..fb9bdd6edf1f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -192,6 +192,92 @@ void nouveau_mem_release(struct drm_file *file_priv, struct mem_block *heap) | |||
192 | } | 192 | } |
193 | 193 | ||
194 | /* | 194 | /* |
195 | * NV10-NV40 tiling helpers | ||
196 | */ | ||
197 | |||
198 | static void | ||
199 | nv10_mem_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
200 | uint32_t size, uint32_t pitch) | ||
201 | { | ||
202 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
203 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | ||
204 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | ||
205 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
206 | struct nouveau_tile_reg *tile = &dev_priv->tile.reg[i]; | ||
207 | |||
208 | tile->addr = addr; | ||
209 | tile->size = size; | ||
210 | tile->used = !!pitch; | ||
211 | nouveau_fence_unref((void **)&tile->fence); | ||
212 | |||
213 | if (!pfifo->cache_flush(dev)) | ||
214 | return; | ||
215 | |||
216 | pfifo->reassign(dev, false); | ||
217 | pfifo->cache_flush(dev); | ||
218 | pfifo->cache_pull(dev, false); | ||
219 | |||
220 | nouveau_wait_for_idle(dev); | ||
221 | |||
222 | pgraph->set_region_tiling(dev, i, addr, size, pitch); | ||
223 | pfb->set_region_tiling(dev, i, addr, size, pitch); | ||
224 | |||
225 | pfifo->cache_pull(dev, true); | ||
226 | pfifo->reassign(dev, true); | ||
227 | } | ||
228 | |||
229 | struct nouveau_tile_reg * | ||
230 | nv10_mem_set_tiling(struct drm_device *dev, uint32_t addr, uint32_t size, | ||
231 | uint32_t pitch) | ||
232 | { | ||
233 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
234 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | ||
235 | struct nouveau_tile_reg *tile = dev_priv->tile.reg, *found = NULL; | ||
236 | int i; | ||
237 | |||
238 | spin_lock(&dev_priv->tile.lock); | ||
239 | |||
240 | for (i = 0; i < pfb->num_tiles; i++) { | ||
241 | if (tile[i].used) | ||
242 | /* Tile region in use. */ | ||
243 | continue; | ||
244 | |||
245 | if (tile[i].fence && | ||
246 | !nouveau_fence_signalled(tile[i].fence, NULL)) | ||
247 | /* Pending tile region. */ | ||
248 | continue; | ||
249 | |||
250 | if (max(tile[i].addr, addr) < | ||
251 | min(tile[i].addr + tile[i].size, addr + size)) | ||
252 | /* Kill an intersecting tile region. */ | ||
253 | nv10_mem_set_region_tiling(dev, i, 0, 0, 0); | ||
254 | |||
255 | if (pitch && !found) { | ||
256 | /* Free tile region. */ | ||
257 | nv10_mem_set_region_tiling(dev, i, addr, size, pitch); | ||
258 | found = &tile[i]; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | spin_unlock(&dev_priv->tile.lock); | ||
263 | |||
264 | return found; | ||
265 | } | ||
266 | |||
267 | void | ||
268 | nv10_mem_expire_tiling(struct drm_device *dev, struct nouveau_tile_reg *tile, | ||
269 | struct nouveau_fence *fence) | ||
270 | { | ||
271 | if (fence) { | ||
272 | /* Mark it as pending. */ | ||
273 | tile->fence = fence; | ||
274 | nouveau_fence_ref(fence); | ||
275 | } | ||
276 | |||
277 | tile->used = false; | ||
278 | } | ||
279 | |||
280 | /* | ||
195 | * NV50 VM helpers | 281 | * NV50 VM helpers |
196 | */ | 282 | */ |
197 | int | 283 | int |
@@ -513,6 +599,7 @@ nouveau_mem_init(struct drm_device *dev) | |||
513 | 599 | ||
514 | INIT_LIST_HEAD(&dev_priv->ttm.bo_list); | 600 | INIT_LIST_HEAD(&dev_priv->ttm.bo_list); |
515 | spin_lock_init(&dev_priv->ttm.bo_list_lock); | 601 | spin_lock_init(&dev_priv->ttm.bo_list_lock); |
602 | spin_lock_init(&dev_priv->tile.lock); | ||
516 | 603 | ||
517 | dev_priv->fb_available_size = nouveau_mem_fb_amount(dev); | 604 | dev_priv->fb_available_size = nouveau_mem_fb_amount(dev); |
518 | 605 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 93379bb81bea..6c2cf81716df 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
@@ -881,7 +881,7 @@ nouveau_gpuobj_gr_new(struct nouveau_channel *chan, int class, | |||
881 | return 0; | 881 | return 0; |
882 | } | 882 | } |
883 | 883 | ||
884 | static int | 884 | int |
885 | nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class, | 885 | nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class, |
886 | struct nouveau_gpuobj **gpuobj_ret) | 886 | struct nouveau_gpuobj **gpuobj_ret) |
887 | { | 887 | { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_reg.h b/drivers/gpu/drm/nouveau/nouveau_reg.h index fa1b0e7165b9..251f1b3b38b9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_reg.h +++ b/drivers/gpu/drm/nouveau/nouveau_reg.h | |||
@@ -349,19 +349,19 @@ | |||
349 | #define NV04_PGRAPH_BLEND 0x00400824 | 349 | #define NV04_PGRAPH_BLEND 0x00400824 |
350 | #define NV04_PGRAPH_STORED_FMT 0x00400830 | 350 | #define NV04_PGRAPH_STORED_FMT 0x00400830 |
351 | #define NV04_PGRAPH_PATT_COLORRAM 0x00400900 | 351 | #define NV04_PGRAPH_PATT_COLORRAM 0x00400900 |
352 | #define NV40_PGRAPH_TILE0(i) (0x00400900 + (i*16)) | 352 | #define NV20_PGRAPH_TILE(i) (0x00400900 + (i*16)) |
353 | #define NV40_PGRAPH_TLIMIT0(i) (0x00400904 + (i*16)) | 353 | #define NV20_PGRAPH_TLIMIT(i) (0x00400904 + (i*16)) |
354 | #define NV40_PGRAPH_TSIZE0(i) (0x00400908 + (i*16)) | 354 | #define NV20_PGRAPH_TSIZE(i) (0x00400908 + (i*16)) |
355 | #define NV40_PGRAPH_TSTATUS0(i) (0x0040090C + (i*16)) | 355 | #define NV20_PGRAPH_TSTATUS(i) (0x0040090C + (i*16)) |
356 | #define NV10_PGRAPH_TILE(i) (0x00400B00 + (i*16)) | 356 | #define NV10_PGRAPH_TILE(i) (0x00400B00 + (i*16)) |
357 | #define NV10_PGRAPH_TLIMIT(i) (0x00400B04 + (i*16)) | 357 | #define NV10_PGRAPH_TLIMIT(i) (0x00400B04 + (i*16)) |
358 | #define NV10_PGRAPH_TSIZE(i) (0x00400B08 + (i*16)) | 358 | #define NV10_PGRAPH_TSIZE(i) (0x00400B08 + (i*16)) |
359 | #define NV10_PGRAPH_TSTATUS(i) (0x00400B0C + (i*16)) | 359 | #define NV10_PGRAPH_TSTATUS(i) (0x00400B0C + (i*16)) |
360 | #define NV04_PGRAPH_U_RAM 0x00400D00 | 360 | #define NV04_PGRAPH_U_RAM 0x00400D00 |
361 | #define NV47_PGRAPH_TILE0(i) (0x00400D00 + (i*16)) | 361 | #define NV47_PGRAPH_TILE(i) (0x00400D00 + (i*16)) |
362 | #define NV47_PGRAPH_TLIMIT0(i) (0x00400D04 + (i*16)) | 362 | #define NV47_PGRAPH_TLIMIT(i) (0x00400D04 + (i*16)) |
363 | #define NV47_PGRAPH_TSIZE0(i) (0x00400D08 + (i*16)) | 363 | #define NV47_PGRAPH_TSIZE(i) (0x00400D08 + (i*16)) |
364 | #define NV47_PGRAPH_TSTATUS0(i) (0x00400D0C + (i*16)) | 364 | #define NV47_PGRAPH_TSTATUS(i) (0x00400D0C + (i*16)) |
365 | #define NV04_PGRAPH_V_RAM 0x00400D40 | 365 | #define NV04_PGRAPH_V_RAM 0x00400D40 |
366 | #define NV04_PGRAPH_W_RAM 0x00400D80 | 366 | #define NV04_PGRAPH_W_RAM 0x00400D80 |
367 | #define NV10_PGRAPH_COMBINER0_IN_ALPHA 0x00400E40 | 367 | #define NV10_PGRAPH_COMBINER0_IN_ALPHA 0x00400E40 |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index e76ec2d207a9..09b9a46dfc0e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -76,6 +76,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
76 | engine->fifo.disable = nv04_fifo_disable; | 76 | engine->fifo.disable = nv04_fifo_disable; |
77 | engine->fifo.enable = nv04_fifo_enable; | 77 | engine->fifo.enable = nv04_fifo_enable; |
78 | engine->fifo.reassign = nv04_fifo_reassign; | 78 | engine->fifo.reassign = nv04_fifo_reassign; |
79 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
80 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
79 | engine->fifo.channel_id = nv04_fifo_channel_id; | 81 | engine->fifo.channel_id = nv04_fifo_channel_id; |
80 | engine->fifo.create_context = nv04_fifo_create_context; | 82 | engine->fifo.create_context = nv04_fifo_create_context; |
81 | engine->fifo.destroy_context = nv04_fifo_destroy_context; | 83 | engine->fifo.destroy_context = nv04_fifo_destroy_context; |
@@ -100,6 +102,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
100 | engine->timer.takedown = nv04_timer_takedown; | 102 | engine->timer.takedown = nv04_timer_takedown; |
101 | engine->fb.init = nv10_fb_init; | 103 | engine->fb.init = nv10_fb_init; |
102 | engine->fb.takedown = nv10_fb_takedown; | 104 | engine->fb.takedown = nv10_fb_takedown; |
105 | engine->fb.set_region_tiling = nv10_fb_set_region_tiling; | ||
103 | engine->graph.grclass = nv10_graph_grclass; | 106 | engine->graph.grclass = nv10_graph_grclass; |
104 | engine->graph.init = nv10_graph_init; | 107 | engine->graph.init = nv10_graph_init; |
105 | engine->graph.takedown = nv10_graph_takedown; | 108 | engine->graph.takedown = nv10_graph_takedown; |
@@ -109,12 +112,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
109 | engine->graph.fifo_access = nv04_graph_fifo_access; | 112 | engine->graph.fifo_access = nv04_graph_fifo_access; |
110 | engine->graph.load_context = nv10_graph_load_context; | 113 | engine->graph.load_context = nv10_graph_load_context; |
111 | engine->graph.unload_context = nv10_graph_unload_context; | 114 | engine->graph.unload_context = nv10_graph_unload_context; |
115 | engine->graph.set_region_tiling = nv10_graph_set_region_tiling; | ||
112 | engine->fifo.channels = 32; | 116 | engine->fifo.channels = 32; |
113 | engine->fifo.init = nv10_fifo_init; | 117 | engine->fifo.init = nv10_fifo_init; |
114 | engine->fifo.takedown = nouveau_stub_takedown; | 118 | engine->fifo.takedown = nouveau_stub_takedown; |
115 | engine->fifo.disable = nv04_fifo_disable; | 119 | engine->fifo.disable = nv04_fifo_disable; |
116 | engine->fifo.enable = nv04_fifo_enable; | 120 | engine->fifo.enable = nv04_fifo_enable; |
117 | engine->fifo.reassign = nv04_fifo_reassign; | 121 | engine->fifo.reassign = nv04_fifo_reassign; |
122 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
123 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
118 | engine->fifo.channel_id = nv10_fifo_channel_id; | 124 | engine->fifo.channel_id = nv10_fifo_channel_id; |
119 | engine->fifo.create_context = nv10_fifo_create_context; | 125 | engine->fifo.create_context = nv10_fifo_create_context; |
120 | engine->fifo.destroy_context = nv10_fifo_destroy_context; | 126 | engine->fifo.destroy_context = nv10_fifo_destroy_context; |
@@ -139,6 +145,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
139 | engine->timer.takedown = nv04_timer_takedown; | 145 | engine->timer.takedown = nv04_timer_takedown; |
140 | engine->fb.init = nv10_fb_init; | 146 | engine->fb.init = nv10_fb_init; |
141 | engine->fb.takedown = nv10_fb_takedown; | 147 | engine->fb.takedown = nv10_fb_takedown; |
148 | engine->fb.set_region_tiling = nv10_fb_set_region_tiling; | ||
142 | engine->graph.grclass = nv20_graph_grclass; | 149 | engine->graph.grclass = nv20_graph_grclass; |
143 | engine->graph.init = nv20_graph_init; | 150 | engine->graph.init = nv20_graph_init; |
144 | engine->graph.takedown = nv20_graph_takedown; | 151 | engine->graph.takedown = nv20_graph_takedown; |
@@ -148,12 +155,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
148 | engine->graph.fifo_access = nv04_graph_fifo_access; | 155 | engine->graph.fifo_access = nv04_graph_fifo_access; |
149 | engine->graph.load_context = nv20_graph_load_context; | 156 | engine->graph.load_context = nv20_graph_load_context; |
150 | engine->graph.unload_context = nv20_graph_unload_context; | 157 | engine->graph.unload_context = nv20_graph_unload_context; |
158 | engine->graph.set_region_tiling = nv20_graph_set_region_tiling; | ||
151 | engine->fifo.channels = 32; | 159 | engine->fifo.channels = 32; |
152 | engine->fifo.init = nv10_fifo_init; | 160 | engine->fifo.init = nv10_fifo_init; |
153 | engine->fifo.takedown = nouveau_stub_takedown; | 161 | engine->fifo.takedown = nouveau_stub_takedown; |
154 | engine->fifo.disable = nv04_fifo_disable; | 162 | engine->fifo.disable = nv04_fifo_disable; |
155 | engine->fifo.enable = nv04_fifo_enable; | 163 | engine->fifo.enable = nv04_fifo_enable; |
156 | engine->fifo.reassign = nv04_fifo_reassign; | 164 | engine->fifo.reassign = nv04_fifo_reassign; |
165 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
166 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
157 | engine->fifo.channel_id = nv10_fifo_channel_id; | 167 | engine->fifo.channel_id = nv10_fifo_channel_id; |
158 | engine->fifo.create_context = nv10_fifo_create_context; | 168 | engine->fifo.create_context = nv10_fifo_create_context; |
159 | engine->fifo.destroy_context = nv10_fifo_destroy_context; | 169 | engine->fifo.destroy_context = nv10_fifo_destroy_context; |
@@ -178,6 +188,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
178 | engine->timer.takedown = nv04_timer_takedown; | 188 | engine->timer.takedown = nv04_timer_takedown; |
179 | engine->fb.init = nv10_fb_init; | 189 | engine->fb.init = nv10_fb_init; |
180 | engine->fb.takedown = nv10_fb_takedown; | 190 | engine->fb.takedown = nv10_fb_takedown; |
191 | engine->fb.set_region_tiling = nv10_fb_set_region_tiling; | ||
181 | engine->graph.grclass = nv30_graph_grclass; | 192 | engine->graph.grclass = nv30_graph_grclass; |
182 | engine->graph.init = nv30_graph_init; | 193 | engine->graph.init = nv30_graph_init; |
183 | engine->graph.takedown = nv20_graph_takedown; | 194 | engine->graph.takedown = nv20_graph_takedown; |
@@ -187,12 +198,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
187 | engine->graph.destroy_context = nv20_graph_destroy_context; | 198 | engine->graph.destroy_context = nv20_graph_destroy_context; |
188 | engine->graph.load_context = nv20_graph_load_context; | 199 | engine->graph.load_context = nv20_graph_load_context; |
189 | engine->graph.unload_context = nv20_graph_unload_context; | 200 | engine->graph.unload_context = nv20_graph_unload_context; |
201 | engine->graph.set_region_tiling = nv20_graph_set_region_tiling; | ||
190 | engine->fifo.channels = 32; | 202 | engine->fifo.channels = 32; |
191 | engine->fifo.init = nv10_fifo_init; | 203 | engine->fifo.init = nv10_fifo_init; |
192 | engine->fifo.takedown = nouveau_stub_takedown; | 204 | engine->fifo.takedown = nouveau_stub_takedown; |
193 | engine->fifo.disable = nv04_fifo_disable; | 205 | engine->fifo.disable = nv04_fifo_disable; |
194 | engine->fifo.enable = nv04_fifo_enable; | 206 | engine->fifo.enable = nv04_fifo_enable; |
195 | engine->fifo.reassign = nv04_fifo_reassign; | 207 | engine->fifo.reassign = nv04_fifo_reassign; |
208 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
209 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
196 | engine->fifo.channel_id = nv10_fifo_channel_id; | 210 | engine->fifo.channel_id = nv10_fifo_channel_id; |
197 | engine->fifo.create_context = nv10_fifo_create_context; | 211 | engine->fifo.create_context = nv10_fifo_create_context; |
198 | engine->fifo.destroy_context = nv10_fifo_destroy_context; | 212 | engine->fifo.destroy_context = nv10_fifo_destroy_context; |
@@ -218,6 +232,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
218 | engine->timer.takedown = nv04_timer_takedown; | 232 | engine->timer.takedown = nv04_timer_takedown; |
219 | engine->fb.init = nv40_fb_init; | 233 | engine->fb.init = nv40_fb_init; |
220 | engine->fb.takedown = nv40_fb_takedown; | 234 | engine->fb.takedown = nv40_fb_takedown; |
235 | engine->fb.set_region_tiling = nv40_fb_set_region_tiling; | ||
221 | engine->graph.grclass = nv40_graph_grclass; | 236 | engine->graph.grclass = nv40_graph_grclass; |
222 | engine->graph.init = nv40_graph_init; | 237 | engine->graph.init = nv40_graph_init; |
223 | engine->graph.takedown = nv40_graph_takedown; | 238 | engine->graph.takedown = nv40_graph_takedown; |
@@ -227,12 +242,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
227 | engine->graph.destroy_context = nv40_graph_destroy_context; | 242 | engine->graph.destroy_context = nv40_graph_destroy_context; |
228 | engine->graph.load_context = nv40_graph_load_context; | 243 | engine->graph.load_context = nv40_graph_load_context; |
229 | engine->graph.unload_context = nv40_graph_unload_context; | 244 | engine->graph.unload_context = nv40_graph_unload_context; |
245 | engine->graph.set_region_tiling = nv40_graph_set_region_tiling; | ||
230 | engine->fifo.channels = 32; | 246 | engine->fifo.channels = 32; |
231 | engine->fifo.init = nv40_fifo_init; | 247 | engine->fifo.init = nv40_fifo_init; |
232 | engine->fifo.takedown = nouveau_stub_takedown; | 248 | engine->fifo.takedown = nouveau_stub_takedown; |
233 | engine->fifo.disable = nv04_fifo_disable; | 249 | engine->fifo.disable = nv04_fifo_disable; |
234 | engine->fifo.enable = nv04_fifo_enable; | 250 | engine->fifo.enable = nv04_fifo_enable; |
235 | engine->fifo.reassign = nv04_fifo_reassign; | 251 | engine->fifo.reassign = nv04_fifo_reassign; |
252 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
253 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
236 | engine->fifo.channel_id = nv10_fifo_channel_id; | 254 | engine->fifo.channel_id = nv10_fifo_channel_id; |
237 | engine->fifo.create_context = nv40_fifo_create_context; | 255 | engine->fifo.create_context = nv40_fifo_create_context; |
238 | engine->fifo.destroy_context = nv40_fifo_destroy_context; | 256 | engine->fifo.destroy_context = nv40_fifo_destroy_context; |
@@ -624,7 +642,10 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
624 | dev_priv->chipset = (reg0 & 0xff00000) >> 20; | 642 | dev_priv->chipset = (reg0 & 0xff00000) >> 20; |
625 | /* NV04 or NV05 */ | 643 | /* NV04 or NV05 */ |
626 | } else if ((reg0 & 0xff00fff0) == 0x20004000) { | 644 | } else if ((reg0 & 0xff00fff0) == 0x20004000) { |
627 | dev_priv->chipset = 0x04; | 645 | if (reg0 & 0x00f00000) |
646 | dev_priv->chipset = 0x05; | ||
647 | else | ||
648 | dev_priv->chipset = 0x04; | ||
628 | } else | 649 | } else |
629 | dev_priv->chipset = 0xff; | 650 | dev_priv->chipset = 0xff; |
630 | 651 | ||
@@ -704,8 +725,8 @@ static void nouveau_close(struct drm_device *dev) | |||
704 | { | 725 | { |
705 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 726 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
706 | 727 | ||
707 | /* In the case of an error dev_priv may not be be allocated yet */ | 728 | /* In the case of an error dev_priv may not be allocated yet */ |
708 | if (dev_priv && dev_priv->card_type) | 729 | if (dev_priv) |
709 | nouveau_card_takedown(dev); | 730 | nouveau_card_takedown(dev); |
710 | } | 731 | } |
711 | 732 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c index 187eb84e4da5..c385d50f041b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c | |||
@@ -28,45 +28,17 @@ | |||
28 | 28 | ||
29 | #include "nouveau_drv.h" | 29 | #include "nouveau_drv.h" |
30 | 30 | ||
31 | static struct vm_operations_struct nouveau_ttm_vm_ops; | ||
32 | static const struct vm_operations_struct *ttm_vm_ops; | ||
33 | |||
34 | static int | ||
35 | nouveau_ttm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | ||
36 | { | ||
37 | struct ttm_buffer_object *bo = vma->vm_private_data; | ||
38 | int ret; | ||
39 | |||
40 | if (unlikely(bo == NULL)) | ||
41 | return VM_FAULT_NOPAGE; | ||
42 | |||
43 | ret = ttm_vm_ops->fault(vma, vmf); | ||
44 | return ret; | ||
45 | } | ||
46 | |||
47 | int | 31 | int |
48 | nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma) | 32 | nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma) |
49 | { | 33 | { |
50 | struct drm_file *file_priv = filp->private_data; | 34 | struct drm_file *file_priv = filp->private_data; |
51 | struct drm_nouveau_private *dev_priv = | 35 | struct drm_nouveau_private *dev_priv = |
52 | file_priv->minor->dev->dev_private; | 36 | file_priv->minor->dev->dev_private; |
53 | int ret; | ||
54 | 37 | ||
55 | if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) | 38 | if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) |
56 | return drm_mmap(filp, vma); | 39 | return drm_mmap(filp, vma); |
57 | 40 | ||
58 | ret = ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev); | 41 | return ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev); |
59 | if (unlikely(ret != 0)) | ||
60 | return ret; | ||
61 | |||
62 | if (unlikely(ttm_vm_ops == NULL)) { | ||
63 | ttm_vm_ops = vma->vm_ops; | ||
64 | nouveau_ttm_vm_ops = *ttm_vm_ops; | ||
65 | nouveau_ttm_vm_ops.fault = &nouveau_ttm_fault; | ||
66 | } | ||
67 | |||
68 | vma->vm_ops = &nouveau_ttm_vm_ops; | ||
69 | return 0; | ||
70 | } | 42 | } |
71 | 43 | ||
72 | static int | 44 | static int |
diff --git a/drivers/gpu/drm/nouveau/nv04_dac.c b/drivers/gpu/drm/nouveau/nv04_dac.c index d9f32879ba38..d0e038d28948 100644 --- a/drivers/gpu/drm/nouveau/nv04_dac.c +++ b/drivers/gpu/drm/nouveau/nv04_dac.c | |||
@@ -212,16 +212,15 @@ out: | |||
212 | return connector_status_disconnected; | 212 | return connector_status_disconnected; |
213 | } | 213 | } |
214 | 214 | ||
215 | enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, | 215 | uint32_t nv17_dac_sample_load(struct drm_encoder *encoder) |
216 | struct drm_connector *connector) | ||
217 | { | 216 | { |
218 | struct drm_device *dev = encoder->dev; | 217 | struct drm_device *dev = encoder->dev; |
219 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 218 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
220 | struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb; | 219 | struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb; |
221 | uint32_t testval, regoffset = nv04_dac_output_offset(encoder); | 220 | uint32_t sample, testval, regoffset = nv04_dac_output_offset(encoder); |
222 | uint32_t saved_powerctrl_2 = 0, saved_powerctrl_4 = 0, saved_routput, | 221 | uint32_t saved_powerctrl_2 = 0, saved_powerctrl_4 = 0, saved_routput, |
223 | saved_rtest_ctrl, saved_gpio0, saved_gpio1, temp, routput; | 222 | saved_rtest_ctrl, saved_gpio0, saved_gpio1, temp, routput; |
224 | int head, present = 0; | 223 | int head; |
225 | 224 | ||
226 | #define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20) | 225 | #define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20) |
227 | if (dcb->type == OUTPUT_TV) { | 226 | if (dcb->type == OUTPUT_TV) { |
@@ -287,13 +286,7 @@ enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, | |||
287 | temp | NV_PRAMDAC_TEST_CONTROL_TP_INS_EN_ASSERTED); | 286 | temp | NV_PRAMDAC_TEST_CONTROL_TP_INS_EN_ASSERTED); |
288 | msleep(5); | 287 | msleep(5); |
289 | 288 | ||
290 | temp = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset); | 289 | sample = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset); |
291 | |||
292 | if (dcb->type == OUTPUT_TV) | ||
293 | present = (nv17_tv_detect(encoder, connector, temp) | ||
294 | == connector_status_connected); | ||
295 | else | ||
296 | present = temp & NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI; | ||
297 | 290 | ||
298 | temp = NVReadRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL); | 291 | temp = NVReadRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL); |
299 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL, | 292 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL, |
@@ -310,15 +303,25 @@ enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, | |||
310 | nv17_gpio_set(dev, DCB_GPIO_TVDAC1, saved_gpio1); | 303 | nv17_gpio_set(dev, DCB_GPIO_TVDAC1, saved_gpio1); |
311 | nv17_gpio_set(dev, DCB_GPIO_TVDAC0, saved_gpio0); | 304 | nv17_gpio_set(dev, DCB_GPIO_TVDAC0, saved_gpio0); |
312 | 305 | ||
313 | if (present) { | 306 | return sample; |
314 | NV_INFO(dev, "Load detected on output %c\n", '@' + ffs(dcb->or)); | 307 | } |
308 | |||
309 | static enum drm_connector_status | ||
310 | nv17_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) | ||
311 | { | ||
312 | struct drm_device *dev = encoder->dev; | ||
313 | struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb; | ||
314 | uint32_t sample = nv17_dac_sample_load(encoder); | ||
315 | |||
316 | if (sample & NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) { | ||
317 | NV_INFO(dev, "Load detected on output %c\n", | ||
318 | '@' + ffs(dcb->or)); | ||
315 | return connector_status_connected; | 319 | return connector_status_connected; |
320 | } else { | ||
321 | return connector_status_disconnected; | ||
316 | } | 322 | } |
317 | |||
318 | return connector_status_disconnected; | ||
319 | } | 323 | } |
320 | 324 | ||
321 | |||
322 | static bool nv04_dac_mode_fixup(struct drm_encoder *encoder, | 325 | static bool nv04_dac_mode_fixup(struct drm_encoder *encoder, |
323 | struct drm_display_mode *mode, | 326 | struct drm_display_mode *mode, |
324 | struct drm_display_mode *adjusted_mode) | 327 | struct drm_display_mode *adjusted_mode) |
diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c index 09a31071ee58..d910873c1368 100644 --- a/drivers/gpu/drm/nouveau/nv04_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c | |||
@@ -39,8 +39,7 @@ nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) | |||
39 | return; | 39 | return; |
40 | 40 | ||
41 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 4)) { | 41 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 4)) { |
42 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 42 | nouveau_fbcon_gpu_lockup(info); |
43 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
44 | } | 43 | } |
45 | 44 | ||
46 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 45 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -62,14 +61,12 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
62 | struct drm_device *dev = par->dev; | 61 | struct drm_device *dev = par->dev; |
63 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 62 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
64 | struct nouveau_channel *chan = dev_priv->channel; | 63 | struct nouveau_channel *chan = dev_priv->channel; |
65 | uint32_t color = ((uint32_t *) info->pseudo_palette)[rect->color]; | ||
66 | 64 | ||
67 | if (info->state != FBINFO_STATE_RUNNING) | 65 | if (info->state != FBINFO_STATE_RUNNING) |
68 | return; | 66 | return; |
69 | 67 | ||
70 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 7)) { | 68 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 7)) { |
71 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 69 | nouveau_fbcon_gpu_lockup(info); |
72 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
73 | } | 70 | } |
74 | 71 | ||
75 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 72 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -80,7 +77,11 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
80 | BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1); | 77 | BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1); |
81 | OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3); | 78 | OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3); |
82 | BEGIN_RING(chan, NvSubGdiRect, 0x03fc, 1); | 79 | BEGIN_RING(chan, NvSubGdiRect, 0x03fc, 1); |
83 | OUT_RING(chan, color); | 80 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || |
81 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) | ||
82 | OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]); | ||
83 | else | ||
84 | OUT_RING(chan, rect->color); | ||
84 | BEGIN_RING(chan, NvSubGdiRect, 0x0400, 2); | 85 | BEGIN_RING(chan, NvSubGdiRect, 0x0400, 2); |
85 | OUT_RING(chan, (rect->dx << 16) | rect->dy); | 86 | OUT_RING(chan, (rect->dx << 16) | rect->dy); |
86 | OUT_RING(chan, (rect->width << 16) | rect->height); | 87 | OUT_RING(chan, (rect->width << 16) | rect->height); |
@@ -109,8 +110,7 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
109 | } | 110 | } |
110 | 111 | ||
111 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 8)) { | 112 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 8)) { |
112 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 113 | nouveau_fbcon_gpu_lockup(info); |
113 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
114 | } | 114 | } |
115 | 115 | ||
116 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 116 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -144,8 +144,7 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
144 | int iter_len = dsize > 128 ? 128 : dsize; | 144 | int iter_len = dsize > 128 ? 128 : dsize; |
145 | 145 | ||
146 | if (RING_SPACE(chan, iter_len + 1)) { | 146 | if (RING_SPACE(chan, iter_len + 1)) { |
147 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 147 | nouveau_fbcon_gpu_lockup(info); |
148 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
149 | cfb_imageblit(info, image); | 148 | cfb_imageblit(info, image); |
150 | return; | 149 | return; |
151 | } | 150 | } |
@@ -184,6 +183,7 @@ nv04_fbcon_accel_init(struct fb_info *info) | |||
184 | struct drm_device *dev = par->dev; | 183 | struct drm_device *dev = par->dev; |
185 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 184 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
186 | struct nouveau_channel *chan = dev_priv->channel; | 185 | struct nouveau_channel *chan = dev_priv->channel; |
186 | const int sub = NvSubCtxSurf2D; | ||
187 | int surface_fmt, pattern_fmt, rect_fmt; | 187 | int surface_fmt, pattern_fmt, rect_fmt; |
188 | int ret; | 188 | int ret; |
189 | 189 | ||
@@ -242,30 +242,29 @@ nv04_fbcon_accel_init(struct fb_info *info) | |||
242 | return ret; | 242 | return ret; |
243 | 243 | ||
244 | if (RING_SPACE(chan, 49)) { | 244 | if (RING_SPACE(chan, 49)) { |
245 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 245 | nouveau_fbcon_gpu_lockup(info); |
246 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
247 | return 0; | 246 | return 0; |
248 | } | 247 | } |
249 | 248 | ||
250 | BEGIN_RING(chan, 1, 0x0000, 1); | 249 | BEGIN_RING(chan, sub, 0x0000, 1); |
251 | OUT_RING(chan, NvCtxSurf2D); | 250 | OUT_RING(chan, NvCtxSurf2D); |
252 | BEGIN_RING(chan, 1, 0x0184, 2); | 251 | BEGIN_RING(chan, sub, 0x0184, 2); |
253 | OUT_RING(chan, NvDmaFB); | 252 | OUT_RING(chan, NvDmaFB); |
254 | OUT_RING(chan, NvDmaFB); | 253 | OUT_RING(chan, NvDmaFB); |
255 | BEGIN_RING(chan, 1, 0x0300, 4); | 254 | BEGIN_RING(chan, sub, 0x0300, 4); |
256 | OUT_RING(chan, surface_fmt); | 255 | OUT_RING(chan, surface_fmt); |
257 | OUT_RING(chan, info->fix.line_length | (info->fix.line_length << 16)); | 256 | OUT_RING(chan, info->fix.line_length | (info->fix.line_length << 16)); |
258 | OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); | 257 | OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); |
259 | OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); | 258 | OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); |
260 | 259 | ||
261 | BEGIN_RING(chan, 1, 0x0000, 1); | 260 | BEGIN_RING(chan, sub, 0x0000, 1); |
262 | OUT_RING(chan, NvRop); | 261 | OUT_RING(chan, NvRop); |
263 | BEGIN_RING(chan, 1, 0x0300, 1); | 262 | BEGIN_RING(chan, sub, 0x0300, 1); |
264 | OUT_RING(chan, 0x55); | 263 | OUT_RING(chan, 0x55); |
265 | 264 | ||
266 | BEGIN_RING(chan, 1, 0x0000, 1); | 265 | BEGIN_RING(chan, sub, 0x0000, 1); |
267 | OUT_RING(chan, NvImagePatt); | 266 | OUT_RING(chan, NvImagePatt); |
268 | BEGIN_RING(chan, 1, 0x0300, 8); | 267 | BEGIN_RING(chan, sub, 0x0300, 8); |
269 | OUT_RING(chan, pattern_fmt); | 268 | OUT_RING(chan, pattern_fmt); |
270 | #ifdef __BIG_ENDIAN | 269 | #ifdef __BIG_ENDIAN |
271 | OUT_RING(chan, 2); | 270 | OUT_RING(chan, 2); |
@@ -279,9 +278,9 @@ nv04_fbcon_accel_init(struct fb_info *info) | |||
279 | OUT_RING(chan, ~0); | 278 | OUT_RING(chan, ~0); |
280 | OUT_RING(chan, ~0); | 279 | OUT_RING(chan, ~0); |
281 | 280 | ||
282 | BEGIN_RING(chan, 1, 0x0000, 1); | 281 | BEGIN_RING(chan, sub, 0x0000, 1); |
283 | OUT_RING(chan, NvClipRect); | 282 | OUT_RING(chan, NvClipRect); |
284 | BEGIN_RING(chan, 1, 0x0300, 2); | 283 | BEGIN_RING(chan, sub, 0x0300, 2); |
285 | OUT_RING(chan, 0); | 284 | OUT_RING(chan, 0); |
286 | OUT_RING(chan, (info->var.yres_virtual << 16) | info->var.xres_virtual); | 285 | OUT_RING(chan, (info->var.yres_virtual << 16) | info->var.xres_virtual); |
287 | 286 | ||
diff --git a/drivers/gpu/drm/nouveau/nv04_fifo.c b/drivers/gpu/drm/nouveau/nv04_fifo.c index 0c3cd53c7313..f31347b8c9b0 100644 --- a/drivers/gpu/drm/nouveau/nv04_fifo.c +++ b/drivers/gpu/drm/nouveau/nv04_fifo.c | |||
@@ -71,6 +71,40 @@ nv04_fifo_reassign(struct drm_device *dev, bool enable) | |||
71 | return (reassign == 1); | 71 | return (reassign == 1); |
72 | } | 72 | } |
73 | 73 | ||
74 | bool | ||
75 | nv04_fifo_cache_flush(struct drm_device *dev) | ||
76 | { | ||
77 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
78 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | ||
79 | uint64_t start = ptimer->read(dev); | ||
80 | |||
81 | do { | ||
82 | if (nv_rd32(dev, NV03_PFIFO_CACHE1_GET) == | ||
83 | nv_rd32(dev, NV03_PFIFO_CACHE1_PUT)) | ||
84 | return true; | ||
85 | |||
86 | } while (ptimer->read(dev) - start < 100000000); | ||
87 | |||
88 | NV_ERROR(dev, "Timeout flushing the PFIFO cache.\n"); | ||
89 | |||
90 | return false; | ||
91 | } | ||
92 | |||
93 | bool | ||
94 | nv04_fifo_cache_pull(struct drm_device *dev, bool enable) | ||
95 | { | ||
96 | uint32_t pull = nv_rd32(dev, NV04_PFIFO_CACHE1_PULL0); | ||
97 | |||
98 | if (enable) { | ||
99 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, pull | 1); | ||
100 | } else { | ||
101 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, pull & ~1); | ||
102 | nv_wr32(dev, NV04_PFIFO_CACHE1_HASH, 0); | ||
103 | } | ||
104 | |||
105 | return !!(pull & 1); | ||
106 | } | ||
107 | |||
74 | int | 108 | int |
75 | nv04_fifo_channel_id(struct drm_device *dev) | 109 | nv04_fifo_channel_id(struct drm_device *dev) |
76 | { | 110 | { |
diff --git a/drivers/gpu/drm/nouveau/nv04_graph.c b/drivers/gpu/drm/nouveau/nv04_graph.c index d561d773c0f4..e260986ea65a 100644 --- a/drivers/gpu/drm/nouveau/nv04_graph.c +++ b/drivers/gpu/drm/nouveau/nv04_graph.c | |||
@@ -28,6 +28,10 @@ | |||
28 | #include "nouveau_drv.h" | 28 | #include "nouveau_drv.h" |
29 | 29 | ||
30 | static uint32_t nv04_graph_ctx_regs[] = { | 30 | static uint32_t nv04_graph_ctx_regs[] = { |
31 | 0x0040053c, | ||
32 | 0x00400544, | ||
33 | 0x00400540, | ||
34 | 0x00400548, | ||
31 | NV04_PGRAPH_CTX_SWITCH1, | 35 | NV04_PGRAPH_CTX_SWITCH1, |
32 | NV04_PGRAPH_CTX_SWITCH2, | 36 | NV04_PGRAPH_CTX_SWITCH2, |
33 | NV04_PGRAPH_CTX_SWITCH3, | 37 | NV04_PGRAPH_CTX_SWITCH3, |
@@ -102,69 +106,69 @@ static uint32_t nv04_graph_ctx_regs[] = { | |||
102 | NV04_PGRAPH_PATT_COLOR0, | 106 | NV04_PGRAPH_PATT_COLOR0, |
103 | NV04_PGRAPH_PATT_COLOR1, | 107 | NV04_PGRAPH_PATT_COLOR1, |
104 | NV04_PGRAPH_PATT_COLORRAM+0x00, | 108 | NV04_PGRAPH_PATT_COLORRAM+0x00, |
105 | NV04_PGRAPH_PATT_COLORRAM+0x01, | ||
106 | NV04_PGRAPH_PATT_COLORRAM+0x02, | ||
107 | NV04_PGRAPH_PATT_COLORRAM+0x03, | ||
108 | NV04_PGRAPH_PATT_COLORRAM+0x04, | 109 | NV04_PGRAPH_PATT_COLORRAM+0x04, |
109 | NV04_PGRAPH_PATT_COLORRAM+0x05, | ||
110 | NV04_PGRAPH_PATT_COLORRAM+0x06, | ||
111 | NV04_PGRAPH_PATT_COLORRAM+0x07, | ||
112 | NV04_PGRAPH_PATT_COLORRAM+0x08, | 110 | NV04_PGRAPH_PATT_COLORRAM+0x08, |
113 | NV04_PGRAPH_PATT_COLORRAM+0x09, | 111 | NV04_PGRAPH_PATT_COLORRAM+0x0c, |
114 | NV04_PGRAPH_PATT_COLORRAM+0x0A, | ||
115 | NV04_PGRAPH_PATT_COLORRAM+0x0B, | ||
116 | NV04_PGRAPH_PATT_COLORRAM+0x0C, | ||
117 | NV04_PGRAPH_PATT_COLORRAM+0x0D, | ||
118 | NV04_PGRAPH_PATT_COLORRAM+0x0E, | ||
119 | NV04_PGRAPH_PATT_COLORRAM+0x0F, | ||
120 | NV04_PGRAPH_PATT_COLORRAM+0x10, | 112 | NV04_PGRAPH_PATT_COLORRAM+0x10, |
121 | NV04_PGRAPH_PATT_COLORRAM+0x11, | ||
122 | NV04_PGRAPH_PATT_COLORRAM+0x12, | ||
123 | NV04_PGRAPH_PATT_COLORRAM+0x13, | ||
124 | NV04_PGRAPH_PATT_COLORRAM+0x14, | 113 | NV04_PGRAPH_PATT_COLORRAM+0x14, |
125 | NV04_PGRAPH_PATT_COLORRAM+0x15, | ||
126 | NV04_PGRAPH_PATT_COLORRAM+0x16, | ||
127 | NV04_PGRAPH_PATT_COLORRAM+0x17, | ||
128 | NV04_PGRAPH_PATT_COLORRAM+0x18, | 114 | NV04_PGRAPH_PATT_COLORRAM+0x18, |
129 | NV04_PGRAPH_PATT_COLORRAM+0x19, | 115 | NV04_PGRAPH_PATT_COLORRAM+0x1c, |
130 | NV04_PGRAPH_PATT_COLORRAM+0x1A, | ||
131 | NV04_PGRAPH_PATT_COLORRAM+0x1B, | ||
132 | NV04_PGRAPH_PATT_COLORRAM+0x1C, | ||
133 | NV04_PGRAPH_PATT_COLORRAM+0x1D, | ||
134 | NV04_PGRAPH_PATT_COLORRAM+0x1E, | ||
135 | NV04_PGRAPH_PATT_COLORRAM+0x1F, | ||
136 | NV04_PGRAPH_PATT_COLORRAM+0x20, | 116 | NV04_PGRAPH_PATT_COLORRAM+0x20, |
137 | NV04_PGRAPH_PATT_COLORRAM+0x21, | ||
138 | NV04_PGRAPH_PATT_COLORRAM+0x22, | ||
139 | NV04_PGRAPH_PATT_COLORRAM+0x23, | ||
140 | NV04_PGRAPH_PATT_COLORRAM+0x24, | 117 | NV04_PGRAPH_PATT_COLORRAM+0x24, |
141 | NV04_PGRAPH_PATT_COLORRAM+0x25, | ||
142 | NV04_PGRAPH_PATT_COLORRAM+0x26, | ||
143 | NV04_PGRAPH_PATT_COLORRAM+0x27, | ||
144 | NV04_PGRAPH_PATT_COLORRAM+0x28, | 118 | NV04_PGRAPH_PATT_COLORRAM+0x28, |
145 | NV04_PGRAPH_PATT_COLORRAM+0x29, | 119 | NV04_PGRAPH_PATT_COLORRAM+0x2c, |
146 | NV04_PGRAPH_PATT_COLORRAM+0x2A, | ||
147 | NV04_PGRAPH_PATT_COLORRAM+0x2B, | ||
148 | NV04_PGRAPH_PATT_COLORRAM+0x2C, | ||
149 | NV04_PGRAPH_PATT_COLORRAM+0x2D, | ||
150 | NV04_PGRAPH_PATT_COLORRAM+0x2E, | ||
151 | NV04_PGRAPH_PATT_COLORRAM+0x2F, | ||
152 | NV04_PGRAPH_PATT_COLORRAM+0x30, | 120 | NV04_PGRAPH_PATT_COLORRAM+0x30, |
153 | NV04_PGRAPH_PATT_COLORRAM+0x31, | ||
154 | NV04_PGRAPH_PATT_COLORRAM+0x32, | ||
155 | NV04_PGRAPH_PATT_COLORRAM+0x33, | ||
156 | NV04_PGRAPH_PATT_COLORRAM+0x34, | 121 | NV04_PGRAPH_PATT_COLORRAM+0x34, |
157 | NV04_PGRAPH_PATT_COLORRAM+0x35, | ||
158 | NV04_PGRAPH_PATT_COLORRAM+0x36, | ||
159 | NV04_PGRAPH_PATT_COLORRAM+0x37, | ||
160 | NV04_PGRAPH_PATT_COLORRAM+0x38, | 122 | NV04_PGRAPH_PATT_COLORRAM+0x38, |
161 | NV04_PGRAPH_PATT_COLORRAM+0x39, | 123 | NV04_PGRAPH_PATT_COLORRAM+0x3c, |
162 | NV04_PGRAPH_PATT_COLORRAM+0x3A, | 124 | NV04_PGRAPH_PATT_COLORRAM+0x40, |
163 | NV04_PGRAPH_PATT_COLORRAM+0x3B, | 125 | NV04_PGRAPH_PATT_COLORRAM+0x44, |
164 | NV04_PGRAPH_PATT_COLORRAM+0x3C, | 126 | NV04_PGRAPH_PATT_COLORRAM+0x48, |
165 | NV04_PGRAPH_PATT_COLORRAM+0x3D, | 127 | NV04_PGRAPH_PATT_COLORRAM+0x4c, |
166 | NV04_PGRAPH_PATT_COLORRAM+0x3E, | 128 | NV04_PGRAPH_PATT_COLORRAM+0x50, |
167 | NV04_PGRAPH_PATT_COLORRAM+0x3F, | 129 | NV04_PGRAPH_PATT_COLORRAM+0x54, |
130 | NV04_PGRAPH_PATT_COLORRAM+0x58, | ||
131 | NV04_PGRAPH_PATT_COLORRAM+0x5c, | ||
132 | NV04_PGRAPH_PATT_COLORRAM+0x60, | ||
133 | NV04_PGRAPH_PATT_COLORRAM+0x64, | ||
134 | NV04_PGRAPH_PATT_COLORRAM+0x68, | ||
135 | NV04_PGRAPH_PATT_COLORRAM+0x6c, | ||
136 | NV04_PGRAPH_PATT_COLORRAM+0x70, | ||
137 | NV04_PGRAPH_PATT_COLORRAM+0x74, | ||
138 | NV04_PGRAPH_PATT_COLORRAM+0x78, | ||
139 | NV04_PGRAPH_PATT_COLORRAM+0x7c, | ||
140 | NV04_PGRAPH_PATT_COLORRAM+0x80, | ||
141 | NV04_PGRAPH_PATT_COLORRAM+0x84, | ||
142 | NV04_PGRAPH_PATT_COLORRAM+0x88, | ||
143 | NV04_PGRAPH_PATT_COLORRAM+0x8c, | ||
144 | NV04_PGRAPH_PATT_COLORRAM+0x90, | ||
145 | NV04_PGRAPH_PATT_COLORRAM+0x94, | ||
146 | NV04_PGRAPH_PATT_COLORRAM+0x98, | ||
147 | NV04_PGRAPH_PATT_COLORRAM+0x9c, | ||
148 | NV04_PGRAPH_PATT_COLORRAM+0xa0, | ||
149 | NV04_PGRAPH_PATT_COLORRAM+0xa4, | ||
150 | NV04_PGRAPH_PATT_COLORRAM+0xa8, | ||
151 | NV04_PGRAPH_PATT_COLORRAM+0xac, | ||
152 | NV04_PGRAPH_PATT_COLORRAM+0xb0, | ||
153 | NV04_PGRAPH_PATT_COLORRAM+0xb4, | ||
154 | NV04_PGRAPH_PATT_COLORRAM+0xb8, | ||
155 | NV04_PGRAPH_PATT_COLORRAM+0xbc, | ||
156 | NV04_PGRAPH_PATT_COLORRAM+0xc0, | ||
157 | NV04_PGRAPH_PATT_COLORRAM+0xc4, | ||
158 | NV04_PGRAPH_PATT_COLORRAM+0xc8, | ||
159 | NV04_PGRAPH_PATT_COLORRAM+0xcc, | ||
160 | NV04_PGRAPH_PATT_COLORRAM+0xd0, | ||
161 | NV04_PGRAPH_PATT_COLORRAM+0xd4, | ||
162 | NV04_PGRAPH_PATT_COLORRAM+0xd8, | ||
163 | NV04_PGRAPH_PATT_COLORRAM+0xdc, | ||
164 | NV04_PGRAPH_PATT_COLORRAM+0xe0, | ||
165 | NV04_PGRAPH_PATT_COLORRAM+0xe4, | ||
166 | NV04_PGRAPH_PATT_COLORRAM+0xe8, | ||
167 | NV04_PGRAPH_PATT_COLORRAM+0xec, | ||
168 | NV04_PGRAPH_PATT_COLORRAM+0xf0, | ||
169 | NV04_PGRAPH_PATT_COLORRAM+0xf4, | ||
170 | NV04_PGRAPH_PATT_COLORRAM+0xf8, | ||
171 | NV04_PGRAPH_PATT_COLORRAM+0xfc, | ||
168 | NV04_PGRAPH_PATTERN, | 172 | NV04_PGRAPH_PATTERN, |
169 | 0x0040080c, | 173 | 0x0040080c, |
170 | NV04_PGRAPH_PATTERN_SHAPE, | 174 | NV04_PGRAPH_PATTERN_SHAPE, |
@@ -247,14 +251,6 @@ static uint32_t nv04_graph_ctx_regs[] = { | |||
247 | 0x004004f8, | 251 | 0x004004f8, |
248 | 0x0040047c, | 252 | 0x0040047c, |
249 | 0x004004fc, | 253 | 0x004004fc, |
250 | 0x0040053c, | ||
251 | 0x00400544, | ||
252 | 0x00400540, | ||
253 | 0x00400548, | ||
254 | 0x00400560, | ||
255 | 0x00400568, | ||
256 | 0x00400564, | ||
257 | 0x0040056c, | ||
258 | 0x00400534, | 254 | 0x00400534, |
259 | 0x00400538, | 255 | 0x00400538, |
260 | 0x00400514, | 256 | 0x00400514, |
@@ -341,9 +337,8 @@ static uint32_t nv04_graph_ctx_regs[] = { | |||
341 | 0x00400500, | 337 | 0x00400500, |
342 | 0x00400504, | 338 | 0x00400504, |
343 | NV04_PGRAPH_VALID1, | 339 | NV04_PGRAPH_VALID1, |
344 | NV04_PGRAPH_VALID2 | 340 | NV04_PGRAPH_VALID2, |
345 | 341 | NV04_PGRAPH_DEBUG_3 | |
346 | |||
347 | }; | 342 | }; |
348 | 343 | ||
349 | struct graph_state { | 344 | struct graph_state { |
@@ -388,6 +383,18 @@ nv04_graph_context_switch(struct drm_device *dev) | |||
388 | pgraph->fifo_access(dev, true); | 383 | pgraph->fifo_access(dev, true); |
389 | } | 384 | } |
390 | 385 | ||
386 | static uint32_t *ctx_reg(struct graph_state *ctx, uint32_t reg) | ||
387 | { | ||
388 | int i; | ||
389 | |||
390 | for (i = 0; i < ARRAY_SIZE(nv04_graph_ctx_regs); i++) { | ||
391 | if (nv04_graph_ctx_regs[i] == reg) | ||
392 | return &ctx->nv04[i]; | ||
393 | } | ||
394 | |||
395 | return NULL; | ||
396 | } | ||
397 | |||
391 | int nv04_graph_create_context(struct nouveau_channel *chan) | 398 | int nv04_graph_create_context(struct nouveau_channel *chan) |
392 | { | 399 | { |
393 | struct graph_state *pgraph_ctx; | 400 | struct graph_state *pgraph_ctx; |
@@ -398,15 +405,8 @@ int nv04_graph_create_context(struct nouveau_channel *chan) | |||
398 | if (pgraph_ctx == NULL) | 405 | if (pgraph_ctx == NULL) |
399 | return -ENOMEM; | 406 | return -ENOMEM; |
400 | 407 | ||
401 | /* dev_priv->fifos[channel].pgraph_ctx_user = channel << 24; */ | 408 | *ctx_reg(pgraph_ctx, NV04_PGRAPH_DEBUG_3) = 0xfad4ff31; |
402 | pgraph_ctx->nv04[0] = 0x0001ffff; | 409 | |
403 | /* is it really needed ??? */ | ||
404 | #if 0 | ||
405 | dev_priv->fifos[channel].pgraph_ctx[1] = | ||
406 | nv_rd32(dev, NV_PGRAPH_DEBUG_4); | ||
407 | dev_priv->fifos[channel].pgraph_ctx[2] = | ||
408 | nv_rd32(dev, 0x004006b0); | ||
409 | #endif | ||
410 | return 0; | 410 | return 0; |
411 | } | 411 | } |
412 | 412 | ||
@@ -429,9 +429,13 @@ int nv04_graph_load_context(struct nouveau_channel *chan) | |||
429 | nv_wr32(dev, nv04_graph_ctx_regs[i], pgraph_ctx->nv04[i]); | 429 | nv_wr32(dev, nv04_graph_ctx_regs[i], pgraph_ctx->nv04[i]); |
430 | 430 | ||
431 | nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10010100); | 431 | nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10010100); |
432 | nv_wr32(dev, NV04_PGRAPH_CTX_USER, chan->id << 24); | 432 | |
433 | tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff; | ||
434 | nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp | chan->id << 24); | ||
435 | |||
433 | tmp = nv_rd32(dev, NV04_PGRAPH_FFINTFC_ST2); | 436 | tmp = nv_rd32(dev, NV04_PGRAPH_FFINTFC_ST2); |
434 | nv_wr32(dev, NV04_PGRAPH_FFINTFC_ST2, tmp & 0x000fffff); | 437 | nv_wr32(dev, NV04_PGRAPH_FFINTFC_ST2, tmp & 0x000fffff); |
438 | |||
435 | return 0; | 439 | return 0; |
436 | } | 440 | } |
437 | 441 | ||
@@ -494,7 +498,7 @@ int nv04_graph_init(struct drm_device *dev) | |||
494 | nv_wr32(dev, NV04_PGRAPH_STATE , 0xFFFFFFFF); | 498 | nv_wr32(dev, NV04_PGRAPH_STATE , 0xFFFFFFFF); |
495 | nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL , 0x10000100); | 499 | nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL , 0x10000100); |
496 | tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff; | 500 | tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff; |
497 | tmp |= dev_priv->engine.fifo.channels << 24; | 501 | tmp |= (dev_priv->engine.fifo.channels - 1) << 24; |
498 | nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp); | 502 | nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp); |
499 | 503 | ||
500 | /* These don't belong here, they're part of a per-channel context */ | 504 | /* These don't belong here, they're part of a per-channel context */ |
@@ -533,7 +537,7 @@ nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass, | |||
533 | int mthd, uint32_t data) | 537 | int mthd, uint32_t data) |
534 | { | 538 | { |
535 | struct drm_device *dev = chan->dev; | 539 | struct drm_device *dev = chan->dev; |
536 | uint32_t instance = nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff; | 540 | uint32_t instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4; |
537 | int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7; | 541 | int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7; |
538 | uint32_t tmp; | 542 | uint32_t tmp; |
539 | 543 | ||
@@ -547,7 +551,7 @@ nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass, | |||
547 | return 0; | 551 | return 0; |
548 | } | 552 | } |
549 | 553 | ||
550 | static struct nouveau_pgraph_object_method nv04_graph_mthds_m2mf[] = { | 554 | static struct nouveau_pgraph_object_method nv04_graph_mthds_sw[] = { |
551 | { 0x0150, nv04_graph_mthd_set_ref }, | 555 | { 0x0150, nv04_graph_mthd_set_ref }, |
552 | {} | 556 | {} |
553 | }; | 557 | }; |
@@ -558,7 +562,7 @@ static struct nouveau_pgraph_object_method nv04_graph_mthds_set_operation[] = { | |||
558 | }; | 562 | }; |
559 | 563 | ||
560 | struct nouveau_pgraph_object_class nv04_graph_grclass[] = { | 564 | struct nouveau_pgraph_object_class nv04_graph_grclass[] = { |
561 | { 0x0039, false, nv04_graph_mthds_m2mf }, | 565 | { 0x0039, false, NULL }, |
562 | { 0x004a, false, nv04_graph_mthds_set_operation }, /* gdirect */ | 566 | { 0x004a, false, nv04_graph_mthds_set_operation }, /* gdirect */ |
563 | { 0x005f, false, nv04_graph_mthds_set_operation }, /* imageblit */ | 567 | { 0x005f, false, nv04_graph_mthds_set_operation }, /* imageblit */ |
564 | { 0x0061, false, nv04_graph_mthds_set_operation }, /* ifc */ | 568 | { 0x0061, false, nv04_graph_mthds_set_operation }, /* ifc */ |
@@ -574,6 +578,7 @@ struct nouveau_pgraph_object_class nv04_graph_grclass[] = { | |||
574 | { 0x0053, false, NULL }, /* surf3d */ | 578 | { 0x0053, false, NULL }, /* surf3d */ |
575 | { 0x0054, false, NULL }, /* tex_tri */ | 579 | { 0x0054, false, NULL }, /* tex_tri */ |
576 | { 0x0055, false, NULL }, /* multitex_tri */ | 580 | { 0x0055, false, NULL }, /* multitex_tri */ |
581 | { 0x506e, true, nv04_graph_mthds_sw }, | ||
577 | {} | 582 | {} |
578 | }; | 583 | }; |
579 | 584 | ||
diff --git a/drivers/gpu/drm/nouveau/nv10_fb.c b/drivers/gpu/drm/nouveau/nv10_fb.c index 79e2d104d70a..cc5cda44e501 100644 --- a/drivers/gpu/drm/nouveau/nv10_fb.c +++ b/drivers/gpu/drm/nouveau/nv10_fb.c | |||
@@ -3,17 +3,37 @@ | |||
3 | #include "nouveau_drv.h" | 3 | #include "nouveau_drv.h" |
4 | #include "nouveau_drm.h" | 4 | #include "nouveau_drm.h" |
5 | 5 | ||
6 | void | ||
7 | nv10_fb_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
8 | uint32_t size, uint32_t pitch) | ||
9 | { | ||
10 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
11 | uint32_t limit = max(1u, addr + size) - 1; | ||
12 | |||
13 | if (pitch) { | ||
14 | if (dev_priv->card_type >= NV_20) | ||
15 | addr |= 1; | ||
16 | else | ||
17 | addr |= 1 << 31; | ||
18 | } | ||
19 | |||
20 | nv_wr32(dev, NV10_PFB_TLIMIT(i), limit); | ||
21 | nv_wr32(dev, NV10_PFB_TSIZE(i), pitch); | ||
22 | nv_wr32(dev, NV10_PFB_TILE(i), addr); | ||
23 | } | ||
24 | |||
6 | int | 25 | int |
7 | nv10_fb_init(struct drm_device *dev) | 26 | nv10_fb_init(struct drm_device *dev) |
8 | { | 27 | { |
9 | uint32_t fb_bar_size; | 28 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
29 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | ||
10 | int i; | 30 | int i; |
11 | 31 | ||
12 | fb_bar_size = drm_get_resource_len(dev, 0) - 1; | 32 | pfb->num_tiles = NV10_PFB_TILE__SIZE; |
13 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | 33 | |
14 | nv_wr32(dev, NV10_PFB_TILE(i), 0); | 34 | /* Turn all the tiling regions off. */ |
15 | nv_wr32(dev, NV10_PFB_TLIMIT(i), fb_bar_size); | 35 | for (i = 0; i < pfb->num_tiles; i++) |
16 | } | 36 | pfb->set_region_tiling(dev, i, 0, 0, 0); |
17 | 37 | ||
18 | return 0; | 38 | return 0; |
19 | } | 39 | } |
diff --git a/drivers/gpu/drm/nouveau/nv10_graph.c b/drivers/gpu/drm/nouveau/nv10_graph.c index 6870e0ee2e7e..fcf2cdd19493 100644 --- a/drivers/gpu/drm/nouveau/nv10_graph.c +++ b/drivers/gpu/drm/nouveau/nv10_graph.c | |||
@@ -807,6 +807,20 @@ void nv10_graph_destroy_context(struct nouveau_channel *chan) | |||
807 | chan->pgraph_ctx = NULL; | 807 | chan->pgraph_ctx = NULL; |
808 | } | 808 | } |
809 | 809 | ||
810 | void | ||
811 | nv10_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
812 | uint32_t size, uint32_t pitch) | ||
813 | { | ||
814 | uint32_t limit = max(1u, addr + size) - 1; | ||
815 | |||
816 | if (pitch) | ||
817 | addr |= 1 << 31; | ||
818 | |||
819 | nv_wr32(dev, NV10_PGRAPH_TLIMIT(i), limit); | ||
820 | nv_wr32(dev, NV10_PGRAPH_TSIZE(i), pitch); | ||
821 | nv_wr32(dev, NV10_PGRAPH_TILE(i), addr); | ||
822 | } | ||
823 | |||
810 | int nv10_graph_init(struct drm_device *dev) | 824 | int nv10_graph_init(struct drm_device *dev) |
811 | { | 825 | { |
812 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 826 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
@@ -838,17 +852,9 @@ int nv10_graph_init(struct drm_device *dev) | |||
838 | } else | 852 | } else |
839 | nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x00000000); | 853 | nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x00000000); |
840 | 854 | ||
841 | /* copy tile info from PFB */ | 855 | /* Turn all the tiling regions off. */ |
842 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | 856 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) |
843 | nv_wr32(dev, NV10_PGRAPH_TILE(i), | 857 | nv10_graph_set_region_tiling(dev, i, 0, 0, 0); |
844 | nv_rd32(dev, NV10_PFB_TILE(i))); | ||
845 | nv_wr32(dev, NV10_PGRAPH_TLIMIT(i), | ||
846 | nv_rd32(dev, NV10_PFB_TLIMIT(i))); | ||
847 | nv_wr32(dev, NV10_PGRAPH_TSIZE(i), | ||
848 | nv_rd32(dev, NV10_PFB_TSIZE(i))); | ||
849 | nv_wr32(dev, NV10_PGRAPH_TSTATUS(i), | ||
850 | nv_rd32(dev, NV10_PFB_TSTATUS(i))); | ||
851 | } | ||
852 | 858 | ||
853 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH1, 0x00000000); | 859 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH1, 0x00000000); |
854 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH2, 0x00000000); | 860 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH2, 0x00000000); |
diff --git a/drivers/gpu/drm/nouveau/nv17_tv.c b/drivers/gpu/drm/nouveau/nv17_tv.c index 81c01353a9f9..58b917c3341b 100644 --- a/drivers/gpu/drm/nouveau/nv17_tv.c +++ b/drivers/gpu/drm/nouveau/nv17_tv.c | |||
@@ -33,13 +33,103 @@ | |||
33 | #include "nouveau_hw.h" | 33 | #include "nouveau_hw.h" |
34 | #include "nv17_tv.h" | 34 | #include "nv17_tv.h" |
35 | 35 | ||
36 | enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder, | 36 | static uint32_t nv42_tv_sample_load(struct drm_encoder *encoder) |
37 | struct drm_connector *connector, | ||
38 | uint32_t pin_mask) | ||
39 | { | 37 | { |
38 | struct drm_device *dev = encoder->dev; | ||
39 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
40 | uint32_t testval, regoffset = nv04_dac_output_offset(encoder); | ||
41 | uint32_t gpio0, gpio1, fp_htotal, fp_hsync_start, fp_hsync_end, | ||
42 | fp_control, test_ctrl, dacclk, ctv_14, ctv_1c, ctv_6c; | ||
43 | uint32_t sample = 0; | ||
44 | int head; | ||
45 | |||
46 | #define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20) | ||
47 | testval = RGB_TEST_DATA(0x82, 0xeb, 0x82); | ||
48 | if (dev_priv->vbios->tvdactestval) | ||
49 | testval = dev_priv->vbios->tvdactestval; | ||
50 | |||
51 | dacclk = NVReadRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset); | ||
52 | head = (dacclk & 0x100) >> 8; | ||
53 | |||
54 | /* Save the previous state. */ | ||
55 | gpio1 = nv17_gpio_get(dev, DCB_GPIO_TVDAC1); | ||
56 | gpio0 = nv17_gpio_get(dev, DCB_GPIO_TVDAC0); | ||
57 | fp_htotal = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_HTOTAL); | ||
58 | fp_hsync_start = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_START); | ||
59 | fp_hsync_end = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_END); | ||
60 | fp_control = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL); | ||
61 | test_ctrl = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset); | ||
62 | ctv_1c = NVReadRAMDAC(dev, head, 0x680c1c); | ||
63 | ctv_14 = NVReadRAMDAC(dev, head, 0x680c14); | ||
64 | ctv_6c = NVReadRAMDAC(dev, head, 0x680c6c); | ||
65 | |||
66 | /* Prepare the DAC for load detection. */ | ||
67 | nv17_gpio_set(dev, DCB_GPIO_TVDAC1, true); | ||
68 | nv17_gpio_set(dev, DCB_GPIO_TVDAC0, true); | ||
69 | |||
70 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HTOTAL, 1343); | ||
71 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_START, 1047); | ||
72 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_END, 1183); | ||
73 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL, | ||
74 | NV_PRAMDAC_FP_TG_CONTROL_DISPEN_POS | | ||
75 | NV_PRAMDAC_FP_TG_CONTROL_WIDTH_12 | | ||
76 | NV_PRAMDAC_FP_TG_CONTROL_READ_PROG | | ||
77 | NV_PRAMDAC_FP_TG_CONTROL_HSYNC_POS | | ||
78 | NV_PRAMDAC_FP_TG_CONTROL_VSYNC_POS); | ||
79 | |||
80 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset, 0); | ||
81 | |||
82 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset, | ||
83 | (dacclk & ~0xff) | 0x22); | ||
84 | msleep(1); | ||
85 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset, | ||
86 | (dacclk & ~0xff) | 0x21); | ||
87 | |||
88 | NVWriteRAMDAC(dev, head, 0x680c1c, 1 << 20); | ||
89 | NVWriteRAMDAC(dev, head, 0x680c14, 4 << 16); | ||
90 | |||
91 | /* Sample pin 0x4 (usually S-video luma). */ | ||
92 | NVWriteRAMDAC(dev, head, 0x680c6c, testval >> 10 & 0x3ff); | ||
93 | msleep(20); | ||
94 | sample |= NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset) | ||
95 | & 0x4 << 28; | ||
96 | |||
97 | /* Sample the remaining pins. */ | ||
98 | NVWriteRAMDAC(dev, head, 0x680c6c, testval & 0x3ff); | ||
99 | msleep(20); | ||
100 | sample |= NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset) | ||
101 | & 0xa << 28; | ||
102 | |||
103 | /* Restore the previous state. */ | ||
104 | NVWriteRAMDAC(dev, head, 0x680c1c, ctv_1c); | ||
105 | NVWriteRAMDAC(dev, head, 0x680c14, ctv_14); | ||
106 | NVWriteRAMDAC(dev, head, 0x680c6c, ctv_6c); | ||
107 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset, dacclk); | ||
108 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset, test_ctrl); | ||
109 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL, fp_control); | ||
110 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_END, fp_hsync_end); | ||
111 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_START, fp_hsync_start); | ||
112 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HTOTAL, fp_htotal); | ||
113 | nv17_gpio_set(dev, DCB_GPIO_TVDAC1, gpio1); | ||
114 | nv17_gpio_set(dev, DCB_GPIO_TVDAC0, gpio0); | ||
115 | |||
116 | return sample; | ||
117 | } | ||
118 | |||
119 | static enum drm_connector_status | ||
120 | nv17_tv_detect(struct drm_encoder *encoder, struct drm_connector *connector) | ||
121 | { | ||
122 | struct drm_device *dev = encoder->dev; | ||
123 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
124 | struct drm_mode_config *conf = &dev->mode_config; | ||
40 | struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); | 125 | struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); |
126 | struct dcb_entry *dcb = tv_enc->base.dcb; | ||
41 | 127 | ||
42 | tv_enc->pin_mask = pin_mask >> 28 & 0xe; | 128 | if (dev_priv->chipset == 0x42 || |
129 | dev_priv->chipset == 0x43) | ||
130 | tv_enc->pin_mask = nv42_tv_sample_load(encoder) >> 28 & 0xe; | ||
131 | else | ||
132 | tv_enc->pin_mask = nv17_dac_sample_load(encoder) >> 28 & 0xe; | ||
43 | 133 | ||
44 | switch (tv_enc->pin_mask) { | 134 | switch (tv_enc->pin_mask) { |
45 | case 0x2: | 135 | case 0x2: |
@@ -50,7 +140,7 @@ enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder, | |||
50 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SVIDEO; | 140 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SVIDEO; |
51 | break; | 141 | break; |
52 | case 0xe: | 142 | case 0xe: |
53 | if (nouveau_encoder(encoder)->dcb->tvconf.has_component_output) | 143 | if (dcb->tvconf.has_component_output) |
54 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_Component; | 144 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_Component; |
55 | else | 145 | else |
56 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SCART; | 146 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SCART; |
@@ -61,11 +151,16 @@ enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder, | |||
61 | } | 151 | } |
62 | 152 | ||
63 | drm_connector_property_set_value(connector, | 153 | drm_connector_property_set_value(connector, |
64 | encoder->dev->mode_config.tv_subconnector_property, | 154 | conf->tv_subconnector_property, |
65 | tv_enc->subconnector); | 155 | tv_enc->subconnector); |
66 | 156 | ||
67 | return tv_enc->subconnector ? connector_status_connected : | 157 | if (tv_enc->subconnector) { |
68 | connector_status_disconnected; | 158 | NV_INFO(dev, "Load detected on output %c\n", |
159 | '@' + ffs(dcb->or)); | ||
160 | return connector_status_connected; | ||
161 | } else { | ||
162 | return connector_status_disconnected; | ||
163 | } | ||
69 | } | 164 | } |
70 | 165 | ||
71 | static const struct { | 166 | static const struct { |
@@ -633,7 +728,7 @@ static struct drm_encoder_helper_funcs nv17_tv_helper_funcs = { | |||
633 | .prepare = nv17_tv_prepare, | 728 | .prepare = nv17_tv_prepare, |
634 | .commit = nv17_tv_commit, | 729 | .commit = nv17_tv_commit, |
635 | .mode_set = nv17_tv_mode_set, | 730 | .mode_set = nv17_tv_mode_set, |
636 | .detect = nv17_dac_detect, | 731 | .detect = nv17_tv_detect, |
637 | }; | 732 | }; |
638 | 733 | ||
639 | static struct drm_encoder_slave_funcs nv17_tv_slave_funcs = { | 734 | static struct drm_encoder_slave_funcs nv17_tv_slave_funcs = { |
diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c index 18ba74f19703..d6fc0a82f03d 100644 --- a/drivers/gpu/drm/nouveau/nv20_graph.c +++ b/drivers/gpu/drm/nouveau/nv20_graph.c | |||
@@ -514,6 +514,27 @@ nv20_graph_rdi(struct drm_device *dev) | |||
514 | nouveau_wait_for_idle(dev); | 514 | nouveau_wait_for_idle(dev); |
515 | } | 515 | } |
516 | 516 | ||
517 | void | ||
518 | nv20_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
519 | uint32_t size, uint32_t pitch) | ||
520 | { | ||
521 | uint32_t limit = max(1u, addr + size) - 1; | ||
522 | |||
523 | if (pitch) | ||
524 | addr |= 1; | ||
525 | |||
526 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), limit); | ||
527 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), pitch); | ||
528 | nv_wr32(dev, NV20_PGRAPH_TILE(i), addr); | ||
529 | |||
530 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0030 + 4 * i); | ||
531 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, limit); | ||
532 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0050 + 4 * i); | ||
533 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, pitch); | ||
534 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0010 + 4 * i); | ||
535 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, addr); | ||
536 | } | ||
537 | |||
517 | int | 538 | int |
518 | nv20_graph_init(struct drm_device *dev) | 539 | nv20_graph_init(struct drm_device *dev) |
519 | { | 540 | { |
@@ -572,27 +593,10 @@ nv20_graph_init(struct drm_device *dev) | |||
572 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA , 0x00000030); | 593 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA , 0x00000030); |
573 | } | 594 | } |
574 | 595 | ||
575 | /* copy tile info from PFB */ | 596 | /* Turn all the tiling regions off. */ |
576 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | 597 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) |
577 | nv_wr32(dev, 0x00400904 + i * 0x10, | 598 | nv20_graph_set_region_tiling(dev, i, 0, 0, 0); |
578 | nv_rd32(dev, NV10_PFB_TLIMIT(i))); | 599 | |
579 | /* which is NV40_PGRAPH_TLIMIT0(i) ?? */ | ||
580 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0030 + i * 4); | ||
581 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, | ||
582 | nv_rd32(dev, NV10_PFB_TLIMIT(i))); | ||
583 | nv_wr32(dev, 0x00400908 + i * 0x10, | ||
584 | nv_rd32(dev, NV10_PFB_TSIZE(i))); | ||
585 | /* which is NV40_PGRAPH_TSIZE0(i) ?? */ | ||
586 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0050 + i * 4); | ||
587 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, | ||
588 | nv_rd32(dev, NV10_PFB_TSIZE(i))); | ||
589 | nv_wr32(dev, 0x00400900 + i * 0x10, | ||
590 | nv_rd32(dev, NV10_PFB_TILE(i))); | ||
591 | /* which is NV40_PGRAPH_TILE0(i) ?? */ | ||
592 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0010 + i * 4); | ||
593 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, | ||
594 | nv_rd32(dev, NV10_PFB_TILE(i))); | ||
595 | } | ||
596 | for (i = 0; i < 8; i++) { | 600 | for (i = 0; i < 8; i++) { |
597 | nv_wr32(dev, 0x400980 + i * 4, nv_rd32(dev, 0x100300 + i * 4)); | 601 | nv_wr32(dev, 0x400980 + i * 4, nv_rd32(dev, 0x100300 + i * 4)); |
598 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0090 + i * 4); | 602 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0090 + i * 4); |
@@ -704,18 +708,9 @@ nv30_graph_init(struct drm_device *dev) | |||
704 | 708 | ||
705 | nv_wr32(dev, 0x4000c0, 0x00000016); | 709 | nv_wr32(dev, 0x4000c0, 0x00000016); |
706 | 710 | ||
707 | /* copy tile info from PFB */ | 711 | /* Turn all the tiling regions off. */ |
708 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | 712 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) |
709 | nv_wr32(dev, 0x00400904 + i * 0x10, | 713 | nv20_graph_set_region_tiling(dev, i, 0, 0, 0); |
710 | nv_rd32(dev, NV10_PFB_TLIMIT(i))); | ||
711 | /* which is NV40_PGRAPH_TLIMIT0(i) ?? */ | ||
712 | nv_wr32(dev, 0x00400908 + i * 0x10, | ||
713 | nv_rd32(dev, NV10_PFB_TSIZE(i))); | ||
714 | /* which is NV40_PGRAPH_TSIZE0(i) ?? */ | ||
715 | nv_wr32(dev, 0x00400900 + i * 0x10, | ||
716 | nv_rd32(dev, NV10_PFB_TILE(i))); | ||
717 | /* which is NV40_PGRAPH_TILE0(i) ?? */ | ||
718 | } | ||
719 | 714 | ||
720 | nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10000100); | 715 | nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10000100); |
721 | nv_wr32(dev, NV10_PGRAPH_STATE , 0xFFFFFFFF); | 716 | nv_wr32(dev, NV10_PGRAPH_STATE , 0xFFFFFFFF); |
diff --git a/drivers/gpu/drm/nouveau/nv40_fb.c b/drivers/gpu/drm/nouveau/nv40_fb.c index ca1d27107a8e..3cd07d8d5bd7 100644 --- a/drivers/gpu/drm/nouveau/nv40_fb.c +++ b/drivers/gpu/drm/nouveau/nv40_fb.c | |||
@@ -3,12 +3,37 @@ | |||
3 | #include "nouveau_drv.h" | 3 | #include "nouveau_drv.h" |
4 | #include "nouveau_drm.h" | 4 | #include "nouveau_drm.h" |
5 | 5 | ||
6 | void | ||
7 | nv40_fb_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
8 | uint32_t size, uint32_t pitch) | ||
9 | { | ||
10 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
11 | uint32_t limit = max(1u, addr + size) - 1; | ||
12 | |||
13 | if (pitch) | ||
14 | addr |= 1; | ||
15 | |||
16 | switch (dev_priv->chipset) { | ||
17 | case 0x40: | ||
18 | nv_wr32(dev, NV10_PFB_TLIMIT(i), limit); | ||
19 | nv_wr32(dev, NV10_PFB_TSIZE(i), pitch); | ||
20 | nv_wr32(dev, NV10_PFB_TILE(i), addr); | ||
21 | break; | ||
22 | |||
23 | default: | ||
24 | nv_wr32(dev, NV40_PFB_TLIMIT(i), limit); | ||
25 | nv_wr32(dev, NV40_PFB_TSIZE(i), pitch); | ||
26 | nv_wr32(dev, NV40_PFB_TILE(i), addr); | ||
27 | break; | ||
28 | } | ||
29 | } | ||
30 | |||
6 | int | 31 | int |
7 | nv40_fb_init(struct drm_device *dev) | 32 | nv40_fb_init(struct drm_device *dev) |
8 | { | 33 | { |
9 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 34 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
10 | uint32_t fb_bar_size, tmp; | 35 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; |
11 | int num_tiles; | 36 | uint32_t tmp; |
12 | int i; | 37 | int i; |
13 | 38 | ||
14 | /* This is strictly a NV4x register (don't know about NV5x). */ | 39 | /* This is strictly a NV4x register (don't know about NV5x). */ |
@@ -23,35 +48,23 @@ nv40_fb_init(struct drm_device *dev) | |||
23 | case 0x45: | 48 | case 0x45: |
24 | tmp = nv_rd32(dev, NV10_PFB_CLOSE_PAGE2); | 49 | tmp = nv_rd32(dev, NV10_PFB_CLOSE_PAGE2); |
25 | nv_wr32(dev, NV10_PFB_CLOSE_PAGE2, tmp & ~(1 << 15)); | 50 | nv_wr32(dev, NV10_PFB_CLOSE_PAGE2, tmp & ~(1 << 15)); |
26 | num_tiles = NV10_PFB_TILE__SIZE; | 51 | pfb->num_tiles = NV10_PFB_TILE__SIZE; |
27 | break; | 52 | break; |
28 | case 0x46: /* G72 */ | 53 | case 0x46: /* G72 */ |
29 | case 0x47: /* G70 */ | 54 | case 0x47: /* G70 */ |
30 | case 0x49: /* G71 */ | 55 | case 0x49: /* G71 */ |
31 | case 0x4b: /* G73 */ | 56 | case 0x4b: /* G73 */ |
32 | case 0x4c: /* C51 (G7X version) */ | 57 | case 0x4c: /* C51 (G7X version) */ |
33 | num_tiles = NV40_PFB_TILE__SIZE_1; | 58 | pfb->num_tiles = NV40_PFB_TILE__SIZE_1; |
34 | break; | 59 | break; |
35 | default: | 60 | default: |
36 | num_tiles = NV40_PFB_TILE__SIZE_0; | 61 | pfb->num_tiles = NV40_PFB_TILE__SIZE_0; |
37 | break; | 62 | break; |
38 | } | 63 | } |
39 | 64 | ||
40 | fb_bar_size = drm_get_resource_len(dev, 0) - 1; | 65 | /* Turn all the tiling regions off. */ |
41 | switch (dev_priv->chipset) { | 66 | for (i = 0; i < pfb->num_tiles; i++) |
42 | case 0x40: | 67 | pfb->set_region_tiling(dev, i, 0, 0, 0); |
43 | for (i = 0; i < num_tiles; i++) { | ||
44 | nv_wr32(dev, NV10_PFB_TILE(i), 0); | ||
45 | nv_wr32(dev, NV10_PFB_TLIMIT(i), fb_bar_size); | ||
46 | } | ||
47 | break; | ||
48 | default: | ||
49 | for (i = 0; i < num_tiles; i++) { | ||
50 | nv_wr32(dev, NV40_PFB_TILE(i), 0); | ||
51 | nv_wr32(dev, NV40_PFB_TLIMIT(i), fb_bar_size); | ||
52 | } | ||
53 | break; | ||
54 | } | ||
55 | 68 | ||
56 | return 0; | 69 | return 0; |
57 | } | 70 | } |
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c index 2b332bb55acf..53e8afe1dcd1 100644 --- a/drivers/gpu/drm/nouveau/nv40_graph.c +++ b/drivers/gpu/drm/nouveau/nv40_graph.c | |||
@@ -181,6 +181,48 @@ nv40_graph_unload_context(struct drm_device *dev) | |||
181 | return ret; | 181 | return ret; |
182 | } | 182 | } |
183 | 183 | ||
184 | void | ||
185 | nv40_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
186 | uint32_t size, uint32_t pitch) | ||
187 | { | ||
188 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
189 | uint32_t limit = max(1u, addr + size) - 1; | ||
190 | |||
191 | if (pitch) | ||
192 | addr |= 1; | ||
193 | |||
194 | switch (dev_priv->chipset) { | ||
195 | case 0x44: | ||
196 | case 0x4a: | ||
197 | case 0x4e: | ||
198 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), pitch); | ||
199 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), limit); | ||
200 | nv_wr32(dev, NV20_PGRAPH_TILE(i), addr); | ||
201 | break; | ||
202 | |||
203 | case 0x46: | ||
204 | case 0x47: | ||
205 | case 0x49: | ||
206 | case 0x4b: | ||
207 | nv_wr32(dev, NV47_PGRAPH_TSIZE(i), pitch); | ||
208 | nv_wr32(dev, NV47_PGRAPH_TLIMIT(i), limit); | ||
209 | nv_wr32(dev, NV47_PGRAPH_TILE(i), addr); | ||
210 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), pitch); | ||
211 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), limit); | ||
212 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), addr); | ||
213 | break; | ||
214 | |||
215 | default: | ||
216 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), pitch); | ||
217 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), limit); | ||
218 | nv_wr32(dev, NV20_PGRAPH_TILE(i), addr); | ||
219 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), pitch); | ||
220 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), limit); | ||
221 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), addr); | ||
222 | break; | ||
223 | } | ||
224 | } | ||
225 | |||
184 | /* | 226 | /* |
185 | * G70 0x47 | 227 | * G70 0x47 |
186 | * G71 0x49 | 228 | * G71 0x49 |
@@ -195,7 +237,8 @@ nv40_graph_init(struct drm_device *dev) | |||
195 | { | 237 | { |
196 | struct drm_nouveau_private *dev_priv = | 238 | struct drm_nouveau_private *dev_priv = |
197 | (struct drm_nouveau_private *)dev->dev_private; | 239 | (struct drm_nouveau_private *)dev->dev_private; |
198 | uint32_t vramsz, tmp; | 240 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; |
241 | uint32_t vramsz; | ||
199 | int i, j; | 242 | int i, j; |
200 | 243 | ||
201 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & | 244 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & |
@@ -292,74 +335,9 @@ nv40_graph_init(struct drm_device *dev) | |||
292 | nv_wr32(dev, 0x400b38, 0x2ffff800); | 335 | nv_wr32(dev, 0x400b38, 0x2ffff800); |
293 | nv_wr32(dev, 0x400b3c, 0x00006000); | 336 | nv_wr32(dev, 0x400b3c, 0x00006000); |
294 | 337 | ||
295 | /* copy tile info from PFB */ | 338 | /* Turn all the tiling regions off. */ |
296 | switch (dev_priv->chipset) { | 339 | for (i = 0; i < pfb->num_tiles; i++) |
297 | case 0x40: /* vanilla NV40 */ | 340 | nv40_graph_set_region_tiling(dev, i, 0, 0, 0); |
298 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | ||
299 | tmp = nv_rd32(dev, NV10_PFB_TILE(i)); | ||
300 | nv_wr32(dev, NV40_PGRAPH_TILE0(i), tmp); | ||
301 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tmp); | ||
302 | tmp = nv_rd32(dev, NV10_PFB_TLIMIT(i)); | ||
303 | nv_wr32(dev, NV40_PGRAPH_TLIMIT0(i), tmp); | ||
304 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tmp); | ||
305 | tmp = nv_rd32(dev, NV10_PFB_TSIZE(i)); | ||
306 | nv_wr32(dev, NV40_PGRAPH_TSIZE0(i), tmp); | ||
307 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tmp); | ||
308 | tmp = nv_rd32(dev, NV10_PFB_TSTATUS(i)); | ||
309 | nv_wr32(dev, NV40_PGRAPH_TSTATUS0(i), tmp); | ||
310 | nv_wr32(dev, NV40_PGRAPH_TSTATUS1(i), tmp); | ||
311 | } | ||
312 | break; | ||
313 | case 0x44: | ||
314 | case 0x4a: | ||
315 | case 0x4e: /* NV44-based cores don't have 0x406900? */ | ||
316 | for (i = 0; i < NV40_PFB_TILE__SIZE_0; i++) { | ||
317 | tmp = nv_rd32(dev, NV40_PFB_TILE(i)); | ||
318 | nv_wr32(dev, NV40_PGRAPH_TILE0(i), tmp); | ||
319 | tmp = nv_rd32(dev, NV40_PFB_TLIMIT(i)); | ||
320 | nv_wr32(dev, NV40_PGRAPH_TLIMIT0(i), tmp); | ||
321 | tmp = nv_rd32(dev, NV40_PFB_TSIZE(i)); | ||
322 | nv_wr32(dev, NV40_PGRAPH_TSIZE0(i), tmp); | ||
323 | tmp = nv_rd32(dev, NV40_PFB_TSTATUS(i)); | ||
324 | nv_wr32(dev, NV40_PGRAPH_TSTATUS0(i), tmp); | ||
325 | } | ||
326 | break; | ||
327 | case 0x46: | ||
328 | case 0x47: | ||
329 | case 0x49: | ||
330 | case 0x4b: /* G7X-based cores */ | ||
331 | for (i = 0; i < NV40_PFB_TILE__SIZE_1; i++) { | ||
332 | tmp = nv_rd32(dev, NV40_PFB_TILE(i)); | ||
333 | nv_wr32(dev, NV47_PGRAPH_TILE0(i), tmp); | ||
334 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tmp); | ||
335 | tmp = nv_rd32(dev, NV40_PFB_TLIMIT(i)); | ||
336 | nv_wr32(dev, NV47_PGRAPH_TLIMIT0(i), tmp); | ||
337 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tmp); | ||
338 | tmp = nv_rd32(dev, NV40_PFB_TSIZE(i)); | ||
339 | nv_wr32(dev, NV47_PGRAPH_TSIZE0(i), tmp); | ||
340 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tmp); | ||
341 | tmp = nv_rd32(dev, NV40_PFB_TSTATUS(i)); | ||
342 | nv_wr32(dev, NV47_PGRAPH_TSTATUS0(i), tmp); | ||
343 | nv_wr32(dev, NV40_PGRAPH_TSTATUS1(i), tmp); | ||
344 | } | ||
345 | break; | ||
346 | default: /* everything else */ | ||
347 | for (i = 0; i < NV40_PFB_TILE__SIZE_0; i++) { | ||
348 | tmp = nv_rd32(dev, NV40_PFB_TILE(i)); | ||
349 | nv_wr32(dev, NV40_PGRAPH_TILE0(i), tmp); | ||
350 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tmp); | ||
351 | tmp = nv_rd32(dev, NV40_PFB_TLIMIT(i)); | ||
352 | nv_wr32(dev, NV40_PGRAPH_TLIMIT0(i), tmp); | ||
353 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tmp); | ||
354 | tmp = nv_rd32(dev, NV40_PFB_TSIZE(i)); | ||
355 | nv_wr32(dev, NV40_PGRAPH_TSIZE0(i), tmp); | ||
356 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tmp); | ||
357 | tmp = nv_rd32(dev, NV40_PFB_TSTATUS(i)); | ||
358 | nv_wr32(dev, NV40_PGRAPH_TSTATUS0(i), tmp); | ||
359 | nv_wr32(dev, NV40_PGRAPH_TSTATUS1(i), tmp); | ||
360 | } | ||
361 | break; | ||
362 | } | ||
363 | 341 | ||
364 | /* begin RAM config */ | 342 | /* begin RAM config */ |
365 | vramsz = drm_get_resource_len(dev, 0) - 1; | 343 | vramsz = drm_get_resource_len(dev, 0) - 1; |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index a9263d92a231..90f0bf59fbcd 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -690,9 +690,21 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent, | |||
690 | int pxclk) | 690 | int pxclk) |
691 | { | 691 | { |
692 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 692 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
693 | struct nouveau_connector *nv_connector = NULL; | ||
694 | struct drm_encoder *encoder; | ||
693 | struct nvbios *bios = &dev_priv->VBIOS; | 695 | struct nvbios *bios = &dev_priv->VBIOS; |
694 | uint32_t mc, script = 0, or; | 696 | uint32_t mc, script = 0, or; |
695 | 697 | ||
698 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
699 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); | ||
700 | |||
701 | if (nv_encoder->dcb != dcbent) | ||
702 | continue; | ||
703 | |||
704 | nv_connector = nouveau_encoder_connector_get(nv_encoder); | ||
705 | break; | ||
706 | } | ||
707 | |||
696 | or = ffs(dcbent->or) - 1; | 708 | or = ffs(dcbent->or) - 1; |
697 | mc = nv50_display_mode_ctrl(dev, dcbent->type != OUTPUT_ANALOG, or); | 709 | mc = nv50_display_mode_ctrl(dev, dcbent->type != OUTPUT_ANALOG, or); |
698 | switch (dcbent->type) { | 710 | switch (dcbent->type) { |
@@ -711,6 +723,11 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent, | |||
711 | } else | 723 | } else |
712 | if (bios->fp.strapless_is_24bit & 1) | 724 | if (bios->fp.strapless_is_24bit & 1) |
713 | script |= 0x0200; | 725 | script |= 0x0200; |
726 | |||
727 | if (nv_connector && nv_connector->edid && | ||
728 | (nv_connector->edid->revision >= 4) && | ||
729 | (nv_connector->edid->input & 0x70) >= 0x20) | ||
730 | script |= 0x0200; | ||
714 | } | 731 | } |
715 | 732 | ||
716 | if (nouveau_uscript_lvds >= 0) { | 733 | if (nouveau_uscript_lvds >= 0) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_fbcon.c b/drivers/gpu/drm/nouveau/nv50_fbcon.c index 6bcc6d39e9b0..e4f279ee61cf 100644 --- a/drivers/gpu/drm/nouveau/nv50_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv50_fbcon.c | |||
@@ -16,9 +16,7 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
16 | 16 | ||
17 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && | 17 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && |
18 | RING_SPACE(chan, rect->rop == ROP_COPY ? 7 : 11)) { | 18 | RING_SPACE(chan, rect->rop == ROP_COPY ? 7 : 11)) { |
19 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 19 | nouveau_fbcon_gpu_lockup(info); |
20 | |||
21 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
22 | } | 20 | } |
23 | 21 | ||
24 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 22 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -31,7 +29,11 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
31 | OUT_RING(chan, 1); | 29 | OUT_RING(chan, 1); |
32 | } | 30 | } |
33 | BEGIN_RING(chan, NvSub2D, 0x0588, 1); | 31 | BEGIN_RING(chan, NvSub2D, 0x0588, 1); |
34 | OUT_RING(chan, rect->color); | 32 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || |
33 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) | ||
34 | OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]); | ||
35 | else | ||
36 | OUT_RING(chan, rect->color); | ||
35 | BEGIN_RING(chan, NvSub2D, 0x0600, 4); | 37 | BEGIN_RING(chan, NvSub2D, 0x0600, 4); |
36 | OUT_RING(chan, rect->dx); | 38 | OUT_RING(chan, rect->dx); |
37 | OUT_RING(chan, rect->dy); | 39 | OUT_RING(chan, rect->dy); |
@@ -56,9 +58,7 @@ nv50_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) | |||
56 | return; | 58 | return; |
57 | 59 | ||
58 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 12)) { | 60 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 12)) { |
59 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 61 | nouveau_fbcon_gpu_lockup(info); |
60 | |||
61 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
62 | } | 62 | } |
63 | 63 | ||
64 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 64 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -101,8 +101,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
101 | } | 101 | } |
102 | 102 | ||
103 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 11)) { | 103 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 11)) { |
104 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 104 | nouveau_fbcon_gpu_lockup(info); |
105 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
106 | } | 105 | } |
107 | 106 | ||
108 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 107 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -135,9 +134,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
135 | int push = dwords > 2047 ? 2047 : dwords; | 134 | int push = dwords > 2047 ? 2047 : dwords; |
136 | 135 | ||
137 | if (RING_SPACE(chan, push + 1)) { | 136 | if (RING_SPACE(chan, push + 1)) { |
138 | NV_ERROR(dev, | 137 | nouveau_fbcon_gpu_lockup(info); |
139 | "GPU lockup - switching to software fbcon\n"); | ||
140 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
141 | cfb_imageblit(info, image); | 138 | cfb_imageblit(info, image); |
142 | return; | 139 | return; |
143 | } | 140 | } |
@@ -199,7 +196,7 @@ nv50_fbcon_accel_init(struct fb_info *info) | |||
199 | 196 | ||
200 | ret = RING_SPACE(chan, 59); | 197 | ret = RING_SPACE(chan, 59); |
201 | if (ret) { | 198 | if (ret) { |
202 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 199 | nouveau_fbcon_gpu_lockup(info); |
203 | return ret; | 200 | return ret; |
204 | } | 201 | } |
205 | 202 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_fifo.c b/drivers/gpu/drm/nouveau/nv50_fifo.c index b7282284f080..39caf167587d 100644 --- a/drivers/gpu/drm/nouveau/nv50_fifo.c +++ b/drivers/gpu/drm/nouveau/nv50_fifo.c | |||
@@ -384,8 +384,8 @@ nv50_fifo_load_context(struct nouveau_channel *chan) | |||
384 | nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr), | 384 | nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr), |
385 | nv_ro32(dev, cache, (ptr * 2) + 1)); | 385 | nv_ro32(dev, cache, (ptr * 2) + 1)); |
386 | } | 386 | } |
387 | nv_wr32(dev, 0x3210, cnt << 2); | 387 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, cnt << 2); |
388 | nv_wr32(dev, 0x3270, 0); | 388 | nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0); |
389 | 389 | ||
390 | /* guessing that all the 0x34xx regs aren't on NV50 */ | 390 | /* guessing that all the 0x34xx regs aren't on NV50 */ |
391 | if (!IS_G80) { | 391 | if (!IS_G80) { |
@@ -398,8 +398,6 @@ nv50_fifo_load_context(struct nouveau_channel *chan) | |||
398 | 398 | ||
399 | dev_priv->engine.instmem.finish_access(dev); | 399 | dev_priv->engine.instmem.finish_access(dev); |
400 | 400 | ||
401 | nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0); | ||
402 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, 0); | ||
403 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16)); | 401 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16)); |
404 | return 0; | 402 | return 0; |
405 | } | 403 | } |
diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index b5f5fe75e6af..1cc7b937b1ea 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile | |||
@@ -24,6 +24,9 @@ $(obj)/rv515_reg_safe.h: $(src)/reg_srcs/rv515 $(obj)/mkregtable | |||
24 | $(obj)/r300_reg_safe.h: $(src)/reg_srcs/r300 $(obj)/mkregtable | 24 | $(obj)/r300_reg_safe.h: $(src)/reg_srcs/r300 $(obj)/mkregtable |
25 | $(call if_changed,mkregtable) | 25 | $(call if_changed,mkregtable) |
26 | 26 | ||
27 | $(obj)/r420_reg_safe.h: $(src)/reg_srcs/r420 $(obj)/mkregtable | ||
28 | $(call if_changed,mkregtable) | ||
29 | |||
27 | $(obj)/rs600_reg_safe.h: $(src)/reg_srcs/rs600 $(obj)/mkregtable | 30 | $(obj)/rs600_reg_safe.h: $(src)/reg_srcs/rs600 $(obj)/mkregtable |
28 | $(call if_changed,mkregtable) | 31 | $(call if_changed,mkregtable) |
29 | 32 | ||
@@ -35,6 +38,8 @@ $(obj)/rv515.o: $(obj)/rv515_reg_safe.h | |||
35 | 38 | ||
36 | $(obj)/r300.o: $(obj)/r300_reg_safe.h | 39 | $(obj)/r300.o: $(obj)/r300_reg_safe.h |
37 | 40 | ||
41 | $(obj)/r420.o: $(obj)/r420_reg_safe.h | ||
42 | |||
38 | $(obj)/rs600.o: $(obj)/rs600_reg_safe.h | 43 | $(obj)/rs600.o: $(obj)/rs600_reg_safe.h |
39 | 44 | ||
40 | radeon-y := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o \ | 45 | radeon-y := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o \ |
diff --git a/drivers/gpu/drm/radeon/ObjectID.h b/drivers/gpu/drm/radeon/ObjectID.h index 6d0183c61d3b..c714179d1bfa 100644 --- a/drivers/gpu/drm/radeon/ObjectID.h +++ b/drivers/gpu/drm/radeon/ObjectID.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2006-2007 Advanced Micro Devices, Inc. | 2 | * Copyright 2006-2007 Advanced Micro Devices, Inc. |
3 | * | 3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), | 5 | * copy of this software and associated documentation files (the "Software"), |
@@ -41,14 +41,14 @@ | |||
41 | /****************************************************/ | 41 | /****************************************************/ |
42 | /* Encoder Object ID Definition */ | 42 | /* Encoder Object ID Definition */ |
43 | /****************************************************/ | 43 | /****************************************************/ |
44 | #define ENCODER_OBJECT_ID_NONE 0x00 | 44 | #define ENCODER_OBJECT_ID_NONE 0x00 |
45 | 45 | ||
46 | /* Radeon Class Display Hardware */ | 46 | /* Radeon Class Display Hardware */ |
47 | #define ENCODER_OBJECT_ID_INTERNAL_LVDS 0x01 | 47 | #define ENCODER_OBJECT_ID_INTERNAL_LVDS 0x01 |
48 | #define ENCODER_OBJECT_ID_INTERNAL_TMDS1 0x02 | 48 | #define ENCODER_OBJECT_ID_INTERNAL_TMDS1 0x02 |
49 | #define ENCODER_OBJECT_ID_INTERNAL_TMDS2 0x03 | 49 | #define ENCODER_OBJECT_ID_INTERNAL_TMDS2 0x03 |
50 | #define ENCODER_OBJECT_ID_INTERNAL_DAC1 0x04 | 50 | #define ENCODER_OBJECT_ID_INTERNAL_DAC1 0x04 |
51 | #define ENCODER_OBJECT_ID_INTERNAL_DAC2 0x05 /* TV/CV DAC */ | 51 | #define ENCODER_OBJECT_ID_INTERNAL_DAC2 0x05 /* TV/CV DAC */ |
52 | #define ENCODER_OBJECT_ID_INTERNAL_SDVOA 0x06 | 52 | #define ENCODER_OBJECT_ID_INTERNAL_SDVOA 0x06 |
53 | #define ENCODER_OBJECT_ID_INTERNAL_SDVOB 0x07 | 53 | #define ENCODER_OBJECT_ID_INTERNAL_SDVOB 0x07 |
54 | 54 | ||
@@ -56,11 +56,11 @@ | |||
56 | #define ENCODER_OBJECT_ID_SI170B 0x08 | 56 | #define ENCODER_OBJECT_ID_SI170B 0x08 |
57 | #define ENCODER_OBJECT_ID_CH7303 0x09 | 57 | #define ENCODER_OBJECT_ID_CH7303 0x09 |
58 | #define ENCODER_OBJECT_ID_CH7301 0x0A | 58 | #define ENCODER_OBJECT_ID_CH7301 0x0A |
59 | #define ENCODER_OBJECT_ID_INTERNAL_DVO1 0x0B /* This belongs to Radeon Class Display Hardware */ | 59 | #define ENCODER_OBJECT_ID_INTERNAL_DVO1 0x0B /* This belongs to Radeon Class Display Hardware */ |
60 | #define ENCODER_OBJECT_ID_EXTERNAL_SDVOA 0x0C | 60 | #define ENCODER_OBJECT_ID_EXTERNAL_SDVOA 0x0C |
61 | #define ENCODER_OBJECT_ID_EXTERNAL_SDVOB 0x0D | 61 | #define ENCODER_OBJECT_ID_EXTERNAL_SDVOB 0x0D |
62 | #define ENCODER_OBJECT_ID_TITFP513 0x0E | 62 | #define ENCODER_OBJECT_ID_TITFP513 0x0E |
63 | #define ENCODER_OBJECT_ID_INTERNAL_LVTM1 0x0F /* not used for Radeon */ | 63 | #define ENCODER_OBJECT_ID_INTERNAL_LVTM1 0x0F /* not used for Radeon */ |
64 | #define ENCODER_OBJECT_ID_VT1623 0x10 | 64 | #define ENCODER_OBJECT_ID_VT1623 0x10 |
65 | #define ENCODER_OBJECT_ID_HDMI_SI1930 0x11 | 65 | #define ENCODER_OBJECT_ID_HDMI_SI1930 0x11 |
66 | #define ENCODER_OBJECT_ID_HDMI_INTERNAL 0x12 | 66 | #define ENCODER_OBJECT_ID_HDMI_INTERNAL 0x12 |
@@ -68,9 +68,9 @@ | |||
68 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 0x13 | 68 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 0x13 |
69 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 0x14 | 69 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 0x14 |
70 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 0x15 | 70 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 0x15 |
71 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 0x16 /* Shared with CV/TV and CRT */ | 71 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 0x16 /* Shared with CV/TV and CRT */ |
72 | #define ENCODER_OBJECT_ID_SI178 0X17 /* External TMDS (dual link, no HDCP.) */ | 72 | #define ENCODER_OBJECT_ID_SI178 0X17 /* External TMDS (dual link, no HDCP.) */ |
73 | #define ENCODER_OBJECT_ID_MVPU_FPGA 0x18 /* MVPU FPGA chip */ | 73 | #define ENCODER_OBJECT_ID_MVPU_FPGA 0x18 /* MVPU FPGA chip */ |
74 | #define ENCODER_OBJECT_ID_INTERNAL_DDI 0x19 | 74 | #define ENCODER_OBJECT_ID_INTERNAL_DDI 0x19 |
75 | #define ENCODER_OBJECT_ID_VT1625 0x1A | 75 | #define ENCODER_OBJECT_ID_VT1625 0x1A |
76 | #define ENCODER_OBJECT_ID_HDMI_SI1932 0x1B | 76 | #define ENCODER_OBJECT_ID_HDMI_SI1932 0x1B |
@@ -86,7 +86,7 @@ | |||
86 | /****************************************************/ | 86 | /****************************************************/ |
87 | /* Connector Object ID Definition */ | 87 | /* Connector Object ID Definition */ |
88 | /****************************************************/ | 88 | /****************************************************/ |
89 | #define CONNECTOR_OBJECT_ID_NONE 0x00 | 89 | #define CONNECTOR_OBJECT_ID_NONE 0x00 |
90 | #define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I 0x01 | 90 | #define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I 0x01 |
91 | #define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I 0x02 | 91 | #define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I 0x02 |
92 | #define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D 0x03 | 92 | #define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D 0x03 |
@@ -96,7 +96,7 @@ | |||
96 | #define CONNECTOR_OBJECT_ID_SVIDEO 0x07 | 96 | #define CONNECTOR_OBJECT_ID_SVIDEO 0x07 |
97 | #define CONNECTOR_OBJECT_ID_YPbPr 0x08 | 97 | #define CONNECTOR_OBJECT_ID_YPbPr 0x08 |
98 | #define CONNECTOR_OBJECT_ID_D_CONNECTOR 0x09 | 98 | #define CONNECTOR_OBJECT_ID_D_CONNECTOR 0x09 |
99 | #define CONNECTOR_OBJECT_ID_9PIN_DIN 0x0A /* Supports both CV & TV */ | 99 | #define CONNECTOR_OBJECT_ID_9PIN_DIN 0x0A /* Supports both CV & TV */ |
100 | #define CONNECTOR_OBJECT_ID_SCART 0x0B | 100 | #define CONNECTOR_OBJECT_ID_SCART 0x0B |
101 | #define CONNECTOR_OBJECT_ID_HDMI_TYPE_A 0x0C | 101 | #define CONNECTOR_OBJECT_ID_HDMI_TYPE_A 0x0C |
102 | #define CONNECTOR_OBJECT_ID_HDMI_TYPE_B 0x0D | 102 | #define CONNECTOR_OBJECT_ID_HDMI_TYPE_B 0x0D |
@@ -106,6 +106,8 @@ | |||
106 | #define CONNECTOR_OBJECT_ID_CROSSFIRE 0x11 | 106 | #define CONNECTOR_OBJECT_ID_CROSSFIRE 0x11 |
107 | #define CONNECTOR_OBJECT_ID_HARDCODE_DVI 0x12 | 107 | #define CONNECTOR_OBJECT_ID_HARDCODE_DVI 0x12 |
108 | #define CONNECTOR_OBJECT_ID_DISPLAYPORT 0x13 | 108 | #define CONNECTOR_OBJECT_ID_DISPLAYPORT 0x13 |
109 | #define CONNECTOR_OBJECT_ID_eDP 0x14 | ||
110 | #define CONNECTOR_OBJECT_ID_MXM 0x15 | ||
109 | 111 | ||
110 | /* deleted */ | 112 | /* deleted */ |
111 | 113 | ||
@@ -116,6 +118,14 @@ | |||
116 | #define ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL 0x01 | 118 | #define ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL 0x01 |
117 | 119 | ||
118 | /****************************************************/ | 120 | /****************************************************/ |
121 | /* Generic Object ID Definition */ | ||
122 | /****************************************************/ | ||
123 | #define GENERIC_OBJECT_ID_NONE 0x00 | ||
124 | #define GENERIC_OBJECT_ID_GLSYNC 0x01 | ||
125 | #define GENERIC_OBJECT_ID_PX2_NON_DRIVABLE 0x02 | ||
126 | #define GENERIC_OBJECT_ID_MXM_OPM 0x03 | ||
127 | |||
128 | /****************************************************/ | ||
119 | /* Graphics Object ENUM ID Definition */ | 129 | /* Graphics Object ENUM ID Definition */ |
120 | /****************************************************/ | 130 | /****************************************************/ |
121 | #define GRAPH_OBJECT_ENUM_ID1 0x01 | 131 | #define GRAPH_OBJECT_ENUM_ID1 0x01 |
@@ -124,6 +134,7 @@ | |||
124 | #define GRAPH_OBJECT_ENUM_ID4 0x04 | 134 | #define GRAPH_OBJECT_ENUM_ID4 0x04 |
125 | #define GRAPH_OBJECT_ENUM_ID5 0x05 | 135 | #define GRAPH_OBJECT_ENUM_ID5 0x05 |
126 | #define GRAPH_OBJECT_ENUM_ID6 0x06 | 136 | #define GRAPH_OBJECT_ENUM_ID6 0x06 |
137 | #define GRAPH_OBJECT_ENUM_ID7 0x07 | ||
127 | 138 | ||
128 | /****************************************************/ | 139 | /****************************************************/ |
129 | /* Graphics Object ID Bit definition */ | 140 | /* Graphics Object ID Bit definition */ |
@@ -133,35 +144,35 @@ | |||
133 | #define RESERVED1_ID_MASK 0x0800 | 144 | #define RESERVED1_ID_MASK 0x0800 |
134 | #define OBJECT_TYPE_MASK 0x7000 | 145 | #define OBJECT_TYPE_MASK 0x7000 |
135 | #define RESERVED2_ID_MASK 0x8000 | 146 | #define RESERVED2_ID_MASK 0x8000 |
136 | 147 | ||
137 | #define OBJECT_ID_SHIFT 0x00 | 148 | #define OBJECT_ID_SHIFT 0x00 |
138 | #define ENUM_ID_SHIFT 0x08 | 149 | #define ENUM_ID_SHIFT 0x08 |
139 | #define OBJECT_TYPE_SHIFT 0x0C | 150 | #define OBJECT_TYPE_SHIFT 0x0C |
140 | 151 | ||
152 | |||
141 | /****************************************************/ | 153 | /****************************************************/ |
142 | /* Graphics Object family definition */ | 154 | /* Graphics Object family definition */ |
143 | /****************************************************/ | 155 | /****************************************************/ |
144 | #define CONSTRUCTOBJECTFAMILYID(GRAPHICS_OBJECT_TYPE, GRAPHICS_OBJECT_ID) \ | 156 | #define CONSTRUCTOBJECTFAMILYID(GRAPHICS_OBJECT_TYPE, GRAPHICS_OBJECT_ID) (GRAPHICS_OBJECT_TYPE << OBJECT_TYPE_SHIFT | \ |
145 | (GRAPHICS_OBJECT_TYPE << OBJECT_TYPE_SHIFT | \ | 157 | GRAPHICS_OBJECT_ID << OBJECT_ID_SHIFT) |
146 | GRAPHICS_OBJECT_ID << OBJECT_ID_SHIFT) | ||
147 | /****************************************************/ | 158 | /****************************************************/ |
148 | /* GPU Object ID definition - Shared with BIOS */ | 159 | /* GPU Object ID definition - Shared with BIOS */ |
149 | /****************************************************/ | 160 | /****************************************************/ |
150 | #define GPU_ENUM_ID1 (GRAPH_OBJECT_TYPE_GPU << OBJECT_TYPE_SHIFT |\ | 161 | #define GPU_ENUM_ID1 ( GRAPH_OBJECT_TYPE_GPU << OBJECT_TYPE_SHIFT |\ |
151 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT) | 162 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT) |
152 | 163 | ||
153 | /****************************************************/ | 164 | /****************************************************/ |
154 | /* Encoder Object ID definition - Shared with BIOS */ | 165 | /* Encoder Object ID definition - Shared with BIOS */ |
155 | /****************************************************/ | 166 | /****************************************************/ |
156 | /* | 167 | /* |
157 | #define ENCODER_INTERNAL_LVDS_ENUM_ID1 0x2101 | 168 | #define ENCODER_INTERNAL_LVDS_ENUM_ID1 0x2101 |
158 | #define ENCODER_INTERNAL_TMDS1_ENUM_ID1 0x2102 | 169 | #define ENCODER_INTERNAL_TMDS1_ENUM_ID1 0x2102 |
159 | #define ENCODER_INTERNAL_TMDS2_ENUM_ID1 0x2103 | 170 | #define ENCODER_INTERNAL_TMDS2_ENUM_ID1 0x2103 |
160 | #define ENCODER_INTERNAL_DAC1_ENUM_ID1 0x2104 | 171 | #define ENCODER_INTERNAL_DAC1_ENUM_ID1 0x2104 |
161 | #define ENCODER_INTERNAL_DAC2_ENUM_ID1 0x2105 | 172 | #define ENCODER_INTERNAL_DAC2_ENUM_ID1 0x2105 |
162 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID1 0x2106 | 173 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID1 0x2106 |
163 | #define ENCODER_INTERNAL_SDVOB_ENUM_ID1 0x2107 | 174 | #define ENCODER_INTERNAL_SDVOB_ENUM_ID1 0x2107 |
164 | #define ENCODER_SIL170B_ENUM_ID1 0x2108 | 175 | #define ENCODER_SIL170B_ENUM_ID1 0x2108 |
165 | #define ENCODER_CH7303_ENUM_ID1 0x2109 | 176 | #define ENCODER_CH7303_ENUM_ID1 0x2109 |
166 | #define ENCODER_CH7301_ENUM_ID1 0x210A | 177 | #define ENCODER_CH7301_ENUM_ID1 0x210A |
167 | #define ENCODER_INTERNAL_DVO1_ENUM_ID1 0x210B | 178 | #define ENCODER_INTERNAL_DVO1_ENUM_ID1 0x210B |
@@ -175,8 +186,8 @@ | |||
175 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 0x2113 | 186 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 0x2113 |
176 | #define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 0x2114 | 187 | #define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 0x2114 |
177 | #define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 0x2115 | 188 | #define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 0x2115 |
178 | #define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 0x2116 | 189 | #define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 0x2116 |
179 | #define ENCODER_SI178_ENUM_ID1 0x2117 | 190 | #define ENCODER_SI178_ENUM_ID1 0x2117 |
180 | #define ENCODER_MVPU_FPGA_ENUM_ID1 0x2118 | 191 | #define ENCODER_MVPU_FPGA_ENUM_ID1 0x2118 |
181 | #define ENCODER_INTERNAL_DDI_ENUM_ID1 0x2119 | 192 | #define ENCODER_INTERNAL_DDI_ENUM_ID1 0x2119 |
182 | #define ENCODER_VT1625_ENUM_ID1 0x211A | 193 | #define ENCODER_VT1625_ENUM_ID1 0x211A |
@@ -185,205 +196,169 @@ | |||
185 | #define ENCODER_DP_DP501_ENUM_ID1 0x211D | 196 | #define ENCODER_DP_DP501_ENUM_ID1 0x211D |
186 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 0x211E | 197 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 0x211E |
187 | */ | 198 | */ |
188 | #define ENCODER_INTERNAL_LVDS_ENUM_ID1 \ | 199 | #define ENCODER_INTERNAL_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
189 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 200 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
190 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 201 | ENCODER_OBJECT_ID_INTERNAL_LVDS << OBJECT_ID_SHIFT) |
191 | ENCODER_OBJECT_ID_INTERNAL_LVDS << OBJECT_ID_SHIFT) | 202 | |
192 | 203 | #define ENCODER_INTERNAL_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
193 | #define ENCODER_INTERNAL_TMDS1_ENUM_ID1 \ | 204 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
194 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 205 | ENCODER_OBJECT_ID_INTERNAL_TMDS1 << OBJECT_ID_SHIFT) |
195 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 206 | |
196 | ENCODER_OBJECT_ID_INTERNAL_TMDS1 << OBJECT_ID_SHIFT) | 207 | #define ENCODER_INTERNAL_TMDS2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
197 | 208 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
198 | #define ENCODER_INTERNAL_TMDS2_ENUM_ID1 \ | 209 | ENCODER_OBJECT_ID_INTERNAL_TMDS2 << OBJECT_ID_SHIFT) |
199 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 210 | |
200 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 211 | #define ENCODER_INTERNAL_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
201 | ENCODER_OBJECT_ID_INTERNAL_TMDS2 << OBJECT_ID_SHIFT) | 212 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
202 | 213 | ENCODER_OBJECT_ID_INTERNAL_DAC1 << OBJECT_ID_SHIFT) | |
203 | #define ENCODER_INTERNAL_DAC1_ENUM_ID1 \ | 214 | |
204 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 215 | #define ENCODER_INTERNAL_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
205 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 216 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
206 | ENCODER_OBJECT_ID_INTERNAL_DAC1 << OBJECT_ID_SHIFT) | 217 | ENCODER_OBJECT_ID_INTERNAL_DAC2 << OBJECT_ID_SHIFT) |
207 | 218 | ||
208 | #define ENCODER_INTERNAL_DAC2_ENUM_ID1 \ | 219 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
209 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 220 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
210 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 221 | ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) |
211 | ENCODER_OBJECT_ID_INTERNAL_DAC2 << OBJECT_ID_SHIFT) | 222 | |
212 | 223 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
213 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID1 \ | 224 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
214 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 225 | ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) |
215 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 226 | |
216 | ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) | 227 | #define ENCODER_INTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
217 | 228 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
218 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID2 \ | 229 | ENCODER_OBJECT_ID_INTERNAL_SDVOB << OBJECT_ID_SHIFT) |
219 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 230 | |
220 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 231 | #define ENCODER_SIL170B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
221 | ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) | 232 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
222 | 233 | ENCODER_OBJECT_ID_SI170B << OBJECT_ID_SHIFT) | |
223 | #define ENCODER_INTERNAL_SDVOB_ENUM_ID1 \ | 234 | |
224 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 235 | #define ENCODER_CH7303_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
225 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 236 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
226 | ENCODER_OBJECT_ID_INTERNAL_SDVOB << OBJECT_ID_SHIFT) | 237 | ENCODER_OBJECT_ID_CH7303 << OBJECT_ID_SHIFT) |
227 | 238 | ||
228 | #define ENCODER_SIL170B_ENUM_ID1 \ | 239 | #define ENCODER_CH7301_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
229 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 240 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
230 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 241 | ENCODER_OBJECT_ID_CH7301 << OBJECT_ID_SHIFT) |
231 | ENCODER_OBJECT_ID_SI170B << OBJECT_ID_SHIFT) | 242 | |
232 | 243 | #define ENCODER_INTERNAL_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
233 | #define ENCODER_CH7303_ENUM_ID1 \ | 244 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
234 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 245 | ENCODER_OBJECT_ID_INTERNAL_DVO1 << OBJECT_ID_SHIFT) |
235 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 246 | |
236 | ENCODER_OBJECT_ID_CH7303 << OBJECT_ID_SHIFT) | 247 | #define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
237 | 248 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
238 | #define ENCODER_CH7301_ENUM_ID1 \ | 249 | ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) |
239 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 250 | |
240 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 251 | #define ENCODER_EXTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
241 | ENCODER_OBJECT_ID_CH7301 << OBJECT_ID_SHIFT) | 252 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
242 | 253 | ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) | |
243 | #define ENCODER_INTERNAL_DVO1_ENUM_ID1 \ | 254 | |
244 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 255 | |
245 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 256 | #define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
246 | ENCODER_OBJECT_ID_INTERNAL_DVO1 << OBJECT_ID_SHIFT) | 257 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
247 | 258 | ENCODER_OBJECT_ID_EXTERNAL_SDVOB << OBJECT_ID_SHIFT) | |
248 | #define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 \ | 259 | |
249 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 260 | |
250 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 261 | #define ENCODER_TITFP513_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
251 | ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) | 262 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
252 | 263 | ENCODER_OBJECT_ID_TITFP513 << OBJECT_ID_SHIFT) | |
253 | #define ENCODER_EXTERNAL_SDVOA_ENUM_ID2 \ | 264 | |
254 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 265 | #define ENCODER_INTERNAL_LVTM1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
255 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 266 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
256 | ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) | 267 | ENCODER_OBJECT_ID_INTERNAL_LVTM1 << OBJECT_ID_SHIFT) |
257 | 268 | ||
258 | #define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 \ | 269 | #define ENCODER_VT1623_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
259 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 270 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
260 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 271 | ENCODER_OBJECT_ID_VT1623 << OBJECT_ID_SHIFT) |
261 | ENCODER_OBJECT_ID_EXTERNAL_SDVOB << OBJECT_ID_SHIFT) | 272 | |
262 | 273 | #define ENCODER_HDMI_SI1930_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
263 | #define ENCODER_TITFP513_ENUM_ID1 \ | 274 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
264 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 275 | ENCODER_OBJECT_ID_HDMI_SI1930 << OBJECT_ID_SHIFT) |
265 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 276 | |
266 | ENCODER_OBJECT_ID_TITFP513 << OBJECT_ID_SHIFT) | 277 | #define ENCODER_HDMI_INTERNAL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
267 | 278 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
268 | #define ENCODER_INTERNAL_LVTM1_ENUM_ID1 \ | 279 | ENCODER_OBJECT_ID_HDMI_INTERNAL << OBJECT_ID_SHIFT) |
269 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 280 | |
270 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 281 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
271 | ENCODER_OBJECT_ID_INTERNAL_LVTM1 << OBJECT_ID_SHIFT) | 282 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
272 | 283 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) | |
273 | #define ENCODER_VT1623_ENUM_ID1 \ | 284 | |
274 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 285 | |
275 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 286 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
276 | ENCODER_OBJECT_ID_VT1623 << OBJECT_ID_SHIFT) | 287 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
277 | 288 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) | |
278 | #define ENCODER_HDMI_SI1930_ENUM_ID1 \ | 289 | |
279 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 290 | |
280 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 291 | #define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
281 | ENCODER_OBJECT_ID_HDMI_SI1930 << OBJECT_ID_SHIFT) | 292 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
282 | 293 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 << OBJECT_ID_SHIFT) | |
283 | #define ENCODER_HDMI_INTERNAL_ENUM_ID1 \ | 294 | |
284 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 295 | #define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
285 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 296 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
286 | ENCODER_OBJECT_ID_HDMI_INTERNAL << OBJECT_ID_SHIFT) | 297 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 << OBJECT_ID_SHIFT) |
287 | 298 | ||
288 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 \ | 299 | #define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
289 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 300 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
290 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 301 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 << OBJECT_ID_SHIFT) // Shared with CV/TV and CRT |
291 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) | 302 | |
292 | 303 | #define ENCODER_SI178_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
293 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID2 \ | 304 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
294 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 305 | ENCODER_OBJECT_ID_SI178 << OBJECT_ID_SHIFT) |
295 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 306 | |
296 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) | 307 | #define ENCODER_MVPU_FPGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
297 | 308 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
298 | #define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 \ | 309 | ENCODER_OBJECT_ID_MVPU_FPGA << OBJECT_ID_SHIFT) |
299 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 310 | |
300 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 311 | #define ENCODER_INTERNAL_DDI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
301 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 << OBJECT_ID_SHIFT) | 312 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
302 | 313 | ENCODER_OBJECT_ID_INTERNAL_DDI << OBJECT_ID_SHIFT) | |
303 | #define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 \ | 314 | |
304 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 315 | #define ENCODER_VT1625_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
305 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 316 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
306 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 << OBJECT_ID_SHIFT) | 317 | ENCODER_OBJECT_ID_VT1625 << OBJECT_ID_SHIFT) |
307 | 318 | ||
308 | #define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 \ | 319 | #define ENCODER_HDMI_SI1932_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
309 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 320 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
310 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 321 | ENCODER_OBJECT_ID_HDMI_SI1932 << OBJECT_ID_SHIFT) |
311 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 << OBJECT_ID_SHIFT) /* Shared with CV/TV and CRT */ | 322 | |
312 | 323 | #define ENCODER_DP_DP501_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
313 | #define ENCODER_SI178_ENUM_ID1 \ | 324 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
314 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 325 | ENCODER_OBJECT_ID_DP_DP501 << OBJECT_ID_SHIFT) |
315 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 326 | |
316 | ENCODER_OBJECT_ID_SI178 << OBJECT_ID_SHIFT) | 327 | #define ENCODER_DP_AN9801_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
317 | 328 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
318 | #define ENCODER_MVPU_FPGA_ENUM_ID1 \ | 329 | ENCODER_OBJECT_ID_DP_AN9801 << OBJECT_ID_SHIFT) |
319 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 330 | |
320 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 331 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
321 | ENCODER_OBJECT_ID_MVPU_FPGA << OBJECT_ID_SHIFT) | 332 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
322 | 333 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) | |
323 | #define ENCODER_INTERNAL_DDI_ENUM_ID1 \ | 334 | |
324 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 335 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
325 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 336 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
326 | ENCODER_OBJECT_ID_INTERNAL_DDI << OBJECT_ID_SHIFT) | 337 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) |
327 | 338 | ||
328 | #define ENCODER_VT1625_ENUM_ID1 \ | 339 | #define ENCODER_INTERNAL_KLDSCP_LVTMA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
329 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 340 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
330 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 341 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA << OBJECT_ID_SHIFT) |
331 | ENCODER_OBJECT_ID_VT1625 << OBJECT_ID_SHIFT) | 342 | |
332 | 343 | #define ENCODER_INTERNAL_UNIPHY1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
333 | #define ENCODER_HDMI_SI1932_ENUM_ID1 \ | 344 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
334 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 345 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) |
335 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 346 | |
336 | ENCODER_OBJECT_ID_HDMI_SI1932 << OBJECT_ID_SHIFT) | 347 | #define ENCODER_INTERNAL_UNIPHY1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
337 | 348 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | |
338 | #define ENCODER_DP_DP501_ENUM_ID1 \ | 349 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) |
339 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 350 | |
340 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 351 | #define ENCODER_INTERNAL_UNIPHY2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
341 | ENCODER_OBJECT_ID_DP_DP501 << OBJECT_ID_SHIFT) | 352 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
342 | 353 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) | |
343 | #define ENCODER_DP_AN9801_ENUM_ID1 \ | 354 | |
344 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 355 | #define ENCODER_INTERNAL_UNIPHY2_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
345 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 356 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
346 | ENCODER_OBJECT_ID_DP_AN9801 << OBJECT_ID_SHIFT) | 357 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) |
347 | 358 | ||
348 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 \ | 359 | #define ENCODER_GENERAL_EXTERNAL_DVO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
349 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 360 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
350 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 361 | ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO << OBJECT_ID_SHIFT) |
351 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) | ||
352 | |||
353 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID2 \ | ||
354 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
355 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
356 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) | ||
357 | |||
358 | #define ENCODER_INTERNAL_KLDSCP_LVTMA_ENUM_ID1 \ | ||
359 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
360 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
361 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA << OBJECT_ID_SHIFT) | ||
362 | |||
363 | #define ENCODER_INTERNAL_UNIPHY1_ENUM_ID1 \ | ||
364 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
365 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
366 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) | ||
367 | |||
368 | #define ENCODER_INTERNAL_UNIPHY1_ENUM_ID2 \ | ||
369 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
370 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
371 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) | ||
372 | |||
373 | #define ENCODER_INTERNAL_UNIPHY2_ENUM_ID1 \ | ||
374 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
375 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
376 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) | ||
377 | |||
378 | #define ENCODER_INTERNAL_UNIPHY2_ENUM_ID2 \ | ||
379 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
380 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
381 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) | ||
382 | |||
383 | #define ENCODER_GENERAL_EXTERNAL_DVO_ENUM_ID1 \ | ||
384 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
385 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
386 | ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO << OBJECT_ID_SHIFT) | ||
387 | 362 | ||
388 | /****************************************************/ | 363 | /****************************************************/ |
389 | /* Connector Object ID definition - Shared with BIOS */ | 364 | /* Connector Object ID definition - Shared with BIOS */ |
@@ -406,167 +381,253 @@ | |||
406 | #define CONNECTOR_7PIN_DIN_ENUM_ID1 0x310F | 381 | #define CONNECTOR_7PIN_DIN_ENUM_ID1 0x310F |
407 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 0x3110 | 382 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 0x3110 |
408 | */ | 383 | */ |
409 | #define CONNECTOR_LVDS_ENUM_ID1 \ | 384 | #define CONNECTOR_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
410 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 385 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
411 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 386 | CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) |
412 | CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) | 387 | |
413 | 388 | #define CONNECTOR_LVDS_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
414 | #define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 \ | 389 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
415 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 390 | CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) |
416 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 391 | |
417 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) | 392 | #define CONNECTOR_eDP_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
418 | 393 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
419 | #define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID2 \ | 394 | CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT) |
420 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 395 | |
421 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 396 | #define CONNECTOR_eDP_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
422 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) | 397 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
423 | 398 | CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT) | |
424 | #define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 \ | 399 | |
425 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 400 | #define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
426 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 401 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
427 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) | 402 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) |
428 | 403 | ||
429 | #define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID2 \ | 404 | #define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
430 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 405 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
431 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 406 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) |
432 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) | 407 | |
433 | 408 | #define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
434 | #define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 \ | 409 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
435 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 410 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) |
436 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 411 | |
437 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) | 412 | #define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
438 | 413 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | |
439 | #define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID2 \ | 414 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) |
440 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 415 | |
441 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 416 | #define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
442 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) | 417 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
443 | 418 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) | |
444 | #define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 \ | 419 | |
445 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 420 | #define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
446 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 421 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
447 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) | 422 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) |
448 | 423 | ||
449 | #define CONNECTOR_VGA_ENUM_ID1 \ | 424 | #define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
450 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 425 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
451 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 426 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) |
452 | CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) | 427 | |
453 | 428 | #define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
454 | #define CONNECTOR_VGA_ENUM_ID2 \ | 429 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
455 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 430 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) |
456 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 431 | |
457 | CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) | 432 | #define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
458 | 433 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ | |
459 | #define CONNECTOR_COMPOSITE_ENUM_ID1 \ | 434 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) |
460 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 435 | |
461 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 436 | #define CONNECTOR_VGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
462 | CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) | 437 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
463 | 438 | CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) | |
464 | #define CONNECTOR_SVIDEO_ENUM_ID1 \ | 439 | |
465 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 440 | #define CONNECTOR_VGA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
466 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 441 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
467 | CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) | 442 | CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) |
468 | 443 | ||
469 | #define CONNECTOR_YPbPr_ENUM_ID1 \ | 444 | #define CONNECTOR_COMPOSITE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
470 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 445 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
471 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 446 | CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) |
472 | CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) | 447 | |
473 | 448 | #define CONNECTOR_COMPOSITE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
474 | #define CONNECTOR_D_CONNECTOR_ENUM_ID1 \ | 449 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
475 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 450 | CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) |
476 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 451 | |
477 | CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) | 452 | #define CONNECTOR_SVIDEO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
478 | 453 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
479 | #define CONNECTOR_9PIN_DIN_ENUM_ID1 \ | 454 | CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) |
480 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 455 | |
481 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 456 | #define CONNECTOR_SVIDEO_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
482 | CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) | 457 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
483 | 458 | CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) | |
484 | #define CONNECTOR_SCART_ENUM_ID1 \ | 459 | |
485 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 460 | #define CONNECTOR_YPbPr_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
486 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 461 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
487 | CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) | 462 | CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) |
488 | 463 | ||
489 | #define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 \ | 464 | #define CONNECTOR_YPbPr_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
490 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 465 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
491 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 466 | CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) |
492 | CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) | 467 | |
493 | 468 | #define CONNECTOR_D_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
494 | #define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 \ | 469 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
495 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 470 | CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) |
496 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 471 | |
497 | CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) | 472 | #define CONNECTOR_D_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
498 | 473 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | |
499 | #define CONNECTOR_7PIN_DIN_ENUM_ID1 \ | 474 | CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) |
500 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 475 | |
501 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 476 | #define CONNECTOR_9PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
502 | CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) | 477 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
503 | 478 | CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) | |
504 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 \ | 479 | |
505 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 480 | #define CONNECTOR_9PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
506 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 481 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
507 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) | 482 | CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) |
508 | 483 | ||
509 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID2 \ | 484 | #define CONNECTOR_SCART_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
510 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 485 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
511 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 486 | CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) |
512 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) | 487 | |
513 | 488 | #define CONNECTOR_SCART_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
514 | #define CONNECTOR_CROSSFIRE_ENUM_ID1 \ | 489 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
515 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 490 | CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) |
516 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 491 | |
517 | CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) | 492 | #define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
518 | 493 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
519 | #define CONNECTOR_CROSSFIRE_ENUM_ID2 \ | 494 | CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) |
520 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 495 | |
521 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 496 | #define CONNECTOR_HDMI_TYPE_A_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
522 | CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) | 497 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
523 | 498 | CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) | |
524 | #define CONNECTOR_HARDCODE_DVI_ENUM_ID1 \ | 499 | |
525 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 500 | #define CONNECTOR_HDMI_TYPE_A_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
526 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 501 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ |
527 | CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) | 502 | CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) |
528 | 503 | ||
529 | #define CONNECTOR_HARDCODE_DVI_ENUM_ID2 \ | 504 | #define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
530 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 505 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
531 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 506 | CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) |
532 | CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) | 507 | |
533 | 508 | #define CONNECTOR_HDMI_TYPE_B_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
534 | #define CONNECTOR_DISPLAYPORT_ENUM_ID1 \ | 509 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
535 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 510 | CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) |
536 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 511 | |
537 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | 512 | #define CONNECTOR_7PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
538 | 513 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
539 | #define CONNECTOR_DISPLAYPORT_ENUM_ID2 \ | 514 | CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) |
540 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 515 | #define CONNECTOR_7PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
541 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 516 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
542 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | 517 | CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) |
543 | 518 | ||
544 | #define CONNECTOR_DISPLAYPORT_ENUM_ID3 \ | 519 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
545 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 520 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
546 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ | 521 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) |
547 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | 522 | |
548 | 523 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
549 | #define CONNECTOR_DISPLAYPORT_ENUM_ID4 \ | 524 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
550 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 525 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) |
551 | GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ | 526 | |
552 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | 527 | #define CONNECTOR_CROSSFIRE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
528 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
529 | CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) | ||
530 | |||
531 | #define CONNECTOR_CROSSFIRE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
532 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
533 | CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) | ||
534 | |||
535 | |||
536 | #define CONNECTOR_HARDCODE_DVI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
537 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
538 | CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) | ||
539 | |||
540 | #define CONNECTOR_HARDCODE_DVI_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
541 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
542 | CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) | ||
543 | |||
544 | #define CONNECTOR_DISPLAYPORT_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
545 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
546 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
547 | |||
548 | #define CONNECTOR_DISPLAYPORT_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
549 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
550 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
551 | |||
552 | #define CONNECTOR_DISPLAYPORT_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
553 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ | ||
554 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
555 | |||
556 | #define CONNECTOR_DISPLAYPORT_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
557 | GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ | ||
558 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
559 | |||
560 | #define CONNECTOR_DISPLAYPORT_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
561 | GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\ | ||
562 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
563 | |||
564 | #define CONNECTOR_DISPLAYPORT_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
565 | GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\ | ||
566 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
567 | |||
568 | #define CONNECTOR_MXM_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
569 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
570 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_A | ||
571 | |||
572 | #define CONNECTOR_MXM_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
573 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
574 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_B | ||
575 | |||
576 | #define CONNECTOR_MXM_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
577 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ | ||
578 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_C | ||
579 | |||
580 | #define CONNECTOR_MXM_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
581 | GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ | ||
582 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_D | ||
583 | |||
584 | #define CONNECTOR_MXM_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
585 | GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\ | ||
586 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_TXxx | ||
587 | |||
588 | #define CONNECTOR_MXM_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
589 | GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\ | ||
590 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_UXxx | ||
591 | |||
592 | #define CONNECTOR_MXM_ENUM_ID7 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
593 | GRAPH_OBJECT_ENUM_ID7 << ENUM_ID_SHIFT |\ | ||
594 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DAC | ||
553 | 595 | ||
554 | /****************************************************/ | 596 | /****************************************************/ |
555 | /* Router Object ID definition - Shared with BIOS */ | 597 | /* Router Object ID definition - Shared with BIOS */ |
556 | /****************************************************/ | 598 | /****************************************************/ |
557 | #define ROUTER_I2C_EXTENDER_CNTL_ENUM_ID1 \ | 599 | #define ROUTER_I2C_EXTENDER_CNTL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ROUTER << OBJECT_TYPE_SHIFT |\ |
558 | (GRAPH_OBJECT_TYPE_ROUTER << OBJECT_TYPE_SHIFT |\ | 600 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
559 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 601 | ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL << OBJECT_ID_SHIFT) |
560 | ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL << OBJECT_ID_SHIFT) | ||
561 | 602 | ||
562 | /* deleted */ | 603 | /* deleted */ |
563 | 604 | ||
564 | /****************************************************/ | 605 | /****************************************************/ |
606 | /* Generic Object ID definition - Shared with BIOS */ | ||
607 | /****************************************************/ | ||
608 | #define GENERICOBJECT_GLSYNC_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ | ||
609 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
610 | GENERIC_OBJECT_ID_GLSYNC << OBJECT_ID_SHIFT) | ||
611 | |||
612 | #define GENERICOBJECT_PX2_NON_DRIVABLE_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ | ||
613 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
614 | GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT) | ||
615 | |||
616 | #define GENERICOBJECT_PX2_NON_DRIVABLE_ID2 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ | ||
617 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
618 | GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT) | ||
619 | |||
620 | #define GENERICOBJECT_MXM_OPM_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ | ||
621 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
622 | GENERIC_OBJECT_ID_MXM_OPM << OBJECT_ID_SHIFT) | ||
623 | |||
624 | /****************************************************/ | ||
565 | /* Object Cap definition - Shared with BIOS */ | 625 | /* Object Cap definition - Shared with BIOS */ |
566 | /****************************************************/ | 626 | /****************************************************/ |
567 | #define GRAPHICS_OBJECT_CAP_I2C 0x00000001L | 627 | #define GRAPHICS_OBJECT_CAP_I2C 0x00000001L |
568 | #define GRAPHICS_OBJECT_CAP_TABLE_ID 0x00000002L | 628 | #define GRAPHICS_OBJECT_CAP_TABLE_ID 0x00000002L |
569 | 629 | ||
630 | |||
570 | #define GRAPHICS_OBJECT_I2CCOMMAND_TABLE_ID 0x01 | 631 | #define GRAPHICS_OBJECT_I2CCOMMAND_TABLE_ID 0x01 |
571 | #define GRAPHICS_OBJECT_HOTPLUGDETECTIONINTERUPT_TABLE_ID 0x02 | 632 | #define GRAPHICS_OBJECT_HOTPLUGDETECTIONINTERUPT_TABLE_ID 0x02 |
572 | #define GRAPHICS_OBJECT_ENCODER_OUTPUT_PROTECTION_TABLE_ID 0x03 | 633 | #define GRAPHICS_OBJECT_ENCODER_OUTPUT_PROTECTION_TABLE_ID 0x03 |
@@ -575,4 +636,8 @@ | |||
575 | #pragma pack() | 636 | #pragma pack() |
576 | #endif | 637 | #endif |
577 | 638 | ||
578 | #endif /*GRAPHICTYPE */ | 639 | #endif /*GRAPHICTYPE */ |
640 | |||
641 | |||
642 | |||
643 | |||
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 0d63c4436e7c..3eb0ca5b3d73 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -468,7 +468,8 @@ void radeon_dp_set_link_config(struct drm_connector *connector, | |||
468 | struct radeon_connector *radeon_connector; | 468 | struct radeon_connector *radeon_connector; |
469 | struct radeon_connector_atom_dig *dig_connector; | 469 | struct radeon_connector_atom_dig *dig_connector; |
470 | 470 | ||
471 | if (connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) | 471 | if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) || |
472 | (connector->connector_type != DRM_MODE_CONNECTOR_eDP)) | ||
472 | return; | 473 | return; |
473 | 474 | ||
474 | radeon_connector = to_radeon_connector(connector); | 475 | radeon_connector = to_radeon_connector(connector); |
@@ -582,7 +583,8 @@ void dp_link_train(struct drm_encoder *encoder, | |||
582 | u8 train_set[4]; | 583 | u8 train_set[4]; |
583 | int i; | 584 | int i; |
584 | 585 | ||
585 | if (connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) | 586 | if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) || |
587 | (connector->connector_type != DRM_MODE_CONNECTOR_eDP)) | ||
586 | return; | 588 | return; |
587 | 589 | ||
588 | if (!radeon_encoder->enc_priv) | 590 | if (!radeon_encoder->enc_priv) |
diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c index 0d79577c1576..607241c6a8a9 100644 --- a/drivers/gpu/drm/radeon/mkregtable.c +++ b/drivers/gpu/drm/radeon/mkregtable.c | |||
@@ -661,8 +661,10 @@ static int parser_auth(struct table *t, const char *filename) | |||
661 | fseek(file, 0, SEEK_SET); | 661 | fseek(file, 0, SEEK_SET); |
662 | 662 | ||
663 | /* get header */ | 663 | /* get header */ |
664 | if (fgets(buf, 1024, file) == NULL) | 664 | if (fgets(buf, 1024, file) == NULL) { |
665 | fclose(file); | ||
665 | return -1; | 666 | return -1; |
667 | } | ||
666 | 668 | ||
667 | /* first line will contain the last register | 669 | /* first line will contain the last register |
668 | * and gpu name */ | 670 | * and gpu name */ |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 71727460968f..8760d66e058a 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -131,7 +131,8 @@ void r100_hpd_init(struct radeon_device *rdev) | |||
131 | break; | 131 | break; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | r100_irq_set(rdev); | 134 | if (rdev->irq.installed) |
135 | r100_irq_set(rdev); | ||
135 | } | 136 | } |
136 | 137 | ||
137 | void r100_hpd_fini(struct radeon_device *rdev) | 138 | void r100_hpd_fini(struct radeon_device *rdev) |
@@ -243,6 +244,11 @@ int r100_irq_set(struct radeon_device *rdev) | |||
243 | { | 244 | { |
244 | uint32_t tmp = 0; | 245 | uint32_t tmp = 0; |
245 | 246 | ||
247 | if (!rdev->irq.installed) { | ||
248 | WARN(1, "Can't enable IRQ/MSI because no handler is installed.\n"); | ||
249 | WREG32(R_000040_GEN_INT_CNTL, 0); | ||
250 | return -EINVAL; | ||
251 | } | ||
246 | if (rdev->irq.sw_int) { | 252 | if (rdev->irq.sw_int) { |
247 | tmp |= RADEON_SW_INT_ENABLE; | 253 | tmp |= RADEON_SW_INT_ENABLE; |
248 | } | 254 | } |
@@ -356,6 +362,11 @@ void r100_fence_ring_emit(struct radeon_device *rdev, | |||
356 | /* Wait until IDLE & CLEAN */ | 362 | /* Wait until IDLE & CLEAN */ |
357 | radeon_ring_write(rdev, PACKET0(0x1720, 0)); | 363 | radeon_ring_write(rdev, PACKET0(0x1720, 0)); |
358 | radeon_ring_write(rdev, (1 << 16) | (1 << 17)); | 364 | radeon_ring_write(rdev, (1 << 16) | (1 << 17)); |
365 | radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
366 | radeon_ring_write(rdev, rdev->config.r100.hdp_cntl | | ||
367 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
368 | radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
369 | radeon_ring_write(rdev, rdev->config.r100.hdp_cntl); | ||
359 | /* Emit fence sequence & fire IRQ */ | 370 | /* Emit fence sequence & fire IRQ */ |
360 | radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); | 371 | radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); |
361 | radeon_ring_write(rdev, fence->seq); | 372 | radeon_ring_write(rdev, fence->seq); |
@@ -1713,14 +1724,6 @@ void r100_gpu_init(struct radeon_device *rdev) | |||
1713 | r100_hdp_reset(rdev); | 1724 | r100_hdp_reset(rdev); |
1714 | } | 1725 | } |
1715 | 1726 | ||
1716 | void r100_hdp_flush(struct radeon_device *rdev) | ||
1717 | { | ||
1718 | u32 tmp; | ||
1719 | tmp = RREG32(RADEON_HOST_PATH_CNTL); | ||
1720 | tmp |= RADEON_HDP_READ_BUFFER_INVALIDATE; | ||
1721 | WREG32(RADEON_HOST_PATH_CNTL, tmp); | ||
1722 | } | ||
1723 | |||
1724 | void r100_hdp_reset(struct radeon_device *rdev) | 1727 | void r100_hdp_reset(struct radeon_device *rdev) |
1725 | { | 1728 | { |
1726 | uint32_t tmp; | 1729 | uint32_t tmp; |
@@ -3313,6 +3316,7 @@ static int r100_startup(struct radeon_device *rdev) | |||
3313 | } | 3316 | } |
3314 | /* Enable IRQ */ | 3317 | /* Enable IRQ */ |
3315 | r100_irq_set(rdev); | 3318 | r100_irq_set(rdev); |
3319 | rdev->config.r100.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
3316 | /* 1M ring buffer */ | 3320 | /* 1M ring buffer */ |
3317 | r = r100_cp_init(rdev, 1024 * 1024); | 3321 | r = r100_cp_init(rdev, 1024 * 1024); |
3318 | if (r) { | 3322 | if (r) { |
@@ -3371,6 +3375,7 @@ void r100_fini(struct radeon_device *rdev) | |||
3371 | radeon_gem_fini(rdev); | 3375 | radeon_gem_fini(rdev); |
3372 | if (rdev->flags & RADEON_IS_PCI) | 3376 | if (rdev->flags & RADEON_IS_PCI) |
3373 | r100_pci_gart_fini(rdev); | 3377 | r100_pci_gart_fini(rdev); |
3378 | radeon_agp_fini(rdev); | ||
3374 | radeon_irq_kms_fini(rdev); | 3379 | radeon_irq_kms_fini(rdev); |
3375 | radeon_fence_driver_fini(rdev); | 3380 | radeon_fence_driver_fini(rdev); |
3376 | radeon_bo_fini(rdev); | 3381 | radeon_bo_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 3f2cc9e2e8d9..0051d11b907c 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -36,7 +36,15 @@ | |||
36 | #include "rv350d.h" | 36 | #include "rv350d.h" |
37 | #include "r300_reg_safe.h" | 37 | #include "r300_reg_safe.h" |
38 | 38 | ||
39 | /* This files gather functions specifics to: r300,r350,rv350,rv370,rv380 */ | 39 | /* This files gather functions specifics to: r300,r350,rv350,rv370,rv380 |
40 | * | ||
41 | * GPU Errata: | ||
42 | * - HOST_PATH_CNTL: r300 family seems to dislike write to HOST_PATH_CNTL | ||
43 | * using MMIO to flush host path read cache, this lead to HARDLOCKUP. | ||
44 | * However, scheduling such write to the ring seems harmless, i suspect | ||
45 | * the CP read collide with the flush somehow, or maybe the MC, hard to | ||
46 | * tell. (Jerome Glisse) | ||
47 | */ | ||
40 | 48 | ||
41 | /* | 49 | /* |
42 | * rv370,rv380 PCIE GART | 50 | * rv370,rv380 PCIE GART |
@@ -178,6 +186,11 @@ void r300_fence_ring_emit(struct radeon_device *rdev, | |||
178 | /* Wait until IDLE & CLEAN */ | 186 | /* Wait until IDLE & CLEAN */ |
179 | radeon_ring_write(rdev, PACKET0(0x1720, 0)); | 187 | radeon_ring_write(rdev, PACKET0(0x1720, 0)); |
180 | radeon_ring_write(rdev, (1 << 17) | (1 << 16) | (1 << 9)); | 188 | radeon_ring_write(rdev, (1 << 17) | (1 << 16) | (1 << 9)); |
189 | radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
190 | radeon_ring_write(rdev, rdev->config.r300.hdp_cntl | | ||
191 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
192 | radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
193 | radeon_ring_write(rdev, rdev->config.r300.hdp_cntl); | ||
181 | /* Emit fence sequence & fire IRQ */ | 194 | /* Emit fence sequence & fire IRQ */ |
182 | radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); | 195 | radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); |
183 | radeon_ring_write(rdev, fence->seq); | 196 | radeon_ring_write(rdev, fence->seq); |
@@ -1258,6 +1271,7 @@ static int r300_startup(struct radeon_device *rdev) | |||
1258 | } | 1271 | } |
1259 | /* Enable IRQ */ | 1272 | /* Enable IRQ */ |
1260 | r100_irq_set(rdev); | 1273 | r100_irq_set(rdev); |
1274 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
1261 | /* 1M ring buffer */ | 1275 | /* 1M ring buffer */ |
1262 | r = r100_cp_init(rdev, 1024 * 1024); | 1276 | r = r100_cp_init(rdev, 1024 * 1024); |
1263 | if (r) { | 1277 | if (r) { |
@@ -1322,6 +1336,7 @@ void r300_fini(struct radeon_device *rdev) | |||
1322 | rv370_pcie_gart_fini(rdev); | 1336 | rv370_pcie_gart_fini(rdev); |
1323 | if (rdev->flags & RADEON_IS_PCI) | 1337 | if (rdev->flags & RADEON_IS_PCI) |
1324 | r100_pci_gart_fini(rdev); | 1338 | r100_pci_gart_fini(rdev); |
1339 | radeon_agp_fini(rdev); | ||
1325 | radeon_irq_kms_fini(rdev); | 1340 | radeon_irq_kms_fini(rdev); |
1326 | radeon_fence_driver_fini(rdev); | 1341 | radeon_fence_driver_fini(rdev); |
1327 | radeon_bo_fini(rdev); | 1342 | radeon_bo_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index c05a7270cf0c..053404e71a9d 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -30,7 +30,15 @@ | |||
30 | #include "radeon_reg.h" | 30 | #include "radeon_reg.h" |
31 | #include "radeon.h" | 31 | #include "radeon.h" |
32 | #include "atom.h" | 32 | #include "atom.h" |
33 | #include "r100d.h" | ||
33 | #include "r420d.h" | 34 | #include "r420d.h" |
35 | #include "r420_reg_safe.h" | ||
36 | |||
37 | static void r420_set_reg_safe(struct radeon_device *rdev) | ||
38 | { | ||
39 | rdev->config.r300.reg_safe_bm = r420_reg_safe_bm; | ||
40 | rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(r420_reg_safe_bm); | ||
41 | } | ||
34 | 42 | ||
35 | int r420_mc_init(struct radeon_device *rdev) | 43 | int r420_mc_init(struct radeon_device *rdev) |
36 | { | 44 | { |
@@ -165,6 +173,34 @@ static void r420_clock_resume(struct radeon_device *rdev) | |||
165 | WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl); | 173 | WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl); |
166 | } | 174 | } |
167 | 175 | ||
176 | static void r420_cp_errata_init(struct radeon_device *rdev) | ||
177 | { | ||
178 | /* RV410 and R420 can lock up if CP DMA to host memory happens | ||
179 | * while the 2D engine is busy. | ||
180 | * | ||
181 | * The proper workaround is to queue a RESYNC at the beginning | ||
182 | * of the CP init, apparently. | ||
183 | */ | ||
184 | radeon_scratch_get(rdev, &rdev->config.r300.resync_scratch); | ||
185 | radeon_ring_lock(rdev, 8); | ||
186 | radeon_ring_write(rdev, PACKET0(R300_CP_RESYNC_ADDR, 1)); | ||
187 | radeon_ring_write(rdev, rdev->config.r300.resync_scratch); | ||
188 | radeon_ring_write(rdev, 0xDEADBEEF); | ||
189 | radeon_ring_unlock_commit(rdev); | ||
190 | } | ||
191 | |||
192 | static void r420_cp_errata_fini(struct radeon_device *rdev) | ||
193 | { | ||
194 | /* Catch the RESYNC we dispatched all the way back, | ||
195 | * at the very beginning of the CP init. | ||
196 | */ | ||
197 | radeon_ring_lock(rdev, 8); | ||
198 | radeon_ring_write(rdev, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | ||
199 | radeon_ring_write(rdev, R300_RB3D_DC_FINISH); | ||
200 | radeon_ring_unlock_commit(rdev); | ||
201 | radeon_scratch_free(rdev, rdev->config.r300.resync_scratch); | ||
202 | } | ||
203 | |||
168 | static int r420_startup(struct radeon_device *rdev) | 204 | static int r420_startup(struct radeon_device *rdev) |
169 | { | 205 | { |
170 | int r; | 206 | int r; |
@@ -190,12 +226,14 @@ static int r420_startup(struct radeon_device *rdev) | |||
190 | r420_pipes_init(rdev); | 226 | r420_pipes_init(rdev); |
191 | /* Enable IRQ */ | 227 | /* Enable IRQ */ |
192 | r100_irq_set(rdev); | 228 | r100_irq_set(rdev); |
229 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
193 | /* 1M ring buffer */ | 230 | /* 1M ring buffer */ |
194 | r = r100_cp_init(rdev, 1024 * 1024); | 231 | r = r100_cp_init(rdev, 1024 * 1024); |
195 | if (r) { | 232 | if (r) { |
196 | dev_err(rdev->dev, "failled initializing CP (%d).\n", r); | 233 | dev_err(rdev->dev, "failled initializing CP (%d).\n", r); |
197 | return r; | 234 | return r; |
198 | } | 235 | } |
236 | r420_cp_errata_init(rdev); | ||
199 | r = r100_wb_init(rdev); | 237 | r = r100_wb_init(rdev); |
200 | if (r) { | 238 | if (r) { |
201 | dev_err(rdev->dev, "failled initializing WB (%d).\n", r); | 239 | dev_err(rdev->dev, "failled initializing WB (%d).\n", r); |
@@ -238,6 +276,7 @@ int r420_resume(struct radeon_device *rdev) | |||
238 | 276 | ||
239 | int r420_suspend(struct radeon_device *rdev) | 277 | int r420_suspend(struct radeon_device *rdev) |
240 | { | 278 | { |
279 | r420_cp_errata_fini(rdev); | ||
241 | r100_cp_disable(rdev); | 280 | r100_cp_disable(rdev); |
242 | r100_wb_disable(rdev); | 281 | r100_wb_disable(rdev); |
243 | r100_irq_disable(rdev); | 282 | r100_irq_disable(rdev); |
@@ -346,7 +385,7 @@ int r420_init(struct radeon_device *rdev) | |||
346 | if (r) | 385 | if (r) |
347 | return r; | 386 | return r; |
348 | } | 387 | } |
349 | r300_set_reg_safe(rdev); | 388 | r420_set_reg_safe(rdev); |
350 | rdev->accel_working = true; | 389 | rdev->accel_working = true; |
351 | r = r420_startup(rdev); | 390 | r = r420_startup(rdev); |
352 | if (r) { | 391 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index 0f3843b6dac7..9a189072f2b9 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
@@ -186,6 +186,7 @@ static int r520_startup(struct radeon_device *rdev) | |||
186 | } | 186 | } |
187 | /* Enable IRQ */ | 187 | /* Enable IRQ */ |
188 | rs600_irq_set(rdev); | 188 | rs600_irq_set(rdev); |
189 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
189 | /* 1M ring buffer */ | 190 | /* 1M ring buffer */ |
190 | r = r100_cp_init(rdev, 1024 * 1024); | 191 | r = r100_cp_init(rdev, 1024 * 1024); |
191 | if (r) { | 192 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index a0ac3c134b1b..c0651991c3e4 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -285,7 +285,8 @@ void r600_hpd_init(struct radeon_device *rdev) | |||
285 | } | 285 | } |
286 | } | 286 | } |
287 | } | 287 | } |
288 | r600_irq_set(rdev); | 288 | if (rdev->irq.installed) |
289 | r600_irq_set(rdev); | ||
289 | } | 290 | } |
290 | 291 | ||
291 | void r600_hpd_fini(struct radeon_device *rdev) | 292 | void r600_hpd_fini(struct radeon_device *rdev) |
@@ -726,6 +727,10 @@ int r600_mc_init(struct radeon_device *rdev) | |||
726 | a.full = rfixed_const(100); | 727 | a.full = rfixed_const(100); |
727 | rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); | 728 | rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); |
728 | rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); | 729 | rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); |
730 | |||
731 | if (rdev->flags & RADEON_IS_IGP) | ||
732 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | ||
733 | |||
729 | return 0; | 734 | return 0; |
730 | } | 735 | } |
731 | 736 | ||
@@ -1384,11 +1389,6 @@ void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) | |||
1384 | (void)RREG32(PCIE_PORT_DATA); | 1389 | (void)RREG32(PCIE_PORT_DATA); |
1385 | } | 1390 | } |
1386 | 1391 | ||
1387 | void r600_hdp_flush(struct radeon_device *rdev) | ||
1388 | { | ||
1389 | WREG32(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1); | ||
1390 | } | ||
1391 | |||
1392 | /* | 1392 | /* |
1393 | * CP & Ring | 1393 | * CP & Ring |
1394 | */ | 1394 | */ |
@@ -1785,6 +1785,8 @@ void r600_fence_ring_emit(struct radeon_device *rdev, | |||
1785 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); | 1785 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); |
1786 | radeon_ring_write(rdev, ((rdev->fence_drv.scratch_reg - PACKET3_SET_CONFIG_REG_OFFSET) >> 2)); | 1786 | radeon_ring_write(rdev, ((rdev->fence_drv.scratch_reg - PACKET3_SET_CONFIG_REG_OFFSET) >> 2)); |
1787 | radeon_ring_write(rdev, fence->seq); | 1787 | radeon_ring_write(rdev, fence->seq); |
1788 | radeon_ring_write(rdev, PACKET0(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0)); | ||
1789 | radeon_ring_write(rdev, 1); | ||
1788 | /* CP_INTERRUPT packet 3 no longer exists, use packet 0 */ | 1790 | /* CP_INTERRUPT packet 3 no longer exists, use packet 0 */ |
1789 | radeon_ring_write(rdev, PACKET0(CP_INT_STATUS, 0)); | 1791 | radeon_ring_write(rdev, PACKET0(CP_INT_STATUS, 0)); |
1790 | radeon_ring_write(rdev, RB_INT_STAT); | 1792 | radeon_ring_write(rdev, RB_INT_STAT); |
@@ -2089,8 +2091,7 @@ void r600_fini(struct radeon_device *rdev) | |||
2089 | radeon_gem_fini(rdev); | 2091 | radeon_gem_fini(rdev); |
2090 | radeon_fence_driver_fini(rdev); | 2092 | radeon_fence_driver_fini(rdev); |
2091 | radeon_clocks_fini(rdev); | 2093 | radeon_clocks_fini(rdev); |
2092 | if (rdev->flags & RADEON_IS_AGP) | 2094 | radeon_agp_fini(rdev); |
2093 | radeon_agp_fini(rdev); | ||
2094 | radeon_bo_fini(rdev); | 2095 | radeon_bo_fini(rdev); |
2095 | radeon_atombios_fini(rdev); | 2096 | radeon_atombios_fini(rdev); |
2096 | kfree(rdev->bios); | 2097 | kfree(rdev->bios); |
@@ -2461,6 +2462,10 @@ int r600_irq_set(struct radeon_device *rdev) | |||
2461 | u32 mode_int = 0; | 2462 | u32 mode_int = 0; |
2462 | u32 hpd1, hpd2, hpd3, hpd4 = 0, hpd5 = 0, hpd6 = 0; | 2463 | u32 hpd1, hpd2, hpd3, hpd4 = 0, hpd5 = 0, hpd6 = 0; |
2463 | 2464 | ||
2465 | if (!rdev->irq.installed) { | ||
2466 | WARN(1, "Can't enable IRQ/MSI because no handler is installed.\n"); | ||
2467 | return -EINVAL; | ||
2468 | } | ||
2464 | /* don't enable anything if the ih is disabled */ | 2469 | /* don't enable anything if the ih is disabled */ |
2465 | if (!rdev->ih.enabled) | 2470 | if (!rdev->ih.enabled) |
2466 | return 0; | 2471 | return 0; |
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 9aecafb51b66..8787ea89dc6e 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -577,9 +577,9 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
577 | ring_size = num_loops * dwords_per_loop; | 577 | ring_size = num_loops * dwords_per_loop; |
578 | /* set default + shaders */ | 578 | /* set default + shaders */ |
579 | ring_size += 40; /* shaders + def state */ | 579 | ring_size += 40; /* shaders + def state */ |
580 | ring_size += 5; /* fence emit for VB IB */ | 580 | ring_size += 7; /* fence emit for VB IB */ |
581 | ring_size += 5; /* done copy */ | 581 | ring_size += 5; /* done copy */ |
582 | ring_size += 5; /* fence emit for done copy */ | 582 | ring_size += 7; /* fence emit for done copy */ |
583 | r = radeon_ring_lock(rdev, ring_size); | 583 | r = radeon_ring_lock(rdev, ring_size); |
584 | WARN_ON(r); | 584 | WARN_ON(r); |
585 | 585 | ||
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 53b55608102b..eb5f99b9469d 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -319,10 +319,12 @@ struct radeon_mc { | |||
319 | u64 real_vram_size; | 319 | u64 real_vram_size; |
320 | int vram_mtrr; | 320 | int vram_mtrr; |
321 | bool vram_is_ddr; | 321 | bool vram_is_ddr; |
322 | bool igp_sideport_enabled; | ||
322 | }; | 323 | }; |
323 | 324 | ||
324 | int radeon_mc_setup(struct radeon_device *rdev); | 325 | int radeon_mc_setup(struct radeon_device *rdev); |
325 | 326 | bool radeon_combios_sideport_present(struct radeon_device *rdev); | |
327 | bool radeon_atombios_sideport_present(struct radeon_device *rdev); | ||
326 | 328 | ||
327 | /* | 329 | /* |
328 | * GPU scratch registers structures, functions & helpers | 330 | * GPU scratch registers structures, functions & helpers |
@@ -654,7 +656,6 @@ struct radeon_asic { | |||
654 | uint32_t offset, uint32_t obj_size); | 656 | uint32_t offset, uint32_t obj_size); |
655 | int (*clear_surface_reg)(struct radeon_device *rdev, int reg); | 657 | int (*clear_surface_reg)(struct radeon_device *rdev, int reg); |
656 | void (*bandwidth_update)(struct radeon_device *rdev); | 658 | void (*bandwidth_update)(struct radeon_device *rdev); |
657 | void (*hdp_flush)(struct radeon_device *rdev); | ||
658 | void (*hpd_init)(struct radeon_device *rdev); | 659 | void (*hpd_init)(struct radeon_device *rdev); |
659 | void (*hpd_fini)(struct radeon_device *rdev); | 660 | void (*hpd_fini)(struct radeon_device *rdev); |
660 | bool (*hpd_sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd); | 661 | bool (*hpd_sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd); |
@@ -667,11 +668,14 @@ struct radeon_asic { | |||
667 | struct r100_asic { | 668 | struct r100_asic { |
668 | const unsigned *reg_safe_bm; | 669 | const unsigned *reg_safe_bm; |
669 | unsigned reg_safe_bm_size; | 670 | unsigned reg_safe_bm_size; |
671 | u32 hdp_cntl; | ||
670 | }; | 672 | }; |
671 | 673 | ||
672 | struct r300_asic { | 674 | struct r300_asic { |
673 | const unsigned *reg_safe_bm; | 675 | const unsigned *reg_safe_bm; |
674 | unsigned reg_safe_bm_size; | 676 | unsigned reg_safe_bm_size; |
677 | u32 resync_scratch; | ||
678 | u32 hdp_cntl; | ||
675 | }; | 679 | }; |
676 | 680 | ||
677 | struct r600_asic { | 681 | struct r600_asic { |
@@ -1007,7 +1011,6 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v) | |||
1007 | #define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s))) | 1011 | #define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s))) |
1008 | #define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r))) | 1012 | #define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r))) |
1009 | #define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev)) | 1013 | #define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev)) |
1010 | #define radeon_hdp_flush(rdev) (rdev)->asic->hdp_flush((rdev)) | ||
1011 | #define radeon_hpd_init(rdev) (rdev)->asic->hpd_init((rdev)) | 1014 | #define radeon_hpd_init(rdev) (rdev)->asic->hpd_init((rdev)) |
1012 | #define radeon_hpd_fini(rdev) (rdev)->asic->hpd_fini((rdev)) | 1015 | #define radeon_hpd_fini(rdev) (rdev)->asic->hpd_fini((rdev)) |
1013 | #define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd)) | 1016 | #define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd)) |
diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c index 54bf49a6d676..220f454ea9fa 100644 --- a/drivers/gpu/drm/radeon/radeon_agp.c +++ b/drivers/gpu/drm/radeon/radeon_agp.c | |||
@@ -252,10 +252,8 @@ void radeon_agp_resume(struct radeon_device *rdev) | |||
252 | void radeon_agp_fini(struct radeon_device *rdev) | 252 | void radeon_agp_fini(struct radeon_device *rdev) |
253 | { | 253 | { |
254 | #if __OS_HAS_AGP | 254 | #if __OS_HAS_AGP |
255 | if (rdev->flags & RADEON_IS_AGP) { | 255 | if (rdev->ddev->agp && rdev->ddev->agp->acquired) { |
256 | if (rdev->ddev->agp && rdev->ddev->agp->acquired) { | 256 | drm_agp_release(rdev->ddev); |
257 | drm_agp_release(rdev->ddev); | ||
258 | } | ||
259 | } | 257 | } |
260 | #endif | 258 | #endif |
261 | } | 259 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index eb29217bbf1d..f2fbd2e4e9df 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -77,7 +77,6 @@ int r100_clear_surface_reg(struct radeon_device *rdev, int reg); | |||
77 | void r100_bandwidth_update(struct radeon_device *rdev); | 77 | void r100_bandwidth_update(struct radeon_device *rdev); |
78 | void r100_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); | 78 | void r100_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); |
79 | int r100_ring_test(struct radeon_device *rdev); | 79 | int r100_ring_test(struct radeon_device *rdev); |
80 | void r100_hdp_flush(struct radeon_device *rdev); | ||
81 | void r100_hpd_init(struct radeon_device *rdev); | 80 | void r100_hpd_init(struct radeon_device *rdev); |
82 | void r100_hpd_fini(struct radeon_device *rdev); | 81 | void r100_hpd_fini(struct radeon_device *rdev); |
83 | bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); | 82 | bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); |
@@ -114,7 +113,6 @@ static struct radeon_asic r100_asic = { | |||
114 | .set_surface_reg = r100_set_surface_reg, | 113 | .set_surface_reg = r100_set_surface_reg, |
115 | .clear_surface_reg = r100_clear_surface_reg, | 114 | .clear_surface_reg = r100_clear_surface_reg, |
116 | .bandwidth_update = &r100_bandwidth_update, | 115 | .bandwidth_update = &r100_bandwidth_update, |
117 | .hdp_flush = &r100_hdp_flush, | ||
118 | .hpd_init = &r100_hpd_init, | 116 | .hpd_init = &r100_hpd_init, |
119 | .hpd_fini = &r100_hpd_fini, | 117 | .hpd_fini = &r100_hpd_fini, |
120 | .hpd_sense = &r100_hpd_sense, | 118 | .hpd_sense = &r100_hpd_sense, |
@@ -174,7 +172,6 @@ static struct radeon_asic r300_asic = { | |||
174 | .set_surface_reg = r100_set_surface_reg, | 172 | .set_surface_reg = r100_set_surface_reg, |
175 | .clear_surface_reg = r100_clear_surface_reg, | 173 | .clear_surface_reg = r100_clear_surface_reg, |
176 | .bandwidth_update = &r100_bandwidth_update, | 174 | .bandwidth_update = &r100_bandwidth_update, |
177 | .hdp_flush = &r100_hdp_flush, | ||
178 | .hpd_init = &r100_hpd_init, | 175 | .hpd_init = &r100_hpd_init, |
179 | .hpd_fini = &r100_hpd_fini, | 176 | .hpd_fini = &r100_hpd_fini, |
180 | .hpd_sense = &r100_hpd_sense, | 177 | .hpd_sense = &r100_hpd_sense, |
@@ -218,7 +215,6 @@ static struct radeon_asic r420_asic = { | |||
218 | .set_surface_reg = r100_set_surface_reg, | 215 | .set_surface_reg = r100_set_surface_reg, |
219 | .clear_surface_reg = r100_clear_surface_reg, | 216 | .clear_surface_reg = r100_clear_surface_reg, |
220 | .bandwidth_update = &r100_bandwidth_update, | 217 | .bandwidth_update = &r100_bandwidth_update, |
221 | .hdp_flush = &r100_hdp_flush, | ||
222 | .hpd_init = &r100_hpd_init, | 218 | .hpd_init = &r100_hpd_init, |
223 | .hpd_fini = &r100_hpd_fini, | 219 | .hpd_fini = &r100_hpd_fini, |
224 | .hpd_sense = &r100_hpd_sense, | 220 | .hpd_sense = &r100_hpd_sense, |
@@ -267,7 +263,6 @@ static struct radeon_asic rs400_asic = { | |||
267 | .set_surface_reg = r100_set_surface_reg, | 263 | .set_surface_reg = r100_set_surface_reg, |
268 | .clear_surface_reg = r100_clear_surface_reg, | 264 | .clear_surface_reg = r100_clear_surface_reg, |
269 | .bandwidth_update = &r100_bandwidth_update, | 265 | .bandwidth_update = &r100_bandwidth_update, |
270 | .hdp_flush = &r100_hdp_flush, | ||
271 | .hpd_init = &r100_hpd_init, | 266 | .hpd_init = &r100_hpd_init, |
272 | .hpd_fini = &r100_hpd_fini, | 267 | .hpd_fini = &r100_hpd_fini, |
273 | .hpd_sense = &r100_hpd_sense, | 268 | .hpd_sense = &r100_hpd_sense, |
@@ -324,7 +319,6 @@ static struct radeon_asic rs600_asic = { | |||
324 | .set_pcie_lanes = NULL, | 319 | .set_pcie_lanes = NULL, |
325 | .set_clock_gating = &radeon_atom_set_clock_gating, | 320 | .set_clock_gating = &radeon_atom_set_clock_gating, |
326 | .bandwidth_update = &rs600_bandwidth_update, | 321 | .bandwidth_update = &rs600_bandwidth_update, |
327 | .hdp_flush = &r100_hdp_flush, | ||
328 | .hpd_init = &rs600_hpd_init, | 322 | .hpd_init = &rs600_hpd_init, |
329 | .hpd_fini = &rs600_hpd_fini, | 323 | .hpd_fini = &rs600_hpd_fini, |
330 | .hpd_sense = &rs600_hpd_sense, | 324 | .hpd_sense = &rs600_hpd_sense, |
@@ -372,7 +366,6 @@ static struct radeon_asic rs690_asic = { | |||
372 | .set_surface_reg = r100_set_surface_reg, | 366 | .set_surface_reg = r100_set_surface_reg, |
373 | .clear_surface_reg = r100_clear_surface_reg, | 367 | .clear_surface_reg = r100_clear_surface_reg, |
374 | .bandwidth_update = &rs690_bandwidth_update, | 368 | .bandwidth_update = &rs690_bandwidth_update, |
375 | .hdp_flush = &r100_hdp_flush, | ||
376 | .hpd_init = &rs600_hpd_init, | 369 | .hpd_init = &rs600_hpd_init, |
377 | .hpd_fini = &rs600_hpd_fini, | 370 | .hpd_fini = &rs600_hpd_fini, |
378 | .hpd_sense = &rs600_hpd_sense, | 371 | .hpd_sense = &rs600_hpd_sense, |
@@ -424,7 +417,6 @@ static struct radeon_asic rv515_asic = { | |||
424 | .set_surface_reg = r100_set_surface_reg, | 417 | .set_surface_reg = r100_set_surface_reg, |
425 | .clear_surface_reg = r100_clear_surface_reg, | 418 | .clear_surface_reg = r100_clear_surface_reg, |
426 | .bandwidth_update = &rv515_bandwidth_update, | 419 | .bandwidth_update = &rv515_bandwidth_update, |
427 | .hdp_flush = &r100_hdp_flush, | ||
428 | .hpd_init = &rs600_hpd_init, | 420 | .hpd_init = &rs600_hpd_init, |
429 | .hpd_fini = &rs600_hpd_fini, | 421 | .hpd_fini = &rs600_hpd_fini, |
430 | .hpd_sense = &rs600_hpd_sense, | 422 | .hpd_sense = &rs600_hpd_sense, |
@@ -467,7 +459,6 @@ static struct radeon_asic r520_asic = { | |||
467 | .set_surface_reg = r100_set_surface_reg, | 459 | .set_surface_reg = r100_set_surface_reg, |
468 | .clear_surface_reg = r100_clear_surface_reg, | 460 | .clear_surface_reg = r100_clear_surface_reg, |
469 | .bandwidth_update = &rv515_bandwidth_update, | 461 | .bandwidth_update = &rv515_bandwidth_update, |
470 | .hdp_flush = &r100_hdp_flush, | ||
471 | .hpd_init = &rs600_hpd_init, | 462 | .hpd_init = &rs600_hpd_init, |
472 | .hpd_fini = &rs600_hpd_fini, | 463 | .hpd_fini = &rs600_hpd_fini, |
473 | .hpd_sense = &rs600_hpd_sense, | 464 | .hpd_sense = &rs600_hpd_sense, |
@@ -508,7 +499,6 @@ int r600_ring_test(struct radeon_device *rdev); | |||
508 | int r600_copy_blit(struct radeon_device *rdev, | 499 | int r600_copy_blit(struct radeon_device *rdev, |
509 | uint64_t src_offset, uint64_t dst_offset, | 500 | uint64_t src_offset, uint64_t dst_offset, |
510 | unsigned num_pages, struct radeon_fence *fence); | 501 | unsigned num_pages, struct radeon_fence *fence); |
511 | void r600_hdp_flush(struct radeon_device *rdev); | ||
512 | void r600_hpd_init(struct radeon_device *rdev); | 502 | void r600_hpd_init(struct radeon_device *rdev); |
513 | void r600_hpd_fini(struct radeon_device *rdev); | 503 | void r600_hpd_fini(struct radeon_device *rdev); |
514 | bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); | 504 | bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); |
@@ -544,7 +534,6 @@ static struct radeon_asic r600_asic = { | |||
544 | .set_surface_reg = r600_set_surface_reg, | 534 | .set_surface_reg = r600_set_surface_reg, |
545 | .clear_surface_reg = r600_clear_surface_reg, | 535 | .clear_surface_reg = r600_clear_surface_reg, |
546 | .bandwidth_update = &rv515_bandwidth_update, | 536 | .bandwidth_update = &rv515_bandwidth_update, |
547 | .hdp_flush = &r600_hdp_flush, | ||
548 | .hpd_init = &r600_hpd_init, | 537 | .hpd_init = &r600_hpd_init, |
549 | .hpd_fini = &r600_hpd_fini, | 538 | .hpd_fini = &r600_hpd_fini, |
550 | .hpd_sense = &r600_hpd_sense, | 539 | .hpd_sense = &r600_hpd_sense, |
@@ -589,7 +578,6 @@ static struct radeon_asic rv770_asic = { | |||
589 | .set_surface_reg = r600_set_surface_reg, | 578 | .set_surface_reg = r600_set_surface_reg, |
590 | .clear_surface_reg = r600_clear_surface_reg, | 579 | .clear_surface_reg = r600_clear_surface_reg, |
591 | .bandwidth_update = &rv515_bandwidth_update, | 580 | .bandwidth_update = &rv515_bandwidth_update, |
592 | .hdp_flush = &r600_hdp_flush, | ||
593 | .hpd_init = &r600_hpd_init, | 581 | .hpd_init = &r600_hpd_init, |
594 | .hpd_fini = &r600_hpd_fini, | 582 | .hpd_fini = &r600_hpd_fini, |
595 | .hpd_sense = &r600_hpd_sense, | 583 | .hpd_sense = &r600_hpd_sense, |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 321044bef71c..fa82ca74324e 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -114,6 +114,7 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
114 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | 114 | i2c.i2c_id = gpio->sucI2cId.ucAccess; |
115 | 115 | ||
116 | i2c.valid = true; | 116 | i2c.valid = true; |
117 | break; | ||
117 | } | 118 | } |
118 | } | 119 | } |
119 | 120 | ||
@@ -345,7 +346,9 @@ const int object_connector_convert[] = { | |||
345 | DRM_MODE_CONNECTOR_Unknown, | 346 | DRM_MODE_CONNECTOR_Unknown, |
346 | DRM_MODE_CONNECTOR_Unknown, | 347 | DRM_MODE_CONNECTOR_Unknown, |
347 | DRM_MODE_CONNECTOR_Unknown, | 348 | DRM_MODE_CONNECTOR_Unknown, |
348 | DRM_MODE_CONNECTOR_DisplayPort | 349 | DRM_MODE_CONNECTOR_DisplayPort, |
350 | DRM_MODE_CONNECTOR_eDP, | ||
351 | DRM_MODE_CONNECTOR_Unknown | ||
349 | }; | 352 | }; |
350 | 353 | ||
351 | bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | 354 | bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) |
@@ -935,6 +938,43 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
935 | return false; | 938 | return false; |
936 | } | 939 | } |
937 | 940 | ||
941 | union igp_info { | ||
942 | struct _ATOM_INTEGRATED_SYSTEM_INFO info; | ||
943 | struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_2; | ||
944 | }; | ||
945 | |||
946 | bool radeon_atombios_sideport_present(struct radeon_device *rdev) | ||
947 | { | ||
948 | struct radeon_mode_info *mode_info = &rdev->mode_info; | ||
949 | int index = GetIndexIntoMasterTable(DATA, IntegratedSystemInfo); | ||
950 | union igp_info *igp_info; | ||
951 | u8 frev, crev; | ||
952 | u16 data_offset; | ||
953 | |||
954 | atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, | ||
955 | &crev, &data_offset); | ||
956 | |||
957 | igp_info = (union igp_info *)(mode_info->atom_context->bios + | ||
958 | data_offset); | ||
959 | |||
960 | if (igp_info) { | ||
961 | switch (crev) { | ||
962 | case 1: | ||
963 | if (igp_info->info.ucMemoryType & 0xf0) | ||
964 | return true; | ||
965 | break; | ||
966 | case 2: | ||
967 | if (igp_info->info_2.ucMemoryType & 0x0f) | ||
968 | return true; | ||
969 | break; | ||
970 | default: | ||
971 | DRM_ERROR("Unsupported IGP table: %d %d\n", frev, crev); | ||
972 | break; | ||
973 | } | ||
974 | } | ||
975 | return false; | ||
976 | } | ||
977 | |||
938 | bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, | 978 | bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, |
939 | struct radeon_encoder_int_tmds *tmds) | 979 | struct radeon_encoder_int_tmds *tmds) |
940 | { | 980 | { |
@@ -1026,6 +1066,7 @@ static struct radeon_atom_ss *radeon_atombios_get_ss_info(struct | |||
1026 | ss->delay = ss_info->asSS_Info[i].ucSS_Delay; | 1066 | ss->delay = ss_info->asSS_Info[i].ucSS_Delay; |
1027 | ss->range = ss_info->asSS_Info[i].ucSS_Range; | 1067 | ss->range = ss_info->asSS_Info[i].ucSS_Range; |
1028 | ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div; | 1068 | ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div; |
1069 | break; | ||
1029 | } | 1070 | } |
1030 | } | 1071 | } |
1031 | } | 1072 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index fd94dbca33ac..7914455c96ca 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -595,6 +595,48 @@ bool radeon_combios_get_clock_info(struct drm_device *dev) | |||
595 | return false; | 595 | return false; |
596 | } | 596 | } |
597 | 597 | ||
598 | bool radeon_combios_sideport_present(struct radeon_device *rdev) | ||
599 | { | ||
600 | struct drm_device *dev = rdev->ddev; | ||
601 | u16 igp_info; | ||
602 | |||
603 | igp_info = combios_get_table_offset(dev, COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE); | ||
604 | |||
605 | if (igp_info) { | ||
606 | if (RBIOS16(igp_info + 0x4)) | ||
607 | return true; | ||
608 | } | ||
609 | return false; | ||
610 | } | ||
611 | |||
612 | static const uint32_t default_primarydac_adj[CHIP_LAST] = { | ||
613 | 0x00000808, /* r100 */ | ||
614 | 0x00000808, /* rv100 */ | ||
615 | 0x00000808, /* rs100 */ | ||
616 | 0x00000808, /* rv200 */ | ||
617 | 0x00000808, /* rs200 */ | ||
618 | 0x00000808, /* r200 */ | ||
619 | 0x00000808, /* rv250 */ | ||
620 | 0x00000000, /* rs300 */ | ||
621 | 0x00000808, /* rv280 */ | ||
622 | 0x00000808, /* r300 */ | ||
623 | 0x00000808, /* r350 */ | ||
624 | 0x00000808, /* rv350 */ | ||
625 | 0x00000808, /* rv380 */ | ||
626 | 0x00000808, /* r420 */ | ||
627 | 0x00000808, /* r423 */ | ||
628 | 0x00000808, /* rv410 */ | ||
629 | 0x00000000, /* rs400 */ | ||
630 | 0x00000000, /* rs480 */ | ||
631 | }; | ||
632 | |||
633 | static void radeon_legacy_get_primary_dac_info_from_table(struct radeon_device *rdev, | ||
634 | struct radeon_encoder_primary_dac *p_dac) | ||
635 | { | ||
636 | p_dac->ps2_pdac_adj = default_primarydac_adj[rdev->family]; | ||
637 | return; | ||
638 | } | ||
639 | |||
598 | struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct | 640 | struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct |
599 | radeon_encoder | 641 | radeon_encoder |
600 | *encoder) | 642 | *encoder) |
@@ -604,20 +646,20 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct | |||
604 | uint16_t dac_info; | 646 | uint16_t dac_info; |
605 | uint8_t rev, bg, dac; | 647 | uint8_t rev, bg, dac; |
606 | struct radeon_encoder_primary_dac *p_dac = NULL; | 648 | struct radeon_encoder_primary_dac *p_dac = NULL; |
649 | int found = 0; | ||
607 | 650 | ||
608 | if (rdev->bios == NULL) | 651 | p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac), |
652 | GFP_KERNEL); | ||
653 | |||
654 | if (!p_dac) | ||
609 | return NULL; | 655 | return NULL; |
610 | 656 | ||
657 | if (rdev->bios == NULL) | ||
658 | goto out; | ||
659 | |||
611 | /* check CRT table */ | 660 | /* check CRT table */ |
612 | dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); | 661 | dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); |
613 | if (dac_info) { | 662 | if (dac_info) { |
614 | p_dac = | ||
615 | kzalloc(sizeof(struct radeon_encoder_primary_dac), | ||
616 | GFP_KERNEL); | ||
617 | |||
618 | if (!p_dac) | ||
619 | return NULL; | ||
620 | |||
621 | rev = RBIOS8(dac_info) & 0x3; | 663 | rev = RBIOS8(dac_info) & 0x3; |
622 | if (rev < 2) { | 664 | if (rev < 2) { |
623 | bg = RBIOS8(dac_info + 0x2) & 0xf; | 665 | bg = RBIOS8(dac_info + 0x2) & 0xf; |
@@ -628,9 +670,13 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct | |||
628 | dac = RBIOS8(dac_info + 0x3) & 0xf; | 670 | dac = RBIOS8(dac_info + 0x3) & 0xf; |
629 | p_dac->ps2_pdac_adj = (bg << 8) | (dac); | 671 | p_dac->ps2_pdac_adj = (bg << 8) | (dac); |
630 | } | 672 | } |
631 | 673 | found = 1; | |
632 | } | 674 | } |
633 | 675 | ||
676 | out: | ||
677 | if (!found) /* fallback to defaults */ | ||
678 | radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac); | ||
679 | |||
634 | return p_dac; | 680 | return p_dac; |
635 | } | 681 | } |
636 | 682 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 20161567dbff..9da10dd5df80 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -49,8 +49,10 @@ void radeon_connector_hotplug(struct drm_connector *connector) | |||
49 | if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) | 49 | if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) |
50 | radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); | 50 | radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); |
51 | 51 | ||
52 | if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { | 52 | if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
53 | if (radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_DISPLAYPORT) { | 53 | (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) { |
54 | if ((radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_DISPLAYPORT) || | ||
55 | (radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_eDP)) { | ||
54 | if (radeon_dp_needs_link_train(radeon_connector)) { | 56 | if (radeon_dp_needs_link_train(radeon_connector)) { |
55 | if (connector->encoder) | 57 | if (connector->encoder) |
56 | dp_link_train(connector->encoder, connector); | 58 | dp_link_train(connector->encoder, connector); |
@@ -615,7 +617,7 @@ static enum drm_connector_status radeon_vga_detect(struct drm_connector *connect | |||
615 | ret = connector_status_connected; | 617 | ret = connector_status_connected; |
616 | } | 618 | } |
617 | } else { | 619 | } else { |
618 | if (radeon_connector->dac_load_detect) { | 620 | if (radeon_connector->dac_load_detect && encoder) { |
619 | encoder_funcs = encoder->helper_private; | 621 | encoder_funcs = encoder->helper_private; |
620 | ret = encoder_funcs->detect(encoder, connector); | 622 | ret = encoder_funcs->detect(encoder, connector); |
621 | } | 623 | } |
@@ -967,7 +969,8 @@ static enum drm_connector_status radeon_dp_detect(struct drm_connector *connecto | |||
967 | } | 969 | } |
968 | 970 | ||
969 | sink_type = radeon_dp_getsinktype(radeon_connector); | 971 | sink_type = radeon_dp_getsinktype(radeon_connector); |
970 | if (sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { | 972 | if ((sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
973 | (sink_type == CONNECTOR_OBJECT_ID_eDP)) { | ||
971 | if (radeon_dp_getdpcd(radeon_connector)) { | 974 | if (radeon_dp_getdpcd(radeon_connector)) { |
972 | radeon_dig_connector->dp_sink_type = sink_type; | 975 | radeon_dig_connector->dp_sink_type = sink_type; |
973 | ret = connector_status_connected; | 976 | ret = connector_status_connected; |
@@ -992,7 +995,8 @@ static int radeon_dp_mode_valid(struct drm_connector *connector, | |||
992 | 995 | ||
993 | /* XXX check mode bandwidth */ | 996 | /* XXX check mode bandwidth */ |
994 | 997 | ||
995 | if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) | 998 | if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
999 | (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | ||
996 | return radeon_dp_mode_valid_helper(radeon_connector, mode); | 1000 | return radeon_dp_mode_valid_helper(radeon_connector, mode); |
997 | else | 1001 | else |
998 | return MODE_OK; | 1002 | return MODE_OK; |
@@ -1145,6 +1149,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1145 | subpixel_order = SubPixelHorizontalRGB; | 1149 | subpixel_order = SubPixelHorizontalRGB; |
1146 | break; | 1150 | break; |
1147 | case DRM_MODE_CONNECTOR_DisplayPort: | 1151 | case DRM_MODE_CONNECTOR_DisplayPort: |
1152 | case DRM_MODE_CONNECTOR_eDP: | ||
1148 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); | 1153 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
1149 | if (!radeon_dig_connector) | 1154 | if (!radeon_dig_connector) |
1150 | goto failed; | 1155 | goto failed; |
@@ -1157,10 +1162,16 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1157 | goto failed; | 1162 | goto failed; |
1158 | if (i2c_bus->valid) { | 1163 | if (i2c_bus->valid) { |
1159 | /* add DP i2c bus */ | 1164 | /* add DP i2c bus */ |
1160 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); | 1165 | if (connector_type == DRM_MODE_CONNECTOR_eDP) |
1166 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch"); | ||
1167 | else | ||
1168 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); | ||
1161 | if (!radeon_dig_connector->dp_i2c_bus) | 1169 | if (!radeon_dig_connector->dp_i2c_bus) |
1162 | goto failed; | 1170 | goto failed; |
1163 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP"); | 1171 | if (connector_type == DRM_MODE_CONNECTOR_eDP) |
1172 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "eDP"); | ||
1173 | else | ||
1174 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP"); | ||
1164 | if (!radeon_connector->ddc_bus) | 1175 | if (!radeon_connector->ddc_bus) |
1165 | goto failed; | 1176 | goto failed; |
1166 | } | 1177 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c index 0b2f9c2ad2c1..06123ba31d31 100644 --- a/drivers/gpu/drm/radeon/radeon_cp.c +++ b/drivers/gpu/drm/radeon/radeon_cp.c | |||
@@ -2145,6 +2145,7 @@ int radeon_master_create(struct drm_device *dev, struct drm_master *master) | |||
2145 | &master_priv->sarea); | 2145 | &master_priv->sarea); |
2146 | if (ret) { | 2146 | if (ret) { |
2147 | DRM_ERROR("SAREA setup failed\n"); | 2147 | DRM_ERROR("SAREA setup failed\n"); |
2148 | kfree(master_priv); | ||
2148 | return ret; | 2149 | return ret; |
2149 | } | 2150 | } |
2150 | master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea); | 2151 | master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 7c6848096bcd..0c51f8e46613 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -733,16 +733,18 @@ void radeon_device_fini(struct radeon_device *rdev) | |||
733 | */ | 733 | */ |
734 | int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | 734 | int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) |
735 | { | 735 | { |
736 | struct radeon_device *rdev = dev->dev_private; | 736 | struct radeon_device *rdev; |
737 | struct drm_crtc *crtc; | 737 | struct drm_crtc *crtc; |
738 | int r; | 738 | int r; |
739 | 739 | ||
740 | if (dev == NULL || rdev == NULL) { | 740 | if (dev == NULL || dev->dev_private == NULL) { |
741 | return -ENODEV; | 741 | return -ENODEV; |
742 | } | 742 | } |
743 | if (state.event == PM_EVENT_PRETHAW) { | 743 | if (state.event == PM_EVENT_PRETHAW) { |
744 | return 0; | 744 | return 0; |
745 | } | 745 | } |
746 | rdev = dev->dev_private; | ||
747 | |||
746 | /* unpin the front buffers */ | 748 | /* unpin the front buffers */ |
747 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 749 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
748 | struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb); | 750 | struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 91d72b70abc9..0ec491ead2ff 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -234,7 +234,7 @@ static const char *encoder_names[34] = { | |||
234 | "INTERNAL_UNIPHY2", | 234 | "INTERNAL_UNIPHY2", |
235 | }; | 235 | }; |
236 | 236 | ||
237 | static const char *connector_names[13] = { | 237 | static const char *connector_names[15] = { |
238 | "Unknown", | 238 | "Unknown", |
239 | "VGA", | 239 | "VGA", |
240 | "DVI-I", | 240 | "DVI-I", |
@@ -248,6 +248,8 @@ static const char *connector_names[13] = { | |||
248 | "DisplayPort", | 248 | "DisplayPort", |
249 | "HDMI-A", | 249 | "HDMI-A", |
250 | "HDMI-B", | 250 | "HDMI-B", |
251 | "TV", | ||
252 | "eDP", | ||
251 | }; | 253 | }; |
252 | 254 | ||
253 | static const char *hpd_names[7] = { | 255 | static const char *hpd_names[7] = { |
@@ -329,8 +331,11 @@ static bool radeon_setup_enc_conn(struct drm_device *dev) | |||
329 | ret = radeon_get_atom_connector_info_from_object_table(dev); | 331 | ret = radeon_get_atom_connector_info_from_object_table(dev); |
330 | else | 332 | else |
331 | ret = radeon_get_atom_connector_info_from_supported_devices_table(dev); | 333 | ret = radeon_get_atom_connector_info_from_supported_devices_table(dev); |
332 | } else | 334 | } else { |
333 | ret = radeon_get_legacy_connector_info_from_bios(dev); | 335 | ret = radeon_get_legacy_connector_info_from_bios(dev); |
336 | if (ret == false) | ||
337 | ret = radeon_get_legacy_connector_info_from_table(dev); | ||
338 | } | ||
334 | } else { | 339 | } else { |
335 | if (!ASIC_IS_AVIVO(rdev)) | 340 | if (!ASIC_IS_AVIVO(rdev)) |
336 | ret = radeon_get_legacy_connector_info_from_table(dev); | 341 | ret = radeon_get_legacy_connector_info_from_table(dev); |
@@ -349,7 +354,8 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | |||
349 | { | 354 | { |
350 | int ret = 0; | 355 | int ret = 0; |
351 | 356 | ||
352 | if (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) { | 357 | if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
358 | (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { | ||
353 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | 359 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; |
354 | if (dig->dp_i2c_bus) | 360 | if (dig->dp_i2c_bus) |
355 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter); | 361 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter); |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index ccba95f83d11..82eb551970b9 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -596,21 +596,23 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
596 | return ATOM_ENCODER_MODE_LVDS; | 596 | return ATOM_ENCODER_MODE_LVDS; |
597 | break; | 597 | break; |
598 | case DRM_MODE_CONNECTOR_DisplayPort: | 598 | case DRM_MODE_CONNECTOR_DisplayPort: |
599 | case DRM_MODE_CONNECTOR_eDP: | ||
599 | radeon_dig_connector = radeon_connector->con_priv; | 600 | radeon_dig_connector = radeon_connector->con_priv; |
600 | if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) | 601 | if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
602 | (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | ||
601 | return ATOM_ENCODER_MODE_DP; | 603 | return ATOM_ENCODER_MODE_DP; |
602 | else if (drm_detect_hdmi_monitor(radeon_connector->edid)) | 604 | else if (drm_detect_hdmi_monitor(radeon_connector->edid)) |
603 | return ATOM_ENCODER_MODE_HDMI; | 605 | return ATOM_ENCODER_MODE_HDMI; |
604 | else | 606 | else |
605 | return ATOM_ENCODER_MODE_DVI; | 607 | return ATOM_ENCODER_MODE_DVI; |
606 | break; | 608 | break; |
607 | case CONNECTOR_DVI_A: | 609 | case DRM_MODE_CONNECTOR_DVIA: |
608 | case CONNECTOR_VGA: | 610 | case DRM_MODE_CONNECTOR_VGA: |
609 | return ATOM_ENCODER_MODE_CRT; | 611 | return ATOM_ENCODER_MODE_CRT; |
610 | break; | 612 | break; |
611 | case CONNECTOR_STV: | 613 | case DRM_MODE_CONNECTOR_Composite: |
612 | case CONNECTOR_CTV: | 614 | case DRM_MODE_CONNECTOR_SVIDEO: |
613 | case CONNECTOR_DIN: | 615 | case DRM_MODE_CONNECTOR_9PinDIN: |
614 | /* fix me */ | 616 | /* fix me */ |
615 | return ATOM_ENCODER_MODE_TV; | 617 | return ATOM_ENCODER_MODE_TV; |
616 | /*return ATOM_ENCODER_MODE_CV;*/ | 618 | /*return ATOM_ENCODER_MODE_CV;*/ |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 4cdd8b4f7549..8495d4e32e18 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -140,16 +140,15 @@ int radeon_fence_create(struct radeon_device *rdev, struct radeon_fence **fence) | |||
140 | 140 | ||
141 | bool radeon_fence_signaled(struct radeon_fence *fence) | 141 | bool radeon_fence_signaled(struct radeon_fence *fence) |
142 | { | 142 | { |
143 | struct radeon_device *rdev = fence->rdev; | ||
144 | unsigned long irq_flags; | 143 | unsigned long irq_flags; |
145 | bool signaled = false; | 144 | bool signaled = false; |
146 | 145 | ||
147 | if (rdev->gpu_lockup) { | 146 | if (!fence) |
148 | return true; | 147 | return true; |
149 | } | 148 | |
150 | if (fence == NULL) { | 149 | if (fence->rdev->gpu_lockup) |
151 | return true; | 150 | return true; |
152 | } | 151 | |
153 | write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags); | 152 | write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags); |
154 | signaled = fence->signaled; | 153 | signaled = fence->signaled; |
155 | /* if we are shuting down report all fence as signaled */ | 154 | /* if we are shuting down report all fence as signaled */ |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index 60df2d7e7e4c..0e1325e18534 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -131,7 +131,6 @@ int radeon_gem_set_domain(struct drm_gem_object *gobj, | |||
131 | printk(KERN_ERR "Failed to wait for object !\n"); | 131 | printk(KERN_ERR "Failed to wait for object !\n"); |
132 | return r; | 132 | return r; |
133 | } | 133 | } |
134 | radeon_hdp_flush(robj->rdev); | ||
135 | } | 134 | } |
136 | return 0; | 135 | return 0; |
137 | } | 136 | } |
@@ -312,7 +311,6 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | |||
312 | mutex_lock(&dev->struct_mutex); | 311 | mutex_lock(&dev->struct_mutex); |
313 | drm_gem_object_unreference(gobj); | 312 | drm_gem_object_unreference(gobj); |
314 | mutex_unlock(&dev->struct_mutex); | 313 | mutex_unlock(&dev->struct_mutex); |
315 | radeon_hdp_flush(robj->rdev); | ||
316 | return r; | 314 | return r; |
317 | } | 315 | } |
318 | 316 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c index b79ecc4a7cc4..2f349a300195 100644 --- a/drivers/gpu/drm/radeon/radeon_irq.c +++ b/drivers/gpu/drm/radeon/radeon_irq.c | |||
@@ -289,16 +289,16 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr | |||
289 | drm_radeon_irq_emit_t *emit = data; | 289 | drm_radeon_irq_emit_t *emit = data; |
290 | int result; | 290 | int result; |
291 | 291 | ||
292 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) | ||
293 | return -EINVAL; | ||
294 | |||
295 | LOCK_TEST_WITH_RETURN(dev, file_priv); | ||
296 | |||
297 | if (!dev_priv) { | 292 | if (!dev_priv) { |
298 | DRM_ERROR("called with no initialization\n"); | 293 | DRM_ERROR("called with no initialization\n"); |
299 | return -EINVAL; | 294 | return -EINVAL; |
300 | } | 295 | } |
301 | 296 | ||
297 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) | ||
298 | return -EINVAL; | ||
299 | |||
300 | LOCK_TEST_WITH_RETURN(dev, file_priv); | ||
301 | |||
302 | result = radeon_emit_irq(dev); | 302 | result = radeon_emit_irq(dev); |
303 | 303 | ||
304 | if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) { | 304 | if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) { |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 9223296fe37b..3cfd60fd0083 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -97,6 +97,7 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev) | |||
97 | rdev->irq.sw_int = false; | 97 | rdev->irq.sw_int = false; |
98 | for (i = 0; i < 2; i++) { | 98 | for (i = 0; i < 2; i++) { |
99 | rdev->irq.crtc_vblank_int[i] = false; | 99 | rdev->irq.crtc_vblank_int[i] = false; |
100 | rdev->irq.hpd[i] = false; | ||
100 | } | 101 | } |
101 | radeon_irq_set(rdev); | 102 | radeon_irq_set(rdev); |
102 | } | 103 | } |
@@ -128,17 +129,22 @@ int radeon_irq_kms_init(struct radeon_device *rdev) | |||
128 | DRM_INFO("radeon: using MSI.\n"); | 129 | DRM_INFO("radeon: using MSI.\n"); |
129 | } | 130 | } |
130 | } | 131 | } |
131 | drm_irq_install(rdev->ddev); | ||
132 | rdev->irq.installed = true; | 132 | rdev->irq.installed = true; |
133 | r = drm_irq_install(rdev->ddev); | ||
134 | if (r) { | ||
135 | rdev->irq.installed = false; | ||
136 | return r; | ||
137 | } | ||
133 | DRM_INFO("radeon: irq initialized.\n"); | 138 | DRM_INFO("radeon: irq initialized.\n"); |
134 | return 0; | 139 | return 0; |
135 | } | 140 | } |
136 | 141 | ||
137 | void radeon_irq_kms_fini(struct radeon_device *rdev) | 142 | void radeon_irq_kms_fini(struct radeon_device *rdev) |
138 | { | 143 | { |
144 | drm_vblank_cleanup(rdev->ddev); | ||
139 | if (rdev->irq.installed) { | 145 | if (rdev->irq.installed) { |
140 | rdev->irq.installed = false; | ||
141 | drm_irq_uninstall(rdev->ddev); | 146 | drm_irq_uninstall(rdev->ddev); |
147 | rdev->irq.installed = false; | ||
142 | if (rdev->msi_enabled) | 148 | if (rdev->msi_enabled) |
143 | pci_disable_msi(rdev->pdev); | 149 | pci_disable_msi(rdev->pdev); |
144 | } | 150 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_tv.c b/drivers/gpu/drm/radeon/radeon_legacy_tv.c index 3a12bb0c0563..417684daef4c 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_tv.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_tv.c | |||
@@ -77,7 +77,7 @@ struct radeon_tv_mode_constants { | |||
77 | unsigned pix_to_tv; | 77 | unsigned pix_to_tv; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static const uint16_t hor_timing_NTSC[] = { | 80 | static const uint16_t hor_timing_NTSC[MAX_H_CODE_TIMING_LEN] = { |
81 | 0x0007, | 81 | 0x0007, |
82 | 0x003f, | 82 | 0x003f, |
83 | 0x0263, | 83 | 0x0263, |
@@ -98,7 +98,7 @@ static const uint16_t hor_timing_NTSC[] = { | |||
98 | 0 | 98 | 0 |
99 | }; | 99 | }; |
100 | 100 | ||
101 | static const uint16_t vert_timing_NTSC[] = { | 101 | static const uint16_t vert_timing_NTSC[MAX_V_CODE_TIMING_LEN] = { |
102 | 0x2001, | 102 | 0x2001, |
103 | 0x200d, | 103 | 0x200d, |
104 | 0x1006, | 104 | 0x1006, |
@@ -115,7 +115,7 @@ static const uint16_t vert_timing_NTSC[] = { | |||
115 | 0 | 115 | 0 |
116 | }; | 116 | }; |
117 | 117 | ||
118 | static const uint16_t hor_timing_PAL[] = { | 118 | static const uint16_t hor_timing_PAL[MAX_H_CODE_TIMING_LEN] = { |
119 | 0x0007, | 119 | 0x0007, |
120 | 0x0058, | 120 | 0x0058, |
121 | 0x027c, | 121 | 0x027c, |
@@ -136,7 +136,7 @@ static const uint16_t hor_timing_PAL[] = { | |||
136 | 0 | 136 | 0 |
137 | }; | 137 | }; |
138 | 138 | ||
139 | static const uint16_t vert_timing_PAL[] = { | 139 | static const uint16_t vert_timing_PAL[MAX_V_CODE_TIMING_LEN] = { |
140 | 0x2001, | 140 | 0x2001, |
141 | 0x200c, | 141 | 0x200c, |
142 | 0x1005, | 142 | 0x1005, |
@@ -623,9 +623,9 @@ void radeon_legacy_tv_mode_set(struct drm_encoder *encoder, | |||
623 | } | 623 | } |
624 | flicker_removal = (tmp + 500) / 1000; | 624 | flicker_removal = (tmp + 500) / 1000; |
625 | 625 | ||
626 | if (flicker_removal < 3) | 626 | if (flicker_removal < 2) |
627 | flicker_removal = 3; | 627 | flicker_removal = 2; |
628 | for (i = 0; i < 6; ++i) { | 628 | for (i = 0; i < ARRAY_SIZE(SLOPE_limit); ++i) { |
629 | if (flicker_removal == SLOPE_limit[i]) | 629 | if (flicker_removal == SLOPE_limit[i]) |
630 | break; | 630 | break; |
631 | } | 631 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 402369db5ba0..91cb041cb40d 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -46,32 +46,6 @@ struct radeon_device; | |||
46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) | 46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) |
47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) | 47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) |
48 | 48 | ||
49 | enum radeon_connector_type { | ||
50 | CONNECTOR_NONE, | ||
51 | CONNECTOR_VGA, | ||
52 | CONNECTOR_DVI_I, | ||
53 | CONNECTOR_DVI_D, | ||
54 | CONNECTOR_DVI_A, | ||
55 | CONNECTOR_STV, | ||
56 | CONNECTOR_CTV, | ||
57 | CONNECTOR_LVDS, | ||
58 | CONNECTOR_DIGITAL, | ||
59 | CONNECTOR_SCART, | ||
60 | CONNECTOR_HDMI_TYPE_A, | ||
61 | CONNECTOR_HDMI_TYPE_B, | ||
62 | CONNECTOR_0XC, | ||
63 | CONNECTOR_0XD, | ||
64 | CONNECTOR_DIN, | ||
65 | CONNECTOR_DISPLAY_PORT, | ||
66 | CONNECTOR_UNSUPPORTED | ||
67 | }; | ||
68 | |||
69 | enum radeon_dvi_type { | ||
70 | DVI_AUTO, | ||
71 | DVI_DIGITAL, | ||
72 | DVI_ANALOG | ||
73 | }; | ||
74 | |||
75 | enum radeon_rmx_type { | 49 | enum radeon_rmx_type { |
76 | RMX_OFF, | 50 | RMX_OFF, |
77 | RMX_FULL, | 51 | RMX_FULL, |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index d9ffe1f56e8f..4e636de877b2 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -221,8 +221,9 @@ int radeon_bo_unpin(struct radeon_bo *bo) | |||
221 | int radeon_bo_evict_vram(struct radeon_device *rdev) | 221 | int radeon_bo_evict_vram(struct radeon_device *rdev) |
222 | { | 222 | { |
223 | if (rdev->flags & RADEON_IS_IGP) { | 223 | if (rdev->flags & RADEON_IS_IGP) { |
224 | /* Useless to evict on IGP chips */ | 224 | if (rdev->mc.igp_sideport_enabled == false) |
225 | return 0; | 225 | /* Useless to evict on IGP chips */ |
226 | return 0; | ||
226 | } | 227 | } |
227 | return ttm_bo_evict_mm(&rdev->mman.bdev, TTM_PL_VRAM); | 228 | return ttm_bo_evict_mm(&rdev->mman.bdev, TTM_PL_VRAM); |
228 | } | 229 | } |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/r420 b/drivers/gpu/drm/radeon/reg_srcs/r420 new file mode 100644 index 000000000000..989f7a020832 --- /dev/null +++ b/drivers/gpu/drm/radeon/reg_srcs/r420 | |||
@@ -0,0 +1,795 @@ | |||
1 | r420 0x4f60 | ||
2 | 0x1434 SRC_Y_X | ||
3 | 0x1438 DST_Y_X | ||
4 | 0x143C DST_HEIGHT_WIDTH | ||
5 | 0x146C DP_GUI_MASTER_CNTL | ||
6 | 0x1474 BRUSH_Y_X | ||
7 | 0x1478 DP_BRUSH_BKGD_CLR | ||
8 | 0x147C DP_BRUSH_FRGD_CLR | ||
9 | 0x1480 BRUSH_DATA0 | ||
10 | 0x1484 BRUSH_DATA1 | ||
11 | 0x1598 DST_WIDTH_HEIGHT | ||
12 | 0x15C0 CLR_CMP_CNTL | ||
13 | 0x15C4 CLR_CMP_CLR_SRC | ||
14 | 0x15C8 CLR_CMP_CLR_DST | ||
15 | 0x15CC CLR_CMP_MSK | ||
16 | 0x15D8 DP_SRC_FRGD_CLR | ||
17 | 0x15DC DP_SRC_BKGD_CLR | ||
18 | 0x1600 DST_LINE_START | ||
19 | 0x1604 DST_LINE_END | ||
20 | 0x1608 DST_LINE_PATCOUNT | ||
21 | 0x16C0 DP_CNTL | ||
22 | 0x16CC DP_WRITE_MSK | ||
23 | 0x16D0 DP_CNTL_XDIR_YDIR_YMAJOR | ||
24 | 0x16E8 DEFAULT_SC_BOTTOM_RIGHT | ||
25 | 0x16EC SC_TOP_LEFT | ||
26 | 0x16F0 SC_BOTTOM_RIGHT | ||
27 | 0x16F4 SRC_SC_BOTTOM_RIGHT | ||
28 | 0x1714 DSTCACHE_CTLSTAT | ||
29 | 0x1720 WAIT_UNTIL | ||
30 | 0x172C RBBM_GUICNTL | ||
31 | 0x1D98 VAP_VPORT_XSCALE | ||
32 | 0x1D9C VAP_VPORT_XOFFSET | ||
33 | 0x1DA0 VAP_VPORT_YSCALE | ||
34 | 0x1DA4 VAP_VPORT_YOFFSET | ||
35 | 0x1DA8 VAP_VPORT_ZSCALE | ||
36 | 0x1DAC VAP_VPORT_ZOFFSET | ||
37 | 0x2080 VAP_CNTL | ||
38 | 0x2090 VAP_OUT_VTX_FMT_0 | ||
39 | 0x2094 VAP_OUT_VTX_FMT_1 | ||
40 | 0x20B0 VAP_VTE_CNTL | ||
41 | 0x2138 VAP_VF_MIN_VTX_INDX | ||
42 | 0x2140 VAP_CNTL_STATUS | ||
43 | 0x2150 VAP_PROG_STREAM_CNTL_0 | ||
44 | 0x2154 VAP_PROG_STREAM_CNTL_1 | ||
45 | 0x2158 VAP_PROG_STREAM_CNTL_2 | ||
46 | 0x215C VAP_PROG_STREAM_CNTL_3 | ||
47 | 0x2160 VAP_PROG_STREAM_CNTL_4 | ||
48 | 0x2164 VAP_PROG_STREAM_CNTL_5 | ||
49 | 0x2168 VAP_PROG_STREAM_CNTL_6 | ||
50 | 0x216C VAP_PROG_STREAM_CNTL_7 | ||
51 | 0x2180 VAP_VTX_STATE_CNTL | ||
52 | 0x2184 VAP_VSM_VTX_ASSM | ||
53 | 0x2188 VAP_VTX_STATE_IND_REG_0 | ||
54 | 0x218C VAP_VTX_STATE_IND_REG_1 | ||
55 | 0x2190 VAP_VTX_STATE_IND_REG_2 | ||
56 | 0x2194 VAP_VTX_STATE_IND_REG_3 | ||
57 | 0x2198 VAP_VTX_STATE_IND_REG_4 | ||
58 | 0x219C VAP_VTX_STATE_IND_REG_5 | ||
59 | 0x21A0 VAP_VTX_STATE_IND_REG_6 | ||
60 | 0x21A4 VAP_VTX_STATE_IND_REG_7 | ||
61 | 0x21A8 VAP_VTX_STATE_IND_REG_8 | ||
62 | 0x21AC VAP_VTX_STATE_IND_REG_9 | ||
63 | 0x21B0 VAP_VTX_STATE_IND_REG_10 | ||
64 | 0x21B4 VAP_VTX_STATE_IND_REG_11 | ||
65 | 0x21B8 VAP_VTX_STATE_IND_REG_12 | ||
66 | 0x21BC VAP_VTX_STATE_IND_REG_13 | ||
67 | 0x21C0 VAP_VTX_STATE_IND_REG_14 | ||
68 | 0x21C4 VAP_VTX_STATE_IND_REG_15 | ||
69 | 0x21DC VAP_PSC_SGN_NORM_CNTL | ||
70 | 0x21E0 VAP_PROG_STREAM_CNTL_EXT_0 | ||
71 | 0x21E4 VAP_PROG_STREAM_CNTL_EXT_1 | ||
72 | 0x21E8 VAP_PROG_STREAM_CNTL_EXT_2 | ||
73 | 0x21EC VAP_PROG_STREAM_CNTL_EXT_3 | ||
74 | 0x21F0 VAP_PROG_STREAM_CNTL_EXT_4 | ||
75 | 0x21F4 VAP_PROG_STREAM_CNTL_EXT_5 | ||
76 | 0x21F8 VAP_PROG_STREAM_CNTL_EXT_6 | ||
77 | 0x21FC VAP_PROG_STREAM_CNTL_EXT_7 | ||
78 | 0x2200 VAP_PVS_VECTOR_INDX_REG | ||
79 | 0x2204 VAP_PVS_VECTOR_DATA_REG | ||
80 | 0x2208 VAP_PVS_VECTOR_DATA_REG_128 | ||
81 | 0x221C VAP_CLIP_CNTL | ||
82 | 0x2220 VAP_GB_VERT_CLIP_ADJ | ||
83 | 0x2224 VAP_GB_VERT_DISC_ADJ | ||
84 | 0x2228 VAP_GB_HORZ_CLIP_ADJ | ||
85 | 0x222C VAP_GB_HORZ_DISC_ADJ | ||
86 | 0x2230 VAP_PVS_FLOW_CNTL_ADDRS_0 | ||
87 | 0x2234 VAP_PVS_FLOW_CNTL_ADDRS_1 | ||
88 | 0x2238 VAP_PVS_FLOW_CNTL_ADDRS_2 | ||
89 | 0x223C VAP_PVS_FLOW_CNTL_ADDRS_3 | ||
90 | 0x2240 VAP_PVS_FLOW_CNTL_ADDRS_4 | ||
91 | 0x2244 VAP_PVS_FLOW_CNTL_ADDRS_5 | ||
92 | 0x2248 VAP_PVS_FLOW_CNTL_ADDRS_6 | ||
93 | 0x224C VAP_PVS_FLOW_CNTL_ADDRS_7 | ||
94 | 0x2250 VAP_PVS_FLOW_CNTL_ADDRS_8 | ||
95 | 0x2254 VAP_PVS_FLOW_CNTL_ADDRS_9 | ||
96 | 0x2258 VAP_PVS_FLOW_CNTL_ADDRS_10 | ||
97 | 0x225C VAP_PVS_FLOW_CNTL_ADDRS_11 | ||
98 | 0x2260 VAP_PVS_FLOW_CNTL_ADDRS_12 | ||
99 | 0x2264 VAP_PVS_FLOW_CNTL_ADDRS_13 | ||
100 | 0x2268 VAP_PVS_FLOW_CNTL_ADDRS_14 | ||
101 | 0x226C VAP_PVS_FLOW_CNTL_ADDRS_15 | ||
102 | 0x2284 VAP_PVS_STATE_FLUSH_REG | ||
103 | 0x2288 VAP_PVS_VTX_TIMEOUT_REG | ||
104 | 0x2290 VAP_PVS_FLOW_CNTL_LOOP_INDEX_0 | ||
105 | 0x2294 VAP_PVS_FLOW_CNTL_LOOP_INDEX_1 | ||
106 | 0x2298 VAP_PVS_FLOW_CNTL_LOOP_INDEX_2 | ||
107 | 0x229C VAP_PVS_FLOW_CNTL_LOOP_INDEX_3 | ||
108 | 0x22A0 VAP_PVS_FLOW_CNTL_LOOP_INDEX_4 | ||
109 | 0x22A4 VAP_PVS_FLOW_CNTL_LOOP_INDEX_5 | ||
110 | 0x22A8 VAP_PVS_FLOW_CNTL_LOOP_INDEX_6 | ||
111 | 0x22AC VAP_PVS_FLOW_CNTL_LOOP_INDEX_7 | ||
112 | 0x22B0 VAP_PVS_FLOW_CNTL_LOOP_INDEX_8 | ||
113 | 0x22B4 VAP_PVS_FLOW_CNTL_LOOP_INDEX_9 | ||
114 | 0x22B8 VAP_PVS_FLOW_CNTL_LOOP_INDEX_10 | ||
115 | 0x22BC VAP_PVS_FLOW_CNTL_LOOP_INDEX_11 | ||
116 | 0x22C0 VAP_PVS_FLOW_CNTL_LOOP_INDEX_12 | ||
117 | 0x22C4 VAP_PVS_FLOW_CNTL_LOOP_INDEX_13 | ||
118 | 0x22C8 VAP_PVS_FLOW_CNTL_LOOP_INDEX_14 | ||
119 | 0x22CC VAP_PVS_FLOW_CNTL_LOOP_INDEX_15 | ||
120 | 0x22D0 VAP_PVS_CODE_CNTL_0 | ||
121 | 0x22D4 VAP_PVS_CONST_CNTL | ||
122 | 0x22D8 VAP_PVS_CODE_CNTL_1 | ||
123 | 0x22DC VAP_PVS_FLOW_CNTL_OPC | ||
124 | 0x342C RB2D_DSTCACHE_CTLSTAT | ||
125 | 0x4000 GB_VAP_RASTER_VTX_FMT_0 | ||
126 | 0x4004 GB_VAP_RASTER_VTX_FMT_1 | ||
127 | 0x4008 GB_ENABLE | ||
128 | 0x401C GB_SELECT | ||
129 | 0x4020 GB_AA_CONFIG | ||
130 | 0x4024 GB_FIFO_SIZE | ||
131 | 0x4100 TX_INVALTAGS | ||
132 | 0x4200 GA_POINT_S0 | ||
133 | 0x4204 GA_POINT_T0 | ||
134 | 0x4208 GA_POINT_S1 | ||
135 | 0x420C GA_POINT_T1 | ||
136 | 0x4214 GA_TRIANGLE_STIPPLE | ||
137 | 0x421C GA_POINT_SIZE | ||
138 | 0x4230 GA_POINT_MINMAX | ||
139 | 0x4234 GA_LINE_CNTL | ||
140 | 0x4238 GA_LINE_STIPPLE_CONFIG | ||
141 | 0x4260 GA_LINE_STIPPLE_VALUE | ||
142 | 0x4264 GA_LINE_S0 | ||
143 | 0x4268 GA_LINE_S1 | ||
144 | 0x4278 GA_COLOR_CONTROL | ||
145 | 0x427C GA_SOLID_RG | ||
146 | 0x4280 GA_SOLID_BA | ||
147 | 0x4288 GA_POLY_MODE | ||
148 | 0x428C GA_ROUND_MODE | ||
149 | 0x4290 GA_OFFSET | ||
150 | 0x4294 GA_FOG_SCALE | ||
151 | 0x4298 GA_FOG_OFFSET | ||
152 | 0x42A0 SU_TEX_WRAP | ||
153 | 0x42A4 SU_POLY_OFFSET_FRONT_SCALE | ||
154 | 0x42A8 SU_POLY_OFFSET_FRONT_OFFSET | ||
155 | 0x42AC SU_POLY_OFFSET_BACK_SCALE | ||
156 | 0x42B0 SU_POLY_OFFSET_BACK_OFFSET | ||
157 | 0x42B4 SU_POLY_OFFSET_ENABLE | ||
158 | 0x42B8 SU_CULL_MODE | ||
159 | 0x42C0 SU_DEPTH_SCALE | ||
160 | 0x42C4 SU_DEPTH_OFFSET | ||
161 | 0x42C8 SU_REG_DEST | ||
162 | 0x4300 RS_COUNT | ||
163 | 0x4304 RS_INST_COUNT | ||
164 | 0x4310 RS_IP_0 | ||
165 | 0x4314 RS_IP_1 | ||
166 | 0x4318 RS_IP_2 | ||
167 | 0x431C RS_IP_3 | ||
168 | 0x4320 RS_IP_4 | ||
169 | 0x4324 RS_IP_5 | ||
170 | 0x4328 RS_IP_6 | ||
171 | 0x432C RS_IP_7 | ||
172 | 0x4330 RS_INST_0 | ||
173 | 0x4334 RS_INST_1 | ||
174 | 0x4338 RS_INST_2 | ||
175 | 0x433C RS_INST_3 | ||
176 | 0x4340 RS_INST_4 | ||
177 | 0x4344 RS_INST_5 | ||
178 | 0x4348 RS_INST_6 | ||
179 | 0x434C RS_INST_7 | ||
180 | 0x4350 RS_INST_8 | ||
181 | 0x4354 RS_INST_9 | ||
182 | 0x4358 RS_INST_10 | ||
183 | 0x435C RS_INST_11 | ||
184 | 0x4360 RS_INST_12 | ||
185 | 0x4364 RS_INST_13 | ||
186 | 0x4368 RS_INST_14 | ||
187 | 0x436C RS_INST_15 | ||
188 | 0x43A4 SC_HYPERZ_EN | ||
189 | 0x43A8 SC_EDGERULE | ||
190 | 0x43B0 SC_CLIP_0_A | ||
191 | 0x43B4 SC_CLIP_0_B | ||
192 | 0x43B8 SC_CLIP_1_A | ||
193 | 0x43BC SC_CLIP_1_B | ||
194 | 0x43C0 SC_CLIP_2_A | ||
195 | 0x43C4 SC_CLIP_2_B | ||
196 | 0x43C8 SC_CLIP_3_A | ||
197 | 0x43CC SC_CLIP_3_B | ||
198 | 0x43D0 SC_CLIP_RULE | ||
199 | 0x43E0 SC_SCISSOR0 | ||
200 | 0x43E8 SC_SCREENDOOR | ||
201 | 0x4440 TX_FILTER1_0 | ||
202 | 0x4444 TX_FILTER1_1 | ||
203 | 0x4448 TX_FILTER1_2 | ||
204 | 0x444C TX_FILTER1_3 | ||
205 | 0x4450 TX_FILTER1_4 | ||
206 | 0x4454 TX_FILTER1_5 | ||
207 | 0x4458 TX_FILTER1_6 | ||
208 | 0x445C TX_FILTER1_7 | ||
209 | 0x4460 TX_FILTER1_8 | ||
210 | 0x4464 TX_FILTER1_9 | ||
211 | 0x4468 TX_FILTER1_10 | ||
212 | 0x446C TX_FILTER1_11 | ||
213 | 0x4470 TX_FILTER1_12 | ||
214 | 0x4474 TX_FILTER1_13 | ||
215 | 0x4478 TX_FILTER1_14 | ||
216 | 0x447C TX_FILTER1_15 | ||
217 | 0x4580 TX_CHROMA_KEY_0 | ||
218 | 0x4584 TX_CHROMA_KEY_1 | ||
219 | 0x4588 TX_CHROMA_KEY_2 | ||
220 | 0x458C TX_CHROMA_KEY_3 | ||
221 | 0x4590 TX_CHROMA_KEY_4 | ||
222 | 0x4594 TX_CHROMA_KEY_5 | ||
223 | 0x4598 TX_CHROMA_KEY_6 | ||
224 | 0x459C TX_CHROMA_KEY_7 | ||
225 | 0x45A0 TX_CHROMA_KEY_8 | ||
226 | 0x45A4 TX_CHROMA_KEY_9 | ||
227 | 0x45A8 TX_CHROMA_KEY_10 | ||
228 | 0x45AC TX_CHROMA_KEY_11 | ||
229 | 0x45B0 TX_CHROMA_KEY_12 | ||
230 | 0x45B4 TX_CHROMA_KEY_13 | ||
231 | 0x45B8 TX_CHROMA_KEY_14 | ||
232 | 0x45BC TX_CHROMA_KEY_15 | ||
233 | 0x45C0 TX_BORDER_COLOR_0 | ||
234 | 0x45C4 TX_BORDER_COLOR_1 | ||
235 | 0x45C8 TX_BORDER_COLOR_2 | ||
236 | 0x45CC TX_BORDER_COLOR_3 | ||
237 | 0x45D0 TX_BORDER_COLOR_4 | ||
238 | 0x45D4 TX_BORDER_COLOR_5 | ||
239 | 0x45D8 TX_BORDER_COLOR_6 | ||
240 | 0x45DC TX_BORDER_COLOR_7 | ||
241 | 0x45E0 TX_BORDER_COLOR_8 | ||
242 | 0x45E4 TX_BORDER_COLOR_9 | ||
243 | 0x45E8 TX_BORDER_COLOR_10 | ||
244 | 0x45EC TX_BORDER_COLOR_11 | ||
245 | 0x45F0 TX_BORDER_COLOR_12 | ||
246 | 0x45F4 TX_BORDER_COLOR_13 | ||
247 | 0x45F8 TX_BORDER_COLOR_14 | ||
248 | 0x45FC TX_BORDER_COLOR_15 | ||
249 | 0x4600 US_CONFIG | ||
250 | 0x4604 US_PIXSIZE | ||
251 | 0x4608 US_CODE_OFFSET | ||
252 | 0x460C US_RESET | ||
253 | 0x4610 US_CODE_ADDR_0 | ||
254 | 0x4614 US_CODE_ADDR_1 | ||
255 | 0x4618 US_CODE_ADDR_2 | ||
256 | 0x461C US_CODE_ADDR_3 | ||
257 | 0x4620 US_TEX_INST_0 | ||
258 | 0x4624 US_TEX_INST_1 | ||
259 | 0x4628 US_TEX_INST_2 | ||
260 | 0x462C US_TEX_INST_3 | ||
261 | 0x4630 US_TEX_INST_4 | ||
262 | 0x4634 US_TEX_INST_5 | ||
263 | 0x4638 US_TEX_INST_6 | ||
264 | 0x463C US_TEX_INST_7 | ||
265 | 0x4640 US_TEX_INST_8 | ||
266 | 0x4644 US_TEX_INST_9 | ||
267 | 0x4648 US_TEX_INST_10 | ||
268 | 0x464C US_TEX_INST_11 | ||
269 | 0x4650 US_TEX_INST_12 | ||
270 | 0x4654 US_TEX_INST_13 | ||
271 | 0x4658 US_TEX_INST_14 | ||
272 | 0x465C US_TEX_INST_15 | ||
273 | 0x4660 US_TEX_INST_16 | ||
274 | 0x4664 US_TEX_INST_17 | ||
275 | 0x4668 US_TEX_INST_18 | ||
276 | 0x466C US_TEX_INST_19 | ||
277 | 0x4670 US_TEX_INST_20 | ||
278 | 0x4674 US_TEX_INST_21 | ||
279 | 0x4678 US_TEX_INST_22 | ||
280 | 0x467C US_TEX_INST_23 | ||
281 | 0x4680 US_TEX_INST_24 | ||
282 | 0x4684 US_TEX_INST_25 | ||
283 | 0x4688 US_TEX_INST_26 | ||
284 | 0x468C US_TEX_INST_27 | ||
285 | 0x4690 US_TEX_INST_28 | ||
286 | 0x4694 US_TEX_INST_29 | ||
287 | 0x4698 US_TEX_INST_30 | ||
288 | 0x469C US_TEX_INST_31 | ||
289 | 0x46A4 US_OUT_FMT_0 | ||
290 | 0x46A8 US_OUT_FMT_1 | ||
291 | 0x46AC US_OUT_FMT_2 | ||
292 | 0x46B0 US_OUT_FMT_3 | ||
293 | 0x46B4 US_W_FMT | ||
294 | 0x46B8 US_CODE_BANK | ||
295 | 0x46BC US_CODE_EXT | ||
296 | 0x46C0 US_ALU_RGB_ADDR_0 | ||
297 | 0x46C4 US_ALU_RGB_ADDR_1 | ||
298 | 0x46C8 US_ALU_RGB_ADDR_2 | ||
299 | 0x46CC US_ALU_RGB_ADDR_3 | ||
300 | 0x46D0 US_ALU_RGB_ADDR_4 | ||
301 | 0x46D4 US_ALU_RGB_ADDR_5 | ||
302 | 0x46D8 US_ALU_RGB_ADDR_6 | ||
303 | 0x46DC US_ALU_RGB_ADDR_7 | ||
304 | 0x46E0 US_ALU_RGB_ADDR_8 | ||
305 | 0x46E4 US_ALU_RGB_ADDR_9 | ||
306 | 0x46E8 US_ALU_RGB_ADDR_10 | ||
307 | 0x46EC US_ALU_RGB_ADDR_11 | ||
308 | 0x46F0 US_ALU_RGB_ADDR_12 | ||
309 | 0x46F4 US_ALU_RGB_ADDR_13 | ||
310 | 0x46F8 US_ALU_RGB_ADDR_14 | ||
311 | 0x46FC US_ALU_RGB_ADDR_15 | ||
312 | 0x4700 US_ALU_RGB_ADDR_16 | ||
313 | 0x4704 US_ALU_RGB_ADDR_17 | ||
314 | 0x4708 US_ALU_RGB_ADDR_18 | ||
315 | 0x470C US_ALU_RGB_ADDR_19 | ||
316 | 0x4710 US_ALU_RGB_ADDR_20 | ||
317 | 0x4714 US_ALU_RGB_ADDR_21 | ||
318 | 0x4718 US_ALU_RGB_ADDR_22 | ||
319 | 0x471C US_ALU_RGB_ADDR_23 | ||
320 | 0x4720 US_ALU_RGB_ADDR_24 | ||
321 | 0x4724 US_ALU_RGB_ADDR_25 | ||
322 | 0x4728 US_ALU_RGB_ADDR_26 | ||
323 | 0x472C US_ALU_RGB_ADDR_27 | ||
324 | 0x4730 US_ALU_RGB_ADDR_28 | ||
325 | 0x4734 US_ALU_RGB_ADDR_29 | ||
326 | 0x4738 US_ALU_RGB_ADDR_30 | ||
327 | 0x473C US_ALU_RGB_ADDR_31 | ||
328 | 0x4740 US_ALU_RGB_ADDR_32 | ||
329 | 0x4744 US_ALU_RGB_ADDR_33 | ||
330 | 0x4748 US_ALU_RGB_ADDR_34 | ||
331 | 0x474C US_ALU_RGB_ADDR_35 | ||
332 | 0x4750 US_ALU_RGB_ADDR_36 | ||
333 | 0x4754 US_ALU_RGB_ADDR_37 | ||
334 | 0x4758 US_ALU_RGB_ADDR_38 | ||
335 | 0x475C US_ALU_RGB_ADDR_39 | ||
336 | 0x4760 US_ALU_RGB_ADDR_40 | ||
337 | 0x4764 US_ALU_RGB_ADDR_41 | ||
338 | 0x4768 US_ALU_RGB_ADDR_42 | ||
339 | 0x476C US_ALU_RGB_ADDR_43 | ||
340 | 0x4770 US_ALU_RGB_ADDR_44 | ||
341 | 0x4774 US_ALU_RGB_ADDR_45 | ||
342 | 0x4778 US_ALU_RGB_ADDR_46 | ||
343 | 0x477C US_ALU_RGB_ADDR_47 | ||
344 | 0x4780 US_ALU_RGB_ADDR_48 | ||
345 | 0x4784 US_ALU_RGB_ADDR_49 | ||
346 | 0x4788 US_ALU_RGB_ADDR_50 | ||
347 | 0x478C US_ALU_RGB_ADDR_51 | ||
348 | 0x4790 US_ALU_RGB_ADDR_52 | ||
349 | 0x4794 US_ALU_RGB_ADDR_53 | ||
350 | 0x4798 US_ALU_RGB_ADDR_54 | ||
351 | 0x479C US_ALU_RGB_ADDR_55 | ||
352 | 0x47A0 US_ALU_RGB_ADDR_56 | ||
353 | 0x47A4 US_ALU_RGB_ADDR_57 | ||
354 | 0x47A8 US_ALU_RGB_ADDR_58 | ||
355 | 0x47AC US_ALU_RGB_ADDR_59 | ||
356 | 0x47B0 US_ALU_RGB_ADDR_60 | ||
357 | 0x47B4 US_ALU_RGB_ADDR_61 | ||
358 | 0x47B8 US_ALU_RGB_ADDR_62 | ||
359 | 0x47BC US_ALU_RGB_ADDR_63 | ||
360 | 0x47C0 US_ALU_ALPHA_ADDR_0 | ||
361 | 0x47C4 US_ALU_ALPHA_ADDR_1 | ||
362 | 0x47C8 US_ALU_ALPHA_ADDR_2 | ||
363 | 0x47CC US_ALU_ALPHA_ADDR_3 | ||
364 | 0x47D0 US_ALU_ALPHA_ADDR_4 | ||
365 | 0x47D4 US_ALU_ALPHA_ADDR_5 | ||
366 | 0x47D8 US_ALU_ALPHA_ADDR_6 | ||
367 | 0x47DC US_ALU_ALPHA_ADDR_7 | ||
368 | 0x47E0 US_ALU_ALPHA_ADDR_8 | ||
369 | 0x47E4 US_ALU_ALPHA_ADDR_9 | ||
370 | 0x47E8 US_ALU_ALPHA_ADDR_10 | ||
371 | 0x47EC US_ALU_ALPHA_ADDR_11 | ||
372 | 0x47F0 US_ALU_ALPHA_ADDR_12 | ||
373 | 0x47F4 US_ALU_ALPHA_ADDR_13 | ||
374 | 0x47F8 US_ALU_ALPHA_ADDR_14 | ||
375 | 0x47FC US_ALU_ALPHA_ADDR_15 | ||
376 | 0x4800 US_ALU_ALPHA_ADDR_16 | ||
377 | 0x4804 US_ALU_ALPHA_ADDR_17 | ||
378 | 0x4808 US_ALU_ALPHA_ADDR_18 | ||
379 | 0x480C US_ALU_ALPHA_ADDR_19 | ||
380 | 0x4810 US_ALU_ALPHA_ADDR_20 | ||
381 | 0x4814 US_ALU_ALPHA_ADDR_21 | ||
382 | 0x4818 US_ALU_ALPHA_ADDR_22 | ||
383 | 0x481C US_ALU_ALPHA_ADDR_23 | ||
384 | 0x4820 US_ALU_ALPHA_ADDR_24 | ||
385 | 0x4824 US_ALU_ALPHA_ADDR_25 | ||
386 | 0x4828 US_ALU_ALPHA_ADDR_26 | ||
387 | 0x482C US_ALU_ALPHA_ADDR_27 | ||
388 | 0x4830 US_ALU_ALPHA_ADDR_28 | ||
389 | 0x4834 US_ALU_ALPHA_ADDR_29 | ||
390 | 0x4838 US_ALU_ALPHA_ADDR_30 | ||
391 | 0x483C US_ALU_ALPHA_ADDR_31 | ||
392 | 0x4840 US_ALU_ALPHA_ADDR_32 | ||
393 | 0x4844 US_ALU_ALPHA_ADDR_33 | ||
394 | 0x4848 US_ALU_ALPHA_ADDR_34 | ||
395 | 0x484C US_ALU_ALPHA_ADDR_35 | ||
396 | 0x4850 US_ALU_ALPHA_ADDR_36 | ||
397 | 0x4854 US_ALU_ALPHA_ADDR_37 | ||
398 | 0x4858 US_ALU_ALPHA_ADDR_38 | ||
399 | 0x485C US_ALU_ALPHA_ADDR_39 | ||
400 | 0x4860 US_ALU_ALPHA_ADDR_40 | ||
401 | 0x4864 US_ALU_ALPHA_ADDR_41 | ||
402 | 0x4868 US_ALU_ALPHA_ADDR_42 | ||
403 | 0x486C US_ALU_ALPHA_ADDR_43 | ||
404 | 0x4870 US_ALU_ALPHA_ADDR_44 | ||
405 | 0x4874 US_ALU_ALPHA_ADDR_45 | ||
406 | 0x4878 US_ALU_ALPHA_ADDR_46 | ||
407 | 0x487C US_ALU_ALPHA_ADDR_47 | ||
408 | 0x4880 US_ALU_ALPHA_ADDR_48 | ||
409 | 0x4884 US_ALU_ALPHA_ADDR_49 | ||
410 | 0x4888 US_ALU_ALPHA_ADDR_50 | ||
411 | 0x488C US_ALU_ALPHA_ADDR_51 | ||
412 | 0x4890 US_ALU_ALPHA_ADDR_52 | ||
413 | 0x4894 US_ALU_ALPHA_ADDR_53 | ||
414 | 0x4898 US_ALU_ALPHA_ADDR_54 | ||
415 | 0x489C US_ALU_ALPHA_ADDR_55 | ||
416 | 0x48A0 US_ALU_ALPHA_ADDR_56 | ||
417 | 0x48A4 US_ALU_ALPHA_ADDR_57 | ||
418 | 0x48A8 US_ALU_ALPHA_ADDR_58 | ||
419 | 0x48AC US_ALU_ALPHA_ADDR_59 | ||
420 | 0x48B0 US_ALU_ALPHA_ADDR_60 | ||
421 | 0x48B4 US_ALU_ALPHA_ADDR_61 | ||
422 | 0x48B8 US_ALU_ALPHA_ADDR_62 | ||
423 | 0x48BC US_ALU_ALPHA_ADDR_63 | ||
424 | 0x48C0 US_ALU_RGB_INST_0 | ||
425 | 0x48C4 US_ALU_RGB_INST_1 | ||
426 | 0x48C8 US_ALU_RGB_INST_2 | ||
427 | 0x48CC US_ALU_RGB_INST_3 | ||
428 | 0x48D0 US_ALU_RGB_INST_4 | ||
429 | 0x48D4 US_ALU_RGB_INST_5 | ||
430 | 0x48D8 US_ALU_RGB_INST_6 | ||
431 | 0x48DC US_ALU_RGB_INST_7 | ||
432 | 0x48E0 US_ALU_RGB_INST_8 | ||
433 | 0x48E4 US_ALU_RGB_INST_9 | ||
434 | 0x48E8 US_ALU_RGB_INST_10 | ||
435 | 0x48EC US_ALU_RGB_INST_11 | ||
436 | 0x48F0 US_ALU_RGB_INST_12 | ||
437 | 0x48F4 US_ALU_RGB_INST_13 | ||
438 | 0x48F8 US_ALU_RGB_INST_14 | ||
439 | 0x48FC US_ALU_RGB_INST_15 | ||
440 | 0x4900 US_ALU_RGB_INST_16 | ||
441 | 0x4904 US_ALU_RGB_INST_17 | ||
442 | 0x4908 US_ALU_RGB_INST_18 | ||
443 | 0x490C US_ALU_RGB_INST_19 | ||
444 | 0x4910 US_ALU_RGB_INST_20 | ||
445 | 0x4914 US_ALU_RGB_INST_21 | ||
446 | 0x4918 US_ALU_RGB_INST_22 | ||
447 | 0x491C US_ALU_RGB_INST_23 | ||
448 | 0x4920 US_ALU_RGB_INST_24 | ||
449 | 0x4924 US_ALU_RGB_INST_25 | ||
450 | 0x4928 US_ALU_RGB_INST_26 | ||
451 | 0x492C US_ALU_RGB_INST_27 | ||
452 | 0x4930 US_ALU_RGB_INST_28 | ||
453 | 0x4934 US_ALU_RGB_INST_29 | ||
454 | 0x4938 US_ALU_RGB_INST_30 | ||
455 | 0x493C US_ALU_RGB_INST_31 | ||
456 | 0x4940 US_ALU_RGB_INST_32 | ||
457 | 0x4944 US_ALU_RGB_INST_33 | ||
458 | 0x4948 US_ALU_RGB_INST_34 | ||
459 | 0x494C US_ALU_RGB_INST_35 | ||
460 | 0x4950 US_ALU_RGB_INST_36 | ||
461 | 0x4954 US_ALU_RGB_INST_37 | ||
462 | 0x4958 US_ALU_RGB_INST_38 | ||
463 | 0x495C US_ALU_RGB_INST_39 | ||
464 | 0x4960 US_ALU_RGB_INST_40 | ||
465 | 0x4964 US_ALU_RGB_INST_41 | ||
466 | 0x4968 US_ALU_RGB_INST_42 | ||
467 | 0x496C US_ALU_RGB_INST_43 | ||
468 | 0x4970 US_ALU_RGB_INST_44 | ||
469 | 0x4974 US_ALU_RGB_INST_45 | ||
470 | 0x4978 US_ALU_RGB_INST_46 | ||
471 | 0x497C US_ALU_RGB_INST_47 | ||
472 | 0x4980 US_ALU_RGB_INST_48 | ||
473 | 0x4984 US_ALU_RGB_INST_49 | ||
474 | 0x4988 US_ALU_RGB_INST_50 | ||
475 | 0x498C US_ALU_RGB_INST_51 | ||
476 | 0x4990 US_ALU_RGB_INST_52 | ||
477 | 0x4994 US_ALU_RGB_INST_53 | ||
478 | 0x4998 US_ALU_RGB_INST_54 | ||
479 | 0x499C US_ALU_RGB_INST_55 | ||
480 | 0x49A0 US_ALU_RGB_INST_56 | ||
481 | 0x49A4 US_ALU_RGB_INST_57 | ||
482 | 0x49A8 US_ALU_RGB_INST_58 | ||
483 | 0x49AC US_ALU_RGB_INST_59 | ||
484 | 0x49B0 US_ALU_RGB_INST_60 | ||
485 | 0x49B4 US_ALU_RGB_INST_61 | ||
486 | 0x49B8 US_ALU_RGB_INST_62 | ||
487 | 0x49BC US_ALU_RGB_INST_63 | ||
488 | 0x49C0 US_ALU_ALPHA_INST_0 | ||
489 | 0x49C4 US_ALU_ALPHA_INST_1 | ||
490 | 0x49C8 US_ALU_ALPHA_INST_2 | ||
491 | 0x49CC US_ALU_ALPHA_INST_3 | ||
492 | 0x49D0 US_ALU_ALPHA_INST_4 | ||
493 | 0x49D4 US_ALU_ALPHA_INST_5 | ||
494 | 0x49D8 US_ALU_ALPHA_INST_6 | ||
495 | 0x49DC US_ALU_ALPHA_INST_7 | ||
496 | 0x49E0 US_ALU_ALPHA_INST_8 | ||
497 | 0x49E4 US_ALU_ALPHA_INST_9 | ||
498 | 0x49E8 US_ALU_ALPHA_INST_10 | ||
499 | 0x49EC US_ALU_ALPHA_INST_11 | ||
500 | 0x49F0 US_ALU_ALPHA_INST_12 | ||
501 | 0x49F4 US_ALU_ALPHA_INST_13 | ||
502 | 0x49F8 US_ALU_ALPHA_INST_14 | ||
503 | 0x49FC US_ALU_ALPHA_INST_15 | ||
504 | 0x4A00 US_ALU_ALPHA_INST_16 | ||
505 | 0x4A04 US_ALU_ALPHA_INST_17 | ||
506 | 0x4A08 US_ALU_ALPHA_INST_18 | ||
507 | 0x4A0C US_ALU_ALPHA_INST_19 | ||
508 | 0x4A10 US_ALU_ALPHA_INST_20 | ||
509 | 0x4A14 US_ALU_ALPHA_INST_21 | ||
510 | 0x4A18 US_ALU_ALPHA_INST_22 | ||
511 | 0x4A1C US_ALU_ALPHA_INST_23 | ||
512 | 0x4A20 US_ALU_ALPHA_INST_24 | ||
513 | 0x4A24 US_ALU_ALPHA_INST_25 | ||
514 | 0x4A28 US_ALU_ALPHA_INST_26 | ||
515 | 0x4A2C US_ALU_ALPHA_INST_27 | ||
516 | 0x4A30 US_ALU_ALPHA_INST_28 | ||
517 | 0x4A34 US_ALU_ALPHA_INST_29 | ||
518 | 0x4A38 US_ALU_ALPHA_INST_30 | ||
519 | 0x4A3C US_ALU_ALPHA_INST_31 | ||
520 | 0x4A40 US_ALU_ALPHA_INST_32 | ||
521 | 0x4A44 US_ALU_ALPHA_INST_33 | ||
522 | 0x4A48 US_ALU_ALPHA_INST_34 | ||
523 | 0x4A4C US_ALU_ALPHA_INST_35 | ||
524 | 0x4A50 US_ALU_ALPHA_INST_36 | ||
525 | 0x4A54 US_ALU_ALPHA_INST_37 | ||
526 | 0x4A58 US_ALU_ALPHA_INST_38 | ||
527 | 0x4A5C US_ALU_ALPHA_INST_39 | ||
528 | 0x4A60 US_ALU_ALPHA_INST_40 | ||
529 | 0x4A64 US_ALU_ALPHA_INST_41 | ||
530 | 0x4A68 US_ALU_ALPHA_INST_42 | ||
531 | 0x4A6C US_ALU_ALPHA_INST_43 | ||
532 | 0x4A70 US_ALU_ALPHA_INST_44 | ||
533 | 0x4A74 US_ALU_ALPHA_INST_45 | ||
534 | 0x4A78 US_ALU_ALPHA_INST_46 | ||
535 | 0x4A7C US_ALU_ALPHA_INST_47 | ||
536 | 0x4A80 US_ALU_ALPHA_INST_48 | ||
537 | 0x4A84 US_ALU_ALPHA_INST_49 | ||
538 | 0x4A88 US_ALU_ALPHA_INST_50 | ||
539 | 0x4A8C US_ALU_ALPHA_INST_51 | ||
540 | 0x4A90 US_ALU_ALPHA_INST_52 | ||
541 | 0x4A94 US_ALU_ALPHA_INST_53 | ||
542 | 0x4A98 US_ALU_ALPHA_INST_54 | ||
543 | 0x4A9C US_ALU_ALPHA_INST_55 | ||
544 | 0x4AA0 US_ALU_ALPHA_INST_56 | ||
545 | 0x4AA4 US_ALU_ALPHA_INST_57 | ||
546 | 0x4AA8 US_ALU_ALPHA_INST_58 | ||
547 | 0x4AAC US_ALU_ALPHA_INST_59 | ||
548 | 0x4AB0 US_ALU_ALPHA_INST_60 | ||
549 | 0x4AB4 US_ALU_ALPHA_INST_61 | ||
550 | 0x4AB8 US_ALU_ALPHA_INST_62 | ||
551 | 0x4ABC US_ALU_ALPHA_INST_63 | ||
552 | 0x4AC0 US_ALU_EXT_ADDR_0 | ||
553 | 0x4AC4 US_ALU_EXT_ADDR_1 | ||
554 | 0x4AC8 US_ALU_EXT_ADDR_2 | ||
555 | 0x4ACC US_ALU_EXT_ADDR_3 | ||
556 | 0x4AD0 US_ALU_EXT_ADDR_4 | ||
557 | 0x4AD4 US_ALU_EXT_ADDR_5 | ||
558 | 0x4AD8 US_ALU_EXT_ADDR_6 | ||
559 | 0x4ADC US_ALU_EXT_ADDR_7 | ||
560 | 0x4AE0 US_ALU_EXT_ADDR_8 | ||
561 | 0x4AE4 US_ALU_EXT_ADDR_9 | ||
562 | 0x4AE8 US_ALU_EXT_ADDR_10 | ||
563 | 0x4AEC US_ALU_EXT_ADDR_11 | ||
564 | 0x4AF0 US_ALU_EXT_ADDR_12 | ||
565 | 0x4AF4 US_ALU_EXT_ADDR_13 | ||
566 | 0x4AF8 US_ALU_EXT_ADDR_14 | ||
567 | 0x4AFC US_ALU_EXT_ADDR_15 | ||
568 | 0x4B00 US_ALU_EXT_ADDR_16 | ||
569 | 0x4B04 US_ALU_EXT_ADDR_17 | ||
570 | 0x4B08 US_ALU_EXT_ADDR_18 | ||
571 | 0x4B0C US_ALU_EXT_ADDR_19 | ||
572 | 0x4B10 US_ALU_EXT_ADDR_20 | ||
573 | 0x4B14 US_ALU_EXT_ADDR_21 | ||
574 | 0x4B18 US_ALU_EXT_ADDR_22 | ||
575 | 0x4B1C US_ALU_EXT_ADDR_23 | ||
576 | 0x4B20 US_ALU_EXT_ADDR_24 | ||
577 | 0x4B24 US_ALU_EXT_ADDR_25 | ||
578 | 0x4B28 US_ALU_EXT_ADDR_26 | ||
579 | 0x4B2C US_ALU_EXT_ADDR_27 | ||
580 | 0x4B30 US_ALU_EXT_ADDR_28 | ||
581 | 0x4B34 US_ALU_EXT_ADDR_29 | ||
582 | 0x4B38 US_ALU_EXT_ADDR_30 | ||
583 | 0x4B3C US_ALU_EXT_ADDR_31 | ||
584 | 0x4B40 US_ALU_EXT_ADDR_32 | ||
585 | 0x4B44 US_ALU_EXT_ADDR_33 | ||
586 | 0x4B48 US_ALU_EXT_ADDR_34 | ||
587 | 0x4B4C US_ALU_EXT_ADDR_35 | ||
588 | 0x4B50 US_ALU_EXT_ADDR_36 | ||
589 | 0x4B54 US_ALU_EXT_ADDR_37 | ||
590 | 0x4B58 US_ALU_EXT_ADDR_38 | ||
591 | 0x4B5C US_ALU_EXT_ADDR_39 | ||
592 | 0x4B60 US_ALU_EXT_ADDR_40 | ||
593 | 0x4B64 US_ALU_EXT_ADDR_41 | ||
594 | 0x4B68 US_ALU_EXT_ADDR_42 | ||
595 | 0x4B6C US_ALU_EXT_ADDR_43 | ||
596 | 0x4B70 US_ALU_EXT_ADDR_44 | ||
597 | 0x4B74 US_ALU_EXT_ADDR_45 | ||
598 | 0x4B78 US_ALU_EXT_ADDR_46 | ||
599 | 0x4B7C US_ALU_EXT_ADDR_47 | ||
600 | 0x4B80 US_ALU_EXT_ADDR_48 | ||
601 | 0x4B84 US_ALU_EXT_ADDR_49 | ||
602 | 0x4B88 US_ALU_EXT_ADDR_50 | ||
603 | 0x4B8C US_ALU_EXT_ADDR_51 | ||
604 | 0x4B90 US_ALU_EXT_ADDR_52 | ||
605 | 0x4B94 US_ALU_EXT_ADDR_53 | ||
606 | 0x4B98 US_ALU_EXT_ADDR_54 | ||
607 | 0x4B9C US_ALU_EXT_ADDR_55 | ||
608 | 0x4BA0 US_ALU_EXT_ADDR_56 | ||
609 | 0x4BA4 US_ALU_EXT_ADDR_57 | ||
610 | 0x4BA8 US_ALU_EXT_ADDR_58 | ||
611 | 0x4BAC US_ALU_EXT_ADDR_59 | ||
612 | 0x4BB0 US_ALU_EXT_ADDR_60 | ||
613 | 0x4BB4 US_ALU_EXT_ADDR_61 | ||
614 | 0x4BB8 US_ALU_EXT_ADDR_62 | ||
615 | 0x4BBC US_ALU_EXT_ADDR_63 | ||
616 | 0x4BC0 FG_FOG_BLEND | ||
617 | 0x4BC4 FG_FOG_FACTOR | ||
618 | 0x4BC8 FG_FOG_COLOR_R | ||
619 | 0x4BCC FG_FOG_COLOR_G | ||
620 | 0x4BD0 FG_FOG_COLOR_B | ||
621 | 0x4BD4 FG_ALPHA_FUNC | ||
622 | 0x4BD8 FG_DEPTH_SRC | ||
623 | 0x4C00 US_ALU_CONST_R_0 | ||
624 | 0x4C04 US_ALU_CONST_G_0 | ||
625 | 0x4C08 US_ALU_CONST_B_0 | ||
626 | 0x4C0C US_ALU_CONST_A_0 | ||
627 | 0x4C10 US_ALU_CONST_R_1 | ||
628 | 0x4C14 US_ALU_CONST_G_1 | ||
629 | 0x4C18 US_ALU_CONST_B_1 | ||
630 | 0x4C1C US_ALU_CONST_A_1 | ||
631 | 0x4C20 US_ALU_CONST_R_2 | ||
632 | 0x4C24 US_ALU_CONST_G_2 | ||
633 | 0x4C28 US_ALU_CONST_B_2 | ||
634 | 0x4C2C US_ALU_CONST_A_2 | ||
635 | 0x4C30 US_ALU_CONST_R_3 | ||
636 | 0x4C34 US_ALU_CONST_G_3 | ||
637 | 0x4C38 US_ALU_CONST_B_3 | ||
638 | 0x4C3C US_ALU_CONST_A_3 | ||
639 | 0x4C40 US_ALU_CONST_R_4 | ||
640 | 0x4C44 US_ALU_CONST_G_4 | ||
641 | 0x4C48 US_ALU_CONST_B_4 | ||
642 | 0x4C4C US_ALU_CONST_A_4 | ||
643 | 0x4C50 US_ALU_CONST_R_5 | ||
644 | 0x4C54 US_ALU_CONST_G_5 | ||
645 | 0x4C58 US_ALU_CONST_B_5 | ||
646 | 0x4C5C US_ALU_CONST_A_5 | ||
647 | 0x4C60 US_ALU_CONST_R_6 | ||
648 | 0x4C64 US_ALU_CONST_G_6 | ||
649 | 0x4C68 US_ALU_CONST_B_6 | ||
650 | 0x4C6C US_ALU_CONST_A_6 | ||
651 | 0x4C70 US_ALU_CONST_R_7 | ||
652 | 0x4C74 US_ALU_CONST_G_7 | ||
653 | 0x4C78 US_ALU_CONST_B_7 | ||
654 | 0x4C7C US_ALU_CONST_A_7 | ||
655 | 0x4C80 US_ALU_CONST_R_8 | ||
656 | 0x4C84 US_ALU_CONST_G_8 | ||
657 | 0x4C88 US_ALU_CONST_B_8 | ||
658 | 0x4C8C US_ALU_CONST_A_8 | ||
659 | 0x4C90 US_ALU_CONST_R_9 | ||
660 | 0x4C94 US_ALU_CONST_G_9 | ||
661 | 0x4C98 US_ALU_CONST_B_9 | ||
662 | 0x4C9C US_ALU_CONST_A_9 | ||
663 | 0x4CA0 US_ALU_CONST_R_10 | ||
664 | 0x4CA4 US_ALU_CONST_G_10 | ||
665 | 0x4CA8 US_ALU_CONST_B_10 | ||
666 | 0x4CAC US_ALU_CONST_A_10 | ||
667 | 0x4CB0 US_ALU_CONST_R_11 | ||
668 | 0x4CB4 US_ALU_CONST_G_11 | ||
669 | 0x4CB8 US_ALU_CONST_B_11 | ||
670 | 0x4CBC US_ALU_CONST_A_11 | ||
671 | 0x4CC0 US_ALU_CONST_R_12 | ||
672 | 0x4CC4 US_ALU_CONST_G_12 | ||
673 | 0x4CC8 US_ALU_CONST_B_12 | ||
674 | 0x4CCC US_ALU_CONST_A_12 | ||
675 | 0x4CD0 US_ALU_CONST_R_13 | ||
676 | 0x4CD4 US_ALU_CONST_G_13 | ||
677 | 0x4CD8 US_ALU_CONST_B_13 | ||
678 | 0x4CDC US_ALU_CONST_A_13 | ||
679 | 0x4CE0 US_ALU_CONST_R_14 | ||
680 | 0x4CE4 US_ALU_CONST_G_14 | ||
681 | 0x4CE8 US_ALU_CONST_B_14 | ||
682 | 0x4CEC US_ALU_CONST_A_14 | ||
683 | 0x4CF0 US_ALU_CONST_R_15 | ||
684 | 0x4CF4 US_ALU_CONST_G_15 | ||
685 | 0x4CF8 US_ALU_CONST_B_15 | ||
686 | 0x4CFC US_ALU_CONST_A_15 | ||
687 | 0x4D00 US_ALU_CONST_R_16 | ||
688 | 0x4D04 US_ALU_CONST_G_16 | ||
689 | 0x4D08 US_ALU_CONST_B_16 | ||
690 | 0x4D0C US_ALU_CONST_A_16 | ||
691 | 0x4D10 US_ALU_CONST_R_17 | ||
692 | 0x4D14 US_ALU_CONST_G_17 | ||
693 | 0x4D18 US_ALU_CONST_B_17 | ||
694 | 0x4D1C US_ALU_CONST_A_17 | ||
695 | 0x4D20 US_ALU_CONST_R_18 | ||
696 | 0x4D24 US_ALU_CONST_G_18 | ||
697 | 0x4D28 US_ALU_CONST_B_18 | ||
698 | 0x4D2C US_ALU_CONST_A_18 | ||
699 | 0x4D30 US_ALU_CONST_R_19 | ||
700 | 0x4D34 US_ALU_CONST_G_19 | ||
701 | 0x4D38 US_ALU_CONST_B_19 | ||
702 | 0x4D3C US_ALU_CONST_A_19 | ||
703 | 0x4D40 US_ALU_CONST_R_20 | ||
704 | 0x4D44 US_ALU_CONST_G_20 | ||
705 | 0x4D48 US_ALU_CONST_B_20 | ||
706 | 0x4D4C US_ALU_CONST_A_20 | ||
707 | 0x4D50 US_ALU_CONST_R_21 | ||
708 | 0x4D54 US_ALU_CONST_G_21 | ||
709 | 0x4D58 US_ALU_CONST_B_21 | ||
710 | 0x4D5C US_ALU_CONST_A_21 | ||
711 | 0x4D60 US_ALU_CONST_R_22 | ||
712 | 0x4D64 US_ALU_CONST_G_22 | ||
713 | 0x4D68 US_ALU_CONST_B_22 | ||
714 | 0x4D6C US_ALU_CONST_A_22 | ||
715 | 0x4D70 US_ALU_CONST_R_23 | ||
716 | 0x4D74 US_ALU_CONST_G_23 | ||
717 | 0x4D78 US_ALU_CONST_B_23 | ||
718 | 0x4D7C US_ALU_CONST_A_23 | ||
719 | 0x4D80 US_ALU_CONST_R_24 | ||
720 | 0x4D84 US_ALU_CONST_G_24 | ||
721 | 0x4D88 US_ALU_CONST_B_24 | ||
722 | 0x4D8C US_ALU_CONST_A_24 | ||
723 | 0x4D90 US_ALU_CONST_R_25 | ||
724 | 0x4D94 US_ALU_CONST_G_25 | ||
725 | 0x4D98 US_ALU_CONST_B_25 | ||
726 | 0x4D9C US_ALU_CONST_A_25 | ||
727 | 0x4DA0 US_ALU_CONST_R_26 | ||
728 | 0x4DA4 US_ALU_CONST_G_26 | ||
729 | 0x4DA8 US_ALU_CONST_B_26 | ||
730 | 0x4DAC US_ALU_CONST_A_26 | ||
731 | 0x4DB0 US_ALU_CONST_R_27 | ||
732 | 0x4DB4 US_ALU_CONST_G_27 | ||
733 | 0x4DB8 US_ALU_CONST_B_27 | ||
734 | 0x4DBC US_ALU_CONST_A_27 | ||
735 | 0x4DC0 US_ALU_CONST_R_28 | ||
736 | 0x4DC4 US_ALU_CONST_G_28 | ||
737 | 0x4DC8 US_ALU_CONST_B_28 | ||
738 | 0x4DCC US_ALU_CONST_A_28 | ||
739 | 0x4DD0 US_ALU_CONST_R_29 | ||
740 | 0x4DD4 US_ALU_CONST_G_29 | ||
741 | 0x4DD8 US_ALU_CONST_B_29 | ||
742 | 0x4DDC US_ALU_CONST_A_29 | ||
743 | 0x4DE0 US_ALU_CONST_R_30 | ||
744 | 0x4DE4 US_ALU_CONST_G_30 | ||
745 | 0x4DE8 US_ALU_CONST_B_30 | ||
746 | 0x4DEC US_ALU_CONST_A_30 | ||
747 | 0x4DF0 US_ALU_CONST_R_31 | ||
748 | 0x4DF4 US_ALU_CONST_G_31 | ||
749 | 0x4DF8 US_ALU_CONST_B_31 | ||
750 | 0x4DFC US_ALU_CONST_A_31 | ||
751 | 0x4E04 RB3D_BLENDCNTL_R3 | ||
752 | 0x4E08 RB3D_ABLENDCNTL_R3 | ||
753 | 0x4E0C RB3D_COLOR_CHANNEL_MASK | ||
754 | 0x4E10 RB3D_CONSTANT_COLOR | ||
755 | 0x4E14 RB3D_COLOR_CLEAR_VALUE | ||
756 | 0x4E18 RB3D_ROPCNTL_R3 | ||
757 | 0x4E1C RB3D_CLRCMP_FLIPE_R3 | ||
758 | 0x4E20 RB3D_CLRCMP_CLR_R3 | ||
759 | 0x4E24 RB3D_CLRCMP_MSK_R3 | ||
760 | 0x4E48 RB3D_DEBUG_CTL | ||
761 | 0x4E4C RB3D_DSTCACHE_CTLSTAT_R3 | ||
762 | 0x4E50 RB3D_DITHER_CTL | ||
763 | 0x4E54 RB3D_CMASK_OFFSET0 | ||
764 | 0x4E58 RB3D_CMASK_OFFSET1 | ||
765 | 0x4E5C RB3D_CMASK_OFFSET2 | ||
766 | 0x4E60 RB3D_CMASK_OFFSET3 | ||
767 | 0x4E64 RB3D_CMASK_PITCH0 | ||
768 | 0x4E68 RB3D_CMASK_PITCH1 | ||
769 | 0x4E6C RB3D_CMASK_PITCH2 | ||
770 | 0x4E70 RB3D_CMASK_PITCH3 | ||
771 | 0x4E74 RB3D_CMASK_WRINDEX | ||
772 | 0x4E78 RB3D_CMASK_DWORD | ||
773 | 0x4E7C RB3D_CMASK_RDINDEX | ||
774 | 0x4E80 RB3D_AARESOLVE_OFFSET | ||
775 | 0x4E84 RB3D_AARESOLVE_PITCH | ||
776 | 0x4E88 RB3D_AARESOLVE_CTL | ||
777 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD | ||
778 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD | ||
779 | 0x4F04 ZB_ZSTENCILCNTL | ||
780 | 0x4F08 ZB_STENCILREFMASK | ||
781 | 0x4F14 ZB_ZTOP | ||
782 | 0x4F18 ZB_ZCACHE_CTLSTAT | ||
783 | 0x4F1C ZB_BW_CNTL | ||
784 | 0x4F28 ZB_DEPTHCLEARVALUE | ||
785 | 0x4F30 ZB_ZMASK_OFFSET | ||
786 | 0x4F34 ZB_ZMASK_PITCH | ||
787 | 0x4F38 ZB_ZMASK_WRINDEX | ||
788 | 0x4F3C ZB_ZMASK_DWORD | ||
789 | 0x4F40 ZB_ZMASK_RDINDEX | ||
790 | 0x4F44 ZB_HIZ_OFFSET | ||
791 | 0x4F48 ZB_HIZ_WRINDEX | ||
792 | 0x4F4C ZB_HIZ_DWORD | ||
793 | 0x4F50 ZB_HIZ_RDINDEX | ||
794 | 0x4F54 ZB_HIZ_PITCH | ||
795 | 0x4F58 ZB_ZPASS_DATA | ||
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rs600 b/drivers/gpu/drm/radeon/reg_srcs/rs600 index 8e3c0b807add..6801b865d1c4 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/rs600 +++ b/drivers/gpu/drm/radeon/reg_srcs/rs600 | |||
@@ -153,7 +153,7 @@ rs600 0x6d40 | |||
153 | 0x42A4 SU_POLY_OFFSET_FRONT_SCALE | 153 | 0x42A4 SU_POLY_OFFSET_FRONT_SCALE |
154 | 0x42A8 SU_POLY_OFFSET_FRONT_OFFSET | 154 | 0x42A8 SU_POLY_OFFSET_FRONT_OFFSET |
155 | 0x42AC SU_POLY_OFFSET_BACK_SCALE | 155 | 0x42AC SU_POLY_OFFSET_BACK_SCALE |
156 | 0x42B0 SU_POLY_OFFSET_BACK_OFFSET | 156 | 0x42B0 SU_POLY_OFFSET_BACK_OFFSET |
157 | 0x42B4 SU_POLY_OFFSET_ENABLE | 157 | 0x42B4 SU_POLY_OFFSET_ENABLE |
158 | 0x42B8 SU_CULL_MODE | 158 | 0x42B8 SU_CULL_MODE |
159 | 0x42C0 SU_DEPTH_SCALE | 159 | 0x42C0 SU_DEPTH_SCALE |
@@ -291,6 +291,8 @@ rs600 0x6d40 | |||
291 | 0x46AC US_OUT_FMT_2 | 291 | 0x46AC US_OUT_FMT_2 |
292 | 0x46B0 US_OUT_FMT_3 | 292 | 0x46B0 US_OUT_FMT_3 |
293 | 0x46B4 US_W_FMT | 293 | 0x46B4 US_W_FMT |
294 | 0x46B8 US_CODE_BANK | ||
295 | 0x46BC US_CODE_EXT | ||
294 | 0x46C0 US_ALU_RGB_ADDR_0 | 296 | 0x46C0 US_ALU_RGB_ADDR_0 |
295 | 0x46C4 US_ALU_RGB_ADDR_1 | 297 | 0x46C4 US_ALU_RGB_ADDR_1 |
296 | 0x46C8 US_ALU_RGB_ADDR_2 | 298 | 0x46C8 US_ALU_RGB_ADDR_2 |
@@ -547,6 +549,70 @@ rs600 0x6d40 | |||
547 | 0x4AB4 US_ALU_ALPHA_INST_61 | 549 | 0x4AB4 US_ALU_ALPHA_INST_61 |
548 | 0x4AB8 US_ALU_ALPHA_INST_62 | 550 | 0x4AB8 US_ALU_ALPHA_INST_62 |
549 | 0x4ABC US_ALU_ALPHA_INST_63 | 551 | 0x4ABC US_ALU_ALPHA_INST_63 |
552 | 0x4AC0 US_ALU_EXT_ADDR_0 | ||
553 | 0x4AC4 US_ALU_EXT_ADDR_1 | ||
554 | 0x4AC8 US_ALU_EXT_ADDR_2 | ||
555 | 0x4ACC US_ALU_EXT_ADDR_3 | ||
556 | 0x4AD0 US_ALU_EXT_ADDR_4 | ||
557 | 0x4AD4 US_ALU_EXT_ADDR_5 | ||
558 | 0x4AD8 US_ALU_EXT_ADDR_6 | ||
559 | 0x4ADC US_ALU_EXT_ADDR_7 | ||
560 | 0x4AE0 US_ALU_EXT_ADDR_8 | ||
561 | 0x4AE4 US_ALU_EXT_ADDR_9 | ||
562 | 0x4AE8 US_ALU_EXT_ADDR_10 | ||
563 | 0x4AEC US_ALU_EXT_ADDR_11 | ||
564 | 0x4AF0 US_ALU_EXT_ADDR_12 | ||
565 | 0x4AF4 US_ALU_EXT_ADDR_13 | ||
566 | 0x4AF8 US_ALU_EXT_ADDR_14 | ||
567 | 0x4AFC US_ALU_EXT_ADDR_15 | ||
568 | 0x4B00 US_ALU_EXT_ADDR_16 | ||
569 | 0x4B04 US_ALU_EXT_ADDR_17 | ||
570 | 0x4B08 US_ALU_EXT_ADDR_18 | ||
571 | 0x4B0C US_ALU_EXT_ADDR_19 | ||
572 | 0x4B10 US_ALU_EXT_ADDR_20 | ||
573 | 0x4B14 US_ALU_EXT_ADDR_21 | ||
574 | 0x4B18 US_ALU_EXT_ADDR_22 | ||
575 | 0x4B1C US_ALU_EXT_ADDR_23 | ||
576 | 0x4B20 US_ALU_EXT_ADDR_24 | ||
577 | 0x4B24 US_ALU_EXT_ADDR_25 | ||
578 | 0x4B28 US_ALU_EXT_ADDR_26 | ||
579 | 0x4B2C US_ALU_EXT_ADDR_27 | ||
580 | 0x4B30 US_ALU_EXT_ADDR_28 | ||
581 | 0x4B34 US_ALU_EXT_ADDR_29 | ||
582 | 0x4B38 US_ALU_EXT_ADDR_30 | ||
583 | 0x4B3C US_ALU_EXT_ADDR_31 | ||
584 | 0x4B40 US_ALU_EXT_ADDR_32 | ||
585 | 0x4B44 US_ALU_EXT_ADDR_33 | ||
586 | 0x4B48 US_ALU_EXT_ADDR_34 | ||
587 | 0x4B4C US_ALU_EXT_ADDR_35 | ||
588 | 0x4B50 US_ALU_EXT_ADDR_36 | ||
589 | 0x4B54 US_ALU_EXT_ADDR_37 | ||
590 | 0x4B58 US_ALU_EXT_ADDR_38 | ||
591 | 0x4B5C US_ALU_EXT_ADDR_39 | ||
592 | 0x4B60 US_ALU_EXT_ADDR_40 | ||
593 | 0x4B64 US_ALU_EXT_ADDR_41 | ||
594 | 0x4B68 US_ALU_EXT_ADDR_42 | ||
595 | 0x4B6C US_ALU_EXT_ADDR_43 | ||
596 | 0x4B70 US_ALU_EXT_ADDR_44 | ||
597 | 0x4B74 US_ALU_EXT_ADDR_45 | ||
598 | 0x4B78 US_ALU_EXT_ADDR_46 | ||
599 | 0x4B7C US_ALU_EXT_ADDR_47 | ||
600 | 0x4B80 US_ALU_EXT_ADDR_48 | ||
601 | 0x4B84 US_ALU_EXT_ADDR_49 | ||
602 | 0x4B88 US_ALU_EXT_ADDR_50 | ||
603 | 0x4B8C US_ALU_EXT_ADDR_51 | ||
604 | 0x4B90 US_ALU_EXT_ADDR_52 | ||
605 | 0x4B94 US_ALU_EXT_ADDR_53 | ||
606 | 0x4B98 US_ALU_EXT_ADDR_54 | ||
607 | 0x4B9C US_ALU_EXT_ADDR_55 | ||
608 | 0x4BA0 US_ALU_EXT_ADDR_56 | ||
609 | 0x4BA4 US_ALU_EXT_ADDR_57 | ||
610 | 0x4BA8 US_ALU_EXT_ADDR_58 | ||
611 | 0x4BAC US_ALU_EXT_ADDR_59 | ||
612 | 0x4BB0 US_ALU_EXT_ADDR_60 | ||
613 | 0x4BB4 US_ALU_EXT_ADDR_61 | ||
614 | 0x4BB8 US_ALU_EXT_ADDR_62 | ||
615 | 0x4BBC US_ALU_EXT_ADDR_63 | ||
550 | 0x4BC0 FG_FOG_BLEND | 616 | 0x4BC0 FG_FOG_BLEND |
551 | 0x4BC4 FG_FOG_FACTOR | 617 | 0x4BC4 FG_FOG_FACTOR |
552 | 0x4BC8 FG_FOG_COLOR_R | 618 | 0x4BC8 FG_FOG_COLOR_R |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rv515 b/drivers/gpu/drm/radeon/reg_srcs/rv515 index 0102a0d5735c..38abf63bf2cd 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/rv515 +++ b/drivers/gpu/drm/radeon/reg_srcs/rv515 | |||
@@ -161,7 +161,12 @@ rv515 0x6d40 | |||
161 | 0x401C GB_SELECT | 161 | 0x401C GB_SELECT |
162 | 0x4020 GB_AA_CONFIG | 162 | 0x4020 GB_AA_CONFIG |
163 | 0x4024 GB_FIFO_SIZE | 163 | 0x4024 GB_FIFO_SIZE |
164 | 0x4028 GB_Z_PEQ_CONFIG | ||
164 | 0x4100 TX_INVALTAGS | 165 | 0x4100 TX_INVALTAGS |
166 | 0x4114 SU_TEX_WRAP_PS3 | ||
167 | 0x4118 PS3_ENABLE | ||
168 | 0x411c PS3_VTX_FMT | ||
169 | 0x4120 PS3_TEX_SOURCE | ||
165 | 0x4200 GA_POINT_S0 | 170 | 0x4200 GA_POINT_S0 |
166 | 0x4204 GA_POINT_T0 | 171 | 0x4204 GA_POINT_T0 |
167 | 0x4208 GA_POINT_S1 | 172 | 0x4208 GA_POINT_S1 |
@@ -171,6 +176,7 @@ rv515 0x6d40 | |||
171 | 0x4230 GA_POINT_MINMAX | 176 | 0x4230 GA_POINT_MINMAX |
172 | 0x4234 GA_LINE_CNTL | 177 | 0x4234 GA_LINE_CNTL |
173 | 0x4238 GA_LINE_STIPPLE_CONFIG | 178 | 0x4238 GA_LINE_STIPPLE_CONFIG |
179 | 0x4258 GA_COLOR_CONTROL_PS3 | ||
174 | 0x4260 GA_LINE_STIPPLE_VALUE | 180 | 0x4260 GA_LINE_STIPPLE_VALUE |
175 | 0x4264 GA_LINE_S0 | 181 | 0x4264 GA_LINE_S0 |
176 | 0x4268 GA_LINE_S1 | 182 | 0x4268 GA_LINE_S1 |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 368415df5f3a..9f5418983e2a 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -356,6 +356,7 @@ static int rs400_mc_init(struct radeon_device *rdev) | |||
356 | rdev->mc.vram_location = G_00015C_MC_FB_START(tmp) << 16; | 356 | rdev->mc.vram_location = G_00015C_MC_FB_START(tmp) << 16; |
357 | rdev->mc.gtt_location = 0xFFFFFFFFUL; | 357 | rdev->mc.gtt_location = 0xFFFFFFFFUL; |
358 | r = radeon_mc_setup(rdev); | 358 | r = radeon_mc_setup(rdev); |
359 | rdev->mc.igp_sideport_enabled = radeon_combios_sideport_present(rdev); | ||
359 | if (r) | 360 | if (r) |
360 | return r; | 361 | return r; |
361 | return 0; | 362 | return 0; |
@@ -395,6 +396,7 @@ static int rs400_startup(struct radeon_device *rdev) | |||
395 | return r; | 396 | return r; |
396 | /* Enable IRQ */ | 397 | /* Enable IRQ */ |
397 | r100_irq_set(rdev); | 398 | r100_irq_set(rdev); |
399 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
398 | /* 1M ring buffer */ | 400 | /* 1M ring buffer */ |
399 | r = r100_cp_init(rdev, 1024 * 1024); | 401 | r = r100_cp_init(rdev, 1024 * 1024); |
400 | if (r) { | 402 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 4f8ea4260572..d5255751e7b3 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -56,6 +56,7 @@ int rs600_mc_init(struct radeon_device *rdev) | |||
56 | rdev->mc.vram_location = G_000004_MC_FB_START(tmp) << 16; | 56 | rdev->mc.vram_location = G_000004_MC_FB_START(tmp) << 16; |
57 | rdev->mc.gtt_location = 0xffffffffUL; | 57 | rdev->mc.gtt_location = 0xffffffffUL; |
58 | r = radeon_mc_setup(rdev); | 58 | r = radeon_mc_setup(rdev); |
59 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | ||
59 | if (r) | 60 | if (r) |
60 | return r; | 61 | return r; |
61 | return 0; | 62 | return 0; |
@@ -134,7 +135,8 @@ void rs600_hpd_init(struct radeon_device *rdev) | |||
134 | break; | 135 | break; |
135 | } | 136 | } |
136 | } | 137 | } |
137 | rs600_irq_set(rdev); | 138 | if (rdev->irq.installed) |
139 | rs600_irq_set(rdev); | ||
138 | } | 140 | } |
139 | 141 | ||
140 | void rs600_hpd_fini(struct radeon_device *rdev) | 142 | void rs600_hpd_fini(struct radeon_device *rdev) |
@@ -315,6 +317,11 @@ int rs600_irq_set(struct radeon_device *rdev) | |||
315 | u32 hpd2 = RREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL) & | 317 | u32 hpd2 = RREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL) & |
316 | ~S_007D18_DC_HOT_PLUG_DETECT2_INT_EN(1); | 318 | ~S_007D18_DC_HOT_PLUG_DETECT2_INT_EN(1); |
317 | 319 | ||
320 | if (!rdev->irq.installed) { | ||
321 | WARN(1, "Can't enable IRQ/MSI because no handler is installed.\n"); | ||
322 | WREG32(R_000040_GEN_INT_CNTL, 0); | ||
323 | return -EINVAL; | ||
324 | } | ||
318 | if (rdev->irq.sw_int) { | 325 | if (rdev->irq.sw_int) { |
319 | tmp |= S_000040_SW_INT_EN(1); | 326 | tmp |= S_000040_SW_INT_EN(1); |
320 | } | 327 | } |
@@ -396,7 +403,7 @@ int rs600_irq_process(struct radeon_device *rdev) | |||
396 | } | 403 | } |
397 | while (status || r500_disp_int) { | 404 | while (status || r500_disp_int) { |
398 | /* SW interrupt */ | 405 | /* SW interrupt */ |
399 | if (G_000040_SW_INT_EN(status)) | 406 | if (G_000044_SW_INT(status)) |
400 | radeon_fence_process(rdev); | 407 | radeon_fence_process(rdev); |
401 | /* Vertical blank interrupts */ | 408 | /* Vertical blank interrupts */ |
402 | if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int)) | 409 | if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int)) |
@@ -553,6 +560,7 @@ static int rs600_startup(struct radeon_device *rdev) | |||
553 | return r; | 560 | return r; |
554 | /* Enable IRQ */ | 561 | /* Enable IRQ */ |
555 | rs600_irq_set(rdev); | 562 | rs600_irq_set(rdev); |
563 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
556 | /* 1M ring buffer */ | 564 | /* 1M ring buffer */ |
557 | r = r100_cp_init(rdev, 1024 * 1024); | 565 | r = r100_cp_init(rdev, 1024 * 1024); |
558 | if (r) { | 566 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 1e22f52d6039..cd31da913771 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -172,6 +172,7 @@ static int rs690_mc_init(struct radeon_device *rdev) | |||
172 | rdev->mc.vram_location = G_000100_MC_FB_START(tmp) << 16; | 172 | rdev->mc.vram_location = G_000100_MC_FB_START(tmp) << 16; |
173 | rdev->mc.gtt_location = 0xFFFFFFFFUL; | 173 | rdev->mc.gtt_location = 0xFFFFFFFFUL; |
174 | r = radeon_mc_setup(rdev); | 174 | r = radeon_mc_setup(rdev); |
175 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | ||
175 | if (r) | 176 | if (r) |
176 | return r; | 177 | return r; |
177 | return 0; | 178 | return 0; |
@@ -625,6 +626,7 @@ static int rs690_startup(struct radeon_device *rdev) | |||
625 | return r; | 626 | return r; |
626 | /* Enable IRQ */ | 627 | /* Enable IRQ */ |
627 | rs600_irq_set(rdev); | 628 | rs600_irq_set(rdev); |
629 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
628 | /* 1M ring buffer */ | 630 | /* 1M ring buffer */ |
629 | r = r100_cp_init(rdev, 1024 * 1024); | 631 | r = r100_cp_init(rdev, 1024 * 1024); |
630 | if (r) { | 632 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 59632a506b46..62756717b044 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -479,6 +479,7 @@ static int rv515_startup(struct radeon_device *rdev) | |||
479 | } | 479 | } |
480 | /* Enable IRQ */ | 480 | /* Enable IRQ */ |
481 | rs600_irq_set(rdev); | 481 | rs600_irq_set(rdev); |
482 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
482 | /* 1M ring buffer */ | 483 | /* 1M ring buffer */ |
483 | r = r100_cp_init(rdev, 1024 * 1024); | 484 | r = r100_cp_init(rdev, 1024 * 1024); |
484 | if (r) { | 485 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 3bcb66e52786..59c71245fb91 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -1096,8 +1096,7 @@ void rv770_fini(struct radeon_device *rdev) | |||
1096 | radeon_gem_fini(rdev); | 1096 | radeon_gem_fini(rdev); |
1097 | radeon_fence_driver_fini(rdev); | 1097 | radeon_fence_driver_fini(rdev); |
1098 | radeon_clocks_fini(rdev); | 1098 | radeon_clocks_fini(rdev); |
1099 | if (rdev->flags & RADEON_IS_AGP) | 1099 | radeon_agp_fini(rdev); |
1100 | radeon_agp_fini(rdev); | ||
1101 | radeon_bo_fini(rdev); | 1100 | radeon_bo_fini(rdev); |
1102 | radeon_atombios_fini(rdev); | 1101 | radeon_atombios_fini(rdev); |
1103 | kfree(rdev->bios); | 1102 | kfree(rdev->bios); |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 46c3c566307e..68cf87749a42 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -392,7 +392,7 @@ config SENSORS_GL520SM | |||
392 | 392 | ||
393 | config SENSORS_CORETEMP | 393 | config SENSORS_CORETEMP |
394 | tristate "Intel Core/Core2/Atom temperature sensor" | 394 | tristate "Intel Core/Core2/Atom temperature sensor" |
395 | depends on X86 && EXPERIMENTAL | 395 | depends on X86 && PCI && EXPERIMENTAL |
396 | help | 396 | help |
397 | If you say yes here you get support for the temperature | 397 | If you say yes here you get support for the temperature |
398 | sensor inside your CPU. Most of the family 6 CPUs | 398 | sensor inside your CPU. Most of the family 6 CPUs |
@@ -792,6 +792,16 @@ config SENSORS_ADS7828 | |||
792 | This driver can also be built as a module. If so, the module | 792 | This driver can also be built as a module. If so, the module |
793 | will be called ads7828. | 793 | will be called ads7828. |
794 | 794 | ||
795 | config SENSORS_AMC6821 | ||
796 | tristate "Texas Instruments AMC6821" | ||
797 | depends on I2C && EXPERIMENTAL | ||
798 | help | ||
799 | If you say yes here you get support for the Texas Instruments | ||
800 | AMC6821 hardware monitoring chips. | ||
801 | |||
802 | This driver can also be build as a module. If so, the module | ||
803 | will be called amc6821. | ||
804 | |||
795 | config SENSORS_THMC50 | 805 | config SENSORS_THMC50 |
796 | tristate "Texas Instruments THMC50 / Analog Devices ADM1022" | 806 | tristate "Texas Instruments THMC50 / Analog Devices ADM1022" |
797 | depends on I2C && EXPERIMENTAL | 807 | depends on I2C && EXPERIMENTAL |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 450c8e894277..4bc215c0953f 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -86,6 +86,7 @@ obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o | |||
86 | obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o | 86 | obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o |
87 | obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o | 87 | obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o |
88 | obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o | 88 | obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o |
89 | obj-$(CONFIG_SENSORS_AMC6821) += amc6821.o | ||
89 | obj-$(CONFIG_SENSORS_THMC50) += thmc50.o | 90 | obj-$(CONFIG_SENSORS_THMC50) += thmc50.o |
90 | obj-$(CONFIG_SENSORS_TMP401) += tmp401.o | 91 | obj-$(CONFIG_SENSORS_TMP401) += tmp401.o |
91 | obj-$(CONFIG_SENSORS_TMP421) += tmp421.o | 92 | obj-$(CONFIG_SENSORS_TMP421) += tmp421.o |
diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c index a1a7ef14b519..a31e77c776ae 100644 --- a/drivers/hwmon/adt7462.c +++ b/drivers/hwmon/adt7462.c | |||
@@ -94,7 +94,7 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END }; | |||
94 | #define ADT7462_PIN24_SHIFT 6 | 94 | #define ADT7462_PIN24_SHIFT 6 |
95 | #define ADT7462_PIN26_VOLT_INPUT 0x08 | 95 | #define ADT7462_PIN26_VOLT_INPUT 0x08 |
96 | #define ADT7462_PIN25_VOLT_INPUT 0x20 | 96 | #define ADT7462_PIN25_VOLT_INPUT 0x20 |
97 | #define ADT7462_PIN28_SHIFT 6 /* cfg3 */ | 97 | #define ADT7462_PIN28_SHIFT 4 /* cfg3 */ |
98 | #define ADT7462_PIN28_VOLT 0x5 | 98 | #define ADT7462_PIN28_VOLT 0x5 |
99 | 99 | ||
100 | #define ADT7462_REG_ALARM1 0xB8 | 100 | #define ADT7462_REG_ALARM1 0xB8 |
diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c new file mode 100644 index 000000000000..1c89d922d619 --- /dev/null +++ b/drivers/hwmon/amc6821.c | |||
@@ -0,0 +1,1116 @@ | |||
1 | /* | ||
2 | amc6821.c - Part of lm_sensors, Linux kernel modules for hardware | ||
3 | monitoring | ||
4 | Copyright (C) 2009 T. Mertelj <tomaz.mertelj@guest.arnes.si> | ||
5 | |||
6 | Based on max6650.c: | ||
7 | Copyright (C) 2007 Hans J. Koch <hjk@linutronix.de> | ||
8 | |||
9 | This program is free software; you can redistribute it and/or modify | ||
10 | it under the terms of the GNU General Public License as published by | ||
11 | the Free Software Foundation; either version 2 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | This program is distributed in the hope that it will be useful, | ||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | GNU General Public License for more details. | ||
18 | |||
19 | You should have received a copy of the GNU General Public License | ||
20 | along with this program; if not, write to the Free Software | ||
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | |||
25 | #include <linux/kernel.h> /* Needed for KERN_INFO */ | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/jiffies.h> | ||
30 | #include <linux/i2c.h> | ||
31 | #include <linux/hwmon.h> | ||
32 | #include <linux/hwmon-sysfs.h> | ||
33 | #include <linux/err.h> | ||
34 | #include <linux/mutex.h> | ||
35 | |||
36 | |||
37 | /* | ||
38 | * Addresses to scan. | ||
39 | */ | ||
40 | |||
41 | static const unsigned short normal_i2c[] = {0x18, 0x19, 0x1a, 0x2c, 0x2d, 0x2e, | ||
42 | 0x4c, 0x4d, 0x4e, I2C_CLIENT_END}; | ||
43 | |||
44 | |||
45 | |||
46 | /* | ||
47 | * Insmod parameters | ||
48 | */ | ||
49 | |||
50 | static int pwminv = 0; /*Inverted PWM output. */ | ||
51 | module_param(pwminv, int, S_IRUGO); | ||
52 | |||
53 | static int init = 1; /*Power-on initialization.*/ | ||
54 | module_param(init, int, S_IRUGO); | ||
55 | |||
56 | |||
57 | enum chips { amc6821 }; | ||
58 | |||
59 | #define AMC6821_REG_DEV_ID 0x3D | ||
60 | #define AMC6821_REG_COMP_ID 0x3E | ||
61 | #define AMC6821_REG_CONF1 0x00 | ||
62 | #define AMC6821_REG_CONF2 0x01 | ||
63 | #define AMC6821_REG_CONF3 0x3F | ||
64 | #define AMC6821_REG_CONF4 0x04 | ||
65 | #define AMC6821_REG_STAT1 0x02 | ||
66 | #define AMC6821_REG_STAT2 0x03 | ||
67 | #define AMC6821_REG_TDATA_LOW 0x08 | ||
68 | #define AMC6821_REG_TDATA_HI 0x09 | ||
69 | #define AMC6821_REG_LTEMP_HI 0x0A | ||
70 | #define AMC6821_REG_RTEMP_HI 0x0B | ||
71 | #define AMC6821_REG_LTEMP_LIMIT_MIN 0x15 | ||
72 | #define AMC6821_REG_LTEMP_LIMIT_MAX 0x14 | ||
73 | #define AMC6821_REG_RTEMP_LIMIT_MIN 0x19 | ||
74 | #define AMC6821_REG_RTEMP_LIMIT_MAX 0x18 | ||
75 | #define AMC6821_REG_LTEMP_CRIT 0x1B | ||
76 | #define AMC6821_REG_RTEMP_CRIT 0x1D | ||
77 | #define AMC6821_REG_PSV_TEMP 0x1C | ||
78 | #define AMC6821_REG_DCY 0x22 | ||
79 | #define AMC6821_REG_LTEMP_FAN_CTRL 0x24 | ||
80 | #define AMC6821_REG_RTEMP_FAN_CTRL 0x25 | ||
81 | #define AMC6821_REG_DCY_LOW_TEMP 0x21 | ||
82 | |||
83 | #define AMC6821_REG_TACH_LLIMITL 0x10 | ||
84 | #define AMC6821_REG_TACH_LLIMITH 0x11 | ||
85 | #define AMC6821_REG_TACH_HLIMITL 0x12 | ||
86 | #define AMC6821_REG_TACH_HLIMITH 0x13 | ||
87 | |||
88 | #define AMC6821_CONF1_START 0x01 | ||
89 | #define AMC6821_CONF1_FAN_INT_EN 0x02 | ||
90 | #define AMC6821_CONF1_FANIE 0x04 | ||
91 | #define AMC6821_CONF1_PWMINV 0x08 | ||
92 | #define AMC6821_CONF1_FAN_FAULT_EN 0x10 | ||
93 | #define AMC6821_CONF1_FDRC0 0x20 | ||
94 | #define AMC6821_CONF1_FDRC1 0x40 | ||
95 | #define AMC6821_CONF1_THERMOVIE 0x80 | ||
96 | |||
97 | #define AMC6821_CONF2_PWM_EN 0x01 | ||
98 | #define AMC6821_CONF2_TACH_MODE 0x02 | ||
99 | #define AMC6821_CONF2_TACH_EN 0x04 | ||
100 | #define AMC6821_CONF2_RTFIE 0x08 | ||
101 | #define AMC6821_CONF2_LTOIE 0x10 | ||
102 | #define AMC6821_CONF2_RTOIE 0x20 | ||
103 | #define AMC6821_CONF2_PSVIE 0x40 | ||
104 | #define AMC6821_CONF2_RST 0x80 | ||
105 | |||
106 | #define AMC6821_CONF3_THERM_FAN_EN 0x80 | ||
107 | #define AMC6821_CONF3_REV_MASK 0x0F | ||
108 | |||
109 | #define AMC6821_CONF4_OVREN 0x10 | ||
110 | #define AMC6821_CONF4_TACH_FAST 0x20 | ||
111 | #define AMC6821_CONF4_PSPR 0x40 | ||
112 | #define AMC6821_CONF4_MODE 0x80 | ||
113 | |||
114 | #define AMC6821_STAT1_RPM_ALARM 0x01 | ||
115 | #define AMC6821_STAT1_FANS 0x02 | ||
116 | #define AMC6821_STAT1_RTH 0x04 | ||
117 | #define AMC6821_STAT1_RTL 0x08 | ||
118 | #define AMC6821_STAT1_R_THERM 0x10 | ||
119 | #define AMC6821_STAT1_RTF 0x20 | ||
120 | #define AMC6821_STAT1_LTH 0x40 | ||
121 | #define AMC6821_STAT1_LTL 0x80 | ||
122 | |||
123 | #define AMC6821_STAT2_RTC 0x08 | ||
124 | #define AMC6821_STAT2_LTC 0x10 | ||
125 | #define AMC6821_STAT2_LPSV 0x20 | ||
126 | #define AMC6821_STAT2_L_THERM 0x40 | ||
127 | #define AMC6821_STAT2_THERM_IN 0x80 | ||
128 | |||
129 | enum {IDX_TEMP1_INPUT = 0, IDX_TEMP1_MIN, IDX_TEMP1_MAX, | ||
130 | IDX_TEMP1_CRIT, IDX_TEMP2_INPUT, IDX_TEMP2_MIN, | ||
131 | IDX_TEMP2_MAX, IDX_TEMP2_CRIT, | ||
132 | TEMP_IDX_LEN, }; | ||
133 | |||
134 | static const u8 temp_reg[] = {AMC6821_REG_LTEMP_HI, | ||
135 | AMC6821_REG_LTEMP_LIMIT_MIN, | ||
136 | AMC6821_REG_LTEMP_LIMIT_MAX, | ||
137 | AMC6821_REG_LTEMP_CRIT, | ||
138 | AMC6821_REG_RTEMP_HI, | ||
139 | AMC6821_REG_RTEMP_LIMIT_MIN, | ||
140 | AMC6821_REG_RTEMP_LIMIT_MAX, | ||
141 | AMC6821_REG_RTEMP_CRIT, }; | ||
142 | |||
143 | enum {IDX_FAN1_INPUT = 0, IDX_FAN1_MIN, IDX_FAN1_MAX, | ||
144 | FAN1_IDX_LEN, }; | ||
145 | |||
146 | static const u8 fan_reg_low[] = {AMC6821_REG_TDATA_LOW, | ||
147 | AMC6821_REG_TACH_LLIMITL, | ||
148 | AMC6821_REG_TACH_HLIMITL, }; | ||
149 | |||
150 | |||
151 | static const u8 fan_reg_hi[] = {AMC6821_REG_TDATA_HI, | ||
152 | AMC6821_REG_TACH_LLIMITH, | ||
153 | AMC6821_REG_TACH_HLIMITH, }; | ||
154 | |||
155 | static int amc6821_probe( | ||
156 | struct i2c_client *client, | ||
157 | const struct i2c_device_id *id); | ||
158 | static int amc6821_detect( | ||
159 | struct i2c_client *client, | ||
160 | struct i2c_board_info *info); | ||
161 | static int amc6821_init_client(struct i2c_client *client); | ||
162 | static int amc6821_remove(struct i2c_client *client); | ||
163 | static struct amc6821_data *amc6821_update_device(struct device *dev); | ||
164 | |||
165 | /* | ||
166 | * Driver data (common to all clients) | ||
167 | */ | ||
168 | |||
169 | static const struct i2c_device_id amc6821_id[] = { | ||
170 | { "amc6821", amc6821 }, | ||
171 | { } | ||
172 | }; | ||
173 | |||
174 | MODULE_DEVICE_TABLE(i2c, amc6821_id); | ||
175 | |||
176 | static struct i2c_driver amc6821_driver = { | ||
177 | .class = I2C_CLASS_HWMON, | ||
178 | .driver = { | ||
179 | .name = "amc6821", | ||
180 | }, | ||
181 | .probe = amc6821_probe, | ||
182 | .remove = amc6821_remove, | ||
183 | .id_table = amc6821_id, | ||
184 | .detect = amc6821_detect, | ||
185 | .address_list = normal_i2c, | ||
186 | }; | ||
187 | |||
188 | |||
189 | /* | ||
190 | * Client data (each client gets its own) | ||
191 | */ | ||
192 | |||
193 | struct amc6821_data { | ||
194 | struct device *hwmon_dev; | ||
195 | struct mutex update_lock; | ||
196 | char valid; /* zero until following fields are valid */ | ||
197 | unsigned long last_updated; /* in jiffies */ | ||
198 | |||
199 | /* register values */ | ||
200 | int temp[TEMP_IDX_LEN]; | ||
201 | |||
202 | u16 fan[FAN1_IDX_LEN]; | ||
203 | u8 fan1_div; | ||
204 | |||
205 | u8 pwm1; | ||
206 | u8 temp1_auto_point_temp[3]; | ||
207 | u8 temp2_auto_point_temp[3]; | ||
208 | u8 pwm1_auto_point_pwm[3]; | ||
209 | u8 pwm1_enable; | ||
210 | u8 pwm1_auto_channels_temp; | ||
211 | |||
212 | u8 stat1; | ||
213 | u8 stat2; | ||
214 | }; | ||
215 | |||
216 | |||
217 | static ssize_t get_temp( | ||
218 | struct device *dev, | ||
219 | struct device_attribute *devattr, | ||
220 | char *buf) | ||
221 | { | ||
222 | struct amc6821_data *data = amc6821_update_device(dev); | ||
223 | int ix = to_sensor_dev_attr(devattr)->index; | ||
224 | |||
225 | return sprintf(buf, "%d\n", data->temp[ix] * 1000); | ||
226 | } | ||
227 | |||
228 | |||
229 | |||
230 | static ssize_t set_temp( | ||
231 | struct device *dev, | ||
232 | struct device_attribute *attr, | ||
233 | const char *buf, | ||
234 | size_t count) | ||
235 | { | ||
236 | struct i2c_client *client = to_i2c_client(dev); | ||
237 | struct amc6821_data *data = i2c_get_clientdata(client); | ||
238 | int ix = to_sensor_dev_attr(attr)->index; | ||
239 | long val; | ||
240 | |||
241 | int ret = strict_strtol(buf, 10, &val); | ||
242 | if (ret) | ||
243 | return ret; | ||
244 | val = SENSORS_LIMIT(val / 1000, -128, 127); | ||
245 | |||
246 | mutex_lock(&data->update_lock); | ||
247 | data->temp[ix] = val; | ||
248 | if (i2c_smbus_write_byte_data(client, temp_reg[ix], data->temp[ix])) { | ||
249 | dev_err(&client->dev, "Register write error, aborting.\n"); | ||
250 | count = -EIO; | ||
251 | } | ||
252 | mutex_unlock(&data->update_lock); | ||
253 | return count; | ||
254 | } | ||
255 | |||
256 | |||
257 | |||
258 | |||
259 | static ssize_t get_temp_alarm( | ||
260 | struct device *dev, | ||
261 | struct device_attribute *devattr, | ||
262 | char *buf) | ||
263 | { | ||
264 | struct amc6821_data *data = amc6821_update_device(dev); | ||
265 | int ix = to_sensor_dev_attr(devattr)->index; | ||
266 | u8 flag; | ||
267 | |||
268 | switch (ix) { | ||
269 | case IDX_TEMP1_MIN: | ||
270 | flag = data->stat1 & AMC6821_STAT1_LTL; | ||
271 | break; | ||
272 | case IDX_TEMP1_MAX: | ||
273 | flag = data->stat1 & AMC6821_STAT1_LTH; | ||
274 | break; | ||
275 | case IDX_TEMP1_CRIT: | ||
276 | flag = data->stat2 & AMC6821_STAT2_LTC; | ||
277 | break; | ||
278 | case IDX_TEMP2_MIN: | ||
279 | flag = data->stat1 & AMC6821_STAT1_RTL; | ||
280 | break; | ||
281 | case IDX_TEMP2_MAX: | ||
282 | flag = data->stat1 & AMC6821_STAT1_RTH; | ||
283 | break; | ||
284 | case IDX_TEMP2_CRIT: | ||
285 | flag = data->stat2 & AMC6821_STAT2_RTC; | ||
286 | break; | ||
287 | default: | ||
288 | dev_dbg(dev, "Unknown attr->index (%d).\n", ix); | ||
289 | return -EINVAL; | ||
290 | } | ||
291 | if (flag) | ||
292 | return sprintf(buf, "1"); | ||
293 | else | ||
294 | return sprintf(buf, "0"); | ||
295 | } | ||
296 | |||
297 | |||
298 | |||
299 | |||
300 | static ssize_t get_temp2_fault( | ||
301 | struct device *dev, | ||
302 | struct device_attribute *devattr, | ||
303 | char *buf) | ||
304 | { | ||
305 | struct amc6821_data *data = amc6821_update_device(dev); | ||
306 | if (data->stat1 & AMC6821_STAT1_RTF) | ||
307 | return sprintf(buf, "1"); | ||
308 | else | ||
309 | return sprintf(buf, "0"); | ||
310 | } | ||
311 | |||
312 | static ssize_t get_pwm1( | ||
313 | struct device *dev, | ||
314 | struct device_attribute *devattr, | ||
315 | char *buf) | ||
316 | { | ||
317 | struct amc6821_data *data = amc6821_update_device(dev); | ||
318 | return sprintf(buf, "%d\n", data->pwm1); | ||
319 | } | ||
320 | |||
321 | static ssize_t set_pwm1( | ||
322 | struct device *dev, | ||
323 | struct device_attribute *devattr, | ||
324 | const char *buf, | ||
325 | size_t count) | ||
326 | { | ||
327 | struct i2c_client *client = to_i2c_client(dev); | ||
328 | struct amc6821_data *data = i2c_get_clientdata(client); | ||
329 | long val; | ||
330 | int ret = strict_strtol(buf, 10, &val); | ||
331 | if (ret) | ||
332 | return ret; | ||
333 | |||
334 | mutex_lock(&data->update_lock); | ||
335 | data->pwm1 = SENSORS_LIMIT(val , 0, 255); | ||
336 | i2c_smbus_write_byte_data(client, AMC6821_REG_DCY, data->pwm1); | ||
337 | mutex_unlock(&data->update_lock); | ||
338 | return count; | ||
339 | } | ||
340 | |||
341 | static ssize_t get_pwm1_enable( | ||
342 | struct device *dev, | ||
343 | struct device_attribute *devattr, | ||
344 | char *buf) | ||
345 | { | ||
346 | struct amc6821_data *data = amc6821_update_device(dev); | ||
347 | return sprintf(buf, "%d\n", data->pwm1_enable); | ||
348 | } | ||
349 | |||
350 | static ssize_t set_pwm1_enable( | ||
351 | struct device *dev, | ||
352 | struct device_attribute *attr, | ||
353 | const char *buf, | ||
354 | size_t count) | ||
355 | { | ||
356 | struct i2c_client *client = to_i2c_client(dev); | ||
357 | struct amc6821_data *data = i2c_get_clientdata(client); | ||
358 | long val; | ||
359 | int config = strict_strtol(buf, 10, &val); | ||
360 | if (config) | ||
361 | return config; | ||
362 | |||
363 | config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1); | ||
364 | if (config < 0) { | ||
365 | dev_err(&client->dev, | ||
366 | "Error reading configuration register, aborting.\n"); | ||
367 | return -EIO; | ||
368 | } | ||
369 | |||
370 | switch (val) { | ||
371 | case 1: | ||
372 | config &= ~AMC6821_CONF1_FDRC0; | ||
373 | config &= ~AMC6821_CONF1_FDRC1; | ||
374 | break; | ||
375 | case 2: | ||
376 | config &= ~AMC6821_CONF1_FDRC0; | ||
377 | config |= AMC6821_CONF1_FDRC1; | ||
378 | break; | ||
379 | case 3: | ||
380 | config |= AMC6821_CONF1_FDRC0; | ||
381 | config |= AMC6821_CONF1_FDRC1; | ||
382 | break; | ||
383 | default: | ||
384 | return -EINVAL; | ||
385 | } | ||
386 | mutex_lock(&data->update_lock); | ||
387 | if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF1, config)) { | ||
388 | dev_err(&client->dev, | ||
389 | "Configuration register write error, aborting.\n"); | ||
390 | count = -EIO; | ||
391 | } | ||
392 | mutex_unlock(&data->update_lock); | ||
393 | return count; | ||
394 | } | ||
395 | |||
396 | |||
397 | static ssize_t get_pwm1_auto_channels_temp( | ||
398 | struct device *dev, | ||
399 | struct device_attribute *devattr, | ||
400 | char *buf) | ||
401 | { | ||
402 | struct amc6821_data *data = amc6821_update_device(dev); | ||
403 | return sprintf(buf, "%d\n", data->pwm1_auto_channels_temp); | ||
404 | } | ||
405 | |||
406 | |||
407 | static ssize_t get_temp_auto_point_temp( | ||
408 | struct device *dev, | ||
409 | struct device_attribute *devattr, | ||
410 | char *buf) | ||
411 | { | ||
412 | int ix = to_sensor_dev_attr_2(devattr)->index; | ||
413 | int nr = to_sensor_dev_attr_2(devattr)->nr; | ||
414 | struct amc6821_data *data = amc6821_update_device(dev); | ||
415 | switch (nr) { | ||
416 | case 1: | ||
417 | return sprintf(buf, "%d\n", | ||
418 | data->temp1_auto_point_temp[ix] * 1000); | ||
419 | break; | ||
420 | case 2: | ||
421 | return sprintf(buf, "%d\n", | ||
422 | data->temp2_auto_point_temp[ix] * 1000); | ||
423 | break; | ||
424 | default: | ||
425 | dev_dbg(dev, "Unknown attr->nr (%d).\n", nr); | ||
426 | return -EINVAL; | ||
427 | } | ||
428 | } | ||
429 | |||
430 | |||
431 | static ssize_t get_pwm1_auto_point_pwm( | ||
432 | struct device *dev, | ||
433 | struct device_attribute *devattr, | ||
434 | char *buf) | ||
435 | { | ||
436 | int ix = to_sensor_dev_attr(devattr)->index; | ||
437 | struct amc6821_data *data = amc6821_update_device(dev); | ||
438 | return sprintf(buf, "%d\n", data->pwm1_auto_point_pwm[ix]); | ||
439 | } | ||
440 | |||
441 | |||
442 | static inline ssize_t set_slope_register(struct i2c_client *client, | ||
443 | u8 reg, | ||
444 | u8 dpwm, | ||
445 | u8 *ptemp) | ||
446 | { | ||
447 | int dt; | ||
448 | u8 tmp; | ||
449 | |||
450 | dt = ptemp[2]-ptemp[1]; | ||
451 | for (tmp = 4; tmp > 0; tmp--) { | ||
452 | if (dt * (0x20 >> tmp) >= dpwm) | ||
453 | break; | ||
454 | } | ||
455 | tmp |= (ptemp[1] & 0x7C) << 1; | ||
456 | if (i2c_smbus_write_byte_data(client, | ||
457 | reg, tmp)) { | ||
458 | dev_err(&client->dev, "Register write error, aborting.\n"); | ||
459 | return -EIO; | ||
460 | } | ||
461 | return 0; | ||
462 | } | ||
463 | |||
464 | |||
465 | |||
466 | static ssize_t set_temp_auto_point_temp( | ||
467 | struct device *dev, | ||
468 | struct device_attribute *attr, | ||
469 | const char *buf, | ||
470 | size_t count) | ||
471 | { | ||
472 | struct i2c_client *client = to_i2c_client(dev); | ||
473 | struct amc6821_data *data = amc6821_update_device(dev); | ||
474 | int ix = to_sensor_dev_attr_2(attr)->index; | ||
475 | int nr = to_sensor_dev_attr_2(attr)->nr; | ||
476 | u8 *ptemp; | ||
477 | u8 reg; | ||
478 | int dpwm; | ||
479 | long val; | ||
480 | int ret = strict_strtol(buf, 10, &val); | ||
481 | if (ret) | ||
482 | return ret; | ||
483 | |||
484 | switch (nr) { | ||
485 | case 1: | ||
486 | ptemp = data->temp1_auto_point_temp; | ||
487 | reg = AMC6821_REG_LTEMP_FAN_CTRL; | ||
488 | break; | ||
489 | case 2: | ||
490 | ptemp = data->temp2_auto_point_temp; | ||
491 | reg = AMC6821_REG_RTEMP_FAN_CTRL; | ||
492 | break; | ||
493 | default: | ||
494 | dev_dbg(dev, "Unknown attr->nr (%d).\n", nr); | ||
495 | return -EINVAL; | ||
496 | } | ||
497 | |||
498 | data->valid = 0; | ||
499 | mutex_lock(&data->update_lock); | ||
500 | switch (ix) { | ||
501 | case 0: | ||
502 | ptemp[0] = SENSORS_LIMIT(val / 1000, 0, | ||
503 | data->temp1_auto_point_temp[1]); | ||
504 | ptemp[0] = SENSORS_LIMIT(ptemp[0], 0, | ||
505 | data->temp2_auto_point_temp[1]); | ||
506 | ptemp[0] = SENSORS_LIMIT(ptemp[0], 0, 63); | ||
507 | if (i2c_smbus_write_byte_data( | ||
508 | client, | ||
509 | AMC6821_REG_PSV_TEMP, | ||
510 | ptemp[0])) { | ||
511 | dev_err(&client->dev, | ||
512 | "Register write error, aborting.\n"); | ||
513 | count = -EIO; | ||
514 | } | ||
515 | goto EXIT; | ||
516 | break; | ||
517 | case 1: | ||
518 | ptemp[1] = SENSORS_LIMIT( | ||
519 | val / 1000, | ||
520 | (ptemp[0] & 0x7C) + 4, | ||
521 | 124); | ||
522 | ptemp[1] &= 0x7C; | ||
523 | ptemp[2] = SENSORS_LIMIT( | ||
524 | ptemp[2], ptemp[1] + 1, | ||
525 | 255); | ||
526 | break; | ||
527 | case 2: | ||
528 | ptemp[2] = SENSORS_LIMIT( | ||
529 | val / 1000, | ||
530 | ptemp[1]+1, | ||
531 | 255); | ||
532 | break; | ||
533 | default: | ||
534 | dev_dbg(dev, "Unknown attr->index (%d).\n", ix); | ||
535 | count = -EINVAL; | ||
536 | goto EXIT; | ||
537 | } | ||
538 | dpwm = data->pwm1_auto_point_pwm[2] - data->pwm1_auto_point_pwm[1]; | ||
539 | if (set_slope_register(client, reg, dpwm, ptemp)) | ||
540 | count = -EIO; | ||
541 | |||
542 | EXIT: | ||
543 | mutex_unlock(&data->update_lock); | ||
544 | return count; | ||
545 | } | ||
546 | |||
547 | |||
548 | |||
549 | static ssize_t set_pwm1_auto_point_pwm( | ||
550 | struct device *dev, | ||
551 | struct device_attribute *attr, | ||
552 | const char *buf, | ||
553 | size_t count) | ||
554 | { | ||
555 | struct i2c_client *client = to_i2c_client(dev); | ||
556 | struct amc6821_data *data = i2c_get_clientdata(client); | ||
557 | int dpwm; | ||
558 | long val; | ||
559 | int ret = strict_strtol(buf, 10, &val); | ||
560 | if (ret) | ||
561 | return ret; | ||
562 | |||
563 | mutex_lock(&data->update_lock); | ||
564 | data->pwm1_auto_point_pwm[1] = SENSORS_LIMIT(val, 0, 254); | ||
565 | if (i2c_smbus_write_byte_data(client, AMC6821_REG_DCY_LOW_TEMP, | ||
566 | data->pwm1_auto_point_pwm[1])) { | ||
567 | dev_err(&client->dev, "Register write error, aborting.\n"); | ||
568 | count = -EIO; | ||
569 | goto EXIT; | ||
570 | } | ||
571 | dpwm = data->pwm1_auto_point_pwm[2] - data->pwm1_auto_point_pwm[1]; | ||
572 | if (set_slope_register(client, AMC6821_REG_LTEMP_FAN_CTRL, dpwm, | ||
573 | data->temp1_auto_point_temp)) { | ||
574 | count = -EIO; | ||
575 | goto EXIT; | ||
576 | } | ||
577 | if (set_slope_register(client, AMC6821_REG_RTEMP_FAN_CTRL, dpwm, | ||
578 | data->temp2_auto_point_temp)) { | ||
579 | count = -EIO; | ||
580 | goto EXIT; | ||
581 | } | ||
582 | |||
583 | EXIT: | ||
584 | data->valid = 0; | ||
585 | mutex_unlock(&data->update_lock); | ||
586 | return count; | ||
587 | } | ||
588 | |||
589 | static ssize_t get_fan( | ||
590 | struct device *dev, | ||
591 | struct device_attribute *devattr, | ||
592 | char *buf) | ||
593 | { | ||
594 | struct amc6821_data *data = amc6821_update_device(dev); | ||
595 | int ix = to_sensor_dev_attr(devattr)->index; | ||
596 | if (0 == data->fan[ix]) | ||
597 | return sprintf(buf, "0"); | ||
598 | return sprintf(buf, "%d\n", (int)(6000000 / data->fan[ix])); | ||
599 | } | ||
600 | |||
601 | |||
602 | |||
603 | static ssize_t get_fan1_fault( | ||
604 | struct device *dev, | ||
605 | struct device_attribute *devattr, | ||
606 | char *buf) | ||
607 | { | ||
608 | struct amc6821_data *data = amc6821_update_device(dev); | ||
609 | if (data->stat1 & AMC6821_STAT1_FANS) | ||
610 | return sprintf(buf, "1"); | ||
611 | else | ||
612 | return sprintf(buf, "0"); | ||
613 | } | ||
614 | |||
615 | |||
616 | |||
617 | static ssize_t set_fan( | ||
618 | struct device *dev, | ||
619 | struct device_attribute *attr, | ||
620 | const char *buf, size_t count) | ||
621 | { | ||
622 | struct i2c_client *client = to_i2c_client(dev); | ||
623 | struct amc6821_data *data = i2c_get_clientdata(client); | ||
624 | long val; | ||
625 | int ix = to_sensor_dev_attr(attr)->index; | ||
626 | int ret = strict_strtol(buf, 10, &val); | ||
627 | if (ret) | ||
628 | return ret; | ||
629 | val = 1 > val ? 0xFFFF : 6000000/val; | ||
630 | |||
631 | mutex_lock(&data->update_lock); | ||
632 | data->fan[ix] = (u16) SENSORS_LIMIT(val, 1, 0xFFFF); | ||
633 | if (i2c_smbus_write_byte_data(client, fan_reg_low[ix], | ||
634 | data->fan[ix] & 0xFF)) { | ||
635 | dev_err(&client->dev, "Register write error, aborting.\n"); | ||
636 | count = -EIO; | ||
637 | goto EXIT; | ||
638 | } | ||
639 | if (i2c_smbus_write_byte_data(client, | ||
640 | fan_reg_hi[ix], data->fan[ix] >> 8)) { | ||
641 | dev_err(&client->dev, "Register write error, aborting.\n"); | ||
642 | count = -EIO; | ||
643 | } | ||
644 | EXIT: | ||
645 | mutex_unlock(&data->update_lock); | ||
646 | return count; | ||
647 | } | ||
648 | |||
649 | |||
650 | |||
651 | static ssize_t get_fan1_div( | ||
652 | struct device *dev, | ||
653 | struct device_attribute *devattr, | ||
654 | char *buf) | ||
655 | { | ||
656 | struct amc6821_data *data = amc6821_update_device(dev); | ||
657 | return sprintf(buf, "%d\n", data->fan1_div); | ||
658 | } | ||
659 | |||
660 | static ssize_t set_fan1_div( | ||
661 | struct device *dev, | ||
662 | struct device_attribute *attr, | ||
663 | const char *buf, size_t count) | ||
664 | { | ||
665 | struct i2c_client *client = to_i2c_client(dev); | ||
666 | struct amc6821_data *data = i2c_get_clientdata(client); | ||
667 | long val; | ||
668 | int config = strict_strtol(buf, 10, &val); | ||
669 | if (config) | ||
670 | return config; | ||
671 | |||
672 | config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF4); | ||
673 | if (config < 0) { | ||
674 | dev_err(&client->dev, | ||
675 | "Error reading configuration register, aborting.\n"); | ||
676 | return -EIO; | ||
677 | } | ||
678 | mutex_lock(&data->update_lock); | ||
679 | switch (val) { | ||
680 | case 2: | ||
681 | config &= ~AMC6821_CONF4_PSPR; | ||
682 | data->fan1_div = 2; | ||
683 | break; | ||
684 | case 4: | ||
685 | config |= AMC6821_CONF4_PSPR; | ||
686 | data->fan1_div = 4; | ||
687 | break; | ||
688 | default: | ||
689 | mutex_unlock(&data->update_lock); | ||
690 | count = -EINVAL; | ||
691 | goto EXIT; | ||
692 | } | ||
693 | if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF4, config)) { | ||
694 | dev_err(&client->dev, | ||
695 | "Configuration register write error, aborting.\n"); | ||
696 | count = -EIO; | ||
697 | } | ||
698 | EXIT: | ||
699 | mutex_unlock(&data->update_lock); | ||
700 | return count; | ||
701 | } | ||
702 | |||
703 | |||
704 | |||
705 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, | ||
706 | get_temp, NULL, IDX_TEMP1_INPUT); | ||
707 | static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO | S_IWUSR, get_temp, | ||
708 | set_temp, IDX_TEMP1_MIN); | ||
709 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, get_temp, | ||
710 | set_temp, IDX_TEMP1_MAX); | ||
711 | static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO | S_IWUSR, get_temp, | ||
712 | set_temp, IDX_TEMP1_CRIT); | ||
713 | static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, | ||
714 | get_temp_alarm, NULL, IDX_TEMP1_MIN); | ||
715 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, | ||
716 | get_temp_alarm, NULL, IDX_TEMP1_MAX); | ||
717 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, | ||
718 | get_temp_alarm, NULL, IDX_TEMP1_CRIT); | ||
719 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO | S_IWUSR, | ||
720 | get_temp, NULL, IDX_TEMP2_INPUT); | ||
721 | static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp, | ||
722 | set_temp, IDX_TEMP2_MIN); | ||
723 | static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO | S_IWUSR, get_temp, | ||
724 | set_temp, IDX_TEMP2_MAX); | ||
725 | static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO | S_IWUSR, get_temp, | ||
726 | set_temp, IDX_TEMP2_CRIT); | ||
727 | static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, | ||
728 | get_temp2_fault, NULL, 0); | ||
729 | static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, | ||
730 | get_temp_alarm, NULL, IDX_TEMP2_MIN); | ||
731 | static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, | ||
732 | get_temp_alarm, NULL, IDX_TEMP2_MAX); | ||
733 | static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, | ||
734 | get_temp_alarm, NULL, IDX_TEMP2_CRIT); | ||
735 | static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, get_fan, NULL, IDX_FAN1_INPUT); | ||
736 | static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO | S_IWUSR, | ||
737 | get_fan, set_fan, IDX_FAN1_MIN); | ||
738 | static SENSOR_DEVICE_ATTR(fan1_max, S_IRUGO | S_IWUSR, | ||
739 | get_fan, set_fan, IDX_FAN1_MAX); | ||
740 | static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, get_fan1_fault, NULL, 0); | ||
741 | static SENSOR_DEVICE_ATTR(fan1_div, S_IRUGO | S_IWUSR, | ||
742 | get_fan1_div, set_fan1_div, 0); | ||
743 | |||
744 | static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, get_pwm1, set_pwm1, 0); | ||
745 | static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, | ||
746 | get_pwm1_enable, set_pwm1_enable, 0); | ||
747 | static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IRUGO, | ||
748 | get_pwm1_auto_point_pwm, NULL, 0); | ||
749 | static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IWUSR | S_IRUGO, | ||
750 | get_pwm1_auto_point_pwm, set_pwm1_auto_point_pwm, 1); | ||
751 | static SENSOR_DEVICE_ATTR(pwm1_auto_point3_pwm, S_IRUGO, | ||
752 | get_pwm1_auto_point_pwm, NULL, 2); | ||
753 | static SENSOR_DEVICE_ATTR(pwm1_auto_channels_temp, S_IRUGO, | ||
754 | get_pwm1_auto_channels_temp, NULL, 0); | ||
755 | static SENSOR_DEVICE_ATTR_2(temp1_auto_point1_temp, S_IRUGO, | ||
756 | get_temp_auto_point_temp, NULL, 1, 0); | ||
757 | static SENSOR_DEVICE_ATTR_2(temp1_auto_point2_temp, S_IWUSR | S_IRUGO, | ||
758 | get_temp_auto_point_temp, set_temp_auto_point_temp, 1, 1); | ||
759 | static SENSOR_DEVICE_ATTR_2(temp1_auto_point3_temp, S_IWUSR | S_IRUGO, | ||
760 | get_temp_auto_point_temp, set_temp_auto_point_temp, 1, 2); | ||
761 | |||
762 | static SENSOR_DEVICE_ATTR_2(temp2_auto_point1_temp, S_IWUSR | S_IRUGO, | ||
763 | get_temp_auto_point_temp, set_temp_auto_point_temp, 2, 0); | ||
764 | static SENSOR_DEVICE_ATTR_2(temp2_auto_point2_temp, S_IWUSR | S_IRUGO, | ||
765 | get_temp_auto_point_temp, set_temp_auto_point_temp, 2, 1); | ||
766 | static SENSOR_DEVICE_ATTR_2(temp2_auto_point3_temp, S_IWUSR | S_IRUGO, | ||
767 | get_temp_auto_point_temp, set_temp_auto_point_temp, 2, 2); | ||
768 | |||
769 | |||
770 | |||
771 | static struct attribute *amc6821_attrs[] = { | ||
772 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
773 | &sensor_dev_attr_temp1_min.dev_attr.attr, | ||
774 | &sensor_dev_attr_temp1_max.dev_attr.attr, | ||
775 | &sensor_dev_attr_temp1_crit.dev_attr.attr, | ||
776 | &sensor_dev_attr_temp1_min_alarm.dev_attr.attr, | ||
777 | &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, | ||
778 | &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, | ||
779 | &sensor_dev_attr_temp2_input.dev_attr.attr, | ||
780 | &sensor_dev_attr_temp2_min.dev_attr.attr, | ||
781 | &sensor_dev_attr_temp2_max.dev_attr.attr, | ||
782 | &sensor_dev_attr_temp2_crit.dev_attr.attr, | ||
783 | &sensor_dev_attr_temp2_min_alarm.dev_attr.attr, | ||
784 | &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, | ||
785 | &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr, | ||
786 | &sensor_dev_attr_temp2_fault.dev_attr.attr, | ||
787 | &sensor_dev_attr_fan1_input.dev_attr.attr, | ||
788 | &sensor_dev_attr_fan1_min.dev_attr.attr, | ||
789 | &sensor_dev_attr_fan1_max.dev_attr.attr, | ||
790 | &sensor_dev_attr_fan1_fault.dev_attr.attr, | ||
791 | &sensor_dev_attr_fan1_div.dev_attr.attr, | ||
792 | &sensor_dev_attr_pwm1.dev_attr.attr, | ||
793 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | ||
794 | &sensor_dev_attr_pwm1_auto_channels_temp.dev_attr.attr, | ||
795 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, | ||
796 | &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, | ||
797 | &sensor_dev_attr_pwm1_auto_point3_pwm.dev_attr.attr, | ||
798 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, | ||
799 | &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr, | ||
800 | &sensor_dev_attr_temp1_auto_point3_temp.dev_attr.attr, | ||
801 | &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr, | ||
802 | &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr, | ||
803 | &sensor_dev_attr_temp2_auto_point3_temp.dev_attr.attr, | ||
804 | NULL | ||
805 | }; | ||
806 | |||
807 | static struct attribute_group amc6821_attr_grp = { | ||
808 | .attrs = amc6821_attrs, | ||
809 | }; | ||
810 | |||
811 | |||
812 | |||
813 | /* Return 0 if detection is successful, -ENODEV otherwise */ | ||
814 | static int amc6821_detect( | ||
815 | struct i2c_client *client, | ||
816 | struct i2c_board_info *info) | ||
817 | { | ||
818 | struct i2c_adapter *adapter = client->adapter; | ||
819 | int address = client->addr; | ||
820 | int dev_id, comp_id; | ||
821 | |||
822 | dev_dbg(&adapter->dev, "amc6821_detect called.\n"); | ||
823 | |||
824 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { | ||
825 | dev_dbg(&adapter->dev, | ||
826 | "amc6821: I2C bus doesn't support byte mode, " | ||
827 | "skipping.\n"); | ||
828 | return -ENODEV; | ||
829 | } | ||
830 | |||
831 | dev_id = i2c_smbus_read_byte_data(client, AMC6821_REG_DEV_ID); | ||
832 | comp_id = i2c_smbus_read_byte_data(client, AMC6821_REG_COMP_ID); | ||
833 | if (dev_id != 0x21 || comp_id != 0x49) { | ||
834 | dev_dbg(&adapter->dev, | ||
835 | "amc6821: detection failed at 0x%02x.\n", | ||
836 | address); | ||
837 | return -ENODEV; | ||
838 | } | ||
839 | |||
840 | /* Bit 7 of the address register is ignored, so we can check the | ||
841 | ID registers again */ | ||
842 | dev_id = i2c_smbus_read_byte_data(client, 0x80 | AMC6821_REG_DEV_ID); | ||
843 | comp_id = i2c_smbus_read_byte_data(client, 0x80 | AMC6821_REG_COMP_ID); | ||
844 | if (dev_id != 0x21 || comp_id != 0x49) { | ||
845 | dev_dbg(&adapter->dev, | ||
846 | "amc6821: detection failed at 0x%02x.\n", | ||
847 | address); | ||
848 | return -ENODEV; | ||
849 | } | ||
850 | |||
851 | dev_info(&adapter->dev, "amc6821: chip found at 0x%02x.\n", address); | ||
852 | strlcpy(info->type, "amc6821", I2C_NAME_SIZE); | ||
853 | |||
854 | return 0; | ||
855 | } | ||
856 | |||
857 | static int amc6821_probe( | ||
858 | struct i2c_client *client, | ||
859 | const struct i2c_device_id *id) | ||
860 | { | ||
861 | struct amc6821_data *data; | ||
862 | int err; | ||
863 | |||
864 | data = kzalloc(sizeof(struct amc6821_data), GFP_KERNEL); | ||
865 | if (!data) { | ||
866 | dev_err(&client->dev, "out of memory.\n"); | ||
867 | return -ENOMEM; | ||
868 | } | ||
869 | |||
870 | |||
871 | i2c_set_clientdata(client, data); | ||
872 | mutex_init(&data->update_lock); | ||
873 | |||
874 | /* | ||
875 | * Initialize the amc6821 chip | ||
876 | */ | ||
877 | err = amc6821_init_client(client); | ||
878 | if (err) | ||
879 | goto err_free; | ||
880 | |||
881 | err = sysfs_create_group(&client->dev.kobj, &amc6821_attr_grp); | ||
882 | if (err) | ||
883 | goto err_free; | ||
884 | |||
885 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
886 | if (!IS_ERR(data->hwmon_dev)) | ||
887 | return 0; | ||
888 | |||
889 | err = PTR_ERR(data->hwmon_dev); | ||
890 | dev_err(&client->dev, "error registering hwmon device.\n"); | ||
891 | sysfs_remove_group(&client->dev.kobj, &amc6821_attr_grp); | ||
892 | err_free: | ||
893 | kfree(data); | ||
894 | return err; | ||
895 | } | ||
896 | |||
897 | static int amc6821_remove(struct i2c_client *client) | ||
898 | { | ||
899 | struct amc6821_data *data = i2c_get_clientdata(client); | ||
900 | |||
901 | hwmon_device_unregister(data->hwmon_dev); | ||
902 | sysfs_remove_group(&client->dev.kobj, &amc6821_attr_grp); | ||
903 | |||
904 | kfree(data); | ||
905 | |||
906 | return 0; | ||
907 | } | ||
908 | |||
909 | |||
910 | static int amc6821_init_client(struct i2c_client *client) | ||
911 | { | ||
912 | int config; | ||
913 | int err = -EIO; | ||
914 | |||
915 | if (init) { | ||
916 | config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF4); | ||
917 | |||
918 | if (config < 0) { | ||
919 | dev_err(&client->dev, | ||
920 | "Error reading configuration register, aborting.\n"); | ||
921 | return err; | ||
922 | } | ||
923 | |||
924 | config |= AMC6821_CONF4_MODE; | ||
925 | |||
926 | if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF4, | ||
927 | config)) { | ||
928 | dev_err(&client->dev, | ||
929 | "Configuration register write error, aborting.\n"); | ||
930 | return err; | ||
931 | } | ||
932 | |||
933 | config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF3); | ||
934 | |||
935 | if (config < 0) { | ||
936 | dev_err(&client->dev, | ||
937 | "Error reading configuration register, aborting.\n"); | ||
938 | return err; | ||
939 | } | ||
940 | |||
941 | dev_info(&client->dev, "Revision %d\n", config & 0x0f); | ||
942 | |||
943 | config &= ~AMC6821_CONF3_THERM_FAN_EN; | ||
944 | |||
945 | if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF3, | ||
946 | config)) { | ||
947 | dev_err(&client->dev, | ||
948 | "Configuration register write error, aborting.\n"); | ||
949 | return err; | ||
950 | } | ||
951 | |||
952 | config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF2); | ||
953 | |||
954 | if (config < 0) { | ||
955 | dev_err(&client->dev, | ||
956 | "Error reading configuration register, aborting.\n"); | ||
957 | return err; | ||
958 | } | ||
959 | |||
960 | config &= ~AMC6821_CONF2_RTFIE; | ||
961 | config &= ~AMC6821_CONF2_LTOIE; | ||
962 | config &= ~AMC6821_CONF2_RTOIE; | ||
963 | if (i2c_smbus_write_byte_data(client, | ||
964 | AMC6821_REG_CONF2, config)) { | ||
965 | dev_err(&client->dev, | ||
966 | "Configuration register write error, aborting.\n"); | ||
967 | return err; | ||
968 | } | ||
969 | |||
970 | config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1); | ||
971 | |||
972 | if (config < 0) { | ||
973 | dev_err(&client->dev, | ||
974 | "Error reading configuration register, aborting.\n"); | ||
975 | return err; | ||
976 | } | ||
977 | |||
978 | config &= ~AMC6821_CONF1_THERMOVIE; | ||
979 | config &= ~AMC6821_CONF1_FANIE; | ||
980 | config |= AMC6821_CONF1_START; | ||
981 | if (pwminv) | ||
982 | config |= AMC6821_CONF1_PWMINV; | ||
983 | else | ||
984 | config &= ~AMC6821_CONF1_PWMINV; | ||
985 | |||
986 | if (i2c_smbus_write_byte_data( | ||
987 | client, AMC6821_REG_CONF1, config)) { | ||
988 | dev_err(&client->dev, | ||
989 | "Configuration register write error, aborting.\n"); | ||
990 | return err; | ||
991 | } | ||
992 | } | ||
993 | return 0; | ||
994 | } | ||
995 | |||
996 | |||
997 | static struct amc6821_data *amc6821_update_device(struct device *dev) | ||
998 | { | ||
999 | struct i2c_client *client = to_i2c_client(dev); | ||
1000 | struct amc6821_data *data = i2c_get_clientdata(client); | ||
1001 | int timeout = HZ; | ||
1002 | u8 reg; | ||
1003 | int i; | ||
1004 | |||
1005 | mutex_lock(&data->update_lock); | ||
1006 | |||
1007 | if (time_after(jiffies, data->last_updated + timeout) || | ||
1008 | !data->valid) { | ||
1009 | |||
1010 | for (i = 0; i < TEMP_IDX_LEN; i++) | ||
1011 | data->temp[i] = i2c_smbus_read_byte_data(client, | ||
1012 | temp_reg[i]); | ||
1013 | |||
1014 | data->stat1 = i2c_smbus_read_byte_data(client, | ||
1015 | AMC6821_REG_STAT1); | ||
1016 | data->stat2 = i2c_smbus_read_byte_data(client, | ||
1017 | AMC6821_REG_STAT2); | ||
1018 | |||
1019 | data->pwm1 = i2c_smbus_read_byte_data(client, | ||
1020 | AMC6821_REG_DCY); | ||
1021 | for (i = 0; i < FAN1_IDX_LEN; i++) { | ||
1022 | data->fan[i] = i2c_smbus_read_byte_data( | ||
1023 | client, | ||
1024 | fan_reg_low[i]); | ||
1025 | data->fan[i] += i2c_smbus_read_byte_data( | ||
1026 | client, | ||
1027 | fan_reg_hi[i]) << 8; | ||
1028 | } | ||
1029 | data->fan1_div = i2c_smbus_read_byte_data(client, | ||
1030 | AMC6821_REG_CONF4); | ||
1031 | data->fan1_div = data->fan1_div & AMC6821_CONF4_PSPR ? 4 : 2; | ||
1032 | |||
1033 | data->pwm1_auto_point_pwm[0] = 0; | ||
1034 | data->pwm1_auto_point_pwm[2] = 255; | ||
1035 | data->pwm1_auto_point_pwm[1] = i2c_smbus_read_byte_data(client, | ||
1036 | AMC6821_REG_DCY_LOW_TEMP); | ||
1037 | |||
1038 | data->temp1_auto_point_temp[0] = | ||
1039 | i2c_smbus_read_byte_data(client, | ||
1040 | AMC6821_REG_PSV_TEMP); | ||
1041 | data->temp2_auto_point_temp[0] = | ||
1042 | data->temp1_auto_point_temp[0]; | ||
1043 | reg = i2c_smbus_read_byte_data(client, | ||
1044 | AMC6821_REG_LTEMP_FAN_CTRL); | ||
1045 | data->temp1_auto_point_temp[1] = (reg & 0xF8) >> 1; | ||
1046 | reg &= 0x07; | ||
1047 | reg = 0x20 >> reg; | ||
1048 | if (reg > 0) | ||
1049 | data->temp1_auto_point_temp[2] = | ||
1050 | data->temp1_auto_point_temp[1] + | ||
1051 | (data->pwm1_auto_point_pwm[2] - | ||
1052 | data->pwm1_auto_point_pwm[1]) / reg; | ||
1053 | else | ||
1054 | data->temp1_auto_point_temp[2] = 255; | ||
1055 | |||
1056 | reg = i2c_smbus_read_byte_data(client, | ||
1057 | AMC6821_REG_RTEMP_FAN_CTRL); | ||
1058 | data->temp2_auto_point_temp[1] = (reg & 0xF8) >> 1; | ||
1059 | reg &= 0x07; | ||
1060 | reg = 0x20 >> reg; | ||
1061 | if (reg > 0) | ||
1062 | data->temp2_auto_point_temp[2] = | ||
1063 | data->temp2_auto_point_temp[1] + | ||
1064 | (data->pwm1_auto_point_pwm[2] - | ||
1065 | data->pwm1_auto_point_pwm[1]) / reg; | ||
1066 | else | ||
1067 | data->temp2_auto_point_temp[2] = 255; | ||
1068 | |||
1069 | reg = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1); | ||
1070 | reg = (reg >> 5) & 0x3; | ||
1071 | switch (reg) { | ||
1072 | case 0: /*open loop: software sets pwm1*/ | ||
1073 | data->pwm1_auto_channels_temp = 0; | ||
1074 | data->pwm1_enable = 1; | ||
1075 | break; | ||
1076 | case 2: /*closed loop: remote T (temp2)*/ | ||
1077 | data->pwm1_auto_channels_temp = 2; | ||
1078 | data->pwm1_enable = 2; | ||
1079 | break; | ||
1080 | case 3: /*closed loop: local and remote T (temp2)*/ | ||
1081 | data->pwm1_auto_channels_temp = 3; | ||
1082 | data->pwm1_enable = 3; | ||
1083 | break; | ||
1084 | case 1: /*semi-open loop: software sets rpm, chip controls pwm1, | ||
1085 | *currently not implemented | ||
1086 | */ | ||
1087 | data->pwm1_auto_channels_temp = 0; | ||
1088 | data->pwm1_enable = 0; | ||
1089 | break; | ||
1090 | } | ||
1091 | |||
1092 | data->last_updated = jiffies; | ||
1093 | data->valid = 1; | ||
1094 | } | ||
1095 | mutex_unlock(&data->update_lock); | ||
1096 | return data; | ||
1097 | } | ||
1098 | |||
1099 | |||
1100 | static int __init amc6821_init(void) | ||
1101 | { | ||
1102 | return i2c_add_driver(&amc6821_driver); | ||
1103 | } | ||
1104 | |||
1105 | static void __exit amc6821_exit(void) | ||
1106 | { | ||
1107 | i2c_del_driver(&amc6821_driver); | ||
1108 | } | ||
1109 | |||
1110 | module_init(amc6821_init); | ||
1111 | module_exit(amc6821_exit); | ||
1112 | |||
1113 | |||
1114 | MODULE_LICENSE("GPL"); | ||
1115 | MODULE_AUTHOR("T. Mertelj <tomaz.mertelj@guest.arnes.si>"); | ||
1116 | MODULE_DESCRIPTION("Texas Instruments amc6821 hwmon driver"); | ||
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index 5a3ee00c0e7d..6811346c1c62 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * See COPYING in the top level directory of the kernel tree. | 5 | * See COPYING in the top level directory of the kernel tree. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/debugfs.h> | ||
8 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
9 | #include <linux/hwmon.h> | 10 | #include <linux/hwmon.h> |
10 | #include <linux/list.h> | 11 | #include <linux/list.h> |
@@ -101,6 +102,11 @@ struct atk_data { | |||
101 | int temperature_count; | 102 | int temperature_count; |
102 | int fan_count; | 103 | int fan_count; |
103 | struct list_head sensor_list; | 104 | struct list_head sensor_list; |
105 | |||
106 | struct { | ||
107 | struct dentry *root; | ||
108 | u32 id; | ||
109 | } debugfs; | ||
104 | }; | 110 | }; |
105 | 111 | ||
106 | 112 | ||
@@ -624,6 +630,187 @@ static int atk_read_value(struct atk_sensor_data *sensor, u64 *value) | |||
624 | return err; | 630 | return err; |
625 | } | 631 | } |
626 | 632 | ||
633 | #ifdef CONFIG_DEBUG_FS | ||
634 | static int atk_debugfs_gitm_get(void *p, u64 *val) | ||
635 | { | ||
636 | struct atk_data *data = p; | ||
637 | union acpi_object *ret; | ||
638 | struct atk_acpi_ret_buffer *buf; | ||
639 | int err = 0; | ||
640 | |||
641 | if (!data->read_handle) | ||
642 | return -ENODEV; | ||
643 | |||
644 | if (!data->debugfs.id) | ||
645 | return -EINVAL; | ||
646 | |||
647 | ret = atk_gitm(data, data->debugfs.id); | ||
648 | if (IS_ERR(ret)) | ||
649 | return PTR_ERR(ret); | ||
650 | |||
651 | buf = (struct atk_acpi_ret_buffer *)ret->buffer.pointer; | ||
652 | if (buf->flags) | ||
653 | *val = buf->value; | ||
654 | else | ||
655 | err = -EIO; | ||
656 | |||
657 | return err; | ||
658 | } | ||
659 | |||
660 | DEFINE_SIMPLE_ATTRIBUTE(atk_debugfs_gitm, | ||
661 | atk_debugfs_gitm_get, | ||
662 | NULL, | ||
663 | "0x%08llx\n") | ||
664 | |||
665 | static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj) | ||
666 | { | ||
667 | int ret = 0; | ||
668 | |||
669 | switch (obj->type) { | ||
670 | case ACPI_TYPE_INTEGER: | ||
671 | ret = snprintf(buf, sz, "0x%08llx\n", obj->integer.value); | ||
672 | break; | ||
673 | case ACPI_TYPE_STRING: | ||
674 | ret = snprintf(buf, sz, "%s\n", obj->string.pointer); | ||
675 | break; | ||
676 | } | ||
677 | |||
678 | return ret; | ||
679 | } | ||
680 | |||
681 | static void atk_pack_print(char *buf, size_t sz, union acpi_object *pack) | ||
682 | { | ||
683 | int ret; | ||
684 | int i; | ||
685 | |||
686 | for (i = 0; i < pack->package.count; i++) { | ||
687 | union acpi_object *obj = &pack->package.elements[i]; | ||
688 | |||
689 | ret = atk_acpi_print(buf, sz, obj); | ||
690 | if (ret >= sz) | ||
691 | break; | ||
692 | buf += ret; | ||
693 | sz -= ret; | ||
694 | } | ||
695 | } | ||
696 | |||
697 | static int atk_debugfs_ggrp_open(struct inode *inode, struct file *file) | ||
698 | { | ||
699 | struct atk_data *data = inode->i_private; | ||
700 | char *buf = NULL; | ||
701 | union acpi_object *ret; | ||
702 | u8 cls; | ||
703 | int i; | ||
704 | |||
705 | if (!data->enumerate_handle) | ||
706 | return -ENODEV; | ||
707 | if (!data->debugfs.id) | ||
708 | return -EINVAL; | ||
709 | |||
710 | cls = (data->debugfs.id & 0xff000000) >> 24; | ||
711 | ret = atk_ggrp(data, cls); | ||
712 | if (IS_ERR(ret)) | ||
713 | return PTR_ERR(ret); | ||
714 | |||
715 | for (i = 0; i < ret->package.count; i++) { | ||
716 | union acpi_object *pack = &ret->package.elements[i]; | ||
717 | union acpi_object *id; | ||
718 | |||
719 | if (pack->type != ACPI_TYPE_PACKAGE) | ||
720 | continue; | ||
721 | if (!pack->package.count) | ||
722 | continue; | ||
723 | id = &pack->package.elements[0]; | ||
724 | if (id->integer.value == data->debugfs.id) { | ||
725 | /* Print the package */ | ||
726 | buf = kzalloc(512, GFP_KERNEL); | ||
727 | if (!buf) { | ||
728 | ACPI_FREE(ret); | ||
729 | return -ENOMEM; | ||
730 | } | ||
731 | atk_pack_print(buf, 512, pack); | ||
732 | break; | ||
733 | } | ||
734 | } | ||
735 | ACPI_FREE(ret); | ||
736 | |||
737 | if (!buf) | ||
738 | return -EINVAL; | ||
739 | |||
740 | file->private_data = buf; | ||
741 | |||
742 | return nonseekable_open(inode, file); | ||
743 | } | ||
744 | |||
745 | static ssize_t atk_debugfs_ggrp_read(struct file *file, char __user *buf, | ||
746 | size_t count, loff_t *pos) | ||
747 | { | ||
748 | char *str = file->private_data; | ||
749 | size_t len = strlen(str); | ||
750 | |||
751 | return simple_read_from_buffer(buf, count, pos, str, len); | ||
752 | } | ||
753 | |||
754 | static int atk_debugfs_ggrp_release(struct inode *inode, struct file *file) | ||
755 | { | ||
756 | kfree(file->private_data); | ||
757 | return 0; | ||
758 | } | ||
759 | |||
760 | static const struct file_operations atk_debugfs_ggrp_fops = { | ||
761 | .read = atk_debugfs_ggrp_read, | ||
762 | .open = atk_debugfs_ggrp_open, | ||
763 | .release = atk_debugfs_ggrp_release, | ||
764 | }; | ||
765 | |||
766 | static void atk_debugfs_init(struct atk_data *data) | ||
767 | { | ||
768 | struct dentry *d; | ||
769 | struct dentry *f; | ||
770 | |||
771 | data->debugfs.id = 0; | ||
772 | |||
773 | d = debugfs_create_dir("asus_atk0110", NULL); | ||
774 | if (!d || IS_ERR(d)) | ||
775 | return; | ||
776 | |||
777 | f = debugfs_create_x32("id", S_IRUSR | S_IWUSR, d, &data->debugfs.id); | ||
778 | if (!f || IS_ERR(f)) | ||
779 | goto cleanup; | ||
780 | |||
781 | f = debugfs_create_file("gitm", S_IRUSR, d, data, | ||
782 | &atk_debugfs_gitm); | ||
783 | if (!f || IS_ERR(f)) | ||
784 | goto cleanup; | ||
785 | |||
786 | f = debugfs_create_file("ggrp", S_IRUSR, d, data, | ||
787 | &atk_debugfs_ggrp_fops); | ||
788 | if (!f || IS_ERR(f)) | ||
789 | goto cleanup; | ||
790 | |||
791 | data->debugfs.root = d; | ||
792 | |||
793 | return; | ||
794 | cleanup: | ||
795 | debugfs_remove_recursive(d); | ||
796 | } | ||
797 | |||
798 | static void atk_debugfs_cleanup(struct atk_data *data) | ||
799 | { | ||
800 | debugfs_remove_recursive(data->debugfs.root); | ||
801 | } | ||
802 | |||
803 | #else /* CONFIG_DEBUG_FS */ | ||
804 | |||
805 | static void atk_debugfs_init(struct atk_data *data) | ||
806 | { | ||
807 | } | ||
808 | |||
809 | static void atk_debugfs_cleanup(struct atk_data *data) | ||
810 | { | ||
811 | } | ||
812 | #endif | ||
813 | |||
627 | static int atk_add_sensor(struct atk_data *data, union acpi_object *obj) | 814 | static int atk_add_sensor(struct atk_data *data, union acpi_object *obj) |
628 | { | 815 | { |
629 | struct device *dev = &data->acpi_dev->dev; | 816 | struct device *dev = &data->acpi_dev->dev; |
@@ -1047,76 +1234,75 @@ remove: | |||
1047 | return err; | 1234 | return err; |
1048 | } | 1235 | } |
1049 | 1236 | ||
1050 | static int atk_check_old_if(struct atk_data *data) | 1237 | static int atk_probe_if(struct atk_data *data) |
1051 | { | 1238 | { |
1052 | struct device *dev = &data->acpi_dev->dev; | 1239 | struct device *dev = &data->acpi_dev->dev; |
1053 | acpi_handle ret; | 1240 | acpi_handle ret; |
1054 | acpi_status status; | 1241 | acpi_status status; |
1242 | int err = 0; | ||
1055 | 1243 | ||
1056 | /* RTMP: read temperature */ | 1244 | /* RTMP: read temperature */ |
1057 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_TMP, &ret); | 1245 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_TMP, &ret); |
1058 | if (status != AE_OK) { | 1246 | if (ACPI_SUCCESS(status)) |
1247 | data->rtmp_handle = ret; | ||
1248 | else | ||
1059 | dev_dbg(dev, "method " METHOD_OLD_READ_TMP " not found: %s\n", | 1249 | dev_dbg(dev, "method " METHOD_OLD_READ_TMP " not found: %s\n", |
1060 | acpi_format_exception(status)); | 1250 | acpi_format_exception(status)); |
1061 | return -ENODEV; | ||
1062 | } | ||
1063 | data->rtmp_handle = ret; | ||
1064 | 1251 | ||
1065 | /* RVLT: read voltage */ | 1252 | /* RVLT: read voltage */ |
1066 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_VLT, &ret); | 1253 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_VLT, &ret); |
1067 | if (status != AE_OK) { | 1254 | if (ACPI_SUCCESS(status)) |
1255 | data->rvlt_handle = ret; | ||
1256 | else | ||
1068 | dev_dbg(dev, "method " METHOD_OLD_READ_VLT " not found: %s\n", | 1257 | dev_dbg(dev, "method " METHOD_OLD_READ_VLT " not found: %s\n", |
1069 | acpi_format_exception(status)); | 1258 | acpi_format_exception(status)); |
1070 | return -ENODEV; | ||
1071 | } | ||
1072 | data->rvlt_handle = ret; | ||
1073 | 1259 | ||
1074 | /* RFAN: read fan status */ | 1260 | /* RFAN: read fan status */ |
1075 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_FAN, &ret); | 1261 | status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_FAN, &ret); |
1076 | if (status != AE_OK) { | 1262 | if (ACPI_SUCCESS(status)) |
1263 | data->rfan_handle = ret; | ||
1264 | else | ||
1077 | dev_dbg(dev, "method " METHOD_OLD_READ_FAN " not found: %s\n", | 1265 | dev_dbg(dev, "method " METHOD_OLD_READ_FAN " not found: %s\n", |
1078 | acpi_format_exception(status)); | 1266 | acpi_format_exception(status)); |
1079 | return -ENODEV; | ||
1080 | } | ||
1081 | data->rfan_handle = ret; | ||
1082 | |||
1083 | return 0; | ||
1084 | } | ||
1085 | |||
1086 | static int atk_check_new_if(struct atk_data *data) | ||
1087 | { | ||
1088 | struct device *dev = &data->acpi_dev->dev; | ||
1089 | acpi_handle ret; | ||
1090 | acpi_status status; | ||
1091 | 1267 | ||
1092 | /* Enumeration */ | 1268 | /* Enumeration */ |
1093 | status = acpi_get_handle(data->atk_handle, METHOD_ENUMERATE, &ret); | 1269 | status = acpi_get_handle(data->atk_handle, METHOD_ENUMERATE, &ret); |
1094 | if (status != AE_OK) { | 1270 | if (ACPI_SUCCESS(status)) |
1271 | data->enumerate_handle = ret; | ||
1272 | else | ||
1095 | dev_dbg(dev, "method " METHOD_ENUMERATE " not found: %s\n", | 1273 | dev_dbg(dev, "method " METHOD_ENUMERATE " not found: %s\n", |
1096 | acpi_format_exception(status)); | 1274 | acpi_format_exception(status)); |
1097 | return -ENODEV; | ||
1098 | } | ||
1099 | data->enumerate_handle = ret; | ||
1100 | 1275 | ||
1101 | /* De-multiplexer (read) */ | 1276 | /* De-multiplexer (read) */ |
1102 | status = acpi_get_handle(data->atk_handle, METHOD_READ, &ret); | 1277 | status = acpi_get_handle(data->atk_handle, METHOD_READ, &ret); |
1103 | if (status != AE_OK) { | 1278 | if (ACPI_SUCCESS(status)) |
1279 | data->read_handle = ret; | ||
1280 | else | ||
1104 | dev_dbg(dev, "method " METHOD_READ " not found: %s\n", | 1281 | dev_dbg(dev, "method " METHOD_READ " not found: %s\n", |
1105 | acpi_format_exception(status)); | 1282 | acpi_format_exception(status)); |
1106 | return -ENODEV; | ||
1107 | } | ||
1108 | data->read_handle = ret; | ||
1109 | 1283 | ||
1110 | /* De-multiplexer (write) */ | 1284 | /* De-multiplexer (write) */ |
1111 | status = acpi_get_handle(data->atk_handle, METHOD_WRITE, &ret); | 1285 | status = acpi_get_handle(data->atk_handle, METHOD_WRITE, &ret); |
1112 | if (status != AE_OK) { | 1286 | if (ACPI_SUCCESS(status)) |
1113 | dev_dbg(dev, "method " METHOD_READ " not found: %s\n", | 1287 | data->write_handle = ret; |
1288 | else | ||
1289 | dev_dbg(dev, "method " METHOD_WRITE " not found: %s\n", | ||
1114 | acpi_format_exception(status)); | 1290 | acpi_format_exception(status)); |
1115 | return -ENODEV; | ||
1116 | } | ||
1117 | data->write_handle = ret; | ||
1118 | 1291 | ||
1119 | return 0; | 1292 | /* Check for hwmon methods: first check "old" style methods; note that |
1293 | * both may be present: in this case we stick to the old interface; | ||
1294 | * analysis of multiple DSDTs indicates that when both interfaces | ||
1295 | * are present the new one (GGRP/GITM) is not functional. | ||
1296 | */ | ||
1297 | if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle) | ||
1298 | data->old_interface = true; | ||
1299 | else if (data->enumerate_handle && data->read_handle && | ||
1300 | data->write_handle) | ||
1301 | data->old_interface = false; | ||
1302 | else | ||
1303 | err = -ENODEV; | ||
1304 | |||
1305 | return err; | ||
1120 | } | 1306 | } |
1121 | 1307 | ||
1122 | static int atk_add(struct acpi_device *device) | 1308 | static int atk_add(struct acpi_device *device) |
@@ -1155,28 +1341,19 @@ static int atk_add(struct acpi_device *device) | |||
1155 | } | 1341 | } |
1156 | ACPI_FREE(buf.pointer); | 1342 | ACPI_FREE(buf.pointer); |
1157 | 1343 | ||
1158 | /* Check for hwmon methods: first check "old" style methods; note that | 1344 | err = atk_probe_if(data); |
1159 | * both may be present: in this case we stick to the old interface; | 1345 | if (err) { |
1160 | * analysis of multiple DSDTs indicates that when both interfaces | 1346 | dev_err(&device->dev, "No usable hwmon interface detected\n"); |
1161 | * are present the new one (GGRP/GITM) is not functional. | 1347 | goto out; |
1162 | */ | ||
1163 | err = atk_check_old_if(data); | ||
1164 | if (!err) { | ||
1165 | dev_dbg(&device->dev, "Using old hwmon interface\n"); | ||
1166 | data->old_interface = true; | ||
1167 | } else { | ||
1168 | err = atk_check_new_if(data); | ||
1169 | if (err) | ||
1170 | goto out; | ||
1171 | |||
1172 | dev_dbg(&device->dev, "Using new hwmon interface\n"); | ||
1173 | data->old_interface = false; | ||
1174 | } | 1348 | } |
1175 | 1349 | ||
1176 | if (data->old_interface) | 1350 | if (data->old_interface) { |
1351 | dev_dbg(&device->dev, "Using old hwmon interface\n"); | ||
1177 | err = atk_enumerate_old_hwmon(data); | 1352 | err = atk_enumerate_old_hwmon(data); |
1178 | else | 1353 | } else { |
1354 | dev_dbg(&device->dev, "Using new hwmon interface\n"); | ||
1179 | err = atk_enumerate_new_hwmon(data); | 1355 | err = atk_enumerate_new_hwmon(data); |
1356 | } | ||
1180 | if (err < 0) | 1357 | if (err < 0) |
1181 | goto out; | 1358 | goto out; |
1182 | if (err == 0) { | 1359 | if (err == 0) { |
@@ -1190,6 +1367,8 @@ static int atk_add(struct acpi_device *device) | |||
1190 | if (err) | 1367 | if (err) |
1191 | goto cleanup; | 1368 | goto cleanup; |
1192 | 1369 | ||
1370 | atk_debugfs_init(data); | ||
1371 | |||
1193 | device->driver_data = data; | 1372 | device->driver_data = data; |
1194 | return 0; | 1373 | return 0; |
1195 | cleanup: | 1374 | cleanup: |
@@ -1208,6 +1387,8 @@ static int atk_remove(struct acpi_device *device, int type) | |||
1208 | 1387 | ||
1209 | device->driver_data = NULL; | 1388 | device->driver_data = NULL; |
1210 | 1389 | ||
1390 | atk_debugfs_cleanup(data); | ||
1391 | |||
1211 | atk_remove_files(data); | 1392 | atk_remove_files(data); |
1212 | atk_free_sensors(data); | 1393 | atk_free_sensors(data); |
1213 | hwmon_device_unregister(data->hwmon_dev); | 1394 | hwmon_device_unregister(data->hwmon_dev); |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index caef39cda8c8..2d7bceeed0bc 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | #include <linux/cpu.h> | 35 | #include <linux/cpu.h> |
36 | #include <linux/pci.h> | ||
36 | #include <asm/msr.h> | 37 | #include <asm/msr.h> |
37 | #include <asm/processor.h> | 38 | #include <asm/processor.h> |
38 | 39 | ||
@@ -161,6 +162,7 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device * | |||
161 | int usemsr_ee = 1; | 162 | int usemsr_ee = 1; |
162 | int err; | 163 | int err; |
163 | u32 eax, edx; | 164 | u32 eax, edx; |
165 | struct pci_dev *host_bridge; | ||
164 | 166 | ||
165 | /* Early chips have no MSR for TjMax */ | 167 | /* Early chips have no MSR for TjMax */ |
166 | 168 | ||
@@ -168,11 +170,21 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device * | |||
168 | usemsr_ee = 0; | 170 | usemsr_ee = 0; |
169 | } | 171 | } |
170 | 172 | ||
171 | /* Atoms seems to have TjMax at 90C */ | 173 | /* Atom CPUs */ |
172 | 174 | ||
173 | if (c->x86_model == 0x1c) { | 175 | if (c->x86_model == 0x1c) { |
174 | usemsr_ee = 0; | 176 | usemsr_ee = 0; |
175 | tjmax = 90000; | 177 | |
178 | host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); | ||
179 | |||
180 | if (host_bridge && host_bridge->vendor == PCI_VENDOR_ID_INTEL | ||
181 | && (host_bridge->device == 0xa000 /* NM10 based nettop */ | ||
182 | || host_bridge->device == 0xa010)) /* NM10 based netbook */ | ||
183 | tjmax = 100000; | ||
184 | else | ||
185 | tjmax = 90000; | ||
186 | |||
187 | pci_dev_put(host_bridge); | ||
176 | } | 188 | } |
177 | 189 | ||
178 | if ((c->x86_model > 0xe) && (usemsr_ee)) { | 190 | if ((c->x86_model > 0xe) && (usemsr_ee)) { |
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index d8a26d16d948..099a2138cdf6 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -33,6 +33,16 @@ static bool force; | |||
33 | module_param(force, bool, 0444); | 33 | module_param(force, bool, 0444); |
34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); | 34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); |
35 | 35 | ||
36 | /* CPUID function 0x80000001, ebx */ | ||
37 | #define CPUID_PKGTYPE_MASK 0xf0000000 | ||
38 | #define CPUID_PKGTYPE_F 0x00000000 | ||
39 | #define CPUID_PKGTYPE_AM2R2_AM3 0x10000000 | ||
40 | |||
41 | /* DRAM controller (PCI function 2) */ | ||
42 | #define REG_DCT0_CONFIG_HIGH 0x094 | ||
43 | #define DDR3_MODE 0x00000100 | ||
44 | |||
45 | /* miscellaneous (PCI function 3) */ | ||
36 | #define REG_HARDWARE_THERMAL_CONTROL 0x64 | 46 | #define REG_HARDWARE_THERMAL_CONTROL 0x64 |
37 | #define HTC_ENABLE 0x00000001 | 47 | #define HTC_ENABLE 0x00000001 |
38 | 48 | ||
@@ -85,13 +95,28 @@ static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); | |||
85 | static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit, NULL, 1); | 95 | static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit, NULL, 1); |
86 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 96 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
87 | 97 | ||
88 | static bool __devinit has_erratum_319(void) | 98 | static bool __devinit has_erratum_319(struct pci_dev *pdev) |
89 | { | 99 | { |
100 | u32 pkg_type, reg_dram_cfg; | ||
101 | |||
102 | if (boot_cpu_data.x86 != 0x10) | ||
103 | return false; | ||
104 | |||
90 | /* | 105 | /* |
91 | * Erratum 319: The thermal sensor of older Family 10h processors | 106 | * Erratum 319: The thermal sensor of Socket F/AM2+ processors |
92 | * (B steppings) may be unreliable. | 107 | * may be unreliable. |
93 | */ | 108 | */ |
94 | return boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model <= 2; | 109 | pkg_type = cpuid_ebx(0x80000001) & CPUID_PKGTYPE_MASK; |
110 | if (pkg_type == CPUID_PKGTYPE_F) | ||
111 | return true; | ||
112 | if (pkg_type != CPUID_PKGTYPE_AM2R2_AM3) | ||
113 | return false; | ||
114 | |||
115 | /* Differentiate between AM2+ (bad) and AM3 (good) */ | ||
116 | pci_bus_read_config_dword(pdev->bus, | ||
117 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 2), | ||
118 | REG_DCT0_CONFIG_HIGH, ®_dram_cfg); | ||
119 | return !(reg_dram_cfg & DDR3_MODE); | ||
95 | } | 120 | } |
96 | 121 | ||
97 | static int __devinit k10temp_probe(struct pci_dev *pdev, | 122 | static int __devinit k10temp_probe(struct pci_dev *pdev, |
@@ -99,9 +124,10 @@ static int __devinit k10temp_probe(struct pci_dev *pdev, | |||
99 | { | 124 | { |
100 | struct device *hwmon_dev; | 125 | struct device *hwmon_dev; |
101 | u32 reg_caps, reg_htc; | 126 | u32 reg_caps, reg_htc; |
127 | int unreliable = has_erratum_319(pdev); | ||
102 | int err; | 128 | int err; |
103 | 129 | ||
104 | if (has_erratum_319() && !force) { | 130 | if (unreliable && !force) { |
105 | dev_err(&pdev->dev, | 131 | dev_err(&pdev->dev, |
106 | "unreliable CPU thermal sensor; monitoring disabled\n"); | 132 | "unreliable CPU thermal sensor; monitoring disabled\n"); |
107 | err = -ENODEV; | 133 | err = -ENODEV; |
@@ -139,7 +165,7 @@ static int __devinit k10temp_probe(struct pci_dev *pdev, | |||
139 | } | 165 | } |
140 | dev_set_drvdata(&pdev->dev, hwmon_dev); | 166 | dev_set_drvdata(&pdev->dev, hwmon_dev); |
141 | 167 | ||
142 | if (has_erratum_319() && force) | 168 | if (unreliable && force) |
143 | dev_warn(&pdev->dev, | 169 | dev_warn(&pdev->dev, |
144 | "unreliable CPU thermal sensor; check erratum 319\n"); | 170 | "unreliable CPU thermal sensor; check erratum 319\n"); |
145 | return 0; | 171 | return 0; |
@@ -169,7 +195,7 @@ static void __devexit k10temp_remove(struct pci_dev *pdev) | |||
169 | dev_set_drvdata(&pdev->dev, NULL); | 195 | dev_set_drvdata(&pdev->dev, NULL); |
170 | } | 196 | } |
171 | 197 | ||
172 | static struct pci_device_id k10temp_id_table[] = { | 198 | static const struct pci_device_id k10temp_id_table[] = { |
173 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, | 199 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, |
174 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, | 200 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, |
175 | {} | 201 | {} |
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index 1fe995111841..0ceb6d6200a3 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c | |||
@@ -136,7 +136,7 @@ static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 1, 0); | |||
136 | static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1); | 136 | static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1); |
137 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 137 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
138 | 138 | ||
139 | static struct pci_device_id k8temp_ids[] = { | 139 | static const struct pci_device_id k8temp_ids[] = { |
140 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, | 140 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, |
141 | { 0 }, | 141 | { 0 }, |
142 | }; | 142 | }; |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 12f2e7086560..79c2931e3008 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -697,7 +697,7 @@ static struct sis5595_data *sis5595_update_device(struct device *dev) | |||
697 | return data; | 697 | return data; |
698 | } | 698 | } |
699 | 699 | ||
700 | static struct pci_device_id sis5595_pci_ids[] = { | 700 | static const struct pci_device_id sis5595_pci_ids[] = { |
701 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, | 701 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, |
702 | { 0, } | 702 | { 0, } |
703 | }; | 703 | }; |
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index 39e82a492f26..f397ce7ad598 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -767,7 +767,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) | |||
767 | return data; | 767 | return data; |
768 | } | 768 | } |
769 | 769 | ||
770 | static struct pci_device_id via686a_pci_ids[] = { | 770 | static const struct pci_device_id via686a_pci_ids[] = { |
771 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) }, | 771 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) }, |
772 | { 0, } | 772 | { 0, } |
773 | }; | 773 | }; |
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index 470a1226ba2b..d47b4c9949c2 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c | |||
@@ -697,7 +697,7 @@ static struct platform_driver vt8231_driver = { | |||
697 | .remove = __devexit_p(vt8231_remove), | 697 | .remove = __devexit_p(vt8231_remove), |
698 | }; | 698 | }; |
699 | 699 | ||
700 | static struct pci_device_id vt8231_pci_ids[] = { | 700 | static const struct pci_device_id vt8231_pci_ids[] = { |
701 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) }, | 701 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) }, |
702 | { 0, } | 702 | { 0, } |
703 | }; | 703 | }; |
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig index f102fcc7e52a..e02096cf7d95 100644 --- a/drivers/ieee1394/Kconfig +++ b/drivers/ieee1394/Kconfig | |||
@@ -1,8 +1,3 @@ | |||
1 | menu "IEEE 1394 (FireWire) support" | ||
2 | depends on PCI || BROKEN | ||
3 | |||
4 | source "drivers/firewire/Kconfig" | ||
5 | |||
6 | config IEEE1394 | 1 | config IEEE1394 |
7 | tristate "Legacy alternative FireWire driver stack" | 2 | tristate "Legacy alternative FireWire driver stack" |
8 | depends on PCI || BROKEN | 3 | depends on PCI || BROKEN |
@@ -16,8 +11,13 @@ config IEEE1394 | |||
16 | is the core support only, you will also need to select a driver for | 11 | is the core support only, you will also need to select a driver for |
17 | your IEEE 1394 adapter. | 12 | your IEEE 1394 adapter. |
18 | 13 | ||
19 | To compile this driver as a module, say M here: the | 14 | To compile this driver as a module, say M here: the module will be |
20 | module will be called ieee1394. | 15 | called ieee1394. |
16 | |||
17 | NOTE: | ||
18 | ieee1394 is superseded by the newer firewire-core driver. See | ||
19 | http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for | ||
20 | further information on how to switch to the new FireWire drivers. | ||
21 | 21 | ||
22 | config IEEE1394_OHCI1394 | 22 | config IEEE1394_OHCI1394 |
23 | tristate "OHCI-1394 controllers" | 23 | tristate "OHCI-1394 controllers" |
@@ -29,19 +29,23 @@ config IEEE1394_OHCI1394 | |||
29 | use one of these chipsets. It should work with any OHCI-1394 | 29 | use one of these chipsets. It should work with any OHCI-1394 |
30 | compliant card, however. | 30 | compliant card, however. |
31 | 31 | ||
32 | To compile this driver as a module, say M here: the | 32 | To compile this driver as a module, say M here: the module will be |
33 | module will be called ohci1394. | 33 | called ohci1394. |
34 | 34 | ||
35 | NOTE: | 35 | NOTE: |
36 | ohci1394 is superseded by the newer firewire-ohci driver. See | ||
37 | http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for | ||
38 | further information on how to switch to the new FireWire drivers. | ||
39 | |||
36 | If you want to install firewire-ohci and ohci1394 together, you | 40 | If you want to install firewire-ohci and ohci1394 together, you |
37 | should configure them only as modules and blacklist the driver(s) | 41 | should configure them only as modules and blacklist the driver(s) |
38 | which you don't want to have auto-loaded. Add either | 42 | which you don't want to have auto-loaded. Add either |
39 | 43 | ||
40 | blacklist firewire-ohci | ||
41 | or | ||
42 | blacklist ohci1394 | 44 | blacklist ohci1394 |
43 | blacklist video1394 | 45 | blacklist video1394 |
44 | blacklist dv1394 | 46 | blacklist dv1394 |
47 | or | ||
48 | blacklist firewire-ohci | ||
45 | 49 | ||
46 | to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf | 50 | to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf |
47 | depending on your distribution. | 51 | depending on your distribution. |
@@ -58,8 +62,8 @@ config IEEE1394_PCILYNX | |||
58 | Instruments PCILynx chip. Note: this driver is written for revision | 62 | Instruments PCILynx chip. Note: this driver is written for revision |
59 | 2 of this chip and may not work with revision 0. | 63 | 2 of this chip and may not work with revision 0. |
60 | 64 | ||
61 | To compile this driver as a module, say M here: the | 65 | To compile this driver as a module, say M here: the module will be |
62 | module will be called pcilynx. | 66 | called pcilynx. |
63 | 67 | ||
64 | Only some old and now very rare PCI and CardBus cards and | 68 | Only some old and now very rare PCI and CardBus cards and |
65 | PowerMacs G3 B&W contain the PCILynx controller. Therefore | 69 | PowerMacs G3 B&W contain the PCILynx controller. Therefore |
@@ -79,6 +83,14 @@ config IEEE1394_SBP2 | |||
79 | You should also enable support for disks, CD-ROMs, etc. in the SCSI | 83 | You should also enable support for disks, CD-ROMs, etc. in the SCSI |
80 | configuration section. | 84 | configuration section. |
81 | 85 | ||
86 | To compile this driver as a module, say M here: the module will be | ||
87 | called sbp2. | ||
88 | |||
89 | NOTE: | ||
90 | sbp2 is superseded by the newer firewire-sbp2 driver. See | ||
91 | http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for | ||
92 | further information on how to switch to the new FireWire drivers. | ||
93 | |||
82 | config IEEE1394_SBP2_PHYS_DMA | 94 | config IEEE1394_SBP2_PHYS_DMA |
83 | bool "Enable replacement for physical DMA in SBP2" | 95 | bool "Enable replacement for physical DMA in SBP2" |
84 | depends on IEEE1394_SBP2 && VIRT_TO_BUS && EXPERIMENTAL | 96 | depends on IEEE1394_SBP2 && VIRT_TO_BUS && EXPERIMENTAL |
@@ -111,6 +123,11 @@ config IEEE1394_ETH1394 | |||
111 | 123 | ||
112 | The module is called eth1394 although it does not emulate Ethernet. | 124 | The module is called eth1394 although it does not emulate Ethernet. |
113 | 125 | ||
126 | NOTE: | ||
127 | eth1394 is superseded by the newer firewire-net driver. See | ||
128 | http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for | ||
129 | further information on how to switch to the new FireWire drivers. | ||
130 | |||
114 | config IEEE1394_RAWIO | 131 | config IEEE1394_RAWIO |
115 | tristate "raw1394 userspace interface" | 132 | tristate "raw1394 userspace interface" |
116 | depends on IEEE1394 | 133 | depends on IEEE1394 |
@@ -123,6 +140,11 @@ config IEEE1394_RAWIO | |||
123 | To compile this driver as a module, say M here: the module will be | 140 | To compile this driver as a module, say M here: the module will be |
124 | called raw1394. | 141 | called raw1394. |
125 | 142 | ||
143 | NOTE: | ||
144 | raw1394 is superseded by the newer firewire-core driver. See | ||
145 | http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for | ||
146 | further information on how to switch to the new FireWire drivers. | ||
147 | |||
126 | config IEEE1394_VIDEO1394 | 148 | config IEEE1394_VIDEO1394 |
127 | tristate "video1394 userspace interface" | 149 | tristate "video1394 userspace interface" |
128 | depends on IEEE1394 && IEEE1394_OHCI1394 | 150 | depends on IEEE1394 && IEEE1394_OHCI1394 |
@@ -136,13 +158,18 @@ config IEEE1394_VIDEO1394 | |||
136 | To compile this driver as a module, say M here: the module will be | 158 | To compile this driver as a module, say M here: the module will be |
137 | called video1394. | 159 | called video1394. |
138 | 160 | ||
161 | NOTE: | ||
162 | video1394 is superseded by the newer firewire-core driver. See | ||
163 | http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for | ||
164 | further information on how to switch to the new FireWire drivers. | ||
165 | |||
139 | config IEEE1394_DV1394 | 166 | config IEEE1394_DV1394 |
140 | tristate "dv1394 userspace interface (deprecated)" | 167 | tristate "dv1394 userspace interface (deprecated)" |
141 | depends on IEEE1394 && IEEE1394_OHCI1394 | 168 | depends on IEEE1394 && IEEE1394_OHCI1394 |
142 | help | 169 | help |
143 | The dv1394 driver is unsupported and may be removed from Linux in a | 170 | The dv1394 driver is unsupported and may be removed from Linux in a |
144 | future release. Its functionality is now provided by raw1394 together | 171 | future release. Its functionality is now provided by either |
145 | with libraries such as libiec61883. | 172 | raw1394 or firewire-core together with libraries such as libiec61883. |
146 | 173 | ||
147 | config IEEE1394_VERBOSEDEBUG | 174 | config IEEE1394_VERBOSEDEBUG |
148 | bool "Excessive debugging output" | 175 | bool "Excessive debugging output" |
@@ -153,5 +180,3 @@ config IEEE1394_VERBOSEDEBUG | |||
153 | will quickly result in large amounts of data sent to the system log. | 180 | will quickly result in large amounts of data sent to the system log. |
154 | 181 | ||
155 | Say Y if you really need the debugging output. Everyone else says N. | 182 | Say Y if you really need the debugging output. Everyone else says N. |
156 | |||
157 | endmenu | ||
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index fbdd73106000..cc9b5940fa97 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -2083,7 +2083,7 @@ static int cma_get_port(struct rdma_id_private *id_priv) | |||
2083 | static int cma_check_linklocal(struct rdma_dev_addr *dev_addr, | 2083 | static int cma_check_linklocal(struct rdma_dev_addr *dev_addr, |
2084 | struct sockaddr *addr) | 2084 | struct sockaddr *addr) |
2085 | { | 2085 | { |
2086 | #if defined(CONFIG_IPv6) || defined(CONFIG_IPV6_MODULE) | 2086 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
2087 | struct sockaddr_in6 *sin6; | 2087 | struct sockaddr_in6 *sin6; |
2088 | 2088 | ||
2089 | if (addr->sa_family != AF_INET6) | 2089 | if (addr->sa_family != AF_INET6) |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 989555cee883..2a97c964b9ef 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -1752,7 +1752,7 @@ int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
1752 | ind = qp->rq.head & (qp->rq.wqe_cnt - 1); | 1752 | ind = qp->rq.head & (qp->rq.wqe_cnt - 1); |
1753 | 1753 | ||
1754 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 1754 | for (nreq = 0; wr; ++nreq, wr = wr->next) { |
1755 | if (mlx4_wq_overflow(&qp->rq, nreq, qp->ibqp.send_cq)) { | 1755 | if (mlx4_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) { |
1756 | err = -ENOMEM; | 1756 | err = -ENOMEM; |
1757 | *bad_wr = wr; | 1757 | *bad_wr = wr; |
1758 | goto out; | 1758 | goto out; |
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c index d42565258fb7..cf8085bcbd6d 100644 --- a/drivers/infiniband/hw/mlx4/srq.c +++ b/drivers/infiniband/hw/mlx4/srq.c | |||
@@ -74,6 +74,7 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, | |||
74 | struct mlx4_ib_dev *dev = to_mdev(pd->device); | 74 | struct mlx4_ib_dev *dev = to_mdev(pd->device); |
75 | struct mlx4_ib_srq *srq; | 75 | struct mlx4_ib_srq *srq; |
76 | struct mlx4_wqe_srq_next_seg *next; | 76 | struct mlx4_wqe_srq_next_seg *next; |
77 | struct mlx4_wqe_data_seg *scatter; | ||
77 | int desc_size; | 78 | int desc_size; |
78 | int buf_size; | 79 | int buf_size; |
79 | int err; | 80 | int err; |
@@ -149,6 +150,11 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, | |||
149 | next = get_wqe(srq, i); | 150 | next = get_wqe(srq, i); |
150 | next->next_wqe_index = | 151 | next->next_wqe_index = |
151 | cpu_to_be16((i + 1) & (srq->msrq.max - 1)); | 152 | cpu_to_be16((i + 1) & (srq->msrq.max - 1)); |
153 | |||
154 | for (scatter = (void *) (next + 1); | ||
155 | (void *) scatter < (void *) next + desc_size; | ||
156 | ++scatter) | ||
157 | scatter->lkey = cpu_to_be32(MLX4_INVALID_LKEY); | ||
152 | } | 158 | } |
153 | 159 | ||
154 | err = mlx4_mtt_init(dev->dev, srq->buf.npages, srq->buf.page_shift, | 160 | err = mlx4_mtt_init(dev->dev, srq->buf.npages, srq->buf.page_shift, |
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c index b483b2995fa9..f967008f332e 100644 --- a/drivers/input/ff-memless.c +++ b/drivers/input/ff-memless.c | |||
@@ -221,11 +221,27 @@ static int get_compatible_type(struct ff_device *ff, int effect_type) | |||
221 | } | 221 | } |
222 | 222 | ||
223 | /* | 223 | /* |
224 | * Only left/right direction should be used (under/over 0x8000) for | ||
225 | * forward/reverse motor direction (to keep calculation fast & simple). | ||
226 | */ | ||
227 | static u16 ml_calculate_direction(u16 direction, u16 force, | ||
228 | u16 new_direction, u16 new_force) | ||
229 | { | ||
230 | if (!force) | ||
231 | return new_direction; | ||
232 | if (!new_force) | ||
233 | return direction; | ||
234 | return (((u32)(direction >> 1) * force + | ||
235 | (new_direction >> 1) * new_force) / | ||
236 | (force + new_force)) << 1; | ||
237 | } | ||
238 | |||
239 | /* | ||
224 | * Combine two effects and apply gain. | 240 | * Combine two effects and apply gain. |
225 | */ | 241 | */ |
226 | static void ml_combine_effects(struct ff_effect *effect, | 242 | static void ml_combine_effects(struct ff_effect *effect, |
227 | struct ml_effect_state *state, | 243 | struct ml_effect_state *state, |
228 | unsigned int gain) | 244 | int gain) |
229 | { | 245 | { |
230 | struct ff_effect *new = state->effect; | 246 | struct ff_effect *new = state->effect; |
231 | unsigned int strong, weak, i; | 247 | unsigned int strong, weak, i; |
@@ -252,8 +268,21 @@ static void ml_combine_effects(struct ff_effect *effect, | |||
252 | break; | 268 | break; |
253 | 269 | ||
254 | case FF_RUMBLE: | 270 | case FF_RUMBLE: |
255 | strong = new->u.rumble.strong_magnitude * gain / 0xffff; | 271 | strong = (u32)new->u.rumble.strong_magnitude * gain / 0xffff; |
256 | weak = new->u.rumble.weak_magnitude * gain / 0xffff; | 272 | weak = (u32)new->u.rumble.weak_magnitude * gain / 0xffff; |
273 | |||
274 | if (effect->u.rumble.strong_magnitude + strong) | ||
275 | effect->direction = ml_calculate_direction( | ||
276 | effect->direction, | ||
277 | effect->u.rumble.strong_magnitude, | ||
278 | new->direction, strong); | ||
279 | else if (effect->u.rumble.weak_magnitude + weak) | ||
280 | effect->direction = ml_calculate_direction( | ||
281 | effect->direction, | ||
282 | effect->u.rumble.weak_magnitude, | ||
283 | new->direction, weak); | ||
284 | else | ||
285 | effect->direction = 0; | ||
257 | effect->u.rumble.strong_magnitude = | 286 | effect->u.rumble.strong_magnitude = |
258 | min(strong + effect->u.rumble.strong_magnitude, | 287 | min(strong + effect->u.rumble.strong_magnitude, |
259 | 0xffffU); | 288 | 0xffffU); |
@@ -268,6 +297,13 @@ static void ml_combine_effects(struct ff_effect *effect, | |||
268 | /* here we also scale it 0x7fff => 0xffff */ | 297 | /* here we also scale it 0x7fff => 0xffff */ |
269 | i = i * gain / 0x7fff; | 298 | i = i * gain / 0x7fff; |
270 | 299 | ||
300 | if (effect->u.rumble.strong_magnitude + i) | ||
301 | effect->direction = ml_calculate_direction( | ||
302 | effect->direction, | ||
303 | effect->u.rumble.strong_magnitude, | ||
304 | new->direction, i); | ||
305 | else | ||
306 | effect->direction = 0; | ||
271 | effect->u.rumble.strong_magnitude = | 307 | effect->u.rumble.strong_magnitude = |
272 | min(i + effect->u.rumble.strong_magnitude, 0xffffU); | 308 | min(i + effect->u.rumble.strong_magnitude, 0xffffU); |
273 | effect->u.rumble.weak_magnitude = | 309 | effect->u.rumble.weak_magnitude = |
@@ -411,8 +447,6 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value) | |||
411 | msecs_to_jiffies(state->effect->replay.length); | 447 | msecs_to_jiffies(state->effect->replay.length); |
412 | state->adj_at = state->play_at; | 448 | state->adj_at = state->play_at; |
413 | 449 | ||
414 | ml_schedule_timer(ml); | ||
415 | |||
416 | } else { | 450 | } else { |
417 | debug("initiated stop"); | 451 | debug("initiated stop"); |
418 | 452 | ||
@@ -420,10 +454,10 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value) | |||
420 | __set_bit(FF_EFFECT_ABORTING, &state->flags); | 454 | __set_bit(FF_EFFECT_ABORTING, &state->flags); |
421 | else | 455 | else |
422 | __clear_bit(FF_EFFECT_STARTED, &state->flags); | 456 | __clear_bit(FF_EFFECT_STARTED, &state->flags); |
423 | |||
424 | ml_play_effects(ml); | ||
425 | } | 457 | } |
426 | 458 | ||
459 | ml_play_effects(ml); | ||
460 | |||
427 | return 0; | 461 | return 0; |
428 | } | 462 | } |
429 | 463 | ||
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index f6c688cae334..b1edd778639c 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c | |||
@@ -210,7 +210,7 @@ static int iforce_open(struct input_dev *dev) | |||
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
212 | 212 | ||
213 | static void iforce_release(struct input_dev *dev) | 213 | static void iforce_close(struct input_dev *dev) |
214 | { | 214 | { |
215 | struct iforce *iforce = input_get_drvdata(dev); | 215 | struct iforce *iforce = input_get_drvdata(dev); |
216 | int i; | 216 | int i; |
@@ -228,30 +228,17 @@ static void iforce_release(struct input_dev *dev) | |||
228 | 228 | ||
229 | /* Disable force feedback playback */ | 229 | /* Disable force feedback playback */ |
230 | iforce_send_packet(iforce, FF_CMD_ENABLE, "\001"); | 230 | iforce_send_packet(iforce, FF_CMD_ENABLE, "\001"); |
231 | /* Wait for the command to complete */ | ||
232 | wait_event_interruptible(iforce->wait, | ||
233 | !test_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)); | ||
231 | } | 234 | } |
232 | 235 | ||
233 | switch (iforce->bus) { | 236 | switch (iforce->bus) { |
234 | #ifdef CONFIG_JOYSTICK_IFORCE_USB | 237 | #ifdef CONFIG_JOYSTICK_IFORCE_USB |
235 | case IFORCE_USB: | ||
236 | usb_kill_urb(iforce->irq); | ||
237 | |||
238 | /* The device was unplugged before the file | ||
239 | * was released */ | ||
240 | if (iforce->usbdev == NULL) { | ||
241 | iforce_delete_device(iforce); | ||
242 | kfree(iforce); | ||
243 | } | ||
244 | break; | ||
245 | #endif | ||
246 | } | ||
247 | } | ||
248 | |||
249 | void iforce_delete_device(struct iforce *iforce) | ||
250 | { | ||
251 | switch (iforce->bus) { | ||
252 | #ifdef CONFIG_JOYSTICK_IFORCE_USB | ||
253 | case IFORCE_USB: | 238 | case IFORCE_USB: |
254 | iforce_usb_delete(iforce); | 239 | usb_kill_urb(iforce->irq); |
240 | usb_kill_urb(iforce->out); | ||
241 | usb_kill_urb(iforce->ctrl); | ||
255 | break; | 242 | break; |
256 | #endif | 243 | #endif |
257 | #ifdef CONFIG_JOYSTICK_IFORCE_232 | 244 | #ifdef CONFIG_JOYSTICK_IFORCE_232 |
@@ -303,7 +290,7 @@ int iforce_init_device(struct iforce *iforce) | |||
303 | 290 | ||
304 | input_dev->name = "Unknown I-Force device"; | 291 | input_dev->name = "Unknown I-Force device"; |
305 | input_dev->open = iforce_open; | 292 | input_dev->open = iforce_open; |
306 | input_dev->close = iforce_release; | 293 | input_dev->close = iforce_close; |
307 | 294 | ||
308 | /* | 295 | /* |
309 | * On-device memory allocation. | 296 | * On-device memory allocation. |
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 9f289d8f52c6..b41303d3ec54 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c | |||
@@ -109,6 +109,7 @@ static void iforce_usb_out(struct urb *urb) | |||
109 | struct iforce *iforce = urb->context; | 109 | struct iforce *iforce = urb->context; |
110 | 110 | ||
111 | if (urb->status) { | 111 | if (urb->status) { |
112 | clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); | ||
112 | dbg("urb->status %d, exiting", urb->status); | 113 | dbg("urb->status %d, exiting", urb->status); |
113 | return; | 114 | return; |
114 | } | 115 | } |
@@ -186,33 +187,19 @@ fail: | |||
186 | return err; | 187 | return err; |
187 | } | 188 | } |
188 | 189 | ||
189 | /* Called by iforce_delete() */ | ||
190 | void iforce_usb_delete(struct iforce* iforce) | ||
191 | { | ||
192 | usb_kill_urb(iforce->irq); | ||
193 | usb_kill_urb(iforce->out); | ||
194 | usb_kill_urb(iforce->ctrl); | ||
195 | |||
196 | usb_free_urb(iforce->irq); | ||
197 | usb_free_urb(iforce->out); | ||
198 | usb_free_urb(iforce->ctrl); | ||
199 | } | ||
200 | |||
201 | static void iforce_usb_disconnect(struct usb_interface *intf) | 190 | static void iforce_usb_disconnect(struct usb_interface *intf) |
202 | { | 191 | { |
203 | struct iforce *iforce = usb_get_intfdata(intf); | 192 | struct iforce *iforce = usb_get_intfdata(intf); |
204 | int open = 0; /* FIXME! iforce->dev.handle->open; */ | ||
205 | 193 | ||
206 | usb_set_intfdata(intf, NULL); | 194 | usb_set_intfdata(intf, NULL); |
207 | if (iforce) { | ||
208 | iforce->usbdev = NULL; | ||
209 | input_unregister_device(iforce->dev); | ||
210 | 195 | ||
211 | if (!open) { | 196 | input_unregister_device(iforce->dev); |
212 | iforce_delete_device(iforce); | 197 | |
213 | kfree(iforce); | 198 | usb_free_urb(iforce->irq); |
214 | } | 199 | usb_free_urb(iforce->out); |
215 | } | 200 | usb_free_urb(iforce->ctrl); |
201 | |||
202 | kfree(iforce); | ||
216 | } | 203 | } |
217 | 204 | ||
218 | static struct usb_device_id iforce_usb_ids [] = { | 205 | static struct usb_device_id iforce_usb_ids [] = { |
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index f2d91f4028ca..9f494b75848a 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h | |||
@@ -150,11 +150,9 @@ void iforce_serial_xmit(struct iforce *iforce); | |||
150 | 150 | ||
151 | /* iforce-usb.c */ | 151 | /* iforce-usb.c */ |
152 | void iforce_usb_xmit(struct iforce *iforce); | 152 | void iforce_usb_xmit(struct iforce *iforce); |
153 | void iforce_usb_delete(struct iforce *iforce); | ||
154 | 153 | ||
155 | /* iforce-main.c */ | 154 | /* iforce-main.c */ |
156 | int iforce_init_device(struct iforce *iforce); | 155 | int iforce_init_device(struct iforce *iforce); |
157 | void iforce_delete_device(struct iforce *iforce); | ||
158 | 156 | ||
159 | /* iforce-packets.c */ | 157 | /* iforce-packets.c */ |
160 | int iforce_control_playback(struct iforce*, u16 id, unsigned int); | 158 | int iforce_control_playback(struct iforce*, u16 id, unsigned int); |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index a3573570c52f..1f5e2ce327d6 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -134,7 +134,8 @@ static const unsigned short atkbd_unxlate_table[128] = { | |||
134 | #define ATKBD_CMD_GETID 0x02f2 | 134 | #define ATKBD_CMD_GETID 0x02f2 |
135 | #define ATKBD_CMD_SETREP 0x10f3 | 135 | #define ATKBD_CMD_SETREP 0x10f3 |
136 | #define ATKBD_CMD_ENABLE 0x00f4 | 136 | #define ATKBD_CMD_ENABLE 0x00f4 |
137 | #define ATKBD_CMD_RESET_DIS 0x00f5 | 137 | #define ATKBD_CMD_RESET_DIS 0x00f5 /* Reset to defaults and disable */ |
138 | #define ATKBD_CMD_RESET_DEF 0x00f6 /* Reset to defaults */ | ||
138 | #define ATKBD_CMD_SETALL_MBR 0x00fa | 139 | #define ATKBD_CMD_SETALL_MBR 0x00fa |
139 | #define ATKBD_CMD_RESET_BAT 0x02ff | 140 | #define ATKBD_CMD_RESET_BAT 0x02ff |
140 | #define ATKBD_CMD_RESEND 0x00fe | 141 | #define ATKBD_CMD_RESEND 0x00fe |
@@ -836,7 +837,7 @@ static void atkbd_cleanup(struct serio *serio) | |||
836 | struct atkbd *atkbd = serio_get_drvdata(serio); | 837 | struct atkbd *atkbd = serio_get_drvdata(serio); |
837 | 838 | ||
838 | atkbd_disable(atkbd); | 839 | atkbd_disable(atkbd); |
839 | ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT); | 840 | ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_DEF); |
840 | } | 841 | } |
841 | 842 | ||
842 | 843 | ||
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 34f4a29d4973..d3c8b61a941d 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -29,11 +29,13 @@ struct matrix_keypad { | |||
29 | unsigned short *keycodes; | 29 | unsigned short *keycodes; |
30 | unsigned int row_shift; | 30 | unsigned int row_shift; |
31 | 31 | ||
32 | DECLARE_BITMAP(disabled_gpios, MATRIX_MAX_ROWS); | ||
33 | |||
32 | uint32_t last_key_state[MATRIX_MAX_COLS]; | 34 | uint32_t last_key_state[MATRIX_MAX_COLS]; |
33 | struct delayed_work work; | 35 | struct delayed_work work; |
36 | spinlock_t lock; | ||
34 | bool scan_pending; | 37 | bool scan_pending; |
35 | bool stopped; | 38 | bool stopped; |
36 | spinlock_t lock; | ||
37 | }; | 39 | }; |
38 | 40 | ||
39 | /* | 41 | /* |
@@ -222,9 +224,16 @@ static int matrix_keypad_suspend(struct device *dev) | |||
222 | 224 | ||
223 | matrix_keypad_stop(keypad->input_dev); | 225 | matrix_keypad_stop(keypad->input_dev); |
224 | 226 | ||
225 | if (device_may_wakeup(&pdev->dev)) | 227 | if (device_may_wakeup(&pdev->dev)) { |
226 | for (i = 0; i < pdata->num_row_gpios; i++) | 228 | for (i = 0; i < pdata->num_row_gpios; i++) { |
227 | enable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); | 229 | if (!test_bit(i, keypad->disabled_gpios)) { |
230 | unsigned int gpio = pdata->row_gpios[i]; | ||
231 | |||
232 | if (enable_irq_wake(gpio_to_irq(gpio)) == 0) | ||
233 | __set_bit(i, keypad->disabled_gpios); | ||
234 | } | ||
235 | } | ||
236 | } | ||
228 | 237 | ||
229 | return 0; | 238 | return 0; |
230 | } | 239 | } |
@@ -236,9 +245,15 @@ static int matrix_keypad_resume(struct device *dev) | |||
236 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | 245 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; |
237 | int i; | 246 | int i; |
238 | 247 | ||
239 | if (device_may_wakeup(&pdev->dev)) | 248 | if (device_may_wakeup(&pdev->dev)) { |
240 | for (i = 0; i < pdata->num_row_gpios; i++) | 249 | for (i = 0; i < pdata->num_row_gpios; i++) { |
241 | disable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); | 250 | if (test_and_clear_bit(i, keypad->disabled_gpios)) { |
251 | unsigned int gpio = pdata->row_gpios[i]; | ||
252 | |||
253 | disable_irq_wake(gpio_to_irq(gpio)); | ||
254 | } | ||
255 | } | ||
256 | } | ||
242 | 257 | ||
243 | matrix_keypad_start(keypad->input_dev); | 258 | matrix_keypad_start(keypad->input_dev); |
244 | 259 | ||
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index eeaa7acb9cfc..21d6184efa96 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c | |||
@@ -253,14 +253,6 @@ static irqreturn_t do_kp_irq(int irq, void *_kp) | |||
253 | u8 reg; | 253 | u8 reg; |
254 | int ret; | 254 | int ret; |
255 | 255 | ||
256 | #ifdef CONFIG_LOCKDEP | ||
257 | /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which | ||
258 | * we don't want and can't tolerate. Although it might be | ||
259 | * friendlier not to borrow this thread context... | ||
260 | */ | ||
261 | local_irq_enable(); | ||
262 | #endif | ||
263 | |||
264 | /* Read & Clear TWL4030 pending interrupt */ | 256 | /* Read & Clear TWL4030 pending interrupt */ |
265 | ret = twl4030_kpread(kp, ®, KEYP_ISR1, 1); | 257 | ret = twl4030_kpread(kp, ®, KEYP_ISR1, 1); |
266 | 258 | ||
@@ -403,7 +395,8 @@ static int __devinit twl4030_kp_probe(struct platform_device *pdev) | |||
403 | * | 395 | * |
404 | * NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ... | 396 | * NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ... |
405 | */ | 397 | */ |
406 | error = request_irq(kp->irq, do_kp_irq, 0, pdev->name, kp); | 398 | error = request_threaded_irq(kp->irq, NULL, do_kp_irq, |
399 | 0, pdev->name, kp); | ||
407 | if (error) { | 400 | if (error) { |
408 | dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n", | 401 | dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n", |
409 | kp->irq); | 402 | kp->irq); |
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c index bdde5c889035..e9069b87fde2 100644 --- a/drivers/input/misc/twl4030-pwrbutton.c +++ b/drivers/input/misc/twl4030-pwrbutton.c | |||
@@ -39,18 +39,8 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr) | |||
39 | int err; | 39 | int err; |
40 | u8 value; | 40 | u8 value; |
41 | 41 | ||
42 | #ifdef CONFIG_LOCKDEP | ||
43 | /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which | ||
44 | * we don't want and can't tolerate since this is a threaded | ||
45 | * IRQ and can sleep due to the i2c reads it has to issue. | ||
46 | * Although it might be friendlier not to borrow this thread | ||
47 | * context... | ||
48 | */ | ||
49 | local_irq_enable(); | ||
50 | #endif | ||
51 | |||
52 | err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value, | 42 | err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value, |
53 | STS_HW_CONDITIONS); | 43 | STS_HW_CONDITIONS); |
54 | if (!err) { | 44 | if (!err) { |
55 | input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); | 45 | input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); |
56 | input_sync(pwr); | 46 | input_sync(pwr); |
@@ -80,7 +70,7 @@ static int __devinit twl4030_pwrbutton_probe(struct platform_device *pdev) | |||
80 | pwr->phys = "twl4030_pwrbutton/input0"; | 70 | pwr->phys = "twl4030_pwrbutton/input0"; |
81 | pwr->dev.parent = &pdev->dev; | 71 | pwr->dev.parent = &pdev->dev; |
82 | 72 | ||
83 | err = request_irq(irq, powerbutton_irq, | 73 | err = request_threaded_irq(irq, NULL, powerbutton_irq, |
84 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | 74 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, |
85 | "twl4030_pwrbutton", pwr); | 75 | "twl4030_pwrbutton", pwr); |
86 | if (err < 0) { | 76 | if (err < 0) { |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 38da6ab04384..c0afb71a3a6d 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -1328,7 +1328,7 @@ static struct platform_driver wistron_driver = { | |||
1328 | .driver = { | 1328 | .driver = { |
1329 | .name = "wistron-bios", | 1329 | .name = "wistron-bios", |
1330 | .owner = THIS_MODULE, | 1330 | .owner = THIS_MODULE, |
1331 | #if CONFIG_PM | 1331 | #ifdef CONFIG_PM |
1332 | .pm = &wistron_pm_ops, | 1332 | .pm = &wistron_pm_ops, |
1333 | #endif | 1333 | #endif |
1334 | }, | 1334 | }, |
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 3feeb3af8abd..c714ca2407f8 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig | |||
@@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS | |||
70 | config MOUSE_PS2_LIFEBOOK | 70 | config MOUSE_PS2_LIFEBOOK |
71 | bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED | 71 | bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED |
72 | default y | 72 | default y |
73 | depends on MOUSE_PS2 && X86 | 73 | depends on MOUSE_PS2 && X86 && DMI |
74 | help | 74 | help |
75 | Say Y here if you have a Fujitsu B-series Lifebook PS/2 | 75 | Say Y here if you have a Fujitsu B-series Lifebook PS/2 |
76 | TouchScreen connected to your system. | 76 | TouchScreen connected to your system. |
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index b146237266d8..90be30e93556 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c | |||
@@ -427,7 +427,6 @@ static void hgpk_recalib_work(struct work_struct *work) | |||
427 | 427 | ||
428 | static int hgpk_register(struct psmouse *psmouse) | 428 | static int hgpk_register(struct psmouse *psmouse) |
429 | { | 429 | { |
430 | struct input_dev *dev = psmouse->dev; | ||
431 | int err; | 430 | int err; |
432 | 431 | ||
433 | /* register handlers */ | 432 | /* register handlers */ |
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 2e6bdfea0165..6d7aa10d10f0 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
@@ -44,7 +44,6 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | static const struct dmi_system_id __initconst lifebook_dmi_table[] = { | 46 | static const struct dmi_system_id __initconst lifebook_dmi_table[] = { |
47 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
48 | { | 47 | { |
49 | /* FLORA-ie 55mi */ | 48 | /* FLORA-ie 55mi */ |
50 | .matches = { | 49 | .matches = { |
@@ -118,7 +117,6 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = { | |||
118 | }, | 117 | }, |
119 | }, | 118 | }, |
120 | { } | 119 | { } |
121 | #endif | ||
122 | }; | 120 | }; |
123 | 121 | ||
124 | void __init lifebook_module_init(void) | 122 | void __init lifebook_module_init(void) |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index fd0bc094616a..401ac6b6edd4 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -1137,7 +1137,10 @@ static void psmouse_cleanup(struct serio *serio) | |||
1137 | if (psmouse->cleanup) | 1137 | if (psmouse->cleanup) |
1138 | psmouse->cleanup(psmouse); | 1138 | psmouse->cleanup(psmouse); |
1139 | 1139 | ||
1140 | psmouse_reset(psmouse); | 1140 | /* |
1141 | * Reset the mouse to defaults (bare PS/2 protocol). | ||
1142 | */ | ||
1143 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS); | ||
1141 | 1144 | ||
1142 | /* | 1145 | /* |
1143 | * Some boxes, such as HP nx7400, get terribly confused if mouse | 1146 | * Some boxes, such as HP nx7400, get terribly confused if mouse |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 0236f0d5fd91..e0f30186d513 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -284,13 +284,7 @@ static void serio_handle_event(void) | |||
284 | 284 | ||
285 | mutex_lock(&serio_mutex); | 285 | mutex_lock(&serio_mutex); |
286 | 286 | ||
287 | /* | 287 | while ((event = serio_get_event())) { |
288 | * Note that we handle only one event here to give swsusp | ||
289 | * a chance to freeze kseriod thread. Serio events should | ||
290 | * be pretty rare so we are not concerned about taking | ||
291 | * performance hit. | ||
292 | */ | ||
293 | if ((event = serio_get_event())) { | ||
294 | 288 | ||
295 | switch (event->type) { | 289 | switch (event->type) { |
296 | case SERIO_REGISTER_PORT: | 290 | case SERIO_REGISTER_PORT: |
@@ -380,10 +374,9 @@ static struct serio *serio_get_pending_child(struct serio *parent) | |||
380 | 374 | ||
381 | static int serio_thread(void *nothing) | 375 | static int serio_thread(void *nothing) |
382 | { | 376 | { |
383 | set_freezable(); | ||
384 | do { | 377 | do { |
385 | serio_handle_event(); | 378 | serio_handle_event(); |
386 | wait_event_freezable(serio_wait, | 379 | wait_event_interruptible(serio_wait, |
387 | kthread_should_stop() || !list_empty(&serio_event_list)); | 380 | kthread_should_stop() || !list_empty(&serio_event_list)); |
388 | } while (!kthread_should_stop()); | 381 | } while (!kthread_should_stop()); |
389 | 382 | ||
diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c index 951c57b0a7e0..ede46581351a 100644 --- a/drivers/lguest/segments.c +++ b/drivers/lguest/segments.c | |||
@@ -179,8 +179,10 @@ void load_guest_gdt_entry(struct lg_cpu *cpu, u32 num, u32 lo, u32 hi) | |||
179 | * We assume the Guest has the same number of GDT entries as the | 179 | * We assume the Guest has the same number of GDT entries as the |
180 | * Host, otherwise we'd have to dynamically allocate the Guest GDT. | 180 | * Host, otherwise we'd have to dynamically allocate the Guest GDT. |
181 | */ | 181 | */ |
182 | if (num >= ARRAY_SIZE(cpu->arch.gdt)) | 182 | if (num >= ARRAY_SIZE(cpu->arch.gdt)) { |
183 | kill_guest(cpu, "too many gdt entries %i", num); | 183 | kill_guest(cpu, "too many gdt entries %i", num); |
184 | return; | ||
185 | } | ||
184 | 186 | ||
185 | /* Set it up, then fix it. */ | 187 | /* Set it up, then fix it. */ |
186 | cpu->arch.gdt[num].a = lo; | 188 | cpu->arch.gdt[num].a = lo; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index f4f5f82f9f53..dd3dfe42d5a9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -386,7 +386,9 @@ static void mddev_put(mddev_t *mddev) | |||
386 | if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock)) | 386 | if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock)) |
387 | return; | 387 | return; |
388 | if (!mddev->raid_disks && list_empty(&mddev->disks) && | 388 | if (!mddev->raid_disks && list_empty(&mddev->disks) && |
389 | !mddev->hold_active) { | 389 | mddev->ctime == 0 && !mddev->hold_active) { |
390 | /* Array is not configured at all, and not held active, | ||
391 | * so destroy it */ | ||
390 | list_del(&mddev->all_mddevs); | 392 | list_del(&mddev->all_mddevs); |
391 | if (mddev->gendisk) { | 393 | if (mddev->gendisk) { |
392 | /* we did a probe so need to clean up. | 394 | /* we did a probe so need to clean up. |
@@ -4355,7 +4357,7 @@ static int do_md_run(mddev_t * mddev) | |||
4355 | mddev->barriers_work = 1; | 4357 | mddev->barriers_work = 1; |
4356 | mddev->ok_start_degraded = start_dirty_degraded; | 4358 | mddev->ok_start_degraded = start_dirty_degraded; |
4357 | 4359 | ||
4358 | if (start_readonly) | 4360 | if (start_readonly && mddev->ro == 0) |
4359 | mddev->ro = 2; /* read-only, but switch on first write */ | 4361 | mddev->ro = 2; /* read-only, but switch on first write */ |
4360 | 4362 | ||
4361 | err = mddev->pers->run(mddev); | 4363 | err = mddev->pers->run(mddev); |
@@ -4419,33 +4421,6 @@ static int do_md_run(mddev_t * mddev) | |||
4419 | 4421 | ||
4420 | set_capacity(disk, mddev->array_sectors); | 4422 | set_capacity(disk, mddev->array_sectors); |
4421 | 4423 | ||
4422 | /* If there is a partially-recovered drive we need to | ||
4423 | * start recovery here. If we leave it to md_check_recovery, | ||
4424 | * it will remove the drives and not do the right thing | ||
4425 | */ | ||
4426 | if (mddev->degraded && !mddev->sync_thread) { | ||
4427 | int spares = 0; | ||
4428 | list_for_each_entry(rdev, &mddev->disks, same_set) | ||
4429 | if (rdev->raid_disk >= 0 && | ||
4430 | !test_bit(In_sync, &rdev->flags) && | ||
4431 | !test_bit(Faulty, &rdev->flags)) | ||
4432 | /* complete an interrupted recovery */ | ||
4433 | spares++; | ||
4434 | if (spares && mddev->pers->sync_request) { | ||
4435 | mddev->recovery = 0; | ||
4436 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); | ||
4437 | mddev->sync_thread = md_register_thread(md_do_sync, | ||
4438 | mddev, | ||
4439 | "resync"); | ||
4440 | if (!mddev->sync_thread) { | ||
4441 | printk(KERN_ERR "%s: could not start resync" | ||
4442 | " thread...\n", | ||
4443 | mdname(mddev)); | ||
4444 | /* leave the spares where they are, it shouldn't hurt */ | ||
4445 | mddev->recovery = 0; | ||
4446 | } | ||
4447 | } | ||
4448 | } | ||
4449 | md_wakeup_thread(mddev->thread); | 4424 | md_wakeup_thread(mddev->thread); |
4450 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | 4425 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ |
4451 | 4426 | ||
@@ -5262,6 +5237,10 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info) | |||
5262 | mddev->minor_version = info->minor_version; | 5237 | mddev->minor_version = info->minor_version; |
5263 | mddev->patch_version = info->patch_version; | 5238 | mddev->patch_version = info->patch_version; |
5264 | mddev->persistent = !info->not_persistent; | 5239 | mddev->persistent = !info->not_persistent; |
5240 | /* ensure mddev_put doesn't delete this now that there | ||
5241 | * is some minimal configuration. | ||
5242 | */ | ||
5243 | mddev->ctime = get_seconds(); | ||
5265 | return 0; | 5244 | return 0; |
5266 | } | 5245 | } |
5267 | mddev->major_version = MD_MAJOR_VERSION; | 5246 | mddev->major_version = MD_MAJOR_VERSION; |
@@ -6494,10 +6473,11 @@ void md_do_sync(mddev_t *mddev) | |||
6494 | mddev->curr_resync = 2; | 6473 | mddev->curr_resync = 2; |
6495 | 6474 | ||
6496 | try_again: | 6475 | try_again: |
6497 | if (kthread_should_stop()) { | 6476 | if (kthread_should_stop()) |
6498 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 6477 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
6478 | |||
6479 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) | ||
6499 | goto skip; | 6480 | goto skip; |
6500 | } | ||
6501 | for_each_mddev(mddev2, tmp) { | 6481 | for_each_mddev(mddev2, tmp) { |
6502 | if (mddev2 == mddev) | 6482 | if (mddev2 == mddev) |
6503 | continue; | 6483 | continue; |
diff --git a/drivers/media/dvb/firewire/firedtv-fw.c b/drivers/media/dvb/firewire/firedtv-fw.c index fe44789ab037..6223bf01efe9 100644 --- a/drivers/media/dvb/firewire/firedtv-fw.c +++ b/drivers/media/dvb/firewire/firedtv-fw.c | |||
@@ -202,14 +202,8 @@ static void handle_fcp(struct fw_card *card, struct fw_request *request, | |||
202 | unsigned long flags; | 202 | unsigned long flags; |
203 | int su; | 203 | int su; |
204 | 204 | ||
205 | if ((tcode != TCODE_WRITE_QUADLET_REQUEST && | 205 | if (length < 2 || (((u8 *)payload)[0] & 0xf0) != 0) |
206 | tcode != TCODE_WRITE_BLOCK_REQUEST) || | ||
207 | offset != CSR_REGISTER_BASE + CSR_FCP_RESPONSE || | ||
208 | length == 0 || | ||
209 | (((u8 *)payload)[0] & 0xf0) != 0) { | ||
210 | fw_send_response(card, request, RCODE_TYPE_ERROR); | ||
211 | return; | 206 | return; |
212 | } | ||
213 | 207 | ||
214 | su = ((u8 *)payload)[1] & 0x7; | 208 | su = ((u8 *)payload)[1] & 0x7; |
215 | 209 | ||
@@ -230,10 +224,8 @@ static void handle_fcp(struct fw_card *card, struct fw_request *request, | |||
230 | } | 224 | } |
231 | spin_unlock_irqrestore(&node_list_lock, flags); | 225 | spin_unlock_irqrestore(&node_list_lock, flags); |
232 | 226 | ||
233 | if (fdtv) { | 227 | if (fdtv) |
234 | avc_recv(fdtv, payload, length); | 228 | avc_recv(fdtv, payload, length); |
235 | fw_send_response(card, request, RCODE_COMPLETE); | ||
236 | } | ||
237 | } | 229 | } |
238 | 230 | ||
239 | static struct fw_address_handler fcp_handler = { | 231 | static struct fw_address_handler fcp_handler = { |
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index efba7021948a..3d5f40cd69df 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -40,8 +40,7 @@ | |||
40 | 40 | ||
41 | #define SG_TABLESIZE 30 | 41 | #define SG_TABLESIZE 30 |
42 | 42 | ||
43 | static int i2o_cfg_ioctl(struct inode *, struct file *, unsigned int, | 43 | static long i2o_cfg_ioctl(struct file *, unsigned int, unsigned long); |
44 | unsigned long); | ||
45 | 44 | ||
46 | static spinlock_t i2o_config_lock; | 45 | static spinlock_t i2o_config_lock; |
47 | 46 | ||
@@ -751,7 +750,7 @@ static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd, | |||
751 | lock_kernel(); | 750 | lock_kernel(); |
752 | switch (cmd) { | 751 | switch (cmd) { |
753 | case I2OGETIOPS: | 752 | case I2OGETIOPS: |
754 | ret = i2o_cfg_ioctl(NULL, file, cmd, arg); | 753 | ret = i2o_cfg_ioctl(file, cmd, arg); |
755 | break; | 754 | break; |
756 | case I2OPASSTHRU32: | 755 | case I2OPASSTHRU32: |
757 | ret = i2o_cfg_passthru32(file, cmd, arg); | 756 | ret = i2o_cfg_passthru32(file, cmd, arg); |
@@ -984,11 +983,11 @@ out: | |||
984 | /* | 983 | /* |
985 | * IOCTL Handler | 984 | * IOCTL Handler |
986 | */ | 985 | */ |
987 | static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, | 986 | static long i2o_cfg_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) |
988 | unsigned long arg) | ||
989 | { | 987 | { |
990 | int ret; | 988 | int ret; |
991 | 989 | ||
990 | lock_kernel(); | ||
992 | switch (cmd) { | 991 | switch (cmd) { |
993 | case I2OGETIOPS: | 992 | case I2OGETIOPS: |
994 | ret = i2o_cfg_getiops(arg); | 993 | ret = i2o_cfg_getiops(arg); |
@@ -1044,7 +1043,7 @@ static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, | |||
1044 | osm_debug("unknown ioctl called!\n"); | 1043 | osm_debug("unknown ioctl called!\n"); |
1045 | ret = -EINVAL; | 1044 | ret = -EINVAL; |
1046 | } | 1045 | } |
1047 | 1046 | unlock_kernel(); | |
1048 | return ret; | 1047 | return ret; |
1049 | } | 1048 | } |
1050 | 1049 | ||
@@ -1118,7 +1117,7 @@ static int cfg_release(struct inode *inode, struct file *file) | |||
1118 | static const struct file_operations config_fops = { | 1117 | static const struct file_operations config_fops = { |
1119 | .owner = THIS_MODULE, | 1118 | .owner = THIS_MODULE, |
1120 | .llseek = no_llseek, | 1119 | .llseek = no_llseek, |
1121 | .ioctl = i2o_cfg_ioctl, | 1120 | .unlocked_ioctl = i2o_cfg_ioctl, |
1122 | #ifdef CONFIG_COMPAT | 1121 | #ifdef CONFIG_COMPAT |
1123 | .compat_ioctl = i2o_cfg_compat_ioctl, | 1122 | .compat_ioctl = i2o_cfg_compat_ioctl, |
1124 | #endif | 1123 | #endif |
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c index 20d29bafc9f5..9df9a5ad38f9 100644 --- a/drivers/mfd/twl4030-irq.c +++ b/drivers/mfd/twl4030-irq.c | |||
@@ -568,12 +568,12 @@ static void twl4030_sih_do_edge(struct work_struct *work) | |||
568 | 568 | ||
569 | bytes[byte] &= ~(0x03 << off); | 569 | bytes[byte] &= ~(0x03 << off); |
570 | 570 | ||
571 | spin_lock_irq(&d->lock); | 571 | raw_spin_lock_irq(&d->lock); |
572 | if (d->status & IRQ_TYPE_EDGE_RISING) | 572 | if (d->status & IRQ_TYPE_EDGE_RISING) |
573 | bytes[byte] |= BIT(off + 1); | 573 | bytes[byte] |= BIT(off + 1); |
574 | if (d->status & IRQ_TYPE_EDGE_FALLING) | 574 | if (d->status & IRQ_TYPE_EDGE_FALLING) |
575 | bytes[byte] |= BIT(off + 0); | 575 | bytes[byte] |= BIT(off + 0); |
576 | spin_unlock_irq(&d->lock); | 576 | raw_spin_unlock_irq(&d->lock); |
577 | 577 | ||
578 | edge_change &= ~BIT(i); | 578 | edge_change &= ~BIT(i); |
579 | } | 579 | } |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 85f0e8cd875b..1f552c6e7579 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -85,7 +85,14 @@ static void mmc_blk_put(struct mmc_blk_data *md) | |||
85 | mutex_lock(&open_lock); | 85 | mutex_lock(&open_lock); |
86 | md->usage--; | 86 | md->usage--; |
87 | if (md->usage == 0) { | 87 | if (md->usage == 0) { |
88 | int devmaj = MAJOR(disk_devt(md->disk)); | ||
88 | int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT; | 89 | int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT; |
90 | |||
91 | if (!devmaj) | ||
92 | devidx = md->disk->first_minor >> MMC_SHIFT; | ||
93 | |||
94 | blk_cleanup_queue(md->queue.queue); | ||
95 | |||
89 | __clear_bit(devidx, dev_use); | 96 | __clear_bit(devidx, dev_use); |
90 | 97 | ||
91 | put_disk(md->disk); | 98 | put_disk(md->disk); |
@@ -613,6 +620,7 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
613 | return 0; | 620 | return 0; |
614 | 621 | ||
615 | out: | 622 | out: |
623 | mmc_cleanup_queue(&md->queue); | ||
616 | mmc_blk_put(md); | 624 | mmc_blk_put(md); |
617 | 625 | ||
618 | return err; | 626 | return err; |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 49e582356c65..c5a7a855f4b1 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -90,9 +90,10 @@ static void mmc_request(struct request_queue *q) | |||
90 | struct request *req; | 90 | struct request *req; |
91 | 91 | ||
92 | if (!mq) { | 92 | if (!mq) { |
93 | printk(KERN_ERR "MMC: killing requests for dead queue\n"); | 93 | while ((req = blk_fetch_request(q)) != NULL) { |
94 | while ((req = blk_fetch_request(q)) != NULL) | 94 | req->cmd_flags |= REQ_QUIET; |
95 | __blk_end_request_all(req, -EIO); | 95 | __blk_end_request_all(req, -EIO); |
96 | } | ||
96 | return; | 97 | return; |
97 | } | 98 | } |
98 | 99 | ||
@@ -223,17 +224,18 @@ void mmc_cleanup_queue(struct mmc_queue *mq) | |||
223 | struct request_queue *q = mq->queue; | 224 | struct request_queue *q = mq->queue; |
224 | unsigned long flags; | 225 | unsigned long flags; |
225 | 226 | ||
226 | /* Mark that we should start throwing out stragglers */ | ||
227 | spin_lock_irqsave(q->queue_lock, flags); | ||
228 | q->queuedata = NULL; | ||
229 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
230 | |||
231 | /* Make sure the queue isn't suspended, as that will deadlock */ | 227 | /* Make sure the queue isn't suspended, as that will deadlock */ |
232 | mmc_queue_resume(mq); | 228 | mmc_queue_resume(mq); |
233 | 229 | ||
234 | /* Then terminate our worker thread */ | 230 | /* Then terminate our worker thread */ |
235 | kthread_stop(mq->thread); | 231 | kthread_stop(mq->thread); |
236 | 232 | ||
233 | /* Empty the queue */ | ||
234 | spin_lock_irqsave(q->queue_lock, flags); | ||
235 | q->queuedata = NULL; | ||
236 | blk_start_queue(q); | ||
237 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
238 | |||
237 | if (mq->bounce_sg) | 239 | if (mq->bounce_sg) |
238 | kfree(mq->bounce_sg); | 240 | kfree(mq->bounce_sg); |
239 | mq->bounce_sg = NULL; | 241 | mq->bounce_sg = NULL; |
@@ -245,8 +247,6 @@ void mmc_cleanup_queue(struct mmc_queue *mq) | |||
245 | kfree(mq->bounce_buf); | 247 | kfree(mq->bounce_buf); |
246 | mq->bounce_buf = NULL; | 248 | mq->bounce_buf = NULL; |
247 | 249 | ||
248 | blk_cleanup_queue(mq->queue); | ||
249 | |||
250 | mq->card = NULL; | 250 | mq->card = NULL; |
251 | } | 251 | } |
252 | EXPORT_SYMBOL(mmc_cleanup_queue); | 252 | EXPORT_SYMBOL(mmc_cleanup_queue); |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index c11189446a1f..0eac6c814904 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -207,7 +207,7 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
207 | } | 207 | } |
208 | 208 | ||
209 | card->ext_csd.rev = ext_csd[EXT_CSD_REV]; | 209 | card->ext_csd.rev = ext_csd[EXT_CSD_REV]; |
210 | if (card->ext_csd.rev > 3) { | 210 | if (card->ext_csd.rev > 5) { |
211 | printk(KERN_ERR "%s: unrecognised EXT_CSD structure " | 211 | printk(KERN_ERR "%s: unrecognised EXT_CSD structure " |
212 | "version %d\n", mmc_hostname(card->host), | 212 | "version %d\n", mmc_hostname(card->host), |
213 | card->ext_csd.rev); | 213 | card->ext_csd.rev); |
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index fbc231153e55..77cf0901a441 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c | |||
@@ -56,6 +56,7 @@ static const char version[] = | |||
56 | #include <linux/errno.h> | 56 | #include <linux/errno.h> |
57 | #include <linux/netdevice.h> | 57 | #include <linux/netdevice.h> |
58 | #include <linux/etherdevice.h> | 58 | #include <linux/etherdevice.h> |
59 | #include <linux/if_ether.h> | ||
59 | #include <linux/skbuff.h> | 60 | #include <linux/skbuff.h> |
60 | #include <linux/slab.h> | 61 | #include <linux/slab.h> |
61 | #include <linux/init.h> | 62 | #include <linux/init.h> |
@@ -734,8 +735,7 @@ static void init_82586_mem(struct net_device *dev) | |||
734 | memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10); | 735 | memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10); |
735 | 736 | ||
736 | /* Fill in the station address. */ | 737 | /* Fill in the station address. */ |
737 | memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr, | 738 | memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr, ETH_ALEN); |
738 | sizeof(dev->dev_addr)); | ||
739 | 739 | ||
740 | /* The Tx-block list is written as needed. We just set up the values. */ | 740 | /* The Tx-block list is written as needed. We just set up the values. */ |
741 | lp->tx_cmd_link = IDLELOOP + 4; | 741 | lp->tx_cmd_link = IDLELOOP + 4; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index e58a65391ad2..dd9a09c72dff 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2346,6 +2346,7 @@ config GELIC_NET | |||
2346 | 2346 | ||
2347 | config GELIC_WIRELESS | 2347 | config GELIC_WIRELESS |
2348 | bool "PS3 Wireless support" | 2348 | bool "PS3 Wireless support" |
2349 | depends on WLAN | ||
2349 | depends on GELIC_NET | 2350 | depends on GELIC_NET |
2350 | select WIRELESS_EXT | 2351 | select WIRELESS_EXT |
2351 | help | 2352 | help |
@@ -2358,6 +2359,7 @@ config GELIC_WIRELESS | |||
2358 | config GELIC_WIRELESS_OLD_PSK_INTERFACE | 2359 | config GELIC_WIRELESS_OLD_PSK_INTERFACE |
2359 | bool "PS3 Wireless private PSK interface (OBSOLETE)" | 2360 | bool "PS3 Wireless private PSK interface (OBSOLETE)" |
2360 | depends on GELIC_WIRELESS | 2361 | depends on GELIC_WIRELESS |
2362 | select WEXT_PRIV | ||
2361 | help | 2363 | help |
2362 | This option retains the obsolete private interface to pass | 2364 | This option retains the obsolete private interface to pass |
2363 | the PSK from user space programs to the driver. The PSK | 2365 | the PSK from user space programs to the driver. The PSK |
diff --git a/drivers/net/arm/Kconfig b/drivers/net/arm/Kconfig index c37ee9e6b67b..39e1c0d39476 100644 --- a/drivers/net/arm/Kconfig +++ b/drivers/net/arm/Kconfig | |||
@@ -68,6 +68,7 @@ config W90P910_ETH | |||
68 | tristate "Nuvoton w90p910 Ethernet support" | 68 | tristate "Nuvoton w90p910 Ethernet support" |
69 | depends on ARM && ARCH_W90X900 | 69 | depends on ARM && ARCH_W90X900 |
70 | select PHYLIB | 70 | select PHYLIB |
71 | select MII | ||
71 | help | 72 | help |
72 | Say Y here if you want to use built-in Ethernet ports | 73 | Say Y here if you want to use built-in Ethernet ports |
73 | on w90p910 processor. | 74 | on w90p910 processor. |
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 9e56014d27ed..9fd8e5ecd5d7 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -275,6 +275,7 @@ struct be_adapter { | |||
275 | u32 tx_fc; /* Tx flow control */ | 275 | u32 tx_fc; /* Tx flow control */ |
276 | int link_speed; | 276 | int link_speed; |
277 | u8 port_type; | 277 | u8 port_type; |
278 | u8 transceiver; | ||
278 | }; | 279 | }; |
279 | 280 | ||
280 | extern const struct ethtool_ops be_ethtool_ops; | 281 | extern const struct ethtool_ops be_ethtool_ops; |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 1b68bd98dc0c..102ade134165 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -1479,6 +1479,41 @@ err: | |||
1479 | return status; | 1479 | return status; |
1480 | } | 1480 | } |
1481 | 1481 | ||
1482 | int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, | ||
1483 | u8 loopback_type, u8 enable) | ||
1484 | { | ||
1485 | struct be_mcc_wrb *wrb; | ||
1486 | struct be_cmd_req_set_lmode *req; | ||
1487 | int status; | ||
1488 | |||
1489 | spin_lock_bh(&adapter->mcc_lock); | ||
1490 | |||
1491 | wrb = wrb_from_mccq(adapter); | ||
1492 | if (!wrb) { | ||
1493 | status = -EBUSY; | ||
1494 | goto err; | ||
1495 | } | ||
1496 | |||
1497 | req = embedded_payload(wrb); | ||
1498 | |||
1499 | be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0, | ||
1500 | OPCODE_LOWLEVEL_SET_LOOPBACK_MODE); | ||
1501 | |||
1502 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, | ||
1503 | OPCODE_LOWLEVEL_SET_LOOPBACK_MODE, | ||
1504 | sizeof(*req)); | ||
1505 | |||
1506 | req->src_port = port_num; | ||
1507 | req->dest_port = port_num; | ||
1508 | req->loopback_type = loopback_type; | ||
1509 | req->loopback_state = enable; | ||
1510 | |||
1511 | status = be_mcc_notify_wait(adapter); | ||
1512 | err: | ||
1513 | spin_unlock_bh(&adapter->mcc_lock); | ||
1514 | return status; | ||
1515 | } | ||
1516 | |||
1482 | int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | 1517 | int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, |
1483 | u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern) | 1518 | u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern) |
1484 | { | 1519 | { |
@@ -1501,6 +1536,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | |||
1501 | 1536 | ||
1502 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, | 1537 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, |
1503 | OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req)); | 1538 | OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req)); |
1539 | req->hdr.timeout = 4; | ||
1504 | 1540 | ||
1505 | req->pattern = cpu_to_le64(pattern); | 1541 | req->pattern = cpu_to_le64(pattern); |
1506 | req->src_port = cpu_to_le32(port_num); | 1542 | req->src_port = cpu_to_le32(port_num); |
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index 92b87ef156ed..c002b8391b4d 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h | |||
@@ -155,6 +155,7 @@ struct be_mcc_mailbox { | |||
155 | 155 | ||
156 | #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17 | 156 | #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17 |
157 | #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18 | 157 | #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18 |
158 | #define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19 | ||
158 | 159 | ||
159 | struct be_cmd_req_hdr { | 160 | struct be_cmd_req_hdr { |
160 | u8 opcode; /* dword 0 */ | 161 | u8 opcode; /* dword 0 */ |
@@ -821,6 +822,19 @@ struct be_cmd_resp_loopback_test { | |||
821 | u32 ticks_compl; | 822 | u32 ticks_compl; |
822 | }; | 823 | }; |
823 | 824 | ||
825 | struct be_cmd_req_set_lmode { | ||
826 | struct be_cmd_req_hdr hdr; | ||
827 | u8 src_port; | ||
828 | u8 dest_port; | ||
829 | u8 loopback_type; | ||
830 | u8 loopback_state; | ||
831 | }; | ||
832 | |||
833 | struct be_cmd_resp_set_lmode { | ||
834 | struct be_cmd_resp_hdr resp_hdr; | ||
835 | u8 rsvd0[4]; | ||
836 | }; | ||
837 | |||
824 | /********************** DDR DMA test *********************/ | 838 | /********************** DDR DMA test *********************/ |
825 | struct be_cmd_req_ddrdma_test { | 839 | struct be_cmd_req_ddrdma_test { |
826 | struct be_cmd_req_hdr hdr; | 840 | struct be_cmd_req_hdr hdr; |
@@ -912,3 +926,5 @@ extern int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | |||
912 | u32 num_pkts, u64 pattern); | 926 | u32 num_pkts, u64 pattern); |
913 | extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, | 927 | extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, |
914 | u32 byte_cnt, struct be_dma_mem *cmd); | 928 | u32 byte_cnt, struct be_dma_mem *cmd); |
929 | extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, | ||
930 | u8 loopback_type, u8 enable); | ||
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 298b92cbd689..5d001c4deac1 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
@@ -118,6 +118,7 @@ static const char et_self_tests[][ETH_GSTRING_LEN] = { | |||
118 | #define BE_MAC_LOOPBACK 0x0 | 118 | #define BE_MAC_LOOPBACK 0x0 |
119 | #define BE_PHY_LOOPBACK 0x1 | 119 | #define BE_PHY_LOOPBACK 0x1 |
120 | #define BE_ONE_PORT_EXT_LOOPBACK 0x2 | 120 | #define BE_ONE_PORT_EXT_LOOPBACK 0x2 |
121 | #define BE_NO_LOOPBACK 0xff | ||
121 | 122 | ||
122 | static void | 123 | static void |
123 | be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | 124 | be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) |
@@ -339,28 +340,50 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
339 | 340 | ||
340 | status = be_cmd_read_port_type(adapter, adapter->port_num, | 341 | status = be_cmd_read_port_type(adapter, adapter->port_num, |
341 | &connector); | 342 | &connector); |
342 | switch (connector) { | 343 | if (!status) { |
343 | case 7: | 344 | switch (connector) { |
344 | ecmd->port = PORT_FIBRE; | 345 | case 7: |
345 | break; | 346 | ecmd->port = PORT_FIBRE; |
346 | default: | 347 | ecmd->transceiver = XCVR_EXTERNAL; |
347 | ecmd->port = PORT_TP; | 348 | break; |
348 | break; | 349 | case 0: |
350 | ecmd->port = PORT_TP; | ||
351 | ecmd->transceiver = XCVR_EXTERNAL; | ||
352 | break; | ||
353 | default: | ||
354 | ecmd->port = PORT_TP; | ||
355 | ecmd->transceiver = XCVR_INTERNAL; | ||
356 | break; | ||
357 | } | ||
358 | } else { | ||
359 | ecmd->port = PORT_AUI; | ||
360 | ecmd->transceiver = XCVR_INTERNAL; | ||
349 | } | 361 | } |
350 | 362 | ||
351 | /* Save for future use */ | 363 | /* Save for future use */ |
352 | adapter->link_speed = ecmd->speed; | 364 | adapter->link_speed = ecmd->speed; |
353 | adapter->port_type = ecmd->port; | 365 | adapter->port_type = ecmd->port; |
366 | adapter->transceiver = ecmd->transceiver; | ||
354 | } else { | 367 | } else { |
355 | ecmd->speed = adapter->link_speed; | 368 | ecmd->speed = adapter->link_speed; |
356 | ecmd->port = adapter->port_type; | 369 | ecmd->port = adapter->port_type; |
370 | ecmd->transceiver = adapter->transceiver; | ||
357 | } | 371 | } |
358 | 372 | ||
359 | ecmd->duplex = DUPLEX_FULL; | 373 | ecmd->duplex = DUPLEX_FULL; |
360 | ecmd->autoneg = AUTONEG_DISABLE; | 374 | ecmd->autoneg = AUTONEG_DISABLE; |
361 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP); | ||
362 | ecmd->phy_address = adapter->port_num; | 375 | ecmd->phy_address = adapter->port_num; |
363 | ecmd->transceiver = XCVR_INTERNAL; | 376 | switch (ecmd->port) { |
377 | case PORT_FIBRE: | ||
378 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); | ||
379 | break; | ||
380 | case PORT_TP: | ||
381 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP); | ||
382 | break; | ||
383 | case PORT_AUI: | ||
384 | ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_AUI); | ||
385 | break; | ||
386 | } | ||
364 | 387 | ||
365 | return 0; | 388 | return 0; |
366 | } | 389 | } |
@@ -489,6 +512,19 @@ err: | |||
489 | return ret; | 512 | return ret; |
490 | } | 513 | } |
491 | 514 | ||
515 | static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type, | ||
516 | u64 *status) | ||
517 | { | ||
518 | be_cmd_set_loopback(adapter, adapter->port_num, | ||
519 | loopback_type, 1); | ||
520 | *status = be_cmd_loopback_test(adapter, adapter->port_num, | ||
521 | loopback_type, 1500, | ||
522 | 2, 0xabc); | ||
523 | be_cmd_set_loopback(adapter, adapter->port_num, | ||
524 | BE_NO_LOOPBACK, 1); | ||
525 | return *status; | ||
526 | } | ||
527 | |||
492 | static void | 528 | static void |
493 | be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) | 529 | be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) |
494 | { | 530 | { |
@@ -497,23 +533,18 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) | |||
497 | memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); | 533 | memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); |
498 | 534 | ||
499 | if (test->flags & ETH_TEST_FL_OFFLINE) { | 535 | if (test->flags & ETH_TEST_FL_OFFLINE) { |
500 | data[0] = be_cmd_loopback_test(adapter, adapter->port_num, | 536 | if (be_loopback_test(adapter, BE_MAC_LOOPBACK, |
501 | BE_MAC_LOOPBACK, 1500, | 537 | &data[0]) != 0) { |
502 | 2, 0xabc); | ||
503 | if (data[0] != 0) | ||
504 | test->flags |= ETH_TEST_FL_FAILED; | 538 | test->flags |= ETH_TEST_FL_FAILED; |
505 | 539 | } | |
506 | data[1] = be_cmd_loopback_test(adapter, adapter->port_num, | 540 | if (be_loopback_test(adapter, BE_PHY_LOOPBACK, |
507 | BE_PHY_LOOPBACK, 1500, | 541 | &data[1]) != 0) { |
508 | 2, 0xabc); | ||
509 | if (data[1] != 0) | ||
510 | test->flags |= ETH_TEST_FL_FAILED; | 542 | test->flags |= ETH_TEST_FL_FAILED; |
511 | 543 | } | |
512 | data[2] = be_cmd_loopback_test(adapter, adapter->port_num, | 544 | if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK, |
513 | BE_ONE_PORT_EXT_LOOPBACK, | 545 | &data[2]) != 0) { |
514 | 1500, 2, 0xabc); | ||
515 | if (data[2] != 0) | ||
516 | test->flags |= ETH_TEST_FL_FAILED; | 546 | test->flags |= ETH_TEST_FL_FAILED; |
547 | } | ||
517 | 548 | ||
518 | data[3] = be_test_ddr_dma(adapter); | 549 | data[3] = be_test_ddr_dma(adapter); |
519 | if (data[3] != 0) | 550 | if (data[3] != 0) |
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 77ba13520d87..306c2b8165e2 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -7593,6 +7593,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
7593 | if (bp->cnic_eth_dev.drv_state & CNIC_DRV_STATE_REGD) { | 7593 | if (bp->cnic_eth_dev.drv_state & CNIC_DRV_STATE_REGD) { |
7594 | bnx2x_set_iscsi_eth_mac_addr(bp, 1); | 7594 | bnx2x_set_iscsi_eth_mac_addr(bp, 1); |
7595 | bp->cnic_flags |= BNX2X_CNIC_FLAG_MAC_SET; | 7595 | bp->cnic_flags |= BNX2X_CNIC_FLAG_MAC_SET; |
7596 | bnx2x_init_sb(bp, bp->cnic_sb, bp->cnic_sb_mapping, | ||
7597 | CNIC_SB_ID(bp)); | ||
7596 | } | 7598 | } |
7597 | mutex_unlock(&bp->cnic_mutex); | 7599 | mutex_unlock(&bp->cnic_mutex); |
7598 | #endif | 7600 | #endif |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 0fb7a4964e75..822f586d72af 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -1580,7 +1580,7 @@ static void ad_agg_selection_logic(struct aggregator *agg) | |||
1580 | // check if any partner replys | 1580 | // check if any partner replys |
1581 | if (best->is_individual) { | 1581 | if (best->is_individual) { |
1582 | pr_warning("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n", | 1582 | pr_warning("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n", |
1583 | best->slave->dev->master->name); | 1583 | best->slave ? best->slave->dev->master->name : "NULL"); |
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | best->is_active = 1; | 1586 | best->is_active = 1; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index e0620d084644..8bd3c9f17532 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -143,7 +143,6 @@ void gfar_start(struct net_device *dev); | |||
143 | static void gfar_clear_exact_match(struct net_device *dev); | 143 | static void gfar_clear_exact_match(struct net_device *dev); |
144 | static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); | 144 | static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); |
145 | static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 145 | static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
146 | u16 gfar_select_queue(struct net_device *dev, struct sk_buff *skb); | ||
147 | 146 | ||
148 | MODULE_AUTHOR("Freescale Semiconductor, Inc"); | 147 | MODULE_AUTHOR("Freescale Semiconductor, Inc"); |
149 | MODULE_DESCRIPTION("Gianfar Ethernet Driver"); | 148 | MODULE_DESCRIPTION("Gianfar Ethernet Driver"); |
@@ -455,7 +454,6 @@ static const struct net_device_ops gfar_netdev_ops = { | |||
455 | .ndo_set_multicast_list = gfar_set_multi, | 454 | .ndo_set_multicast_list = gfar_set_multi, |
456 | .ndo_tx_timeout = gfar_timeout, | 455 | .ndo_tx_timeout = gfar_timeout, |
457 | .ndo_do_ioctl = gfar_ioctl, | 456 | .ndo_do_ioctl = gfar_ioctl, |
458 | .ndo_select_queue = gfar_select_queue, | ||
459 | .ndo_get_stats = gfar_get_stats, | 457 | .ndo_get_stats = gfar_get_stats, |
460 | .ndo_vlan_rx_register = gfar_vlan_rx_register, | 458 | .ndo_vlan_rx_register = gfar_vlan_rx_register, |
461 | .ndo_set_mac_address = eth_mac_addr, | 459 | .ndo_set_mac_address = eth_mac_addr, |
@@ -506,10 +504,6 @@ static inline int gfar_uses_fcb(struct gfar_private *priv) | |||
506 | return priv->vlgrp || priv->rx_csum_enable; | 504 | return priv->vlgrp || priv->rx_csum_enable; |
507 | } | 505 | } |
508 | 506 | ||
509 | u16 gfar_select_queue(struct net_device *dev, struct sk_buff *skb) | ||
510 | { | ||
511 | return skb_get_queue_mapping(skb); | ||
512 | } | ||
513 | static void free_tx_pointers(struct gfar_private *priv) | 507 | static void free_tx_pointers(struct gfar_private *priv) |
514 | { | 508 | { |
515 | int i = 0; | 509 | int i = 0; |
@@ -2470,10 +2464,11 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, | |||
2470 | fcb = (struct rxfcb *)skb->data; | 2464 | fcb = (struct rxfcb *)skb->data; |
2471 | 2465 | ||
2472 | /* Remove the FCB from the skb */ | 2466 | /* Remove the FCB from the skb */ |
2473 | skb_set_queue_mapping(skb, fcb->rq); | ||
2474 | /* Remove the padded bytes, if there are any */ | 2467 | /* Remove the padded bytes, if there are any */ |
2475 | if (amount_pull) | 2468 | if (amount_pull) { |
2469 | skb_record_rx_queue(skb, fcb->rq); | ||
2476 | skb_pull(skb, amount_pull); | 2470 | skb_pull(skb, amount_pull); |
2471 | } | ||
2477 | 2472 | ||
2478 | if (priv->rx_csum_enable) | 2473 | if (priv->rx_csum_enable) |
2479 | gfar_rx_checksum(skb, fcb); | 2474 | gfar_rx_checksum(skb, fcb); |
@@ -2554,7 +2549,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) | |||
2554 | /* Remove the FCS from the packet length */ | 2549 | /* Remove the FCS from the packet length */ |
2555 | skb_put(skb, pkt_len); | 2550 | skb_put(skb, pkt_len); |
2556 | rx_queue->stats.rx_bytes += pkt_len; | 2551 | rx_queue->stats.rx_bytes += pkt_len; |
2557 | 2552 | skb_record_rx_queue(skb, rx_queue->qindex); | |
2558 | gfar_process_frame(dev, skb, amount_pull); | 2553 | gfar_process_frame(dev, skb, amount_pull); |
2559 | 2554 | ||
2560 | } else { | 2555 | } else { |
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 090a6d3af112..052c74091d91 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c | |||
@@ -87,6 +87,7 @@ History: | |||
87 | #include <linux/module.h> | 87 | #include <linux/module.h> |
88 | #include <linux/netdevice.h> | 88 | #include <linux/netdevice.h> |
89 | #include <linux/etherdevice.h> | 89 | #include <linux/etherdevice.h> |
90 | #include <linux/if_ether.h> | ||
90 | #include <linux/skbuff.h> | 91 | #include <linux/skbuff.h> |
91 | #include <linux/bitops.h> | 92 | #include <linux/bitops.h> |
92 | 93 | ||
@@ -988,7 +989,7 @@ static int __devinit ibmlana_init_one(struct device *kdev) | |||
988 | 989 | ||
989 | /* copy out MAC address */ | 990 | /* copy out MAC address */ |
990 | 991 | ||
991 | for (z = 0; z < sizeof(dev->dev_addr); z++) | 992 | for (z = 0; z < ETH_ALEN; z++) |
992 | dev->dev_addr[z] = inb(dev->base_addr + MACADDRPROM + z); | 993 | dev->dev_addr[z] = inb(dev->base_addr + MACADDRPROM + z); |
993 | 994 | ||
994 | /* print config */ | 995 | /* print config */ |
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index e8e9e9194a88..c505b50d1fa3 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
@@ -1096,9 +1096,7 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw) | |||
1096 | hw_dbg("Configuring Autoneg:PCS_LCTL=0x%08X\n", reg); | 1096 | hw_dbg("Configuring Autoneg:PCS_LCTL=0x%08X\n", reg); |
1097 | } else { | 1097 | } else { |
1098 | /* Set PCS register for forced link */ | 1098 | /* Set PCS register for forced link */ |
1099 | reg |= E1000_PCS_LCTL_FSD | /* Force Speed */ | 1099 | reg |= E1000_PCS_LCTL_FSD; /* Force Speed */ |
1100 | E1000_PCS_LCTL_FORCE_LINK | /* Force Link */ | ||
1101 | E1000_PCS_LCTL_FLV_LINK_UP; /* Force link value up */ | ||
1102 | 1100 | ||
1103 | hw_dbg("Configuring Forced Link:PCS_LCTL=0x%08X\n", reg); | 1101 | hw_dbg("Configuring Forced Link:PCS_LCTL=0x%08X\n", reg); |
1104 | } | 1102 | } |
diff --git a/drivers/net/igb/e1000_phy.c b/drivers/net/igb/e1000_phy.c index 5c9d73e9bb8d..3670a66401b8 100644 --- a/drivers/net/igb/e1000_phy.c +++ b/drivers/net/igb/e1000_phy.c | |||
@@ -457,15 +457,6 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw) | |||
457 | phy_data |= I82580_CFG_ENABLE_DOWNSHIFT; | 457 | phy_data |= I82580_CFG_ENABLE_DOWNSHIFT; |
458 | 458 | ||
459 | ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data); | 459 | ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data); |
460 | if (ret_val) | ||
461 | goto out; | ||
462 | |||
463 | /* Set number of link attempts before downshift */ | ||
464 | ret_val = phy->ops.read_reg(hw, I82580_CTRL_REG, &phy_data); | ||
465 | if (ret_val) | ||
466 | goto out; | ||
467 | phy_data &= ~I82580_CTRL_DOWNSHIFT_MASK; | ||
468 | ret_val = phy->ops.write_reg(hw, I82580_CTRL_REG, phy_data); | ||
469 | 460 | ||
470 | out: | 461 | out: |
471 | return ret_val; | 462 | return ret_val; |
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index ac9d5272650d..f771a6c08777 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
@@ -1795,7 +1795,7 @@ static int igb_wol_exclusion(struct igb_adapter *adapter, | |||
1795 | /* dual port cards only support WoL on port A from now on | 1795 | /* dual port cards only support WoL on port A from now on |
1796 | * unless it was enabled in the eeprom for port B | 1796 | * unless it was enabled in the eeprom for port B |
1797 | * so exclude FUNC_1 ports from having WoL enabled */ | 1797 | * so exclude FUNC_1 ports from having WoL enabled */ |
1798 | if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1 && | 1798 | if ((rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) && |
1799 | !adapter->eeprom_wol) { | 1799 | !adapter->eeprom_wol) { |
1800 | wol->supported = 0; | 1800 | wol->supported = 0; |
1801 | break; | 1801 | break; |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 78963a0e128d..933c64ff2465 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -1306,13 +1306,8 @@ void igb_reset(struct igb_adapter *adapter) | |||
1306 | hwm = min(((pba << 10) * 9 / 10), | 1306 | hwm = min(((pba << 10) * 9 / 10), |
1307 | ((pba << 10) - 2 * adapter->max_frame_size)); | 1307 | ((pba << 10) - 2 * adapter->max_frame_size)); |
1308 | 1308 | ||
1309 | if (mac->type < e1000_82576) { | 1309 | fc->high_water = hwm & 0xFFF0; /* 16-byte granularity */ |
1310 | fc->high_water = hwm & 0xFFF8; /* 8-byte granularity */ | 1310 | fc->low_water = fc->high_water - 16; |
1311 | fc->low_water = fc->high_water - 8; | ||
1312 | } else { | ||
1313 | fc->high_water = hwm & 0xFFF0; /* 16-byte granularity */ | ||
1314 | fc->low_water = fc->high_water - 16; | ||
1315 | } | ||
1316 | fc->pause_time = 0xFFFF; | 1311 | fc->pause_time = 0xFFFF; |
1317 | fc->send_xon = 1; | 1312 | fc->send_xon = 1; |
1318 | fc->current_mode = fc->requested_mode; | 1313 | fc->current_mode = fc->requested_mode; |
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c index e9dd95f136aa..0dbd0320023a 100644 --- a/drivers/net/igbvf/netdev.c +++ b/drivers/net/igbvf/netdev.c | |||
@@ -2763,7 +2763,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2763 | err = hw->mac.ops.reset_hw(hw); | 2763 | err = hw->mac.ops.reset_hw(hw); |
2764 | if (err) { | 2764 | if (err) { |
2765 | dev_info(&pdev->dev, | 2765 | dev_info(&pdev->dev, |
2766 | "PF still in reset state, assigning new address\n"); | 2766 | "PF still in reset state, assigning new address." |
2767 | " Is the PF interface up?\n"); | ||
2767 | random_ether_addr(hw->mac.addr); | 2768 | random_ether_addr(hw->mac.addr); |
2768 | } else { | 2769 | } else { |
2769 | err = hw->mac.ops.read_mac_addr(hw); | 2770 | err = hw->mac.ops.read_mac_addr(hw); |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index bd64387563f0..1a2ea621e371 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -4373,6 +4373,11 @@ static int ixgbe_resume(struct pci_dev *pdev) | |||
4373 | 4373 | ||
4374 | pci_set_power_state(pdev, PCI_D0); | 4374 | pci_set_power_state(pdev, PCI_D0); |
4375 | pci_restore_state(pdev); | 4375 | pci_restore_state(pdev); |
4376 | /* | ||
4377 | * pci_restore_state clears dev->state_saved so call | ||
4378 | * pci_save_state to restore it. | ||
4379 | */ | ||
4380 | pci_save_state(pdev); | ||
4376 | 4381 | ||
4377 | err = pci_enable_device_mem(pdev); | 4382 | err = pci_enable_device_mem(pdev); |
4378 | if (err) { | 4383 | if (err) { |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 291a505fd4fc..3cf56d90d859 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -1174,7 +1174,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1174 | return 0; | 1174 | return 0; |
1175 | 1175 | ||
1176 | err_port: | 1176 | err_port: |
1177 | for (port = 1; port <= dev->caps.num_ports; port++) | 1177 | for (--port; port >= 1; --port) |
1178 | mlx4_cleanup_port_info(&priv->port[port]); | 1178 | mlx4_cleanup_port_info(&priv->port[port]); |
1179 | 1179 | ||
1180 | mlx4_cleanup_mcg_table(dev); | 1180 | mlx4_cleanup_mcg_table(dev); |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index dcc67a35e8f2..e154677ff706 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -45,6 +45,7 @@ static const char *const version = | |||
45 | #include <linux/crc32.h> | 45 | #include <linux/crc32.h> |
46 | #include <linux/netdevice.h> | 46 | #include <linux/netdevice.h> |
47 | #include <linux/etherdevice.h> | 47 | #include <linux/etherdevice.h> |
48 | #include <linux/if_ether.h> | ||
48 | #include <linux/skbuff.h> | 49 | #include <linux/skbuff.h> |
49 | #include <linux/spinlock.h> | 50 | #include <linux/spinlock.h> |
50 | #include <linux/moduleparam.h> | 51 | #include <linux/moduleparam.h> |
@@ -1765,7 +1766,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1765 | 1766 | ||
1766 | /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ | 1767 | /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ |
1767 | if (!is_valid_ether_addr(dev->perm_addr)) | 1768 | if (!is_valid_ether_addr(dev->perm_addr)) |
1768 | memset(dev->dev_addr, 0, sizeof(dev->dev_addr)); | 1769 | memset(dev->dev_addr, 0, ETH_ALEN); |
1769 | 1770 | ||
1770 | if (pcnet32_debug & NETIF_MSG_PROBE) { | 1771 | if (pcnet32_debug & NETIF_MSG_PROBE) { |
1771 | printk(" %pM", dev->dev_addr); | 1772 | printk(" %pM", dev->dev_addr); |
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index f983e3b507cc..103e8b0e2a0d 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -741,14 +741,14 @@ static int efx_probe_port(struct efx_nic *efx) | |||
741 | 741 | ||
742 | EFX_LOG(efx, "create port\n"); | 742 | EFX_LOG(efx, "create port\n"); |
743 | 743 | ||
744 | if (phy_flash_cfg) | ||
745 | efx->phy_mode = PHY_MODE_SPECIAL; | ||
746 | |||
744 | /* Connect up MAC/PHY operations table */ | 747 | /* Connect up MAC/PHY operations table */ |
745 | rc = efx->type->probe_port(efx); | 748 | rc = efx->type->probe_port(efx); |
746 | if (rc) | 749 | if (rc) |
747 | goto err; | 750 | goto err; |
748 | 751 | ||
749 | if (phy_flash_cfg) | ||
750 | efx->phy_mode = PHY_MODE_SPECIAL; | ||
751 | |||
752 | /* Sanity check MAC address */ | 752 | /* Sanity check MAC address */ |
753 | if (is_valid_ether_addr(efx->mac_address)) { | 753 | if (is_valid_ether_addr(efx->mac_address)) { |
754 | memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN); | 754 | memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN); |
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index 17afcd26e870..9d009c46e962 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -925,6 +925,7 @@ static int falcon_probe_port(struct efx_nic *efx) | |||
925 | 925 | ||
926 | static void falcon_remove_port(struct efx_nic *efx) | 926 | static void falcon_remove_port(struct efx_nic *efx) |
927 | { | 927 | { |
928 | efx->phy_op->remove(efx); | ||
928 | efx_nic_free_buffer(efx, &efx->stats_buffer); | 929 | efx_nic_free_buffer(efx, &efx->stats_buffer); |
929 | } | 930 | } |
930 | 931 | ||
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c index 3da933f8f079..8ccab2c67a20 100644 --- a/drivers/net/sfc/falcon_xmac.c +++ b/drivers/net/sfc/falcon_xmac.c | |||
@@ -111,16 +111,12 @@ static void falcon_mask_status_intr(struct efx_nic *efx, bool enable) | |||
111 | efx_writeo(efx, ®, FR_AB_XM_MGT_INT_MASK); | 111 | efx_writeo(efx, ®, FR_AB_XM_MGT_INT_MASK); |
112 | } | 112 | } |
113 | 113 | ||
114 | /* Get status of XAUI link */ | 114 | static bool falcon_xgxs_link_ok(struct efx_nic *efx) |
115 | static bool falcon_xaui_link_ok(struct efx_nic *efx) | ||
116 | { | 115 | { |
117 | efx_oword_t reg; | 116 | efx_oword_t reg; |
118 | bool align_done, link_ok = false; | 117 | bool align_done, link_ok = false; |
119 | int sync_status; | 118 | int sync_status; |
120 | 119 | ||
121 | if (LOOPBACK_INTERNAL(efx)) | ||
122 | return true; | ||
123 | |||
124 | /* Read link status */ | 120 | /* Read link status */ |
125 | efx_reado(efx, ®, FR_AB_XX_CORE_STAT); | 121 | efx_reado(efx, ®, FR_AB_XX_CORE_STAT); |
126 | 122 | ||
@@ -135,14 +131,24 @@ static bool falcon_xaui_link_ok(struct efx_nic *efx) | |||
135 | EFX_SET_OWORD_FIELD(reg, FRF_AB_XX_DISPERR, FFE_AB_XX_STAT_ALL_LANES); | 131 | EFX_SET_OWORD_FIELD(reg, FRF_AB_XX_DISPERR, FFE_AB_XX_STAT_ALL_LANES); |
136 | efx_writeo(efx, ®, FR_AB_XX_CORE_STAT); | 132 | efx_writeo(efx, ®, FR_AB_XX_CORE_STAT); |
137 | 133 | ||
138 | /* If the link is up, then check the phy side of the xaui link */ | ||
139 | if (efx->link_state.up && link_ok) | ||
140 | if (efx->mdio.mmds & (1 << MDIO_MMD_PHYXS)) | ||
141 | link_ok = efx_mdio_phyxgxs_lane_sync(efx); | ||
142 | |||
143 | return link_ok; | 134 | return link_ok; |
144 | } | 135 | } |
145 | 136 | ||
137 | static bool falcon_xmac_link_ok(struct efx_nic *efx) | ||
138 | { | ||
139 | /* | ||
140 | * Check MAC's XGXS link status except when using XGMII loopback | ||
141 | * which bypasses the XGXS block. | ||
142 | * If possible, check PHY's XGXS link status except when using | ||
143 | * MAC loopback. | ||
144 | */ | ||
145 | return (efx->loopback_mode == LOOPBACK_XGMII || | ||
146 | falcon_xgxs_link_ok(efx)) && | ||
147 | (!(efx->mdio.mmds & (1 << MDIO_MMD_PHYXS)) || | ||
148 | LOOPBACK_INTERNAL(efx) || | ||
149 | efx_mdio_phyxgxs_lane_sync(efx)); | ||
150 | } | ||
151 | |||
146 | void falcon_reconfigure_xmac_core(struct efx_nic *efx) | 152 | void falcon_reconfigure_xmac_core(struct efx_nic *efx) |
147 | { | 153 | { |
148 | unsigned int max_frame_len; | 154 | unsigned int max_frame_len; |
@@ -245,9 +251,9 @@ static void falcon_reconfigure_xgxs_core(struct efx_nic *efx) | |||
245 | 251 | ||
246 | 252 | ||
247 | /* Try to bring up the Falcon side of the Falcon-Phy XAUI link */ | 253 | /* Try to bring up the Falcon side of the Falcon-Phy XAUI link */ |
248 | static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries) | 254 | static bool falcon_xmac_link_ok_retry(struct efx_nic *efx, int tries) |
249 | { | 255 | { |
250 | bool mac_up = falcon_xaui_link_ok(efx); | 256 | bool mac_up = falcon_xmac_link_ok(efx); |
251 | 257 | ||
252 | if (LOOPBACK_MASK(efx) & LOOPBACKS_EXTERNAL(efx) & LOOPBACKS_WS || | 258 | if (LOOPBACK_MASK(efx) & LOOPBACKS_EXTERNAL(efx) & LOOPBACKS_WS || |
253 | efx_phy_mode_disabled(efx->phy_mode)) | 259 | efx_phy_mode_disabled(efx->phy_mode)) |
@@ -261,7 +267,7 @@ static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries) | |||
261 | falcon_reset_xaui(efx); | 267 | falcon_reset_xaui(efx); |
262 | udelay(200); | 268 | udelay(200); |
263 | 269 | ||
264 | mac_up = falcon_xaui_link_ok(efx); | 270 | mac_up = falcon_xmac_link_ok(efx); |
265 | --tries; | 271 | --tries; |
266 | } | 272 | } |
267 | 273 | ||
@@ -272,7 +278,7 @@ static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries) | |||
272 | 278 | ||
273 | static bool falcon_xmac_check_fault(struct efx_nic *efx) | 279 | static bool falcon_xmac_check_fault(struct efx_nic *efx) |
274 | { | 280 | { |
275 | return !falcon_check_xaui_link_up(efx, 5); | 281 | return !falcon_xmac_link_ok_retry(efx, 5); |
276 | } | 282 | } |
277 | 283 | ||
278 | static int falcon_reconfigure_xmac(struct efx_nic *efx) | 284 | static int falcon_reconfigure_xmac(struct efx_nic *efx) |
@@ -284,7 +290,7 @@ static int falcon_reconfigure_xmac(struct efx_nic *efx) | |||
284 | 290 | ||
285 | falcon_reconfigure_mac_wrapper(efx); | 291 | falcon_reconfigure_mac_wrapper(efx); |
286 | 292 | ||
287 | efx->xmac_poll_required = !falcon_check_xaui_link_up(efx, 5); | 293 | efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 5); |
288 | falcon_mask_status_intr(efx, true); | 294 | falcon_mask_status_intr(efx, true); |
289 | 295 | ||
290 | return 0; | 296 | return 0; |
@@ -357,7 +363,7 @@ void falcon_poll_xmac(struct efx_nic *efx) | |||
357 | return; | 363 | return; |
358 | 364 | ||
359 | falcon_mask_status_intr(efx, false); | 365 | falcon_mask_status_intr(efx, false); |
360 | efx->xmac_poll_required = !falcon_check_xaui_link_up(efx, 1); | 366 | efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1); |
361 | falcon_mask_status_intr(efx, true); | 367 | falcon_mask_status_intr(efx, true); |
362 | } | 368 | } |
363 | 369 | ||
diff --git a/drivers/net/sfc/mcdi_phy.c b/drivers/net/sfc/mcdi_phy.c index 0e1bcc5a0d52..eb694af7a473 100644 --- a/drivers/net/sfc/mcdi_phy.c +++ b/drivers/net/sfc/mcdi_phy.c | |||
@@ -304,31 +304,47 @@ static u32 mcdi_to_ethtool_media(u32 media) | |||
304 | 304 | ||
305 | static int efx_mcdi_phy_probe(struct efx_nic *efx) | 305 | static int efx_mcdi_phy_probe(struct efx_nic *efx) |
306 | { | 306 | { |
307 | struct efx_mcdi_phy_cfg *phy_cfg; | 307 | struct efx_mcdi_phy_cfg *phy_data; |
308 | u8 outbuf[MC_CMD_GET_LINK_OUT_LEN]; | ||
309 | u32 caps; | ||
308 | int rc; | 310 | int rc; |
309 | 311 | ||
310 | /* TODO: Move phy_data initialisation to | 312 | /* Initialise and populate phy_data */ |
311 | * phy_op->probe/remove, rather than init/fini */ | 313 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); |
312 | phy_cfg = kzalloc(sizeof(*phy_cfg), GFP_KERNEL); | 314 | if (phy_data == NULL) |
313 | if (phy_cfg == NULL) { | 315 | return -ENOMEM; |
314 | rc = -ENOMEM; | 316 | |
315 | goto fail_alloc; | 317 | rc = efx_mcdi_get_phy_cfg(efx, phy_data); |
316 | } | ||
317 | rc = efx_mcdi_get_phy_cfg(efx, phy_cfg); | ||
318 | if (rc != 0) | 318 | if (rc != 0) |
319 | goto fail; | 319 | goto fail; |
320 | 320 | ||
321 | efx->phy_type = phy_cfg->type; | 321 | /* Read initial link advertisement */ |
322 | BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0); | ||
323 | rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, | ||
324 | outbuf, sizeof(outbuf), NULL); | ||
325 | if (rc) | ||
326 | goto fail; | ||
327 | |||
328 | /* Fill out nic state */ | ||
329 | efx->phy_data = phy_data; | ||
330 | efx->phy_type = phy_data->type; | ||
322 | 331 | ||
323 | efx->mdio_bus = phy_cfg->channel; | 332 | efx->mdio_bus = phy_data->channel; |
324 | efx->mdio.prtad = phy_cfg->port; | 333 | efx->mdio.prtad = phy_data->port; |
325 | efx->mdio.mmds = phy_cfg->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22); | 334 | efx->mdio.mmds = phy_data->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22); |
326 | efx->mdio.mode_support = 0; | 335 | efx->mdio.mode_support = 0; |
327 | if (phy_cfg->mmd_mask & (1 << MC_CMD_MMD_CLAUSE22)) | 336 | if (phy_data->mmd_mask & (1 << MC_CMD_MMD_CLAUSE22)) |
328 | efx->mdio.mode_support |= MDIO_SUPPORTS_C22; | 337 | efx->mdio.mode_support |= MDIO_SUPPORTS_C22; |
329 | if (phy_cfg->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22)) | 338 | if (phy_data->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22)) |
330 | efx->mdio.mode_support |= MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | 339 | efx->mdio.mode_support |= MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; |
331 | 340 | ||
341 | caps = MCDI_DWORD(outbuf, GET_LINK_OUT_CAP); | ||
342 | if (caps & (1 << MC_CMD_PHY_CAP_AN_LBN)) | ||
343 | efx->link_advertising = | ||
344 | mcdi_to_ethtool_cap(phy_data->media, caps); | ||
345 | else | ||
346 | phy_data->forced_cap = caps; | ||
347 | |||
332 | /* Assert that we can map efx -> mcdi loopback modes */ | 348 | /* Assert that we can map efx -> mcdi loopback modes */ |
333 | BUILD_BUG_ON(LOOPBACK_NONE != MC_CMD_LOOPBACK_NONE); | 349 | BUILD_BUG_ON(LOOPBACK_NONE != MC_CMD_LOOPBACK_NONE); |
334 | BUILD_BUG_ON(LOOPBACK_DATA != MC_CMD_LOOPBACK_DATA); | 350 | BUILD_BUG_ON(LOOPBACK_DATA != MC_CMD_LOOPBACK_DATA); |
@@ -365,46 +381,6 @@ static int efx_mcdi_phy_probe(struct efx_nic *efx) | |||
365 | * but by convention we don't */ | 381 | * but by convention we don't */ |
366 | efx->loopback_modes &= ~(1 << LOOPBACK_NONE); | 382 | efx->loopback_modes &= ~(1 << LOOPBACK_NONE); |
367 | 383 | ||
368 | kfree(phy_cfg); | ||
369 | |||
370 | return 0; | ||
371 | |||
372 | fail: | ||
373 | kfree(phy_cfg); | ||
374 | fail_alloc: | ||
375 | return rc; | ||
376 | } | ||
377 | |||
378 | static int efx_mcdi_phy_init(struct efx_nic *efx) | ||
379 | { | ||
380 | struct efx_mcdi_phy_cfg *phy_data; | ||
381 | u8 outbuf[MC_CMD_GET_LINK_OUT_LEN]; | ||
382 | u32 caps; | ||
383 | int rc; | ||
384 | |||
385 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); | ||
386 | if (phy_data == NULL) | ||
387 | return -ENOMEM; | ||
388 | |||
389 | rc = efx_mcdi_get_phy_cfg(efx, phy_data); | ||
390 | if (rc != 0) | ||
391 | goto fail; | ||
392 | |||
393 | efx->phy_data = phy_data; | ||
394 | |||
395 | BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0); | ||
396 | rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0, | ||
397 | outbuf, sizeof(outbuf), NULL); | ||
398 | if (rc) | ||
399 | goto fail; | ||
400 | |||
401 | caps = MCDI_DWORD(outbuf, GET_LINK_OUT_CAP); | ||
402 | if (caps & (1 << MC_CMD_PHY_CAP_AN_LBN)) | ||
403 | efx->link_advertising = | ||
404 | mcdi_to_ethtool_cap(phy_data->media, caps); | ||
405 | else | ||
406 | phy_data->forced_cap = caps; | ||
407 | |||
408 | return 0; | 384 | return 0; |
409 | 385 | ||
410 | fail: | 386 | fail: |
@@ -504,7 +480,7 @@ static bool efx_mcdi_phy_poll(struct efx_nic *efx) | |||
504 | return !efx_link_state_equal(&efx->link_state, &old_state); | 480 | return !efx_link_state_equal(&efx->link_state, &old_state); |
505 | } | 481 | } |
506 | 482 | ||
507 | static void efx_mcdi_phy_fini(struct efx_nic *efx) | 483 | static void efx_mcdi_phy_remove(struct efx_nic *efx) |
508 | { | 484 | { |
509 | struct efx_mcdi_phy_data *phy_data = efx->phy_data; | 485 | struct efx_mcdi_phy_data *phy_data = efx->phy_data; |
510 | 486 | ||
@@ -586,10 +562,11 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec | |||
586 | 562 | ||
587 | struct efx_phy_operations efx_mcdi_phy_ops = { | 563 | struct efx_phy_operations efx_mcdi_phy_ops = { |
588 | .probe = efx_mcdi_phy_probe, | 564 | .probe = efx_mcdi_phy_probe, |
589 | .init = efx_mcdi_phy_init, | 565 | .init = efx_port_dummy_op_int, |
590 | .reconfigure = efx_mcdi_phy_reconfigure, | 566 | .reconfigure = efx_mcdi_phy_reconfigure, |
591 | .poll = efx_mcdi_phy_poll, | 567 | .poll = efx_mcdi_phy_poll, |
592 | .fini = efx_mcdi_phy_fini, | 568 | .fini = efx_port_dummy_op_void, |
569 | .remove = efx_mcdi_phy_remove, | ||
593 | .get_settings = efx_mcdi_phy_get_settings, | 570 | .get_settings = efx_mcdi_phy_get_settings, |
594 | .set_settings = efx_mcdi_phy_set_settings, | 571 | .set_settings = efx_mcdi_phy_set_settings, |
595 | .run_tests = NULL, | 572 | .run_tests = NULL, |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 34c381f009b7..d5aab5b3fa06 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -524,6 +524,7 @@ struct efx_phy_operations { | |||
524 | int (*probe) (struct efx_nic *efx); | 524 | int (*probe) (struct efx_nic *efx); |
525 | int (*init) (struct efx_nic *efx); | 525 | int (*init) (struct efx_nic *efx); |
526 | void (*fini) (struct efx_nic *efx); | 526 | void (*fini) (struct efx_nic *efx); |
527 | void (*remove) (struct efx_nic *efx); | ||
527 | int (*reconfigure) (struct efx_nic *efx); | 528 | int (*reconfigure) (struct efx_nic *efx); |
528 | bool (*poll) (struct efx_nic *efx); | 529 | bool (*poll) (struct efx_nic *efx); |
529 | void (*get_settings) (struct efx_nic *efx, | 530 | void (*get_settings) (struct efx_nic *efx, |
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c index a577be227862..db44224ed2ca 100644 --- a/drivers/net/sfc/nic.c +++ b/drivers/net/sfc/nic.c | |||
@@ -1576,6 +1576,8 @@ void efx_nic_init_common(struct efx_nic *efx) | |||
1576 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_SOFT_EVT_EN, 1); | 1576 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_SOFT_EVT_EN, 1); |
1577 | /* Prefetch threshold 2 => fetch when descriptor cache half empty */ | 1577 | /* Prefetch threshold 2 => fetch when descriptor cache half empty */ |
1578 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_PREF_THRESHOLD, 2); | 1578 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_PREF_THRESHOLD, 2); |
1579 | /* Disable hardware watchdog which can misfire */ | ||
1580 | EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_PREF_WD_TMR, 0x3fffff); | ||
1579 | /* Squash TX of packets of 16 bytes or less */ | 1581 | /* Squash TX of packets of 16 bytes or less */ |
1580 | if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) | 1582 | if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) |
1581 | EFX_SET_OWORD_FIELD(temp, FRF_BZ_TX_FLUSH_MIN_LEN_EN, 1); | 1583 | EFX_SET_OWORD_FIELD(temp, FRF_BZ_TX_FLUSH_MIN_LEN_EN, 1); |
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c index 3800fc791b2f..ff8f0a417fa3 100644 --- a/drivers/net/sfc/qt202x_phy.c +++ b/drivers/net/sfc/qt202x_phy.c | |||
@@ -33,6 +33,9 @@ | |||
33 | #define PCS_FW_HEARTBEAT_REG 0xd7ee | 33 | #define PCS_FW_HEARTBEAT_REG 0xd7ee |
34 | #define PCS_FW_HEARTB_LBN 0 | 34 | #define PCS_FW_HEARTB_LBN 0 |
35 | #define PCS_FW_HEARTB_WIDTH 8 | 35 | #define PCS_FW_HEARTB_WIDTH 8 |
36 | #define PCS_FW_PRODUCT_CODE_1 0xd7f0 | ||
37 | #define PCS_FW_VERSION_1 0xd7f3 | ||
38 | #define PCS_FW_BUILD_1 0xd7f6 | ||
36 | #define PCS_UC8051_STATUS_REG 0xd7fd | 39 | #define PCS_UC8051_STATUS_REG 0xd7fd |
37 | #define PCS_UC_STATUS_LBN 0 | 40 | #define PCS_UC_STATUS_LBN 0 |
38 | #define PCS_UC_STATUS_WIDTH 8 | 41 | #define PCS_UC_STATUS_WIDTH 8 |
@@ -52,14 +55,24 @@ void falcon_qt202x_set_led(struct efx_nic *p, int led, int mode) | |||
52 | 55 | ||
53 | struct qt202x_phy_data { | 56 | struct qt202x_phy_data { |
54 | enum efx_phy_mode phy_mode; | 57 | enum efx_phy_mode phy_mode; |
58 | bool bug17190_in_bad_state; | ||
59 | unsigned long bug17190_timer; | ||
60 | u32 firmware_ver; | ||
55 | }; | 61 | }; |
56 | 62 | ||
57 | #define QT2022C2_MAX_RESET_TIME 500 | 63 | #define QT2022C2_MAX_RESET_TIME 500 |
58 | #define QT2022C2_RESET_WAIT 10 | 64 | #define QT2022C2_RESET_WAIT 10 |
59 | 65 | ||
60 | static int qt2025c_wait_reset(struct efx_nic *efx) | 66 | #define QT2025C_MAX_HEARTB_TIME (5 * HZ) |
67 | #define QT2025C_HEARTB_WAIT 100 | ||
68 | #define QT2025C_MAX_FWSTART_TIME (25 * HZ / 10) | ||
69 | #define QT2025C_FWSTART_WAIT 100 | ||
70 | |||
71 | #define BUG17190_INTERVAL (2 * HZ) | ||
72 | |||
73 | static int qt2025c_wait_heartbeat(struct efx_nic *efx) | ||
61 | { | 74 | { |
62 | unsigned long timeout = jiffies + 10 * HZ; | 75 | unsigned long timeout = jiffies + QT2025C_MAX_HEARTB_TIME; |
63 | int reg, old_counter = 0; | 76 | int reg, old_counter = 0; |
64 | 77 | ||
65 | /* Wait for firmware heartbeat to start */ | 78 | /* Wait for firmware heartbeat to start */ |
@@ -74,11 +87,25 @@ static int qt2025c_wait_reset(struct efx_nic *efx) | |||
74 | old_counter = counter; | 87 | old_counter = counter; |
75 | else if (counter != old_counter) | 88 | else if (counter != old_counter) |
76 | break; | 89 | break; |
77 | if (time_after(jiffies, timeout)) | 90 | if (time_after(jiffies, timeout)) { |
91 | /* Some cables have EEPROMs that conflict with the | ||
92 | * PHY's on-board EEPROM so it cannot load firmware */ | ||
93 | EFX_ERR(efx, "If an SFP+ direct attach cable is" | ||
94 | " connected, please check that it complies" | ||
95 | " with the SFP+ specification\n"); | ||
78 | return -ETIMEDOUT; | 96 | return -ETIMEDOUT; |
79 | msleep(10); | 97 | } |
98 | msleep(QT2025C_HEARTB_WAIT); | ||
80 | } | 99 | } |
81 | 100 | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static int qt2025c_wait_fw_status_good(struct efx_nic *efx) | ||
105 | { | ||
106 | unsigned long timeout = jiffies + QT2025C_MAX_FWSTART_TIME; | ||
107 | int reg; | ||
108 | |||
82 | /* Wait for firmware status to look good */ | 109 | /* Wait for firmware status to look good */ |
83 | for (;;) { | 110 | for (;;) { |
84 | reg = efx_mdio_read(efx, MDIO_MMD_PCS, PCS_UC8051_STATUS_REG); | 111 | reg = efx_mdio_read(efx, MDIO_MMD_PCS, PCS_UC8051_STATUS_REG); |
@@ -90,7 +117,178 @@ static int qt2025c_wait_reset(struct efx_nic *efx) | |||
90 | break; | 117 | break; |
91 | if (time_after(jiffies, timeout)) | 118 | if (time_after(jiffies, timeout)) |
92 | return -ETIMEDOUT; | 119 | return -ETIMEDOUT; |
120 | msleep(QT2025C_FWSTART_WAIT); | ||
121 | } | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static void qt2025c_restart_firmware(struct efx_nic *efx) | ||
127 | { | ||
128 | /* Restart microcontroller execution of firmware from RAM */ | ||
129 | efx_mdio_write(efx, 3, 0xe854, 0x00c0); | ||
130 | efx_mdio_write(efx, 3, 0xe854, 0x0040); | ||
131 | msleep(50); | ||
132 | } | ||
133 | |||
134 | static int qt2025c_wait_reset(struct efx_nic *efx) | ||
135 | { | ||
136 | int rc; | ||
137 | |||
138 | rc = qt2025c_wait_heartbeat(efx); | ||
139 | if (rc != 0) | ||
140 | return rc; | ||
141 | |||
142 | rc = qt2025c_wait_fw_status_good(efx); | ||
143 | if (rc == -ETIMEDOUT) { | ||
144 | /* Bug 17689: occasionally heartbeat starts but firmware status | ||
145 | * code never progresses beyond 0x00. Try again, once, after | ||
146 | * restarting execution of the firmware image. */ | ||
147 | EFX_LOG(efx, "bashing QT2025C microcontroller\n"); | ||
148 | qt2025c_restart_firmware(efx); | ||
149 | rc = qt2025c_wait_heartbeat(efx); | ||
150 | if (rc != 0) | ||
151 | return rc; | ||
152 | rc = qt2025c_wait_fw_status_good(efx); | ||
153 | } | ||
154 | |||
155 | return rc; | ||
156 | } | ||
157 | |||
158 | static void qt2025c_firmware_id(struct efx_nic *efx) | ||
159 | { | ||
160 | struct qt202x_phy_data *phy_data = efx->phy_data; | ||
161 | u8 firmware_id[9]; | ||
162 | size_t i; | ||
163 | |||
164 | for (i = 0; i < sizeof(firmware_id); i++) | ||
165 | firmware_id[i] = efx_mdio_read(efx, MDIO_MMD_PCS, | ||
166 | PCS_FW_PRODUCT_CODE_1 + i); | ||
167 | EFX_INFO(efx, "QT2025C firmware %xr%d v%d.%d.%d.%d [20%02d-%02d-%02d]\n", | ||
168 | (firmware_id[0] << 8) | firmware_id[1], firmware_id[2], | ||
169 | firmware_id[3] >> 4, firmware_id[3] & 0xf, | ||
170 | firmware_id[4], firmware_id[5], | ||
171 | firmware_id[6], firmware_id[7], firmware_id[8]); | ||
172 | phy_data->firmware_ver = ((firmware_id[3] & 0xf0) << 20) | | ||
173 | ((firmware_id[3] & 0x0f) << 16) | | ||
174 | (firmware_id[4] << 8) | firmware_id[5]; | ||
175 | } | ||
176 | |||
177 | static void qt2025c_bug17190_workaround(struct efx_nic *efx) | ||
178 | { | ||
179 | struct qt202x_phy_data *phy_data = efx->phy_data; | ||
180 | |||
181 | /* The PHY can get stuck in a state where it reports PHY_XS and PMA/PMD | ||
182 | * layers up, but PCS down (no block_lock). If we notice this state | ||
183 | * persisting for a couple of seconds, we switch PMA/PMD loopback | ||
184 | * briefly on and then off again, which is normally sufficient to | ||
185 | * recover it. | ||
186 | */ | ||
187 | if (efx->link_state.up || | ||
188 | !efx_mdio_links_ok(efx, MDIO_DEVS_PMAPMD | MDIO_DEVS_PHYXS)) { | ||
189 | phy_data->bug17190_in_bad_state = false; | ||
190 | return; | ||
191 | } | ||
192 | |||
193 | if (!phy_data->bug17190_in_bad_state) { | ||
194 | phy_data->bug17190_in_bad_state = true; | ||
195 | phy_data->bug17190_timer = jiffies + BUG17190_INTERVAL; | ||
196 | return; | ||
197 | } | ||
198 | |||
199 | if (time_after_eq(jiffies, phy_data->bug17190_timer)) { | ||
200 | EFX_LOG(efx, "bashing QT2025C PMA/PMD\n"); | ||
201 | efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1, | ||
202 | MDIO_PMA_CTRL1_LOOPBACK, true); | ||
93 | msleep(100); | 203 | msleep(100); |
204 | efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1, | ||
205 | MDIO_PMA_CTRL1_LOOPBACK, false); | ||
206 | phy_data->bug17190_timer = jiffies + BUG17190_INTERVAL; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | static int qt2025c_select_phy_mode(struct efx_nic *efx) | ||
211 | { | ||
212 | struct qt202x_phy_data *phy_data = efx->phy_data; | ||
213 | struct falcon_board *board = falcon_board(efx); | ||
214 | int reg, rc, i; | ||
215 | uint16_t phy_op_mode; | ||
216 | |||
217 | /* Only 2.0.1.0+ PHY firmware supports the more optimal SFP+ | ||
218 | * Self-Configure mode. Don't attempt any switching if we encounter | ||
219 | * older firmware. */ | ||
220 | if (phy_data->firmware_ver < 0x02000100) | ||
221 | return 0; | ||
222 | |||
223 | /* In general we will get optimal behaviour in "SFP+ Self-Configure" | ||
224 | * mode; however, that powers down most of the PHY when no module is | ||
225 | * present, so we must use a different mode (any fixed mode will do) | ||
226 | * to be sure that loopbacks will work. */ | ||
227 | phy_op_mode = (efx->loopback_mode == LOOPBACK_NONE) ? 0x0038 : 0x0020; | ||
228 | |||
229 | /* Only change mode if really necessary */ | ||
230 | reg = efx_mdio_read(efx, 1, 0xc319); | ||
231 | if ((reg & 0x0038) == phy_op_mode) | ||
232 | return 0; | ||
233 | EFX_LOG(efx, "Switching PHY to mode 0x%04x\n", phy_op_mode); | ||
234 | |||
235 | /* This sequence replicates the register writes configured in the boot | ||
236 | * EEPROM (including the differences between board revisions), except | ||
237 | * that the operating mode is changed, and the PHY is prevented from | ||
238 | * unnecessarily reloading the main firmware image again. */ | ||
239 | efx_mdio_write(efx, 1, 0xc300, 0x0000); | ||
240 | /* (Note: this portion of the boot EEPROM sequence, which bit-bashes 9 | ||
241 | * STOPs onto the firmware/module I2C bus to reset it, varies across | ||
242 | * board revisions, as the bus is connected to different GPIO/LED | ||
243 | * outputs on the PHY.) */ | ||
244 | if (board->major == 0 && board->minor < 2) { | ||
245 | efx_mdio_write(efx, 1, 0xc303, 0x4498); | ||
246 | for (i = 0; i < 9; i++) { | ||
247 | efx_mdio_write(efx, 1, 0xc303, 0x4488); | ||
248 | efx_mdio_write(efx, 1, 0xc303, 0x4480); | ||
249 | efx_mdio_write(efx, 1, 0xc303, 0x4490); | ||
250 | efx_mdio_write(efx, 1, 0xc303, 0x4498); | ||
251 | } | ||
252 | } else { | ||
253 | efx_mdio_write(efx, 1, 0xc303, 0x0920); | ||
254 | efx_mdio_write(efx, 1, 0xd008, 0x0004); | ||
255 | for (i = 0; i < 9; i++) { | ||
256 | efx_mdio_write(efx, 1, 0xc303, 0x0900); | ||
257 | efx_mdio_write(efx, 1, 0xd008, 0x0005); | ||
258 | efx_mdio_write(efx, 1, 0xc303, 0x0920); | ||
259 | efx_mdio_write(efx, 1, 0xd008, 0x0004); | ||
260 | } | ||
261 | efx_mdio_write(efx, 1, 0xc303, 0x4900); | ||
262 | } | ||
263 | efx_mdio_write(efx, 1, 0xc303, 0x4900); | ||
264 | efx_mdio_write(efx, 1, 0xc302, 0x0004); | ||
265 | efx_mdio_write(efx, 1, 0xc316, 0x0013); | ||
266 | efx_mdio_write(efx, 1, 0xc318, 0x0054); | ||
267 | efx_mdio_write(efx, 1, 0xc319, phy_op_mode); | ||
268 | efx_mdio_write(efx, 1, 0xc31a, 0x0098); | ||
269 | efx_mdio_write(efx, 3, 0x0026, 0x0e00); | ||
270 | efx_mdio_write(efx, 3, 0x0027, 0x0013); | ||
271 | efx_mdio_write(efx, 3, 0x0028, 0xa528); | ||
272 | efx_mdio_write(efx, 1, 0xd006, 0x000a); | ||
273 | efx_mdio_write(efx, 1, 0xd007, 0x0009); | ||
274 | efx_mdio_write(efx, 1, 0xd008, 0x0004); | ||
275 | /* This additional write is not present in the boot EEPROM. It | ||
276 | * prevents the PHY's internal boot ROM doing another pointless (and | ||
277 | * slow) reload of the firmware image (the microcontroller's code | ||
278 | * memory is not affected by the microcontroller reset). */ | ||
279 | efx_mdio_write(efx, 1, 0xc317, 0x00ff); | ||
280 | efx_mdio_write(efx, 1, 0xc300, 0x0002); | ||
281 | msleep(20); | ||
282 | |||
283 | /* Restart microcontroller execution of firmware from RAM */ | ||
284 | qt2025c_restart_firmware(efx); | ||
285 | |||
286 | /* Wait for the microcontroller to be ready again */ | ||
287 | rc = qt2025c_wait_reset(efx); | ||
288 | if (rc < 0) { | ||
289 | EFX_ERR(efx, "PHY microcontroller reset during mode switch " | ||
290 | "timed out\n"); | ||
291 | return rc; | ||
94 | } | 292 | } |
95 | 293 | ||
96 | return 0; | 294 | return 0; |
@@ -137,6 +335,16 @@ static int qt202x_reset_phy(struct efx_nic *efx) | |||
137 | 335 | ||
138 | static int qt202x_phy_probe(struct efx_nic *efx) | 336 | static int qt202x_phy_probe(struct efx_nic *efx) |
139 | { | 337 | { |
338 | struct qt202x_phy_data *phy_data; | ||
339 | |||
340 | phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL); | ||
341 | if (!phy_data) | ||
342 | return -ENOMEM; | ||
343 | efx->phy_data = phy_data; | ||
344 | phy_data->phy_mode = efx->phy_mode; | ||
345 | phy_data->bug17190_in_bad_state = false; | ||
346 | phy_data->bug17190_timer = 0; | ||
347 | |||
140 | efx->mdio.mmds = QT202X_REQUIRED_DEVS; | 348 | efx->mdio.mmds = QT202X_REQUIRED_DEVS; |
141 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | 349 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; |
142 | efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS; | 350 | efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS; |
@@ -145,7 +353,6 @@ static int qt202x_phy_probe(struct efx_nic *efx) | |||
145 | 353 | ||
146 | static int qt202x_phy_init(struct efx_nic *efx) | 354 | static int qt202x_phy_init(struct efx_nic *efx) |
147 | { | 355 | { |
148 | struct qt202x_phy_data *phy_data; | ||
149 | u32 devid; | 356 | u32 devid; |
150 | int rc; | 357 | int rc; |
151 | 358 | ||
@@ -155,17 +362,14 @@ static int qt202x_phy_init(struct efx_nic *efx) | |||
155 | return rc; | 362 | return rc; |
156 | } | 363 | } |
157 | 364 | ||
158 | phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL); | ||
159 | if (!phy_data) | ||
160 | return -ENOMEM; | ||
161 | efx->phy_data = phy_data; | ||
162 | |||
163 | devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); | 365 | devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); |
164 | EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", | 366 | EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", |
165 | devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), | 367 | devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), |
166 | efx_mdio_id_rev(devid)); | 368 | efx_mdio_id_rev(devid)); |
167 | 369 | ||
168 | phy_data->phy_mode = efx->phy_mode; | 370 | if (efx->phy_type == PHY_TYPE_QT2025C) |
371 | qt2025c_firmware_id(efx); | ||
372 | |||
169 | return 0; | 373 | return 0; |
170 | } | 374 | } |
171 | 375 | ||
@@ -183,6 +387,9 @@ static bool qt202x_phy_poll(struct efx_nic *efx) | |||
183 | efx->link_state.fd = true; | 387 | efx->link_state.fd = true; |
184 | efx->link_state.fc = efx->wanted_fc; | 388 | efx->link_state.fc = efx->wanted_fc; |
185 | 389 | ||
390 | if (efx->phy_type == PHY_TYPE_QT2025C) | ||
391 | qt2025c_bug17190_workaround(efx); | ||
392 | |||
186 | return efx->link_state.up != was_up; | 393 | return efx->link_state.up != was_up; |
187 | } | 394 | } |
188 | 395 | ||
@@ -191,6 +398,10 @@ static int qt202x_phy_reconfigure(struct efx_nic *efx) | |||
191 | struct qt202x_phy_data *phy_data = efx->phy_data; | 398 | struct qt202x_phy_data *phy_data = efx->phy_data; |
192 | 399 | ||
193 | if (efx->phy_type == PHY_TYPE_QT2025C) { | 400 | if (efx->phy_type == PHY_TYPE_QT2025C) { |
401 | int rc = qt2025c_select_phy_mode(efx); | ||
402 | if (rc) | ||
403 | return rc; | ||
404 | |||
194 | /* There are several different register bits which can | 405 | /* There are several different register bits which can |
195 | * disable TX (and save power) on direct-attach cables | 406 | * disable TX (and save power) on direct-attach cables |
196 | * or optical transceivers, varying somewhat between | 407 | * or optical transceivers, varying somewhat between |
@@ -224,7 +435,7 @@ static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecm | |||
224 | mdio45_ethtool_gset(&efx->mdio, ecmd); | 435 | mdio45_ethtool_gset(&efx->mdio, ecmd); |
225 | } | 436 | } |
226 | 437 | ||
227 | static void qt202x_phy_fini(struct efx_nic *efx) | 438 | static void qt202x_phy_remove(struct efx_nic *efx) |
228 | { | 439 | { |
229 | /* Free the context block */ | 440 | /* Free the context block */ |
230 | kfree(efx->phy_data); | 441 | kfree(efx->phy_data); |
@@ -236,7 +447,8 @@ struct efx_phy_operations falcon_qt202x_phy_ops = { | |||
236 | .init = qt202x_phy_init, | 447 | .init = qt202x_phy_init, |
237 | .reconfigure = qt202x_phy_reconfigure, | 448 | .reconfigure = qt202x_phy_reconfigure, |
238 | .poll = qt202x_phy_poll, | 449 | .poll = qt202x_phy_poll, |
239 | .fini = qt202x_phy_fini, | 450 | .fini = efx_port_dummy_op_void, |
451 | .remove = qt202x_phy_remove, | ||
240 | .get_settings = qt202x_phy_get_settings, | 452 | .get_settings = qt202x_phy_get_settings, |
241 | .set_settings = efx_mdio_set_settings, | 453 | .set_settings = efx_mdio_set_settings, |
242 | }; | 454 | }; |
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index de07a4f031b2..f8c6771e66d8 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
@@ -133,6 +133,7 @@ static int siena_probe_port(struct efx_nic *efx) | |||
133 | 133 | ||
134 | void siena_remove_port(struct efx_nic *efx) | 134 | void siena_remove_port(struct efx_nic *efx) |
135 | { | 135 | { |
136 | efx->phy_op->remove(efx); | ||
136 | efx_nic_free_buffer(efx, &efx->stats_buffer); | 137 | efx_nic_free_buffer(efx, &efx->stats_buffer); |
137 | } | 138 | } |
138 | 139 | ||
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index ca11572a49a9..3009c297c135 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -202,10 +202,14 @@ static ssize_t set_phy_short_reach(struct device *dev, | |||
202 | int rc; | 202 | int rc; |
203 | 203 | ||
204 | rtnl_lock(); | 204 | rtnl_lock(); |
205 | efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TXPWR, | 205 | if (efx->state != STATE_RUNNING) { |
206 | MDIO_PMA_10GBT_TXPWR_SHORT, | 206 | rc = -EBUSY; |
207 | count != 0 && *buf != '0'); | 207 | } else { |
208 | rc = efx_reconfigure_port(efx); | 208 | efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TXPWR, |
209 | MDIO_PMA_10GBT_TXPWR_SHORT, | ||
210 | count != 0 && *buf != '0'); | ||
211 | rc = efx_reconfigure_port(efx); | ||
212 | } | ||
209 | rtnl_unlock(); | 213 | rtnl_unlock(); |
210 | 214 | ||
211 | return rc < 0 ? rc : (ssize_t)count; | 215 | return rc < 0 ? rc : (ssize_t)count; |
@@ -298,36 +302,62 @@ static int tenxpress_init(struct efx_nic *efx) | |||
298 | return 0; | 302 | return 0; |
299 | } | 303 | } |
300 | 304 | ||
301 | static int sfx7101_phy_probe(struct efx_nic *efx) | 305 | static int tenxpress_phy_probe(struct efx_nic *efx) |
302 | { | 306 | { |
303 | efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS; | 307 | struct tenxpress_phy_data *phy_data; |
304 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | 308 | int rc; |
305 | efx->loopback_modes = SFX7101_LOOPBACKS | FALCON_XMAC_LOOPBACKS; | 309 | |
306 | return 0; | 310 | /* Allocate phy private storage */ |
307 | } | 311 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); |
312 | if (!phy_data) | ||
313 | return -ENOMEM; | ||
314 | efx->phy_data = phy_data; | ||
315 | phy_data->phy_mode = efx->phy_mode; | ||
316 | |||
317 | /* Create any special files */ | ||
318 | if (efx->phy_type == PHY_TYPE_SFT9001B) { | ||
319 | rc = device_create_file(&efx->pci_dev->dev, | ||
320 | &dev_attr_phy_short_reach); | ||
321 | if (rc) | ||
322 | goto fail; | ||
323 | } | ||
324 | |||
325 | if (efx->phy_type == PHY_TYPE_SFX7101) { | ||
326 | efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS; | ||
327 | efx->mdio.mode_support = MDIO_SUPPORTS_C45; | ||
328 | |||
329 | efx->loopback_modes = SFX7101_LOOPBACKS | FALCON_XMAC_LOOPBACKS; | ||
330 | |||
331 | efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg | | ||
332 | ADVERTISED_10000baseT_Full); | ||
333 | } else { | ||
334 | efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS; | ||
335 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | ||
336 | |||
337 | efx->loopback_modes = (SFT9001_LOOPBACKS | | ||
338 | FALCON_XMAC_LOOPBACKS | | ||
339 | FALCON_GMAC_LOOPBACKS); | ||
340 | |||
341 | efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg | | ||
342 | ADVERTISED_10000baseT_Full | | ||
343 | ADVERTISED_1000baseT_Full | | ||
344 | ADVERTISED_100baseT_Full); | ||
345 | } | ||
308 | 346 | ||
309 | static int sft9001_phy_probe(struct efx_nic *efx) | ||
310 | { | ||
311 | efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS; | ||
312 | efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; | ||
313 | efx->loopback_modes = (SFT9001_LOOPBACKS | FALCON_XMAC_LOOPBACKS | | ||
314 | FALCON_GMAC_LOOPBACKS); | ||
315 | return 0; | 347 | return 0; |
348 | |||
349 | fail: | ||
350 | kfree(efx->phy_data); | ||
351 | efx->phy_data = NULL; | ||
352 | return rc; | ||
316 | } | 353 | } |
317 | 354 | ||
318 | static int tenxpress_phy_init(struct efx_nic *efx) | 355 | static int tenxpress_phy_init(struct efx_nic *efx) |
319 | { | 356 | { |
320 | struct tenxpress_phy_data *phy_data; | 357 | int rc; |
321 | int rc = 0; | ||
322 | 358 | ||
323 | falcon_board(efx)->type->init_phy(efx); | 359 | falcon_board(efx)->type->init_phy(efx); |
324 | 360 | ||
325 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); | ||
326 | if (!phy_data) | ||
327 | return -ENOMEM; | ||
328 | efx->phy_data = phy_data; | ||
329 | phy_data->phy_mode = efx->phy_mode; | ||
330 | |||
331 | if (!(efx->phy_mode & PHY_MODE_SPECIAL)) { | 361 | if (!(efx->phy_mode & PHY_MODE_SPECIAL)) { |
332 | if (efx->phy_type == PHY_TYPE_SFT9001A) { | 362 | if (efx->phy_type == PHY_TYPE_SFT9001A) { |
333 | int reg; | 363 | int reg; |
@@ -341,44 +371,27 @@ static int tenxpress_phy_init(struct efx_nic *efx) | |||
341 | 371 | ||
342 | rc = efx_mdio_wait_reset_mmds(efx, TENXPRESS_REQUIRED_DEVS); | 372 | rc = efx_mdio_wait_reset_mmds(efx, TENXPRESS_REQUIRED_DEVS); |
343 | if (rc < 0) | 373 | if (rc < 0) |
344 | goto fail; | 374 | return rc; |
345 | 375 | ||
346 | rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0); | 376 | rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0); |
347 | if (rc < 0) | 377 | if (rc < 0) |
348 | goto fail; | 378 | return rc; |
349 | } | 379 | } |
350 | 380 | ||
351 | rc = tenxpress_init(efx); | 381 | rc = tenxpress_init(efx); |
352 | if (rc < 0) | 382 | if (rc < 0) |
353 | goto fail; | 383 | return rc; |
354 | 384 | ||
355 | /* Initialise advertising flags */ | 385 | /* Reinitialise flow control settings */ |
356 | efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg | | ||
357 | ADVERTISED_10000baseT_Full); | ||
358 | if (efx->phy_type != PHY_TYPE_SFX7101) | ||
359 | efx->link_advertising |= (ADVERTISED_1000baseT_Full | | ||
360 | ADVERTISED_100baseT_Full); | ||
361 | efx_link_set_wanted_fc(efx, efx->wanted_fc); | 386 | efx_link_set_wanted_fc(efx, efx->wanted_fc); |
362 | efx_mdio_an_reconfigure(efx); | 387 | efx_mdio_an_reconfigure(efx); |
363 | 388 | ||
364 | if (efx->phy_type == PHY_TYPE_SFT9001B) { | ||
365 | rc = device_create_file(&efx->pci_dev->dev, | ||
366 | &dev_attr_phy_short_reach); | ||
367 | if (rc) | ||
368 | goto fail; | ||
369 | } | ||
370 | |||
371 | schedule_timeout_uninterruptible(HZ / 5); /* 200ms */ | 389 | schedule_timeout_uninterruptible(HZ / 5); /* 200ms */ |
372 | 390 | ||
373 | /* Let XGXS and SerDes out of reset */ | 391 | /* Let XGXS and SerDes out of reset */ |
374 | falcon_reset_xaui(efx); | 392 | falcon_reset_xaui(efx); |
375 | 393 | ||
376 | return 0; | 394 | return 0; |
377 | |||
378 | fail: | ||
379 | kfree(efx->phy_data); | ||
380 | efx->phy_data = NULL; | ||
381 | return rc; | ||
382 | } | 395 | } |
383 | 396 | ||
384 | /* Perform a "special software reset" on the PHY. The caller is | 397 | /* Perform a "special software reset" on the PHY. The caller is |
@@ -589,25 +602,26 @@ static bool tenxpress_phy_poll(struct efx_nic *efx) | |||
589 | return !efx_link_state_equal(&efx->link_state, &old_state); | 602 | return !efx_link_state_equal(&efx->link_state, &old_state); |
590 | } | 603 | } |
591 | 604 | ||
592 | static void tenxpress_phy_fini(struct efx_nic *efx) | 605 | static void sfx7101_phy_fini(struct efx_nic *efx) |
593 | { | 606 | { |
594 | int reg; | 607 | int reg; |
595 | 608 | ||
609 | /* Power down the LNPGA */ | ||
610 | reg = (1 << PMA_PMD_LNPGA_POWERDOWN_LBN); | ||
611 | efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG, reg); | ||
612 | |||
613 | /* Waiting here ensures that the board fini, which can turn | ||
614 | * off the power to the PHY, won't get run until the LNPGA | ||
615 | * powerdown has been given long enough to complete. */ | ||
616 | schedule_timeout_uninterruptible(LNPGA_PDOWN_WAIT); /* 200 ms */ | ||
617 | } | ||
618 | |||
619 | static void tenxpress_phy_remove(struct efx_nic *efx) | ||
620 | { | ||
596 | if (efx->phy_type == PHY_TYPE_SFT9001B) | 621 | if (efx->phy_type == PHY_TYPE_SFT9001B) |
597 | device_remove_file(&efx->pci_dev->dev, | 622 | device_remove_file(&efx->pci_dev->dev, |
598 | &dev_attr_phy_short_reach); | 623 | &dev_attr_phy_short_reach); |
599 | 624 | ||
600 | if (efx->phy_type == PHY_TYPE_SFX7101) { | ||
601 | /* Power down the LNPGA */ | ||
602 | reg = (1 << PMA_PMD_LNPGA_POWERDOWN_LBN); | ||
603 | efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG, reg); | ||
604 | |||
605 | /* Waiting here ensures that the board fini, which can turn | ||
606 | * off the power to the PHY, won't get run until the LNPGA | ||
607 | * powerdown has been given long enough to complete. */ | ||
608 | schedule_timeout_uninterruptible(LNPGA_PDOWN_WAIT); /* 200 ms */ | ||
609 | } | ||
610 | |||
611 | kfree(efx->phy_data); | 625 | kfree(efx->phy_data); |
612 | efx->phy_data = NULL; | 626 | efx->phy_data = NULL; |
613 | } | 627 | } |
@@ -819,11 +833,12 @@ static void sft9001_set_npage_adv(struct efx_nic *efx, u32 advertising) | |||
819 | } | 833 | } |
820 | 834 | ||
821 | struct efx_phy_operations falcon_sfx7101_phy_ops = { | 835 | struct efx_phy_operations falcon_sfx7101_phy_ops = { |
822 | .probe = sfx7101_phy_probe, | 836 | .probe = tenxpress_phy_probe, |
823 | .init = tenxpress_phy_init, | 837 | .init = tenxpress_phy_init, |
824 | .reconfigure = tenxpress_phy_reconfigure, | 838 | .reconfigure = tenxpress_phy_reconfigure, |
825 | .poll = tenxpress_phy_poll, | 839 | .poll = tenxpress_phy_poll, |
826 | .fini = tenxpress_phy_fini, | 840 | .fini = sfx7101_phy_fini, |
841 | .remove = tenxpress_phy_remove, | ||
827 | .get_settings = tenxpress_get_settings, | 842 | .get_settings = tenxpress_get_settings, |
828 | .set_settings = tenxpress_set_settings, | 843 | .set_settings = tenxpress_set_settings, |
829 | .set_npage_adv = sfx7101_set_npage_adv, | 844 | .set_npage_adv = sfx7101_set_npage_adv, |
@@ -832,11 +847,12 @@ struct efx_phy_operations falcon_sfx7101_phy_ops = { | |||
832 | }; | 847 | }; |
833 | 848 | ||
834 | struct efx_phy_operations falcon_sft9001_phy_ops = { | 849 | struct efx_phy_operations falcon_sft9001_phy_ops = { |
835 | .probe = sft9001_phy_probe, | 850 | .probe = tenxpress_phy_probe, |
836 | .init = tenxpress_phy_init, | 851 | .init = tenxpress_phy_init, |
837 | .reconfigure = tenxpress_phy_reconfigure, | 852 | .reconfigure = tenxpress_phy_reconfigure, |
838 | .poll = tenxpress_phy_poll, | 853 | .poll = tenxpress_phy_poll, |
839 | .fini = tenxpress_phy_fini, | 854 | .fini = efx_port_dummy_op_void, |
855 | .remove = tenxpress_phy_remove, | ||
840 | .get_settings = tenxpress_get_settings, | 856 | .get_settings = tenxpress_get_settings, |
841 | .set_settings = tenxpress_set_settings, | 857 | .set_settings = tenxpress_set_settings, |
842 | .set_npage_adv = sft9001_set_npage_adv, | 858 | .set_npage_adv = sft9001_set_npage_adv, |
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c index e669f94e821b..a8b70ef6d817 100644 --- a/drivers/net/sfc/tx.c +++ b/drivers/net/sfc/tx.c | |||
@@ -821,8 +821,6 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue) | |||
821 | EFX_TXQ_MASK]; | 821 | EFX_TXQ_MASK]; |
822 | efx_tsoh_free(tx_queue, buffer); | 822 | efx_tsoh_free(tx_queue, buffer); |
823 | EFX_BUG_ON_PARANOID(buffer->skb); | 823 | EFX_BUG_ON_PARANOID(buffer->skb); |
824 | buffer->len = 0; | ||
825 | buffer->continuation = true; | ||
826 | if (buffer->unmap_len) { | 824 | if (buffer->unmap_len) { |
827 | unmap_addr = (buffer->dma_addr + buffer->len - | 825 | unmap_addr = (buffer->dma_addr + buffer->len - |
828 | buffer->unmap_len); | 826 | buffer->unmap_len); |
@@ -836,6 +834,8 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue) | |||
836 | PCI_DMA_TODEVICE); | 834 | PCI_DMA_TODEVICE); |
837 | buffer->unmap_len = 0; | 835 | buffer->unmap_len = 0; |
838 | } | 836 | } |
837 | buffer->len = 0; | ||
838 | buffer->continuation = true; | ||
839 | } | 839 | } |
840 | } | 840 | } |
841 | 841 | ||
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 1c01b96c9611..2d28d58200d0 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -4684,6 +4684,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4684 | INIT_WORK(&hw->restart_work, sky2_restart); | 4684 | INIT_WORK(&hw->restart_work, sky2_restart); |
4685 | 4685 | ||
4686 | pci_set_drvdata(pdev, hw); | 4686 | pci_set_drvdata(pdev, hw); |
4687 | pdev->d3_delay = 150; | ||
4687 | 4688 | ||
4688 | return 0; | 4689 | return 0; |
4689 | 4690 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 01e99f22210e..2834a01bae24 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -849,13 +849,13 @@ static void tun_sock_write_space(struct sock *sk) | |||
849 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 849 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) |
850 | wake_up_interruptible_sync(sk->sk_sleep); | 850 | wake_up_interruptible_sync(sk->sk_sleep); |
851 | 851 | ||
852 | tun = container_of(sk, struct tun_sock, sk)->tun; | 852 | tun = tun_sk(sk)->tun; |
853 | kill_fasync(&tun->fasync, SIGIO, POLL_OUT); | 853 | kill_fasync(&tun->fasync, SIGIO, POLL_OUT); |
854 | } | 854 | } |
855 | 855 | ||
856 | static void tun_sock_destruct(struct sock *sk) | 856 | static void tun_sock_destruct(struct sock *sk) |
857 | { | 857 | { |
858 | free_netdev(container_of(sk, struct tun_sock, sk)->tun->dev); | 858 | free_netdev(tun_sk(sk)->tun->dev); |
859 | } | 859 | } |
860 | 860 | ||
861 | static struct proto tun_proto = { | 861 | static struct proto tun_proto = { |
@@ -990,7 +990,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
990 | sk->sk_write_space = tun_sock_write_space; | 990 | sk->sk_write_space = tun_sock_write_space; |
991 | sk->sk_sndbuf = INT_MAX; | 991 | sk->sk_sndbuf = INT_MAX; |
992 | 992 | ||
993 | container_of(sk, struct tun_sock, sk)->tun = tun; | 993 | tun_sk(sk)->tun = tun; |
994 | 994 | ||
995 | security_tun_dev_post_create(sk); | 995 | security_tun_dev_post_create(sk); |
996 | 996 | ||
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index afaf088b72ea..41ad2f3697c7 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -1563,7 +1563,10 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode) | |||
1563 | 1563 | ||
1564 | static void ugeth_quiesce(struct ucc_geth_private *ugeth) | 1564 | static void ugeth_quiesce(struct ucc_geth_private *ugeth) |
1565 | { | 1565 | { |
1566 | /* Wait for and prevent any further xmits. */ | 1566 | /* Prevent any further xmits, plus detach the device. */ |
1567 | netif_device_detach(ugeth->ndev); | ||
1568 | |||
1569 | /* Wait for any current xmits to finish. */ | ||
1567 | netif_tx_disable(ugeth->ndev); | 1570 | netif_tx_disable(ugeth->ndev); |
1568 | 1571 | ||
1569 | /* Disable the interrupt to avoid NAPI rescheduling. */ | 1572 | /* Disable the interrupt to avoid NAPI rescheduling. */ |
@@ -1577,7 +1580,7 @@ static void ugeth_activate(struct ucc_geth_private *ugeth) | |||
1577 | { | 1580 | { |
1578 | napi_enable(&ugeth->napi); | 1581 | napi_enable(&ugeth->napi); |
1579 | enable_irq(ugeth->ug_info->uf_info.irq); | 1582 | enable_irq(ugeth->ug_info->uf_info.irq); |
1580 | netif_tx_wake_all_queues(ugeth->ndev); | 1583 | netif_device_attach(ugeth->ndev); |
1581 | } | 1584 | } |
1582 | 1585 | ||
1583 | /* Called every time the controller might need to be made | 1586 | /* Called every time the controller might need to be made |
@@ -1648,25 +1651,28 @@ static void adjust_link(struct net_device *dev) | |||
1648 | ugeth->oldspeed = phydev->speed; | 1651 | ugeth->oldspeed = phydev->speed; |
1649 | } | 1652 | } |
1650 | 1653 | ||
1651 | /* | ||
1652 | * To change the MAC configuration we need to disable the | ||
1653 | * controller. To do so, we have to either grab ugeth->lock, | ||
1654 | * which is a bad idea since 'graceful stop' commands might | ||
1655 | * take quite a while, or we can quiesce driver's activity. | ||
1656 | */ | ||
1657 | ugeth_quiesce(ugeth); | ||
1658 | ugeth_disable(ugeth, COMM_DIR_RX_AND_TX); | ||
1659 | |||
1660 | out_be32(&ug_regs->maccfg2, tempval); | ||
1661 | out_be32(&uf_regs->upsmr, upsmr); | ||
1662 | |||
1663 | ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); | ||
1664 | ugeth_activate(ugeth); | ||
1665 | |||
1666 | if (!ugeth->oldlink) { | 1654 | if (!ugeth->oldlink) { |
1667 | new_state = 1; | 1655 | new_state = 1; |
1668 | ugeth->oldlink = 1; | 1656 | ugeth->oldlink = 1; |
1669 | } | 1657 | } |
1658 | |||
1659 | if (new_state) { | ||
1660 | /* | ||
1661 | * To change the MAC configuration we need to disable | ||
1662 | * the controller. To do so, we have to either grab | ||
1663 | * ugeth->lock, which is a bad idea since 'graceful | ||
1664 | * stop' commands might take quite a while, or we can | ||
1665 | * quiesce driver's activity. | ||
1666 | */ | ||
1667 | ugeth_quiesce(ugeth); | ||
1668 | ugeth_disable(ugeth, COMM_DIR_RX_AND_TX); | ||
1669 | |||
1670 | out_be32(&ug_regs->maccfg2, tempval); | ||
1671 | out_be32(&uf_regs->upsmr, upsmr); | ||
1672 | |||
1673 | ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); | ||
1674 | ugeth_activate(ugeth); | ||
1675 | } | ||
1670 | } else if (ugeth->oldlink) { | 1676 | } else if (ugeth->oldlink) { |
1671 | new_state = 1; | 1677 | new_state = 1; |
1672 | ugeth->oldlink = 0; | 1678 | ugeth->oldlink = 0; |
@@ -3273,7 +3279,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ) | |||
3273 | /* Handle the transmitted buffer and release */ | 3279 | /* Handle the transmitted buffer and release */ |
3274 | /* the BD to be used with the current frame */ | 3280 | /* the BD to be used with the current frame */ |
3275 | 3281 | ||
3276 | if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0)) | 3282 | if (bd == ugeth->txBd[txQ]) /* queue empty? */ |
3277 | break; | 3283 | break; |
3278 | 3284 | ||
3279 | dev->stats.tx_packets++; | 3285 | dev->stats.tx_packets++; |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 593e01f64e9b..611b80435955 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -102,6 +102,7 @@ static const int multicast_filter_limit = 32; | |||
102 | #include <linux/ethtool.h> | 102 | #include <linux/ethtool.h> |
103 | #include <linux/crc32.h> | 103 | #include <linux/crc32.h> |
104 | #include <linux/bitops.h> | 104 | #include <linux/bitops.h> |
105 | #include <linux/workqueue.h> | ||
105 | #include <asm/processor.h> /* Processor type for cache alignment. */ | 106 | #include <asm/processor.h> /* Processor type for cache alignment. */ |
106 | #include <asm/io.h> | 107 | #include <asm/io.h> |
107 | #include <asm/irq.h> | 108 | #include <asm/irq.h> |
@@ -389,6 +390,7 @@ struct rhine_private { | |||
389 | struct net_device *dev; | 390 | struct net_device *dev; |
390 | struct napi_struct napi; | 391 | struct napi_struct napi; |
391 | spinlock_t lock; | 392 | spinlock_t lock; |
393 | struct work_struct reset_task; | ||
392 | 394 | ||
393 | /* Frequently used values: keep some adjacent for cache effect. */ | 395 | /* Frequently used values: keep some adjacent for cache effect. */ |
394 | u32 quirks; | 396 | u32 quirks; |
@@ -407,6 +409,7 @@ struct rhine_private { | |||
407 | static int mdio_read(struct net_device *dev, int phy_id, int location); | 409 | static int mdio_read(struct net_device *dev, int phy_id, int location); |
408 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); | 410 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); |
409 | static int rhine_open(struct net_device *dev); | 411 | static int rhine_open(struct net_device *dev); |
412 | static void rhine_reset_task(struct work_struct *work); | ||
410 | static void rhine_tx_timeout(struct net_device *dev); | 413 | static void rhine_tx_timeout(struct net_device *dev); |
411 | static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | 414 | static netdev_tx_t rhine_start_tx(struct sk_buff *skb, |
412 | struct net_device *dev); | 415 | struct net_device *dev); |
@@ -775,6 +778,8 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
775 | dev->irq = pdev->irq; | 778 | dev->irq = pdev->irq; |
776 | 779 | ||
777 | spin_lock_init(&rp->lock); | 780 | spin_lock_init(&rp->lock); |
781 | INIT_WORK(&rp->reset_task, rhine_reset_task); | ||
782 | |||
778 | rp->mii_if.dev = dev; | 783 | rp->mii_if.dev = dev; |
779 | rp->mii_if.mdio_read = mdio_read; | 784 | rp->mii_if.mdio_read = mdio_read; |
780 | rp->mii_if.mdio_write = mdio_write; | 785 | rp->mii_if.mdio_write = mdio_write; |
@@ -1179,22 +1184,18 @@ static int rhine_open(struct net_device *dev) | |||
1179 | return 0; | 1184 | return 0; |
1180 | } | 1185 | } |
1181 | 1186 | ||
1182 | static void rhine_tx_timeout(struct net_device *dev) | 1187 | static void rhine_reset_task(struct work_struct *work) |
1183 | { | 1188 | { |
1184 | struct rhine_private *rp = netdev_priv(dev); | 1189 | struct rhine_private *rp = container_of(work, struct rhine_private, |
1185 | void __iomem *ioaddr = rp->base; | 1190 | reset_task); |
1186 | 1191 | struct net_device *dev = rp->dev; | |
1187 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " | ||
1188 | "%4.4x, resetting...\n", | ||
1189 | dev->name, ioread16(ioaddr + IntrStatus), | ||
1190 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); | ||
1191 | 1192 | ||
1192 | /* protect against concurrent rx interrupts */ | 1193 | /* protect against concurrent rx interrupts */ |
1193 | disable_irq(rp->pdev->irq); | 1194 | disable_irq(rp->pdev->irq); |
1194 | 1195 | ||
1195 | napi_disable(&rp->napi); | 1196 | napi_disable(&rp->napi); |
1196 | 1197 | ||
1197 | spin_lock(&rp->lock); | 1198 | spin_lock_bh(&rp->lock); |
1198 | 1199 | ||
1199 | /* clear all descriptors */ | 1200 | /* clear all descriptors */ |
1200 | free_tbufs(dev); | 1201 | free_tbufs(dev); |
@@ -1206,7 +1207,7 @@ static void rhine_tx_timeout(struct net_device *dev) | |||
1206 | rhine_chip_reset(dev); | 1207 | rhine_chip_reset(dev); |
1207 | init_registers(dev); | 1208 | init_registers(dev); |
1208 | 1209 | ||
1209 | spin_unlock(&rp->lock); | 1210 | spin_unlock_bh(&rp->lock); |
1210 | enable_irq(rp->pdev->irq); | 1211 | enable_irq(rp->pdev->irq); |
1211 | 1212 | ||
1212 | dev->trans_start = jiffies; | 1213 | dev->trans_start = jiffies; |
@@ -1214,6 +1215,19 @@ static void rhine_tx_timeout(struct net_device *dev) | |||
1214 | netif_wake_queue(dev); | 1215 | netif_wake_queue(dev); |
1215 | } | 1216 | } |
1216 | 1217 | ||
1218 | static void rhine_tx_timeout(struct net_device *dev) | ||
1219 | { | ||
1220 | struct rhine_private *rp = netdev_priv(dev); | ||
1221 | void __iomem *ioaddr = rp->base; | ||
1222 | |||
1223 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " | ||
1224 | "%4.4x, resetting...\n", | ||
1225 | dev->name, ioread16(ioaddr + IntrStatus), | ||
1226 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); | ||
1227 | |||
1228 | schedule_work(&rp->reset_task); | ||
1229 | } | ||
1230 | |||
1217 | static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | 1231 | static netdev_tx_t rhine_start_tx(struct sk_buff *skb, |
1218 | struct net_device *dev) | 1232 | struct net_device *dev) |
1219 | { | 1233 | { |
@@ -1830,10 +1844,11 @@ static int rhine_close(struct net_device *dev) | |||
1830 | struct rhine_private *rp = netdev_priv(dev); | 1844 | struct rhine_private *rp = netdev_priv(dev); |
1831 | void __iomem *ioaddr = rp->base; | 1845 | void __iomem *ioaddr = rp->base; |
1832 | 1846 | ||
1833 | spin_lock_irq(&rp->lock); | ||
1834 | |||
1835 | netif_stop_queue(dev); | ||
1836 | napi_disable(&rp->napi); | 1847 | napi_disable(&rp->napi); |
1848 | cancel_work_sync(&rp->reset_task); | ||
1849 | netif_stop_queue(dev); | ||
1850 | |||
1851 | spin_lock_irq(&rp->lock); | ||
1837 | 1852 | ||
1838 | if (debug > 1) | 1853 | if (debug > 1) |
1839 | printk(KERN_DEBUG "%s: Shutting down ethercard, " | 1854 | printk(KERN_DEBUG "%s: Shutting down ethercard, " |
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index f1c4b2a1e867..0fdfd58a35a1 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -4087,21 +4087,21 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4087 | goto _exit0; | 4087 | goto _exit0; |
4088 | } | 4088 | } |
4089 | 4089 | ||
4090 | if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { | 4090 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { |
4091 | vxge_debug_ll_config(VXGE_TRACE, | 4091 | vxge_debug_ll_config(VXGE_TRACE, |
4092 | "%s : using 64bit DMA", __func__); | 4092 | "%s : using 64bit DMA", __func__); |
4093 | 4093 | ||
4094 | high_dma = 1; | 4094 | high_dma = 1; |
4095 | 4095 | ||
4096 | if (pci_set_consistent_dma_mask(pdev, | 4096 | if (pci_set_consistent_dma_mask(pdev, |
4097 | 0xffffffffffffffffULL)) { | 4097 | DMA_BIT_MASK(64))) { |
4098 | vxge_debug_init(VXGE_ERR, | 4098 | vxge_debug_init(VXGE_ERR, |
4099 | "%s : unable to obtain 64bit DMA for " | 4099 | "%s : unable to obtain 64bit DMA for " |
4100 | "consistent allocations", __func__); | 4100 | "consistent allocations", __func__); |
4101 | ret = -ENOMEM; | 4101 | ret = -ENOMEM; |
4102 | goto _exit1; | 4102 | goto _exit1; |
4103 | } | 4103 | } |
4104 | } else if (!pci_set_dma_mask(pdev, 0xffffffffUL)) { | 4104 | } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
4105 | vxge_debug_ll_config(VXGE_TRACE, | 4105 | vxge_debug_ll_config(VXGE_TRACE, |
4106 | "%s : using 32bit DMA", __func__); | 4106 | "%s : using 32bit DMA", __func__); |
4107 | } else { | 4107 | } else { |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index a4c086f069b1..e63b7c40d0ee 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1903,17 +1903,6 @@ accept: | |||
1903 | rxs->noise = sc->ah->ah_noise_floor; | 1903 | rxs->noise = sc->ah->ah_noise_floor; |
1904 | rxs->signal = rxs->noise + rs.rs_rssi; | 1904 | rxs->signal = rxs->noise + rs.rs_rssi; |
1905 | 1905 | ||
1906 | /* An rssi of 35 indicates you should be able use | ||
1907 | * 54 Mbps reliably. A more elaborate scheme can be used | ||
1908 | * here but it requires a map of SNR/throughput for each | ||
1909 | * possible mode used */ | ||
1910 | rxs->qual = rs.rs_rssi * 100 / 35; | ||
1911 | |||
1912 | /* rssi can be more than 35 though, anything above that | ||
1913 | * should be considered at 100% */ | ||
1914 | if (rxs->qual > 100) | ||
1915 | rxs->qual = 100; | ||
1916 | |||
1917 | rxs->antenna = rs.rs_antenna; | 1906 | rxs->antenna = rs.rs_antenna; |
1918 | rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate); | 1907 | rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate); |
1919 | rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs); | 1908 | rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs); |
@@ -2381,6 +2370,9 @@ ath5k_init(struct ath5k_softc *sc) | |||
2381 | */ | 2370 | */ |
2382 | ath5k_stop_locked(sc); | 2371 | ath5k_stop_locked(sc); |
2383 | 2372 | ||
2373 | /* Set PHY calibration interval */ | ||
2374 | ah->ah_cal_intval = ath5k_calinterval; | ||
2375 | |||
2384 | /* | 2376 | /* |
2385 | * The basic interface to setting the hardware in a good | 2377 | * The basic interface to setting the hardware in a good |
2386 | * state is ``reset''. On return the hardware is known to | 2378 | * state is ``reset''. On return the hardware is known to |
@@ -2408,10 +2400,6 @@ ath5k_init(struct ath5k_softc *sc) | |||
2408 | 2400 | ||
2409 | /* Set ack to be sent at low bit-rates */ | 2401 | /* Set ack to be sent at low bit-rates */ |
2410 | ath5k_hw_set_ack_bitrate_high(ah, false); | 2402 | ath5k_hw_set_ack_bitrate_high(ah, false); |
2411 | |||
2412 | /* Set PHY calibration inteval */ | ||
2413 | ah->ah_cal_intval = ath5k_calinterval; | ||
2414 | |||
2415 | ret = 0; | 2403 | ret = 0; |
2416 | done: | 2404 | done: |
2417 | mmiowb(); | 2405 | mmiowb(); |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 71b84d91dcff..efc420cd42bf 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -186,7 +186,7 @@ bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q) | |||
186 | wait = wait_time; | 186 | wait = wait_time; |
187 | while (ath9k_hw_numtxpending(ah, q)) { | 187 | while (ath9k_hw_numtxpending(ah, q)) { |
188 | if ((--wait) == 0) { | 188 | if ((--wait) == 0) { |
189 | ath_print(common, ATH_DBG_QUEUE, | 189 | ath_print(common, ATH_DBG_FATAL, |
190 | "Failed to stop TX DMA in 100 " | 190 | "Failed to stop TX DMA in 100 " |
191 | "msec after killing last frame\n"); | 191 | "msec after killing last frame\n"); |
192 | break; | 192 | break; |
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index 0c87771383f0..e185479e295e 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h | |||
@@ -77,6 +77,9 @@ | |||
77 | #define ATH9K_TXERR_XTXOP 0x08 | 77 | #define ATH9K_TXERR_XTXOP 0x08 |
78 | #define ATH9K_TXERR_TIMER_EXPIRED 0x10 | 78 | #define ATH9K_TXERR_TIMER_EXPIRED 0x10 |
79 | #define ATH9K_TX_ACKED 0x20 | 79 | #define ATH9K_TX_ACKED 0x20 |
80 | #define ATH9K_TXERR_MASK \ | ||
81 | (ATH9K_TXERR_XRETRY | ATH9K_TXERR_FILT | ATH9K_TXERR_FIFO | \ | ||
82 | ATH9K_TXERR_XTXOP | ATH9K_TXERR_TIMER_EXPIRED) | ||
80 | 83 | ||
81 | #define ATH9K_TX_BA 0x01 | 84 | #define ATH9K_TX_BA 0x01 |
82 | #define ATH9K_TX_PWRMGMT 0x02 | 85 | #define ATH9K_TX_PWRMGMT 0x02 |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index c48743452515..996eb90263cc 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1973,6 +1973,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
1973 | struct ieee80211_hw *hw = sc->hw; | 1973 | struct ieee80211_hw *hw = sc->hw; |
1974 | int r; | 1974 | int r; |
1975 | 1975 | ||
1976 | /* Stop ANI */ | ||
1977 | del_timer_sync(&common->ani.timer); | ||
1978 | |||
1976 | ath9k_hw_set_interrupts(ah, 0); | 1979 | ath9k_hw_set_interrupts(ah, 0); |
1977 | ath_drain_all_txq(sc, retry_tx); | 1980 | ath_drain_all_txq(sc, retry_tx); |
1978 | ath_stoprecv(sc); | 1981 | ath_stoprecv(sc); |
@@ -2014,6 +2017,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
2014 | } | 2017 | } |
2015 | } | 2018 | } |
2016 | 2019 | ||
2020 | /* Start ANI */ | ||
2021 | ath_start_ani(common); | ||
2022 | |||
2017 | return r; | 2023 | return r; |
2018 | } | 2024 | } |
2019 | 2025 | ||
@@ -2508,6 +2514,9 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2508 | return; /* another wiphy still in use */ | 2514 | return; /* another wiphy still in use */ |
2509 | } | 2515 | } |
2510 | 2516 | ||
2517 | /* Ensure HW is awake when we try to shut it down. */ | ||
2518 | ath9k_ps_wakeup(sc); | ||
2519 | |||
2511 | if (ah->btcoex_hw.enabled) { | 2520 | if (ah->btcoex_hw.enabled) { |
2512 | ath9k_hw_btcoex_disable(ah); | 2521 | ath9k_hw_btcoex_disable(ah); |
2513 | if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) | 2522 | if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) |
@@ -2528,6 +2537,9 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2528 | /* disable HAL and put h/w to sleep */ | 2537 | /* disable HAL and put h/w to sleep */ |
2529 | ath9k_hw_disable(ah); | 2538 | ath9k_hw_disable(ah); |
2530 | ath9k_hw_configpcipowersave(ah, 1, 1); | 2539 | ath9k_hw_configpcipowersave(ah, 1, 1); |
2540 | ath9k_ps_restore(sc); | ||
2541 | |||
2542 | /* Finally, put the chip in FULL SLEEP mode */ | ||
2531 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); | 2543 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); |
2532 | 2544 | ||
2533 | sc->sc_flags |= SC_OP_INVALID; | 2545 | sc->sc_flags |= SC_OP_INVALID; |
@@ -2641,8 +2653,10 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
2641 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || | 2653 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || |
2642 | (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || | 2654 | (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || |
2643 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { | 2655 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { |
2656 | ath9k_ps_wakeup(sc); | ||
2644 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | 2657 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); |
2645 | ath_beacon_return(sc, avp); | 2658 | ath_beacon_return(sc, avp); |
2659 | ath9k_ps_restore(sc); | ||
2646 | } | 2660 | } |
2647 | 2661 | ||
2648 | sc->sc_flags &= ~SC_OP_BEACONS; | 2662 | sc->sc_flags &= ~SC_OP_BEACONS; |
@@ -3091,15 +3105,21 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
3091 | case IEEE80211_AMPDU_RX_STOP: | 3105 | case IEEE80211_AMPDU_RX_STOP: |
3092 | break; | 3106 | break; |
3093 | case IEEE80211_AMPDU_TX_START: | 3107 | case IEEE80211_AMPDU_TX_START: |
3108 | ath9k_ps_wakeup(sc); | ||
3094 | ath_tx_aggr_start(sc, sta, tid, ssn); | 3109 | ath_tx_aggr_start(sc, sta, tid, ssn); |
3095 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 3110 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
3111 | ath9k_ps_restore(sc); | ||
3096 | break; | 3112 | break; |
3097 | case IEEE80211_AMPDU_TX_STOP: | 3113 | case IEEE80211_AMPDU_TX_STOP: |
3114 | ath9k_ps_wakeup(sc); | ||
3098 | ath_tx_aggr_stop(sc, sta, tid); | 3115 | ath_tx_aggr_stop(sc, sta, tid); |
3099 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 3116 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
3117 | ath9k_ps_restore(sc); | ||
3100 | break; | 3118 | break; |
3101 | case IEEE80211_AMPDU_TX_OPERATIONAL: | 3119 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
3120 | ath9k_ps_wakeup(sc); | ||
3102 | ath_tx_aggr_resume(sc, sta, tid); | 3121 | ath_tx_aggr_resume(sc, sta, tid); |
3122 | ath9k_ps_restore(sc); | ||
3103 | break; | 3123 | break; |
3104 | default: | 3124 | default: |
3105 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, | 3125 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 5321f735e5a0..f7af5ea54753 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -96,7 +96,7 @@ static void ath_pci_bt_coex_prep(struct ath_common *common) | |||
96 | pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm); | 96 | pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm); |
97 | } | 97 | } |
98 | 98 | ||
99 | const static struct ath_bus_ops ath_pci_bus_ops = { | 99 | static const struct ath_bus_ops ath_pci_bus_ops = { |
100 | .read_cachesize = ath_pci_read_cachesize, | 100 | .read_cachesize = ath_pci_read_cachesize, |
101 | .cleanup = ath_pci_cleanup, | 101 | .cleanup = ath_pci_cleanup, |
102 | .eeprom_read = ath_pci_eeprom_read, | 102 | .eeprom_read = ath_pci_eeprom_read, |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 2a11cc57ceea..fa12b9060b0b 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1108,11 +1108,11 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) | |||
1108 | if (npend) { | 1108 | if (npend) { |
1109 | int r; | 1109 | int r; |
1110 | 1110 | ||
1111 | ath_print(common, ATH_DBG_XMIT, | 1111 | ath_print(common, ATH_DBG_FATAL, |
1112 | "Unable to stop TxDMA. Reset HAL!\n"); | 1112 | "Unable to stop TxDMA. Reset HAL!\n"); |
1113 | 1113 | ||
1114 | spin_lock_bh(&sc->sc_resetlock); | 1114 | spin_lock_bh(&sc->sc_resetlock); |
1115 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, true); | 1115 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false); |
1116 | if (r) | 1116 | if (r) |
1117 | ath_print(common, ATH_DBG_FATAL, | 1117 | ath_print(common, ATH_DBG_FATAL, |
1118 | "Unable to reset hardware; reset status %d\n", | 1118 | "Unable to reset hardware; reset status %d\n", |
@@ -1414,17 +1414,9 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb, | |||
1414 | * For HT capable stations, we save tidno for later use. | 1414 | * For HT capable stations, we save tidno for later use. |
1415 | * We also override seqno set by upper layer with the one | 1415 | * We also override seqno set by upper layer with the one |
1416 | * in tx aggregation state. | 1416 | * in tx aggregation state. |
1417 | * | ||
1418 | * If fragmentation is on, the sequence number is | ||
1419 | * not overridden, since it has been | ||
1420 | * incremented by the fragmentation routine. | ||
1421 | * | ||
1422 | * FIXME: check if the fragmentation threshold exceeds | ||
1423 | * IEEE80211 max. | ||
1424 | */ | 1417 | */ |
1425 | tid = ATH_AN_2_TID(an, bf->bf_tidno); | 1418 | tid = ATH_AN_2_TID(an, bf->bf_tidno); |
1426 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << | 1419 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); |
1427 | IEEE80211_SEQ_SEQ_SHIFT); | ||
1428 | bf->bf_seqno = tid->seq_next; | 1420 | bf->bf_seqno = tid->seq_next; |
1429 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | 1421 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); |
1430 | } | 1422 | } |
@@ -1636,7 +1628,8 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf, | |||
1636 | bf->bf_keyix = ATH9K_TXKEYIX_INVALID; | 1628 | bf->bf_keyix = ATH9K_TXKEYIX_INVALID; |
1637 | } | 1629 | } |
1638 | 1630 | ||
1639 | if (ieee80211_is_data_qos(fc) && (sc->sc_flags & SC_OP_TXAGGR)) | 1631 | if (ieee80211_is_data_qos(fc) && bf_isht(bf) && |
1632 | (sc->sc_flags & SC_OP_TXAGGR)) | ||
1640 | assign_aggr_tid_seqno(skb, bf); | 1633 | assign_aggr_tid_seqno(skb, bf); |
1641 | 1634 | ||
1642 | bf->bf_mpdu = skb; | 1635 | bf->bf_mpdu = skb; |
@@ -1780,7 +1773,8 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1780 | struct ath_wiphy *aphy = hw->priv; | 1773 | struct ath_wiphy *aphy = hw->priv; |
1781 | struct ath_softc *sc = aphy->sc; | 1774 | struct ath_softc *sc = aphy->sc; |
1782 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1775 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1783 | int hdrlen, padsize; | 1776 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
1777 | int padpos, padsize; | ||
1784 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1778 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1785 | struct ath_tx_control txctl; | 1779 | struct ath_tx_control txctl; |
1786 | 1780 | ||
@@ -1792,7 +1786,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1792 | * BSSes. | 1786 | * BSSes. |
1793 | */ | 1787 | */ |
1794 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | 1788 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
1795 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
1796 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | 1789 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) |
1797 | sc->tx.seq_no += 0x10; | 1790 | sc->tx.seq_no += 0x10; |
1798 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | 1791 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); |
@@ -1800,9 +1793,9 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1800 | } | 1793 | } |
1801 | 1794 | ||
1802 | /* Add the padding after the header if this is not already done */ | 1795 | /* Add the padding after the header if this is not already done */ |
1803 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 1796 | padpos = ath9k_cmn_padpos(hdr->frame_control); |
1804 | if (hdrlen & 3) { | 1797 | padsize = padpos & 3; |
1805 | padsize = hdrlen % 4; | 1798 | if (padsize && skb->len>padpos) { |
1806 | if (skb_headroom(skb) < padsize) { | 1799 | if (skb_headroom(skb) < padsize) { |
1807 | ath_print(common, ATH_DBG_XMIT, | 1800 | ath_print(common, ATH_DBG_XMIT, |
1808 | "TX CABQ padding failed\n"); | 1801 | "TX CABQ padding failed\n"); |
@@ -1810,7 +1803,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1810 | return; | 1803 | return; |
1811 | } | 1804 | } |
1812 | skb_push(skb, padsize); | 1805 | skb_push(skb, padsize); |
1813 | memmove(skb->data, skb->data + padsize, hdrlen); | 1806 | memmove(skb->data, skb->data + padsize, padpos); |
1814 | } | 1807 | } |
1815 | 1808 | ||
1816 | txctl.txq = sc->beacon.cabq; | 1809 | txctl.txq = sc->beacon.cabq; |
@@ -1838,7 +1831,8 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
1838 | struct ieee80211_hw *hw = sc->hw; | 1831 | struct ieee80211_hw *hw = sc->hw; |
1839 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 1832 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
1840 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1833 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1841 | int hdrlen, padsize; | 1834 | struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; |
1835 | int padpos, padsize; | ||
1842 | 1836 | ||
1843 | ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); | 1837 | ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); |
1844 | 1838 | ||
@@ -1853,14 +1847,14 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
1853 | tx_info->flags |= IEEE80211_TX_STAT_ACK; | 1847 | tx_info->flags |= IEEE80211_TX_STAT_ACK; |
1854 | } | 1848 | } |
1855 | 1849 | ||
1856 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 1850 | padpos = ath9k_cmn_padpos(hdr->frame_control); |
1857 | padsize = hdrlen & 3; | 1851 | padsize = padpos & 3; |
1858 | if (padsize && hdrlen >= 24) { | 1852 | if (padsize && skb->len>padpos+padsize) { |
1859 | /* | 1853 | /* |
1860 | * Remove MAC header padding before giving the frame back to | 1854 | * Remove MAC header padding before giving the frame back to |
1861 | * mac80211. | 1855 | * mac80211. |
1862 | */ | 1856 | */ |
1863 | memmove(skb->data + padsize, skb->data, hdrlen); | 1857 | memmove(skb->data + padsize, skb->data, padpos); |
1864 | skb_pull(skb, padsize); | 1858 | skb_pull(skb, padsize); |
1865 | } | 1859 | } |
1866 | 1860 | ||
@@ -2078,7 +2072,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2078 | &txq->axq_q, lastbf->list.prev); | 2072 | &txq->axq_q, lastbf->list.prev); |
2079 | 2073 | ||
2080 | txq->axq_depth--; | 2074 | txq->axq_depth--; |
2081 | txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_FILT); | 2075 | txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_MASK); |
2082 | txq->axq_tx_inprogress = false; | 2076 | txq->axq_tx_inprogress = false; |
2083 | spin_unlock_bh(&txq->axq_lock); | 2077 | spin_unlock_bh(&txq->axq_lock); |
2084 | 2078 | ||
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 027be275e035..88d1fd02d40a 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -383,160 +383,44 @@ static inline | |||
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | /* Check if a DMA region fits the device constraints. | ||
387 | * Returns true, if the region is OK for usage with this device. */ | ||
388 | static inline bool b43_dma_address_ok(struct b43_dmaring *ring, | ||
389 | dma_addr_t addr, size_t size) | ||
390 | { | ||
391 | switch (ring->type) { | ||
392 | case B43_DMA_30BIT: | ||
393 | if ((u64)addr + size > (1ULL << 30)) | ||
394 | return 0; | ||
395 | break; | ||
396 | case B43_DMA_32BIT: | ||
397 | if ((u64)addr + size > (1ULL << 32)) | ||
398 | return 0; | ||
399 | break; | ||
400 | case B43_DMA_64BIT: | ||
401 | /* Currently we can't have addresses beyond | ||
402 | * 64bit in the kernel. */ | ||
403 | break; | ||
404 | } | ||
405 | return 1; | ||
406 | } | ||
407 | |||
408 | #define is_4k_aligned(addr) (((u64)(addr) & 0x0FFFull) == 0) | ||
409 | #define is_8k_aligned(addr) (((u64)(addr) & 0x1FFFull) == 0) | ||
410 | |||
411 | static void b43_unmap_and_free_ringmem(struct b43_dmaring *ring, void *base, | ||
412 | dma_addr_t dmaaddr, size_t size) | ||
413 | { | ||
414 | ssb_dma_unmap_single(ring->dev->dev, dmaaddr, size, DMA_TO_DEVICE); | ||
415 | free_pages((unsigned long)base, get_order(size)); | ||
416 | } | ||
417 | |||
418 | static void * __b43_get_and_map_ringmem(struct b43_dmaring *ring, | ||
419 | dma_addr_t *dmaaddr, size_t size, | ||
420 | gfp_t gfp_flags) | ||
421 | { | ||
422 | void *base; | ||
423 | |||
424 | base = (void *)__get_free_pages(gfp_flags, get_order(size)); | ||
425 | if (!base) | ||
426 | return NULL; | ||
427 | memset(base, 0, size); | ||
428 | *dmaaddr = ssb_dma_map_single(ring->dev->dev, base, size, | ||
429 | DMA_TO_DEVICE); | ||
430 | if (ssb_dma_mapping_error(ring->dev->dev, *dmaaddr)) { | ||
431 | free_pages((unsigned long)base, get_order(size)); | ||
432 | return NULL; | ||
433 | } | ||
434 | |||
435 | return base; | ||
436 | } | ||
437 | |||
438 | static void * b43_get_and_map_ringmem(struct b43_dmaring *ring, | ||
439 | dma_addr_t *dmaaddr, size_t size) | ||
440 | { | ||
441 | void *base; | ||
442 | |||
443 | base = __b43_get_and_map_ringmem(ring, dmaaddr, size, | ||
444 | GFP_KERNEL); | ||
445 | if (!base) { | ||
446 | b43err(ring->dev->wl, "Failed to allocate or map pages " | ||
447 | "for DMA ringmemory\n"); | ||
448 | return NULL; | ||
449 | } | ||
450 | if (!b43_dma_address_ok(ring, *dmaaddr, size)) { | ||
451 | /* The memory does not fit our device constraints. | ||
452 | * Retry with GFP_DMA set to get lower memory. */ | ||
453 | b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size); | ||
454 | base = __b43_get_and_map_ringmem(ring, dmaaddr, size, | ||
455 | GFP_KERNEL | GFP_DMA); | ||
456 | if (!base) { | ||
457 | b43err(ring->dev->wl, "Failed to allocate or map pages " | ||
458 | "in the GFP_DMA region for DMA ringmemory\n"); | ||
459 | return NULL; | ||
460 | } | ||
461 | if (!b43_dma_address_ok(ring, *dmaaddr, size)) { | ||
462 | b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size); | ||
463 | b43err(ring->dev->wl, "Failed to allocate DMA " | ||
464 | "ringmemory that fits device constraints\n"); | ||
465 | return NULL; | ||
466 | } | ||
467 | } | ||
468 | /* We expect the memory to be 4k aligned, at least. */ | ||
469 | if (B43_WARN_ON(!is_4k_aligned(*dmaaddr))) { | ||
470 | b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size); | ||
471 | return NULL; | ||
472 | } | ||
473 | |||
474 | return base; | ||
475 | } | ||
476 | |||
477 | static int alloc_ringmemory(struct b43_dmaring *ring) | 386 | static int alloc_ringmemory(struct b43_dmaring *ring) |
478 | { | 387 | { |
479 | unsigned int required; | 388 | gfp_t flags = GFP_KERNEL; |
480 | void *base; | 389 | |
481 | dma_addr_t dmaaddr; | 390 | /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K |
482 | 391 | * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing | |
483 | /* There are several requirements to the descriptor ring memory: | 392 | * has shown that 4K is sufficient for the latter as long as the buffer |
484 | * - The memory region needs to fit the address constraints for the | 393 | * does not cross an 8K boundary. |
485 | * device (same as for frame buffers). | 394 | * |
486 | * - For 30/32bit DMA devices, the descriptor ring must be 4k aligned. | 395 | * For unknown reasons - possibly a hardware error - the BCM4311 rev |
487 | * - For 64bit DMA devices, the descriptor ring must be 8k aligned. | 396 | * 02, which uses 64-bit DMA, needs the ring buffer in very low memory, |
397 | * which accounts for the GFP_DMA flag below. | ||
398 | * | ||
399 | * The flags here must match the flags in free_ringmemory below! | ||
488 | */ | 400 | */ |
489 | |||
490 | if (ring->type == B43_DMA_64BIT) | 401 | if (ring->type == B43_DMA_64BIT) |
491 | required = ring->nr_slots * sizeof(struct b43_dmadesc64); | 402 | flags |= GFP_DMA; |
492 | else | 403 | ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev, |
493 | required = ring->nr_slots * sizeof(struct b43_dmadesc32); | 404 | B43_DMA_RINGMEMSIZE, |
494 | if (B43_WARN_ON(required > 0x1000)) | 405 | &(ring->dmabase), flags); |
406 | if (!ring->descbase) { | ||
407 | b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); | ||
495 | return -ENOMEM; | 408 | return -ENOMEM; |
496 | |||
497 | ring->alloc_descsize = 0x1000; | ||
498 | base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize); | ||
499 | if (!base) | ||
500 | return -ENOMEM; | ||
501 | ring->alloc_descbase = base; | ||
502 | ring->alloc_dmabase = dmaaddr; | ||
503 | |||
504 | if ((ring->type != B43_DMA_64BIT) || is_8k_aligned(dmaaddr)) { | ||
505 | /* We're on <=32bit DMA, or we already got 8k aligned memory. | ||
506 | * That's all we need, so we're fine. */ | ||
507 | ring->descbase = base; | ||
508 | ring->dmabase = dmaaddr; | ||
509 | return 0; | ||
510 | } | ||
511 | b43_unmap_and_free_ringmem(ring, base, dmaaddr, ring->alloc_descsize); | ||
512 | |||
513 | /* Ok, we failed at the 8k alignment requirement. | ||
514 | * Try to force-align the memory region now. */ | ||
515 | ring->alloc_descsize = 0x2000; | ||
516 | base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize); | ||
517 | if (!base) | ||
518 | return -ENOMEM; | ||
519 | ring->alloc_descbase = base; | ||
520 | ring->alloc_dmabase = dmaaddr; | ||
521 | |||
522 | if (is_8k_aligned(dmaaddr)) { | ||
523 | /* We're already 8k aligned. That Ok, too. */ | ||
524 | ring->descbase = base; | ||
525 | ring->dmabase = dmaaddr; | ||
526 | return 0; | ||
527 | } | 409 | } |
528 | /* Force-align it to 8k */ | 410 | memset(ring->descbase, 0, B43_DMA_RINGMEMSIZE); |
529 | ring->descbase = (void *)((u8 *)base + 0x1000); | ||
530 | ring->dmabase = dmaaddr + 0x1000; | ||
531 | B43_WARN_ON(!is_8k_aligned(ring->dmabase)); | ||
532 | 411 | ||
533 | return 0; | 412 | return 0; |
534 | } | 413 | } |
535 | 414 | ||
536 | static void free_ringmemory(struct b43_dmaring *ring) | 415 | static void free_ringmemory(struct b43_dmaring *ring) |
537 | { | 416 | { |
538 | b43_unmap_and_free_ringmem(ring, ring->alloc_descbase, | 417 | gfp_t flags = GFP_KERNEL; |
539 | ring->alloc_dmabase, ring->alloc_descsize); | 418 | |
419 | if (ring->type == B43_DMA_64BIT) | ||
420 | flags |= GFP_DMA; | ||
421 | |||
422 | ssb_dma_free_consistent(ring->dev->dev, B43_DMA_RINGMEMSIZE, | ||
423 | ring->descbase, ring->dmabase, flags); | ||
540 | } | 424 | } |
541 | 425 | ||
542 | /* Reset the RX DMA channel */ | 426 | /* Reset the RX DMA channel */ |
@@ -646,14 +530,29 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring, | |||
646 | if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) | 530 | if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) |
647 | return 1; | 531 | return 1; |
648 | 532 | ||
649 | if (!b43_dma_address_ok(ring, addr, buffersize)) { | 533 | switch (ring->type) { |
650 | /* We can't support this address. Unmap it again. */ | 534 | case B43_DMA_30BIT: |
651 | unmap_descbuffer(ring, addr, buffersize, dma_to_device); | 535 | if ((u64)addr + buffersize > (1ULL << 30)) |
652 | return 1; | 536 | goto address_error; |
537 | break; | ||
538 | case B43_DMA_32BIT: | ||
539 | if ((u64)addr + buffersize > (1ULL << 32)) | ||
540 | goto address_error; | ||
541 | break; | ||
542 | case B43_DMA_64BIT: | ||
543 | /* Currently we can't have addresses beyond | ||
544 | * 64bit in the kernel. */ | ||
545 | break; | ||
653 | } | 546 | } |
654 | 547 | ||
655 | /* The address is OK. */ | 548 | /* The address is OK. */ |
656 | return 0; | 549 | return 0; |
550 | |||
551 | address_error: | ||
552 | /* We can't support this address. Unmap it again. */ | ||
553 | unmap_descbuffer(ring, addr, buffersize, dma_to_device); | ||
554 | |||
555 | return 1; | ||
657 | } | 556 | } |
658 | 557 | ||
659 | static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) | 558 | static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) |
@@ -715,9 +614,6 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring, | |||
715 | meta->dmaaddr = dmaaddr; | 614 | meta->dmaaddr = dmaaddr; |
716 | ring->ops->fill_descriptor(ring, desc, dmaaddr, | 615 | ring->ops->fill_descriptor(ring, desc, dmaaddr, |
717 | ring->rx_buffersize, 0, 0, 0); | 616 | ring->rx_buffersize, 0, 0, 0); |
718 | ssb_dma_sync_single_for_device(ring->dev->dev, | ||
719 | ring->alloc_dmabase, | ||
720 | ring->alloc_descsize, DMA_TO_DEVICE); | ||
721 | 617 | ||
722 | return 0; | 618 | return 0; |
723 | } | 619 | } |
@@ -1354,9 +1250,6 @@ static int dma_tx_fragment(struct b43_dmaring *ring, | |||
1354 | } | 1250 | } |
1355 | /* Now transfer the whole frame. */ | 1251 | /* Now transfer the whole frame. */ |
1356 | wmb(); | 1252 | wmb(); |
1357 | ssb_dma_sync_single_for_device(ring->dev->dev, | ||
1358 | ring->alloc_dmabase, | ||
1359 | ring->alloc_descsize, DMA_TO_DEVICE); | ||
1360 | ops->poke_tx(ring, next_slot(ring, slot)); | 1253 | ops->poke_tx(ring, next_slot(ring, slot)); |
1361 | return 0; | 1254 | return 0; |
1362 | 1255 | ||
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h index e607b392314c..f7ab37c4cdbc 100644 --- a/drivers/net/wireless/b43/dma.h +++ b/drivers/net/wireless/b43/dma.h | |||
@@ -157,6 +157,7 @@ struct b43_dmadesc_generic { | |||
157 | } __attribute__ ((__packed__)); | 157 | } __attribute__ ((__packed__)); |
158 | 158 | ||
159 | /* Misc DMA constants */ | 159 | /* Misc DMA constants */ |
160 | #define B43_DMA_RINGMEMSIZE PAGE_SIZE | ||
160 | #define B43_DMA0_RX_FRAMEOFFSET 30 | 161 | #define B43_DMA0_RX_FRAMEOFFSET 30 |
161 | 162 | ||
162 | /* DMA engine tuning knobs */ | 163 | /* DMA engine tuning knobs */ |
@@ -246,12 +247,6 @@ struct b43_dmaring { | |||
246 | /* The QOS priority assigned to this ring. Only used for TX rings. | 247 | /* The QOS priority assigned to this ring. Only used for TX rings. |
247 | * This is the mac80211 "queue" value. */ | 248 | * This is the mac80211 "queue" value. */ |
248 | u8 queue_prio; | 249 | u8 queue_prio; |
249 | /* Pointers and size of the originally allocated and mapped memory | ||
250 | * region for the descriptor ring. */ | ||
251 | void *alloc_descbase; | ||
252 | dma_addr_t alloc_dmabase; | ||
253 | unsigned int alloc_descsize; | ||
254 | /* Pointer to our wireless device. */ | ||
255 | struct b43_wldev *dev; | 250 | struct b43_wldev *dev; |
256 | #ifdef CONFIG_B43_DEBUG | 251 | #ifdef CONFIG_B43_DEBUG |
257 | /* Maximum number of used slots. */ | 252 | /* Maximum number of used slots. */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 7da1dab933d9..234891d8cc10 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -681,19 +681,13 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, | |||
681 | snr = rx_stats_sig_avg / rx_stats_noise_diff; | 681 | snr = rx_stats_sig_avg / rx_stats_noise_diff; |
682 | rx_status.noise = rx_status.signal - | 682 | rx_status.noise = rx_status.signal - |
683 | iwl3945_calc_db_from_ratio(snr); | 683 | iwl3945_calc_db_from_ratio(snr); |
684 | rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, | ||
685 | rx_status.noise); | ||
686 | |||
687 | /* If noise info not available, calculate signal quality indicator (%) | ||
688 | * using just the dBm signal level. */ | ||
689 | } else { | 684 | } else { |
690 | rx_status.noise = priv->last_rx_noise; | 685 | rx_status.noise = priv->last_rx_noise; |
691 | rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, 0); | ||
692 | } | 686 | } |
693 | 687 | ||
694 | 688 | ||
695 | IWL_DEBUG_STATS(priv, "Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n", | 689 | IWL_DEBUG_STATS(priv, "Rssi %d noise %d sig_avg %d noise_diff %d\n", |
696 | rx_status.signal, rx_status.noise, rx_status.qual, | 690 | rx_status.signal, rx_status.noise, |
697 | rx_stats_sig_avg, rx_stats_noise_diff); | 691 | rx_stats_sig_avg, rx_stats_noise_diff); |
698 | 692 | ||
699 | header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); | 693 | header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); |
@@ -1835,8 +1829,7 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | |||
1835 | rc = -EIO; | 1829 | rc = -EIO; |
1836 | } | 1830 | } |
1837 | 1831 | ||
1838 | priv->alloc_rxb_page--; | 1832 | iwl_free_pages(priv, cmd.reply_page); |
1839 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
1840 | 1833 | ||
1841 | return rc; | 1834 | return rc; |
1842 | } | 1835 | } |
@@ -2836,6 +2829,7 @@ static struct iwl_cfg iwl3945_bg_cfg = { | |||
2836 | .use_isr_legacy = true, | 2829 | .use_isr_legacy = true, |
2837 | .ht_greenfield_support = false, | 2830 | .ht_greenfield_support = false, |
2838 | .led_compensation = 64, | 2831 | .led_compensation = 64, |
2832 | .broken_powersave = true, | ||
2839 | }; | 2833 | }; |
2840 | 2834 | ||
2841 | static struct iwl_cfg iwl3945_abg_cfg = { | 2835 | static struct iwl_cfg iwl3945_abg_cfg = { |
@@ -2852,6 +2846,7 @@ static struct iwl_cfg iwl3945_abg_cfg = { | |||
2852 | .use_isr_legacy = true, | 2846 | .use_isr_legacy = true, |
2853 | .ht_greenfield_support = false, | 2847 | .ht_greenfield_support = false, |
2854 | .led_compensation = 64, | 2848 | .led_compensation = 64, |
2849 | .broken_powersave = true, | ||
2855 | }; | 2850 | }; |
2856 | 2851 | ||
2857 | struct pci_device_id iwl3945_hw_card_ids[] = { | 2852 | struct pci_device_id iwl3945_hw_card_ids[] = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index ecc23ec1f6a4..531fa125f5a6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -222,7 +222,6 @@ struct iwl3945_ibss_seq { | |||
222 | * | 222 | * |
223 | *****************************************************************************/ | 223 | *****************************************************************************/ |
224 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); | 224 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); |
225 | extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm); | ||
226 | extern void iwl3945_rx_replenish(void *data); | 225 | extern void iwl3945_rx_replenish(void *data); |
227 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); | 226 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); |
228 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, | 227 | extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 386513b601f5..484c5fdf7c2a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -1204,7 +1204,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, | |||
1204 | iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); | 1204 | iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); |
1205 | 1205 | ||
1206 | /* calculate tx gain adjustment based on power supply voltage */ | 1206 | /* calculate tx gain adjustment based on power supply voltage */ |
1207 | voltage = priv->calib_info->voltage; | 1207 | voltage = le16_to_cpu(priv->calib_info->voltage); |
1208 | init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); | 1208 | init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); |
1209 | voltage_compensation = | 1209 | voltage_compensation = |
1210 | iwl4965_get_voltage_compensation(voltage, init_voltage); | 1210 | iwl4965_get_voltage_compensation(voltage, init_voltage); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index 4ef6804a455a..bc056e9ab85f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h | |||
@@ -92,11 +92,15 @@ | |||
92 | 92 | ||
93 | static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) | 93 | static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) |
94 | { | 94 | { |
95 | u16 *temp_calib = (u16 *)iwl_eeprom_query_addr(priv, | 95 | u16 temperature, voltage; |
96 | EEPROM_5000_TEMPERATURE); | 96 | __le16 *temp_calib = |
97 | /* offset = temperature - voltage / coef */ | 97 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE); |
98 | s32 offset = (s32)(temp_calib[0] - temp_calib[1] / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); | 98 | |
99 | return offset; | 99 | temperature = le16_to_cpu(temp_calib[0]); |
100 | voltage = le16_to_cpu(temp_calib[1]); | ||
101 | |||
102 | /* offset = temp - volt / coeff */ | ||
103 | return (s32)(temperature - voltage / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); | ||
100 | } | 104 | } |
101 | 105 | ||
102 | /* Fixed (non-configurable) rx data from phy */ | 106 | /* Fixed (non-configurable) rx data from phy */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index e2f8615c8c9b..33a5866538e7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -333,14 +333,15 @@ static void iwl5000_set_ct_threshold(struct iwl_priv *priv) | |||
333 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) | 333 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) |
334 | { | 334 | { |
335 | struct iwl_calib_xtal_freq_cmd cmd; | 335 | struct iwl_calib_xtal_freq_cmd cmd; |
336 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | 336 | __le16 *xtal_calib = |
337 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | ||
337 | 338 | ||
338 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; | 339 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; |
339 | cmd.hdr.first_group = 0; | 340 | cmd.hdr.first_group = 0; |
340 | cmd.hdr.groups_num = 1; | 341 | cmd.hdr.groups_num = 1; |
341 | cmd.hdr.data_valid = 1; | 342 | cmd.hdr.data_valid = 1; |
342 | cmd.cap_pin1 = (u8)xtal_calib[0]; | 343 | cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); |
343 | cmd.cap_pin2 = (u8)xtal_calib[1]; | 344 | cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]); |
344 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], | 345 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], |
345 | (u8 *)&cmd, sizeof(cmd)); | 346 | (u8 *)&cmd, sizeof(cmd)); |
346 | } | 347 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index fe511cbf012e..b93e49158196 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -150,7 +150,7 @@ static s32 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = { | |||
150 | }; | 150 | }; |
151 | 151 | ||
152 | /* mbps, mcs */ | 152 | /* mbps, mcs */ |
153 | const static struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { | 153 | static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { |
154 | { "1", "BPSK DSSS"}, | 154 | { "1", "BPSK DSSS"}, |
155 | { "2", "QPSK DSSS"}, | 155 | { "2", "QPSK DSSS"}, |
156 | {"5.5", "BPSK CCK"}, | 156 | {"5.5", "BPSK CCK"}, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b8377efb3ba7..1c9866daf815 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1842,7 +1842,7 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log) | |||
1842 | } | 1842 | } |
1843 | 1843 | ||
1844 | #ifdef CONFIG_IWLWIFI_DEBUG | 1844 | #ifdef CONFIG_IWLWIFI_DEBUG |
1845 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) | 1845 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) |
1846 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) | 1846 | size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) |
1847 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; | 1847 | ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; |
1848 | #else | 1848 | #else |
@@ -3173,7 +3173,6 @@ static int iwl_init_drv(struct iwl_priv *priv) | |||
3173 | 3173 | ||
3174 | priv->ibss_beacon = NULL; | 3174 | priv->ibss_beacon = NULL; |
3175 | 3175 | ||
3176 | spin_lock_init(&priv->lock); | ||
3177 | spin_lock_init(&priv->sta_lock); | 3176 | spin_lock_init(&priv->sta_lock); |
3178 | spin_lock_init(&priv->hcmd_lock); | 3177 | spin_lock_init(&priv->hcmd_lock); |
3179 | 3178 | ||
@@ -3361,10 +3360,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3361 | (unsigned long long) pci_resource_len(pdev, 0)); | 3360 | (unsigned long long) pci_resource_len(pdev, 0)); |
3362 | IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); | 3361 | IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); |
3363 | 3362 | ||
3364 | /* this spin lock will be used in apm_ops.init and EEPROM access | 3363 | /* these spin locks will be used in apm_ops.init and EEPROM access |
3365 | * we should init now | 3364 | * we should init now |
3366 | */ | 3365 | */ |
3367 | spin_lock_init(&priv->reg_lock); | 3366 | spin_lock_init(&priv->reg_lock); |
3367 | spin_lock_init(&priv->lock); | ||
3368 | iwl_hw_detect(priv); | 3368 | iwl_hw_detect(priv); |
3369 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", | 3369 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", |
3370 | priv->cfg->name, priv->hw_rev); | 3370 | priv->cfg->name, priv->hw_rev); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index a7bfae01f19b..1ec8cb4d5eae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -77,8 +77,7 @@ | |||
77 | * The MAC (uCode processor, etc.) does not need to be powered up for accessing | 77 | * The MAC (uCode processor, etc.) does not need to be powered up for accessing |
78 | * the CSR registers. | 78 | * the CSR registers. |
79 | * | 79 | * |
80 | * NOTE: Newer devices using one-time-programmable (OTP) memory | 80 | * NOTE: Device does need to be awake in order to read this memory |
81 | * require device to be awake in order to read this memory | ||
82 | * via CSR_EEPROM and CSR_OTP registers | 81 | * via CSR_EEPROM and CSR_OTP registers |
83 | */ | 82 | */ |
84 | #define CSR_BASE (0x000) | 83 | #define CSR_BASE (0x000) |
@@ -111,9 +110,8 @@ | |||
111 | /* | 110 | /* |
112 | * EEPROM and OTP (one-time-programmable) memory reads | 111 | * EEPROM and OTP (one-time-programmable) memory reads |
113 | * | 112 | * |
114 | * NOTE: For (newer) devices using OTP, device must be awake, initialized via | 113 | * NOTE: Device must be awake, initialized via apm_ops.init(), |
115 | * apm_ops.init() in order to read. Older devices (3945/4965/5000) | 114 | * in order to read. |
116 | * use EEPROM and do not require this. | ||
117 | */ | 115 | */ |
118 | #define CSR_EEPROM_REG (CSR_BASE+0x02c) | 116 | #define CSR_EEPROM_REG (CSR_BASE+0x02c) |
119 | #define CSR_EEPROM_GP (CSR_BASE+0x030) | 117 | #define CSR_EEPROM_GP (CSR_BASE+0x030) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 2673e9a4db92..165d1f6e2dd9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1168,7 +1168,7 @@ struct iwl_priv { | |||
1168 | u32 last_beacon_time; | 1168 | u32 last_beacon_time; |
1169 | u64 last_tsf; | 1169 | u64 last_tsf; |
1170 | 1170 | ||
1171 | /* eeprom */ | 1171 | /* eeprom -- this is in the card's little endian byte order */ |
1172 | u8 *eeprom; | 1172 | u8 *eeprom; |
1173 | int nvm_device_type; | 1173 | int nvm_device_type; |
1174 | struct iwl_eeprom_calib_info *calib_info; | 1174 | struct iwl_eeprom_calib_info *calib_info; |
@@ -1353,4 +1353,15 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch) | |||
1353 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; | 1353 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; |
1354 | } | 1354 | } |
1355 | 1355 | ||
1356 | static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page) | ||
1357 | { | ||
1358 | __free_pages(page, priv->hw_params.rx_page_order); | ||
1359 | priv->alloc_rxb_page--; | ||
1360 | } | ||
1361 | |||
1362 | static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page) | ||
1363 | { | ||
1364 | free_pages(page, priv->hw_params.rx_page_order); | ||
1365 | priv->alloc_rxb_page--; | ||
1366 | } | ||
1356 | #endif /* __iwl_dev_h__ */ | 1367 | #endif /* __iwl_dev_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 3946e5c03f81..4a30969689ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -370,7 +370,7 @@ static int iwl_init_otp_access(struct iwl_priv *priv) | |||
370 | return ret; | 370 | return ret; |
371 | } | 371 | } |
372 | 372 | ||
373 | static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | 373 | static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, __le16 *eeprom_data) |
374 | { | 374 | { |
375 | int ret = 0; | 375 | int ret = 0; |
376 | u32 r; | 376 | u32 r; |
@@ -404,7 +404,7 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | |||
404 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); | 404 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); |
405 | IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); | 405 | IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); |
406 | } | 406 | } |
407 | *eeprom_data = le16_to_cpu((__force __le16)(r >> 16)); | 407 | *eeprom_data = cpu_to_le16(r >> 16); |
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
410 | 410 | ||
@@ -413,7 +413,8 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) | |||
413 | */ | 413 | */ |
414 | static bool iwl_is_otp_empty(struct iwl_priv *priv) | 414 | static bool iwl_is_otp_empty(struct iwl_priv *priv) |
415 | { | 415 | { |
416 | u16 next_link_addr = 0, link_value; | 416 | u16 next_link_addr = 0; |
417 | __le16 link_value; | ||
417 | bool is_empty = false; | 418 | bool is_empty = false; |
418 | 419 | ||
419 | /* locate the beginning of OTP link list */ | 420 | /* locate the beginning of OTP link list */ |
@@ -443,7 +444,8 @@ static bool iwl_is_otp_empty(struct iwl_priv *priv) | |||
443 | static int iwl_find_otp_image(struct iwl_priv *priv, | 444 | static int iwl_find_otp_image(struct iwl_priv *priv, |
444 | u16 *validblockaddr) | 445 | u16 *validblockaddr) |
445 | { | 446 | { |
446 | u16 next_link_addr = 0, link_value = 0, valid_addr; | 447 | u16 next_link_addr = 0, valid_addr; |
448 | __le16 link_value = 0; | ||
447 | int usedblocks = 0; | 449 | int usedblocks = 0; |
448 | 450 | ||
449 | /* set addressing mode to absolute to traverse the link list */ | 451 | /* set addressing mode to absolute to traverse the link list */ |
@@ -463,7 +465,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
463 | * check for more block on the link list | 465 | * check for more block on the link list |
464 | */ | 466 | */ |
465 | valid_addr = next_link_addr; | 467 | valid_addr = next_link_addr; |
466 | next_link_addr = link_value * sizeof(u16); | 468 | next_link_addr = le16_to_cpu(link_value) * sizeof(u16); |
467 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", | 469 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", |
468 | usedblocks, next_link_addr); | 470 | usedblocks, next_link_addr); |
469 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) | 471 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) |
@@ -497,7 +499,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
497 | */ | 499 | */ |
498 | int iwl_eeprom_init(struct iwl_priv *priv) | 500 | int iwl_eeprom_init(struct iwl_priv *priv) |
499 | { | 501 | { |
500 | u16 *e; | 502 | __le16 *e; |
501 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); | 503 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); |
502 | int sz; | 504 | int sz; |
503 | int ret; | 505 | int ret; |
@@ -516,12 +518,9 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
516 | ret = -ENOMEM; | 518 | ret = -ENOMEM; |
517 | goto alloc_err; | 519 | goto alloc_err; |
518 | } | 520 | } |
519 | e = (u16 *)priv->eeprom; | 521 | e = (__le16 *)priv->eeprom; |
520 | 522 | ||
521 | if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { | 523 | priv->cfg->ops->lib->apm_ops.init(priv); |
522 | /* OTP reads require powered-up chip */ | ||
523 | priv->cfg->ops->lib->apm_ops.init(priv); | ||
524 | } | ||
525 | 524 | ||
526 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); | 525 | ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); |
527 | if (ret < 0) { | 526 | if (ret < 0) { |
@@ -562,7 +561,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
562 | } | 561 | } |
563 | for (addr = validblockaddr; addr < validblockaddr + sz; | 562 | for (addr = validblockaddr; addr < validblockaddr + sz; |
564 | addr += sizeof(u16)) { | 563 | addr += sizeof(u16)) { |
565 | u16 eeprom_data; | 564 | __le16 eeprom_data; |
566 | 565 | ||
567 | ret = iwl_read_otp_word(priv, addr, &eeprom_data); | 566 | ret = iwl_read_otp_word(priv, addr, &eeprom_data); |
568 | if (ret) | 567 | if (ret) |
@@ -570,13 +569,6 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
570 | e[cache_addr / 2] = eeprom_data; | 569 | e[cache_addr / 2] = eeprom_data; |
571 | cache_addr += sizeof(u16); | 570 | cache_addr += sizeof(u16); |
572 | } | 571 | } |
573 | |||
574 | /* | ||
575 | * Now that OTP reads are complete, reset chip to save | ||
576 | * power until we load uCode during "up". | ||
577 | */ | ||
578 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
579 | |||
580 | } else { | 572 | } else { |
581 | /* eeprom is an array of 16bit values */ | 573 | /* eeprom is an array of 16bit values */ |
582 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | 574 | for (addr = 0; addr < sz; addr += sizeof(u16)) { |
@@ -594,7 +586,7 @@ int iwl_eeprom_init(struct iwl_priv *priv) | |||
594 | goto done; | 586 | goto done; |
595 | } | 587 | } |
596 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); | 588 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); |
597 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); | 589 | e[addr / 2] = cpu_to_le16(r >> 16); |
598 | } | 590 | } |
599 | } | 591 | } |
600 | ret = 0; | 592 | ret = 0; |
@@ -603,6 +595,8 @@ done: | |||
603 | err: | 595 | err: |
604 | if (ret) | 596 | if (ret) |
605 | iwl_eeprom_free(priv); | 597 | iwl_eeprom_free(priv); |
598 | /* Reset chip to save power until we load uCode during "up". */ | ||
599 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
606 | alloc_err: | 600 | alloc_err: |
607 | return ret; | 601 | return ret; |
608 | } | 602 | } |
@@ -755,7 +749,8 @@ static int iwl_mod_ht40_chan_info(struct iwl_priv *priv, | |||
755 | ch_info->ht40_eeprom = *eeprom_ch; | 749 | ch_info->ht40_eeprom = *eeprom_ch; |
756 | ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; | 750 | ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; |
757 | ch_info->ht40_flags = eeprom_ch->flags; | 751 | ch_info->ht40_flags = eeprom_ch->flags; |
758 | ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel; | 752 | if (eeprom_ch->flags & EEPROM_CHANNEL_VALID) |
753 | ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel; | ||
759 | 754 | ||
760 | return 0; | 755 | return 0; |
761 | } | 756 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index 5cd2b66bbe45..0cd9c02ee044 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
@@ -137,7 +137,7 @@ struct iwl_eeprom_channel { | |||
137 | * | 137 | * |
138 | */ | 138 | */ |
139 | struct iwl_eeprom_enhanced_txpwr { | 139 | struct iwl_eeprom_enhanced_txpwr { |
140 | u16 common; | 140 | __le16 common; |
141 | s8 chain_a_max; | 141 | s8 chain_a_max; |
142 | s8 chain_b_max; | 142 | s8 chain_b_max; |
143 | s8 chain_c_max; | 143 | s8 chain_c_max; |
@@ -360,7 +360,7 @@ struct iwl_eeprom_calib_subband_info { | |||
360 | struct iwl_eeprom_calib_info { | 360 | struct iwl_eeprom_calib_info { |
361 | u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ | 361 | u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ |
362 | u8 saturation_power52; /* half-dBm */ | 362 | u8 saturation_power52; /* half-dBm */ |
363 | s16 voltage; /* signed */ | 363 | __le16 voltage; /* signed */ |
364 | struct iwl_eeprom_calib_subband_info | 364 | struct iwl_eeprom_calib_subband_info |
365 | band_info[EEPROM_TX_POWER_BANDS]; | 365 | band_info[EEPROM_TX_POWER_BANDS]; |
366 | } __attribute__ ((packed)); | 366 | } __attribute__ ((packed)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index a23165948202..30e9ea6d54ec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -234,7 +234,7 @@ cancel: | |||
234 | } | 234 | } |
235 | fail: | 235 | fail: |
236 | if (cmd->reply_page) { | 236 | if (cmd->reply_page) { |
237 | free_pages(cmd->reply_page, priv->hw_params.rx_page_order); | 237 | iwl_free_pages(priv, cmd->reply_page); |
238 | cmd->reply_page = 0; | 238 | cmd->reply_page = 0; |
239 | } | 239 | } |
240 | out: | 240 | out: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 6090bc15a6d5..6f36b6e79f5e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -345,10 +345,8 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
345 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 345 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
346 | PAGE_SIZE << priv->hw_params.rx_page_order, | 346 | PAGE_SIZE << priv->hw_params.rx_page_order, |
347 | PCI_DMA_FROMDEVICE); | 347 | PCI_DMA_FROMDEVICE); |
348 | __free_pages(rxq->pool[i].page, | 348 | __iwl_free_pages(priv, rxq->pool[i].page); |
349 | priv->hw_params.rx_page_order); | ||
350 | rxq->pool[i].page = NULL; | 349 | rxq->pool[i].page = NULL; |
351 | priv->alloc_rxb_page--; | ||
352 | } | 350 | } |
353 | } | 351 | } |
354 | 352 | ||
@@ -416,9 +414,7 @@ void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
416 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 414 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
417 | PAGE_SIZE << priv->hw_params.rx_page_order, | 415 | PAGE_SIZE << priv->hw_params.rx_page_order, |
418 | PCI_DMA_FROMDEVICE); | 416 | PCI_DMA_FROMDEVICE); |
419 | priv->alloc_rxb_page--; | 417 | __iwl_free_pages(priv, rxq->pool[i].page); |
420 | __free_pages(rxq->pool[i].page, | ||
421 | priv->hw_params.rx_page_order); | ||
422 | rxq->pool[i].page = NULL; | 418 | rxq->pool[i].page = NULL; |
423 | } | 419 | } |
424 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 420 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
@@ -654,47 +650,6 @@ void iwl_reply_statistics(struct iwl_priv *priv, | |||
654 | } | 650 | } |
655 | EXPORT_SYMBOL(iwl_reply_statistics); | 651 | EXPORT_SYMBOL(iwl_reply_statistics); |
656 | 652 | ||
657 | #define PERFECT_RSSI (-20) /* dBm */ | ||
658 | #define WORST_RSSI (-95) /* dBm */ | ||
659 | #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) | ||
660 | |||
661 | /* Calculate an indication of rx signal quality (a percentage, not dBm!). | ||
662 | * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info | ||
663 | * about formulas used below. */ | ||
664 | static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm) | ||
665 | { | ||
666 | int sig_qual; | ||
667 | int degradation = PERFECT_RSSI - rssi_dbm; | ||
668 | |||
669 | /* If we get a noise measurement, use signal-to-noise ratio (SNR) | ||
670 | * as indicator; formula is (signal dbm - noise dbm). | ||
671 | * SNR at or above 40 is a great signal (100%). | ||
672 | * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. | ||
673 | * Weakest usable signal is usually 10 - 15 dB SNR. */ | ||
674 | if (noise_dbm) { | ||
675 | if (rssi_dbm - noise_dbm >= 40) | ||
676 | return 100; | ||
677 | else if (rssi_dbm < noise_dbm) | ||
678 | return 0; | ||
679 | sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; | ||
680 | |||
681 | /* Else use just the signal level. | ||
682 | * This formula is a least squares fit of data points collected and | ||
683 | * compared with a reference system that had a percentage (%) display | ||
684 | * for signal quality. */ | ||
685 | } else | ||
686 | sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * | ||
687 | (15 * RSSI_RANGE + 62 * degradation)) / | ||
688 | (RSSI_RANGE * RSSI_RANGE); | ||
689 | |||
690 | if (sig_qual > 100) | ||
691 | sig_qual = 100; | ||
692 | else if (sig_qual < 1) | ||
693 | sig_qual = 0; | ||
694 | |||
695 | return sig_qual; | ||
696 | } | ||
697 | |||
698 | /* Calc max signal level (dBm) among 3 possible receivers */ | 653 | /* Calc max signal level (dBm) among 3 possible receivers */ |
699 | static inline int iwl_calc_rssi(struct iwl_priv *priv, | 654 | static inline int iwl_calc_rssi(struct iwl_priv *priv, |
700 | struct iwl_rx_phy_res *rx_resp) | 655 | struct iwl_rx_phy_res *rx_resp) |
@@ -1105,11 +1060,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1105 | if (iwl_is_associated(priv) && | 1060 | if (iwl_is_associated(priv) && |
1106 | !test_bit(STATUS_SCANNING, &priv->status)) { | 1061 | !test_bit(STATUS_SCANNING, &priv->status)) { |
1107 | rx_status.noise = priv->last_rx_noise; | 1062 | rx_status.noise = priv->last_rx_noise; |
1108 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, | ||
1109 | rx_status.noise); | ||
1110 | } else { | 1063 | } else { |
1111 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; | 1064 | rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; |
1112 | rx_status.qual = iwl_calc_sig_qual(rx_status.signal, 0); | ||
1113 | } | 1065 | } |
1114 | 1066 | ||
1115 | /* Reset beacon noise level if not associated. */ | 1067 | /* Reset beacon noise level if not associated. */ |
@@ -1122,8 +1074,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1122 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); | 1074 | iwl_dbg_report_frame(priv, phy_res, len, header, 1); |
1123 | #endif | 1075 | #endif |
1124 | iwl_dbg_log_rx_data_frame(priv, len, header); | 1076 | iwl_dbg_log_rx_data_frame(priv, len, header); |
1125 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n", | 1077 | IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n", |
1126 | rx_status.signal, rx_status.noise, rx_status.qual, | 1078 | rx_status.signal, rx_status.noise, |
1127 | (unsigned long long)rx_status.mactime); | 1079 | (unsigned long long)rx_status.mactime); |
1128 | 1080 | ||
1129 | /* | 1081 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index a2b2b8315ff9..fa1c89ba6459 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -144,8 +144,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv) | |||
144 | clear_bit(STATUS_SCAN_HW, &priv->status); | 144 | clear_bit(STATUS_SCAN_HW, &priv->status); |
145 | } | 145 | } |
146 | 146 | ||
147 | priv->alloc_rxb_page--; | 147 | iwl_free_pages(priv, cmd.reply_page); |
148 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
149 | 148 | ||
150 | return ret; | 149 | return ret; |
151 | } | 150 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index cd6a6901216e..cde09a890b73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -164,9 +164,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
164 | break; | 164 | break; |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | iwl_free_pages(priv, cmd.reply_page); | |
168 | priv->alloc_rxb_page--; | ||
169 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
170 | 168 | ||
171 | return ret; | 169 | return ret; |
172 | } | 170 | } |
@@ -391,9 +389,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr, | |||
391 | break; | 389 | break; |
392 | } | 390 | } |
393 | } | 391 | } |
394 | 392 | iwl_free_pages(priv, cmd.reply_page); | |
395 | priv->alloc_rxb_page--; | ||
396 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | ||
397 | 393 | ||
398 | return ret; | 394 | return ret; |
399 | } | 395 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 00da5e152d46..87ce2bd292c7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -407,13 +407,14 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) | |||
407 | int txq_id; | 407 | int txq_id; |
408 | 408 | ||
409 | /* Tx queues */ | 409 | /* Tx queues */ |
410 | if (priv->txq) | 410 | if (priv->txq) { |
411 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; | 411 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; |
412 | txq_id++) | 412 | txq_id++) |
413 | if (txq_id == IWL_CMD_QUEUE_NUM) | 413 | if (txq_id == IWL_CMD_QUEUE_NUM) |
414 | iwl_cmd_queue_free(priv); | 414 | iwl_cmd_queue_free(priv); |
415 | else | 415 | else |
416 | iwl_tx_queue_free(priv, txq_id); | 416 | iwl_tx_queue_free(priv, txq_id); |
417 | } | ||
417 | iwl_free_dma_ptr(priv, &priv->kw); | 418 | iwl_free_dma_ptr(priv, &priv->kw); |
418 | 419 | ||
419 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); | 420 | iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 2a28a1f8b1fe..f8e4e4b18d02 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -548,6 +548,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
548 | txq = &priv->txq[txq_id]; | 548 | txq = &priv->txq[txq_id]; |
549 | q = &txq->q; | 549 | q = &txq->q; |
550 | 550 | ||
551 | if ((iwl_queue_space(q) < q->high_mark)) | ||
552 | goto drop; | ||
553 | |||
551 | spin_lock_irqsave(&priv->lock, flags); | 554 | spin_lock_irqsave(&priv->lock, flags); |
552 | 555 | ||
553 | idx = get_cmd_index(q, q->write_ptr, 0); | 556 | idx = get_cmd_index(q, q->write_ptr, 0); |
@@ -812,7 +815,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
812 | break; | 815 | break; |
813 | } | 816 | } |
814 | 817 | ||
815 | free_pages(cmd.reply_page, priv->hw_params.rx_page_order); | 818 | iwl_free_pages(priv, cmd.reply_page); |
816 | 819 | ||
817 | return rc; | 820 | return rc; |
818 | } | 821 | } |
@@ -1198,9 +1201,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | |||
1198 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1201 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
1199 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1202 | PAGE_SIZE << priv->hw_params.rx_page_order, |
1200 | PCI_DMA_FROMDEVICE); | 1203 | PCI_DMA_FROMDEVICE); |
1201 | priv->alloc_rxb_page--; | 1204 | __iwl_free_pages(priv, rxq->pool[i].page); |
1202 | __free_pages(rxq->pool[i].page, | ||
1203 | priv->hw_params.rx_page_order); | ||
1204 | rxq->pool[i].page = NULL; | 1205 | rxq->pool[i].page = NULL; |
1205 | } | 1206 | } |
1206 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 1207 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
@@ -1247,10 +1248,8 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx | |||
1247 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1248 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, |
1248 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1249 | PAGE_SIZE << priv->hw_params.rx_page_order, |
1249 | PCI_DMA_FROMDEVICE); | 1250 | PCI_DMA_FROMDEVICE); |
1250 | __free_pages(rxq->pool[i].page, | 1251 | __iwl_free_pages(priv, rxq->pool[i].page); |
1251 | priv->hw_params.rx_page_order); | ||
1252 | rxq->pool[i].page = NULL; | 1252 | rxq->pool[i].page = NULL; |
1253 | priv->alloc_rxb_page--; | ||
1254 | } | 1253 | } |
1255 | } | 1254 | } |
1256 | 1255 | ||
@@ -1300,47 +1299,6 @@ int iwl3945_calc_db_from_ratio(int sig_ratio) | |||
1300 | return (int)ratio2dB[sig_ratio]; | 1299 | return (int)ratio2dB[sig_ratio]; |
1301 | } | 1300 | } |
1302 | 1301 | ||
1303 | #define PERFECT_RSSI (-20) /* dBm */ | ||
1304 | #define WORST_RSSI (-95) /* dBm */ | ||
1305 | #define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI) | ||
1306 | |||
1307 | /* Calculate an indication of rx signal quality (a percentage, not dBm!). | ||
1308 | * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info | ||
1309 | * about formulas used below. */ | ||
1310 | int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm) | ||
1311 | { | ||
1312 | int sig_qual; | ||
1313 | int degradation = PERFECT_RSSI - rssi_dbm; | ||
1314 | |||
1315 | /* If we get a noise measurement, use signal-to-noise ratio (SNR) | ||
1316 | * as indicator; formula is (signal dbm - noise dbm). | ||
1317 | * SNR at or above 40 is a great signal (100%). | ||
1318 | * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator. | ||
1319 | * Weakest usable signal is usually 10 - 15 dB SNR. */ | ||
1320 | if (noise_dbm) { | ||
1321 | if (rssi_dbm - noise_dbm >= 40) | ||
1322 | return 100; | ||
1323 | else if (rssi_dbm < noise_dbm) | ||
1324 | return 0; | ||
1325 | sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2; | ||
1326 | |||
1327 | /* Else use just the signal level. | ||
1328 | * This formula is a least squares fit of data points collected and | ||
1329 | * compared with a reference system that had a percentage (%) display | ||
1330 | * for signal quality. */ | ||
1331 | } else | ||
1332 | sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation * | ||
1333 | (15 * RSSI_RANGE + 62 * degradation)) / | ||
1334 | (RSSI_RANGE * RSSI_RANGE); | ||
1335 | |||
1336 | if (sig_qual > 100) | ||
1337 | sig_qual = 100; | ||
1338 | else if (sig_qual < 1) | ||
1339 | sig_qual = 0; | ||
1340 | |||
1341 | return sig_qual; | ||
1342 | } | ||
1343 | |||
1344 | /** | 1302 | /** |
1345 | * iwl3945_rx_handle - Main entry function for receiving responses from uCode | 1303 | * iwl3945_rx_handle - Main entry function for receiving responses from uCode |
1346 | * | 1304 | * |
@@ -1688,7 +1646,7 @@ void iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log) | |||
1688 | } | 1646 | } |
1689 | 1647 | ||
1690 | #ifdef CONFIG_IWLWIFI_DEBUG | 1648 | #ifdef CONFIG_IWLWIFI_DEBUG |
1691 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) | 1649 | if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log) |
1692 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) | 1650 | size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) |
1693 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; | 1651 | ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; |
1694 | #else | 1652 | #else |
@@ -3867,7 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
3867 | priv->retry_rate = 1; | 3825 | priv->retry_rate = 1; |
3868 | priv->ibss_beacon = NULL; | 3826 | priv->ibss_beacon = NULL; |
3869 | 3827 | ||
3870 | spin_lock_init(&priv->lock); | ||
3871 | spin_lock_init(&priv->sta_lock); | 3828 | spin_lock_init(&priv->sta_lock); |
3872 | spin_lock_init(&priv->hcmd_lock); | 3829 | spin_lock_init(&priv->hcmd_lock); |
3873 | 3830 | ||
@@ -3936,9 +3893,11 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
3936 | /* Tell mac80211 our characteristics */ | 3893 | /* Tell mac80211 our characteristics */ |
3937 | hw->flags = IEEE80211_HW_SIGNAL_DBM | | 3894 | hw->flags = IEEE80211_HW_SIGNAL_DBM | |
3938 | IEEE80211_HW_NOISE_DBM | | 3895 | IEEE80211_HW_NOISE_DBM | |
3939 | IEEE80211_HW_SPECTRUM_MGMT | | 3896 | IEEE80211_HW_SPECTRUM_MGMT; |
3940 | IEEE80211_HW_SUPPORTS_PS | | 3897 | |
3941 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | 3898 | if (!priv->cfg->broken_powersave) |
3899 | hw->flags |= IEEE80211_HW_SUPPORTS_PS | | ||
3900 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | ||
3942 | 3901 | ||
3943 | hw->wiphy->interface_modes = | 3902 | hw->wiphy->interface_modes = |
3944 | BIT(NL80211_IFTYPE_STATION) | | 3903 | BIT(NL80211_IFTYPE_STATION) | |
@@ -4057,10 +4016,11 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4057 | * PCI Tx retries from interfering with C3 CPU state */ | 4016 | * PCI Tx retries from interfering with C3 CPU state */ |
4058 | pci_write_config_byte(pdev, 0x41, 0x00); | 4017 | pci_write_config_byte(pdev, 0x41, 0x00); |
4059 | 4018 | ||
4060 | /* this spin lock will be used in apm_ops.init and EEPROM access | 4019 | /* these spin locks will be used in apm_ops.init and EEPROM access |
4061 | * we should init now | 4020 | * we should init now |
4062 | */ | 4021 | */ |
4063 | spin_lock_init(&priv->reg_lock); | 4022 | spin_lock_init(&priv->reg_lock); |
4023 | spin_lock_init(&priv->lock); | ||
4064 | 4024 | ||
4065 | /*********************** | 4025 | /*********************** |
4066 | * 4. Read EEPROM | 4026 | * 4. Read EEPROM |
diff --git a/drivers/net/wireless/iwmc3200wifi/iwm.h b/drivers/net/wireless/iwmc3200wifi/iwm.h index 5a26bb05a33a..842811142bef 100644 --- a/drivers/net/wireless/iwmc3200wifi/iwm.h +++ b/drivers/net/wireless/iwmc3200wifi/iwm.h | |||
@@ -268,7 +268,7 @@ struct iwm_priv { | |||
268 | 268 | ||
269 | struct sk_buff_head rx_list; | 269 | struct sk_buff_head rx_list; |
270 | struct list_head rx_tickets; | 270 | struct list_head rx_tickets; |
271 | struct list_head rx_packets[IWM_RX_ID_HASH]; | 271 | struct list_head rx_packets[IWM_RX_ID_HASH + 1]; |
272 | struct workqueue_struct *rx_wq; | 272 | struct workqueue_struct *rx_wq; |
273 | struct work_struct rx_worker; | 273 | struct work_struct rx_worker; |
274 | 274 | ||
@@ -349,7 +349,7 @@ int iwm_up(struct iwm_priv *iwm); | |||
349 | int iwm_down(struct iwm_priv *iwm); | 349 | int iwm_down(struct iwm_priv *iwm); |
350 | 350 | ||
351 | /* TX API */ | 351 | /* TX API */ |
352 | u16 iwm_tid_to_queue(u16 tid); | 352 | int iwm_tid_to_queue(u16 tid); |
353 | void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages); | 353 | void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages); |
354 | void iwm_tx_worker(struct work_struct *work); | 354 | void iwm_tx_worker(struct work_struct *work); |
355 | int iwm_xmit_frame(struct sk_buff *skb, struct net_device *netdev); | 355 | int iwm_xmit_frame(struct sk_buff *skb, struct net_device *netdev); |
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c index e4f0f8705f65..c4c0d23c63ec 100644 --- a/drivers/net/wireless/iwmc3200wifi/netdev.c +++ b/drivers/net/wireless/iwmc3200wifi/netdev.c | |||
@@ -76,7 +76,7 @@ static int iwm_stop(struct net_device *ndev) | |||
76 | */ | 76 | */ |
77 | static const u16 iwm_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; | 77 | static const u16 iwm_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; |
78 | 78 | ||
79 | u16 iwm_tid_to_queue(u16 tid) | 79 | int iwm_tid_to_queue(u16 tid) |
80 | { | 80 | { |
81 | if (tid > IWM_UMAC_TID_NR - 2) | 81 | if (tid > IWM_UMAC_TID_NR - 2) |
82 | return -EINVAL; | 82 | return -EINVAL; |
diff --git a/drivers/net/wireless/iwmc3200wifi/rx.c b/drivers/net/wireless/iwmc3200wifi/rx.c index 1c57c1f72cba..6d6ed7485175 100644 --- a/drivers/net/wireless/iwmc3200wifi/rx.c +++ b/drivers/net/wireless/iwmc3200wifi/rx.c | |||
@@ -1126,7 +1126,7 @@ static int iwm_ntf_stop_resume_tx(struct iwm_priv *iwm, u8 *buf, | |||
1126 | 1126 | ||
1127 | if (!stop) { | 1127 | if (!stop) { |
1128 | struct iwm_tx_queue *txq; | 1128 | struct iwm_tx_queue *txq; |
1129 | u16 queue = iwm_tid_to_queue(bit); | 1129 | int queue = iwm_tid_to_queue(bit); |
1130 | 1130 | ||
1131 | if (queue < 0) | 1131 | if (queue < 0) |
1132 | continue; | 1132 | continue; |
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index 2f91c9b808af..92b7a357a5e4 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/delay.h> | 2 | #include <linux/delay.h> |
3 | #include <linux/etherdevice.h> | 3 | #include <linux/etherdevice.h> |
4 | #include <linux/netdevice.h> | 4 | #include <linux/netdevice.h> |
5 | #include <linux/if_ether.h> | ||
5 | #include <linux/if_arp.h> | 6 | #include <linux/if_arp.h> |
6 | #include <linux/kthread.h> | 7 | #include <linux/kthread.h> |
7 | #include <linux/kfifo.h> | 8 | #include <linux/kfifo.h> |
@@ -351,8 +352,7 @@ int lbs_add_mesh(struct lbs_private *priv) | |||
351 | 352 | ||
352 | mesh_dev->netdev_ops = &mesh_netdev_ops; | 353 | mesh_dev->netdev_ops = &mesh_netdev_ops; |
353 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; | 354 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; |
354 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, | 355 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN); |
355 | sizeof(priv->dev->dev_addr)); | ||
356 | 356 | ||
357 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); | 357 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); |
358 | 358 | ||
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index c6a6c042b82f..b0b1c7841500 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -567,11 +567,8 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan) | |||
567 | chan_count = lbs_scan_create_channel_list(priv, chan_list); | 567 | chan_count = lbs_scan_create_channel_list(priv, chan_list); |
568 | 568 | ||
569 | netif_stop_queue(priv->dev); | 569 | netif_stop_queue(priv->dev); |
570 | netif_carrier_off(priv->dev); | 570 | if (priv->mesh_dev) |
571 | if (priv->mesh_dev) { | ||
572 | netif_stop_queue(priv->mesh_dev); | 571 | netif_stop_queue(priv->mesh_dev); |
573 | netif_carrier_off(priv->mesh_dev); | ||
574 | } | ||
575 | 572 | ||
576 | /* Prepare to continue an interrupted scan */ | 573 | /* Prepare to continue an interrupted scan */ |
577 | lbs_deb_scan("chan_count %d, scan_channel %d\n", | 574 | lbs_deb_scan("chan_count %d, scan_channel %d\n", |
@@ -635,16 +632,13 @@ out2: | |||
635 | priv->scan_channel = 0; | 632 | priv->scan_channel = 0; |
636 | 633 | ||
637 | out: | 634 | out: |
638 | if (priv->connect_status == LBS_CONNECTED) { | 635 | if (priv->connect_status == LBS_CONNECTED && !priv->tx_pending_len) |
639 | netif_carrier_on(priv->dev); | 636 | netif_wake_queue(priv->dev); |
640 | if (!priv->tx_pending_len) | 637 | |
641 | netif_wake_queue(priv->dev); | 638 | if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED) && |
642 | } | 639 | !priv->tx_pending_len) |
643 | if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) { | 640 | netif_wake_queue(priv->mesh_dev); |
644 | netif_carrier_on(priv->mesh_dev); | 641 | |
645 | if (!priv->tx_pending_len) | ||
646 | netif_wake_queue(priv->mesh_dev); | ||
647 | } | ||
648 | kfree(chan_list); | 642 | kfree(chan_list); |
649 | 643 | ||
650 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); | 644 | lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index a8eb9e1fcf36..4b1aab593a84 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -2025,10 +2025,8 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, | |||
2025 | if (priv->connect_status == LBS_CONNECTED) { | 2025 | if (priv->connect_status == LBS_CONNECTED) { |
2026 | memcpy(extra, priv->curbssparams.ssid, | 2026 | memcpy(extra, priv->curbssparams.ssid, |
2027 | priv->curbssparams.ssid_len); | 2027 | priv->curbssparams.ssid_len); |
2028 | extra[priv->curbssparams.ssid_len] = '\0'; | ||
2029 | } else { | 2028 | } else { |
2030 | memset(extra, 0, 32); | 2029 | memset(extra, 0, 32); |
2031 | extra[priv->curbssparams.ssid_len] = '\0'; | ||
2032 | } | 2030 | } |
2033 | /* | 2031 | /* |
2034 | * If none, we may want to get the one that was set | 2032 | * If none, we may want to get the one that was set |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index 019431d2f8a9..26a1abd5bb03 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
@@ -495,7 +495,6 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) | |||
495 | stats.band = IEEE80211_BAND_2GHZ; | 495 | stats.band = IEEE80211_BAND_2GHZ; |
496 | stats.signal = prxpd->snr; | 496 | stats.signal = prxpd->snr; |
497 | stats.noise = prxpd->nf; | 497 | stats.noise = prxpd->nf; |
498 | stats.qual = prxpd->snr - prxpd->nf; | ||
499 | /* Marvell rate index has a hole at value 4 */ | 498 | /* Marvell rate index has a hole at value 4 */ |
500 | if (prxpd->rx_rate > 4) | 499 | if (prxpd->rx_rate > 4) |
501 | --prxpd->rx_rate; | 500 | --prxpd->rx_rate; |
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index 7698fdd6a3a2..31ca241f7753 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #define MAX_RID_LEN 1024 | 23 | #define MAX_RID_LEN 1024 |
24 | 24 | ||
25 | /* Helper routine to record keys | 25 | /* Helper routine to record keys |
26 | * Do not call from interrupt context */ | 26 | * It is called under orinoco_lock so it may not sleep */ |
27 | static int orinoco_set_key(struct orinoco_private *priv, int index, | 27 | static int orinoco_set_key(struct orinoco_private *priv, int index, |
28 | enum orinoco_alg alg, const u8 *key, int key_len, | 28 | enum orinoco_alg alg, const u8 *key, int key_len, |
29 | const u8 *seq, int seq_len) | 29 | const u8 *seq, int seq_len) |
@@ -32,14 +32,14 @@ static int orinoco_set_key(struct orinoco_private *priv, int index, | |||
32 | kzfree(priv->keys[index].seq); | 32 | kzfree(priv->keys[index].seq); |
33 | 33 | ||
34 | if (key_len) { | 34 | if (key_len) { |
35 | priv->keys[index].key = kzalloc(key_len, GFP_KERNEL); | 35 | priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC); |
36 | if (!priv->keys[index].key) | 36 | if (!priv->keys[index].key) |
37 | goto nomem; | 37 | goto nomem; |
38 | } else | 38 | } else |
39 | priv->keys[index].key = NULL; | 39 | priv->keys[index].key = NULL; |
40 | 40 | ||
41 | if (seq_len) { | 41 | if (seq_len) { |
42 | priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL); | 42 | priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC); |
43 | if (!priv->keys[index].seq) | 43 | if (!priv->keys[index].seq) |
44 | goto free_key; | 44 | goto free_key; |
45 | } else | 45 | } else |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index c5fe867665e6..1a7eae357fef 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -1323,7 +1323,7 @@ | |||
1323 | #define PAIRWISE_KEY_ENTRY(__idx) \ | 1323 | #define PAIRWISE_KEY_ENTRY(__idx) \ |
1324 | ( PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) ) | 1324 | ( PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) ) |
1325 | #define MAC_IVEIV_ENTRY(__idx) \ | 1325 | #define MAC_IVEIV_ENTRY(__idx) \ |
1326 | ( MAC_IVEIV_TABLE_BASE + ((__idx) & sizeof(struct mac_iveiv_entry)) ) | 1326 | ( MAC_IVEIV_TABLE_BASE + ((__idx) * sizeof(struct mac_iveiv_entry)) ) |
1327 | #define MAC_WCID_ATTR_ENTRY(__idx) \ | 1327 | #define MAC_WCID_ATTR_ENTRY(__idx) \ |
1328 | ( MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)) ) | 1328 | ( MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)) ) |
1329 | #define SHARED_KEY_ENTRY(__idx) \ | 1329 | #define SHARED_KEY_ENTRY(__idx) \ |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index eb1e1d00bec3..27bf887f1453 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | 38 | ||
39 | #include "rt2x00.h" | 39 | #include "rt2x00.h" |
40 | #ifdef CONFIG_RT2800USB | 40 | #if defined(CONFIG_RT2800USB) || defined(CONFIG_RT2800USB_MODULE) |
41 | #include "rt2x00usb.h" | 41 | #include "rt2x00usb.h" |
42 | #endif | 42 | #endif |
43 | #include "rt2800lib.h" | 43 | #include "rt2800lib.h" |
@@ -1121,7 +1121,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
1121 | 1121 | ||
1122 | if (rt2x00_intf_is_usb(rt2x00dev)) { | 1122 | if (rt2x00_intf_is_usb(rt2x00dev)) { |
1123 | rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); | 1123 | rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); |
1124 | #ifdef CONFIG_RT2800USB | 1124 | #if defined(CONFIG_RT2800USB) || defined(CONFIG_RT2800USB_MODULE) |
1125 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, | 1125 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, |
1126 | USB_MODE_RESET, REGISTER_TIMEOUT); | 1126 | USB_MODE_RESET, REGISTER_TIMEOUT); |
1127 | #endif | 1127 | #endif |
@@ -2022,6 +2022,12 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2022 | u16 eeprom; | 2022 | u16 eeprom; |
2023 | 2023 | ||
2024 | /* | 2024 | /* |
2025 | * Disable powersaving as default on PCI devices. | ||
2026 | */ | ||
2027 | if (rt2x00_intf_is_pci(rt2x00dev)) | ||
2028 | rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
2029 | |||
2030 | /* | ||
2025 | * Initialize all hw fields. | 2031 | * Initialize all hw fields. |
2026 | */ | 2032 | */ |
2027 | rt2x00dev->hw->flags = | 2033 | rt2x00dev->hw->flags = |
@@ -2074,8 +2080,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2074 | IEEE80211_HT_CAP_SGI_20 | | 2080 | IEEE80211_HT_CAP_SGI_20 | |
2075 | IEEE80211_HT_CAP_SGI_40 | | 2081 | IEEE80211_HT_CAP_SGI_40 | |
2076 | IEEE80211_HT_CAP_TX_STBC | | 2082 | IEEE80211_HT_CAP_TX_STBC | |
2077 | IEEE80211_HT_CAP_RX_STBC | | 2083 | IEEE80211_HT_CAP_RX_STBC; |
2078 | IEEE80211_HT_CAP_PSMP_SUPPORT; | ||
2079 | spec->ht.ampdu_factor = 3; | 2084 | spec->ht.ampdu_factor = 3; |
2080 | spec->ht.ampdu_density = 4; | 2085 | spec->ht.ampdu_density = 4; |
2081 | spec->ht.mcs.tx_params = | 2086 | spec->ht.mcs.tx_params = |
@@ -2140,8 +2145,8 @@ static void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, | |||
2140 | rt2800_register_multiread(rt2x00dev, offset, | 2145 | rt2800_register_multiread(rt2x00dev, offset, |
2141 | &iveiv_entry, sizeof(iveiv_entry)); | 2146 | &iveiv_entry, sizeof(iveiv_entry)); |
2142 | 2147 | ||
2143 | memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16)); | 2148 | memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16)); |
2144 | memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32)); | 2149 | memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32)); |
2145 | } | 2150 | } |
2146 | 2151 | ||
2147 | static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | 2152 | static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value) |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index af85d18cdbe7..ab95346cf6a3 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -922,6 +922,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
922 | { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, | 922 | { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, |
923 | { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, | 923 | { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, |
924 | { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, | 924 | { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, |
925 | { USB_DEVICE(0x1737, 0x0079), USB_DEVICE_DATA(&rt2800usb_ops) }, | ||
925 | /* Logitec */ | 926 | /* Logitec */ |
926 | { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, | 927 | { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, |
927 | { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) }, | 928 | { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) }, |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 687e17dc2e9f..0ca589306d71 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2539,6 +2539,11 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2539 | unsigned int i; | 2539 | unsigned int i; |
2540 | 2540 | ||
2541 | /* | 2541 | /* |
2542 | * Disable powersaving as default. | ||
2543 | */ | ||
2544 | rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
2545 | |||
2546 | /* | ||
2542 | * Initialize all hw fields. | 2547 | * Initialize all hw fields. |
2543 | */ | 2548 | */ |
2544 | rt2x00dev->hw->flags = | 2549 | rt2x00dev->hw->flags = |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index a1a3dd15c664..8a40a1439984 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
@@ -132,7 +132,6 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) | |||
132 | 132 | ||
133 | rx_status.antenna = (flags2 >> 15) & 1; | 133 | rx_status.antenna = (flags2 >> 15) & 1; |
134 | /* TODO: improve signal/rssi reporting */ | 134 | /* TODO: improve signal/rssi reporting */ |
135 | rx_status.qual = flags2 & 0xFF; | ||
136 | rx_status.signal = (flags2 >> 8) & 0x7F; | 135 | rx_status.signal = (flags2 >> 8) & 0x7F; |
137 | /* XXX: is this correct? */ | 136 | /* XXX: is this correct? */ |
138 | rx_status.rate_idx = (flags >> 20) & 0xF; | 137 | rx_status.rate_idx = (flags >> 20) & 0xF; |
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.c b/drivers/net/wireless/wl12xx/wl1251_boot.c index 2e733e7bdfd4..28a808674080 100644 --- a/drivers/net/wireless/wl12xx/wl1251_boot.c +++ b/drivers/net/wireless/wl12xx/wl1251_boot.c | |||
@@ -256,7 +256,7 @@ int wl1251_boot_run_firmware(struct wl1251 *wl) | |||
256 | } | 256 | } |
257 | } | 257 | } |
258 | 258 | ||
259 | if (loop >= INIT_LOOP) { | 259 | if (loop > INIT_LOOP) { |
260 | wl1251_error("timeout waiting for the hardware to " | 260 | wl1251_error("timeout waiting for the hardware to " |
261 | "complete initialization"); | 261 | "complete initialization"); |
262 | return -EIO; | 262 | return -EIO; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index 886a9bc39cc1..c3385b3d246c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c | |||
@@ -777,7 +777,7 @@ out: | |||
777 | return ret; | 777 | return ret; |
778 | } | 778 | } |
779 | 779 | ||
780 | static int wl1271_build_basic_rates(char *rates, u8 band) | 780 | static int wl1271_build_basic_rates(u8 *rates, u8 band) |
781 | { | 781 | { |
782 | u8 index = 0; | 782 | u8 index = 0; |
783 | 783 | ||
@@ -804,7 +804,7 @@ static int wl1271_build_basic_rates(char *rates, u8 band) | |||
804 | return index; | 804 | return index; |
805 | } | 805 | } |
806 | 806 | ||
807 | static int wl1271_build_extended_rates(char *rates, u8 band) | 807 | static int wl1271_build_extended_rates(u8 *rates, u8 band) |
808 | { | 808 | { |
809 | u8 index = 0; | 809 | u8 index = 0; |
810 | 810 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index dfa1b9bc22c8..7ca95c414fa8 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c | |||
@@ -1325,151 +1325,11 @@ int zd_chip_set_basic_rates(struct zd_chip *chip, u16 cr_rates) | |||
1325 | return r; | 1325 | return r; |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | static int ofdm_qual_db(u8 status_quality, u8 zd_rate, unsigned int size) | ||
1329 | { | ||
1330 | static const u16 constants[] = { | ||
1331 | 715, 655, 585, 540, 470, 410, 360, 315, | ||
1332 | 270, 235, 205, 175, 150, 125, 105, 85, | ||
1333 | 65, 50, 40, 25, 15 | ||
1334 | }; | ||
1335 | |||
1336 | int i; | ||
1337 | u32 x; | ||
1338 | |||
1339 | /* It seems that their quality parameter is somehow per signal | ||
1340 | * and is now transferred per bit. | ||
1341 | */ | ||
1342 | switch (zd_rate) { | ||
1343 | case ZD_OFDM_RATE_6M: | ||
1344 | case ZD_OFDM_RATE_12M: | ||
1345 | case ZD_OFDM_RATE_24M: | ||
1346 | size *= 2; | ||
1347 | break; | ||
1348 | case ZD_OFDM_RATE_9M: | ||
1349 | case ZD_OFDM_RATE_18M: | ||
1350 | case ZD_OFDM_RATE_36M: | ||
1351 | case ZD_OFDM_RATE_54M: | ||
1352 | size *= 4; | ||
1353 | size /= 3; | ||
1354 | break; | ||
1355 | case ZD_OFDM_RATE_48M: | ||
1356 | size *= 3; | ||
1357 | size /= 2; | ||
1358 | break; | ||
1359 | default: | ||
1360 | return -EINVAL; | ||
1361 | } | ||
1362 | |||
1363 | x = (10000 * status_quality)/size; | ||
1364 | for (i = 0; i < ARRAY_SIZE(constants); i++) { | ||
1365 | if (x > constants[i]) | ||
1366 | break; | ||
1367 | } | ||
1368 | |||
1369 | switch (zd_rate) { | ||
1370 | case ZD_OFDM_RATE_6M: | ||
1371 | case ZD_OFDM_RATE_9M: | ||
1372 | i += 3; | ||
1373 | break; | ||
1374 | case ZD_OFDM_RATE_12M: | ||
1375 | case ZD_OFDM_RATE_18M: | ||
1376 | i += 5; | ||
1377 | break; | ||
1378 | case ZD_OFDM_RATE_24M: | ||
1379 | case ZD_OFDM_RATE_36M: | ||
1380 | i += 9; | ||
1381 | break; | ||
1382 | case ZD_OFDM_RATE_48M: | ||
1383 | case ZD_OFDM_RATE_54M: | ||
1384 | i += 15; | ||
1385 | break; | ||
1386 | default: | ||
1387 | return -EINVAL; | ||
1388 | } | ||
1389 | |||
1390 | return i; | ||
1391 | } | ||
1392 | |||
1393 | static int ofdm_qual_percent(u8 status_quality, u8 zd_rate, unsigned int size) | ||
1394 | { | ||
1395 | int r; | ||
1396 | |||
1397 | r = ofdm_qual_db(status_quality, zd_rate, size); | ||
1398 | ZD_ASSERT(r >= 0); | ||
1399 | if (r < 0) | ||
1400 | r = 0; | ||
1401 | |||
1402 | r = (r * 100)/29; | ||
1403 | return r <= 100 ? r : 100; | ||
1404 | } | ||
1405 | |||
1406 | static unsigned int log10times100(unsigned int x) | ||
1407 | { | ||
1408 | static const u8 log10[] = { | ||
1409 | 0, | ||
1410 | 0, 30, 47, 60, 69, 77, 84, 90, 95, 100, | ||
1411 | 104, 107, 111, 114, 117, 120, 123, 125, 127, 130, | ||
1412 | 132, 134, 136, 138, 139, 141, 143, 144, 146, 147, | ||
1413 | 149, 150, 151, 153, 154, 155, 156, 157, 159, 160, | ||
1414 | 161, 162, 163, 164, 165, 166, 167, 168, 169, 169, | ||
1415 | 170, 171, 172, 173, 174, 174, 175, 176, 177, 177, | ||
1416 | 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, | ||
1417 | 185, 185, 186, 186, 187, 188, 188, 189, 189, 190, | ||
1418 | 190, 191, 191, 192, 192, 193, 193, 194, 194, 195, | ||
1419 | 195, 196, 196, 197, 197, 198, 198, 199, 199, 200, | ||
1420 | 200, 200, 201, 201, 202, 202, 202, 203, 203, 204, | ||
1421 | 204, 204, 205, 205, 206, 206, 206, 207, 207, 207, | ||
1422 | 208, 208, 208, 209, 209, 210, 210, 210, 211, 211, | ||
1423 | 211, 212, 212, 212, 213, 213, 213, 213, 214, 214, | ||
1424 | 214, 215, 215, 215, 216, 216, 216, 217, 217, 217, | ||
1425 | 217, 218, 218, 218, 219, 219, 219, 219, 220, 220, | ||
1426 | 220, 220, 221, 221, 221, 222, 222, 222, 222, 223, | ||
1427 | 223, 223, 223, 224, 224, 224, 224, | ||
1428 | }; | ||
1429 | |||
1430 | return x < ARRAY_SIZE(log10) ? log10[x] : 225; | ||
1431 | } | ||
1432 | |||
1433 | enum { | ||
1434 | MAX_CCK_EVM_DB = 45, | ||
1435 | }; | ||
1436 | |||
1437 | static int cck_evm_db(u8 status_quality) | ||
1438 | { | ||
1439 | return (20 * log10times100(status_quality)) / 100; | ||
1440 | } | ||
1441 | |||
1442 | static int cck_snr_db(u8 status_quality) | ||
1443 | { | ||
1444 | int r = MAX_CCK_EVM_DB - cck_evm_db(status_quality); | ||
1445 | ZD_ASSERT(r >= 0); | ||
1446 | return r; | ||
1447 | } | ||
1448 | |||
1449 | static int cck_qual_percent(u8 status_quality) | ||
1450 | { | ||
1451 | int r; | ||
1452 | |||
1453 | r = cck_snr_db(status_quality); | ||
1454 | r = (100*r)/17; | ||
1455 | return r <= 100 ? r : 100; | ||
1456 | } | ||
1457 | |||
1458 | static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame) | 1328 | static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame) |
1459 | { | 1329 | { |
1460 | return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame); | 1330 | return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame); |
1461 | } | 1331 | } |
1462 | 1332 | ||
1463 | u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size, | ||
1464 | const struct rx_status *status) | ||
1465 | { | ||
1466 | return (status->frame_status&ZD_RX_OFDM) ? | ||
1467 | ofdm_qual_percent(status->signal_quality_ofdm, | ||
1468 | zd_rate_from_ofdm_plcp_header(rx_frame), | ||
1469 | size) : | ||
1470 | cck_qual_percent(status->signal_quality_cck); | ||
1471 | } | ||
1472 | |||
1473 | /** | 1333 | /** |
1474 | * zd_rx_rate - report zd-rate | 1334 | * zd_rx_rate - report zd-rate |
1475 | * @rx_frame - received frame | 1335 | * @rx_frame - received frame |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index 9fd8f3508d66..f8bbf7d302ae 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h | |||
@@ -929,9 +929,6 @@ static inline int zd_get_beacon_interval(struct zd_chip *chip, u32 *interval) | |||
929 | 929 | ||
930 | struct rx_status; | 930 | struct rx_status; |
931 | 931 | ||
932 | u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size, | ||
933 | const struct rx_status *status); | ||
934 | |||
935 | u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status); | 932 | u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status); |
936 | 933 | ||
937 | struct zd_mc_hash { | 934 | struct zd_mc_hash { |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index cf51e8f8174b..8ebf5c33955d 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -828,9 +828,6 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length) | |||
828 | stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; | 828 | stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; |
829 | stats.band = IEEE80211_BAND_2GHZ; | 829 | stats.band = IEEE80211_BAND_2GHZ; |
830 | stats.signal = status->signal_strength; | 830 | stats.signal = status->signal_strength; |
831 | stats.qual = zd_rx_qual_percent(buffer, | ||
832 | length - sizeof(struct rx_status), | ||
833 | status); | ||
834 | 831 | ||
835 | rate = zd_rx_rate(buffer, status); | 832 | rate = zd_rx_rate(buffer, status); |
836 | 833 | ||
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index bd588eb8e922..8e210cd76e55 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -121,7 +121,7 @@ struct controller { | |||
121 | #define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450 | 121 | #define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450 |
122 | #define PCI_DEVICE_ID_AMD_POGO_7458 0x7458 | 122 | #define PCI_DEVICE_ID_AMD_POGO_7458 0x7458 |
123 | 123 | ||
124 | /* AMD PCIX bridge registers */ | 124 | /* AMD PCI-X bridge registers */ |
125 | #define PCIX_MEM_BASE_LIMIT_OFFSET 0x1C | 125 | #define PCIX_MEM_BASE_LIMIT_OFFSET 0x1C |
126 | #define PCIX_MISCII_OFFSET 0x48 | 126 | #define PCIX_MISCII_OFFSET 0x48 |
127 | #define PCIX_MISC_BRIDGE_ERRORS_OFFSET 0x80 | 127 | #define PCIX_MISC_BRIDGE_ERRORS_OFFSET 0x80 |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index e56f9bed6f2b..417312528ddf 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -305,7 +305,7 @@ struct device_domain_info { | |||
305 | int segment; /* PCI domain */ | 305 | int segment; /* PCI domain */ |
306 | u8 bus; /* PCI bus number */ | 306 | u8 bus; /* PCI bus number */ |
307 | u8 devfn; /* PCI devfn number */ | 307 | u8 devfn; /* PCI devfn number */ |
308 | struct pci_dev *dev; /* it's NULL for PCIE-to-PCI bridge */ | 308 | struct pci_dev *dev; /* it's NULL for PCIe-to-PCI bridge */ |
309 | struct intel_iommu *iommu; /* IOMMU used by this device */ | 309 | struct intel_iommu *iommu; /* IOMMU used by this device */ |
310 | struct dmar_domain *domain; /* pointer to domain */ | 310 | struct dmar_domain *domain; /* pointer to domain */ |
311 | }; | 311 | }; |
@@ -1604,7 +1604,7 @@ domain_context_mapping(struct dmar_domain *domain, struct pci_dev *pdev, | |||
1604 | return ret; | 1604 | return ret; |
1605 | parent = parent->bus->self; | 1605 | parent = parent->bus->self; |
1606 | } | 1606 | } |
1607 | if (pci_is_pcie(tmp)) /* this is a PCIE-to-PCI bridge */ | 1607 | if (pci_is_pcie(tmp)) /* this is a PCIe-to-PCI bridge */ |
1608 | return domain_context_mapping_one(domain, | 1608 | return domain_context_mapping_one(domain, |
1609 | pci_domain_nr(tmp->subordinate), | 1609 | pci_domain_nr(tmp->subordinate), |
1610 | tmp->subordinate->number, 0, | 1610 | tmp->subordinate->number, 0, |
@@ -3325,7 +3325,7 @@ static void iommu_detach_dependent_devices(struct intel_iommu *iommu, | |||
3325 | parent->devfn); | 3325 | parent->devfn); |
3326 | parent = parent->bus->self; | 3326 | parent = parent->bus->self; |
3327 | } | 3327 | } |
3328 | if (pci_is_pcie(tmp)) /* this is a PCIE-to-PCI bridge */ | 3328 | if (pci_is_pcie(tmp)) /* this is a PCIe-to-PCI bridge */ |
3329 | iommu_detach_dev(iommu, | 3329 | iommu_detach_dev(iommu, |
3330 | tmp->subordinate->number, 0); | 3330 | tmp->subordinate->number, 0); |
3331 | else /* this is a legacy PCI bridge */ | 3331 | else /* this is a legacy PCI bridge */ |
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c index 8b65a489581b..95b849130ad4 100644 --- a/drivers/pci/intr_remapping.c +++ b/drivers/pci/intr_remapping.c | |||
@@ -528,7 +528,7 @@ int set_msi_sid(struct irte *irte, struct pci_dev *dev) | |||
528 | 528 | ||
529 | bridge = pci_find_upstream_pcie_bridge(dev); | 529 | bridge = pci_find_upstream_pcie_bridge(dev); |
530 | if (bridge) { | 530 | if (bridge) { |
531 | if (pci_is_pcie(bridge))/* this is a PCIE-to-PCI/PCIX bridge */ | 531 | if (pci_is_pcie(bridge))/* this is a PCIe-to-PCI/PCIX bridge */ |
532 | set_irte_sid(irte, SVT_VERIFY_BUS, SQ_ALL_16, | 532 | set_irte_sid(irte, SVT_VERIFY_BUS, SQ_ALL_16, |
533 | (bridge->bus->number << 8) | dev->bus->number); | 533 | (bridge->bus->number << 8) | dev->bus->number); |
534 | else /* this is a legacy PCI bridge */ | 534 | else /* this is a legacy PCI bridge */ |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index cc617ddd33d0..7e2829538a4c 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -112,11 +112,7 @@ static bool acpi_pci_can_wakeup(struct pci_dev *dev) | |||
112 | static void acpi_pci_propagate_wakeup_enable(struct pci_bus *bus, bool enable) | 112 | static void acpi_pci_propagate_wakeup_enable(struct pci_bus *bus, bool enable) |
113 | { | 113 | { |
114 | while (bus->parent) { | 114 | while (bus->parent) { |
115 | struct pci_dev *bridge = bus->self; | 115 | if (!acpi_pm_device_sleep_wake(&bus->self->dev, enable)) |
116 | int ret; | ||
117 | |||
118 | ret = acpi_pm_device_sleep_wake(&bridge->dev, enable); | ||
119 | if (!ret || pci_is_pcie(bridge)) | ||
120 | return; | 116 | return; |
121 | bus = bus->parent; | 117 | bus = bus->parent; |
122 | } | 118 | } |
@@ -131,9 +127,7 @@ static int acpi_pci_sleep_wake(struct pci_dev *dev, bool enable) | |||
131 | if (acpi_pci_can_wakeup(dev)) | 127 | if (acpi_pci_can_wakeup(dev)) |
132 | return acpi_pm_device_sleep_wake(&dev->dev, enable); | 128 | return acpi_pm_device_sleep_wake(&dev->dev, enable); |
133 | 129 | ||
134 | if (!pci_is_pcie(dev)) | 130 | acpi_pci_propagate_wakeup_enable(dev->bus, enable); |
135 | acpi_pci_propagate_wakeup_enable(dev->bus, enable); | ||
136 | |||
137 | return 0; | 131 | return 0; |
138 | } | 132 | } |
139 | 133 | ||
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index c5df94e86678..807224ec8351 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -75,7 +75,8 @@ static ssize_t local_cpus_show(struct device *dev, | |||
75 | int len; | 75 | int len; |
76 | 76 | ||
77 | #ifdef CONFIG_NUMA | 77 | #ifdef CONFIG_NUMA |
78 | mask = cpumask_of_node(dev_to_node(dev)); | 78 | mask = (dev_to_node(dev) == -1) ? cpu_online_mask : |
79 | cpumask_of_node(dev_to_node(dev)); | ||
79 | #else | 80 | #else |
80 | mask = cpumask_of_pcibus(to_pci_dev(dev)->bus); | 81 | mask = cpumask_of_pcibus(to_pci_dev(dev)->bus); |
81 | #endif | 82 | #endif |
@@ -93,7 +94,8 @@ static ssize_t local_cpulist_show(struct device *dev, | |||
93 | int len; | 94 | int len; |
94 | 95 | ||
95 | #ifdef CONFIG_NUMA | 96 | #ifdef CONFIG_NUMA |
96 | mask = cpumask_of_node(dev_to_node(dev)); | 97 | mask = (dev_to_node(dev) == -1) ? cpu_online_mask : |
98 | cpumask_of_node(dev_to_node(dev)); | ||
97 | #else | 99 | #else |
98 | mask = cpumask_of_pcibus(to_pci_dev(dev)->bus); | 100 | mask = cpumask_of_pcibus(to_pci_dev(dev)->bus); |
99 | #endif | 101 | #endif |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 0bc27e059019..315fea47e784 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -29,7 +29,17 @@ const char *pci_power_names[] = { | |||
29 | }; | 29 | }; |
30 | EXPORT_SYMBOL_GPL(pci_power_names); | 30 | EXPORT_SYMBOL_GPL(pci_power_names); |
31 | 31 | ||
32 | unsigned int pci_pm_d3_delay = PCI_PM_D3_WAIT; | 32 | unsigned int pci_pm_d3_delay; |
33 | |||
34 | static void pci_dev_d3_sleep(struct pci_dev *dev) | ||
35 | { | ||
36 | unsigned int delay = dev->d3_delay; | ||
37 | |||
38 | if (delay < pci_pm_d3_delay) | ||
39 | delay = pci_pm_d3_delay; | ||
40 | |||
41 | msleep(delay); | ||
42 | } | ||
33 | 43 | ||
34 | #ifdef CONFIG_PCI_DOMAINS | 44 | #ifdef CONFIG_PCI_DOMAINS |
35 | int pci_domains_supported = 1; | 45 | int pci_domains_supported = 1; |
@@ -522,7 +532,7 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
522 | /* Mandatory power management transition delays */ | 532 | /* Mandatory power management transition delays */ |
523 | /* see PCI PM 1.1 5.6.1 table 18 */ | 533 | /* see PCI PM 1.1 5.6.1 table 18 */ |
524 | if (state == PCI_D3hot || dev->current_state == PCI_D3hot) | 534 | if (state == PCI_D3hot || dev->current_state == PCI_D3hot) |
525 | msleep(pci_pm_d3_delay); | 535 | pci_dev_d3_sleep(dev); |
526 | else if (state == PCI_D2 || dev->current_state == PCI_D2) | 536 | else if (state == PCI_D2 || dev->current_state == PCI_D2) |
527 | udelay(PCI_PM_D2_DELAY); | 537 | udelay(PCI_PM_D2_DELAY); |
528 | 538 | ||
@@ -1153,11 +1163,11 @@ pci_disable_device(struct pci_dev *dev) | |||
1153 | 1163 | ||
1154 | /** | 1164 | /** |
1155 | * pcibios_set_pcie_reset_state - set reset state for device dev | 1165 | * pcibios_set_pcie_reset_state - set reset state for device dev |
1156 | * @dev: the PCI-E device reset | 1166 | * @dev: the PCIe device reset |
1157 | * @state: Reset state to enter into | 1167 | * @state: Reset state to enter into |
1158 | * | 1168 | * |
1159 | * | 1169 | * |
1160 | * Sets the PCI-E reset state for the device. This is the default | 1170 | * Sets the PCIe reset state for the device. This is the default |
1161 | * implementation. Architecture implementations can override this. | 1171 | * implementation. Architecture implementations can override this. |
1162 | */ | 1172 | */ |
1163 | int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev, | 1173 | int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev, |
@@ -1168,7 +1178,7 @@ int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev, | |||
1168 | 1178 | ||
1169 | /** | 1179 | /** |
1170 | * pci_set_pcie_reset_state - set reset state for device dev | 1180 | * pci_set_pcie_reset_state - set reset state for device dev |
1171 | * @dev: the PCI-E device reset | 1181 | * @dev: the PCIe device reset |
1172 | * @state: Reset state to enter into | 1182 | * @state: Reset state to enter into |
1173 | * | 1183 | * |
1174 | * | 1184 | * |
@@ -1409,6 +1419,7 @@ void pci_pm_init(struct pci_dev *dev) | |||
1409 | } | 1419 | } |
1410 | 1420 | ||
1411 | dev->pm_cap = pm; | 1421 | dev->pm_cap = pm; |
1422 | dev->d3_delay = PCI_PM_D3_WAIT; | ||
1412 | 1423 | ||
1413 | dev->d1_support = false; | 1424 | dev->d1_support = false; |
1414 | dev->d2_support = false; | 1425 | dev->d2_support = false; |
@@ -2247,12 +2258,12 @@ static int pci_pm_reset(struct pci_dev *dev, int probe) | |||
2247 | csr &= ~PCI_PM_CTRL_STATE_MASK; | 2258 | csr &= ~PCI_PM_CTRL_STATE_MASK; |
2248 | csr |= PCI_D3hot; | 2259 | csr |= PCI_D3hot; |
2249 | pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); | 2260 | pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); |
2250 | msleep(pci_pm_d3_delay); | 2261 | pci_dev_d3_sleep(dev); |
2251 | 2262 | ||
2252 | csr &= ~PCI_PM_CTRL_STATE_MASK; | 2263 | csr &= ~PCI_PM_CTRL_STATE_MASK; |
2253 | csr |= PCI_D0; | 2264 | csr |= PCI_D0; |
2254 | pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); | 2265 | pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); |
2255 | msleep(pci_pm_d3_delay); | 2266 | pci_dev_d3_sleep(dev); |
2256 | 2267 | ||
2257 | return 0; | 2268 | return 0; |
2258 | } | 2269 | } |
@@ -2296,6 +2307,10 @@ static int pci_dev_reset(struct pci_dev *dev, int probe) | |||
2296 | down(&dev->dev.sem); | 2307 | down(&dev->dev.sem); |
2297 | } | 2308 | } |
2298 | 2309 | ||
2310 | rc = pci_dev_specific_reset(dev, probe); | ||
2311 | if (rc != -ENOTTY) | ||
2312 | goto done; | ||
2313 | |||
2299 | rc = pcie_flr(dev, probe); | 2314 | rc = pcie_flr(dev, probe); |
2300 | if (rc != -ENOTTY) | 2315 | if (rc != -ENOTTY) |
2301 | goto done; | 2316 | goto done; |
@@ -2779,6 +2794,11 @@ int __attribute__ ((weak)) pci_ext_cfg_avail(struct pci_dev *dev) | |||
2779 | return 1; | 2794 | return 1; |
2780 | } | 2795 | } |
2781 | 2796 | ||
2797 | void __weak pci_fixup_cardbus(struct pci_bus *bus) | ||
2798 | { | ||
2799 | } | ||
2800 | EXPORT_SYMBOL(pci_fixup_cardbus); | ||
2801 | |||
2782 | static int __init pci_setup(char *str) | 2802 | static int __init pci_setup(char *str) |
2783 | { | 2803 | { |
2784 | while (str) { | 2804 | while (str) { |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 33ed8e0aba1e..fbd0e3adbca3 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -313,4 +313,12 @@ static inline int pci_resource_alignment(struct pci_dev *dev, | |||
313 | 313 | ||
314 | extern void pci_enable_acs(struct pci_dev *dev); | 314 | extern void pci_enable_acs(struct pci_dev *dev); |
315 | 315 | ||
316 | struct pci_dev_reset_methods { | ||
317 | u16 vendor; | ||
318 | u16 device; | ||
319 | int (*reset)(struct pci_dev *dev, int probe); | ||
320 | }; | ||
321 | |||
322 | extern int pci_dev_specific_reset(struct pci_dev *dev, int probe); | ||
323 | |||
316 | #endif /* DRIVERS_PCI_H */ | 324 | #endif /* DRIVERS_PCI_H */ |
diff --git a/drivers/pci/pcie/aer/Kconfig.debug b/drivers/pci/pcie/aer/Kconfig.debug index b8c925c1f6aa..9142949734f5 100644 --- a/drivers/pci/pcie/aer/Kconfig.debug +++ b/drivers/pci/pcie/aer/Kconfig.debug | |||
@@ -3,14 +3,14 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | config PCIEAER_INJECT | 5 | config PCIEAER_INJECT |
6 | tristate "PCIE AER error injector support" | 6 | tristate "PCIe AER error injector support" |
7 | depends on PCIEAER | 7 | depends on PCIEAER |
8 | default n | 8 | default n |
9 | help | 9 | help |
10 | This enables PCI Express Root Port Advanced Error Reporting | 10 | This enables PCI Express Root Port Advanced Error Reporting |
11 | (AER) software error injector. | 11 | (AER) software error injector. |
12 | 12 | ||
13 | Debuging PCIE AER code is quite difficult because it is hard | 13 | Debugging PCIe AER code is quite difficult because it is hard |
14 | to trigger various real hardware errors. Software based | 14 | to trigger various real hardware errors. Software based |
15 | error injection can fake almost all kinds of errors with the | 15 | error injection can fake almost all kinds of errors with the |
16 | help of a user space helper tool aer-inject, which can be | 16 | help of a user space helper tool aer-inject, which can be |
diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c index 7fcd5331b14c..8c30a9544d61 100644 --- a/drivers/pci/pcie/aer/aer_inject.c +++ b/drivers/pci/pcie/aer/aer_inject.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * PCIE AER software error injection support. | 2 | * PCIe AER software error injection support. |
3 | * | 3 | * |
4 | * Debuging PCIE AER code is quite difficult because it is hard to | 4 | * Debuging PCIe AER code is quite difficult because it is hard to |
5 | * trigger various real hardware errors. Software based error | 5 | * trigger various real hardware errors. Software based error |
6 | * injection can fake almost all kinds of errors with the help of a | 6 | * injection can fake almost all kinds of errors with the help of a |
7 | * user space helper tool aer-inject, which can be gotten from: | 7 | * user space helper tool aer-inject, which can be gotten from: |
@@ -321,7 +321,7 @@ static int aer_inject(struct aer_error_inj *einj) | |||
321 | unsigned long flags; | 321 | unsigned long flags; |
322 | unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn); | 322 | unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn); |
323 | int pos_cap_err, rp_pos_cap_err; | 323 | int pos_cap_err, rp_pos_cap_err; |
324 | u32 sever; | 324 | u32 sever, mask; |
325 | int ret = 0; | 325 | int ret = 0; |
326 | 326 | ||
327 | dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn); | 327 | dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn); |
@@ -374,6 +374,24 @@ static int aer_inject(struct aer_error_inj *einj) | |||
374 | err->header_log2 = einj->header_log2; | 374 | err->header_log2 = einj->header_log2; |
375 | err->header_log3 = einj->header_log3; | 375 | err->header_log3 = einj->header_log3; |
376 | 376 | ||
377 | pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &mask); | ||
378 | if (einj->cor_status && !(einj->cor_status & ~mask)) { | ||
379 | ret = -EINVAL; | ||
380 | printk(KERN_WARNING "The correctable error(s) is masked " | ||
381 | "by device\n"); | ||
382 | spin_unlock_irqrestore(&inject_lock, flags); | ||
383 | goto out_put; | ||
384 | } | ||
385 | |||
386 | pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK, &mask); | ||
387 | if (einj->uncor_status && !(einj->uncor_status & ~mask)) { | ||
388 | ret = -EINVAL; | ||
389 | printk(KERN_WARNING "The uncorrectable error(s) is masked " | ||
390 | "by device\n"); | ||
391 | spin_unlock_irqrestore(&inject_lock, flags); | ||
392 | goto out_put; | ||
393 | } | ||
394 | |||
377 | rperr = __find_aer_error_by_dev(rpdev); | 395 | rperr = __find_aer_error_by_dev(rpdev); |
378 | if (!rperr) { | 396 | if (!rperr) { |
379 | rperr = rperr_alloc; | 397 | rperr = rperr_alloc; |
@@ -413,8 +431,14 @@ static int aer_inject(struct aer_error_inj *einj) | |||
413 | if (ret) | 431 | if (ret) |
414 | goto out_put; | 432 | goto out_put; |
415 | 433 | ||
416 | if (find_aer_device(rpdev, &edev)) | 434 | if (find_aer_device(rpdev, &edev)) { |
435 | if (!get_service_data(edev)) { | ||
436 | printk(KERN_WARNING "AER service is not initialized\n"); | ||
437 | ret = -EINVAL; | ||
438 | goto out_put; | ||
439 | } | ||
417 | aer_irq(-1, edev); | 440 | aer_irq(-1, edev); |
441 | } | ||
418 | else | 442 | else |
419 | ret = -EINVAL; | 443 | ret = -EINVAL; |
420 | out_put: | 444 | out_put: |
@@ -484,5 +508,5 @@ static void __exit aer_inject_exit(void) | |||
484 | module_init(aer_inject_init); | 508 | module_init(aer_inject_init); |
485 | module_exit(aer_inject_exit); | 509 | module_exit(aer_inject_exit); |
486 | 510 | ||
487 | MODULE_DESCRIPTION("PCIE AER software error injector"); | 511 | MODULE_DESCRIPTION("PCIe AER software error injector"); |
488 | MODULE_LICENSE("GPL"); | 512 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index 97a345927b55..21f215f4daa3 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
@@ -155,7 +155,7 @@ static struct aer_rpc *aer_alloc_rpc(struct pcie_device *dev) | |||
155 | mutex_init(&rpc->rpc_mutex); | 155 | mutex_init(&rpc->rpc_mutex); |
156 | init_waitqueue_head(&rpc->wait_release); | 156 | init_waitqueue_head(&rpc->wait_release); |
157 | 157 | ||
158 | /* Use PCIE bus function to store rpc into PCIE device */ | 158 | /* Use PCIe bus function to store rpc into PCIe device */ |
159 | set_service_data(dev, rpc); | 159 | set_service_data(dev, rpc); |
160 | 160 | ||
161 | return rpc; | 161 | return rpc; |
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c index 8edb2f300e8f..04814087658d 100644 --- a/drivers/pci/pcie/aer/aerdrv_acpi.c +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * | 24 | * |
25 | * @return: Zero on success. Nonzero otherwise. | 25 | * @return: Zero on success. Nonzero otherwise. |
26 | * | 26 | * |
27 | * Invoked when PCIE bus loads AER service driver. To avoid conflict with | 27 | * Invoked when PCIe bus loads AER service driver. To avoid conflict with |
28 | * BIOS AER support requires BIOS to yield AER control to OS native driver. | 28 | * BIOS AER support requires BIOS to yield AER control to OS native driver. |
29 | **/ | 29 | **/ |
30 | int aer_osc_setup(struct pcie_device *pciedev) | 30 | int aer_osc_setup(struct pcie_device *pciedev) |
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index ae672ca80333..c843a799814d 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
@@ -587,7 +587,7 @@ static void handle_error_source(struct pcie_device *aerdev, | |||
587 | * aer_enable_rootport - enable Root Port's interrupts when receiving messages | 587 | * aer_enable_rootport - enable Root Port's interrupts when receiving messages |
588 | * @rpc: pointer to a Root Port data structure | 588 | * @rpc: pointer to a Root Port data structure |
589 | * | 589 | * |
590 | * Invoked when PCIE bus loads AER service driver. | 590 | * Invoked when PCIe bus loads AER service driver. |
591 | */ | 591 | */ |
592 | void aer_enable_rootport(struct aer_rpc *rpc) | 592 | void aer_enable_rootport(struct aer_rpc *rpc) |
593 | { | 593 | { |
@@ -597,7 +597,7 @@ void aer_enable_rootport(struct aer_rpc *rpc) | |||
597 | u32 reg32; | 597 | u32 reg32; |
598 | 598 | ||
599 | pos = pci_pcie_cap(pdev); | 599 | pos = pci_pcie_cap(pdev); |
600 | /* Clear PCIE Capability's Device Status */ | 600 | /* Clear PCIe Capability's Device Status */ |
601 | pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, ®16); | 601 | pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, ®16); |
602 | pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16); | 602 | pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16); |
603 | 603 | ||
@@ -631,7 +631,7 @@ void aer_enable_rootport(struct aer_rpc *rpc) | |||
631 | * disable_root_aer - disable Root Port's interrupts when receiving messages | 631 | * disable_root_aer - disable Root Port's interrupts when receiving messages |
632 | * @rpc: pointer to a Root Port data structure | 632 | * @rpc: pointer to a Root Port data structure |
633 | * | 633 | * |
634 | * Invoked when PCIE bus unloads AER service driver. | 634 | * Invoked when PCIe bus unloads AER service driver. |
635 | */ | 635 | */ |
636 | static void disable_root_aer(struct aer_rpc *rpc) | 636 | static void disable_root_aer(struct aer_rpc *rpc) |
637 | { | 637 | { |
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index 44acde72294f..9d3e4c8d0184 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c | |||
@@ -184,7 +184,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
184 | 184 | ||
185 | if (info->status == 0) { | 185 | if (info->status == 0) { |
186 | AER_PR(info, dev, | 186 | AER_PR(info, dev, |
187 | "PCIE Bus Error: severity=%s, type=Unaccessible, " | 187 | "PCIe Bus Error: severity=%s, type=Unaccessible, " |
188 | "id=%04x(Unregistered Agent ID)\n", | 188 | "id=%04x(Unregistered Agent ID)\n", |
189 | aer_error_severity_string[info->severity], id); | 189 | aer_error_severity_string[info->severity], id); |
190 | } else { | 190 | } else { |
@@ -194,7 +194,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
194 | agent = AER_GET_AGENT(info->severity, info->status); | 194 | agent = AER_GET_AGENT(info->severity, info->status); |
195 | 195 | ||
196 | AER_PR(info, dev, | 196 | AER_PR(info, dev, |
197 | "PCIE Bus Error: severity=%s, type=%s, id=%04x(%s)\n", | 197 | "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n", |
198 | aer_error_severity_string[info->severity], | 198 | aer_error_severity_string[info->severity], |
199 | aer_error_layer[layer], id, aer_agent_string[agent]); | 199 | aer_error_layer[layer], id, aer_agent_string[agent]); |
200 | 200 | ||
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 5a01fc7fbf05..be53d98fa384 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * File: drivers/pci/pcie/aspm.c | 2 | * File: drivers/pci/pcie/aspm.c |
3 | * Enabling PCIE link L0s/L1 state and Clock Power Management | 3 | * Enabling PCIe link L0s/L1 state and Clock Power Management |
4 | * | 4 | * |
5 | * Copyright (C) 2007 Intel | 5 | * Copyright (C) 2007 Intel |
6 | * Copyright (C) Zhang Yanmin (yanmin.zhang@intel.com) | 6 | * Copyright (C) Zhang Yanmin (yanmin.zhang@intel.com) |
@@ -499,7 +499,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev) | |||
499 | int pos; | 499 | int pos; |
500 | u32 reg32; | 500 | u32 reg32; |
501 | /* | 501 | /* |
502 | * Some functions in a slot might not all be PCIE functions, | 502 | * Some functions in a slot might not all be PCIe functions, |
503 | * very strange. Disable ASPM for the whole slot | 503 | * very strange. Disable ASPM for the whole slot |
504 | */ | 504 | */ |
505 | list_for_each_entry(child, &pdev->subordinate->devices, bus_list) { | 505 | list_for_each_entry(child, &pdev->subordinate->devices, bus_list) { |
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 413262eb95b7..b174188ac121 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -27,7 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | static void release_pcie_device(struct device *dev) | 28 | static void release_pcie_device(struct device *dev) |
29 | { | 29 | { |
30 | kfree(to_pcie_device(dev)); | 30 | kfree(to_pcie_device(dev)); |
31 | } | 31 | } |
32 | 32 | ||
33 | /** | 33 | /** |
@@ -346,12 +346,11 @@ static int suspend_iter(struct device *dev, void *data) | |||
346 | { | 346 | { |
347 | struct pcie_port_service_driver *service_driver; | 347 | struct pcie_port_service_driver *service_driver; |
348 | 348 | ||
349 | if ((dev->bus == &pcie_port_bus_type) && | 349 | if ((dev->bus == &pcie_port_bus_type) && dev->driver) { |
350 | (dev->driver)) { | 350 | service_driver = to_service_driver(dev->driver); |
351 | service_driver = to_service_driver(dev->driver); | 351 | if (service_driver->suspend) |
352 | if (service_driver->suspend) | 352 | service_driver->suspend(to_pcie_device(dev)); |
353 | service_driver->suspend(to_pcie_device(dev)); | 353 | } |
354 | } | ||
355 | return 0; | 354 | return 0; |
356 | } | 355 | } |
357 | 356 | ||
@@ -494,6 +493,7 @@ int pcie_port_service_register(struct pcie_port_service_driver *new) | |||
494 | 493 | ||
495 | return driver_register(&new->driver); | 494 | return driver_register(&new->driver); |
496 | } | 495 | } |
496 | EXPORT_SYMBOL(pcie_port_service_register); | ||
497 | 497 | ||
498 | /** | 498 | /** |
499 | * pcie_port_service_unregister - unregister PCI Express port service driver | 499 | * pcie_port_service_unregister - unregister PCI Express port service driver |
@@ -503,6 +503,4 @@ void pcie_port_service_unregister(struct pcie_port_service_driver *drv) | |||
503 | { | 503 | { |
504 | driver_unregister(&drv->driver); | 504 | driver_unregister(&drv->driver); |
505 | } | 505 | } |
506 | |||
507 | EXPORT_SYMBOL(pcie_port_service_register); | ||
508 | EXPORT_SYMBOL(pcie_port_service_unregister); | 506 | EXPORT_SYMBOL(pcie_port_service_unregister); |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index a49452e2aed9..13c8972886e6 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | #define DRIVER_VERSION "v1.0" | 25 | #define DRIVER_VERSION "v1.0" |
26 | #define DRIVER_AUTHOR "tom.l.nguyen@intel.com" | 26 | #define DRIVER_AUTHOR "tom.l.nguyen@intel.com" |
27 | #define DRIVER_DESC "PCIE Port Bus Driver" | 27 | #define DRIVER_DESC "PCIe Port Bus Driver" |
28 | MODULE_AUTHOR(DRIVER_AUTHOR); | 28 | MODULE_AUTHOR(DRIVER_AUTHOR); |
29 | MODULE_DESCRIPTION(DRIVER_DESC); | 29 | MODULE_DESCRIPTION(DRIVER_DESC); |
30 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
@@ -63,7 +63,7 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = { | |||
63 | * pcie_portdrv_probe - Probe PCI-Express port devices | 63 | * pcie_portdrv_probe - Probe PCI-Express port devices |
64 | * @dev: PCI-Express port device being probed | 64 | * @dev: PCI-Express port device being probed |
65 | * | 65 | * |
66 | * If detected invokes the pcie_port_device_register() method for | 66 | * If detected invokes the pcie_port_device_register() method for |
67 | * this port device. | 67 | * this port device. |
68 | * | 68 | * |
69 | */ | 69 | */ |
@@ -78,7 +78,7 @@ static int __devinit pcie_portdrv_probe(struct pci_dev *dev, | |||
78 | (dev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM))) | 78 | (dev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM))) |
79 | return -ENODEV; | 79 | return -ENODEV; |
80 | 80 | ||
81 | if (!dev->irq && dev->pin) { | 81 | if (!dev->irq && dev->pin) { |
82 | dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; " | 82 | dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; " |
83 | "check vendor BIOS\n", dev->vendor, dev->device); | 83 | "check vendor BIOS\n", dev->vendor, dev->device); |
84 | } | 84 | } |
@@ -91,7 +91,7 @@ static int __devinit pcie_portdrv_probe(struct pci_dev *dev, | |||
91 | return 0; | 91 | return 0; |
92 | } | 92 | } |
93 | 93 | ||
94 | static void pcie_portdrv_remove (struct pci_dev *dev) | 94 | static void pcie_portdrv_remove(struct pci_dev *dev) |
95 | { | 95 | { |
96 | pcie_port_device_remove(dev); | 96 | pcie_port_device_remove(dev); |
97 | pci_disable_device(dev); | 97 | pci_disable_device(dev); |
@@ -129,14 +129,13 @@ static int error_detected_iter(struct device *device, void *data) | |||
129 | static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev, | 129 | static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev, |
130 | enum pci_channel_state error) | 130 | enum pci_channel_state error) |
131 | { | 131 | { |
132 | struct aer_broadcast_data result_data = | 132 | struct aer_broadcast_data data = {error, PCI_ERS_RESULT_CAN_RECOVER}; |
133 | {error, PCI_ERS_RESULT_CAN_RECOVER}; | 133 | int ret; |
134 | int retval; | ||
135 | 134 | ||
136 | /* can not fail */ | 135 | /* can not fail */ |
137 | retval = device_for_each_child(&dev->dev, &result_data, error_detected_iter); | 136 | ret = device_for_each_child(&dev->dev, &data, error_detected_iter); |
138 | 137 | ||
139 | return result_data.result; | 138 | return data.result; |
140 | } | 139 | } |
141 | 140 | ||
142 | static int mmio_enabled_iter(struct device *device, void *data) | 141 | static int mmio_enabled_iter(struct device *device, void *data) |
@@ -290,7 +289,7 @@ static int __init pcie_portdrv_init(void) | |||
290 | return retval; | 289 | return retval; |
291 | } | 290 | } |
292 | 291 | ||
293 | static void __exit pcie_portdrv_exit(void) | 292 | static void __exit pcie_portdrv_exit(void) |
294 | { | 293 | { |
295 | pci_unregister_driver(&pcie_portdriver); | 294 | pci_unregister_driver(&pcie_portdriver); |
296 | pcie_port_bus_unregister(); | 295 | pcie_port_bus_unregister(); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 7cfa7c38d318..c74694345b6e 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -2629,14 +2629,86 @@ static int __init pci_apply_final_quirks(void) | |||
2629 | if (!pci_cache_line_size) { | 2629 | if (!pci_cache_line_size) { |
2630 | printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n", | 2630 | printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n", |
2631 | cls << 2, pci_dfl_cache_line_size << 2); | 2631 | cls << 2, pci_dfl_cache_line_size << 2); |
2632 | pci_cache_line_size = cls; | 2632 | pci_cache_line_size = cls ? cls : pci_dfl_cache_line_size; |
2633 | } | 2633 | } |
2634 | 2634 | ||
2635 | return 0; | 2635 | return 0; |
2636 | } | 2636 | } |
2637 | 2637 | ||
2638 | fs_initcall_sync(pci_apply_final_quirks); | 2638 | fs_initcall_sync(pci_apply_final_quirks); |
2639 | |||
2640 | /* | ||
2641 | * Followings are device-specific reset methods which can be used to | ||
2642 | * reset a single function if other methods (e.g. FLR, PM D0->D3) are | ||
2643 | * not available. | ||
2644 | */ | ||
2645 | static int reset_intel_generic_dev(struct pci_dev *dev, int probe) | ||
2646 | { | ||
2647 | int pos; | ||
2648 | |||
2649 | /* only implement PCI_CLASS_SERIAL_USB at present */ | ||
2650 | if (dev->class == PCI_CLASS_SERIAL_USB) { | ||
2651 | pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); | ||
2652 | if (!pos) | ||
2653 | return -ENOTTY; | ||
2654 | |||
2655 | if (probe) | ||
2656 | return 0; | ||
2657 | |||
2658 | pci_write_config_byte(dev, pos + 0x4, 1); | ||
2659 | msleep(100); | ||
2660 | |||
2661 | return 0; | ||
2662 | } else { | ||
2663 | return -ENOTTY; | ||
2664 | } | ||
2665 | } | ||
2666 | |||
2667 | static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe) | ||
2668 | { | ||
2669 | int pos; | ||
2670 | |||
2671 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | ||
2672 | if (!pos) | ||
2673 | return -ENOTTY; | ||
2674 | |||
2675 | if (probe) | ||
2676 | return 0; | ||
2677 | |||
2678 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, | ||
2679 | PCI_EXP_DEVCTL_BCR_FLR); | ||
2680 | msleep(100); | ||
2681 | |||
2682 | return 0; | ||
2683 | } | ||
2684 | |||
2685 | #define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed | ||
2686 | |||
2687 | static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { | ||
2688 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF, | ||
2689 | reset_intel_82599_sfp_virtfn }, | ||
2690 | { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, | ||
2691 | reset_intel_generic_dev }, | ||
2692 | { 0 } | ||
2693 | }; | ||
2694 | |||
2695 | int pci_dev_specific_reset(struct pci_dev *dev, int probe) | ||
2696 | { | ||
2697 | const struct pci_dev_reset_methods *i; | ||
2698 | |||
2699 | for (i = pci_dev_reset_methods; i->reset; i++) { | ||
2700 | if ((i->vendor == dev->vendor || | ||
2701 | i->vendor == (u16)PCI_ANY_ID) && | ||
2702 | (i->device == dev->device || | ||
2703 | i->device == (u16)PCI_ANY_ID)) | ||
2704 | return i->reset(dev, probe); | ||
2705 | } | ||
2706 | |||
2707 | return -ENOTTY; | ||
2708 | } | ||
2709 | |||
2639 | #else | 2710 | #else |
2640 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} | 2711 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} |
2712 | int pci_dev_specific_reset(struct pci_dev *dev, int probe) { return -ENOTTY; } | ||
2641 | #endif | 2713 | #endif |
2642 | EXPORT_SYMBOL(pci_fixup_device); | 2714 | EXPORT_SYMBOL(pci_fixup_device); |
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 6dae87143258..4a471dc4f4b9 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -15,9 +15,9 @@ | |||
15 | 15 | ||
16 | DECLARE_RWSEM(pci_bus_sem); | 16 | DECLARE_RWSEM(pci_bus_sem); |
17 | /* | 17 | /* |
18 | * find the upstream PCIE-to-PCI bridge of a PCI device | 18 | * find the upstream PCIe-to-PCI bridge of a PCI device |
19 | * if the device is PCIE, return NULL | 19 | * if the device is PCIE, return NULL |
20 | * if the device isn't connected to a PCIE bridge (that is its parent is a | 20 | * if the device isn't connected to a PCIe bridge (that is its parent is a |
21 | * legacy PCI bridge and the bridge is directly connected to bus 0), return its | 21 | * legacy PCI bridge and the bridge is directly connected to bus 0), return its |
22 | * parent | 22 | * parent |
23 | */ | 23 | */ |
@@ -37,7 +37,7 @@ pci_find_upstream_pcie_bridge(struct pci_dev *pdev) | |||
37 | tmp = pdev; | 37 | tmp = pdev; |
38 | continue; | 38 | continue; |
39 | } | 39 | } |
40 | /* PCI device should connect to a PCIE bridge */ | 40 | /* PCI device should connect to a PCIe bridge */ |
41 | if (pdev->pcie_type != PCI_EXP_TYPE_PCI_BRIDGE) { | 41 | if (pdev->pcie_type != PCI_EXP_TYPE_PCI_BRIDGE) { |
42 | /* Busted hardware? */ | 42 | /* Busted hardware? */ |
43 | WARN_ON_ONCE(1); | 43 | WARN_ON_ONCE(1); |
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index cdf50f3bc2df..d99f846451a3 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c | |||
@@ -222,7 +222,7 @@ int __ref cb_alloc(struct pcmcia_socket *s) | |||
222 | unsigned int max, pass; | 222 | unsigned int max, pass; |
223 | 223 | ||
224 | s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0)); | 224 | s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0)); |
225 | /* pcibios_fixup_bus(bus); */ | 225 | pci_fixup_cardbus(bus); |
226 | 226 | ||
227 | max = bus->secondary; | 227 | max = bus->secondary; |
228 | for (pass = 0; pass < 2; pass++) | 228 | for (pass = 0; pass < 2; pass++) |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index ec4faffe6b05..db32c25e3605 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -231,8 +231,36 @@ config THINKPAD_ACPI | |||
231 | 231 | ||
232 | This driver was formerly known as ibm-acpi. | 232 | This driver was formerly known as ibm-acpi. |
233 | 233 | ||
234 | Extra functionality will be available if the rfkill (CONFIG_RFKILL) | ||
235 | and/or ALSA (CONFIG_SND) subsystems are available in the kernel. | ||
236 | Note that if you want ThinkPad-ACPI to be built-in instead of | ||
237 | modular, ALSA and rfkill will also have to be built-in. | ||
238 | |||
234 | If you have an IBM or Lenovo ThinkPad laptop, say Y or M here. | 239 | If you have an IBM or Lenovo ThinkPad laptop, say Y or M here. |
235 | 240 | ||
241 | config THINKPAD_ACPI_ALSA_SUPPORT | ||
242 | bool "Console audio control ALSA interface" | ||
243 | depends on THINKPAD_ACPI | ||
244 | depends on SND | ||
245 | depends on SND = y || THINKPAD_ACPI = SND | ||
246 | default y | ||
247 | ---help--- | ||
248 | Enables monitoring of the built-in console audio output control | ||
249 | (headphone and speakers), which is operated by the mute and (in | ||
250 | some ThinkPad models) volume hotkeys. | ||
251 | |||
252 | If this option is enabled, ThinkPad-ACPI will export an ALSA card | ||
253 | with a single read-only mixer control, which should be used for | ||
254 | on-screen-display feedback purposes by the Desktop Environment. | ||
255 | |||
256 | Optionally, the driver will also allow software control (the | ||
257 | ALSA mixer will be made read-write). Please refer to the driver | ||
258 | documentation for details. | ||
259 | |||
260 | All IBM models have both volume and mute control. Newer Lenovo | ||
261 | models only have mute control (the volume hotkeys are just normal | ||
262 | keys and volume control is done through the main HDA mixer). | ||
263 | |||
236 | config THINKPAD_ACPI_DEBUGFACILITIES | 264 | config THINKPAD_ACPI_DEBUGFACILITIES |
237 | bool "Maintainer debug facilities" | 265 | bool "Maintainer debug facilities" |
238 | depends on THINKPAD_ACPI | 266 | depends on THINKPAD_ACPI |
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 916ccb2b316c..1b1dddbd5744 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c | |||
@@ -202,8 +202,13 @@ static void dell_wmi_notify(u32 value, void *context) | |||
202 | struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; | 202 | struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; |
203 | static struct key_entry *key; | 203 | static struct key_entry *key; |
204 | union acpi_object *obj; | 204 | union acpi_object *obj; |
205 | acpi_status status; | ||
205 | 206 | ||
206 | wmi_get_event_data(value, &response); | 207 | status = wmi_get_event_data(value, &response); |
208 | if (status != AE_OK) { | ||
209 | printk(KERN_INFO "dell-wmi: bad event status 0x%x\n", status); | ||
210 | return; | ||
211 | } | ||
207 | 212 | ||
208 | obj = (union acpi_object *)response.pointer; | 213 | obj = (union acpi_object *)response.pointer; |
209 | 214 | ||
@@ -323,8 +328,9 @@ static int __init dell_wmi_input_setup(void) | |||
323 | static int __init dell_wmi_init(void) | 328 | static int __init dell_wmi_init(void) |
324 | { | 329 | { |
325 | int err; | 330 | int err; |
331 | acpi_status status; | ||
326 | 332 | ||
327 | if (wmi_has_guid(DELL_EVENT_GUID)) { | 333 | if (!wmi_has_guid(DELL_EVENT_GUID)) { |
328 | printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); | 334 | printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); |
329 | return -ENODEV; | 335 | return -ENODEV; |
330 | } | 336 | } |
@@ -336,14 +342,14 @@ static int __init dell_wmi_init(void) | |||
336 | if (err) | 342 | if (err) |
337 | return err; | 343 | return err; |
338 | 344 | ||
339 | err = wmi_install_notify_handler(DELL_EVENT_GUID, | 345 | status = wmi_install_notify_handler(DELL_EVENT_GUID, |
340 | dell_wmi_notify, NULL); | 346 | dell_wmi_notify, NULL); |
341 | if (err) { | 347 | if (ACPI_FAILURE(status)) { |
342 | input_unregister_device(dell_wmi_input_dev); | 348 | input_unregister_device(dell_wmi_input_dev); |
343 | printk(KERN_ERR | 349 | printk(KERN_ERR |
344 | "dell-wmi: Unable to register notify handler - %d\n", | 350 | "dell-wmi: Unable to register notify handler - %d\n", |
345 | err); | 351 | status); |
346 | return err; | 352 | return -ENODEV; |
347 | } | 353 | } |
348 | 354 | ||
349 | return 0; | 355 | return 0; |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 8781d8fa7a57..ad4c414dbfbc 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -338,8 +338,13 @@ static void hp_wmi_notify(u32 value, void *context) | |||
338 | static struct key_entry *key; | 338 | static struct key_entry *key; |
339 | union acpi_object *obj; | 339 | union acpi_object *obj; |
340 | int eventcode; | 340 | int eventcode; |
341 | acpi_status status; | ||
341 | 342 | ||
342 | wmi_get_event_data(value, &response); | 343 | status = wmi_get_event_data(value, &response); |
344 | if (status != AE_OK) { | ||
345 | printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status); | ||
346 | return; | ||
347 | } | ||
343 | 348 | ||
344 | obj = (union acpi_object *)response.pointer; | 349 | obj = (union acpi_object *)response.pointer; |
345 | 350 | ||
@@ -388,8 +393,6 @@ static void hp_wmi_notify(u32 value, void *context) | |||
388 | } else | 393 | } else |
389 | printk(KERN_INFO "HP WMI: Unknown key pressed - %x\n", | 394 | printk(KERN_INFO "HP WMI: Unknown key pressed - %x\n", |
390 | eventcode); | 395 | eventcode); |
391 | |||
392 | kfree(obj); | ||
393 | } | 396 | } |
394 | 397 | ||
395 | static int __init hp_wmi_input_setup(void) | 398 | static int __init hp_wmi_input_setup(void) |
@@ -581,7 +584,7 @@ static int __init hp_wmi_init(void) | |||
581 | if (wmi_has_guid(HPWMI_EVENT_GUID)) { | 584 | if (wmi_has_guid(HPWMI_EVENT_GUID)) { |
582 | err = wmi_install_notify_handler(HPWMI_EVENT_GUID, | 585 | err = wmi_install_notify_handler(HPWMI_EVENT_GUID, |
583 | hp_wmi_notify, NULL); | 586 | hp_wmi_notify, NULL); |
584 | if (!err) | 587 | if (ACPI_SUCCESS(err)) |
585 | hp_wmi_input_setup(); | 588 | hp_wmi_input_setup(); |
586 | } | 589 | } |
587 | 590 | ||
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c index 7f77f908bb01..f5f70d4c6913 100644 --- a/drivers/platform/x86/msi-wmi.c +++ b/drivers/platform/x86/msi-wmi.c | |||
@@ -149,8 +149,13 @@ static void msi_wmi_notify(u32 value, void *context) | |||
149 | static struct key_entry *key; | 149 | static struct key_entry *key; |
150 | union acpi_object *obj; | 150 | union acpi_object *obj; |
151 | ktime_t cur; | 151 | ktime_t cur; |
152 | acpi_status status; | ||
152 | 153 | ||
153 | wmi_get_event_data(value, &response); | 154 | status = wmi_get_event_data(value, &response); |
155 | if (status != AE_OK) { | ||
156 | printk(KERN_INFO DRV_PFX "bad event status 0x%x\n", status); | ||
157 | return; | ||
158 | } | ||
154 | 159 | ||
155 | obj = (union acpi_object *)response.pointer; | 160 | obj = (union acpi_object *)response.pointer; |
156 | 161 | ||
@@ -236,7 +241,7 @@ static int __init msi_wmi_init(void) | |||
236 | } | 241 | } |
237 | err = wmi_install_notify_handler(MSIWMI_EVENT_GUID, | 242 | err = wmi_install_notify_handler(MSIWMI_EVENT_GUID, |
238 | msi_wmi_notify, NULL); | 243 | msi_wmi_notify, NULL); |
239 | if (err) | 244 | if (ACPI_FAILURE(err)) |
240 | return -EINVAL; | 245 | return -EINVAL; |
241 | 246 | ||
242 | err = msi_wmi_input_setup(); | 247 | err = msi_wmi_input_setup(); |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 448c8aeb166b..e67e4feb35cb 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -6384,11 +6384,13 @@ static struct ibm_struct brightness_driver_data = { | |||
6384 | * and we leave them unchanged. | 6384 | * and we leave them unchanged. |
6385 | */ | 6385 | */ |
6386 | 6386 | ||
6387 | #ifdef CONFIG_THINKPAD_ACPI_ALSA_SUPPORT | ||
6388 | |||
6387 | #define TPACPI_ALSA_DRVNAME "ThinkPad EC" | 6389 | #define TPACPI_ALSA_DRVNAME "ThinkPad EC" |
6388 | #define TPACPI_ALSA_SHRTNAME "ThinkPad Console Audio Control" | 6390 | #define TPACPI_ALSA_SHRTNAME "ThinkPad Console Audio Control" |
6389 | #define TPACPI_ALSA_MIXERNAME TPACPI_ALSA_SHRTNAME | 6391 | #define TPACPI_ALSA_MIXERNAME TPACPI_ALSA_SHRTNAME |
6390 | 6392 | ||
6391 | static int alsa_index = SNDRV_DEFAULT_IDX1; | 6393 | static int alsa_index = ~((1 << (SNDRV_CARDS - 3)) - 1); /* last three slots */ |
6392 | static char *alsa_id = "ThinkPadEC"; | 6394 | static char *alsa_id = "ThinkPadEC"; |
6393 | static int alsa_enable = SNDRV_DEFAULT_ENABLE1; | 6395 | static int alsa_enable = SNDRV_DEFAULT_ENABLE1; |
6394 | 6396 | ||
@@ -6705,10 +6707,11 @@ static int __init volume_create_alsa_mixer(void) | |||
6705 | 6707 | ||
6706 | rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, | 6708 | rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, |
6707 | sizeof(struct tpacpi_alsa_data), &card); | 6709 | sizeof(struct tpacpi_alsa_data), &card); |
6708 | if (rc < 0) | 6710 | if (rc < 0 || !card) { |
6709 | return rc; | 6711 | printk(TPACPI_ERR |
6710 | if (!card) | 6712 | "Failed to create ALSA card structures: %d\n", rc); |
6711 | return -ENOMEM; | 6713 | return 1; |
6714 | } | ||
6712 | 6715 | ||
6713 | BUG_ON(!card->private_data); | 6716 | BUG_ON(!card->private_data); |
6714 | data = card->private_data; | 6717 | data = card->private_data; |
@@ -6741,8 +6744,9 @@ static int __init volume_create_alsa_mixer(void) | |||
6741 | rc = snd_ctl_add(card, ctl_vol); | 6744 | rc = snd_ctl_add(card, ctl_vol); |
6742 | if (rc < 0) { | 6745 | if (rc < 0) { |
6743 | printk(TPACPI_ERR | 6746 | printk(TPACPI_ERR |
6744 | "Failed to create ALSA volume control\n"); | 6747 | "Failed to create ALSA volume control: %d\n", |
6745 | goto err_out; | 6748 | rc); |
6749 | goto err_exit; | ||
6746 | } | 6750 | } |
6747 | data->ctl_vol_id = &ctl_vol->id; | 6751 | data->ctl_vol_id = &ctl_vol->id; |
6748 | } | 6752 | } |
@@ -6750,22 +6754,25 @@ static int __init volume_create_alsa_mixer(void) | |||
6750 | ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); | 6754 | ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); |
6751 | rc = snd_ctl_add(card, ctl_mute); | 6755 | rc = snd_ctl_add(card, ctl_mute); |
6752 | if (rc < 0) { | 6756 | if (rc < 0) { |
6753 | printk(TPACPI_ERR "Failed to create ALSA mute control\n"); | 6757 | printk(TPACPI_ERR "Failed to create ALSA mute control: %d\n", |
6754 | goto err_out; | 6758 | rc); |
6759 | goto err_exit; | ||
6755 | } | 6760 | } |
6756 | data->ctl_mute_id = &ctl_mute->id; | 6761 | data->ctl_mute_id = &ctl_mute->id; |
6757 | 6762 | ||
6758 | snd_card_set_dev(card, &tpacpi_pdev->dev); | 6763 | snd_card_set_dev(card, &tpacpi_pdev->dev); |
6759 | rc = snd_card_register(card); | 6764 | rc = snd_card_register(card); |
6760 | |||
6761 | err_out: | ||
6762 | if (rc < 0) { | 6765 | if (rc < 0) { |
6763 | snd_card_free(card); | 6766 | printk(TPACPI_ERR "Failed to register ALSA card: %d\n", rc); |
6764 | card = NULL; | 6767 | goto err_exit; |
6765 | } | 6768 | } |
6766 | 6769 | ||
6767 | alsa_card = card; | 6770 | alsa_card = card; |
6768 | return rc; | 6771 | return 0; |
6772 | |||
6773 | err_exit: | ||
6774 | snd_card_free(card); | ||
6775 | return 1; | ||
6769 | } | 6776 | } |
6770 | 6777 | ||
6771 | #define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */ | 6778 | #define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */ |
@@ -7016,6 +7023,28 @@ static struct ibm_struct volume_driver_data = { | |||
7016 | .shutdown = volume_shutdown, | 7023 | .shutdown = volume_shutdown, |
7017 | }; | 7024 | }; |
7018 | 7025 | ||
7026 | #else /* !CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */ | ||
7027 | |||
7028 | #define alsa_card NULL | ||
7029 | |||
7030 | static void inline volume_alsa_notify_change(void) | ||
7031 | { | ||
7032 | } | ||
7033 | |||
7034 | static int __init volume_init(struct ibm_init_struct *iibm) | ||
7035 | { | ||
7036 | printk(TPACPI_INFO | ||
7037 | "volume: disabled as there is no ALSA support in this kernel\n"); | ||
7038 | |||
7039 | return 1; | ||
7040 | } | ||
7041 | |||
7042 | static struct ibm_struct volume_driver_data = { | ||
7043 | .name = "volume", | ||
7044 | }; | ||
7045 | |||
7046 | #endif /* CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */ | ||
7047 | |||
7019 | /************************************************************************* | 7048 | /************************************************************************* |
7020 | * Fan subdriver | 7049 | * Fan subdriver |
7021 | */ | 7050 | */ |
@@ -8738,6 +8767,7 @@ MODULE_PARM_DESC(hotkey_report_mode, | |||
8738 | "used for backwards compatibility with userspace, " | 8767 | "used for backwards compatibility with userspace, " |
8739 | "see documentation"); | 8768 | "see documentation"); |
8740 | 8769 | ||
8770 | #ifdef CONFIG_THINKPAD_ACPI_ALSA_SUPPORT | ||
8741 | module_param_named(volume_mode, volume_mode, uint, 0444); | 8771 | module_param_named(volume_mode, volume_mode, uint, 0444); |
8742 | MODULE_PARM_DESC(volume_mode, | 8772 | MODULE_PARM_DESC(volume_mode, |
8743 | "Selects volume control strategy: " | 8773 | "Selects volume control strategy: " |
@@ -8760,6 +8790,7 @@ module_param_named(id, alsa_id, charp, 0444); | |||
8760 | MODULE_PARM_DESC(id, "ALSA id for the ACPI EC Mixer"); | 8790 | MODULE_PARM_DESC(id, "ALSA id for the ACPI EC Mixer"); |
8761 | module_param_named(enable, alsa_enable, bool, 0444); | 8791 | module_param_named(enable, alsa_enable, bool, 0444); |
8762 | MODULE_PARM_DESC(enable, "Enable the ALSA interface for the ACPI EC Mixer"); | 8792 | MODULE_PARM_DESC(enable, "Enable the ALSA interface for the ACPI EC Mixer"); |
8793 | #endif /* CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */ | ||
8763 | 8794 | ||
8764 | #define TPACPI_PARAM(feature) \ | 8795 | #define TPACPI_PARAM(feature) \ |
8765 | module_param_call(feature, set_ibm_param, NULL, NULL, 0); \ | 8796 | module_param_call(feature, set_ibm_param, NULL, NULL, 0); \ |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 9f93d6c0f510..b104302fea0a 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -492,8 +492,7 @@ wmi_notify_handler handler, void *data) | |||
492 | if (!guid || !handler) | 492 | if (!guid || !handler) |
493 | return AE_BAD_PARAMETER; | 493 | return AE_BAD_PARAMETER; |
494 | 494 | ||
495 | find_guid(guid, &block); | 495 | if (!find_guid(guid, &block)) |
496 | if (!block) | ||
497 | return AE_NOT_EXIST; | 496 | return AE_NOT_EXIST; |
498 | 497 | ||
499 | if (block->handler) | 498 | if (block->handler) |
@@ -521,8 +520,7 @@ acpi_status wmi_remove_notify_handler(const char *guid) | |||
521 | if (!guid) | 520 | if (!guid) |
522 | return AE_BAD_PARAMETER; | 521 | return AE_BAD_PARAMETER; |
523 | 522 | ||
524 | find_guid(guid, &block); | 523 | if (!find_guid(guid, &block)) |
525 | if (!block) | ||
526 | return AE_NOT_EXIST; | 524 | return AE_NOT_EXIST; |
527 | 525 | ||
528 | if (!block->handler) | 526 | if (!block->handler) |
@@ -716,6 +714,22 @@ static int wmi_class_init(void) | |||
716 | return ret; | 714 | return ret; |
717 | } | 715 | } |
718 | 716 | ||
717 | static bool guid_already_parsed(const char *guid_string) | ||
718 | { | ||
719 | struct guid_block *gblock; | ||
720 | struct wmi_block *wblock; | ||
721 | struct list_head *p; | ||
722 | |||
723 | list_for_each(p, &wmi_blocks.list) { | ||
724 | wblock = list_entry(p, struct wmi_block, list); | ||
725 | gblock = &wblock->gblock; | ||
726 | |||
727 | if (strncmp(gblock->guid, guid_string, 16) == 0) | ||
728 | return true; | ||
729 | } | ||
730 | return false; | ||
731 | } | ||
732 | |||
719 | /* | 733 | /* |
720 | * Parse the _WDG method for the GUID data blocks | 734 | * Parse the _WDG method for the GUID data blocks |
721 | */ | 735 | */ |
@@ -725,6 +739,7 @@ static __init acpi_status parse_wdg(acpi_handle handle) | |||
725 | union acpi_object *obj; | 739 | union acpi_object *obj; |
726 | struct guid_block *gblock; | 740 | struct guid_block *gblock; |
727 | struct wmi_block *wblock; | 741 | struct wmi_block *wblock; |
742 | char guid_string[37]; | ||
728 | acpi_status status; | 743 | acpi_status status; |
729 | u32 i, total; | 744 | u32 i, total; |
730 | 745 | ||
@@ -747,6 +762,19 @@ static __init acpi_status parse_wdg(acpi_handle handle) | |||
747 | memcpy(gblock, obj->buffer.pointer, obj->buffer.length); | 762 | memcpy(gblock, obj->buffer.pointer, obj->buffer.length); |
748 | 763 | ||
749 | for (i = 0; i < total; i++) { | 764 | for (i = 0; i < total; i++) { |
765 | /* | ||
766 | Some WMI devices, like those for nVidia hooks, have a | ||
767 | duplicate GUID. It's not clear what we should do in this | ||
768 | case yet, so for now, we'll just ignore the duplicate. | ||
769 | Anyone who wants to add support for that device can come | ||
770 | up with a better workaround for the mess then. | ||
771 | */ | ||
772 | if (guid_already_parsed(gblock[i].guid) == true) { | ||
773 | wmi_gtoa(gblock[i].guid, guid_string); | ||
774 | printk(KERN_INFO PREFIX "Skipping duplicate GUID %s\n", | ||
775 | guid_string); | ||
776 | continue; | ||
777 | } | ||
750 | wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); | 778 | wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); |
751 | if (!wblock) | 779 | if (!wblock) |
752 | return AE_NO_MEMORY; | 780 | return AE_NO_MEMORY; |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index c8c12325e69b..e9aa814ddd23 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -1096,9 +1096,9 @@ static int cmos_pnp_resume(struct pnp_dev *pnp) | |||
1096 | #define cmos_pnp_resume NULL | 1096 | #define cmos_pnp_resume NULL |
1097 | #endif | 1097 | #endif |
1098 | 1098 | ||
1099 | static void cmos_pnp_shutdown(struct device *pdev) | 1099 | static void cmos_pnp_shutdown(struct pnp_dev *pnp) |
1100 | { | 1100 | { |
1101 | if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(pdev)) | 1101 | if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(&pnp->dev)) |
1102 | return; | 1102 | return; |
1103 | 1103 | ||
1104 | cmos_do_shutdown(); | 1104 | cmos_do_shutdown(); |
@@ -1117,15 +1117,12 @@ static struct pnp_driver cmos_pnp_driver = { | |||
1117 | .id_table = rtc_ids, | 1117 | .id_table = rtc_ids, |
1118 | .probe = cmos_pnp_probe, | 1118 | .probe = cmos_pnp_probe, |
1119 | .remove = __exit_p(cmos_pnp_remove), | 1119 | .remove = __exit_p(cmos_pnp_remove), |
1120 | .shutdown = cmos_pnp_shutdown, | ||
1120 | 1121 | ||
1121 | /* flag ensures resume() gets called, and stops syslog spam */ | 1122 | /* flag ensures resume() gets called, and stops syslog spam */ |
1122 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, | 1123 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, |
1123 | .suspend = cmos_pnp_suspend, | 1124 | .suspend = cmos_pnp_suspend, |
1124 | .resume = cmos_pnp_resume, | 1125 | .resume = cmos_pnp_resume, |
1125 | .driver = { | ||
1126 | .name = (char *)driver_name, | ||
1127 | .shutdown = cmos_pnp_shutdown, | ||
1128 | } | ||
1129 | }; | 1126 | }; |
1130 | 1127 | ||
1131 | #endif /* CONFIG_PNP */ | 1128 | #endif /* CONFIG_PNP */ |
diff --git a/drivers/s390/cio/Makefile b/drivers/s390/cio/Makefile index d033414f7599..e1b700a19648 100644 --- a/drivers/s390/cio/Makefile +++ b/drivers/s390/cio/Makefile | |||
@@ -10,5 +10,5 @@ obj-y += ccw_device.o cmf.o | |||
10 | obj-$(CONFIG_CHSC_SCH) += chsc_sch.o | 10 | obj-$(CONFIG_CHSC_SCH) += chsc_sch.o |
11 | obj-$(CONFIG_CCWGROUP) += ccwgroup.o | 11 | obj-$(CONFIG_CCWGROUP) += ccwgroup.o |
12 | 12 | ||
13 | qdio-objs := qdio_main.o qdio_thinint.o qdio_debug.o qdio_perf.o qdio_setup.o | 13 | qdio-objs := qdio_main.o qdio_thinint.o qdio_debug.o qdio_setup.o |
14 | obj-$(CONFIG_QDIO) += qdio.o | 14 | obj-$(CONFIG_QDIO) += qdio.o |
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h index ff7748a9199d..44f2f6a97f33 100644 --- a/drivers/s390/cio/qdio.h +++ b/drivers/s390/cio/qdio.h | |||
@@ -182,6 +182,34 @@ struct scssc_area { | |||
182 | u32:32; | 182 | u32:32; |
183 | } __attribute__ ((packed)); | 183 | } __attribute__ ((packed)); |
184 | 184 | ||
185 | struct qdio_dev_perf_stat { | ||
186 | unsigned int adapter_int; | ||
187 | unsigned int qdio_int; | ||
188 | unsigned int pci_request_int; | ||
189 | |||
190 | unsigned int tasklet_inbound; | ||
191 | unsigned int tasklet_inbound_resched; | ||
192 | unsigned int tasklet_inbound_resched2; | ||
193 | unsigned int tasklet_outbound; | ||
194 | |||
195 | unsigned int siga_read; | ||
196 | unsigned int siga_write; | ||
197 | unsigned int siga_sync; | ||
198 | |||
199 | unsigned int inbound_call; | ||
200 | unsigned int inbound_handler; | ||
201 | unsigned int stop_polling; | ||
202 | unsigned int inbound_queue_full; | ||
203 | unsigned int outbound_call; | ||
204 | unsigned int outbound_handler; | ||
205 | unsigned int fast_requeue; | ||
206 | unsigned int target_full; | ||
207 | unsigned int eqbs; | ||
208 | unsigned int eqbs_partial; | ||
209 | unsigned int sqbs; | ||
210 | unsigned int sqbs_partial; | ||
211 | }; | ||
212 | |||
185 | struct qdio_input_q { | 213 | struct qdio_input_q { |
186 | /* input buffer acknowledgement flag */ | 214 | /* input buffer acknowledgement flag */ |
187 | int polling; | 215 | int polling; |
@@ -269,6 +297,7 @@ struct qdio_irq { | |||
269 | u32 *dsci; /* address of device state change indicator */ | 297 | u32 *dsci; /* address of device state change indicator */ |
270 | struct ccw_device *cdev; | 298 | struct ccw_device *cdev; |
271 | struct dentry *debugfs_dev; | 299 | struct dentry *debugfs_dev; |
300 | struct dentry *debugfs_perf; | ||
272 | 301 | ||
273 | unsigned long int_parm; | 302 | unsigned long int_parm; |
274 | struct subchannel_id schid; | 303 | struct subchannel_id schid; |
@@ -286,9 +315,10 @@ struct qdio_irq { | |||
286 | struct ciw aqueue; | 315 | struct ciw aqueue; |
287 | 316 | ||
288 | struct qdio_ssqd_desc ssqd_desc; | 317 | struct qdio_ssqd_desc ssqd_desc; |
289 | |||
290 | void (*orig_handler) (struct ccw_device *, unsigned long, struct irb *); | 318 | void (*orig_handler) (struct ccw_device *, unsigned long, struct irb *); |
291 | 319 | ||
320 | struct qdio_dev_perf_stat perf_stat; | ||
321 | int perf_stat_enabled; | ||
292 | /* | 322 | /* |
293 | * Warning: Leave these members together at the end so they won't be | 323 | * Warning: Leave these members together at the end so they won't be |
294 | * cleared in qdio_setup_irq. | 324 | * cleared in qdio_setup_irq. |
@@ -311,6 +341,10 @@ struct qdio_irq { | |||
311 | (irq->qib.qfmt == QDIO_IQDIO_QFMT || \ | 341 | (irq->qib.qfmt == QDIO_IQDIO_QFMT || \ |
312 | css_general_characteristics.aif_osa) | 342 | css_general_characteristics.aif_osa) |
313 | 343 | ||
344 | #define qperf(qdev,attr) qdev->perf_stat.attr | ||
345 | #define qperf_inc(q,attr) if (q->irq_ptr->perf_stat_enabled) \ | ||
346 | q->irq_ptr->perf_stat.attr++ | ||
347 | |||
314 | /* the highest iqdio queue is used for multicast */ | 348 | /* the highest iqdio queue is used for multicast */ |
315 | static inline int multicast_outbound(struct qdio_q *q) | 349 | static inline int multicast_outbound(struct qdio_q *q) |
316 | { | 350 | { |
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index 76769978285f..f49761ff9a00 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
@@ -55,13 +55,11 @@ static int qstat_show(struct seq_file *m, void *v) | |||
55 | if (!q) | 55 | if (!q) |
56 | return 0; | 56 | return 0; |
57 | 57 | ||
58 | seq_printf(m, "device state indicator: %d\n", *(u32 *)q->irq_ptr->dsci); | 58 | seq_printf(m, "DSCI: %d nr_used: %d\n", |
59 | seq_printf(m, "nr_used: %d\n", atomic_read(&q->nr_buf_used)); | 59 | *(u32 *)q->irq_ptr->dsci, atomic_read(&q->nr_buf_used)); |
60 | seq_printf(m, "ftc: %d\n", q->first_to_check); | 60 | seq_printf(m, "ftc: %d last_move: %d\n", q->first_to_check, q->last_move); |
61 | seq_printf(m, "last_move: %d\n", q->last_move); | 61 | seq_printf(m, "polling: %d ack start: %d ack count: %d\n", |
62 | seq_printf(m, "polling: %d\n", q->u.in.polling); | 62 | q->u.in.polling, q->u.in.ack_start, q->u.in.ack_count); |
63 | seq_printf(m, "ack start: %d\n", q->u.in.ack_start); | ||
64 | seq_printf(m, "ack count: %d\n", q->u.in.ack_count); | ||
65 | seq_printf(m, "slsb buffer states:\n"); | 63 | seq_printf(m, "slsb buffer states:\n"); |
66 | seq_printf(m, "|0 |8 |16 |24 |32 |40 |48 |56 63|\n"); | 64 | seq_printf(m, "|0 |8 |16 |24 |32 |40 |48 |56 63|\n"); |
67 | 65 | ||
@@ -110,7 +108,6 @@ static ssize_t qstat_seq_write(struct file *file, const char __user *buf, | |||
110 | 108 | ||
111 | if (!q) | 109 | if (!q) |
112 | return 0; | 110 | return 0; |
113 | |||
114 | if (q->is_input_q) | 111 | if (q->is_input_q) |
115 | xchg(q->irq_ptr->dsci, 1); | 112 | xchg(q->irq_ptr->dsci, 1); |
116 | local_bh_disable(); | 113 | local_bh_disable(); |
@@ -134,6 +131,98 @@ static const struct file_operations debugfs_fops = { | |||
134 | .release = single_release, | 131 | .release = single_release, |
135 | }; | 132 | }; |
136 | 133 | ||
134 | static char *qperf_names[] = { | ||
135 | "Assumed adapter interrupts", | ||
136 | "QDIO interrupts", | ||
137 | "Requested PCIs", | ||
138 | "Inbound tasklet runs", | ||
139 | "Inbound tasklet resched", | ||
140 | "Inbound tasklet resched2", | ||
141 | "Outbound tasklet runs", | ||
142 | "SIGA read", | ||
143 | "SIGA write", | ||
144 | "SIGA sync", | ||
145 | "Inbound calls", | ||
146 | "Inbound handler", | ||
147 | "Inbound stop_polling", | ||
148 | "Inbound queue full", | ||
149 | "Outbound calls", | ||
150 | "Outbound handler", | ||
151 | "Outbound fast_requeue", | ||
152 | "Outbound target_full", | ||
153 | "QEBSM eqbs", | ||
154 | "QEBSM eqbs partial", | ||
155 | "QEBSM sqbs", | ||
156 | "QEBSM sqbs partial" | ||
157 | }; | ||
158 | |||
159 | static int qperf_show(struct seq_file *m, void *v) | ||
160 | { | ||
161 | struct qdio_irq *irq_ptr = m->private; | ||
162 | unsigned int *stat; | ||
163 | int i; | ||
164 | |||
165 | if (!irq_ptr) | ||
166 | return 0; | ||
167 | if (!irq_ptr->perf_stat_enabled) { | ||
168 | seq_printf(m, "disabled\n"); | ||
169 | return 0; | ||
170 | } | ||
171 | stat = (unsigned int *)&irq_ptr->perf_stat; | ||
172 | |||
173 | for (i = 0; i < ARRAY_SIZE(qperf_names); i++) | ||
174 | seq_printf(m, "%26s:\t%u\n", | ||
175 | qperf_names[i], *(stat + i)); | ||
176 | return 0; | ||
177 | } | ||
178 | |||
179 | static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf, | ||
180 | size_t count, loff_t *off) | ||
181 | { | ||
182 | struct seq_file *seq = file->private_data; | ||
183 | struct qdio_irq *irq_ptr = seq->private; | ||
184 | unsigned long val; | ||
185 | char buf[8]; | ||
186 | int ret; | ||
187 | |||
188 | if (!irq_ptr) | ||
189 | return 0; | ||
190 | if (count >= sizeof(buf)) | ||
191 | return -EINVAL; | ||
192 | if (copy_from_user(&buf, ubuf, count)) | ||
193 | return -EFAULT; | ||
194 | buf[count] = 0; | ||
195 | |||
196 | ret = strict_strtoul(buf, 10, &val); | ||
197 | if (ret < 0) | ||
198 | return ret; | ||
199 | |||
200 | switch (val) { | ||
201 | case 0: | ||
202 | irq_ptr->perf_stat_enabled = 0; | ||
203 | memset(&irq_ptr->perf_stat, 0, sizeof(irq_ptr->perf_stat)); | ||
204 | break; | ||
205 | case 1: | ||
206 | irq_ptr->perf_stat_enabled = 1; | ||
207 | break; | ||
208 | } | ||
209 | return count; | ||
210 | } | ||
211 | |||
212 | static int qperf_seq_open(struct inode *inode, struct file *filp) | ||
213 | { | ||
214 | return single_open(filp, qperf_show, | ||
215 | filp->f_path.dentry->d_inode->i_private); | ||
216 | } | ||
217 | |||
218 | static struct file_operations debugfs_perf_fops = { | ||
219 | .owner = THIS_MODULE, | ||
220 | .open = qperf_seq_open, | ||
221 | .read = seq_read, | ||
222 | .write = qperf_seq_write, | ||
223 | .llseek = seq_lseek, | ||
224 | .release = single_release, | ||
225 | }; | ||
137 | static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev) | 226 | static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev) |
138 | { | 227 | { |
139 | char name[QDIO_DEBUGFS_NAME_LEN]; | 228 | char name[QDIO_DEBUGFS_NAME_LEN]; |
@@ -156,6 +245,14 @@ void qdio_setup_debug_entries(struct qdio_irq *irq_ptr, struct ccw_device *cdev) | |||
156 | debugfs_root); | 245 | debugfs_root); |
157 | if (IS_ERR(irq_ptr->debugfs_dev)) | 246 | if (IS_ERR(irq_ptr->debugfs_dev)) |
158 | irq_ptr->debugfs_dev = NULL; | 247 | irq_ptr->debugfs_dev = NULL; |
248 | |||
249 | irq_ptr->debugfs_perf = debugfs_create_file("statistics", | ||
250 | S_IFREG | S_IRUGO | S_IWUSR, | ||
251 | irq_ptr->debugfs_dev, irq_ptr, | ||
252 | &debugfs_perf_fops); | ||
253 | if (IS_ERR(irq_ptr->debugfs_perf)) | ||
254 | irq_ptr->debugfs_perf = NULL; | ||
255 | |||
159 | for_each_input_queue(irq_ptr, q, i) | 256 | for_each_input_queue(irq_ptr, q, i) |
160 | setup_debugfs_entry(q, cdev); | 257 | setup_debugfs_entry(q, cdev); |
161 | for_each_output_queue(irq_ptr, q, i) | 258 | for_each_output_queue(irq_ptr, q, i) |
@@ -171,6 +268,7 @@ void qdio_shutdown_debug_entries(struct qdio_irq *irq_ptr, struct ccw_device *cd | |||
171 | debugfs_remove(q->debugfs_q); | 268 | debugfs_remove(q->debugfs_q); |
172 | for_each_output_queue(irq_ptr, q, i) | 269 | for_each_output_queue(irq_ptr, q, i) |
173 | debugfs_remove(q->debugfs_q); | 270 | debugfs_remove(q->debugfs_q); |
271 | debugfs_remove(irq_ptr->debugfs_perf); | ||
174 | debugfs_remove(irq_ptr->debugfs_dev); | 272 | debugfs_remove(irq_ptr->debugfs_dev); |
175 | } | 273 | } |
176 | 274 | ||
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index b2275c5000e7..999fe80c4051 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include "device.h" | 22 | #include "device.h" |
23 | #include "qdio.h" | 23 | #include "qdio.h" |
24 | #include "qdio_debug.h" | 24 | #include "qdio_debug.h" |
25 | #include "qdio_perf.h" | ||
26 | 25 | ||
27 | MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\ | 26 | MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\ |
28 | "Jan Glauber <jang@linux.vnet.ibm.com>"); | 27 | "Jan Glauber <jang@linux.vnet.ibm.com>"); |
@@ -126,7 +125,7 @@ static int qdio_do_eqbs(struct qdio_q *q, unsigned char *state, | |||
126 | int rc; | 125 | int rc; |
127 | 126 | ||
128 | BUG_ON(!q->irq_ptr->sch_token); | 127 | BUG_ON(!q->irq_ptr->sch_token); |
129 | qdio_perf_stat_inc(&perf_stats.debug_eqbs_all); | 128 | qperf_inc(q, eqbs); |
130 | 129 | ||
131 | if (!q->is_input_q) | 130 | if (!q->is_input_q) |
132 | nr += q->irq_ptr->nr_input_qs; | 131 | nr += q->irq_ptr->nr_input_qs; |
@@ -139,7 +138,7 @@ again: | |||
139 | * buffers later. | 138 | * buffers later. |
140 | */ | 139 | */ |
141 | if ((ccq == 96) && (count != tmp_count)) { | 140 | if ((ccq == 96) && (count != tmp_count)) { |
142 | qdio_perf_stat_inc(&perf_stats.debug_eqbs_incomplete); | 141 | qperf_inc(q, eqbs_partial); |
143 | return (count - tmp_count); | 142 | return (count - tmp_count); |
144 | } | 143 | } |
145 | 144 | ||
@@ -182,7 +181,7 @@ static int qdio_do_sqbs(struct qdio_q *q, unsigned char state, int start, | |||
182 | return 0; | 181 | return 0; |
183 | 182 | ||
184 | BUG_ON(!q->irq_ptr->sch_token); | 183 | BUG_ON(!q->irq_ptr->sch_token); |
185 | qdio_perf_stat_inc(&perf_stats.debug_sqbs_all); | 184 | qperf_inc(q, sqbs); |
186 | 185 | ||
187 | if (!q->is_input_q) | 186 | if (!q->is_input_q) |
188 | nr += q->irq_ptr->nr_input_qs; | 187 | nr += q->irq_ptr->nr_input_qs; |
@@ -191,7 +190,7 @@ again: | |||
191 | rc = qdio_check_ccq(q, ccq); | 190 | rc = qdio_check_ccq(q, ccq); |
192 | if (rc == 1) { | 191 | if (rc == 1) { |
193 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "SQBS again:%2d", ccq); | 192 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "SQBS again:%2d", ccq); |
194 | qdio_perf_stat_inc(&perf_stats.debug_sqbs_incomplete); | 193 | qperf_inc(q, sqbs_partial); |
195 | goto again; | 194 | goto again; |
196 | } | 195 | } |
197 | if (rc < 0) { | 196 | if (rc < 0) { |
@@ -285,7 +284,7 @@ static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output, | |||
285 | return 0; | 284 | return 0; |
286 | 285 | ||
287 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr); | 286 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr); |
288 | qdio_perf_stat_inc(&perf_stats.siga_sync); | 287 | qperf_inc(q, siga_sync); |
289 | 288 | ||
290 | cc = do_siga_sync(q->irq_ptr->schid, output, input); | 289 | cc = do_siga_sync(q->irq_ptr->schid, output, input); |
291 | if (cc) | 290 | if (cc) |
@@ -350,7 +349,7 @@ static inline int qdio_siga_input(struct qdio_q *q) | |||
350 | int cc; | 349 | int cc; |
351 | 350 | ||
352 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr); | 351 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr); |
353 | qdio_perf_stat_inc(&perf_stats.siga_in); | 352 | qperf_inc(q, siga_read); |
354 | 353 | ||
355 | cc = do_siga_input(q->irq_ptr->schid, q->mask); | 354 | cc = do_siga_input(q->irq_ptr->schid, q->mask); |
356 | if (cc) | 355 | if (cc) |
@@ -382,7 +381,7 @@ static inline void qdio_stop_polling(struct qdio_q *q) | |||
382 | return; | 381 | return; |
383 | 382 | ||
384 | q->u.in.polling = 0; | 383 | q->u.in.polling = 0; |
385 | qdio_perf_stat_inc(&perf_stats.debug_stop_polling); | 384 | qperf_inc(q, stop_polling); |
386 | 385 | ||
387 | /* show the card that we are not polling anymore */ | 386 | /* show the card that we are not polling anymore */ |
388 | if (is_qebsm(q)) { | 387 | if (is_qebsm(q)) { |
@@ -400,7 +399,7 @@ static void announce_buffer_error(struct qdio_q *q, int count) | |||
400 | /* special handling for no target buffer empty */ | 399 | /* special handling for no target buffer empty */ |
401 | if ((!q->is_input_q && | 400 | if ((!q->is_input_q && |
402 | (q->sbal[q->first_to_check]->element[15].flags & 0xff) == 0x10)) { | 401 | (q->sbal[q->first_to_check]->element[15].flags & 0xff) == 0x10)) { |
403 | qdio_perf_stat_inc(&perf_stats.outbound_target_full); | 402 | qperf_inc(q, target_full); |
404 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "OUTFULL FTC:%02x", | 403 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "OUTFULL FTC:%02x", |
405 | q->first_to_check); | 404 | q->first_to_check); |
406 | return; | 405 | return; |
@@ -487,7 +486,7 @@ static int get_inbound_buffer_frontier(struct qdio_q *q) | |||
487 | inbound_primed(q, count); | 486 | inbound_primed(q, count); |
488 | q->first_to_check = add_buf(q->first_to_check, count); | 487 | q->first_to_check = add_buf(q->first_to_check, count); |
489 | if (atomic_sub(count, &q->nr_buf_used) == 0) | 488 | if (atomic_sub(count, &q->nr_buf_used) == 0) |
490 | qdio_perf_stat_inc(&perf_stats.inbound_queue_full); | 489 | qperf_inc(q, inbound_queue_full); |
491 | break; | 490 | break; |
492 | case SLSB_P_INPUT_ERROR: | 491 | case SLSB_P_INPUT_ERROR: |
493 | announce_buffer_error(q, count); | 492 | announce_buffer_error(q, count); |
@@ -567,9 +566,10 @@ static void qdio_kick_handler(struct qdio_q *q) | |||
567 | count = sub_buf(end, start); | 566 | count = sub_buf(end, start); |
568 | 567 | ||
569 | if (q->is_input_q) { | 568 | if (q->is_input_q) { |
570 | qdio_perf_stat_inc(&perf_stats.inbound_handler); | 569 | qperf_inc(q, inbound_handler); |
571 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%02x c:%02x", start, count); | 570 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%02x c:%02x", start, count); |
572 | } else | 571 | } else |
572 | qperf_inc(q, outbound_handler); | ||
573 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: s:%02x c:%02x", | 573 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: s:%02x c:%02x", |
574 | start, count); | 574 | start, count); |
575 | 575 | ||
@@ -583,24 +583,28 @@ static void qdio_kick_handler(struct qdio_q *q) | |||
583 | 583 | ||
584 | static void __qdio_inbound_processing(struct qdio_q *q) | 584 | static void __qdio_inbound_processing(struct qdio_q *q) |
585 | { | 585 | { |
586 | qdio_perf_stat_inc(&perf_stats.tasklet_inbound); | 586 | qperf_inc(q, tasklet_inbound); |
587 | again: | 587 | again: |
588 | if (!qdio_inbound_q_moved(q)) | 588 | if (!qdio_inbound_q_moved(q)) |
589 | return; | 589 | return; |
590 | 590 | ||
591 | qdio_kick_handler(q); | 591 | qdio_kick_handler(q); |
592 | 592 | ||
593 | if (!qdio_inbound_q_done(q)) | 593 | if (!qdio_inbound_q_done(q)) { |
594 | /* means poll time is not yet over */ | 594 | /* means poll time is not yet over */ |
595 | qperf_inc(q, tasklet_inbound_resched); | ||
595 | goto again; | 596 | goto again; |
597 | } | ||
596 | 598 | ||
597 | qdio_stop_polling(q); | 599 | qdio_stop_polling(q); |
598 | /* | 600 | /* |
599 | * We need to check again to not lose initiative after | 601 | * We need to check again to not lose initiative after |
600 | * resetting the ACK state. | 602 | * resetting the ACK state. |
601 | */ | 603 | */ |
602 | if (!qdio_inbound_q_done(q)) | 604 | if (!qdio_inbound_q_done(q)) { |
605 | qperf_inc(q, tasklet_inbound_resched2); | ||
603 | goto again; | 606 | goto again; |
607 | } | ||
604 | } | 608 | } |
605 | 609 | ||
606 | void qdio_inbound_processing(unsigned long data) | 610 | void qdio_inbound_processing(unsigned long data) |
@@ -688,7 +692,7 @@ static int qdio_kick_outbound_q(struct qdio_q *q) | |||
688 | return 0; | 692 | return 0; |
689 | 693 | ||
690 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w:%1d", q->nr); | 694 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w:%1d", q->nr); |
691 | qdio_perf_stat_inc(&perf_stats.siga_out); | 695 | qperf_inc(q, siga_write); |
692 | 696 | ||
693 | cc = qdio_siga_output(q, &busy_bit); | 697 | cc = qdio_siga_output(q, &busy_bit); |
694 | switch (cc) { | 698 | switch (cc) { |
@@ -711,7 +715,7 @@ static int qdio_kick_outbound_q(struct qdio_q *q) | |||
711 | 715 | ||
712 | static void __qdio_outbound_processing(struct qdio_q *q) | 716 | static void __qdio_outbound_processing(struct qdio_q *q) |
713 | { | 717 | { |
714 | qdio_perf_stat_inc(&perf_stats.tasklet_outbound); | 718 | qperf_inc(q, tasklet_outbound); |
715 | BUG_ON(atomic_read(&q->nr_buf_used) < 0); | 719 | BUG_ON(atomic_read(&q->nr_buf_used) < 0); |
716 | 720 | ||
717 | if (qdio_outbound_q_moved(q)) | 721 | if (qdio_outbound_q_moved(q)) |
@@ -739,12 +743,9 @@ static void __qdio_outbound_processing(struct qdio_q *q) | |||
739 | */ | 743 | */ |
740 | if (qdio_outbound_q_done(q)) | 744 | if (qdio_outbound_q_done(q)) |
741 | del_timer(&q->u.out.timer); | 745 | del_timer(&q->u.out.timer); |
742 | else { | 746 | else |
743 | if (!timer_pending(&q->u.out.timer)) { | 747 | if (!timer_pending(&q->u.out.timer)) |
744 | mod_timer(&q->u.out.timer, jiffies + 10 * HZ); | 748 | mod_timer(&q->u.out.timer, jiffies + 10 * HZ); |
745 | qdio_perf_stat_inc(&perf_stats.debug_tl_out_timer); | ||
746 | } | ||
747 | } | ||
748 | return; | 749 | return; |
749 | 750 | ||
750 | sched: | 751 | sched: |
@@ -784,7 +785,7 @@ static inline void qdio_check_outbound_after_thinint(struct qdio_q *q) | |||
784 | 785 | ||
785 | static void __tiqdio_inbound_processing(struct qdio_q *q) | 786 | static void __tiqdio_inbound_processing(struct qdio_q *q) |
786 | { | 787 | { |
787 | qdio_perf_stat_inc(&perf_stats.thinint_inbound); | 788 | qperf_inc(q, tasklet_inbound); |
788 | qdio_sync_after_thinint(q); | 789 | qdio_sync_after_thinint(q); |
789 | 790 | ||
790 | /* | 791 | /* |
@@ -799,7 +800,7 @@ static void __tiqdio_inbound_processing(struct qdio_q *q) | |||
799 | qdio_kick_handler(q); | 800 | qdio_kick_handler(q); |
800 | 801 | ||
801 | if (!qdio_inbound_q_done(q)) { | 802 | if (!qdio_inbound_q_done(q)) { |
802 | qdio_perf_stat_inc(&perf_stats.thinint_inbound_loop); | 803 | qperf_inc(q, tasklet_inbound_resched); |
803 | if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED)) { | 804 | if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED)) { |
804 | tasklet_schedule(&q->tasklet); | 805 | tasklet_schedule(&q->tasklet); |
805 | return; | 806 | return; |
@@ -812,7 +813,7 @@ static void __tiqdio_inbound_processing(struct qdio_q *q) | |||
812 | * resetting the ACK state. | 813 | * resetting the ACK state. |
813 | */ | 814 | */ |
814 | if (!qdio_inbound_q_done(q)) { | 815 | if (!qdio_inbound_q_done(q)) { |
815 | qdio_perf_stat_inc(&perf_stats.thinint_inbound_loop2); | 816 | qperf_inc(q, tasklet_inbound_resched2); |
816 | if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED)) | 817 | if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED)) |
817 | tasklet_schedule(&q->tasklet); | 818 | tasklet_schedule(&q->tasklet); |
818 | } | 819 | } |
@@ -851,8 +852,6 @@ static void qdio_int_handler_pci(struct qdio_irq *irq_ptr) | |||
851 | if (unlikely(irq_ptr->state == QDIO_IRQ_STATE_STOPPED)) | 852 | if (unlikely(irq_ptr->state == QDIO_IRQ_STATE_STOPPED)) |
852 | return; | 853 | return; |
853 | 854 | ||
854 | qdio_perf_stat_inc(&perf_stats.pci_int); | ||
855 | |||
856 | for_each_input_queue(irq_ptr, q, i) | 855 | for_each_input_queue(irq_ptr, q, i) |
857 | tasklet_schedule(&q->tasklet); | 856 | tasklet_schedule(&q->tasklet); |
858 | 857 | ||
@@ -923,8 +922,6 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, | |||
923 | struct qdio_irq *irq_ptr = cdev->private->qdio_data; | 922 | struct qdio_irq *irq_ptr = cdev->private->qdio_data; |
924 | int cstat, dstat; | 923 | int cstat, dstat; |
925 | 924 | ||
926 | qdio_perf_stat_inc(&perf_stats.qdio_int); | ||
927 | |||
928 | if (!intparm || !irq_ptr) { | 925 | if (!intparm || !irq_ptr) { |
929 | DBF_ERROR("qint:%4x", cdev->private->schid.sch_no); | 926 | DBF_ERROR("qint:%4x", cdev->private->schid.sch_no); |
930 | return; | 927 | return; |
@@ -1383,6 +1380,8 @@ static int handle_inbound(struct qdio_q *q, unsigned int callflags, | |||
1383 | { | 1380 | { |
1384 | int used, diff; | 1381 | int used, diff; |
1385 | 1382 | ||
1383 | qperf_inc(q, inbound_call); | ||
1384 | |||
1386 | if (!q->u.in.polling) | 1385 | if (!q->u.in.polling) |
1387 | goto set; | 1386 | goto set; |
1388 | 1387 | ||
@@ -1438,14 +1437,16 @@ static int handle_outbound(struct qdio_q *q, unsigned int callflags, | |||
1438 | unsigned char state; | 1437 | unsigned char state; |
1439 | int used, rc = 0; | 1438 | int used, rc = 0; |
1440 | 1439 | ||
1441 | qdio_perf_stat_inc(&perf_stats.outbound_handler); | 1440 | qperf_inc(q, outbound_call); |
1442 | 1441 | ||
1443 | count = set_buf_states(q, bufnr, SLSB_CU_OUTPUT_PRIMED, count); | 1442 | count = set_buf_states(q, bufnr, SLSB_CU_OUTPUT_PRIMED, count); |
1444 | used = atomic_add_return(count, &q->nr_buf_used); | 1443 | used = atomic_add_return(count, &q->nr_buf_used); |
1445 | BUG_ON(used > QDIO_MAX_BUFFERS_PER_Q); | 1444 | BUG_ON(used > QDIO_MAX_BUFFERS_PER_Q); |
1446 | 1445 | ||
1447 | if (callflags & QDIO_FLAG_PCI_OUT) | 1446 | if (callflags & QDIO_FLAG_PCI_OUT) { |
1448 | q->u.out.pci_out_enabled = 1; | 1447 | q->u.out.pci_out_enabled = 1; |
1448 | qperf_inc(q, pci_request_int); | ||
1449 | } | ||
1449 | else | 1450 | else |
1450 | q->u.out.pci_out_enabled = 0; | 1451 | q->u.out.pci_out_enabled = 0; |
1451 | 1452 | ||
@@ -1484,7 +1485,7 @@ static int handle_outbound(struct qdio_q *q, unsigned int callflags, | |||
1484 | if (state != SLSB_CU_OUTPUT_PRIMED) | 1485 | if (state != SLSB_CU_OUTPUT_PRIMED) |
1485 | rc = qdio_kick_outbound_q(q); | 1486 | rc = qdio_kick_outbound_q(q); |
1486 | else | 1487 | else |
1487 | qdio_perf_stat_inc(&perf_stats.fast_requeue); | 1488 | qperf_inc(q, fast_requeue); |
1488 | 1489 | ||
1489 | out: | 1490 | out: |
1490 | tasklet_schedule(&q->tasklet); | 1491 | tasklet_schedule(&q->tasklet); |
@@ -1540,16 +1541,11 @@ static int __init init_QDIO(void) | |||
1540 | rc = qdio_debug_init(); | 1541 | rc = qdio_debug_init(); |
1541 | if (rc) | 1542 | if (rc) |
1542 | goto out_ti; | 1543 | goto out_ti; |
1543 | rc = qdio_setup_perf_stats(); | ||
1544 | if (rc) | ||
1545 | goto out_debug; | ||
1546 | rc = tiqdio_register_thinints(); | 1544 | rc = tiqdio_register_thinints(); |
1547 | if (rc) | 1545 | if (rc) |
1548 | goto out_perf; | 1546 | goto out_debug; |
1549 | return 0; | 1547 | return 0; |
1550 | 1548 | ||
1551 | out_perf: | ||
1552 | qdio_remove_perf_stats(); | ||
1553 | out_debug: | 1549 | out_debug: |
1554 | qdio_debug_exit(); | 1550 | qdio_debug_exit(); |
1555 | out_ti: | 1551 | out_ti: |
@@ -1563,7 +1559,6 @@ static void __exit exit_QDIO(void) | |||
1563 | { | 1559 | { |
1564 | tiqdio_unregister_thinints(); | 1560 | tiqdio_unregister_thinints(); |
1565 | tiqdio_free_memory(); | 1561 | tiqdio_free_memory(); |
1566 | qdio_remove_perf_stats(); | ||
1567 | qdio_debug_exit(); | 1562 | qdio_debug_exit(); |
1568 | qdio_setup_exit(); | 1563 | qdio_setup_exit(); |
1569 | } | 1564 | } |
diff --git a/drivers/s390/cio/qdio_perf.c b/drivers/s390/cio/qdio_perf.c deleted file mode 100644 index 54f7c325a3e6..000000000000 --- a/drivers/s390/cio/qdio_perf.c +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/s390/cio/qdio_perf.c | ||
3 | * | ||
4 | * Copyright IBM Corp. 2008 | ||
5 | * | ||
6 | * Author: Jan Glauber (jang@linux.vnet.ibm.com) | ||
7 | */ | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/proc_fs.h> | ||
10 | #include <linux/seq_file.h> | ||
11 | #include <asm/ccwdev.h> | ||
12 | |||
13 | #include "cio.h" | ||
14 | #include "css.h" | ||
15 | #include "device.h" | ||
16 | #include "ioasm.h" | ||
17 | #include "chsc.h" | ||
18 | #include "qdio_debug.h" | ||
19 | #include "qdio_perf.h" | ||
20 | |||
21 | int qdio_performance_stats; | ||
22 | struct qdio_perf_stats perf_stats; | ||
23 | |||
24 | #ifdef CONFIG_PROC_FS | ||
25 | static struct proc_dir_entry *qdio_perf_pde; | ||
26 | #endif | ||
27 | |||
28 | /* | ||
29 | * procfs functions | ||
30 | */ | ||
31 | static int qdio_perf_proc_show(struct seq_file *m, void *v) | ||
32 | { | ||
33 | seq_printf(m, "Number of qdio interrupts\t\t\t: %li\n", | ||
34 | (long)atomic_long_read(&perf_stats.qdio_int)); | ||
35 | seq_printf(m, "Number of PCI interrupts\t\t\t: %li\n", | ||
36 | (long)atomic_long_read(&perf_stats.pci_int)); | ||
37 | seq_printf(m, "Number of adapter interrupts\t\t\t: %li\n", | ||
38 | (long)atomic_long_read(&perf_stats.thin_int)); | ||
39 | seq_printf(m, "\n"); | ||
40 | seq_printf(m, "Inbound tasklet runs\t\t\t\t: %li\n", | ||
41 | (long)atomic_long_read(&perf_stats.tasklet_inbound)); | ||
42 | seq_printf(m, "Outbound tasklet runs\t\t\t\t: %li\n", | ||
43 | (long)atomic_long_read(&perf_stats.tasklet_outbound)); | ||
44 | seq_printf(m, "Adapter interrupt tasklet runs/loops\t\t: %li/%li\n", | ||
45 | (long)atomic_long_read(&perf_stats.tasklet_thinint), | ||
46 | (long)atomic_long_read(&perf_stats.tasklet_thinint_loop)); | ||
47 | seq_printf(m, "Adapter interrupt inbound tasklet runs/loops\t: %li/%li\n", | ||
48 | (long)atomic_long_read(&perf_stats.thinint_inbound), | ||
49 | (long)atomic_long_read(&perf_stats.thinint_inbound_loop)); | ||
50 | seq_printf(m, "\n"); | ||
51 | seq_printf(m, "Number of SIGA In issued\t\t\t: %li\n", | ||
52 | (long)atomic_long_read(&perf_stats.siga_in)); | ||
53 | seq_printf(m, "Number of SIGA Out issued\t\t\t: %li\n", | ||
54 | (long)atomic_long_read(&perf_stats.siga_out)); | ||
55 | seq_printf(m, "Number of SIGA Sync issued\t\t\t: %li\n", | ||
56 | (long)atomic_long_read(&perf_stats.siga_sync)); | ||
57 | seq_printf(m, "\n"); | ||
58 | seq_printf(m, "Number of inbound transfers\t\t\t: %li\n", | ||
59 | (long)atomic_long_read(&perf_stats.inbound_handler)); | ||
60 | seq_printf(m, "Number of outbound transfers\t\t\t: %li\n", | ||
61 | (long)atomic_long_read(&perf_stats.outbound_handler)); | ||
62 | seq_printf(m, "\n"); | ||
63 | seq_printf(m, "Number of fast requeues (outg. SBAL w/o SIGA)\t: %li\n", | ||
64 | (long)atomic_long_read(&perf_stats.fast_requeue)); | ||
65 | seq_printf(m, "Number of outbound target full condition\t: %li\n", | ||
66 | (long)atomic_long_read(&perf_stats.outbound_target_full)); | ||
67 | seq_printf(m, "Number of inbound queue full condition\t\t: %li\n", | ||
68 | (long)atomic_long_read(&perf_stats.inbound_queue_full)); | ||
69 | seq_printf(m, "Number of outbound tasklet mod_timer calls\t: %li\n", | ||
70 | (long)atomic_long_read(&perf_stats.debug_tl_out_timer)); | ||
71 | seq_printf(m, "Number of stop polling calls\t\t\t: %li\n", | ||
72 | (long)atomic_long_read(&perf_stats.debug_stop_polling)); | ||
73 | seq_printf(m, "AI inbound tasklet loops after stop polling\t: %li\n", | ||
74 | (long)atomic_long_read(&perf_stats.thinint_inbound_loop2)); | ||
75 | seq_printf(m, "QEBSM EQBS total/incomplete\t\t\t: %li/%li\n", | ||
76 | (long)atomic_long_read(&perf_stats.debug_eqbs_all), | ||
77 | (long)atomic_long_read(&perf_stats.debug_eqbs_incomplete)); | ||
78 | seq_printf(m, "QEBSM SQBS total/incomplete\t\t\t: %li/%li\n", | ||
79 | (long)atomic_long_read(&perf_stats.debug_sqbs_all), | ||
80 | (long)atomic_long_read(&perf_stats.debug_sqbs_incomplete)); | ||
81 | seq_printf(m, "\n"); | ||
82 | return 0; | ||
83 | } | ||
84 | static int qdio_perf_seq_open(struct inode *inode, struct file *filp) | ||
85 | { | ||
86 | return single_open(filp, qdio_perf_proc_show, NULL); | ||
87 | } | ||
88 | |||
89 | static const struct file_operations qdio_perf_proc_fops = { | ||
90 | .owner = THIS_MODULE, | ||
91 | .open = qdio_perf_seq_open, | ||
92 | .read = seq_read, | ||
93 | .llseek = seq_lseek, | ||
94 | .release = single_release, | ||
95 | }; | ||
96 | |||
97 | /* | ||
98 | * sysfs functions | ||
99 | */ | ||
100 | static ssize_t qdio_perf_stats_show(struct bus_type *bus, char *buf) | ||
101 | { | ||
102 | return sprintf(buf, "%i\n", qdio_performance_stats ? 1 : 0); | ||
103 | } | ||
104 | |||
105 | static ssize_t qdio_perf_stats_store(struct bus_type *bus, | ||
106 | const char *buf, size_t count) | ||
107 | { | ||
108 | unsigned long i; | ||
109 | |||
110 | if (strict_strtoul(buf, 16, &i) != 0) | ||
111 | return -EINVAL; | ||
112 | if ((i != 0) && (i != 1)) | ||
113 | return -EINVAL; | ||
114 | if (i == qdio_performance_stats) | ||
115 | return count; | ||
116 | |||
117 | qdio_performance_stats = i; | ||
118 | /* reset performance statistics */ | ||
119 | if (i == 0) | ||
120 | memset(&perf_stats, 0, sizeof(struct qdio_perf_stats)); | ||
121 | return count; | ||
122 | } | ||
123 | |||
124 | static BUS_ATTR(qdio_performance_stats, 0644, qdio_perf_stats_show, | ||
125 | qdio_perf_stats_store); | ||
126 | |||
127 | int __init qdio_setup_perf_stats(void) | ||
128 | { | ||
129 | int rc; | ||
130 | |||
131 | rc = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats); | ||
132 | if (rc) | ||
133 | return rc; | ||
134 | |||
135 | #ifdef CONFIG_PROC_FS | ||
136 | memset(&perf_stats, 0, sizeof(struct qdio_perf_stats)); | ||
137 | qdio_perf_pde = proc_create("qdio_perf", S_IFREG | S_IRUGO, | ||
138 | NULL, &qdio_perf_proc_fops); | ||
139 | #endif | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | void qdio_remove_perf_stats(void) | ||
144 | { | ||
145 | #ifdef CONFIG_PROC_FS | ||
146 | remove_proc_entry("qdio_perf", NULL); | ||
147 | #endif | ||
148 | bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats); | ||
149 | } | ||
diff --git a/drivers/s390/cio/qdio_perf.h b/drivers/s390/cio/qdio_perf.h deleted file mode 100644 index 12454231dc8b..000000000000 --- a/drivers/s390/cio/qdio_perf.h +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/s390/cio/qdio_perf.h | ||
3 | * | ||
4 | * Copyright IBM Corp. 2008 | ||
5 | * | ||
6 | * Author: Jan Glauber (jang@linux.vnet.ibm.com) | ||
7 | */ | ||
8 | #ifndef QDIO_PERF_H | ||
9 | #define QDIO_PERF_H | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | #include <asm/atomic.h> | ||
13 | |||
14 | struct qdio_perf_stats { | ||
15 | /* interrupt handler calls */ | ||
16 | atomic_long_t qdio_int; | ||
17 | atomic_long_t pci_int; | ||
18 | atomic_long_t thin_int; | ||
19 | |||
20 | /* tasklet runs */ | ||
21 | atomic_long_t tasklet_inbound; | ||
22 | atomic_long_t tasklet_outbound; | ||
23 | atomic_long_t tasklet_thinint; | ||
24 | atomic_long_t tasklet_thinint_loop; | ||
25 | atomic_long_t thinint_inbound; | ||
26 | atomic_long_t thinint_inbound_loop; | ||
27 | atomic_long_t thinint_inbound_loop2; | ||
28 | |||
29 | /* signal adapter calls */ | ||
30 | atomic_long_t siga_out; | ||
31 | atomic_long_t siga_in; | ||
32 | atomic_long_t siga_sync; | ||
33 | |||
34 | /* misc */ | ||
35 | atomic_long_t inbound_handler; | ||
36 | atomic_long_t outbound_handler; | ||
37 | atomic_long_t fast_requeue; | ||
38 | atomic_long_t outbound_target_full; | ||
39 | atomic_long_t inbound_queue_full; | ||
40 | |||
41 | /* for debugging */ | ||
42 | atomic_long_t debug_tl_out_timer; | ||
43 | atomic_long_t debug_stop_polling; | ||
44 | atomic_long_t debug_eqbs_all; | ||
45 | atomic_long_t debug_eqbs_incomplete; | ||
46 | atomic_long_t debug_sqbs_all; | ||
47 | atomic_long_t debug_sqbs_incomplete; | ||
48 | }; | ||
49 | |||
50 | extern struct qdio_perf_stats perf_stats; | ||
51 | extern int qdio_performance_stats; | ||
52 | |||
53 | static inline void qdio_perf_stat_inc(atomic_long_t *count) | ||
54 | { | ||
55 | if (qdio_performance_stats) | ||
56 | atomic_long_inc(count); | ||
57 | } | ||
58 | |||
59 | int qdio_setup_perf_stats(void); | ||
60 | void qdio_remove_perf_stats(void); | ||
61 | |||
62 | #endif | ||
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c index 981a77ea7ee2..091d904d3182 100644 --- a/drivers/s390/cio/qdio_thinint.c +++ b/drivers/s390/cio/qdio_thinint.c | |||
@@ -1,9 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/s390/cio/thinint_qdio.c | 2 | * linux/drivers/s390/cio/thinint_qdio.c |
3 | * | 3 | * |
4 | * thin interrupt support for qdio | 4 | * Copyright 2000,2009 IBM Corp. |
5 | * | ||
6 | * Copyright 2000-2008 IBM Corp. | ||
7 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com> | 5 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com> |
8 | * Cornelia Huck <cornelia.huck@de.ibm.com> | 6 | * Cornelia Huck <cornelia.huck@de.ibm.com> |
9 | * Jan Glauber <jang@linux.vnet.ibm.com> | 7 | * Jan Glauber <jang@linux.vnet.ibm.com> |
@@ -19,7 +17,6 @@ | |||
19 | #include "ioasm.h" | 17 | #include "ioasm.h" |
20 | #include "qdio.h" | 18 | #include "qdio.h" |
21 | #include "qdio_debug.h" | 19 | #include "qdio_debug.h" |
22 | #include "qdio_perf.h" | ||
23 | 20 | ||
24 | /* | 21 | /* |
25 | * Restriction: only 63 iqdio subchannels would have its own indicator, | 22 | * Restriction: only 63 iqdio subchannels would have its own indicator, |
@@ -132,8 +129,6 @@ static void tiqdio_thinint_handler(void *ind, void *drv_data) | |||
132 | { | 129 | { |
133 | struct qdio_q *q; | 130 | struct qdio_q *q; |
134 | 131 | ||
135 | qdio_perf_stat_inc(&perf_stats.thin_int); | ||
136 | |||
137 | /* | 132 | /* |
138 | * SVS only when needed: issue SVS to benefit from iqdio interrupt | 133 | * SVS only when needed: issue SVS to benefit from iqdio interrupt |
139 | * avoidance (SVS clears adapter interrupt suppression overwrite) | 134 | * avoidance (SVS clears adapter interrupt suppression overwrite) |
@@ -154,6 +149,7 @@ static void tiqdio_thinint_handler(void *ind, void *drv_data) | |||
154 | list_for_each_entry_rcu(q, &tiq_list, entry) | 149 | list_for_each_entry_rcu(q, &tiq_list, entry) |
155 | /* only process queues from changed sets */ | 150 | /* only process queues from changed sets */ |
156 | if (*q->irq_ptr->dsci) { | 151 | if (*q->irq_ptr->dsci) { |
152 | qperf_inc(q, adapter_int); | ||
157 | 153 | ||
158 | /* only clear it if the indicator is non-shared */ | 154 | /* only clear it if the indicator is non-shared */ |
159 | if (!shared_ind(q->irq_ptr)) | 155 | if (!shared_ind(q->irq_ptr)) |
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c index 7c815d3327f7..28d86f9df83c 100644 --- a/drivers/sbus/char/bbc_envctrl.c +++ b/drivers/sbus/char/bbc_envctrl.c | |||
@@ -522,6 +522,40 @@ static void attach_one_fan(struct bbc_i2c_bus *bp, struct of_device *op, | |||
522 | set_fan_speeds(fp); | 522 | set_fan_speeds(fp); |
523 | } | 523 | } |
524 | 524 | ||
525 | static void destroy_one_temp(struct bbc_cpu_temperature *tp) | ||
526 | { | ||
527 | bbc_i2c_detach(tp->client); | ||
528 | kfree(tp); | ||
529 | } | ||
530 | |||
531 | static void destroy_all_temps(struct bbc_i2c_bus *bp) | ||
532 | { | ||
533 | struct bbc_cpu_temperature *tp, *tpos; | ||
534 | |||
535 | list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) { | ||
536 | list_del(&tp->bp_list); | ||
537 | list_del(&tp->glob_list); | ||
538 | destroy_one_temp(tp); | ||
539 | } | ||
540 | } | ||
541 | |||
542 | static void destroy_one_fan(struct bbc_fan_control *fp) | ||
543 | { | ||
544 | bbc_i2c_detach(fp->client); | ||
545 | kfree(fp); | ||
546 | } | ||
547 | |||
548 | static void destroy_all_fans(struct bbc_i2c_bus *bp) | ||
549 | { | ||
550 | struct bbc_fan_control *fp, *fpos; | ||
551 | |||
552 | list_for_each_entry_safe(fp, fpos, &bp->fans, bp_list) { | ||
553 | list_del(&fp->bp_list); | ||
554 | list_del(&fp->glob_list); | ||
555 | destroy_one_fan(fp); | ||
556 | } | ||
557 | } | ||
558 | |||
525 | int bbc_envctrl_init(struct bbc_i2c_bus *bp) | 559 | int bbc_envctrl_init(struct bbc_i2c_bus *bp) |
526 | { | 560 | { |
527 | struct of_device *op; | 561 | struct of_device *op; |
@@ -541,6 +575,8 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp) | |||
541 | int err = PTR_ERR(kenvctrld_task); | 575 | int err = PTR_ERR(kenvctrld_task); |
542 | 576 | ||
543 | kenvctrld_task = NULL; | 577 | kenvctrld_task = NULL; |
578 | destroy_all_temps(bp); | ||
579 | destroy_all_fans(bp); | ||
544 | return err; | 580 | return err; |
545 | } | 581 | } |
546 | } | 582 | } |
@@ -548,35 +584,11 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp) | |||
548 | return 0; | 584 | return 0; |
549 | } | 585 | } |
550 | 586 | ||
551 | static void destroy_one_temp(struct bbc_cpu_temperature *tp) | ||
552 | { | ||
553 | bbc_i2c_detach(tp->client); | ||
554 | kfree(tp); | ||
555 | } | ||
556 | |||
557 | static void destroy_one_fan(struct bbc_fan_control *fp) | ||
558 | { | ||
559 | bbc_i2c_detach(fp->client); | ||
560 | kfree(fp); | ||
561 | } | ||
562 | |||
563 | void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp) | 587 | void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp) |
564 | { | 588 | { |
565 | struct bbc_cpu_temperature *tp, *tpos; | ||
566 | struct bbc_fan_control *fp, *fpos; | ||
567 | |||
568 | if (kenvctrld_task) | 589 | if (kenvctrld_task) |
569 | kthread_stop(kenvctrld_task); | 590 | kthread_stop(kenvctrld_task); |
570 | 591 | ||
571 | list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) { | 592 | destroy_all_temps(bp); |
572 | list_del(&tp->bp_list); | 593 | destroy_all_fans(bp); |
573 | list_del(&tp->glob_list); | ||
574 | destroy_one_temp(tp); | ||
575 | } | ||
576 | |||
577 | list_for_each_entry_safe(fp, fpos, &bp->fans, bp_list) { | ||
578 | list_del(&fp->bp_list); | ||
579 | list_del(&fp->glob_list); | ||
580 | destroy_one_fan(fp); | ||
581 | } | ||
582 | } | 594 | } |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c b/drivers/scsi/cxgb3i/cxgb3i_offload.c index 26ffdcd5a437..15a00e8b7122 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_offload.c +++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c | |||
@@ -1440,6 +1440,10 @@ void cxgb3i_c3cn_release(struct s3_conn *c3cn) | |||
1440 | static int is_cxgb3_dev(struct net_device *dev) | 1440 | static int is_cxgb3_dev(struct net_device *dev) |
1441 | { | 1441 | { |
1442 | struct cxgb3i_sdev_data *cdata; | 1442 | struct cxgb3i_sdev_data *cdata; |
1443 | struct net_device *ndev = dev; | ||
1444 | |||
1445 | if (dev->priv_flags & IFF_802_1Q_VLAN) | ||
1446 | ndev = vlan_dev_real_dev(dev); | ||
1443 | 1447 | ||
1444 | write_lock(&cdata_rwlock); | 1448 | write_lock(&cdata_rwlock); |
1445 | list_for_each_entry(cdata, &cdata_list, list) { | 1449 | list_for_each_entry(cdata, &cdata_list, list) { |
@@ -1447,7 +1451,7 @@ static int is_cxgb3_dev(struct net_device *dev) | |||
1447 | int i; | 1451 | int i; |
1448 | 1452 | ||
1449 | for (i = 0; i < ports->nports; i++) | 1453 | for (i = 0; i < ports->nports; i++) |
1450 | if (dev == ports->lldevs[i]) { | 1454 | if (ndev == ports->lldevs[i]) { |
1451 | write_unlock(&cdata_rwlock); | 1455 | write_unlock(&cdata_rwlock); |
1452 | return 1; | 1456 | return 1; |
1453 | } | 1457 | } |
@@ -1566,6 +1570,26 @@ out_err: | |||
1566 | return -EINVAL; | 1570 | return -EINVAL; |
1567 | } | 1571 | } |
1568 | 1572 | ||
1573 | /** | ||
1574 | * cxgb3i_find_dev - find the interface associated with the given address | ||
1575 | * @ipaddr: ip address | ||
1576 | */ | ||
1577 | static struct net_device * | ||
1578 | cxgb3i_find_dev(struct net_device *dev, __be32 ipaddr) | ||
1579 | { | ||
1580 | struct flowi fl; | ||
1581 | int err; | ||
1582 | struct rtable *rt; | ||
1583 | |||
1584 | memset(&fl, 0, sizeof(fl)); | ||
1585 | fl.nl_u.ip4_u.daddr = ipaddr; | ||
1586 | |||
1587 | err = ip_route_output_key(dev ? dev_net(dev) : &init_net, &rt, &fl); | ||
1588 | if (!err) | ||
1589 | return (&rt->u.dst)->dev; | ||
1590 | |||
1591 | return NULL; | ||
1592 | } | ||
1569 | 1593 | ||
1570 | /** | 1594 | /** |
1571 | * cxgb3i_c3cn_connect - initiates an iscsi tcp connection to a given address | 1595 | * cxgb3i_c3cn_connect - initiates an iscsi tcp connection to a given address |
@@ -1581,6 +1605,7 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn, | |||
1581 | struct cxgb3i_sdev_data *cdata; | 1605 | struct cxgb3i_sdev_data *cdata; |
1582 | struct t3cdev *cdev; | 1606 | struct t3cdev *cdev; |
1583 | __be32 sipv4; | 1607 | __be32 sipv4; |
1608 | struct net_device *dstdev; | ||
1584 | int err; | 1609 | int err; |
1585 | 1610 | ||
1586 | c3cn_conn_debug("c3cn 0x%p, dev 0x%p.\n", c3cn, dev); | 1611 | c3cn_conn_debug("c3cn 0x%p, dev 0x%p.\n", c3cn, dev); |
@@ -1591,6 +1616,13 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn, | |||
1591 | c3cn->daddr.sin_port = usin->sin_port; | 1616 | c3cn->daddr.sin_port = usin->sin_port; |
1592 | c3cn->daddr.sin_addr.s_addr = usin->sin_addr.s_addr; | 1617 | c3cn->daddr.sin_addr.s_addr = usin->sin_addr.s_addr; |
1593 | 1618 | ||
1619 | dstdev = cxgb3i_find_dev(dev, usin->sin_addr.s_addr); | ||
1620 | if (!dstdev || !is_cxgb3_dev(dstdev)) | ||
1621 | return -ENETUNREACH; | ||
1622 | |||
1623 | if (dstdev->priv_flags & IFF_802_1Q_VLAN) | ||
1624 | dev = dstdev; | ||
1625 | |||
1594 | rt = find_route(dev, c3cn->saddr.sin_addr.s_addr, | 1626 | rt = find_route(dev, c3cn->saddr.sin_addr.s_addr, |
1595 | c3cn->daddr.sin_addr.s_addr, | 1627 | c3cn->daddr.sin_addr.s_addr, |
1596 | c3cn->saddr.sin_port, | 1628 | c3cn->saddr.sin_port, |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index ce522702a6c1..2cc39684ce97 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -4142,8 +4142,8 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
4142 | spin_lock_irq(shost->host_lock); | 4142 | spin_lock_irq(shost->host_lock); |
4143 | if (vport->fc_rscn_flush) { | 4143 | if (vport->fc_rscn_flush) { |
4144 | /* Another thread is walking fc_rscn_id_list on this vport */ | 4144 | /* Another thread is walking fc_rscn_id_list on this vport */ |
4145 | spin_unlock_irq(shost->host_lock); | ||
4146 | vport->fc_flag |= FC_RSCN_DISCOVERY; | 4145 | vport->fc_flag |= FC_RSCN_DISCOVERY; |
4146 | spin_unlock_irq(shost->host_lock); | ||
4147 | /* Send back ACC */ | 4147 | /* Send back ACC */ |
4148 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); | 4148 | lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); |
4149 | return 0; | 4149 | return 0; |
@@ -5948,8 +5948,8 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
5948 | lpfc_initial_fdisc(vport); | 5948 | lpfc_initial_fdisc(vport); |
5949 | break; | 5949 | break; |
5950 | } | 5950 | } |
5951 | |||
5952 | } else { | 5951 | } else { |
5952 | vport->vpi_state |= LPFC_VPI_REGISTERED; | ||
5953 | if (vport == phba->pport) | 5953 | if (vport == phba->pport) |
5954 | if (phba->sli_rev < LPFC_SLI_REV4) | 5954 | if (phba->sli_rev < LPFC_SLI_REV4) |
5955 | lpfc_issue_fabric_reglogin(vport); | 5955 | lpfc_issue_fabric_reglogin(vport); |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 3b9424427652..2445e399fd60 100755 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -747,6 +747,10 @@ lpfc_linkdown(struct lpfc_hba *phba) | |||
747 | 747 | ||
748 | if (phba->link_state == LPFC_LINK_DOWN) | 748 | if (phba->link_state == LPFC_LINK_DOWN) |
749 | return 0; | 749 | return 0; |
750 | |||
751 | /* Block all SCSI stack I/Os */ | ||
752 | lpfc_scsi_dev_block(phba); | ||
753 | |||
750 | spin_lock_irq(&phba->hbalock); | 754 | spin_lock_irq(&phba->hbalock); |
751 | phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_DISCOVERED); | 755 | phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_DISCOVERED); |
752 | if (phba->link_state > LPFC_LINK_DOWN) { | 756 | if (phba->link_state > LPFC_LINK_DOWN) { |
@@ -1555,10 +1559,16 @@ lpfc_mbx_cmpl_read_fcf_record(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
1555 | * to book keeping the FCFIs can be used. | 1559 | * to book keeping the FCFIs can be used. |
1556 | */ | 1560 | */ |
1557 | if (shdr_status || shdr_add_status) { | 1561 | if (shdr_status || shdr_add_status) { |
1558 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1562 | if (shdr_status == STATUS_FCF_TABLE_EMPTY) { |
1559 | "2521 READ_FCF_RECORD mailbox failed " | 1563 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1560 | "with status x%x add_status x%x, mbx\n", | 1564 | "2726 READ_FCF_RECORD Indicates empty " |
1561 | shdr_status, shdr_add_status); | 1565 | "FCF table.\n"); |
1566 | } else { | ||
1567 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
1568 | "2521 READ_FCF_RECORD mailbox failed " | ||
1569 | "with status x%x add_status x%x, mbx\n", | ||
1570 | shdr_status, shdr_add_status); | ||
1571 | } | ||
1562 | goto out; | 1572 | goto out; |
1563 | } | 1573 | } |
1564 | /* Interpreting the returned information of FCF records */ | 1574 | /* Interpreting the returned information of FCF records */ |
@@ -1698,7 +1708,9 @@ lpfc_init_vpi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
1698 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | 1708 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); |
1699 | return; | 1709 | return; |
1700 | } | 1710 | } |
1711 | spin_lock_irq(&phba->hbalock); | ||
1701 | vport->fc_flag &= ~FC_VPORT_NEEDS_INIT_VPI; | 1712 | vport->fc_flag &= ~FC_VPORT_NEEDS_INIT_VPI; |
1713 | spin_unlock_irq(&phba->hbalock); | ||
1702 | 1714 | ||
1703 | if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) | 1715 | if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) |
1704 | lpfc_initial_fdisc(vport); | 1716 | lpfc_initial_fdisc(vport); |
@@ -2259,7 +2271,10 @@ lpfc_mbx_cmpl_unreg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
2259 | mb->mbxStatus); | 2271 | mb->mbxStatus); |
2260 | break; | 2272 | break; |
2261 | } | 2273 | } |
2274 | spin_lock_irq(&phba->hbalock); | ||
2262 | vport->vpi_state &= ~LPFC_VPI_REGISTERED; | 2275 | vport->vpi_state &= ~LPFC_VPI_REGISTERED; |
2276 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | ||
2277 | spin_unlock_irq(&phba->hbalock); | ||
2263 | vport->unreg_vpi_cmpl = VPORT_OK; | 2278 | vport->unreg_vpi_cmpl = VPORT_OK; |
2264 | mempool_free(pmb, phba->mbox_mem_pool); | 2279 | mempool_free(pmb, phba->mbox_mem_pool); |
2265 | /* | 2280 | /* |
@@ -4475,8 +4490,10 @@ lpfc_unregister_unused_fcf(struct lpfc_hba *phba) | |||
4475 | (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) | 4490 | (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) |
4476 | for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { | 4491 | for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { |
4477 | lpfc_mbx_unreg_vpi(vports[i]); | 4492 | lpfc_mbx_unreg_vpi(vports[i]); |
4493 | spin_lock_irq(&phba->hbalock); | ||
4478 | vports[i]->fc_flag |= FC_VPORT_NEEDS_INIT_VPI; | 4494 | vports[i]->fc_flag |= FC_VPORT_NEEDS_INIT_VPI; |
4479 | vports[i]->vpi_state &= ~LPFC_VPI_REGISTERED; | 4495 | vports[i]->vpi_state &= ~LPFC_VPI_REGISTERED; |
4496 | spin_unlock_irq(&phba->hbalock); | ||
4480 | } | 4497 | } |
4481 | lpfc_destroy_vport_work_array(phba, vports); | 4498 | lpfc_destroy_vport_work_array(phba, vports); |
4482 | 4499 | ||
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 1585148a17e5..8a2a1c5935c6 100644..100755 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h | |||
@@ -1013,7 +1013,7 @@ struct lpfc_mbx_wq_destroy { | |||
1013 | }; | 1013 | }; |
1014 | 1014 | ||
1015 | #define LPFC_HDR_BUF_SIZE 128 | 1015 | #define LPFC_HDR_BUF_SIZE 128 |
1016 | #define LPFC_DATA_BUF_SIZE 4096 | 1016 | #define LPFC_DATA_BUF_SIZE 2048 |
1017 | struct rq_context { | 1017 | struct rq_context { |
1018 | uint32_t word0; | 1018 | uint32_t word0; |
1019 | #define lpfc_rq_context_rq_size_SHIFT 16 | 1019 | #define lpfc_rq_context_rq_size_SHIFT 16 |
@@ -1371,6 +1371,7 @@ struct lpfc_mbx_query_fw_cfg { | |||
1371 | #define STATUS_ERROR_ACITMAIN 0x2a | 1371 | #define STATUS_ERROR_ACITMAIN 0x2a |
1372 | #define STATUS_REBOOT_REQUIRED 0x2c | 1372 | #define STATUS_REBOOT_REQUIRED 0x2c |
1373 | #define STATUS_FCF_IN_USE 0x3a | 1373 | #define STATUS_FCF_IN_USE 0x3a |
1374 | #define STATUS_FCF_TABLE_EMPTY 0x43 | ||
1374 | 1375 | ||
1375 | struct lpfc_mbx_sli4_config { | 1376 | struct lpfc_mbx_sli4_config { |
1376 | struct mbox_header header; | 1377 | struct mbox_header header; |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index d4da6bdd0e73..b8eb1b6e5e77 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -3006,6 +3006,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3006 | struct lpfc_vport *vport; | 3006 | struct lpfc_vport *vport; |
3007 | struct lpfc_nodelist *ndlp; | 3007 | struct lpfc_nodelist *ndlp; |
3008 | struct Scsi_Host *shost; | 3008 | struct Scsi_Host *shost; |
3009 | uint32_t link_state; | ||
3009 | 3010 | ||
3010 | phba->fc_eventTag = acqe_fcoe->event_tag; | 3011 | phba->fc_eventTag = acqe_fcoe->event_tag; |
3011 | phba->fcoe_eventtag = acqe_fcoe->event_tag; | 3012 | phba->fcoe_eventtag = acqe_fcoe->event_tag; |
@@ -3052,9 +3053,12 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | |||
3052 | break; | 3053 | break; |
3053 | /* | 3054 | /* |
3054 | * Currently, driver support only one FCF - so treat this as | 3055 | * Currently, driver support only one FCF - so treat this as |
3055 | * a link down. | 3056 | * a link down, but save the link state because we don't want |
3057 | * it to be changed to Link Down unless it is already down. | ||
3056 | */ | 3058 | */ |
3059 | link_state = phba->link_state; | ||
3057 | lpfc_linkdown(phba); | 3060 | lpfc_linkdown(phba); |
3061 | phba->link_state = link_state; | ||
3058 | /* Unregister FCF if no devices connected to it */ | 3062 | /* Unregister FCF if no devices connected to it */ |
3059 | lpfc_unregister_unused_fcf(phba); | 3063 | lpfc_unregister_unused_fcf(phba); |
3060 | break; | 3064 | break; |
@@ -7226,8 +7230,6 @@ lpfc_prep_dev_for_perm_failure(struct lpfc_hba *phba) | |||
7226 | { | 7230 | { |
7227 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 7231 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
7228 | "2711 PCI channel permanent disable for failure\n"); | 7232 | "2711 PCI channel permanent disable for failure\n"); |
7229 | /* Block all SCSI devices' I/Os on the host */ | ||
7230 | lpfc_scsi_dev_block(phba); | ||
7231 | /* Clean up all driver's outstanding SCSI I/Os */ | 7233 | /* Clean up all driver's outstanding SCSI I/Os */ |
7232 | lpfc_sli_flush_fcp_rings(phba); | 7234 | lpfc_sli_flush_fcp_rings(phba); |
7233 | } | 7235 | } |
@@ -7256,6 +7258,9 @@ lpfc_io_error_detected_s3(struct pci_dev *pdev, pci_channel_state_t state) | |||
7256 | struct Scsi_Host *shost = pci_get_drvdata(pdev); | 7258 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
7257 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; | 7259 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
7258 | 7260 | ||
7261 | /* Block all SCSI devices' I/Os on the host */ | ||
7262 | lpfc_scsi_dev_block(phba); | ||
7263 | |||
7259 | switch (state) { | 7264 | switch (state) { |
7260 | case pci_channel_io_normal: | 7265 | case pci_channel_io_normal: |
7261 | /* Non-fatal error, prepare for recovery */ | 7266 | /* Non-fatal error, prepare for recovery */ |
@@ -7507,6 +7512,9 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
7507 | error = -ENODEV; | 7512 | error = -ENODEV; |
7508 | goto out_free_sysfs_attr; | 7513 | goto out_free_sysfs_attr; |
7509 | } | 7514 | } |
7515 | /* Default to single FCP EQ for non-MSI-X */ | ||
7516 | if (phba->intr_type != MSIX) | ||
7517 | phba->cfg_fcp_eq_count = 1; | ||
7510 | /* Set up SLI-4 HBA */ | 7518 | /* Set up SLI-4 HBA */ |
7511 | if (lpfc_sli4_hba_setup(phba)) { | 7519 | if (lpfc_sli4_hba_setup(phba)) { |
7512 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 7520 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 7935667b81a5..589549b2bf0e 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -1383,7 +1383,7 @@ lpfc_sli_hbq_to_firmware_s4(struct lpfc_hba *phba, uint32_t hbqno, | |||
1383 | /* HBQ for ELS and CT traffic. */ | 1383 | /* HBQ for ELS and CT traffic. */ |
1384 | static struct lpfc_hbq_init lpfc_els_hbq = { | 1384 | static struct lpfc_hbq_init lpfc_els_hbq = { |
1385 | .rn = 1, | 1385 | .rn = 1, |
1386 | .entry_count = 200, | 1386 | .entry_count = 256, |
1387 | .mask_count = 0, | 1387 | .mask_count = 0, |
1388 | .profile = 0, | 1388 | .profile = 0, |
1389 | .ring_mask = (1 << LPFC_ELS_RING), | 1389 | .ring_mask = (1 << LPFC_ELS_RING), |
@@ -1482,8 +1482,11 @@ err: | |||
1482 | int | 1482 | int |
1483 | lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno) | 1483 | lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno) |
1484 | { | 1484 | { |
1485 | return(lpfc_sli_hbqbuf_fill_hbqs(phba, qno, | 1485 | if (phba->sli_rev == LPFC_SLI_REV4) |
1486 | lpfc_hbq_defs[qno]->add_count)); | 1486 | return 0; |
1487 | else | ||
1488 | return lpfc_sli_hbqbuf_fill_hbqs(phba, qno, | ||
1489 | lpfc_hbq_defs[qno]->add_count); | ||
1487 | } | 1490 | } |
1488 | 1491 | ||
1489 | /** | 1492 | /** |
@@ -1498,8 +1501,12 @@ lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno) | |||
1498 | static int | 1501 | static int |
1499 | lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno) | 1502 | lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno) |
1500 | { | 1503 | { |
1501 | return(lpfc_sli_hbqbuf_fill_hbqs(phba, qno, | 1504 | if (phba->sli_rev == LPFC_SLI_REV4) |
1502 | lpfc_hbq_defs[qno]->init_count)); | 1505 | return lpfc_sli_hbqbuf_fill_hbqs(phba, qno, |
1506 | lpfc_hbq_defs[qno]->entry_count); | ||
1507 | else | ||
1508 | return lpfc_sli_hbqbuf_fill_hbqs(phba, qno, | ||
1509 | lpfc_hbq_defs[qno]->init_count); | ||
1503 | } | 1510 | } |
1504 | 1511 | ||
1505 | /** | 1512 | /** |
@@ -4110,6 +4117,7 @@ lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, | |||
4110 | if (rc) { | 4117 | if (rc) { |
4111 | dma_free_coherent(&phba->pcidev->dev, dma_size, | 4118 | dma_free_coherent(&phba->pcidev->dev, dma_size, |
4112 | dmabuf->virt, dmabuf->phys); | 4119 | dmabuf->virt, dmabuf->phys); |
4120 | kfree(dmabuf); | ||
4113 | return -EIO; | 4121 | return -EIO; |
4114 | } | 4122 | } |
4115 | 4123 | ||
@@ -5848,7 +5856,6 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, | |||
5848 | iocbq->iocb.un.ulpWord[3]); | 5856 | iocbq->iocb.un.ulpWord[3]); |
5849 | wqe->generic.word3 = 0; | 5857 | wqe->generic.word3 = 0; |
5850 | bf_set(wqe_rcvoxid, &wqe->generic, iocbq->iocb.ulpContext); | 5858 | bf_set(wqe_rcvoxid, &wqe->generic, iocbq->iocb.ulpContext); |
5851 | bf_set(wqe_xc, &wqe->generic, 1); | ||
5852 | /* The entire sequence is transmitted for this IOCB */ | 5859 | /* The entire sequence is transmitted for this IOCB */ |
5853 | xmit_len = total_len; | 5860 | xmit_len = total_len; |
5854 | cmnd = CMD_XMIT_SEQUENCE64_CR; | 5861 | cmnd = CMD_XMIT_SEQUENCE64_CR; |
@@ -10944,7 +10951,8 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf) | |||
10944 | return dmabuf; | 10951 | return dmabuf; |
10945 | } | 10952 | } |
10946 | temp_hdr = seq_dmabuf->hbuf.virt; | 10953 | temp_hdr = seq_dmabuf->hbuf.virt; |
10947 | if (new_hdr->fh_seq_cnt < temp_hdr->fh_seq_cnt) { | 10954 | if (be16_to_cpu(new_hdr->fh_seq_cnt) < |
10955 | be16_to_cpu(temp_hdr->fh_seq_cnt)) { | ||
10948 | list_del_init(&seq_dmabuf->hbuf.list); | 10956 | list_del_init(&seq_dmabuf->hbuf.list); |
10949 | list_add_tail(&dmabuf->hbuf.list, &vport->rcv_buffer_list); | 10957 | list_add_tail(&dmabuf->hbuf.list, &vport->rcv_buffer_list); |
10950 | list_add_tail(&dmabuf->dbuf.list, &seq_dmabuf->dbuf.list); | 10958 | list_add_tail(&dmabuf->dbuf.list, &seq_dmabuf->dbuf.list); |
@@ -10955,6 +10963,11 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf) | |||
10955 | list_move_tail(&seq_dmabuf->hbuf.list, &vport->rcv_buffer_list); | 10963 | list_move_tail(&seq_dmabuf->hbuf.list, &vport->rcv_buffer_list); |
10956 | seq_dmabuf->time_stamp = jiffies; | 10964 | seq_dmabuf->time_stamp = jiffies; |
10957 | lpfc_update_rcv_time_stamp(vport); | 10965 | lpfc_update_rcv_time_stamp(vport); |
10966 | if (list_empty(&seq_dmabuf->dbuf.list)) { | ||
10967 | temp_hdr = dmabuf->hbuf.virt; | ||
10968 | list_add_tail(&dmabuf->dbuf.list, &seq_dmabuf->dbuf.list); | ||
10969 | return seq_dmabuf; | ||
10970 | } | ||
10958 | /* find the correct place in the sequence to insert this frame */ | 10971 | /* find the correct place in the sequence to insert this frame */ |
10959 | list_for_each_entry_reverse(d_buf, &seq_dmabuf->dbuf.list, list) { | 10972 | list_for_each_entry_reverse(d_buf, &seq_dmabuf->dbuf.list, list) { |
10960 | temp_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf); | 10973 | temp_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf); |
@@ -10963,7 +10976,8 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf) | |||
10963 | * If the frame's sequence count is greater than the frame on | 10976 | * If the frame's sequence count is greater than the frame on |
10964 | * the list then insert the frame right after this frame | 10977 | * the list then insert the frame right after this frame |
10965 | */ | 10978 | */ |
10966 | if (new_hdr->fh_seq_cnt > temp_hdr->fh_seq_cnt) { | 10979 | if (be16_to_cpu(new_hdr->fh_seq_cnt) > |
10980 | be16_to_cpu(temp_hdr->fh_seq_cnt)) { | ||
10967 | list_add(&dmabuf->dbuf.list, &temp_dmabuf->dbuf.list); | 10981 | list_add(&dmabuf->dbuf.list, &temp_dmabuf->dbuf.list); |
10968 | return seq_dmabuf; | 10982 | return seq_dmabuf; |
10969 | } | 10983 | } |
@@ -11210,7 +11224,7 @@ lpfc_seq_complete(struct hbq_dmabuf *dmabuf) | |||
11210 | seq_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf); | 11224 | seq_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf); |
11211 | hdr = (struct fc_frame_header *)seq_dmabuf->hbuf.virt; | 11225 | hdr = (struct fc_frame_header *)seq_dmabuf->hbuf.virt; |
11212 | /* If there is a hole in the sequence count then fail. */ | 11226 | /* If there is a hole in the sequence count then fail. */ |
11213 | if (++seq_count != hdr->fh_seq_cnt) | 11227 | if (++seq_count != be16_to_cpu(hdr->fh_seq_cnt)) |
11214 | return 0; | 11228 | return 0; |
11215 | fctl = (hdr->fh_f_ctl[0] << 16 | | 11229 | fctl = (hdr->fh_f_ctl[0] << 16 | |
11216 | hdr->fh_f_ctl[1] << 8 | | 11230 | hdr->fh_f_ctl[1] << 8 | |
@@ -11242,6 +11256,7 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf) | |||
11242 | struct lpfc_iocbq *first_iocbq, *iocbq; | 11256 | struct lpfc_iocbq *first_iocbq, *iocbq; |
11243 | struct fc_frame_header *fc_hdr; | 11257 | struct fc_frame_header *fc_hdr; |
11244 | uint32_t sid; | 11258 | uint32_t sid; |
11259 | struct ulp_bde64 *pbde; | ||
11245 | 11260 | ||
11246 | fc_hdr = (struct fc_frame_header *)seq_dmabuf->hbuf.virt; | 11261 | fc_hdr = (struct fc_frame_header *)seq_dmabuf->hbuf.virt; |
11247 | /* remove from receive buffer list */ | 11262 | /* remove from receive buffer list */ |
@@ -11283,8 +11298,9 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf) | |||
11283 | if (!iocbq->context3) { | 11298 | if (!iocbq->context3) { |
11284 | iocbq->context3 = d_buf; | 11299 | iocbq->context3 = d_buf; |
11285 | iocbq->iocb.ulpBdeCount++; | 11300 | iocbq->iocb.ulpBdeCount++; |
11286 | iocbq->iocb.unsli3.rcvsli3.bde2.tus.f.bdeSize = | 11301 | pbde = (struct ulp_bde64 *) |
11287 | LPFC_DATA_BUF_SIZE; | 11302 | &iocbq->iocb.unsli3.sli3Words[4]; |
11303 | pbde->tus.f.bdeSize = LPFC_DATA_BUF_SIZE; | ||
11288 | first_iocbq->iocb.unsli3.rcvsli3.acc_len += | 11304 | first_iocbq->iocb.unsli3.rcvsli3.acc_len += |
11289 | bf_get(lpfc_rcqe_length, | 11305 | bf_get(lpfc_rcqe_length, |
11290 | &seq_dmabuf->cq_event.cqe.rcqe_cmpl); | 11306 | &seq_dmabuf->cq_event.cqe.rcqe_cmpl); |
@@ -11401,15 +11417,9 @@ lpfc_sli4_handle_received_buffer(struct lpfc_hba *phba, | |||
11401 | return; | 11417 | return; |
11402 | } | 11418 | } |
11403 | /* If not last frame in sequence continue processing frames. */ | 11419 | /* If not last frame in sequence continue processing frames. */ |
11404 | if (!lpfc_seq_complete(seq_dmabuf)) { | 11420 | if (!lpfc_seq_complete(seq_dmabuf)) |
11405 | /* | ||
11406 | * When saving off frames post a new one and mark this | ||
11407 | * frame to be freed when it is finished. | ||
11408 | **/ | ||
11409 | lpfc_sli_hbqbuf_fill_hbqs(phba, LPFC_ELS_HBQ, 1); | ||
11410 | dmabuf->tag = -1; | ||
11411 | return; | 11421 | return; |
11412 | } | 11422 | |
11413 | /* Send the complete sequence to the upper layer protocol */ | 11423 | /* Send the complete sequence to the upper layer protocol */ |
11414 | lpfc_sli4_send_seq_to_ulp(vport, seq_dmabuf); | 11424 | lpfc_sli4_send_seq_to_ulp(vport, seq_dmabuf); |
11415 | } | 11425 | } |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index 25d66d070cf8..44e5f574236b 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -28,7 +28,7 @@ | |||
28 | /* Multi-queue arrangement for fast-path FCP work queues */ | 28 | /* Multi-queue arrangement for fast-path FCP work queues */ |
29 | #define LPFC_FN_EQN_MAX 8 | 29 | #define LPFC_FN_EQN_MAX 8 |
30 | #define LPFC_SP_EQN_DEF 1 | 30 | #define LPFC_SP_EQN_DEF 1 |
31 | #define LPFC_FP_EQN_DEF 1 | 31 | #define LPFC_FP_EQN_DEF 4 |
32 | #define LPFC_FP_EQN_MIN 1 | 32 | #define LPFC_FP_EQN_MIN 1 |
33 | #define LPFC_FP_EQN_MAX (LPFC_FN_EQN_MAX - LPFC_SP_EQN_DEF) | 33 | #define LPFC_FP_EQN_MAX (LPFC_FN_EQN_MAX - LPFC_SP_EQN_DEF) |
34 | 34 | ||
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index c7f3aed2aab8..792f72263f1a 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h | |||
@@ -18,7 +18,7 @@ | |||
18 | * included with this package. * | 18 | * included with this package. * |
19 | *******************************************************************/ | 19 | *******************************************************************/ |
20 | 20 | ||
21 | #define LPFC_DRIVER_VERSION "8.3.6" | 21 | #define LPFC_DRIVER_VERSION "8.3.7" |
22 | #define LPFC_DRIVER_NAME "lpfc" | 22 | #define LPFC_DRIVER_NAME "lpfc" |
23 | #define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp" | 23 | #define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp" |
24 | #define LPFC_FP_DRIVER_HANDLER_NAME "lpfc:fp" | 24 | #define LPFC_FP_DRIVER_HANDLER_NAME "lpfc:fp" |
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index 7d6dd83d3592..e3c7fa642306 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c | |||
@@ -512,8 +512,10 @@ enable_vport(struct fc_vport *fc_vport) | |||
512 | return VPORT_OK; | 512 | return VPORT_OK; |
513 | } | 513 | } |
514 | 514 | ||
515 | spin_lock_irq(&phba->hbalock); | ||
515 | vport->load_flag |= FC_LOADING; | 516 | vport->load_flag |= FC_LOADING; |
516 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | 517 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; |
518 | spin_unlock_irq(&phba->hbalock); | ||
517 | 519 | ||
518 | /* Use the Physical nodes Fabric NDLP to determine if the link is | 520 | /* Use the Physical nodes Fabric NDLP to determine if the link is |
519 | * up and ready to FDISC. | 521 | * up and ready to FDISC. |
@@ -700,7 +702,7 @@ lpfc_vport_delete(struct fc_vport *fc_vport) | |||
700 | } | 702 | } |
701 | spin_unlock_irq(&phba->ndlp_lock); | 703 | spin_unlock_irq(&phba->ndlp_lock); |
702 | } | 704 | } |
703 | if (vport->vpi_state != LPFC_VPI_REGISTERED) | 705 | if (!(vport->vpi_state & LPFC_VPI_REGISTERED)) |
704 | goto skip_logo; | 706 | goto skip_logo; |
705 | vport->unreg_vpi_cmpl = VPORT_INVAL; | 707 | vport->unreg_vpi_cmpl = VPORT_INVAL; |
706 | timeout = msecs_to_jiffies(phba->fc_ratov * 2000); | 708 | timeout = msecs_to_jiffies(phba->fc_ratov * 2000); |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index e7d2688fbeba..b6f1ef954af1 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -2483,14 +2483,12 @@ static int pmcraid_error_handler(struct pmcraid_cmd *cmd) | |||
2483 | sense_copied = 1; | 2483 | sense_copied = 1; |
2484 | } | 2484 | } |
2485 | 2485 | ||
2486 | if (RES_IS_GSCSI(res->cfg_entry)) { | 2486 | if (RES_IS_GSCSI(res->cfg_entry)) |
2487 | pmcraid_cancel_all(cmd, sense_copied); | 2487 | pmcraid_cancel_all(cmd, sense_copied); |
2488 | } else if (sense_copied) { | 2488 | else if (sense_copied) |
2489 | pmcraid_erp_done(cmd); | 2489 | pmcraid_erp_done(cmd); |
2490 | return 0; | 2490 | else |
2491 | } else { | ||
2492 | pmcraid_request_sense(cmd); | 2491 | pmcraid_request_sense(cmd); |
2493 | } | ||
2494 | 2492 | ||
2495 | return 1; | 2493 | return 1; |
2496 | 2494 | ||
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 21e2bc4d7401..3a9f5b288aee 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -232,6 +232,9 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, | |||
232 | if (off) | 232 | if (off) |
233 | return 0; | 233 | return 0; |
234 | 234 | ||
235 | if (unlikely(pci_channel_offline(ha->pdev))) | ||
236 | return 0; | ||
237 | |||
235 | if (sscanf(buf, "%d:%x:%x", &val, &start, &size) < 1) | 238 | if (sscanf(buf, "%d:%x:%x", &val, &start, &size) < 1) |
236 | return -EINVAL; | 239 | return -EINVAL; |
237 | if (start > ha->optrom_size) | 240 | if (start > ha->optrom_size) |
@@ -379,6 +382,9 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj, | |||
379 | struct device, kobj))); | 382 | struct device, kobj))); |
380 | struct qla_hw_data *ha = vha->hw; | 383 | struct qla_hw_data *ha = vha->hw; |
381 | 384 | ||
385 | if (unlikely(pci_channel_offline(ha->pdev))) | ||
386 | return 0; | ||
387 | |||
382 | if (!capable(CAP_SYS_ADMIN)) | 388 | if (!capable(CAP_SYS_ADMIN)) |
383 | return 0; | 389 | return 0; |
384 | 390 | ||
@@ -398,6 +404,9 @@ qla2x00_sysfs_write_vpd(struct kobject *kobj, | |||
398 | struct qla_hw_data *ha = vha->hw; | 404 | struct qla_hw_data *ha = vha->hw; |
399 | uint8_t *tmp_data; | 405 | uint8_t *tmp_data; |
400 | 406 | ||
407 | if (unlikely(pci_channel_offline(ha->pdev))) | ||
408 | return 0; | ||
409 | |||
401 | if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->vpd_size || | 410 | if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->vpd_size || |
402 | !ha->isp_ops->write_nvram) | 411 | !ha->isp_ops->write_nvram) |
403 | return 0; | 412 | return 0; |
@@ -1238,10 +1247,11 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr, | |||
1238 | char *buf) | 1247 | char *buf) |
1239 | { | 1248 | { |
1240 | scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); | 1249 | scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); |
1241 | int rval; | 1250 | int rval = QLA_FUNCTION_FAILED; |
1242 | uint16_t state[5]; | 1251 | uint16_t state[5]; |
1243 | 1252 | ||
1244 | rval = qla2x00_get_firmware_state(vha, state); | 1253 | if (!vha->hw->flags.eeh_busy) |
1254 | rval = qla2x00_get_firmware_state(vha, state); | ||
1245 | if (rval != QLA_SUCCESS) | 1255 | if (rval != QLA_SUCCESS) |
1246 | memset(state, -1, sizeof(state)); | 1256 | memset(state, -1, sizeof(state)); |
1247 | 1257 | ||
@@ -1452,10 +1462,13 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport) | |||
1452 | if (!fcport) | 1462 | if (!fcport) |
1453 | return; | 1463 | return; |
1454 | 1464 | ||
1455 | if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) | 1465 | if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags)) |
1466 | return; | ||
1467 | |||
1468 | if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { | ||
1456 | qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); | 1469 | qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); |
1457 | else | 1470 | return; |
1458 | qla2x00_abort_fcport_cmds(fcport); | 1471 | } |
1459 | 1472 | ||
1460 | /* | 1473 | /* |
1461 | * Transport has effectively 'deleted' the rport, clear | 1474 | * Transport has effectively 'deleted' the rport, clear |
@@ -1475,6 +1488,9 @@ qla2x00_terminate_rport_io(struct fc_rport *rport) | |||
1475 | if (!fcport) | 1488 | if (!fcport) |
1476 | return; | 1489 | return; |
1477 | 1490 | ||
1491 | if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags)) | ||
1492 | return; | ||
1493 | |||
1478 | if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { | 1494 | if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { |
1479 | qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); | 1495 | qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); |
1480 | return; | 1496 | return; |
@@ -1515,6 +1531,12 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | |||
1515 | pfc_host_stat = &ha->fc_host_stat; | 1531 | pfc_host_stat = &ha->fc_host_stat; |
1516 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); | 1532 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); |
1517 | 1533 | ||
1534 | if (test_bit(UNLOADING, &vha->dpc_flags)) | ||
1535 | goto done; | ||
1536 | |||
1537 | if (unlikely(pci_channel_offline(ha->pdev))) | ||
1538 | goto done; | ||
1539 | |||
1518 | stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma); | 1540 | stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma); |
1519 | if (stats == NULL) { | 1541 | if (stats == NULL) { |
1520 | DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n", | 1542 | DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n", |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index f660dd70b72e..d6d9c86cb058 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h | |||
@@ -26,7 +26,7 @@ | |||
26 | /* #define QL_DEBUG_LEVEL_14 */ /* Output RSCN trace msgs */ | 26 | /* #define QL_DEBUG_LEVEL_14 */ /* Output RSCN trace msgs */ |
27 | /* #define QL_DEBUG_LEVEL_15 */ /* Output NPIV trace msgs */ | 27 | /* #define QL_DEBUG_LEVEL_15 */ /* Output NPIV trace msgs */ |
28 | /* #define QL_DEBUG_LEVEL_16 */ /* Output ISP84XX trace msgs */ | 28 | /* #define QL_DEBUG_LEVEL_16 */ /* Output ISP84XX trace msgs */ |
29 | /* #define QL_DEBUG_LEVEL_17 */ /* Output MULTI-Q trace messages */ | 29 | /* #define QL_DEBUG_LEVEL_17 */ /* Output EEH trace messages */ |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Macros use for debugging the driver. | 32 | * Macros use for debugging the driver. |
@@ -132,6 +132,13 @@ | |||
132 | #else | 132 | #else |
133 | #define DEBUG16(x) do {} while (0) | 133 | #define DEBUG16(x) do {} while (0) |
134 | #endif | 134 | #endif |
135 | |||
136 | #if defined(QL_DEBUG_LEVEL_17) | ||
137 | #define DEBUG17(x) do {x;} while (0) | ||
138 | #else | ||
139 | #define DEBUG17(x) do {} while (0) | ||
140 | #endif | ||
141 | |||
135 | /* | 142 | /* |
136 | * Firmware Dump structure definition | 143 | * Firmware Dump structure definition |
137 | */ | 144 | */ |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 384afda7dbe9..608e675f68c8 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2256,11 +2256,13 @@ struct qla_hw_data { | |||
2256 | uint32_t disable_serdes :1; | 2256 | uint32_t disable_serdes :1; |
2257 | uint32_t gpsc_supported :1; | 2257 | uint32_t gpsc_supported :1; |
2258 | uint32_t npiv_supported :1; | 2258 | uint32_t npiv_supported :1; |
2259 | uint32_t pci_channel_io_perm_failure :1; | ||
2259 | uint32_t fce_enabled :1; | 2260 | uint32_t fce_enabled :1; |
2260 | uint32_t fac_supported :1; | 2261 | uint32_t fac_supported :1; |
2261 | uint32_t chip_reset_done :1; | 2262 | uint32_t chip_reset_done :1; |
2262 | uint32_t port0 :1; | 2263 | uint32_t port0 :1; |
2263 | uint32_t running_gold_fw :1; | 2264 | uint32_t running_gold_fw :1; |
2265 | uint32_t eeh_busy :1; | ||
2264 | uint32_t cpu_affinity_enabled :1; | 2266 | uint32_t cpu_affinity_enabled :1; |
2265 | uint32_t disable_msix_handshake :1; | 2267 | uint32_t disable_msix_handshake :1; |
2266 | } flags; | 2268 | } flags; |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 0b6801fc6389..f61fb8d01330 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -324,6 +324,7 @@ qla2x00_read_ram_word(scsi_qla_host_t *, uint32_t, uint32_t *); | |||
324 | extern int | 324 | extern int |
325 | qla2x00_write_ram_word(scsi_qla_host_t *, uint32_t, uint32_t); | 325 | qla2x00_write_ram_word(scsi_qla_host_t *, uint32_t, uint32_t); |
326 | 326 | ||
327 | extern int qla2x00_get_data_rate(scsi_qla_host_t *); | ||
327 | /* | 328 | /* |
328 | * Global Function Prototypes in qla_isr.c source file. | 329 | * Global Function Prototypes in qla_isr.c source file. |
329 | */ | 330 | */ |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 73a793539d45..b4a0eac8f96d 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -269,6 +269,8 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha) | |||
269 | vha->flags.online = 0; | 269 | vha->flags.online = 0; |
270 | ha->flags.chip_reset_done = 0; | 270 | ha->flags.chip_reset_done = 0; |
271 | vha->flags.reset_active = 0; | 271 | vha->flags.reset_active = 0; |
272 | ha->flags.pci_channel_io_perm_failure = 0; | ||
273 | ha->flags.eeh_busy = 0; | ||
272 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); | 274 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); |
273 | atomic_set(&vha->loop_state, LOOP_DOWN); | 275 | atomic_set(&vha->loop_state, LOOP_DOWN); |
274 | vha->device_flags = DFLG_NO_CABLE; | 276 | vha->device_flags = DFLG_NO_CABLE; |
@@ -581,6 +583,9 @@ qla2x00_reset_chip(scsi_qla_host_t *vha) | |||
581 | uint32_t cnt; | 583 | uint32_t cnt; |
582 | uint16_t cmd; | 584 | uint16_t cmd; |
583 | 585 | ||
586 | if (unlikely(pci_channel_offline(ha->pdev))) | ||
587 | return; | ||
588 | |||
584 | ha->isp_ops->disable_intrs(ha); | 589 | ha->isp_ops->disable_intrs(ha); |
585 | 590 | ||
586 | spin_lock_irqsave(&ha->hardware_lock, flags); | 591 | spin_lock_irqsave(&ha->hardware_lock, flags); |
@@ -786,6 +791,12 @@ void | |||
786 | qla24xx_reset_chip(scsi_qla_host_t *vha) | 791 | qla24xx_reset_chip(scsi_qla_host_t *vha) |
787 | { | 792 | { |
788 | struct qla_hw_data *ha = vha->hw; | 793 | struct qla_hw_data *ha = vha->hw; |
794 | |||
795 | if (pci_channel_offline(ha->pdev) && | ||
796 | ha->flags.pci_channel_io_perm_failure) { | ||
797 | return; | ||
798 | } | ||
799 | |||
789 | ha->isp_ops->disable_intrs(ha); | 800 | ha->isp_ops->disable_intrs(ha); |
790 | 801 | ||
791 | /* Perform RISC reset. */ | 802 | /* Perform RISC reset. */ |
@@ -2266,6 +2277,8 @@ qla2x00_configure_loop(scsi_qla_host_t *vha) | |||
2266 | clear_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); | 2277 | clear_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); |
2267 | clear_bit(RSCN_UPDATE, &vha->dpc_flags); | 2278 | clear_bit(RSCN_UPDATE, &vha->dpc_flags); |
2268 | 2279 | ||
2280 | qla2x00_get_data_rate(vha); | ||
2281 | |||
2269 | /* Determine what we need to do */ | 2282 | /* Determine what we need to do */ |
2270 | if (ha->current_topology == ISP_CFG_FL && | 2283 | if (ha->current_topology == ISP_CFG_FL && |
2271 | (test_bit(LOCAL_LOOP_UPDATE, &flags))) { | 2284 | (test_bit(LOCAL_LOOP_UPDATE, &flags))) { |
@@ -3560,6 +3573,13 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) | |||
3560 | /* Requeue all commands in outstanding command list. */ | 3573 | /* Requeue all commands in outstanding command list. */ |
3561 | qla2x00_abort_all_cmds(vha, DID_RESET << 16); | 3574 | qla2x00_abort_all_cmds(vha, DID_RESET << 16); |
3562 | 3575 | ||
3576 | if (unlikely(pci_channel_offline(ha->pdev) && | ||
3577 | ha->flags.pci_channel_io_perm_failure)) { | ||
3578 | clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); | ||
3579 | status = 0; | ||
3580 | return status; | ||
3581 | } | ||
3582 | |||
3563 | ha->isp_ops->get_flash_version(vha, req->ring); | 3583 | ha->isp_ops->get_flash_version(vha, req->ring); |
3564 | 3584 | ||
3565 | ha->isp_ops->nvram_config(vha); | 3585 | ha->isp_ops->nvram_config(vha); |
@@ -4458,6 +4478,8 @@ qla2x00_try_to_stop_firmware(scsi_qla_host_t *vha) | |||
4458 | int ret, retries; | 4478 | int ret, retries; |
4459 | struct qla_hw_data *ha = vha->hw; | 4479 | struct qla_hw_data *ha = vha->hw; |
4460 | 4480 | ||
4481 | if (ha->flags.pci_channel_io_perm_failure) | ||
4482 | return; | ||
4461 | if (!IS_FWI2_CAPABLE(ha)) | 4483 | if (!IS_FWI2_CAPABLE(ha)) |
4462 | return; | 4484 | return; |
4463 | if (!ha->fw_major_version) | 4485 | if (!ha->fw_major_version) |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 1692a883f4de..ffd0efdff40e 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -152,7 +152,7 @@ qla2300_intr_handler(int irq, void *dev_id) | |||
152 | for (iter = 50; iter--; ) { | 152 | for (iter = 50; iter--; ) { |
153 | stat = RD_REG_DWORD(®->u.isp2300.host_status); | 153 | stat = RD_REG_DWORD(®->u.isp2300.host_status); |
154 | if (stat & HSR_RISC_PAUSED) { | 154 | if (stat & HSR_RISC_PAUSED) { |
155 | if (pci_channel_offline(ha->pdev)) | 155 | if (unlikely(pci_channel_offline(ha->pdev))) |
156 | break; | 156 | break; |
157 | 157 | ||
158 | hccr = RD_REG_WORD(®->hccr); | 158 | hccr = RD_REG_WORD(®->hccr); |
@@ -1846,12 +1846,15 @@ qla24xx_intr_handler(int irq, void *dev_id) | |||
1846 | reg = &ha->iobase->isp24; | 1846 | reg = &ha->iobase->isp24; |
1847 | status = 0; | 1847 | status = 0; |
1848 | 1848 | ||
1849 | if (unlikely(pci_channel_offline(ha->pdev))) | ||
1850 | return IRQ_HANDLED; | ||
1851 | |||
1849 | spin_lock_irqsave(&ha->hardware_lock, flags); | 1852 | spin_lock_irqsave(&ha->hardware_lock, flags); |
1850 | vha = pci_get_drvdata(ha->pdev); | 1853 | vha = pci_get_drvdata(ha->pdev); |
1851 | for (iter = 50; iter--; ) { | 1854 | for (iter = 50; iter--; ) { |
1852 | stat = RD_REG_DWORD(®->host_status); | 1855 | stat = RD_REG_DWORD(®->host_status); |
1853 | if (stat & HSRX_RISC_PAUSED) { | 1856 | if (stat & HSRX_RISC_PAUSED) { |
1854 | if (pci_channel_offline(ha->pdev)) | 1857 | if (unlikely(pci_channel_offline(ha->pdev))) |
1855 | break; | 1858 | break; |
1856 | 1859 | ||
1857 | hccr = RD_REG_DWORD(®->hccr); | 1860 | hccr = RD_REG_DWORD(®->hccr); |
@@ -1992,7 +1995,7 @@ qla24xx_msix_default(int irq, void *dev_id) | |||
1992 | do { | 1995 | do { |
1993 | stat = RD_REG_DWORD(®->host_status); | 1996 | stat = RD_REG_DWORD(®->host_status); |
1994 | if (stat & HSRX_RISC_PAUSED) { | 1997 | if (stat & HSRX_RISC_PAUSED) { |
1995 | if (pci_channel_offline(ha->pdev)) | 1998 | if (unlikely(pci_channel_offline(ha->pdev))) |
1996 | break; | 1999 | break; |
1997 | 2000 | ||
1998 | hccr = RD_REG_DWORD(®->hccr); | 2001 | hccr = RD_REG_DWORD(®->hccr); |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 05d595d9a7ef..056e4d4505f3 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -56,6 +56,12 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
56 | 56 | ||
57 | DEBUG11(printk("%s(%ld): entered.\n", __func__, base_vha->host_no)); | 57 | DEBUG11(printk("%s(%ld): entered.\n", __func__, base_vha->host_no)); |
58 | 58 | ||
59 | if (ha->flags.pci_channel_io_perm_failure) { | ||
60 | DEBUG(printk("%s(%ld): Perm failure on EEH, timeout MBX " | ||
61 | "Exiting.\n", __func__, vha->host_no)); | ||
62 | return QLA_FUNCTION_TIMEOUT; | ||
63 | } | ||
64 | |||
59 | /* | 65 | /* |
60 | * Wait for active mailbox commands to finish by waiting at most tov | 66 | * Wait for active mailbox commands to finish by waiting at most tov |
61 | * seconds. This is to serialize actual issuing of mailbox cmds during | 67 | * seconds. This is to serialize actual issuing of mailbox cmds during |
@@ -154,10 +160,14 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
154 | /* Check for pending interrupts. */ | 160 | /* Check for pending interrupts. */ |
155 | qla2x00_poll(ha->rsp_q_map[0]); | 161 | qla2x00_poll(ha->rsp_q_map[0]); |
156 | 162 | ||
157 | if (command != MBC_LOAD_RISC_RAM_EXTENDED && | 163 | if (!ha->flags.mbox_int && |
158 | !ha->flags.mbox_int) | 164 | !(IS_QLA2200(ha) && |
165 | command == MBC_LOAD_RISC_RAM_EXTENDED)) | ||
159 | msleep(10); | 166 | msleep(10); |
160 | } /* while */ | 167 | } /* while */ |
168 | DEBUG17(qla_printk(KERN_WARNING, ha, | ||
169 | "Waited %d sec\n", | ||
170 | (uint)((jiffies - (wait_time - (mcp->tov * HZ)))/HZ))); | ||
161 | } | 171 | } |
162 | 172 | ||
163 | /* Check whether we timed out */ | 173 | /* Check whether we timed out */ |
@@ -227,7 +237,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
227 | 237 | ||
228 | if (rval == QLA_FUNCTION_TIMEOUT && | 238 | if (rval == QLA_FUNCTION_TIMEOUT && |
229 | mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) { | 239 | mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) { |
230 | if (!io_lock_on || (mcp->flags & IOCTL_CMD)) { | 240 | if (!io_lock_on || (mcp->flags & IOCTL_CMD) || |
241 | ha->flags.eeh_busy) { | ||
231 | /* not in dpc. schedule it for dpc to take over. */ | 242 | /* not in dpc. schedule it for dpc to take over. */ |
232 | DEBUG(printk("%s(%ld): timeout schedule " | 243 | DEBUG(printk("%s(%ld): timeout schedule " |
233 | "isp_abort_needed.\n", __func__, | 244 | "isp_abort_needed.\n", __func__, |
@@ -237,7 +248,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
237 | base_vha->host_no)); | 248 | base_vha->host_no)); |
238 | qla_printk(KERN_WARNING, ha, | 249 | qla_printk(KERN_WARNING, ha, |
239 | "Mailbox command timeout occurred. Scheduling ISP " | 250 | "Mailbox command timeout occurred. Scheduling ISP " |
240 | "abort.\n"); | 251 | "abort. eeh_busy: 0x%x\n", ha->flags.eeh_busy); |
241 | set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); | 252 | set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); |
242 | qla2xxx_wake_dpc(vha); | 253 | qla2xxx_wake_dpc(vha); |
243 | } else if (!abort_active) { | 254 | } else if (!abort_active) { |
@@ -2530,6 +2541,9 @@ qla2x00_enable_eft_trace(scsi_qla_host_t *vha, dma_addr_t eft_dma, | |||
2530 | if (!IS_FWI2_CAPABLE(vha->hw)) | 2541 | if (!IS_FWI2_CAPABLE(vha->hw)) |
2531 | return QLA_FUNCTION_FAILED; | 2542 | return QLA_FUNCTION_FAILED; |
2532 | 2543 | ||
2544 | if (unlikely(pci_channel_offline(vha->hw->pdev))) | ||
2545 | return QLA_FUNCTION_FAILED; | ||
2546 | |||
2533 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); | 2547 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2534 | 2548 | ||
2535 | mcp->mb[0] = MBC_TRACE_CONTROL; | 2549 | mcp->mb[0] = MBC_TRACE_CONTROL; |
@@ -2565,6 +2579,9 @@ qla2x00_disable_eft_trace(scsi_qla_host_t *vha) | |||
2565 | if (!IS_FWI2_CAPABLE(vha->hw)) | 2579 | if (!IS_FWI2_CAPABLE(vha->hw)) |
2566 | return QLA_FUNCTION_FAILED; | 2580 | return QLA_FUNCTION_FAILED; |
2567 | 2581 | ||
2582 | if (unlikely(pci_channel_offline(vha->hw->pdev))) | ||
2583 | return QLA_FUNCTION_FAILED; | ||
2584 | |||
2568 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); | 2585 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2569 | 2586 | ||
2570 | mcp->mb[0] = MBC_TRACE_CONTROL; | 2587 | mcp->mb[0] = MBC_TRACE_CONTROL; |
@@ -2595,6 +2612,9 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *vha, dma_addr_t fce_dma, | |||
2595 | if (!IS_QLA25XX(vha->hw) && !IS_QLA81XX(vha->hw)) | 2612 | if (!IS_QLA25XX(vha->hw) && !IS_QLA81XX(vha->hw)) |
2596 | return QLA_FUNCTION_FAILED; | 2613 | return QLA_FUNCTION_FAILED; |
2597 | 2614 | ||
2615 | if (unlikely(pci_channel_offline(vha->hw->pdev))) | ||
2616 | return QLA_FUNCTION_FAILED; | ||
2617 | |||
2598 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); | 2618 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2599 | 2619 | ||
2600 | mcp->mb[0] = MBC_TRACE_CONTROL; | 2620 | mcp->mb[0] = MBC_TRACE_CONTROL; |
@@ -2639,6 +2659,9 @@ qla2x00_disable_fce_trace(scsi_qla_host_t *vha, uint64_t *wr, uint64_t *rd) | |||
2639 | if (!IS_FWI2_CAPABLE(vha->hw)) | 2659 | if (!IS_FWI2_CAPABLE(vha->hw)) |
2640 | return QLA_FUNCTION_FAILED; | 2660 | return QLA_FUNCTION_FAILED; |
2641 | 2661 | ||
2662 | if (unlikely(pci_channel_offline(vha->hw->pdev))) | ||
2663 | return QLA_FUNCTION_FAILED; | ||
2664 | |||
2642 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); | 2665 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); |
2643 | 2666 | ||
2644 | mcp->mb[0] = MBC_TRACE_CONTROL; | 2667 | mcp->mb[0] = MBC_TRACE_CONTROL; |
@@ -3643,3 +3666,36 @@ qla2x00_write_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t data) | |||
3643 | 3666 | ||
3644 | return rval; | 3667 | return rval; |
3645 | } | 3668 | } |
3669 | |||
3670 | int | ||
3671 | qla2x00_get_data_rate(scsi_qla_host_t *vha) | ||
3672 | { | ||
3673 | int rval; | ||
3674 | mbx_cmd_t mc; | ||
3675 | mbx_cmd_t *mcp = &mc; | ||
3676 | struct qla_hw_data *ha = vha->hw; | ||
3677 | |||
3678 | if (!IS_FWI2_CAPABLE(ha)) | ||
3679 | return QLA_FUNCTION_FAILED; | ||
3680 | |||
3681 | DEBUG11(printk(KERN_INFO "%s(%ld): entered.\n", __func__, vha->host_no)); | ||
3682 | |||
3683 | mcp->mb[0] = MBC_DATA_RATE; | ||
3684 | mcp->mb[1] = 0; | ||
3685 | mcp->out_mb = MBX_1|MBX_0; | ||
3686 | mcp->in_mb = MBX_2|MBX_1|MBX_0; | ||
3687 | mcp->tov = MBX_TOV_SECONDS; | ||
3688 | mcp->flags = 0; | ||
3689 | rval = qla2x00_mailbox_command(vha, mcp); | ||
3690 | if (rval != QLA_SUCCESS) { | ||
3691 | DEBUG2_3_11(printk(KERN_INFO "%s(%ld): failed=%x mb[0]=%x.\n", | ||
3692 | __func__, vha->host_no, rval, mcp->mb[0])); | ||
3693 | } else { | ||
3694 | DEBUG11(printk(KERN_INFO | ||
3695 | "%s(%ld): done.\n", __func__, vha->host_no)); | ||
3696 | if (mcp->mb[1] != 0x7) | ||
3697 | ha->link_data_rate = mcp->mb[1]; | ||
3698 | } | ||
3699 | |||
3700 | return rval; | ||
3701 | } | ||
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 2a4c7f4e7b69..b901aa267e7d 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -639,8 +639,10 @@ static void qla_do_work(struct work_struct *work) | |||
639 | struct rsp_que *rsp = container_of(work, struct rsp_que, q_work); | 639 | struct rsp_que *rsp = container_of(work, struct rsp_que, q_work); |
640 | struct scsi_qla_host *vha; | 640 | struct scsi_qla_host *vha; |
641 | 641 | ||
642 | spin_lock_irq(&rsp->hw->hardware_lock); | ||
642 | vha = qla25xx_get_host(rsp); | 643 | vha = qla25xx_get_host(rsp); |
643 | qla24xx_process_response_queue(vha, rsp); | 644 | qla24xx_process_response_queue(vha, rsp); |
645 | spin_unlock_irq(&rsp->hw->hardware_lock); | ||
644 | } | 646 | } |
645 | 647 | ||
646 | /* create response queue */ | 648 | /* create response queue */ |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 2f873d237325..209f50e788a1 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -475,11 +475,11 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
475 | srb_t *sp; | 475 | srb_t *sp; |
476 | int rval; | 476 | int rval; |
477 | 477 | ||
478 | if (unlikely(pci_channel_offline(ha->pdev))) { | 478 | if (ha->flags.eeh_busy) { |
479 | if (ha->pdev->error_state == pci_channel_io_frozen) | 479 | if (ha->flags.pci_channel_io_perm_failure) |
480 | cmd->result = DID_REQUEUE << 16; | ||
481 | else | ||
482 | cmd->result = DID_NO_CONNECT << 16; | 480 | cmd->result = DID_NO_CONNECT << 16; |
481 | else | ||
482 | cmd->result = DID_REQUEUE << 16; | ||
483 | goto qc24_fail_command; | 483 | goto qc24_fail_command; |
484 | } | 484 | } |
485 | 485 | ||
@@ -552,8 +552,15 @@ qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd) | |||
552 | #define ABORT_POLLING_PERIOD 1000 | 552 | #define ABORT_POLLING_PERIOD 1000 |
553 | #define ABORT_WAIT_ITER ((10 * 1000) / (ABORT_POLLING_PERIOD)) | 553 | #define ABORT_WAIT_ITER ((10 * 1000) / (ABORT_POLLING_PERIOD)) |
554 | unsigned long wait_iter = ABORT_WAIT_ITER; | 554 | unsigned long wait_iter = ABORT_WAIT_ITER; |
555 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); | ||
556 | struct qla_hw_data *ha = vha->hw; | ||
555 | int ret = QLA_SUCCESS; | 557 | int ret = QLA_SUCCESS; |
556 | 558 | ||
559 | if (unlikely(pci_channel_offline(ha->pdev)) || ha->flags.eeh_busy) { | ||
560 | DEBUG17(qla_printk(KERN_WARNING, ha, "return:eh_wait\n")); | ||
561 | return ret; | ||
562 | } | ||
563 | |||
557 | while (CMD_SP(cmd) && wait_iter--) { | 564 | while (CMD_SP(cmd) && wait_iter--) { |
558 | msleep(ABORT_POLLING_PERIOD); | 565 | msleep(ABORT_POLLING_PERIOD); |
559 | } | 566 | } |
@@ -1810,6 +1817,13 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1810 | 1817 | ||
1811 | /* Set ISP-type information. */ | 1818 | /* Set ISP-type information. */ |
1812 | qla2x00_set_isp_flags(ha); | 1819 | qla2x00_set_isp_flags(ha); |
1820 | |||
1821 | /* Set EEH reset type to fundamental if required by hba */ | ||
1822 | if ( IS_QLA24XX(ha) || IS_QLA25XX(ha) || IS_QLA81XX(ha)) { | ||
1823 | pdev->needs_freset = 1; | ||
1824 | pci_save_state(pdev); | ||
1825 | } | ||
1826 | |||
1813 | /* Configure PCI I/O space */ | 1827 | /* Configure PCI I/O space */ |
1814 | ret = qla2x00_iospace_config(ha); | 1828 | ret = qla2x00_iospace_config(ha); |
1815 | if (ret) | 1829 | if (ret) |
@@ -2174,6 +2188,24 @@ qla2x00_free_device(scsi_qla_host_t *vha) | |||
2174 | { | 2188 | { |
2175 | struct qla_hw_data *ha = vha->hw; | 2189 | struct qla_hw_data *ha = vha->hw; |
2176 | 2190 | ||
2191 | qla2x00_abort_all_cmds(vha, DID_NO_CONNECT << 16); | ||
2192 | |||
2193 | /* Disable timer */ | ||
2194 | if (vha->timer_active) | ||
2195 | qla2x00_stop_timer(vha); | ||
2196 | |||
2197 | /* Kill the kernel thread for this host */ | ||
2198 | if (ha->dpc_thread) { | ||
2199 | struct task_struct *t = ha->dpc_thread; | ||
2200 | |||
2201 | /* | ||
2202 | * qla2xxx_wake_dpc checks for ->dpc_thread | ||
2203 | * so we need to zero it out. | ||
2204 | */ | ||
2205 | ha->dpc_thread = NULL; | ||
2206 | kthread_stop(t); | ||
2207 | } | ||
2208 | |||
2177 | qla25xx_delete_queues(vha); | 2209 | qla25xx_delete_queues(vha); |
2178 | 2210 | ||
2179 | if (ha->flags.fce_enabled) | 2211 | if (ha->flags.fce_enabled) |
@@ -2185,6 +2217,8 @@ qla2x00_free_device(scsi_qla_host_t *vha) | |||
2185 | /* Stop currently executing firmware. */ | 2217 | /* Stop currently executing firmware. */ |
2186 | qla2x00_try_to_stop_firmware(vha); | 2218 | qla2x00_try_to_stop_firmware(vha); |
2187 | 2219 | ||
2220 | vha->flags.online = 0; | ||
2221 | |||
2188 | /* turn-off interrupts on the card */ | 2222 | /* turn-off interrupts on the card */ |
2189 | if (ha->interrupts_on) | 2223 | if (ha->interrupts_on) |
2190 | ha->isp_ops->disable_intrs(ha); | 2224 | ha->isp_ops->disable_intrs(ha); |
@@ -2859,6 +2893,13 @@ qla2x00_do_dpc(void *data) | |||
2859 | if (!base_vha->flags.init_done) | 2893 | if (!base_vha->flags.init_done) |
2860 | continue; | 2894 | continue; |
2861 | 2895 | ||
2896 | if (ha->flags.eeh_busy) { | ||
2897 | DEBUG17(qla_printk(KERN_WARNING, ha, | ||
2898 | "qla2x00_do_dpc: dpc_flags: %lx\n", | ||
2899 | base_vha->dpc_flags)); | ||
2900 | continue; | ||
2901 | } | ||
2902 | |||
2862 | DEBUG3(printk("scsi(%ld): DPC handler\n", base_vha->host_no)); | 2903 | DEBUG3(printk("scsi(%ld): DPC handler\n", base_vha->host_no)); |
2863 | 2904 | ||
2864 | ha->dpc_active = 1; | 2905 | ha->dpc_active = 1; |
@@ -3049,8 +3090,13 @@ qla2x00_timer(scsi_qla_host_t *vha) | |||
3049 | int index; | 3090 | int index; |
3050 | srb_t *sp; | 3091 | srb_t *sp; |
3051 | int t; | 3092 | int t; |
3093 | uint16_t w; | ||
3052 | struct qla_hw_data *ha = vha->hw; | 3094 | struct qla_hw_data *ha = vha->hw; |
3053 | struct req_que *req; | 3095 | struct req_que *req; |
3096 | |||
3097 | /* Hardware read to raise pending EEH errors during mailbox waits. */ | ||
3098 | if (!pci_channel_offline(ha->pdev)) | ||
3099 | pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); | ||
3054 | /* | 3100 | /* |
3055 | * Ports - Port down timer. | 3101 | * Ports - Port down timer. |
3056 | * | 3102 | * |
@@ -3252,16 +3298,23 @@ qla2x00_release_firmware(void) | |||
3252 | static pci_ers_result_t | 3298 | static pci_ers_result_t |
3253 | qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) | 3299 | qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) |
3254 | { | 3300 | { |
3255 | scsi_qla_host_t *base_vha = pci_get_drvdata(pdev); | 3301 | scsi_qla_host_t *vha = pci_get_drvdata(pdev); |
3302 | struct qla_hw_data *ha = vha->hw; | ||
3303 | |||
3304 | DEBUG2(qla_printk(KERN_WARNING, ha, "error_detected:state %x\n", | ||
3305 | state)); | ||
3256 | 3306 | ||
3257 | switch (state) { | 3307 | switch (state) { |
3258 | case pci_channel_io_normal: | 3308 | case pci_channel_io_normal: |
3309 | ha->flags.eeh_busy = 0; | ||
3259 | return PCI_ERS_RESULT_CAN_RECOVER; | 3310 | return PCI_ERS_RESULT_CAN_RECOVER; |
3260 | case pci_channel_io_frozen: | 3311 | case pci_channel_io_frozen: |
3312 | ha->flags.eeh_busy = 1; | ||
3261 | pci_disable_device(pdev); | 3313 | pci_disable_device(pdev); |
3262 | return PCI_ERS_RESULT_NEED_RESET; | 3314 | return PCI_ERS_RESULT_NEED_RESET; |
3263 | case pci_channel_io_perm_failure: | 3315 | case pci_channel_io_perm_failure: |
3264 | qla2x00_abort_all_cmds(base_vha, DID_NO_CONNECT << 16); | 3316 | ha->flags.pci_channel_io_perm_failure = 1; |
3317 | qla2x00_abort_all_cmds(vha, DID_NO_CONNECT << 16); | ||
3265 | return PCI_ERS_RESULT_DISCONNECT; | 3318 | return PCI_ERS_RESULT_DISCONNECT; |
3266 | } | 3319 | } |
3267 | return PCI_ERS_RESULT_NEED_RESET; | 3320 | return PCI_ERS_RESULT_NEED_RESET; |
@@ -3312,6 +3365,8 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev) | |||
3312 | struct qla_hw_data *ha = base_vha->hw; | 3365 | struct qla_hw_data *ha = base_vha->hw; |
3313 | int rc; | 3366 | int rc; |
3314 | 3367 | ||
3368 | DEBUG17(qla_printk(KERN_WARNING, ha, "slot_reset\n")); | ||
3369 | |||
3315 | if (ha->mem_only) | 3370 | if (ha->mem_only) |
3316 | rc = pci_enable_device_mem(pdev); | 3371 | rc = pci_enable_device_mem(pdev); |
3317 | else | 3372 | else |
@@ -3320,19 +3375,33 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev) | |||
3320 | if (rc) { | 3375 | if (rc) { |
3321 | qla_printk(KERN_WARNING, ha, | 3376 | qla_printk(KERN_WARNING, ha, |
3322 | "Can't re-enable PCI device after reset.\n"); | 3377 | "Can't re-enable PCI device after reset.\n"); |
3323 | |||
3324 | return ret; | 3378 | return ret; |
3325 | } | 3379 | } |
3326 | pci_set_master(pdev); | ||
3327 | 3380 | ||
3328 | if (ha->isp_ops->pci_config(base_vha)) | 3381 | if (ha->isp_ops->pci_config(base_vha)) |
3329 | return ret; | 3382 | return ret; |
3330 | 3383 | ||
3384 | #ifdef QL_DEBUG_LEVEL_17 | ||
3385 | { | ||
3386 | uint8_t b; | ||
3387 | uint32_t i; | ||
3388 | |||
3389 | printk("slot_reset_1: "); | ||
3390 | for (i = 0; i < 256; i++) { | ||
3391 | pci_read_config_byte(ha->pdev, i, &b); | ||
3392 | printk("%s%02x", (i%16) ? " " : "\n", b); | ||
3393 | } | ||
3394 | printk("\n"); | ||
3395 | } | ||
3396 | #endif | ||
3331 | set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); | 3397 | set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); |
3332 | if (qla2x00_abort_isp(base_vha) == QLA_SUCCESS) | 3398 | if (qla2x00_abort_isp(base_vha) == QLA_SUCCESS) |
3333 | ret = PCI_ERS_RESULT_RECOVERED; | 3399 | ret = PCI_ERS_RESULT_RECOVERED; |
3334 | clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); | 3400 | clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); |
3335 | 3401 | ||
3402 | DEBUG17(qla_printk(KERN_WARNING, ha, | ||
3403 | "slot_reset-return:ret=%x\n", ret)); | ||
3404 | |||
3336 | return ret; | 3405 | return ret; |
3337 | } | 3406 | } |
3338 | 3407 | ||
@@ -3343,12 +3412,17 @@ qla2xxx_pci_resume(struct pci_dev *pdev) | |||
3343 | struct qla_hw_data *ha = base_vha->hw; | 3412 | struct qla_hw_data *ha = base_vha->hw; |
3344 | int ret; | 3413 | int ret; |
3345 | 3414 | ||
3415 | DEBUG17(qla_printk(KERN_WARNING, ha, "pci_resume\n")); | ||
3416 | |||
3346 | ret = qla2x00_wait_for_hba_online(base_vha); | 3417 | ret = qla2x00_wait_for_hba_online(base_vha); |
3347 | if (ret != QLA_SUCCESS) { | 3418 | if (ret != QLA_SUCCESS) { |
3348 | qla_printk(KERN_ERR, ha, | 3419 | qla_printk(KERN_ERR, ha, |
3349 | "the device failed to resume I/O " | 3420 | "the device failed to resume I/O " |
3350 | "from slot/link_reset"); | 3421 | "from slot/link_reset"); |
3351 | } | 3422 | } |
3423 | |||
3424 | ha->flags.eeh_busy = 0; | ||
3425 | |||
3352 | pci_cleanup_aer_uncorrect_error_status(pdev); | 3426 | pci_cleanup_aer_uncorrect_error_status(pdev); |
3353 | } | 3427 | } |
3354 | 3428 | ||
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index c482220f7eed..a65dd95507c6 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
@@ -7,7 +7,7 @@ | |||
7 | /* | 7 | /* |
8 | * Driver version | 8 | * Driver version |
9 | */ | 9 | */ |
10 | #define QLA2XXX_VERSION "8.03.01-k8" | 10 | #define QLA2XXX_VERSION "8.03.01-k9" |
11 | 11 | ||
12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
13 | #define QLA_DRIVER_MINOR_VER 3 | 13 | #define QLA_DRIVER_MINOR_VER 3 |
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 3058bb1aff95..fd7b15be7640 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c | |||
@@ -623,6 +623,11 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
623 | } | 623 | } |
624 | break; | 624 | break; |
625 | case INQUIRY: | 625 | case INQUIRY: |
626 | if (lun >= host->max_lun) { | ||
627 | cmd->result = DID_NO_CONNECT << 16; | ||
628 | done(cmd); | ||
629 | return 0; | ||
630 | } | ||
626 | if (id != host->max_id - 1) | 631 | if (id != host->max_id - 1) |
627 | break; | 632 | break; |
628 | if (!lun && !cmd->device->channel && | 633 | if (!lun && !cmd->device->channel && |
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c index 409ca9643528..a3a7f8938175 100644 --- a/drivers/video/backlight/omap1_bl.c +++ b/drivers/video/backlight/omap1_bl.c | |||
@@ -139,8 +139,6 @@ static int omapbl_probe(struct platform_device *pdev) | |||
139 | if (!pdata) | 139 | if (!pdata) |
140 | return -ENXIO; | 140 | return -ENXIO; |
141 | 141 | ||
142 | omapbl_ops.check_fb = pdata->check_fb; | ||
143 | |||
144 | bl = kzalloc(sizeof(struct omap_backlight), GFP_KERNEL); | 142 | bl = kzalloc(sizeof(struct omap_backlight), GFP_KERNEL); |
145 | if (unlikely(!bl)) | 143 | if (unlikely(!bl)) |
146 | return -ENOMEM; | 144 | return -ENOMEM; |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 415858b421b3..825b665245bb 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -1221,9 +1221,9 @@ static void setup_smart_timing(struct pxafb_info *fbi, | |||
1221 | static int pxafb_smart_thread(void *arg) | 1221 | static int pxafb_smart_thread(void *arg) |
1222 | { | 1222 | { |
1223 | struct pxafb_info *fbi = arg; | 1223 | struct pxafb_info *fbi = arg; |
1224 | struct pxafb_mach_info *inf; | 1224 | struct pxafb_mach_info *inf = fbi->dev->platform_data; |
1225 | 1225 | ||
1226 | if (!fbi || !fbi->dev->platform_data->smart_update) { | 1226 | if (!inf->smart_update) { |
1227 | pr_err("%s: not properly initialized, thread terminated\n", | 1227 | pr_err("%s: not properly initialized, thread terminated\n", |
1228 | __func__); | 1228 | __func__); |
1229 | return -EINVAL; | 1229 | return -EINVAL; |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 7dc85997e96c..c57d9ce5ff7e 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -171,6 +171,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, | |||
171 | #ifdef ELF_FDPIC_PLAT_INIT | 171 | #ifdef ELF_FDPIC_PLAT_INIT |
172 | unsigned long dynaddr; | 172 | unsigned long dynaddr; |
173 | #endif | 173 | #endif |
174 | #ifndef CONFIG_MMU | ||
175 | unsigned long stack_prot; | ||
176 | #endif | ||
174 | struct file *interpreter = NULL; /* to shut gcc up */ | 177 | struct file *interpreter = NULL; /* to shut gcc up */ |
175 | char *interpreter_name = NULL; | 178 | char *interpreter_name = NULL; |
176 | int executable_stack; | 179 | int executable_stack; |
@@ -316,6 +319,8 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, | |||
316 | * defunct, deceased, etc. after this point we have to exit via | 319 | * defunct, deceased, etc. after this point we have to exit via |
317 | * error_kill */ | 320 | * error_kill */ |
318 | set_personality(PER_LINUX_FDPIC); | 321 | set_personality(PER_LINUX_FDPIC); |
322 | if (elf_read_implies_exec(&exec_params.hdr, executable_stack)) | ||
323 | current->personality |= READ_IMPLIES_EXEC; | ||
319 | set_binfmt(&elf_fdpic_format); | 324 | set_binfmt(&elf_fdpic_format); |
320 | 325 | ||
321 | current->mm->start_code = 0; | 326 | current->mm->start_code = 0; |
@@ -377,9 +382,13 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, | |||
377 | if (stack_size < PAGE_SIZE * 2) | 382 | if (stack_size < PAGE_SIZE * 2) |
378 | stack_size = PAGE_SIZE * 2; | 383 | stack_size = PAGE_SIZE * 2; |
379 | 384 | ||
385 | stack_prot = PROT_READ | PROT_WRITE; | ||
386 | if (executable_stack == EXSTACK_ENABLE_X || | ||
387 | (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC)) | ||
388 | stack_prot |= PROT_EXEC; | ||
389 | |||
380 | down_write(¤t->mm->mmap_sem); | 390 | down_write(¤t->mm->mmap_sem); |
381 | current->mm->start_brk = do_mmap(NULL, 0, stack_size, | 391 | current->mm->start_brk = do_mmap(NULL, 0, stack_size, stack_prot, |
382 | PROT_READ | PROT_WRITE | PROT_EXEC, | ||
383 | MAP_PRIVATE | MAP_ANONYMOUS | | 392 | MAP_PRIVATE | MAP_ANONYMOUS | |
384 | MAP_UNINITIALIZED | MAP_GROWSDOWN, | 393 | MAP_UNINITIALIZED | MAP_GROWSDOWN, |
385 | 0); | 394 | 0); |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 094ea65afc85..7b2600b380d7 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -5,7 +5,9 @@ have duplicated data). Fix oops in cifs_lookup. Workaround problem | |||
5 | mounting to OS/400 Netserve. Fix oops in cifs_get_tcp_session. | 5 | mounting to OS/400 Netserve. Fix oops in cifs_get_tcp_session. |
6 | Disable use of server inode numbers when server only | 6 | Disable use of server inode numbers when server only |
7 | partially supports them (e.g. for one server querying inode numbers on | 7 | partially supports them (e.g. for one server querying inode numbers on |
8 | FindFirst fails but QPathInfo queries works). | 8 | FindFirst fails but QPathInfo queries works). Fix oops with dfs in |
9 | cifs_put_smb_ses. Fix mmap to work on directio mounts (needed | ||
10 | for OpenOffice when on forcedirectio mount e.g.) | ||
9 | 11 | ||
10 | Version 1.60 | 12 | Version 1.60 |
11 | ------------- | 13 | ------------- |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 29f1da761bbf..8c6a03627176 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -758,7 +758,7 @@ const struct file_operations cifs_file_ops = { | |||
758 | }; | 758 | }; |
759 | 759 | ||
760 | const struct file_operations cifs_file_direct_ops = { | 760 | const struct file_operations cifs_file_direct_ops = { |
761 | /* no mmap, no aio, no readv - | 761 | /* no aio, no readv - |
762 | BB reevaluate whether they can be done with directio, no cache */ | 762 | BB reevaluate whether they can be done with directio, no cache */ |
763 | .read = cifs_user_read, | 763 | .read = cifs_user_read, |
764 | .write = cifs_user_write, | 764 | .write = cifs_user_write, |
@@ -767,6 +767,7 @@ const struct file_operations cifs_file_direct_ops = { | |||
767 | .lock = cifs_lock, | 767 | .lock = cifs_lock, |
768 | .fsync = cifs_fsync, | 768 | .fsync = cifs_fsync, |
769 | .flush = cifs_flush, | 769 | .flush = cifs_flush, |
770 | .mmap = cifs_file_mmap, | ||
770 | .splice_read = generic_file_splice_read, | 771 | .splice_read = generic_file_splice_read, |
771 | #ifdef CONFIG_CIFS_POSIX | 772 | #ifdef CONFIG_CIFS_POSIX |
772 | .unlocked_ioctl = cifs_ioctl, | 773 | .unlocked_ioctl = cifs_ioctl, |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 63ea83ff687f..3bbcaa716b3c 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2287,12 +2287,12 @@ int | |||
2287 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | 2287 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, |
2288 | char *mount_data_global, const char *devname) | 2288 | char *mount_data_global, const char *devname) |
2289 | { | 2289 | { |
2290 | int rc = 0; | 2290 | int rc; |
2291 | int xid; | 2291 | int xid; |
2292 | struct smb_vol *volume_info; | 2292 | struct smb_vol *volume_info; |
2293 | struct cifsSesInfo *pSesInfo = NULL; | 2293 | struct cifsSesInfo *pSesInfo; |
2294 | struct cifsTconInfo *tcon = NULL; | 2294 | struct cifsTconInfo *tcon; |
2295 | struct TCP_Server_Info *srvTcp = NULL; | 2295 | struct TCP_Server_Info *srvTcp; |
2296 | char *full_path; | 2296 | char *full_path; |
2297 | char *mount_data = mount_data_global; | 2297 | char *mount_data = mount_data_global; |
2298 | #ifdef CONFIG_CIFS_DFS_UPCALL | 2298 | #ifdef CONFIG_CIFS_DFS_UPCALL |
@@ -2301,6 +2301,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2301 | int referral_walks_count = 0; | 2301 | int referral_walks_count = 0; |
2302 | try_mount_again: | 2302 | try_mount_again: |
2303 | #endif | 2303 | #endif |
2304 | rc = 0; | ||
2305 | tcon = NULL; | ||
2306 | pSesInfo = NULL; | ||
2307 | srvTcp = NULL; | ||
2304 | full_path = NULL; | 2308 | full_path = NULL; |
2305 | 2309 | ||
2306 | xid = GetXid(); | 2310 | xid = GetXid(); |
@@ -2597,6 +2601,7 @@ remote_path_check: | |||
2597 | 2601 | ||
2598 | cleanup_volume_info(&volume_info); | 2602 | cleanup_volume_info(&volume_info); |
2599 | referral_walks_count++; | 2603 | referral_walks_count++; |
2604 | FreeXid(xid); | ||
2600 | goto try_mount_again; | 2605 | goto try_mount_again; |
2601 | } | 2606 | } |
2602 | #else /* No DFS support, return error on mount */ | 2607 | #else /* No DFS support, return error on mount */ |
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c index 698a8636d39c..2afbcebeda71 100644 --- a/fs/exofs/inode.c +++ b/fs/exofs/inode.c | |||
@@ -738,13 +738,28 @@ static int exofs_write_begin_export(struct file *file, | |||
738 | fsdata); | 738 | fsdata); |
739 | } | 739 | } |
740 | 740 | ||
741 | static int exofs_write_end(struct file *file, struct address_space *mapping, | ||
742 | loff_t pos, unsigned len, unsigned copied, | ||
743 | struct page *page, void *fsdata) | ||
744 | { | ||
745 | struct inode *inode = mapping->host; | ||
746 | /* According to comment in simple_write_end i_mutex is held */ | ||
747 | loff_t i_size = inode->i_size; | ||
748 | int ret; | ||
749 | |||
750 | ret = simple_write_end(file, mapping,pos, len, copied, page, fsdata); | ||
751 | if (i_size != inode->i_size) | ||
752 | mark_inode_dirty(inode); | ||
753 | return ret; | ||
754 | } | ||
755 | |||
741 | const struct address_space_operations exofs_aops = { | 756 | const struct address_space_operations exofs_aops = { |
742 | .readpage = exofs_readpage, | 757 | .readpage = exofs_readpage, |
743 | .readpages = exofs_readpages, | 758 | .readpages = exofs_readpages, |
744 | .writepage = exofs_writepage, | 759 | .writepage = exofs_writepage, |
745 | .writepages = exofs_writepages, | 760 | .writepages = exofs_writepages, |
746 | .write_begin = exofs_write_begin_export, | 761 | .write_begin = exofs_write_begin_export, |
747 | .write_end = simple_write_end, | 762 | .write_end = exofs_write_end, |
748 | }; | 763 | }; |
749 | 764 | ||
750 | /****************************************************************************** | 765 | /****************************************************************************** |
diff --git a/fs/exofs/pnfs.h b/fs/exofs/pnfs.h index 423033addd1f..c52e9888b8ab 100644 --- a/fs/exofs/pnfs.h +++ b/fs/exofs/pnfs.h | |||
@@ -15,13 +15,7 @@ | |||
15 | #ifndef __EXOFS_PNFS_H__ | 15 | #ifndef __EXOFS_PNFS_H__ |
16 | #define __EXOFS_PNFS_H__ | 16 | #define __EXOFS_PNFS_H__ |
17 | 17 | ||
18 | #if defined(CONFIG_PNFS) | 18 | #if ! defined(__PNFS_OSD_XDR_H__) |
19 | |||
20 | |||
21 | /* FIXME: move this file to: linux/exportfs/pnfs_osd_xdr.h */ | ||
22 | #include "../nfs/objlayout/pnfs_osd_xdr.h" | ||
23 | |||
24 | #else /* defined(CONFIG_PNFS) */ | ||
25 | 19 | ||
26 | enum pnfs_iomode { | 20 | enum pnfs_iomode { |
27 | IOMODE_READ = 1, | 21 | IOMODE_READ = 1, |
@@ -46,6 +40,6 @@ struct pnfs_osd_data_map { | |||
46 | u32 odm_raid_algorithm; | 40 | u32 odm_raid_algorithm; |
47 | }; | 41 | }; |
48 | 42 | ||
49 | #endif /* else defined(CONFIG_PNFS) */ | 43 | #endif /* ! defined(__PNFS_OSD_XDR_H__) */ |
50 | 44 | ||
51 | #endif /* __EXOFS_PNFS_H__ */ | 45 | #endif /* __EXOFS_PNFS_H__ */ |
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig index 9acf7e808139..9ed1bb1f319f 100644 --- a/fs/ext4/Kconfig +++ b/fs/ext4/Kconfig | |||
@@ -28,6 +28,7 @@ config EXT4_FS | |||
28 | 28 | ||
29 | config EXT4_USE_FOR_EXT23 | 29 | config EXT4_USE_FOR_EXT23 |
30 | bool "Use ext4 for ext2/ext3 file systems" | 30 | bool "Use ext4 for ext2/ext3 file systems" |
31 | depends on EXT4_FS | ||
31 | depends on EXT3_FS=n || EXT2_FS=n | 32 | depends on EXT3_FS=n || EXT2_FS=n |
32 | default y | 33 | default y |
33 | help | 34 | help |
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 4df8621ec31c..a60ab9aad57d 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/swap.h> | 17 | #include <linux/swap.h> |
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/version.h> | ||
20 | #include <linux/blkdev.h> | 19 | #include <linux/blkdev.h> |
21 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
22 | #include "ext4.h" | 21 | #include "ext4.h" |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 56f9271ee8cc..af7b62699ea9 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -699,6 +699,8 @@ struct ext4_inode_info { | |||
699 | unsigned int i_reserved_meta_blocks; | 699 | unsigned int i_reserved_meta_blocks; |
700 | unsigned int i_allocated_meta_blocks; | 700 | unsigned int i_allocated_meta_blocks; |
701 | unsigned short i_delalloc_reserved_flag; | 701 | unsigned short i_delalloc_reserved_flag; |
702 | sector_t i_da_metadata_calc_last_lblock; | ||
703 | int i_da_metadata_calc_len; | ||
702 | 704 | ||
703 | /* on-disk additional length */ | 705 | /* on-disk additional length */ |
704 | __u16 i_extra_isize; | 706 | __u16 i_extra_isize; |
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h index 2ca686454e87..bdb6ce7e2eb4 100644 --- a/fs/ext4/ext4_extents.h +++ b/fs/ext4/ext4_extents.h | |||
@@ -225,7 +225,8 @@ static inline void ext4_ext_mark_initialized(struct ext4_extent *ext) | |||
225 | ext->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ext)); | 225 | ext->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ext)); |
226 | } | 226 | } |
227 | 227 | ||
228 | extern int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks); | 228 | extern int ext4_ext_calc_metadata_amount(struct inode *inode, |
229 | sector_t lblocks); | ||
229 | extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex); | 230 | extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex); |
230 | extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *); | 231 | extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *); |
231 | extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t); | 232 | extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t); |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 3a7928f825e4..7d7b74e94687 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -296,29 +296,44 @@ static inline int ext4_ext_space_root_idx(struct inode *inode, int check) | |||
296 | * to allocate @blocks | 296 | * to allocate @blocks |
297 | * Worse case is one block per extent | 297 | * Worse case is one block per extent |
298 | */ | 298 | */ |
299 | int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks) | 299 | int ext4_ext_calc_metadata_amount(struct inode *inode, sector_t lblock) |
300 | { | 300 | { |
301 | int lcap, icap, rcap, leafs, idxs, num; | 301 | struct ext4_inode_info *ei = EXT4_I(inode); |
302 | int newextents = blocks; | 302 | int idxs, num = 0; |
303 | |||
304 | rcap = ext4_ext_space_root_idx(inode, 0); | ||
305 | lcap = ext4_ext_space_block(inode, 0); | ||
306 | icap = ext4_ext_space_block_idx(inode, 0); | ||
307 | 303 | ||
308 | /* number of new leaf blocks needed */ | 304 | idxs = ((inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header)) |
309 | num = leafs = (newextents + lcap - 1) / lcap; | 305 | / sizeof(struct ext4_extent_idx)); |
310 | 306 | ||
311 | /* | 307 | /* |
312 | * Worse case, we need separate index block(s) | 308 | * If the new delayed allocation block is contiguous with the |
313 | * to link all new leaf blocks | 309 | * previous da block, it can share index blocks with the |
310 | * previous block, so we only need to allocate a new index | ||
311 | * block every idxs leaf blocks. At ldxs**2 blocks, we need | ||
312 | * an additional index block, and at ldxs**3 blocks, yet | ||
313 | * another index blocks. | ||
314 | */ | 314 | */ |
315 | idxs = (leafs + icap - 1) / icap; | 315 | if (ei->i_da_metadata_calc_len && |
316 | do { | 316 | ei->i_da_metadata_calc_last_lblock+1 == lblock) { |
317 | num += idxs; | 317 | if ((ei->i_da_metadata_calc_len % idxs) == 0) |
318 | idxs = (idxs + icap - 1) / icap; | 318 | num++; |
319 | } while (idxs > rcap); | 319 | if ((ei->i_da_metadata_calc_len % (idxs*idxs)) == 0) |
320 | num++; | ||
321 | if ((ei->i_da_metadata_calc_len % (idxs*idxs*idxs)) == 0) { | ||
322 | num++; | ||
323 | ei->i_da_metadata_calc_len = 0; | ||
324 | } else | ||
325 | ei->i_da_metadata_calc_len++; | ||
326 | ei->i_da_metadata_calc_last_lblock++; | ||
327 | return num; | ||
328 | } | ||
320 | 329 | ||
321 | return num; | 330 | /* |
331 | * In the worst case we need a new set of index blocks at | ||
332 | * every level of the inode's extent tree. | ||
333 | */ | ||
334 | ei->i_da_metadata_calc_len = 1; | ||
335 | ei->i_da_metadata_calc_last_lblock = lblock; | ||
336 | return ext_depth(inode) + 1; | ||
322 | } | 337 | } |
323 | 338 | ||
324 | static int | 339 | static int |
@@ -3023,6 +3038,14 @@ out: | |||
3023 | return err; | 3038 | return err; |
3024 | } | 3039 | } |
3025 | 3040 | ||
3041 | static void unmap_underlying_metadata_blocks(struct block_device *bdev, | ||
3042 | sector_t block, int count) | ||
3043 | { | ||
3044 | int i; | ||
3045 | for (i = 0; i < count; i++) | ||
3046 | unmap_underlying_metadata(bdev, block + i); | ||
3047 | } | ||
3048 | |||
3026 | static int | 3049 | static int |
3027 | ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | 3050 | ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, |
3028 | ext4_lblk_t iblock, unsigned int max_blocks, | 3051 | ext4_lblk_t iblock, unsigned int max_blocks, |
@@ -3098,6 +3121,18 @@ out: | |||
3098 | } else | 3121 | } else |
3099 | allocated = ret; | 3122 | allocated = ret; |
3100 | set_buffer_new(bh_result); | 3123 | set_buffer_new(bh_result); |
3124 | /* | ||
3125 | * if we allocated more blocks than requested | ||
3126 | * we need to make sure we unmap the extra block | ||
3127 | * allocated. The actual needed block will get | ||
3128 | * unmapped later when we find the buffer_head marked | ||
3129 | * new. | ||
3130 | */ | ||
3131 | if (allocated > max_blocks) { | ||
3132 | unmap_underlying_metadata_blocks(inode->i_sb->s_bdev, | ||
3133 | newblock + max_blocks, | ||
3134 | allocated - max_blocks); | ||
3135 | } | ||
3101 | map_out: | 3136 | map_out: |
3102 | set_buffer_mapped(bh_result); | 3137 | set_buffer_mapped(bh_result); |
3103 | out1: | 3138 | out1: |
@@ -3190,7 +3225,13 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | |||
3190 | * this situation is possible, though, _during_ tree modification; | 3225 | * this situation is possible, though, _during_ tree modification; |
3191 | * this is why assert can't be put in ext4_ext_find_extent() | 3226 | * this is why assert can't be put in ext4_ext_find_extent() |
3192 | */ | 3227 | */ |
3193 | BUG_ON(path[depth].p_ext == NULL && depth != 0); | 3228 | if (path[depth].p_ext == NULL && depth != 0) { |
3229 | ext4_error(inode->i_sb, __func__, "bad extent address " | ||
3230 | "inode: %lu, iblock: %d, depth: %d", | ||
3231 | inode->i_ino, iblock, depth); | ||
3232 | err = -EIO; | ||
3233 | goto out2; | ||
3234 | } | ||
3194 | eh = path[depth].p_hdr; | 3235 | eh = path[depth].p_hdr; |
3195 | 3236 | ||
3196 | ex = path[depth].p_ext; | 3237 | ex = path[depth].p_ext; |
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index 0b22497d92e1..98bd140aad01 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -88,9 +88,21 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
88 | return ext4_force_commit(inode->i_sb); | 88 | return ext4_force_commit(inode->i_sb); |
89 | 89 | ||
90 | commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid; | 90 | commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid; |
91 | if (jbd2_log_start_commit(journal, commit_tid)) | 91 | if (jbd2_log_start_commit(journal, commit_tid)) { |
92 | /* | ||
93 | * When the journal is on a different device than the | ||
94 | * fs data disk, we need to issue the barrier in | ||
95 | * writeback mode. (In ordered mode, the jbd2 layer | ||
96 | * will take care of issuing the barrier. In | ||
97 | * data=journal, all of the data blocks are written to | ||
98 | * the journal device.) | ||
99 | */ | ||
100 | if (ext4_should_writeback_data(inode) && | ||
101 | (journal->j_fs_dev != journal->j_dev) && | ||
102 | (journal->j_flags & JBD2_BARRIER)) | ||
103 | blkdev_issue_flush(inode->i_sb->s_bdev, NULL); | ||
92 | jbd2_log_wait_commit(journal, commit_tid); | 104 | jbd2_log_wait_commit(journal, commit_tid); |
93 | else if (journal->j_flags & JBD2_BARRIER) | 105 | } else if (journal->j_flags & JBD2_BARRIER) |
94 | blkdev_issue_flush(inode->i_sb->s_bdev, NULL); | 106 | blkdev_issue_flush(inode->i_sb->s_bdev, NULL); |
95 | return ret; | 107 | return ret; |
96 | } | 108 | } |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index ab807963a614..c818972c8302 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1009,77 +1009,88 @@ qsize_t *ext4_get_reserved_space(struct inode *inode) | |||
1009 | return &EXT4_I(inode)->i_reserved_quota; | 1009 | return &EXT4_I(inode)->i_reserved_quota; |
1010 | } | 1010 | } |
1011 | #endif | 1011 | #endif |
1012 | |||
1012 | /* | 1013 | /* |
1013 | * Calculate the number of metadata blocks need to reserve | 1014 | * Calculate the number of metadata blocks need to reserve |
1014 | * to allocate @blocks for non extent file based file | 1015 | * to allocate a new block at @lblocks for non extent file based file |
1015 | */ | 1016 | */ |
1016 | static int ext4_indirect_calc_metadata_amount(struct inode *inode, int blocks) | 1017 | static int ext4_indirect_calc_metadata_amount(struct inode *inode, |
1018 | sector_t lblock) | ||
1017 | { | 1019 | { |
1018 | int icap = EXT4_ADDR_PER_BLOCK(inode->i_sb); | 1020 | struct ext4_inode_info *ei = EXT4_I(inode); |
1019 | int ind_blks, dind_blks, tind_blks; | 1021 | int dind_mask = EXT4_ADDR_PER_BLOCK(inode->i_sb) - 1; |
1020 | 1022 | int blk_bits; | |
1021 | /* number of new indirect blocks needed */ | ||
1022 | ind_blks = (blocks + icap - 1) / icap; | ||
1023 | 1023 | ||
1024 | dind_blks = (ind_blks + icap - 1) / icap; | 1024 | if (lblock < EXT4_NDIR_BLOCKS) |
1025 | return 0; | ||
1025 | 1026 | ||
1026 | tind_blks = 1; | 1027 | lblock -= EXT4_NDIR_BLOCKS; |
1027 | 1028 | ||
1028 | return ind_blks + dind_blks + tind_blks; | 1029 | if (ei->i_da_metadata_calc_len && |
1030 | (lblock & dind_mask) == ei->i_da_metadata_calc_last_lblock) { | ||
1031 | ei->i_da_metadata_calc_len++; | ||
1032 | return 0; | ||
1033 | } | ||
1034 | ei->i_da_metadata_calc_last_lblock = lblock & dind_mask; | ||
1035 | ei->i_da_metadata_calc_len = 1; | ||
1036 | blk_bits = roundup_pow_of_two(lblock + 1); | ||
1037 | return (blk_bits / EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb)) + 1; | ||
1029 | } | 1038 | } |
1030 | 1039 | ||
1031 | /* | 1040 | /* |
1032 | * Calculate the number of metadata blocks need to reserve | 1041 | * Calculate the number of metadata blocks need to reserve |
1033 | * to allocate given number of blocks | 1042 | * to allocate a block located at @lblock |
1034 | */ | 1043 | */ |
1035 | static int ext4_calc_metadata_amount(struct inode *inode, int blocks) | 1044 | static int ext4_calc_metadata_amount(struct inode *inode, sector_t lblock) |
1036 | { | 1045 | { |
1037 | if (!blocks) | ||
1038 | return 0; | ||
1039 | |||
1040 | if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) | 1046 | if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) |
1041 | return ext4_ext_calc_metadata_amount(inode, blocks); | 1047 | return ext4_ext_calc_metadata_amount(inode, lblock); |
1042 | 1048 | ||
1043 | return ext4_indirect_calc_metadata_amount(inode, blocks); | 1049 | return ext4_indirect_calc_metadata_amount(inode, lblock); |
1044 | } | 1050 | } |
1045 | 1051 | ||
1052 | /* | ||
1053 | * Called with i_data_sem down, which is important since we can call | ||
1054 | * ext4_discard_preallocations() from here. | ||
1055 | */ | ||
1046 | static void ext4_da_update_reserve_space(struct inode *inode, int used) | 1056 | static void ext4_da_update_reserve_space(struct inode *inode, int used) |
1047 | { | 1057 | { |
1048 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | 1058 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
1049 | int total, mdb, mdb_free, mdb_claim = 0; | 1059 | struct ext4_inode_info *ei = EXT4_I(inode); |
1050 | 1060 | int mdb_free = 0; | |
1051 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); | 1061 | |
1052 | /* recalculate the number of metablocks still need to be reserved */ | 1062 | spin_lock(&ei->i_block_reservation_lock); |
1053 | total = EXT4_I(inode)->i_reserved_data_blocks - used; | 1063 | if (unlikely(used > ei->i_reserved_data_blocks)) { |
1054 | mdb = ext4_calc_metadata_amount(inode, total); | 1064 | ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, used %d " |
1055 | 1065 | "with only %d reserved data blocks\n", | |
1056 | /* figure out how many metablocks to release */ | 1066 | __func__, inode->i_ino, used, |
1057 | BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks); | 1067 | ei->i_reserved_data_blocks); |
1058 | mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb; | 1068 | WARN_ON(1); |
1059 | 1069 | used = ei->i_reserved_data_blocks; | |
1060 | if (mdb_free) { | 1070 | } |
1061 | /* Account for allocated meta_blocks */ | 1071 | |
1062 | mdb_claim = EXT4_I(inode)->i_allocated_meta_blocks; | 1072 | /* Update per-inode reservations */ |
1063 | BUG_ON(mdb_free < mdb_claim); | 1073 | ei->i_reserved_data_blocks -= used; |
1064 | mdb_free -= mdb_claim; | 1074 | used += ei->i_allocated_meta_blocks; |
1065 | 1075 | ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks; | |
1066 | /* update fs dirty blocks counter */ | 1076 | ei->i_allocated_meta_blocks = 0; |
1077 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, used); | ||
1078 | |||
1079 | if (ei->i_reserved_data_blocks == 0) { | ||
1080 | /* | ||
1081 | * We can release all of the reserved metadata blocks | ||
1082 | * only when we have written all of the delayed | ||
1083 | * allocation blocks. | ||
1084 | */ | ||
1085 | mdb_free = ei->i_reserved_meta_blocks; | ||
1086 | ei->i_reserved_meta_blocks = 0; | ||
1087 | ei->i_da_metadata_calc_len = 0; | ||
1067 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free); | 1088 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free); |
1068 | EXT4_I(inode)->i_allocated_meta_blocks = 0; | ||
1069 | EXT4_I(inode)->i_reserved_meta_blocks = mdb; | ||
1070 | } | 1089 | } |
1071 | |||
1072 | /* update per-inode reservations */ | ||
1073 | BUG_ON(used > EXT4_I(inode)->i_reserved_data_blocks); | ||
1074 | EXT4_I(inode)->i_reserved_data_blocks -= used; | ||
1075 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, used + mdb_claim); | ||
1076 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 1090 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); |
1077 | 1091 | ||
1078 | vfs_dq_claim_block(inode, used + mdb_claim); | 1092 | /* Update quota subsystem */ |
1079 | 1093 | vfs_dq_claim_block(inode, used); | |
1080 | /* | ||
1081 | * free those over-booking quota for metadata blocks | ||
1082 | */ | ||
1083 | if (mdb_free) | 1094 | if (mdb_free) |
1084 | vfs_dq_release_reservation_block(inode, mdb_free); | 1095 | vfs_dq_release_reservation_block(inode, mdb_free); |
1085 | 1096 | ||
@@ -1088,7 +1099,8 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used) | |||
1088 | * there aren't any writers on the inode, we can discard the | 1099 | * there aren't any writers on the inode, we can discard the |
1089 | * inode's preallocations. | 1100 | * inode's preallocations. |
1090 | */ | 1101 | */ |
1091 | if (!total && (atomic_read(&inode->i_writecount) == 0)) | 1102 | if ((ei->i_reserved_data_blocks == 0) && |
1103 | (atomic_read(&inode->i_writecount) == 0)) | ||
1092 | ext4_discard_preallocations(inode); | 1104 | ext4_discard_preallocations(inode); |
1093 | } | 1105 | } |
1094 | 1106 | ||
@@ -1797,11 +1809,15 @@ static int ext4_journalled_write_end(struct file *file, | |||
1797 | return ret ? ret : copied; | 1809 | return ret ? ret : copied; |
1798 | } | 1810 | } |
1799 | 1811 | ||
1800 | static int ext4_da_reserve_space(struct inode *inode, int nrblocks) | 1812 | /* |
1813 | * Reserve a single block located at lblock | ||
1814 | */ | ||
1815 | static int ext4_da_reserve_space(struct inode *inode, sector_t lblock) | ||
1801 | { | 1816 | { |
1802 | int retries = 0; | 1817 | int retries = 0; |
1803 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | 1818 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
1804 | unsigned long md_needed, mdblocks, total = 0; | 1819 | struct ext4_inode_info *ei = EXT4_I(inode); |
1820 | unsigned long md_needed, md_reserved; | ||
1805 | 1821 | ||
1806 | /* | 1822 | /* |
1807 | * recalculate the amount of metadata blocks to reserve | 1823 | * recalculate the amount of metadata blocks to reserve |
@@ -1809,35 +1825,43 @@ static int ext4_da_reserve_space(struct inode *inode, int nrblocks) | |||
1809 | * worse case is one extent per block | 1825 | * worse case is one extent per block |
1810 | */ | 1826 | */ |
1811 | repeat: | 1827 | repeat: |
1812 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); | 1828 | spin_lock(&ei->i_block_reservation_lock); |
1813 | total = EXT4_I(inode)->i_reserved_data_blocks + nrblocks; | 1829 | md_reserved = ei->i_reserved_meta_blocks; |
1814 | mdblocks = ext4_calc_metadata_amount(inode, total); | 1830 | md_needed = ext4_calc_metadata_amount(inode, lblock); |
1815 | BUG_ON(mdblocks < EXT4_I(inode)->i_reserved_meta_blocks); | 1831 | spin_unlock(&ei->i_block_reservation_lock); |
1816 | |||
1817 | md_needed = mdblocks - EXT4_I(inode)->i_reserved_meta_blocks; | ||
1818 | total = md_needed + nrblocks; | ||
1819 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | ||
1820 | 1832 | ||
1821 | /* | 1833 | /* |
1822 | * Make quota reservation here to prevent quota overflow | 1834 | * Make quota reservation here to prevent quota overflow |
1823 | * later. Real quota accounting is done at pages writeout | 1835 | * later. Real quota accounting is done at pages writeout |
1824 | * time. | 1836 | * time. |
1825 | */ | 1837 | */ |
1826 | if (vfs_dq_reserve_block(inode, total)) | 1838 | if (vfs_dq_reserve_block(inode, md_needed + 1)) { |
1839 | /* | ||
1840 | * We tend to badly over-estimate the amount of | ||
1841 | * metadata blocks which are needed, so if we have | ||
1842 | * reserved any metadata blocks, try to force out the | ||
1843 | * inode and see if we have any better luck. | ||
1844 | */ | ||
1845 | if (md_reserved && retries++ <= 3) | ||
1846 | goto retry; | ||
1827 | return -EDQUOT; | 1847 | return -EDQUOT; |
1848 | } | ||
1828 | 1849 | ||
1829 | if (ext4_claim_free_blocks(sbi, total)) { | 1850 | if (ext4_claim_free_blocks(sbi, md_needed + 1)) { |
1830 | vfs_dq_release_reservation_block(inode, total); | 1851 | vfs_dq_release_reservation_block(inode, md_needed + 1); |
1831 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { | 1852 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { |
1853 | retry: | ||
1854 | if (md_reserved) | ||
1855 | write_inode_now(inode, (retries == 3)); | ||
1832 | yield(); | 1856 | yield(); |
1833 | goto repeat; | 1857 | goto repeat; |
1834 | } | 1858 | } |
1835 | return -ENOSPC; | 1859 | return -ENOSPC; |
1836 | } | 1860 | } |
1837 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); | 1861 | spin_lock(&ei->i_block_reservation_lock); |
1838 | EXT4_I(inode)->i_reserved_data_blocks += nrblocks; | 1862 | ei->i_reserved_data_blocks++; |
1839 | EXT4_I(inode)->i_reserved_meta_blocks += md_needed; | 1863 | ei->i_reserved_meta_blocks += md_needed; |
1840 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 1864 | spin_unlock(&ei->i_block_reservation_lock); |
1841 | 1865 | ||
1842 | return 0; /* success */ | 1866 | return 0; /* success */ |
1843 | } | 1867 | } |
@@ -1845,49 +1869,46 @@ repeat: | |||
1845 | static void ext4_da_release_space(struct inode *inode, int to_free) | 1869 | static void ext4_da_release_space(struct inode *inode, int to_free) |
1846 | { | 1870 | { |
1847 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | 1871 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
1848 | int total, mdb, mdb_free, release; | 1872 | struct ext4_inode_info *ei = EXT4_I(inode); |
1849 | 1873 | ||
1850 | if (!to_free) | 1874 | if (!to_free) |
1851 | return; /* Nothing to release, exit */ | 1875 | return; /* Nothing to release, exit */ |
1852 | 1876 | ||
1853 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); | 1877 | spin_lock(&EXT4_I(inode)->i_block_reservation_lock); |
1854 | 1878 | ||
1855 | if (!EXT4_I(inode)->i_reserved_data_blocks) { | 1879 | if (unlikely(to_free > ei->i_reserved_data_blocks)) { |
1856 | /* | 1880 | /* |
1857 | * if there is no reserved blocks, but we try to free some | 1881 | * if there aren't enough reserved blocks, then the |
1858 | * then the counter is messed up somewhere. | 1882 | * counter is messed up somewhere. Since this |
1859 | * but since this function is called from invalidate | 1883 | * function is called from invalidate page, it's |
1860 | * page, it's harmless to return without any action | 1884 | * harmless to return without any action. |
1861 | */ | 1885 | */ |
1862 | printk(KERN_INFO "ext4 delalloc try to release %d reserved " | 1886 | ext4_msg(inode->i_sb, KERN_NOTICE, "ext4_da_release_space: " |
1863 | "blocks for inode %lu, but there is no reserved " | 1887 | "ino %lu, to_free %d with only %d reserved " |
1864 | "data blocks\n", to_free, inode->i_ino); | 1888 | "data blocks\n", inode->i_ino, to_free, |
1865 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 1889 | ei->i_reserved_data_blocks); |
1866 | return; | 1890 | WARN_ON(1); |
1891 | to_free = ei->i_reserved_data_blocks; | ||
1867 | } | 1892 | } |
1893 | ei->i_reserved_data_blocks -= to_free; | ||
1868 | 1894 | ||
1869 | /* recalculate the number of metablocks still need to be reserved */ | 1895 | if (ei->i_reserved_data_blocks == 0) { |
1870 | total = EXT4_I(inode)->i_reserved_data_blocks - to_free; | 1896 | /* |
1871 | mdb = ext4_calc_metadata_amount(inode, total); | 1897 | * We can release all of the reserved metadata blocks |
1872 | 1898 | * only when we have written all of the delayed | |
1873 | /* figure out how many metablocks to release */ | 1899 | * allocation blocks. |
1874 | BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks); | 1900 | */ |
1875 | mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb; | 1901 | to_free += ei->i_reserved_meta_blocks; |
1876 | 1902 | ei->i_reserved_meta_blocks = 0; | |
1877 | release = to_free + mdb_free; | 1903 | ei->i_da_metadata_calc_len = 0; |
1878 | 1904 | } | |
1879 | /* update fs dirty blocks counter for truncate case */ | ||
1880 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, release); | ||
1881 | 1905 | ||
1882 | /* update per-inode reservations */ | 1906 | /* update fs dirty blocks counter */ |
1883 | BUG_ON(to_free > EXT4_I(inode)->i_reserved_data_blocks); | 1907 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, to_free); |
1884 | EXT4_I(inode)->i_reserved_data_blocks -= to_free; | ||
1885 | 1908 | ||
1886 | BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks); | ||
1887 | EXT4_I(inode)->i_reserved_meta_blocks = mdb; | ||
1888 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 1909 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); |
1889 | 1910 | ||
1890 | vfs_dq_release_reservation_block(inode, release); | 1911 | vfs_dq_release_reservation_block(inode, to_free); |
1891 | } | 1912 | } |
1892 | 1913 | ||
1893 | static void ext4_da_page_release_reservation(struct page *page, | 1914 | static void ext4_da_page_release_reservation(struct page *page, |
@@ -2493,7 +2514,7 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock, | |||
2493 | * XXX: __block_prepare_write() unmaps passed block, | 2514 | * XXX: __block_prepare_write() unmaps passed block, |
2494 | * is it OK? | 2515 | * is it OK? |
2495 | */ | 2516 | */ |
2496 | ret = ext4_da_reserve_space(inode, 1); | 2517 | ret = ext4_da_reserve_space(inode, iblock); |
2497 | if (ret) | 2518 | if (ret) |
2498 | /* not enough space to reserve */ | 2519 | /* not enough space to reserve */ |
2499 | return ret; | 2520 | return ret; |
@@ -2967,8 +2988,7 @@ retry: | |||
2967 | out_writepages: | 2988 | out_writepages: |
2968 | if (!no_nrwrite_index_update) | 2989 | if (!no_nrwrite_index_update) |
2969 | wbc->no_nrwrite_index_update = 0; | 2990 | wbc->no_nrwrite_index_update = 0; |
2970 | if (wbc->nr_to_write > nr_to_writebump) | 2991 | wbc->nr_to_write -= nr_to_writebump; |
2971 | wbc->nr_to_write -= nr_to_writebump; | ||
2972 | wbc->range_start = range_start; | 2992 | wbc->range_start = range_start; |
2973 | trace_ext4_da_writepages_result(inode, wbc, ret, pages_written); | 2993 | trace_ext4_da_writepages_result(inode, wbc, ret, pages_written); |
2974 | return ret; | 2994 | return ret; |
@@ -2993,11 +3013,18 @@ static int ext4_nonda_switch(struct super_block *sb) | |||
2993 | if (2 * free_blocks < 3 * dirty_blocks || | 3013 | if (2 * free_blocks < 3 * dirty_blocks || |
2994 | free_blocks < (dirty_blocks + EXT4_FREEBLOCKS_WATERMARK)) { | 3014 | free_blocks < (dirty_blocks + EXT4_FREEBLOCKS_WATERMARK)) { |
2995 | /* | 3015 | /* |
2996 | * free block count is less that 150% of dirty blocks | 3016 | * free block count is less than 150% of dirty blocks |
2997 | * or free blocks is less that watermark | 3017 | * or free blocks is less than watermark |
2998 | */ | 3018 | */ |
2999 | return 1; | 3019 | return 1; |
3000 | } | 3020 | } |
3021 | /* | ||
3022 | * Even if we don't switch but are nearing capacity, | ||
3023 | * start pushing delalloc when 1/2 of free blocks are dirty. | ||
3024 | */ | ||
3025 | if (free_blocks < 2 * dirty_blocks) | ||
3026 | writeback_inodes_sb_if_idle(sb); | ||
3027 | |||
3001 | return 0; | 3028 | return 0; |
3002 | } | 3029 | } |
3003 | 3030 | ||
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h index 0ca811061bc7..436521cae456 100644 --- a/fs/ext4/mballoc.h +++ b/fs/ext4/mballoc.h | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/proc_fs.h> | 17 | #include <linux/proc_fs.h> |
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
20 | #include <linux/version.h> | ||
21 | #include <linux/blkdev.h> | 20 | #include <linux/blkdev.h> |
22 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
23 | #include "ext4_jbd2.h" | 22 | #include "ext4_jbd2.h" |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 6ed9aa91f27d..735c20d5fd56 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -702,6 +702,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) | |||
702 | ei->i_reserved_data_blocks = 0; | 702 | ei->i_reserved_data_blocks = 0; |
703 | ei->i_reserved_meta_blocks = 0; | 703 | ei->i_reserved_meta_blocks = 0; |
704 | ei->i_allocated_meta_blocks = 0; | 704 | ei->i_allocated_meta_blocks = 0; |
705 | ei->i_da_metadata_calc_len = 0; | ||
705 | ei->i_delalloc_reserved_flag = 0; | 706 | ei->i_delalloc_reserved_flag = 0; |
706 | spin_lock_init(&(ei->i_block_reservation_lock)); | 707 | spin_lock_init(&(ei->i_block_reservation_lock)); |
707 | #ifdef CONFIG_QUOTA | 708 | #ifdef CONFIG_QUOTA |
@@ -2174,9 +2175,9 @@ static ssize_t lifetime_write_kbytes_show(struct ext4_attr *a, | |||
2174 | struct super_block *sb = sbi->s_buddy_cache->i_sb; | 2175 | struct super_block *sb = sbi->s_buddy_cache->i_sb; |
2175 | 2176 | ||
2176 | return snprintf(buf, PAGE_SIZE, "%llu\n", | 2177 | return snprintf(buf, PAGE_SIZE, "%llu\n", |
2177 | sbi->s_kbytes_written + | 2178 | (unsigned long long)(sbi->s_kbytes_written + |
2178 | ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) - | 2179 | ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) - |
2179 | EXT4_SB(sb)->s_sectors_written_start) >> 1)); | 2180 | EXT4_SB(sb)->s_sectors_written_start) >> 1))); |
2180 | } | 2181 | } |
2181 | 2182 | ||
2182 | static ssize_t inode_readahead_blks_store(struct ext4_attr *a, | 2183 | static ssize_t inode_readahead_blks_store(struct ext4_attr *a, |
@@ -4005,6 +4006,7 @@ static inline void unregister_as_ext2(void) | |||
4005 | { | 4006 | { |
4006 | unregister_filesystem(&ext2_fs_type); | 4007 | unregister_filesystem(&ext2_fs_type); |
4007 | } | 4008 | } |
4009 | MODULE_ALIAS("ext2"); | ||
4008 | #else | 4010 | #else |
4009 | static inline void register_as_ext2(void) { } | 4011 | static inline void register_as_ext2(void) { } |
4010 | static inline void unregister_as_ext2(void) { } | 4012 | static inline void unregister_as_ext2(void) { } |
@@ -4031,6 +4033,7 @@ static inline void unregister_as_ext3(void) | |||
4031 | { | 4033 | { |
4032 | unregister_filesystem(&ext3_fs_type); | 4034 | unregister_filesystem(&ext3_fs_type); |
4033 | } | 4035 | } |
4036 | MODULE_ALIAS("ext3"); | ||
4034 | #else | 4037 | #else |
4035 | static inline void register_as_ext3(void) { } | 4038 | static inline void register_as_ext3(void) { } |
4036 | static inline void unregister_as_ext3(void) { } | 4039 | static inline void unregister_as_ext3(void) { } |
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 83218bebbc7c..f3a2f7ed45aa 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
@@ -1332,6 +1332,8 @@ retry: | |||
1332 | goto cleanup; | 1332 | goto cleanup; |
1333 | kfree(b_entry_name); | 1333 | kfree(b_entry_name); |
1334 | kfree(buffer); | 1334 | kfree(buffer); |
1335 | b_entry_name = NULL; | ||
1336 | buffer = NULL; | ||
1335 | brelse(is->iloc.bh); | 1337 | brelse(is->iloc.bh); |
1336 | kfree(is); | 1338 | kfree(is); |
1337 | kfree(bs); | 1339 | kfree(bs); |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 49bc1b8e8f19..1a7c42c64ff4 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -242,6 +242,7 @@ static void bdi_sync_writeback(struct backing_dev_info *bdi, | |||
242 | /** | 242 | /** |
243 | * bdi_start_writeback - start writeback | 243 | * bdi_start_writeback - start writeback |
244 | * @bdi: the backing device to write from | 244 | * @bdi: the backing device to write from |
245 | * @sb: write inodes from this super_block | ||
245 | * @nr_pages: the number of pages to write | 246 | * @nr_pages: the number of pages to write |
246 | * | 247 | * |
247 | * Description: | 248 | * Description: |
@@ -1187,6 +1188,23 @@ void writeback_inodes_sb(struct super_block *sb) | |||
1187 | EXPORT_SYMBOL(writeback_inodes_sb); | 1188 | EXPORT_SYMBOL(writeback_inodes_sb); |
1188 | 1189 | ||
1189 | /** | 1190 | /** |
1191 | * writeback_inodes_sb_if_idle - start writeback if none underway | ||
1192 | * @sb: the superblock | ||
1193 | * | ||
1194 | * Invoke writeback_inodes_sb if no writeback is currently underway. | ||
1195 | * Returns 1 if writeback was started, 0 if not. | ||
1196 | */ | ||
1197 | int writeback_inodes_sb_if_idle(struct super_block *sb) | ||
1198 | { | ||
1199 | if (!writeback_in_progress(sb->s_bdi)) { | ||
1200 | writeback_inodes_sb(sb); | ||
1201 | return 1; | ||
1202 | } else | ||
1203 | return 0; | ||
1204 | } | ||
1205 | EXPORT_SYMBOL(writeback_inodes_sb_if_idle); | ||
1206 | |||
1207 | /** | ||
1190 | * sync_inodes_sb - sync sb inode pages | 1208 | * sync_inodes_sb - sync sb inode pages |
1191 | * @sb: the superblock | 1209 | * @sb: the superblock |
1192 | * | 1210 | * |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 4eb308aa3234..a6abbae8a278 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -569,6 +569,40 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
569 | return ret; | 569 | return ret; |
570 | } | 570 | } |
571 | 571 | ||
572 | /** | ||
573 | * gfs2_file_aio_write - Perform a write to a file | ||
574 | * @iocb: The io context | ||
575 | * @iov: The data to write | ||
576 | * @nr_segs: Number of @iov segments | ||
577 | * @pos: The file position | ||
578 | * | ||
579 | * We have to do a lock/unlock here to refresh the inode size for | ||
580 | * O_APPEND writes, otherwise we can land up writing at the wrong | ||
581 | * offset. There is still a race, but provided the app is using its | ||
582 | * own file locking, this will make O_APPEND work as expected. | ||
583 | * | ||
584 | */ | ||
585 | |||
586 | static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | ||
587 | unsigned long nr_segs, loff_t pos) | ||
588 | { | ||
589 | struct file *file = iocb->ki_filp; | ||
590 | |||
591 | if (file->f_flags & O_APPEND) { | ||
592 | struct dentry *dentry = file->f_dentry; | ||
593 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | ||
594 | struct gfs2_holder gh; | ||
595 | int ret; | ||
596 | |||
597 | ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh); | ||
598 | if (ret) | ||
599 | return ret; | ||
600 | gfs2_glock_dq_uninit(&gh); | ||
601 | } | ||
602 | |||
603 | return generic_file_aio_write(iocb, iov, nr_segs, pos); | ||
604 | } | ||
605 | |||
572 | #ifdef CONFIG_GFS2_FS_LOCKING_DLM | 606 | #ifdef CONFIG_GFS2_FS_LOCKING_DLM |
573 | 607 | ||
574 | /** | 608 | /** |
@@ -711,7 +745,7 @@ const struct file_operations gfs2_file_fops = { | |||
711 | .read = do_sync_read, | 745 | .read = do_sync_read, |
712 | .aio_read = generic_file_aio_read, | 746 | .aio_read = generic_file_aio_read, |
713 | .write = do_sync_write, | 747 | .write = do_sync_write, |
714 | .aio_write = generic_file_aio_write, | 748 | .aio_write = gfs2_file_aio_write, |
715 | .unlocked_ioctl = gfs2_ioctl, | 749 | .unlocked_ioctl = gfs2_ioctl, |
716 | .mmap = gfs2_mmap, | 750 | .mmap = gfs2_mmap, |
717 | .open = gfs2_open, | 751 | .open = gfs2_open, |
@@ -741,7 +775,7 @@ const struct file_operations gfs2_file_fops_nolock = { | |||
741 | .read = do_sync_read, | 775 | .read = do_sync_read, |
742 | .aio_read = generic_file_aio_read, | 776 | .aio_read = generic_file_aio_read, |
743 | .write = do_sync_write, | 777 | .write = do_sync_write, |
744 | .aio_write = generic_file_aio_write, | 778 | .aio_write = gfs2_file_aio_write, |
745 | .unlocked_ioctl = gfs2_ioctl, | 779 | .unlocked_ioctl = gfs2_ioctl, |
746 | .mmap = gfs2_mmap, | 780 | .mmap = gfs2_mmap, |
747 | .open = gfs2_open, | 781 | .open = gfs2_open, |
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index cb8d7a93d5ec..6f68a5f18eb8 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -121,7 +121,7 @@ struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp) | |||
121 | if (aspace) { | 121 | if (aspace) { |
122 | mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); | 122 | mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); |
123 | aspace->i_mapping->a_ops = &aspace_aops; | 123 | aspace->i_mapping->a_ops = &aspace_aops; |
124 | aspace->i_size = ~0ULL; | 124 | aspace->i_size = MAX_LFS_FILESIZE; |
125 | ip = GFS2_I(aspace); | 125 | ip = GFS2_I(aspace); |
126 | clear_bit(GIF_USER, &ip->i_flags); | 126 | clear_bit(GIF_USER, &ip->i_flags); |
127 | insert_inode_hash(aspace); | 127 | insert_inode_hash(aspace); |
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 247436c10deb..78f73ca1ef3e 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -748,7 +748,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
748 | struct gfs2_rgrpd *nrgd; | 748 | struct gfs2_rgrpd *nrgd; |
749 | unsigned int num_gh; | 749 | unsigned int num_gh; |
750 | int dir_rename = 0; | 750 | int dir_rename = 0; |
751 | int alloc_required; | 751 | int alloc_required = 0; |
752 | unsigned int x; | 752 | unsigned int x; |
753 | int error; | 753 | int error; |
754 | 754 | ||
@@ -867,7 +867,9 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
867 | goto out_gunlock; | 867 | goto out_gunlock; |
868 | } | 868 | } |
869 | 869 | ||
870 | alloc_required = error = gfs2_diradd_alloc_required(ndir, &ndentry->d_name); | 870 | if (nip == NULL) |
871 | alloc_required = gfs2_diradd_alloc_required(ndir, &ndentry->d_name); | ||
872 | error = alloc_required; | ||
871 | if (error < 0) | 873 | if (error < 0) |
872 | goto out_gunlock; | 874 | goto out_gunlock; |
873 | error = 0; | 875 | error = 0; |
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index 8a04108e0c22..c2ebdf2c01d4 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c | |||
@@ -1296,6 +1296,7 @@ fail: | |||
1296 | 1296 | ||
1297 | int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | 1297 | int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) |
1298 | { | 1298 | { |
1299 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | ||
1299 | struct gfs2_ea_location el; | 1300 | struct gfs2_ea_location el; |
1300 | struct buffer_head *dibh; | 1301 | struct buffer_head *dibh; |
1301 | int error; | 1302 | int error; |
@@ -1305,16 +1306,17 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | |||
1305 | return error; | 1306 | return error; |
1306 | 1307 | ||
1307 | if (GFS2_EA_IS_STUFFED(el.el_ea)) { | 1308 | if (GFS2_EA_IS_STUFFED(el.el_ea)) { |
1308 | error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0); | 1309 | error = gfs2_trans_begin(sdp, RES_DINODE + RES_EATTR, 0); |
1309 | if (error) | 1310 | if (error == 0) { |
1310 | return error; | 1311 | gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1); |
1311 | 1312 | memcpy(GFS2_EA2DATA(el.el_ea), data, | |
1312 | gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1); | 1313 | GFS2_EA_DATA_LEN(el.el_ea)); |
1313 | memcpy(GFS2_EA2DATA(el.el_ea), data, | 1314 | } |
1314 | GFS2_EA_DATA_LEN(el.el_ea)); | 1315 | } else { |
1315 | } else | ||
1316 | error = ea_acl_chmod_unstuffed(ip, el.el_ea, data); | 1316 | error = ea_acl_chmod_unstuffed(ip, el.el_ea, data); |
1317 | } | ||
1317 | 1318 | ||
1319 | brelse(el.el_bh); | ||
1318 | if (error) | 1320 | if (error) |
1319 | return error; | 1321 | return error; |
1320 | 1322 | ||
@@ -1327,8 +1329,7 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | |||
1327 | brelse(dibh); | 1329 | brelse(dibh); |
1328 | } | 1330 | } |
1329 | 1331 | ||
1330 | gfs2_trans_end(GFS2_SB(&ip->i_inode)); | 1332 | gfs2_trans_end(sdp); |
1331 | |||
1332 | return error; | 1333 | return error; |
1333 | } | 1334 | } |
1334 | 1335 | ||
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index ca0f5eb62b20..886849370950 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/jbd2.h> | 22 | #include <linux/jbd2.h> |
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/blkdev.h> | ||
25 | #include <trace/events/jbd2.h> | 26 | #include <trace/events/jbd2.h> |
26 | 27 | ||
27 | /* | 28 | /* |
@@ -515,6 +516,20 @@ int jbd2_cleanup_journal_tail(journal_t *journal) | |||
515 | journal->j_tail_sequence = first_tid; | 516 | journal->j_tail_sequence = first_tid; |
516 | journal->j_tail = blocknr; | 517 | journal->j_tail = blocknr; |
517 | spin_unlock(&journal->j_state_lock); | 518 | spin_unlock(&journal->j_state_lock); |
519 | |||
520 | /* | ||
521 | * If there is an external journal, we need to make sure that | ||
522 | * any data blocks that were recently written out --- perhaps | ||
523 | * by jbd2_log_do_checkpoint() --- are flushed out before we | ||
524 | * drop the transactions from the external journal. It's | ||
525 | * unlikely this will be necessary, especially with a | ||
526 | * appropriately sized journal, but we need this to guarantee | ||
527 | * correctness. Fortunately jbd2_cleanup_journal_tail() | ||
528 | * doesn't get called all that often. | ||
529 | */ | ||
530 | if ((journal->j_fs_dev != journal->j_dev) && | ||
531 | (journal->j_flags & JBD2_BARRIER)) | ||
532 | blkdev_issue_flush(journal->j_fs_dev, NULL); | ||
518 | if (!(journal->j_flags & JBD2_ABORT)) | 533 | if (!(journal->j_flags & JBD2_ABORT)) |
519 | jbd2_journal_update_superblock(journal, 1); | 534 | jbd2_journal_update_superblock(journal, 1); |
520 | return 0; | 535 | return 0; |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 6a10238d2c63..1bc74b6f26d2 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -259,6 +259,7 @@ static int journal_submit_data_buffers(journal_t *journal, | |||
259 | ret = err; | 259 | ret = err; |
260 | spin_lock(&journal->j_list_lock); | 260 | spin_lock(&journal->j_list_lock); |
261 | J_ASSERT(jinode->i_transaction == commit_transaction); | 261 | J_ASSERT(jinode->i_transaction == commit_transaction); |
262 | commit_transaction->t_flushed_data_blocks = 1; | ||
262 | jinode->i_flags &= ~JI_COMMIT_RUNNING; | 263 | jinode->i_flags &= ~JI_COMMIT_RUNNING; |
263 | wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); | 264 | wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); |
264 | } | 265 | } |
@@ -708,8 +709,17 @@ start_journal_io: | |||
708 | } | 709 | } |
709 | } | 710 | } |
710 | 711 | ||
711 | /* Done it all: now write the commit record asynchronously. */ | 712 | /* |
713 | * If the journal is not located on the file system device, | ||
714 | * then we must flush the file system device before we issue | ||
715 | * the commit record | ||
716 | */ | ||
717 | if (commit_transaction->t_flushed_data_blocks && | ||
718 | (journal->j_fs_dev != journal->j_dev) && | ||
719 | (journal->j_flags & JBD2_BARRIER)) | ||
720 | blkdev_issue_flush(journal->j_fs_dev, NULL); | ||
712 | 721 | ||
722 | /* Done it all: now write the commit record asynchronously. */ | ||
713 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 723 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
714 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { | 724 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { |
715 | err = journal_submit_commit_record(journal, commit_transaction, | 725 | err = journal_submit_commit_record(journal, commit_transaction, |
@@ -720,13 +730,6 @@ start_journal_io: | |||
720 | blkdev_issue_flush(journal->j_dev, NULL); | 730 | blkdev_issue_flush(journal->j_dev, NULL); |
721 | } | 731 | } |
722 | 732 | ||
723 | /* | ||
724 | * This is the right place to wait for data buffers both for ASYNC | ||
725 | * and !ASYNC commit. If commit is ASYNC, we need to wait only after | ||
726 | * the commit block went to disk (which happens above). If commit is | ||
727 | * SYNC, we need to wait for data buffers before we start writing | ||
728 | * commit block, which happens below in such setting. | ||
729 | */ | ||
730 | err = journal_finish_inode_data_buffers(journal, commit_transaction); | 733 | err = journal_finish_inode_data_buffers(journal, commit_transaction); |
731 | if (err) { | 734 | if (err) { |
732 | printk(KERN_WARNING | 735 | printk(KERN_WARNING |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 17af879e6e9e..ac0d027595d0 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -814,7 +814,7 @@ static journal_t * journal_init_common (void) | |||
814 | journal_t *journal; | 814 | journal_t *journal; |
815 | int err; | 815 | int err; |
816 | 816 | ||
817 | journal = kzalloc(sizeof(*journal), GFP_KERNEL|__GFP_NOFAIL); | 817 | journal = kzalloc(sizeof(*journal), GFP_KERNEL); |
818 | if (!journal) | 818 | if (!journal) |
819 | goto fail; | 819 | goto fail; |
820 | 820 | ||
diff --git a/fs/namei.c b/fs/namei.c index 68921d9b5302..b55440baf7ab 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -232,6 +232,7 @@ int generic_permission(struct inode *inode, int mask, | |||
232 | /* | 232 | /* |
233 | * Searching includes executable on directories, else just read. | 233 | * Searching includes executable on directories, else just read. |
234 | */ | 234 | */ |
235 | mask &= MAY_READ | MAY_WRITE | MAY_EXEC; | ||
235 | if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE))) | 236 | if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE))) |
236 | if (capable(CAP_DAC_READ_SEARCH)) | 237 | if (capable(CAP_DAC_READ_SEARCH)) |
237 | return 0; | 238 | return 0; |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 2c5ace4f00a7..3c7f03b669fb 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1615,6 +1615,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1615 | goto out; | 1615 | goto out; |
1616 | 1616 | ||
1617 | new_dentry = dentry; | 1617 | new_dentry = dentry; |
1618 | rehash = NULL; | ||
1618 | new_inode = NULL; | 1619 | new_inode = NULL; |
1619 | } | 1620 | } |
1620 | } | 1621 | } |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 7c2e337d05af..c194793b642b 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -780,12 +780,9 @@ static inline int nfsd_dosync(struct file *filp, struct dentry *dp, | |||
780 | int (*fsync) (struct file *, struct dentry *, int); | 780 | int (*fsync) (struct file *, struct dentry *, int); |
781 | int err; | 781 | int err; |
782 | 782 | ||
783 | err = filemap_fdatawrite(inode->i_mapping); | 783 | err = filemap_write_and_wait(inode->i_mapping); |
784 | if (err == 0 && fop && (fsync = fop->fsync)) | 784 | if (err == 0 && fop && (fsync = fop->fsync)) |
785 | err = fsync(filp, dp, 0); | 785 | err = fsync(filp, dp, 0); |
786 | if (err == 0) | ||
787 | err = filemap_fdatawait(inode->i_mapping); | ||
788 | |||
789 | return err; | 786 | return err; |
790 | } | 787 | } |
791 | 788 | ||
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index f4a14ea2ed9c..effdbdbe6c11 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
@@ -417,8 +417,8 @@ __u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *bmap, | |||
417 | 417 | ||
418 | key = page_index(bh->b_page) << (PAGE_CACHE_SHIFT - | 418 | key = page_index(bh->b_page) << (PAGE_CACHE_SHIFT - |
419 | bmap->b_inode->i_blkbits); | 419 | bmap->b_inode->i_blkbits); |
420 | for (pbh = page_buffers(bh->b_page); pbh != bh; | 420 | for (pbh = page_buffers(bh->b_page); pbh != bh; pbh = pbh->b_this_page) |
421 | pbh = pbh->b_this_page, key++); | 421 | key++; |
422 | 422 | ||
423 | return key; | 423 | return key; |
424 | } | 424 | } |
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index d5ad54e204a5..18737818db63 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c | |||
@@ -328,19 +328,24 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, | |||
328 | tnicps += nicps; | 328 | tnicps += nicps; |
329 | nilfs_mdt_mark_buffer_dirty(cp_bh); | 329 | nilfs_mdt_mark_buffer_dirty(cp_bh); |
330 | nilfs_mdt_mark_dirty(cpfile); | 330 | nilfs_mdt_mark_dirty(cpfile); |
331 | if (!nilfs_cpfile_is_in_first(cpfile, cno) && | 331 | if (!nilfs_cpfile_is_in_first(cpfile, cno)) { |
332 | (count = nilfs_cpfile_block_sub_valid_checkpoints( | 332 | count = |
333 | cpfile, cp_bh, kaddr, nicps)) == 0) { | 333 | nilfs_cpfile_block_sub_valid_checkpoints( |
334 | /* make hole */ | 334 | cpfile, cp_bh, kaddr, nicps); |
335 | kunmap_atomic(kaddr, KM_USER0); | 335 | if (count == 0) { |
336 | brelse(cp_bh); | 336 | /* make hole */ |
337 | ret = nilfs_cpfile_delete_checkpoint_block( | 337 | kunmap_atomic(kaddr, KM_USER0); |
338 | cpfile, cno); | 338 | brelse(cp_bh); |
339 | if (ret == 0) | 339 | ret = |
340 | continue; | 340 | nilfs_cpfile_delete_checkpoint_block( |
341 | printk(KERN_ERR "%s: cannot delete block\n", | 341 | cpfile, cno); |
342 | __func__); | 342 | if (ret == 0) |
343 | break; | 343 | continue; |
344 | printk(KERN_ERR | ||
345 | "%s: cannot delete block\n", | ||
346 | __func__); | ||
347 | break; | ||
348 | } | ||
344 | } | 349 | } |
345 | } | 350 | } |
346 | 351 | ||
diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c index d369ac718277..236753df5cdf 100644 --- a/fs/nilfs2/direct.c +++ b/fs/nilfs2/direct.c | |||
@@ -51,11 +51,11 @@ static int nilfs_direct_lookup(const struct nilfs_bmap *bmap, | |||
51 | struct nilfs_direct *direct; | 51 | struct nilfs_direct *direct; |
52 | __u64 ptr; | 52 | __u64 ptr; |
53 | 53 | ||
54 | direct = (struct nilfs_direct *)bmap; | 54 | direct = (struct nilfs_direct *)bmap; /* XXX: use macro for level 1 */ |
55 | if ((key > NILFS_DIRECT_KEY_MAX) || | 55 | if (key > NILFS_DIRECT_KEY_MAX || level != 1) |
56 | (level != 1) || /* XXX: use macro for level 1 */ | 56 | return -ENOENT; |
57 | ((ptr = nilfs_direct_get_ptr(direct, key)) == | 57 | ptr = nilfs_direct_get_ptr(direct, key); |
58 | NILFS_BMAP_INVALID_PTR)) | 58 | if (ptr == NILFS_BMAP_INVALID_PTR) |
59 | return -ENOENT; | 59 | return -ENOENT; |
60 | 60 | ||
61 | if (ptrp != NULL) | 61 | if (ptrp != NULL) |
@@ -73,9 +73,10 @@ static int nilfs_direct_lookup_contig(const struct nilfs_bmap *bmap, | |||
73 | sector_t blocknr; | 73 | sector_t blocknr; |
74 | int ret, cnt; | 74 | int ret, cnt; |
75 | 75 | ||
76 | if (key > NILFS_DIRECT_KEY_MAX || | 76 | if (key > NILFS_DIRECT_KEY_MAX) |
77 | (ptr = nilfs_direct_get_ptr(direct, key)) == | 77 | return -ENOENT; |
78 | NILFS_BMAP_INVALID_PTR) | 78 | ptr = nilfs_direct_get_ptr(direct, key); |
79 | if (ptr == NILFS_BMAP_INVALID_PTR) | ||
79 | return -ENOENT; | 80 | return -ENOENT; |
80 | 81 | ||
81 | if (NILFS_BMAP_USE_VBN(bmap)) { | 82 | if (NILFS_BMAP_USE_VBN(bmap)) { |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index f6af76042d80..d6b2b83de363 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -480,7 +480,7 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, | |||
480 | unsigned int cmd, void __user *argp) | 480 | unsigned int cmd, void __user *argp) |
481 | { | 481 | { |
482 | struct nilfs_argv argv[5]; | 482 | struct nilfs_argv argv[5]; |
483 | const static size_t argsz[5] = { | 483 | static const size_t argsz[5] = { |
484 | sizeof(struct nilfs_vdesc), | 484 | sizeof(struct nilfs_vdesc), |
485 | sizeof(struct nilfs_period), | 485 | sizeof(struct nilfs_period), |
486 | sizeof(__u64), | 486 | sizeof(__u64), |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 3d30a1c974a8..06ccf6a86d35 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1772,7 +1772,8 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry, | |||
1772 | loff_t *ppos, | 1772 | loff_t *ppos, |
1773 | size_t count, | 1773 | size_t count, |
1774 | int appending, | 1774 | int appending, |
1775 | int *direct_io) | 1775 | int *direct_io, |
1776 | int *has_refcount) | ||
1776 | { | 1777 | { |
1777 | int ret = 0, meta_level = 0; | 1778 | int ret = 0, meta_level = 0; |
1778 | struct inode *inode = dentry->d_inode; | 1779 | struct inode *inode = dentry->d_inode; |
@@ -1833,6 +1834,8 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry, | |||
1833 | saved_pos, | 1834 | saved_pos, |
1834 | count, | 1835 | count, |
1835 | &meta_level); | 1836 | &meta_level); |
1837 | if (has_refcount) | ||
1838 | *has_refcount = 1; | ||
1836 | } | 1839 | } |
1837 | 1840 | ||
1838 | if (ret < 0) { | 1841 | if (ret < 0) { |
@@ -1856,6 +1859,10 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry, | |||
1856 | break; | 1859 | break; |
1857 | } | 1860 | } |
1858 | 1861 | ||
1862 | if (has_refcount && *has_refcount == 1) { | ||
1863 | *direct_io = 0; | ||
1864 | break; | ||
1865 | } | ||
1859 | /* | 1866 | /* |
1860 | * Allowing concurrent direct writes means | 1867 | * Allowing concurrent direct writes means |
1861 | * i_size changes wouldn't be synchronized, so | 1868 | * i_size changes wouldn't be synchronized, so |
@@ -1899,7 +1906,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
1899 | loff_t pos) | 1906 | loff_t pos) |
1900 | { | 1907 | { |
1901 | int ret, direct_io, appending, rw_level, have_alloc_sem = 0; | 1908 | int ret, direct_io, appending, rw_level, have_alloc_sem = 0; |
1902 | int can_do_direct; | 1909 | int can_do_direct, has_refcount = 0; |
1903 | ssize_t written = 0; | 1910 | ssize_t written = 0; |
1904 | size_t ocount; /* original count */ | 1911 | size_t ocount; /* original count */ |
1905 | size_t count; /* after file limit checks */ | 1912 | size_t count; /* after file limit checks */ |
@@ -1942,7 +1949,7 @@ relock: | |||
1942 | can_do_direct = direct_io; | 1949 | can_do_direct = direct_io; |
1943 | ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos, | 1950 | ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos, |
1944 | iocb->ki_left, appending, | 1951 | iocb->ki_left, appending, |
1945 | &can_do_direct); | 1952 | &can_do_direct, &has_refcount); |
1946 | if (ret < 0) { | 1953 | if (ret < 0) { |
1947 | mlog_errno(ret); | 1954 | mlog_errno(ret); |
1948 | goto out; | 1955 | goto out; |
@@ -2006,14 +2013,16 @@ out_dio: | |||
2006 | /* buffered aio wouldn't have proper lock coverage today */ | 2013 | /* buffered aio wouldn't have proper lock coverage today */ |
2007 | BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); | 2014 | BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); |
2008 | 2015 | ||
2009 | if ((file->f_flags & O_DSYNC && !direct_io) || IS_SYNC(inode)) { | 2016 | if ((file->f_flags & O_DSYNC && !direct_io) || IS_SYNC(inode) || |
2017 | (file->f_flags & O_DIRECT && has_refcount)) { | ||
2010 | ret = filemap_fdatawrite_range(file->f_mapping, pos, | 2018 | ret = filemap_fdatawrite_range(file->f_mapping, pos, |
2011 | pos + count - 1); | 2019 | pos + count - 1); |
2012 | if (ret < 0) | 2020 | if (ret < 0) |
2013 | written = ret; | 2021 | written = ret; |
2014 | 2022 | ||
2015 | if (!ret && (old_size != i_size_read(inode) || | 2023 | if (!ret && (old_size != i_size_read(inode) || |
2016 | old_clusters != OCFS2_I(inode)->ip_clusters)) { | 2024 | old_clusters != OCFS2_I(inode)->ip_clusters || |
2025 | has_refcount)) { | ||
2017 | ret = jbd2_journal_force_commit(osb->journal->j_journal); | 2026 | ret = jbd2_journal_force_commit(osb->journal->j_journal); |
2018 | if (ret < 0) | 2027 | if (ret < 0) |
2019 | written = ret; | 2028 | written = ret; |
@@ -2062,7 +2071,7 @@ static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, | |||
2062 | int ret; | 2071 | int ret; |
2063 | 2072 | ||
2064 | ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, &sd->pos, | 2073 | ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, &sd->pos, |
2065 | sd->total_len, 0, NULL); | 2074 | sd->total_len, 0, NULL, NULL); |
2066 | if (ret < 0) { | 2075 | if (ret < 0) { |
2067 | mlog_errno(ret); | 2076 | mlog_errno(ret); |
2068 | return ret; | 2077 | return ret; |
diff --git a/fs/proc/array.c b/fs/proc/array.c index f560325c444f..13b5d0708175 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -327,94 +327,6 @@ static inline void task_context_switch_counts(struct seq_file *m, | |||
327 | p->nivcsw); | 327 | p->nivcsw); |
328 | } | 328 | } |
329 | 329 | ||
330 | #ifdef CONFIG_MMU | ||
331 | |||
332 | struct stack_stats { | ||
333 | struct vm_area_struct *vma; | ||
334 | unsigned long startpage; | ||
335 | unsigned long usage; | ||
336 | }; | ||
337 | |||
338 | static int stack_usage_pte_range(pmd_t *pmd, unsigned long addr, | ||
339 | unsigned long end, struct mm_walk *walk) | ||
340 | { | ||
341 | struct stack_stats *ss = walk->private; | ||
342 | struct vm_area_struct *vma = ss->vma; | ||
343 | pte_t *pte, ptent; | ||
344 | spinlock_t *ptl; | ||
345 | int ret = 0; | ||
346 | |||
347 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); | ||
348 | for (; addr != end; pte++, addr += PAGE_SIZE) { | ||
349 | ptent = *pte; | ||
350 | |||
351 | #ifdef CONFIG_STACK_GROWSUP | ||
352 | if (pte_present(ptent) || is_swap_pte(ptent)) | ||
353 | ss->usage = addr - ss->startpage + PAGE_SIZE; | ||
354 | #else | ||
355 | if (pte_present(ptent) || is_swap_pte(ptent)) { | ||
356 | ss->usage = ss->startpage - addr + PAGE_SIZE; | ||
357 | pte++; | ||
358 | ret = 1; | ||
359 | break; | ||
360 | } | ||
361 | #endif | ||
362 | } | ||
363 | pte_unmap_unlock(pte - 1, ptl); | ||
364 | cond_resched(); | ||
365 | return ret; | ||
366 | } | ||
367 | |||
368 | static inline unsigned long get_stack_usage_in_bytes(struct vm_area_struct *vma, | ||
369 | struct task_struct *task) | ||
370 | { | ||
371 | struct stack_stats ss; | ||
372 | struct mm_walk stack_walk = { | ||
373 | .pmd_entry = stack_usage_pte_range, | ||
374 | .mm = vma->vm_mm, | ||
375 | .private = &ss, | ||
376 | }; | ||
377 | |||
378 | if (!vma->vm_mm || is_vm_hugetlb_page(vma)) | ||
379 | return 0; | ||
380 | |||
381 | ss.vma = vma; | ||
382 | ss.startpage = task->stack_start & PAGE_MASK; | ||
383 | ss.usage = 0; | ||
384 | |||
385 | #ifdef CONFIG_STACK_GROWSUP | ||
386 | walk_page_range(KSTK_ESP(task) & PAGE_MASK, vma->vm_end, | ||
387 | &stack_walk); | ||
388 | #else | ||
389 | walk_page_range(vma->vm_start, (KSTK_ESP(task) & PAGE_MASK) + PAGE_SIZE, | ||
390 | &stack_walk); | ||
391 | #endif | ||
392 | return ss.usage; | ||
393 | } | ||
394 | |||
395 | static inline void task_show_stack_usage(struct seq_file *m, | ||
396 | struct task_struct *task) | ||
397 | { | ||
398 | struct vm_area_struct *vma; | ||
399 | struct mm_struct *mm = get_task_mm(task); | ||
400 | |||
401 | if (mm) { | ||
402 | down_read(&mm->mmap_sem); | ||
403 | vma = find_vma(mm, task->stack_start); | ||
404 | if (vma) | ||
405 | seq_printf(m, "Stack usage:\t%lu kB\n", | ||
406 | get_stack_usage_in_bytes(vma, task) >> 10); | ||
407 | |||
408 | up_read(&mm->mmap_sem); | ||
409 | mmput(mm); | ||
410 | } | ||
411 | } | ||
412 | #else | ||
413 | static void task_show_stack_usage(struct seq_file *m, struct task_struct *task) | ||
414 | { | ||
415 | } | ||
416 | #endif /* CONFIG_MMU */ | ||
417 | |||
418 | static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) | 330 | static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) |
419 | { | 331 | { |
420 | seq_printf(m, "Cpus_allowed:\t"); | 332 | seq_printf(m, "Cpus_allowed:\t"); |
@@ -445,7 +357,6 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, | |||
445 | task_show_regs(m, task); | 357 | task_show_regs(m, task); |
446 | #endif | 358 | #endif |
447 | task_context_switch_counts(m, task); | 359 | task_context_switch_counts(m, task); |
448 | task_show_stack_usage(m, task); | ||
449 | return 0; | 360 | return 0; |
450 | } | 361 | } |
451 | 362 | ||
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 47c03f4336b8..f277c4a111cb 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -361,12 +361,11 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | |||
361 | if (!pte_present(ptent)) | 361 | if (!pte_present(ptent)) |
362 | continue; | 362 | continue; |
363 | 363 | ||
364 | mss->resident += PAGE_SIZE; | ||
365 | |||
366 | page = vm_normal_page(vma, addr, ptent); | 364 | page = vm_normal_page(vma, addr, ptent); |
367 | if (!page) | 365 | if (!page) |
368 | continue; | 366 | continue; |
369 | 367 | ||
368 | mss->resident += PAGE_SIZE; | ||
370 | /* Accumulate the size in pages that have been accessed. */ | 369 | /* Accumulate the size in pages that have been accessed. */ |
371 | if (pte_young(ptent) || PageReferenced(page)) | 370 | if (pte_young(ptent) || PageReferenced(page)) |
372 | mss->referenced += PAGE_SIZE; | 371 | mss->referenced += PAGE_SIZE; |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index dea86abdf2e7..3fc62b097bed 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -1377,6 +1377,9 @@ static void inode_sub_rsv_space(struct inode *inode, qsize_t number) | |||
1377 | static qsize_t inode_get_rsv_space(struct inode *inode) | 1377 | static qsize_t inode_get_rsv_space(struct inode *inode) |
1378 | { | 1378 | { |
1379 | qsize_t ret; | 1379 | qsize_t ret; |
1380 | |||
1381 | if (!inode->i_sb->dq_op->get_reserved_space) | ||
1382 | return 0; | ||
1380 | spin_lock(&inode->i_lock); | 1383 | spin_lock(&inode->i_lock); |
1381 | ret = *inode_reserved_space(inode); | 1384 | ret = *inode_reserved_space(inode); |
1382 | spin_unlock(&inode->i_lock); | 1385 | spin_unlock(&inode->i_lock); |
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index 685495707181..65c872761177 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -1277,7 +1277,10 @@ int reiserfs_init_bitmap_cache(struct super_block *sb) | |||
1277 | struct reiserfs_bitmap_info *bitmap; | 1277 | struct reiserfs_bitmap_info *bitmap; |
1278 | unsigned int bmap_nr = reiserfs_bmap_count(sb); | 1278 | unsigned int bmap_nr = reiserfs_bmap_count(sb); |
1279 | 1279 | ||
1280 | /* Avoid lock recursion in fault case */ | ||
1281 | reiserfs_write_unlock(sb); | ||
1280 | bitmap = vmalloc(sizeof(*bitmap) * bmap_nr); | 1282 | bitmap = vmalloc(sizeof(*bitmap) * bmap_nr); |
1283 | reiserfs_write_lock(sb); | ||
1281 | if (bitmap == NULL) | 1284 | if (bitmap == NULL) |
1282 | return -ENOMEM; | 1285 | return -ENOMEM; |
1283 | 1286 | ||
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 290ae38fca8a..9087b10209e6 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -31,11 +31,12 @@ void reiserfs_delete_inode(struct inode *inode) | |||
31 | JOURNAL_PER_BALANCE_CNT * 2 + | 31 | JOURNAL_PER_BALANCE_CNT * 2 + |
32 | 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); | 32 | 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); |
33 | struct reiserfs_transaction_handle th; | 33 | struct reiserfs_transaction_handle th; |
34 | int depth; | ||
34 | int err; | 35 | int err; |
35 | 36 | ||
36 | truncate_inode_pages(&inode->i_data, 0); | 37 | truncate_inode_pages(&inode->i_data, 0); |
37 | 38 | ||
38 | reiserfs_write_lock(inode->i_sb); | 39 | depth = reiserfs_write_lock_once(inode->i_sb); |
39 | 40 | ||
40 | /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ | 41 | /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ |
41 | if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ | 42 | if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ |
@@ -74,7 +75,7 @@ void reiserfs_delete_inode(struct inode *inode) | |||
74 | out: | 75 | out: |
75 | clear_inode(inode); /* note this must go after the journal_end to prevent deadlock */ | 76 | clear_inode(inode); /* note this must go after the journal_end to prevent deadlock */ |
76 | inode->i_blocks = 0; | 77 | inode->i_blocks = 0; |
77 | reiserfs_write_unlock(inode->i_sb); | 78 | reiserfs_write_unlock_once(inode->i_sb, depth); |
78 | } | 79 | } |
79 | 80 | ||
80 | static void _make_cpu_key(struct cpu_key *key, int version, __u32 dirid, | 81 | static void _make_cpu_key(struct cpu_key *key, int version, __u32 dirid, |
@@ -3061,13 +3062,14 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb, | |||
3061 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | 3062 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) |
3062 | { | 3063 | { |
3063 | struct inode *inode = dentry->d_inode; | 3064 | struct inode *inode = dentry->d_inode; |
3064 | int error; | ||
3065 | unsigned int ia_valid; | 3065 | unsigned int ia_valid; |
3066 | int depth; | ||
3067 | int error; | ||
3066 | 3068 | ||
3067 | /* must be turned off for recursive notify_change calls */ | 3069 | /* must be turned off for recursive notify_change calls */ |
3068 | ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); | 3070 | ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); |
3069 | 3071 | ||
3070 | reiserfs_write_lock(inode->i_sb); | 3072 | depth = reiserfs_write_lock_once(inode->i_sb); |
3071 | if (attr->ia_valid & ATTR_SIZE) { | 3073 | if (attr->ia_valid & ATTR_SIZE) { |
3072 | /* version 2 items will be caught by the s_maxbytes check | 3074 | /* version 2 items will be caught by the s_maxbytes check |
3073 | ** done for us in vmtruncate | 3075 | ** done for us in vmtruncate |
@@ -3148,8 +3150,17 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
3148 | journal_end(&th, inode->i_sb, jbegin_count); | 3150 | journal_end(&th, inode->i_sb, jbegin_count); |
3149 | } | 3151 | } |
3150 | } | 3152 | } |
3151 | if (!error) | 3153 | if (!error) { |
3154 | /* | ||
3155 | * Relax the lock here, as it might truncate the | ||
3156 | * inode pages and wait for inode pages locks. | ||
3157 | * To release such page lock, the owner needs the | ||
3158 | * reiserfs lock | ||
3159 | */ | ||
3160 | reiserfs_write_unlock_once(inode->i_sb, depth); | ||
3152 | error = inode_setattr(inode, attr); | 3161 | error = inode_setattr(inode, attr); |
3162 | depth = reiserfs_write_lock_once(inode->i_sb); | ||
3163 | } | ||
3153 | } | 3164 | } |
3154 | 3165 | ||
3155 | if (!error && reiserfs_posixacl(inode->i_sb)) { | 3166 | if (!error && reiserfs_posixacl(inode->i_sb)) { |
@@ -3158,7 +3169,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
3158 | } | 3169 | } |
3159 | 3170 | ||
3160 | out: | 3171 | out: |
3161 | reiserfs_write_unlock(inode->i_sb); | 3172 | reiserfs_write_unlock_once(inode->i_sb, depth); |
3173 | |||
3162 | return error; | 3174 | return error; |
3163 | } | 3175 | } |
3164 | 3176 | ||
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index ace77451ceb1..f53505de0712 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -104,9 +104,10 @@ setflags_out: | |||
104 | err = put_user(inode->i_generation, (int __user *)arg); | 104 | err = put_user(inode->i_generation, (int __user *)arg); |
105 | break; | 105 | break; |
106 | case REISERFS_IOC_SETVERSION: | 106 | case REISERFS_IOC_SETVERSION: |
107 | if (!is_owner_or_cap(inode)) | 107 | if (!is_owner_or_cap(inode)) { |
108 | err = -EPERM; | 108 | err = -EPERM; |
109 | break; | 109 | break; |
110 | } | ||
110 | err = mnt_want_write(filp->f_path.mnt); | 111 | err = mnt_want_write(filp->f_path.mnt); |
111 | if (err) | 112 | if (err) |
112 | break; | 113 | break; |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 2f8a7e7b8dab..83ac4d3b3cb0 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -2009,10 +2009,11 @@ static int do_journal_release(struct reiserfs_transaction_handle *th, | |||
2009 | destroy_workqueue(commit_wq); | 2009 | destroy_workqueue(commit_wq); |
2010 | commit_wq = NULL; | 2010 | commit_wq = NULL; |
2011 | } | 2011 | } |
2012 | reiserfs_write_lock(sb); | ||
2013 | 2012 | ||
2014 | free_journal_ram(sb); | 2013 | free_journal_ram(sb); |
2015 | 2014 | ||
2015 | reiserfs_write_lock(sb); | ||
2016 | |||
2016 | return 0; | 2017 | return 0; |
2017 | } | 2018 | } |
2018 | 2019 | ||
@@ -2758,11 +2759,18 @@ int journal_init(struct super_block *sb, const char *j_dev_name, | |||
2758 | struct reiserfs_journal *journal; | 2759 | struct reiserfs_journal *journal; |
2759 | struct reiserfs_journal_list *jl; | 2760 | struct reiserfs_journal_list *jl; |
2760 | char b[BDEVNAME_SIZE]; | 2761 | char b[BDEVNAME_SIZE]; |
2762 | int ret; | ||
2761 | 2763 | ||
2764 | /* | ||
2765 | * Unlock here to avoid various RECLAIM-FS-ON <-> IN-RECLAIM-FS | ||
2766 | * dependency inversion warnings. | ||
2767 | */ | ||
2768 | reiserfs_write_unlock(sb); | ||
2762 | journal = SB_JOURNAL(sb) = vmalloc(sizeof(struct reiserfs_journal)); | 2769 | journal = SB_JOURNAL(sb) = vmalloc(sizeof(struct reiserfs_journal)); |
2763 | if (!journal) { | 2770 | if (!journal) { |
2764 | reiserfs_warning(sb, "journal-1256", | 2771 | reiserfs_warning(sb, "journal-1256", |
2765 | "unable to get memory for journal structure"); | 2772 | "unable to get memory for journal structure"); |
2773 | reiserfs_write_lock(sb); | ||
2766 | return 1; | 2774 | return 1; |
2767 | } | 2775 | } |
2768 | memset(journal, 0, sizeof(struct reiserfs_journal)); | 2776 | memset(journal, 0, sizeof(struct reiserfs_journal)); |
@@ -2771,10 +2779,12 @@ int journal_init(struct super_block *sb, const char *j_dev_name, | |||
2771 | INIT_LIST_HEAD(&journal->j_working_list); | 2779 | INIT_LIST_HEAD(&journal->j_working_list); |
2772 | INIT_LIST_HEAD(&journal->j_journal_list); | 2780 | INIT_LIST_HEAD(&journal->j_journal_list); |
2773 | journal->j_persistent_trans = 0; | 2781 | journal->j_persistent_trans = 0; |
2774 | if (reiserfs_allocate_list_bitmaps(sb, | 2782 | ret = reiserfs_allocate_list_bitmaps(sb, journal->j_list_bitmap, |
2775 | journal->j_list_bitmap, | 2783 | reiserfs_bmap_count(sb)); |
2776 | reiserfs_bmap_count(sb))) | 2784 | reiserfs_write_lock(sb); |
2785 | if (ret) | ||
2777 | goto free_and_return; | 2786 | goto free_and_return; |
2787 | |||
2778 | allocate_bitmap_nodes(sb); | 2788 | allocate_bitmap_nodes(sb); |
2779 | 2789 | ||
2780 | /* reserved for journal area support */ | 2790 | /* reserved for journal area support */ |
diff --git a/fs/reiserfs/lock.c b/fs/reiserfs/lock.c index ee2cfc0fd8a7..b87aa2c1afc1 100644 --- a/fs/reiserfs/lock.c +++ b/fs/reiserfs/lock.c | |||
@@ -86,3 +86,12 @@ void reiserfs_check_lock_depth(struct super_block *sb, char *caller) | |||
86 | reiserfs_panic(sb, "%s called without kernel lock held %d", | 86 | reiserfs_panic(sb, "%s called without kernel lock held %d", |
87 | caller); | 87 | caller); |
88 | } | 88 | } |
89 | |||
90 | #ifdef CONFIG_REISERFS_CHECK | ||
91 | void reiserfs_lock_check_recursive(struct super_block *sb) | ||
92 | { | ||
93 | struct reiserfs_sb_info *sb_i = REISERFS_SB(sb); | ||
94 | |||
95 | WARN_ONCE((sb_i->lock_depth > 0), "Unwanted recursive reiserfs lock!\n"); | ||
96 | } | ||
97 | #endif | ||
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index e296ff72a6cc..9d4dcf0b07cb 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -921,6 +921,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) | |||
921 | struct reiserfs_transaction_handle th; | 921 | struct reiserfs_transaction_handle th; |
922 | int jbegin_count; | 922 | int jbegin_count; |
923 | unsigned long savelink; | 923 | unsigned long savelink; |
924 | int depth; | ||
924 | 925 | ||
925 | inode = dentry->d_inode; | 926 | inode = dentry->d_inode; |
926 | 927 | ||
@@ -932,7 +933,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) | |||
932 | JOURNAL_PER_BALANCE_CNT * 2 + 2 + | 933 | JOURNAL_PER_BALANCE_CNT * 2 + 2 + |
933 | 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); | 934 | 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); |
934 | 935 | ||
935 | reiserfs_write_lock(dir->i_sb); | 936 | depth = reiserfs_write_lock_once(dir->i_sb); |
936 | retval = journal_begin(&th, dir->i_sb, jbegin_count); | 937 | retval = journal_begin(&th, dir->i_sb, jbegin_count); |
937 | if (retval) | 938 | if (retval) |
938 | goto out_unlink; | 939 | goto out_unlink; |
@@ -993,7 +994,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) | |||
993 | 994 | ||
994 | retval = journal_end(&th, dir->i_sb, jbegin_count); | 995 | retval = journal_end(&th, dir->i_sb, jbegin_count); |
995 | reiserfs_check_path(&path); | 996 | reiserfs_check_path(&path); |
996 | reiserfs_write_unlock(dir->i_sb); | 997 | reiserfs_write_unlock_once(dir->i_sb, depth); |
997 | return retval; | 998 | return retval; |
998 | 999 | ||
999 | end_unlink: | 1000 | end_unlink: |
@@ -1003,7 +1004,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) | |||
1003 | if (err) | 1004 | if (err) |
1004 | retval = err; | 1005 | retval = err; |
1005 | out_unlink: | 1006 | out_unlink: |
1006 | reiserfs_write_unlock(dir->i_sb); | 1007 | reiserfs_write_unlock_once(dir->i_sb, depth); |
1007 | return retval; | 1008 | return retval; |
1008 | } | 1009 | } |
1009 | 1010 | ||
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 8c7033a8b67e..81f09fab8ae4 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -83,7 +83,8 @@ static int xattr_unlink(struct inode *dir, struct dentry *dentry) | |||
83 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 83 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
84 | vfs_dq_init(dir); | 84 | vfs_dq_init(dir); |
85 | 85 | ||
86 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); | 86 | reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex, |
87 | I_MUTEX_CHILD, dir->i_sb); | ||
87 | error = dir->i_op->unlink(dir, dentry); | 88 | error = dir->i_op->unlink(dir, dentry); |
88 | mutex_unlock(&dentry->d_inode->i_mutex); | 89 | mutex_unlock(&dentry->d_inode->i_mutex); |
89 | 90 | ||
@@ -98,7 +99,8 @@ static int xattr_rmdir(struct inode *dir, struct dentry *dentry) | |||
98 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 99 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
99 | vfs_dq_init(dir); | 100 | vfs_dq_init(dir); |
100 | 101 | ||
101 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); | 102 | reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex, |
103 | I_MUTEX_CHILD, dir->i_sb); | ||
102 | dentry_unhash(dentry); | 104 | dentry_unhash(dentry); |
103 | error = dir->i_op->rmdir(dir, dentry); | 105 | error = dir->i_op->rmdir(dir, dentry); |
104 | if (!error) | 106 | if (!error) |
@@ -235,16 +237,22 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
235 | if (IS_PRIVATE(inode) || get_inode_sd_version(inode) == STAT_DATA_V1) | 237 | if (IS_PRIVATE(inode) || get_inode_sd_version(inode) == STAT_DATA_V1) |
236 | return 0; | 238 | return 0; |
237 | 239 | ||
240 | reiserfs_write_unlock(inode->i_sb); | ||
238 | dir = open_xa_dir(inode, XATTR_REPLACE); | 241 | dir = open_xa_dir(inode, XATTR_REPLACE); |
239 | if (IS_ERR(dir)) { | 242 | if (IS_ERR(dir)) { |
240 | err = PTR_ERR(dir); | 243 | err = PTR_ERR(dir); |
244 | reiserfs_write_lock(inode->i_sb); | ||
241 | goto out; | 245 | goto out; |
242 | } else if (!dir->d_inode) { | 246 | } else if (!dir->d_inode) { |
243 | err = 0; | 247 | err = 0; |
248 | reiserfs_write_lock(inode->i_sb); | ||
244 | goto out_dir; | 249 | goto out_dir; |
245 | } | 250 | } |
246 | 251 | ||
247 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); | 252 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); |
253 | |||
254 | reiserfs_write_lock(inode->i_sb); | ||
255 | |||
248 | buf.xadir = dir; | 256 | buf.xadir = dir; |
249 | err = reiserfs_readdir_dentry(dir, &buf, fill_with_dentries, &pos); | 257 | err = reiserfs_readdir_dentry(dir, &buf, fill_with_dentries, &pos); |
250 | while ((err == 0 || err == -ENOSPC) && buf.count) { | 258 | while ((err == 0 || err == -ENOSPC) && buf.count) { |
@@ -283,8 +291,9 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
283 | err = journal_begin(&th, inode->i_sb, blocks); | 291 | err = journal_begin(&th, inode->i_sb, blocks); |
284 | if (!err) { | 292 | if (!err) { |
285 | int jerror; | 293 | int jerror; |
286 | mutex_lock_nested(&dir->d_parent->d_inode->i_mutex, | 294 | reiserfs_mutex_lock_nested_safe( |
287 | I_MUTEX_XATTR); | 295 | &dir->d_parent->d_inode->i_mutex, |
296 | I_MUTEX_XATTR, inode->i_sb); | ||
288 | err = action(dir, data); | 297 | err = action(dir, data); |
289 | jerror = journal_end(&th, inode->i_sb, blocks); | 298 | jerror = journal_end(&th, inode->i_sb, blocks); |
290 | mutex_unlock(&dir->d_parent->d_inode->i_mutex); | 299 | mutex_unlock(&dir->d_parent->d_inode->i_mutex); |
@@ -443,7 +452,9 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) | |||
443 | } | 452 | } |
444 | 453 | ||
445 | if (dentry->d_inode) { | 454 | if (dentry->d_inode) { |
455 | reiserfs_write_lock(inode->i_sb); | ||
446 | err = xattr_unlink(xadir->d_inode, dentry); | 456 | err = xattr_unlink(xadir->d_inode, dentry); |
457 | reiserfs_write_unlock(inode->i_sb); | ||
447 | update_ctime(inode); | 458 | update_ctime(inode); |
448 | } | 459 | } |
449 | 460 | ||
@@ -477,15 +488,24 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
477 | if (get_inode_sd_version(inode) == STAT_DATA_V1) | 488 | if (get_inode_sd_version(inode) == STAT_DATA_V1) |
478 | return -EOPNOTSUPP; | 489 | return -EOPNOTSUPP; |
479 | 490 | ||
480 | if (!buffer) | 491 | reiserfs_write_unlock(inode->i_sb); |
481 | return lookup_and_delete_xattr(inode, name); | 492 | |
493 | if (!buffer) { | ||
494 | err = lookup_and_delete_xattr(inode, name); | ||
495 | reiserfs_write_lock(inode->i_sb); | ||
496 | return err; | ||
497 | } | ||
482 | 498 | ||
483 | dentry = xattr_lookup(inode, name, flags); | 499 | dentry = xattr_lookup(inode, name, flags); |
484 | if (IS_ERR(dentry)) | 500 | if (IS_ERR(dentry)) { |
501 | reiserfs_write_lock(inode->i_sb); | ||
485 | return PTR_ERR(dentry); | 502 | return PTR_ERR(dentry); |
503 | } | ||
486 | 504 | ||
487 | down_write(&REISERFS_I(inode)->i_xattr_sem); | 505 | down_write(&REISERFS_I(inode)->i_xattr_sem); |
488 | 506 | ||
507 | reiserfs_write_lock(inode->i_sb); | ||
508 | |||
489 | xahash = xattr_hash(buffer, buffer_size); | 509 | xahash = xattr_hash(buffer, buffer_size); |
490 | while (buffer_pos < buffer_size || buffer_pos == 0) { | 510 | while (buffer_pos < buffer_size || buffer_pos == 0) { |
491 | size_t chunk; | 511 | size_t chunk; |
@@ -540,8 +560,12 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
540 | .ia_size = buffer_size, | 560 | .ia_size = buffer_size, |
541 | .ia_valid = ATTR_SIZE | ATTR_CTIME, | 561 | .ia_valid = ATTR_SIZE | ATTR_CTIME, |
542 | }; | 562 | }; |
563 | |||
564 | reiserfs_write_unlock(inode->i_sb); | ||
543 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); | 565 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); |
544 | down_write(&dentry->d_inode->i_alloc_sem); | 566 | down_write(&dentry->d_inode->i_alloc_sem); |
567 | reiserfs_write_lock(inode->i_sb); | ||
568 | |||
545 | err = reiserfs_setattr(dentry, &newattrs); | 569 | err = reiserfs_setattr(dentry, &newattrs); |
546 | up_write(&dentry->d_inode->i_alloc_sem); | 570 | up_write(&dentry->d_inode->i_alloc_sem); |
547 | mutex_unlock(&dentry->d_inode->i_mutex); | 571 | mutex_unlock(&dentry->d_inode->i_mutex); |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index cc32e6ada67b..dd20a7883f0f 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -455,7 +455,9 @@ int reiserfs_acl_chmod(struct inode *inode) | |||
455 | return 0; | 455 | return 0; |
456 | } | 456 | } |
457 | 457 | ||
458 | reiserfs_write_unlock(inode->i_sb); | ||
458 | acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); | 459 | acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); |
460 | reiserfs_write_lock(inode->i_sb); | ||
459 | if (!acl) | 461 | if (!acl) |
460 | return 0; | 462 | return 0; |
461 | if (IS_ERR(acl)) | 463 | if (IS_ERR(acl)) |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index f05f2303a8b8..699f371b9f12 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -106,8 +106,10 @@ static struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd) | |||
106 | return NULL; | 106 | return NULL; |
107 | 107 | ||
108 | t = atomic_cmpxchg(&sd->s_active, v, v + 1); | 108 | t = atomic_cmpxchg(&sd->s_active, v, v + 1); |
109 | if (likely(t == v)) | 109 | if (likely(t == v)) { |
110 | rwsem_acquire_read(&sd->dep_map, 0, 1, _RET_IP_); | ||
110 | return sd; | 111 | return sd; |
112 | } | ||
111 | if (t < 0) | 113 | if (t < 0) |
112 | return NULL; | 114 | return NULL; |
113 | 115 | ||
@@ -130,6 +132,7 @@ static void sysfs_put_active(struct sysfs_dirent *sd) | |||
130 | if (unlikely(!sd)) | 132 | if (unlikely(!sd)) |
131 | return; | 133 | return; |
132 | 134 | ||
135 | rwsem_release(&sd->dep_map, 1, _RET_IP_); | ||
133 | v = atomic_dec_return(&sd->s_active); | 136 | v = atomic_dec_return(&sd->s_active); |
134 | if (likely(v != SD_DEACTIVATED_BIAS)) | 137 | if (likely(v != SD_DEACTIVATED_BIAS)) |
135 | return; | 138 | return; |
@@ -194,15 +197,21 @@ static void sysfs_deactivate(struct sysfs_dirent *sd) | |||
194 | BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED)); | 197 | BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED)); |
195 | sd->s_sibling = (void *)&wait; | 198 | sd->s_sibling = (void *)&wait; |
196 | 199 | ||
200 | rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_); | ||
197 | /* atomic_add_return() is a mb(), put_active() will always see | 201 | /* atomic_add_return() is a mb(), put_active() will always see |
198 | * the updated sd->s_sibling. | 202 | * the updated sd->s_sibling. |
199 | */ | 203 | */ |
200 | v = atomic_add_return(SD_DEACTIVATED_BIAS, &sd->s_active); | 204 | v = atomic_add_return(SD_DEACTIVATED_BIAS, &sd->s_active); |
201 | 205 | ||
202 | if (v != SD_DEACTIVATED_BIAS) | 206 | if (v != SD_DEACTIVATED_BIAS) { |
207 | lock_contended(&sd->dep_map, _RET_IP_); | ||
203 | wait_for_completion(&wait); | 208 | wait_for_completion(&wait); |
209 | } | ||
204 | 210 | ||
205 | sd->s_sibling = NULL; | 211 | sd->s_sibling = NULL; |
212 | |||
213 | lock_acquired(&sd->dep_map, _RET_IP_); | ||
214 | rwsem_release(&sd->dep_map, 1, _RET_IP_); | ||
206 | } | 215 | } |
207 | 216 | ||
208 | static int sysfs_alloc_ino(ino_t *pino) | 217 | static int sysfs_alloc_ino(ino_t *pino) |
@@ -345,6 +354,7 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type) | |||
345 | 354 | ||
346 | atomic_set(&sd->s_count, 1); | 355 | atomic_set(&sd->s_count, 1); |
347 | atomic_set(&sd->s_active, 0); | 356 | atomic_set(&sd->s_active, 0); |
357 | sysfs_dirent_init_lockdep(sd); | ||
348 | 358 | ||
349 | sd->s_name = name; | 359 | sd->s_name = name; |
350 | sd->s_mode = mode; | 360 | sd->s_mode = mode; |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index ca52e7b9d8f8..cdd9377a6e06 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -8,6 +8,7 @@ | |||
8 | * This file is released under the GPLv2. | 8 | * This file is released under the GPLv2. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/lockdep.h> | ||
11 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
12 | 13 | ||
13 | struct sysfs_open_dirent; | 14 | struct sysfs_open_dirent; |
@@ -50,6 +51,9 @@ struct sysfs_inode_attrs { | |||
50 | struct sysfs_dirent { | 51 | struct sysfs_dirent { |
51 | atomic_t s_count; | 52 | atomic_t s_count; |
52 | atomic_t s_active; | 53 | atomic_t s_active; |
54 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
55 | struct lockdep_map dep_map; | ||
56 | #endif | ||
53 | struct sysfs_dirent *s_parent; | 57 | struct sysfs_dirent *s_parent; |
54 | struct sysfs_dirent *s_sibling; | 58 | struct sysfs_dirent *s_sibling; |
55 | const char *s_name; | 59 | const char *s_name; |
@@ -84,6 +88,17 @@ static inline unsigned int sysfs_type(struct sysfs_dirent *sd) | |||
84 | return sd->s_flags & SYSFS_TYPE_MASK; | 88 | return sd->s_flags & SYSFS_TYPE_MASK; |
85 | } | 89 | } |
86 | 90 | ||
91 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
92 | #define sysfs_dirent_init_lockdep(sd) \ | ||
93 | do { \ | ||
94 | static struct lock_class_key __key; \ | ||
95 | \ | ||
96 | lockdep_init_map(&sd->dep_map, "s_active", &__key, 0); \ | ||
97 | } while(0) | ||
98 | #else | ||
99 | #define sysfs_dirent_init_lockdep(sd) do {} while(0) | ||
100 | #endif | ||
101 | |||
87 | /* | 102 | /* |
88 | * Context structure to be used while adding/removing nodes. | 103 | * Context structure to be used while adding/removing nodes. |
89 | */ | 104 | */ |
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c index 2512125dfa7c..883ca5ab8af5 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/linux-2.6/xfs_acl.c | |||
@@ -251,8 +251,9 @@ xfs_set_mode(struct inode *inode, mode_t mode) | |||
251 | if (mode != inode->i_mode) { | 251 | if (mode != inode->i_mode) { |
252 | struct iattr iattr; | 252 | struct iattr iattr; |
253 | 253 | ||
254 | iattr.ia_valid = ATTR_MODE; | 254 | iattr.ia_valid = ATTR_MODE | ATTR_CTIME; |
255 | iattr.ia_mode = mode; | 255 | iattr.ia_mode = mode; |
256 | iattr.ia_ctime = current_fs_time(inode->i_sb); | ||
256 | 257 | ||
257 | error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL); | 258 | error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL); |
258 | } | 259 | } |
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h index c40834bdee58..c22a608321a3 100644 --- a/fs/xfs/linux-2.6/xfs_trace.h +++ b/fs/xfs/linux-2.6/xfs_trace.h | |||
@@ -33,51 +33,55 @@ struct xfs_dquot; | |||
33 | struct xlog_ticket; | 33 | struct xlog_ticket; |
34 | struct log; | 34 | struct log; |
35 | 35 | ||
36 | DECLARE_EVENT_CLASS(xfs_attr_list_class, | ||
37 | TP_PROTO(struct xfs_attr_list_context *ctx), | ||
38 | TP_ARGS(ctx), | ||
39 | TP_STRUCT__entry( | ||
40 | __field(dev_t, dev) | ||
41 | __field(xfs_ino_t, ino) | ||
42 | __field(u32, hashval) | ||
43 | __field(u32, blkno) | ||
44 | __field(u32, offset) | ||
45 | __field(void *, alist) | ||
46 | __field(int, bufsize) | ||
47 | __field(int, count) | ||
48 | __field(int, firstu) | ||
49 | __field(int, dupcnt) | ||
50 | __field(int, flags) | ||
51 | ), | ||
52 | TP_fast_assign( | ||
53 | __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev; | ||
54 | __entry->ino = ctx->dp->i_ino; | ||
55 | __entry->hashval = ctx->cursor->hashval; | ||
56 | __entry->blkno = ctx->cursor->blkno; | ||
57 | __entry->offset = ctx->cursor->offset; | ||
58 | __entry->alist = ctx->alist; | ||
59 | __entry->bufsize = ctx->bufsize; | ||
60 | __entry->count = ctx->count; | ||
61 | __entry->firstu = ctx->firstu; | ||
62 | __entry->flags = ctx->flags; | ||
63 | ), | ||
64 | TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u " | ||
65 | "alist 0x%p size %u count %u firstu %u flags %d %s", | ||
66 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
67 | __entry->ino, | ||
68 | __entry->hashval, | ||
69 | __entry->blkno, | ||
70 | __entry->offset, | ||
71 | __entry->dupcnt, | ||
72 | __entry->alist, | ||
73 | __entry->bufsize, | ||
74 | __entry->count, | ||
75 | __entry->firstu, | ||
76 | __entry->flags, | ||
77 | __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS) | ||
78 | ) | ||
79 | ) | ||
80 | |||
36 | #define DEFINE_ATTR_LIST_EVENT(name) \ | 81 | #define DEFINE_ATTR_LIST_EVENT(name) \ |
37 | TRACE_EVENT(name, \ | 82 | DEFINE_EVENT(xfs_attr_list_class, name, \ |
38 | TP_PROTO(struct xfs_attr_list_context *ctx), \ | 83 | TP_PROTO(struct xfs_attr_list_context *ctx), \ |
39 | TP_ARGS(ctx), \ | 84 | TP_ARGS(ctx)) |
40 | TP_STRUCT__entry( \ | ||
41 | __field(dev_t, dev) \ | ||
42 | __field(xfs_ino_t, ino) \ | ||
43 | __field(u32, hashval) \ | ||
44 | __field(u32, blkno) \ | ||
45 | __field(u32, offset) \ | ||
46 | __field(void *, alist) \ | ||
47 | __field(int, bufsize) \ | ||
48 | __field(int, count) \ | ||
49 | __field(int, firstu) \ | ||
50 | __field(int, dupcnt) \ | ||
51 | __field(int, flags) \ | ||
52 | ), \ | ||
53 | TP_fast_assign( \ | ||
54 | __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev; \ | ||
55 | __entry->ino = ctx->dp->i_ino; \ | ||
56 | __entry->hashval = ctx->cursor->hashval; \ | ||
57 | __entry->blkno = ctx->cursor->blkno; \ | ||
58 | __entry->offset = ctx->cursor->offset; \ | ||
59 | __entry->alist = ctx->alist; \ | ||
60 | __entry->bufsize = ctx->bufsize; \ | ||
61 | __entry->count = ctx->count; \ | ||
62 | __entry->firstu = ctx->firstu; \ | ||
63 | __entry->flags = ctx->flags; \ | ||
64 | ), \ | ||
65 | TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u " \ | ||
66 | "alist 0x%p size %u count %u firstu %u flags %d %s", \ | ||
67 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
68 | __entry->ino, \ | ||
69 | __entry->hashval, \ | ||
70 | __entry->blkno, \ | ||
71 | __entry->offset, \ | ||
72 | __entry->dupcnt, \ | ||
73 | __entry->alist, \ | ||
74 | __entry->bufsize, \ | ||
75 | __entry->count, \ | ||
76 | __entry->firstu, \ | ||
77 | __entry->flags, \ | ||
78 | __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS) \ | ||
79 | ) \ | ||
80 | ) | ||
81 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf); | 85 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf); |
82 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all); | 86 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all); |
83 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf); | 87 | DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf); |
@@ -178,91 +182,99 @@ TRACE_EVENT(xfs_iext_insert, | |||
178 | (char *)__entry->caller_ip) | 182 | (char *)__entry->caller_ip) |
179 | ); | 183 | ); |
180 | 184 | ||
185 | DECLARE_EVENT_CLASS(xfs_bmap_class, | ||
186 | TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, | ||
187 | unsigned long caller_ip), | ||
188 | TP_ARGS(ip, idx, state, caller_ip), | ||
189 | TP_STRUCT__entry( | ||
190 | __field(dev_t, dev) | ||
191 | __field(xfs_ino_t, ino) | ||
192 | __field(xfs_extnum_t, idx) | ||
193 | __field(xfs_fileoff_t, startoff) | ||
194 | __field(xfs_fsblock_t, startblock) | ||
195 | __field(xfs_filblks_t, blockcount) | ||
196 | __field(xfs_exntst_t, state) | ||
197 | __field(int, bmap_state) | ||
198 | __field(unsigned long, caller_ip) | ||
199 | ), | ||
200 | TP_fast_assign( | ||
201 | struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ? | ||
202 | ip->i_afp : &ip->i_df; | ||
203 | struct xfs_bmbt_irec r; | ||
204 | |||
205 | xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r); | ||
206 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
207 | __entry->ino = ip->i_ino; | ||
208 | __entry->idx = idx; | ||
209 | __entry->startoff = r.br_startoff; | ||
210 | __entry->startblock = r.br_startblock; | ||
211 | __entry->blockcount = r.br_blockcount; | ||
212 | __entry->state = r.br_state; | ||
213 | __entry->bmap_state = state; | ||
214 | __entry->caller_ip = caller_ip; | ||
215 | ), | ||
216 | TP_printk("dev %d:%d ino 0x%llx state %s idx %ld " | ||
217 | "offset %lld block %s count %lld flag %d caller %pf", | ||
218 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
219 | __entry->ino, | ||
220 | __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS), | ||
221 | (long)__entry->idx, | ||
222 | __entry->startoff, | ||
223 | xfs_fmtfsblock(__entry->startblock), | ||
224 | __entry->blockcount, | ||
225 | __entry->state, | ||
226 | (char *)__entry->caller_ip) | ||
227 | ) | ||
228 | |||
181 | #define DEFINE_BMAP_EVENT(name) \ | 229 | #define DEFINE_BMAP_EVENT(name) \ |
182 | TRACE_EVENT(name, \ | 230 | DEFINE_EVENT(xfs_bmap_class, name, \ |
183 | TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \ | 231 | TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \ |
184 | unsigned long caller_ip), \ | 232 | unsigned long caller_ip), \ |
185 | TP_ARGS(ip, idx, state, caller_ip), \ | 233 | TP_ARGS(ip, idx, state, caller_ip)) |
186 | TP_STRUCT__entry( \ | ||
187 | __field(dev_t, dev) \ | ||
188 | __field(xfs_ino_t, ino) \ | ||
189 | __field(xfs_extnum_t, idx) \ | ||
190 | __field(xfs_fileoff_t, startoff) \ | ||
191 | __field(xfs_fsblock_t, startblock) \ | ||
192 | __field(xfs_filblks_t, blockcount) \ | ||
193 | __field(xfs_exntst_t, state) \ | ||
194 | __field(int, bmap_state) \ | ||
195 | __field(unsigned long, caller_ip) \ | ||
196 | ), \ | ||
197 | TP_fast_assign( \ | ||
198 | struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ? \ | ||
199 | ip->i_afp : &ip->i_df; \ | ||
200 | struct xfs_bmbt_irec r; \ | ||
201 | \ | ||
202 | xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r); \ | ||
203 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
204 | __entry->ino = ip->i_ino; \ | ||
205 | __entry->idx = idx; \ | ||
206 | __entry->startoff = r.br_startoff; \ | ||
207 | __entry->startblock = r.br_startblock; \ | ||
208 | __entry->blockcount = r.br_blockcount; \ | ||
209 | __entry->state = r.br_state; \ | ||
210 | __entry->bmap_state = state; \ | ||
211 | __entry->caller_ip = caller_ip; \ | ||
212 | ), \ | ||
213 | TP_printk("dev %d:%d ino 0x%llx state %s idx %ld " \ | ||
214 | "offset %lld block %s count %lld flag %d caller %pf", \ | ||
215 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
216 | __entry->ino, \ | ||
217 | __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS), \ | ||
218 | (long)__entry->idx, \ | ||
219 | __entry->startoff, \ | ||
220 | xfs_fmtfsblock(__entry->startblock), \ | ||
221 | __entry->blockcount, \ | ||
222 | __entry->state, \ | ||
223 | (char *)__entry->caller_ip) \ | ||
224 | ) | ||
225 | |||
226 | DEFINE_BMAP_EVENT(xfs_iext_remove); | 234 | DEFINE_BMAP_EVENT(xfs_iext_remove); |
227 | DEFINE_BMAP_EVENT(xfs_bmap_pre_update); | 235 | DEFINE_BMAP_EVENT(xfs_bmap_pre_update); |
228 | DEFINE_BMAP_EVENT(xfs_bmap_post_update); | 236 | DEFINE_BMAP_EVENT(xfs_bmap_post_update); |
229 | DEFINE_BMAP_EVENT(xfs_extlist); | 237 | DEFINE_BMAP_EVENT(xfs_extlist); |
230 | 238 | ||
231 | #define DEFINE_BUF_EVENT(tname) \ | 239 | DECLARE_EVENT_CLASS(xfs_buf_class, |
232 | TRACE_EVENT(tname, \ | 240 | TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), |
233 | TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \ | 241 | TP_ARGS(bp, caller_ip), |
234 | TP_ARGS(bp, caller_ip), \ | 242 | TP_STRUCT__entry( |
235 | TP_STRUCT__entry( \ | 243 | __field(dev_t, dev) |
236 | __field(dev_t, dev) \ | 244 | __field(xfs_daddr_t, bno) |
237 | __field(xfs_daddr_t, bno) \ | 245 | __field(size_t, buffer_length) |
238 | __field(size_t, buffer_length) \ | 246 | __field(int, hold) |
239 | __field(int, hold) \ | 247 | __field(int, pincount) |
240 | __field(int, pincount) \ | 248 | __field(unsigned, lockval) |
241 | __field(unsigned, lockval) \ | 249 | __field(unsigned, flags) |
242 | __field(unsigned, flags) \ | 250 | __field(unsigned long, caller_ip) |
243 | __field(unsigned long, caller_ip) \ | 251 | ), |
244 | ), \ | 252 | TP_fast_assign( |
245 | TP_fast_assign( \ | 253 | __entry->dev = bp->b_target->bt_dev; |
246 | __entry->dev = bp->b_target->bt_dev; \ | 254 | __entry->bno = bp->b_bn; |
247 | __entry->bno = bp->b_bn; \ | 255 | __entry->buffer_length = bp->b_buffer_length; |
248 | __entry->buffer_length = bp->b_buffer_length; \ | 256 | __entry->hold = atomic_read(&bp->b_hold); |
249 | __entry->hold = atomic_read(&bp->b_hold); \ | 257 | __entry->pincount = atomic_read(&bp->b_pin_count); |
250 | __entry->pincount = atomic_read(&bp->b_pin_count); \ | 258 | __entry->lockval = xfs_buf_lock_value(bp); |
251 | __entry->lockval = xfs_buf_lock_value(bp); \ | 259 | __entry->flags = bp->b_flags; |
252 | __entry->flags = bp->b_flags; \ | 260 | __entry->caller_ip = caller_ip; |
253 | __entry->caller_ip = caller_ip; \ | 261 | ), |
254 | ), \ | 262 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " |
255 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \ | 263 | "lock %d flags %s caller %pf", |
256 | "lock %d flags %s caller %pf", \ | 264 | MAJOR(__entry->dev), MINOR(__entry->dev), |
257 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 265 | (unsigned long long)__entry->bno, |
258 | (unsigned long long)__entry->bno, \ | 266 | __entry->buffer_length, |
259 | __entry->buffer_length, \ | 267 | __entry->hold, |
260 | __entry->hold, \ | 268 | __entry->pincount, |
261 | __entry->pincount, \ | 269 | __entry->lockval, |
262 | __entry->lockval, \ | 270 | __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), |
263 | __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), \ | 271 | (void *)__entry->caller_ip) |
264 | (void *)__entry->caller_ip) \ | ||
265 | ) | 272 | ) |
273 | |||
274 | #define DEFINE_BUF_EVENT(name) \ | ||
275 | DEFINE_EVENT(xfs_buf_class, name, \ | ||
276 | TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \ | ||
277 | TP_ARGS(bp, caller_ip)) | ||
266 | DEFINE_BUF_EVENT(xfs_buf_init); | 278 | DEFINE_BUF_EVENT(xfs_buf_init); |
267 | DEFINE_BUF_EVENT(xfs_buf_free); | 279 | DEFINE_BUF_EVENT(xfs_buf_free); |
268 | DEFINE_BUF_EVENT(xfs_buf_hold); | 280 | DEFINE_BUF_EVENT(xfs_buf_hold); |
@@ -299,41 +311,45 @@ DEFINE_BUF_EVENT(xfs_reset_dqcounts); | |||
299 | DEFINE_BUF_EVENT(xfs_inode_item_push); | 311 | DEFINE_BUF_EVENT(xfs_inode_item_push); |
300 | 312 | ||
301 | /* pass flags explicitly */ | 313 | /* pass flags explicitly */ |
302 | #define DEFINE_BUF_FLAGS_EVENT(tname) \ | 314 | DECLARE_EVENT_CLASS(xfs_buf_flags_class, |
303 | TRACE_EVENT(tname, \ | 315 | TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), |
304 | TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \ | 316 | TP_ARGS(bp, flags, caller_ip), |
305 | TP_ARGS(bp, flags, caller_ip), \ | 317 | TP_STRUCT__entry( |
306 | TP_STRUCT__entry( \ | 318 | __field(dev_t, dev) |
307 | __field(dev_t, dev) \ | 319 | __field(xfs_daddr_t, bno) |
308 | __field(xfs_daddr_t, bno) \ | 320 | __field(size_t, buffer_length) |
309 | __field(size_t, buffer_length) \ | 321 | __field(int, hold) |
310 | __field(int, hold) \ | 322 | __field(int, pincount) |
311 | __field(int, pincount) \ | 323 | __field(unsigned, lockval) |
312 | __field(unsigned, lockval) \ | 324 | __field(unsigned, flags) |
313 | __field(unsigned, flags) \ | 325 | __field(unsigned long, caller_ip) |
314 | __field(unsigned long, caller_ip) \ | 326 | ), |
315 | ), \ | 327 | TP_fast_assign( |
316 | TP_fast_assign( \ | 328 | __entry->dev = bp->b_target->bt_dev; |
317 | __entry->dev = bp->b_target->bt_dev; \ | 329 | __entry->bno = bp->b_bn; |
318 | __entry->bno = bp->b_bn; \ | 330 | __entry->buffer_length = bp->b_buffer_length; |
319 | __entry->buffer_length = bp->b_buffer_length; \ | 331 | __entry->flags = flags; |
320 | __entry->flags = flags; \ | 332 | __entry->hold = atomic_read(&bp->b_hold); |
321 | __entry->hold = atomic_read(&bp->b_hold); \ | 333 | __entry->pincount = atomic_read(&bp->b_pin_count); |
322 | __entry->pincount = atomic_read(&bp->b_pin_count); \ | 334 | __entry->lockval = xfs_buf_lock_value(bp); |
323 | __entry->lockval = xfs_buf_lock_value(bp); \ | 335 | __entry->caller_ip = caller_ip; |
324 | __entry->caller_ip = caller_ip; \ | 336 | ), |
325 | ), \ | 337 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " |
326 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \ | 338 | "lock %d flags %s caller %pf", |
327 | "lock %d flags %s caller %pf", \ | 339 | MAJOR(__entry->dev), MINOR(__entry->dev), |
328 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 340 | (unsigned long long)__entry->bno, |
329 | (unsigned long long)__entry->bno, \ | 341 | __entry->buffer_length, |
330 | __entry->buffer_length, \ | 342 | __entry->hold, |
331 | __entry->hold, \ | 343 | __entry->pincount, |
332 | __entry->pincount, \ | 344 | __entry->lockval, |
333 | __entry->lockval, \ | 345 | __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), |
334 | __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), \ | 346 | (void *)__entry->caller_ip) |
335 | (void *)__entry->caller_ip) \ | ||
336 | ) | 347 | ) |
348 | |||
349 | #define DEFINE_BUF_FLAGS_EVENT(name) \ | ||
350 | DEFINE_EVENT(xfs_buf_flags_class, name, \ | ||
351 | TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \ | ||
352 | TP_ARGS(bp, flags, caller_ip)) | ||
337 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_find); | 353 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_find); |
338 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_get); | 354 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_get); |
339 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_read); | 355 | DEFINE_BUF_FLAGS_EVENT(xfs_buf_read); |
@@ -376,55 +392,58 @@ TRACE_EVENT(xfs_buf_ioerror, | |||
376 | (void *)__entry->caller_ip) | 392 | (void *)__entry->caller_ip) |
377 | ); | 393 | ); |
378 | 394 | ||
379 | #define DEFINE_BUF_ITEM_EVENT(tname) \ | 395 | DECLARE_EVENT_CLASS(xfs_buf_item_class, |
380 | TRACE_EVENT(tname, \ | 396 | TP_PROTO(struct xfs_buf_log_item *bip), |
381 | TP_PROTO(struct xfs_buf_log_item *bip), \ | 397 | TP_ARGS(bip), |
382 | TP_ARGS(bip), \ | 398 | TP_STRUCT__entry( |
383 | TP_STRUCT__entry( \ | 399 | __field(dev_t, dev) |
384 | __field(dev_t, dev) \ | 400 | __field(xfs_daddr_t, buf_bno) |
385 | __field(xfs_daddr_t, buf_bno) \ | 401 | __field(size_t, buf_len) |
386 | __field(size_t, buf_len) \ | 402 | __field(int, buf_hold) |
387 | __field(int, buf_hold) \ | 403 | __field(int, buf_pincount) |
388 | __field(int, buf_pincount) \ | 404 | __field(int, buf_lockval) |
389 | __field(int, buf_lockval) \ | 405 | __field(unsigned, buf_flags) |
390 | __field(unsigned, buf_flags) \ | 406 | __field(unsigned, bli_recur) |
391 | __field(unsigned, bli_recur) \ | 407 | __field(int, bli_refcount) |
392 | __field(int, bli_refcount) \ | 408 | __field(unsigned, bli_flags) |
393 | __field(unsigned, bli_flags) \ | 409 | __field(void *, li_desc) |
394 | __field(void *, li_desc) \ | 410 | __field(unsigned, li_flags) |
395 | __field(unsigned, li_flags) \ | 411 | ), |
396 | ), \ | 412 | TP_fast_assign( |
397 | TP_fast_assign( \ | 413 | __entry->dev = bip->bli_buf->b_target->bt_dev; |
398 | __entry->dev = bip->bli_buf->b_target->bt_dev; \ | 414 | __entry->bli_flags = bip->bli_flags; |
399 | __entry->bli_flags = bip->bli_flags; \ | 415 | __entry->bli_recur = bip->bli_recur; |
400 | __entry->bli_recur = bip->bli_recur; \ | 416 | __entry->bli_refcount = atomic_read(&bip->bli_refcount); |
401 | __entry->bli_refcount = atomic_read(&bip->bli_refcount); \ | 417 | __entry->buf_bno = bip->bli_buf->b_bn; |
402 | __entry->buf_bno = bip->bli_buf->b_bn; \ | 418 | __entry->buf_len = bip->bli_buf->b_buffer_length; |
403 | __entry->buf_len = bip->bli_buf->b_buffer_length; \ | 419 | __entry->buf_flags = bip->bli_buf->b_flags; |
404 | __entry->buf_flags = bip->bli_buf->b_flags; \ | 420 | __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold); |
405 | __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold); \ | 421 | __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count); |
406 | __entry->buf_pincount = \ | 422 | __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf); |
407 | atomic_read(&bip->bli_buf->b_pin_count); \ | 423 | __entry->li_desc = bip->bli_item.li_desc; |
408 | __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf); \ | 424 | __entry->li_flags = bip->bli_item.li_flags; |
409 | __entry->li_desc = bip->bli_item.li_desc; \ | 425 | ), |
410 | __entry->li_flags = bip->bli_item.li_flags; \ | 426 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " |
411 | ), \ | 427 | "lock %d flags %s recur %d refcount %d bliflags %s " |
412 | TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \ | 428 | "lidesc 0x%p liflags %s", |
413 | "lock %d flags %s recur %d refcount %d bliflags %s " \ | 429 | MAJOR(__entry->dev), MINOR(__entry->dev), |
414 | "lidesc 0x%p liflags %s", \ | 430 | (unsigned long long)__entry->buf_bno, |
415 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 431 | __entry->buf_len, |
416 | (unsigned long long)__entry->buf_bno, \ | 432 | __entry->buf_hold, |
417 | __entry->buf_len, \ | 433 | __entry->buf_pincount, |
418 | __entry->buf_hold, \ | 434 | __entry->buf_lockval, |
419 | __entry->buf_pincount, \ | 435 | __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS), |
420 | __entry->buf_lockval, \ | 436 | __entry->bli_recur, |
421 | __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS), \ | 437 | __entry->bli_refcount, |
422 | __entry->bli_recur, \ | 438 | __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS), |
423 | __entry->bli_refcount, \ | 439 | __entry->li_desc, |
424 | __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS), \ | 440 | __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS)) |
425 | __entry->li_desc, \ | ||
426 | __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS)) \ | ||
427 | ) | 441 | ) |
442 | |||
443 | #define DEFINE_BUF_ITEM_EVENT(name) \ | ||
444 | DEFINE_EVENT(xfs_buf_item_class, name, \ | ||
445 | TP_PROTO(struct xfs_buf_log_item *bip), \ | ||
446 | TP_ARGS(bip)) | ||
428 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size); | 447 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size); |
429 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale); | 448 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale); |
430 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format); | 449 | DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format); |
@@ -450,78 +469,90 @@ DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold); | |||
450 | DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release); | 469 | DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release); |
451 | DEFINE_BUF_ITEM_EVENT(xfs_trans_binval); | 470 | DEFINE_BUF_ITEM_EVENT(xfs_trans_binval); |
452 | 471 | ||
472 | DECLARE_EVENT_CLASS(xfs_lock_class, | ||
473 | TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, | ||
474 | unsigned long caller_ip), | ||
475 | TP_ARGS(ip, lock_flags, caller_ip), | ||
476 | TP_STRUCT__entry( | ||
477 | __field(dev_t, dev) | ||
478 | __field(xfs_ino_t, ino) | ||
479 | __field(int, lock_flags) | ||
480 | __field(unsigned long, caller_ip) | ||
481 | ), | ||
482 | TP_fast_assign( | ||
483 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
484 | __entry->ino = ip->i_ino; | ||
485 | __entry->lock_flags = lock_flags; | ||
486 | __entry->caller_ip = caller_ip; | ||
487 | ), | ||
488 | TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf", | ||
489 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
490 | __entry->ino, | ||
491 | __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS), | ||
492 | (void *)__entry->caller_ip) | ||
493 | ) | ||
494 | |||
453 | #define DEFINE_LOCK_EVENT(name) \ | 495 | #define DEFINE_LOCK_EVENT(name) \ |
454 | TRACE_EVENT(name, \ | 496 | DEFINE_EVENT(xfs_lock_class, name, \ |
455 | TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \ | 497 | TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \ |
456 | unsigned long caller_ip), \ | 498 | unsigned long caller_ip), \ |
457 | TP_ARGS(ip, lock_flags, caller_ip), \ | 499 | TP_ARGS(ip, lock_flags, caller_ip)) |
458 | TP_STRUCT__entry( \ | ||
459 | __field(dev_t, dev) \ | ||
460 | __field(xfs_ino_t, ino) \ | ||
461 | __field(int, lock_flags) \ | ||
462 | __field(unsigned long, caller_ip) \ | ||
463 | ), \ | ||
464 | TP_fast_assign( \ | ||
465 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
466 | __entry->ino = ip->i_ino; \ | ||
467 | __entry->lock_flags = lock_flags; \ | ||
468 | __entry->caller_ip = caller_ip; \ | ||
469 | ), \ | ||
470 | TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf", \ | ||
471 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
472 | __entry->ino, \ | ||
473 | __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS), \ | ||
474 | (void *)__entry->caller_ip) \ | ||
475 | ) | ||
476 | |||
477 | DEFINE_LOCK_EVENT(xfs_ilock); | 500 | DEFINE_LOCK_EVENT(xfs_ilock); |
478 | DEFINE_LOCK_EVENT(xfs_ilock_nowait); | 501 | DEFINE_LOCK_EVENT(xfs_ilock_nowait); |
479 | DEFINE_LOCK_EVENT(xfs_ilock_demote); | 502 | DEFINE_LOCK_EVENT(xfs_ilock_demote); |
480 | DEFINE_LOCK_EVENT(xfs_iunlock); | 503 | DEFINE_LOCK_EVENT(xfs_iunlock); |
481 | 504 | ||
505 | DECLARE_EVENT_CLASS(xfs_iget_class, | ||
506 | TP_PROTO(struct xfs_inode *ip), | ||
507 | TP_ARGS(ip), | ||
508 | TP_STRUCT__entry( | ||
509 | __field(dev_t, dev) | ||
510 | __field(xfs_ino_t, ino) | ||
511 | ), | ||
512 | TP_fast_assign( | ||
513 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
514 | __entry->ino = ip->i_ino; | ||
515 | ), | ||
516 | TP_printk("dev %d:%d ino 0x%llx", | ||
517 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
518 | __entry->ino) | ||
519 | ) | ||
520 | |||
482 | #define DEFINE_IGET_EVENT(name) \ | 521 | #define DEFINE_IGET_EVENT(name) \ |
483 | TRACE_EVENT(name, \ | 522 | DEFINE_EVENT(xfs_iget_class, name, \ |
484 | TP_PROTO(struct xfs_inode *ip), \ | 523 | TP_PROTO(struct xfs_inode *ip), \ |
485 | TP_ARGS(ip), \ | 524 | TP_ARGS(ip)) |
486 | TP_STRUCT__entry( \ | ||
487 | __field(dev_t, dev) \ | ||
488 | __field(xfs_ino_t, ino) \ | ||
489 | ), \ | ||
490 | TP_fast_assign( \ | ||
491 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
492 | __entry->ino = ip->i_ino; \ | ||
493 | ), \ | ||
494 | TP_printk("dev %d:%d ino 0x%llx", \ | ||
495 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
496 | __entry->ino) \ | ||
497 | ) | ||
498 | DEFINE_IGET_EVENT(xfs_iget_skip); | 525 | DEFINE_IGET_EVENT(xfs_iget_skip); |
499 | DEFINE_IGET_EVENT(xfs_iget_reclaim); | 526 | DEFINE_IGET_EVENT(xfs_iget_reclaim); |
500 | DEFINE_IGET_EVENT(xfs_iget_found); | 527 | DEFINE_IGET_EVENT(xfs_iget_found); |
501 | DEFINE_IGET_EVENT(xfs_iget_alloc); | 528 | DEFINE_IGET_EVENT(xfs_iget_alloc); |
502 | 529 | ||
530 | DECLARE_EVENT_CLASS(xfs_inode_class, | ||
531 | TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), | ||
532 | TP_ARGS(ip, caller_ip), | ||
533 | TP_STRUCT__entry( | ||
534 | __field(dev_t, dev) | ||
535 | __field(xfs_ino_t, ino) | ||
536 | __field(int, count) | ||
537 | __field(unsigned long, caller_ip) | ||
538 | ), | ||
539 | TP_fast_assign( | ||
540 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
541 | __entry->ino = ip->i_ino; | ||
542 | __entry->count = atomic_read(&VFS_I(ip)->i_count); | ||
543 | __entry->caller_ip = caller_ip; | ||
544 | ), | ||
545 | TP_printk("dev %d:%d ino 0x%llx count %d caller %pf", | ||
546 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
547 | __entry->ino, | ||
548 | __entry->count, | ||
549 | (char *)__entry->caller_ip) | ||
550 | ) | ||
551 | |||
503 | #define DEFINE_INODE_EVENT(name) \ | 552 | #define DEFINE_INODE_EVENT(name) \ |
504 | TRACE_EVENT(name, \ | 553 | DEFINE_EVENT(xfs_inode_class, name, \ |
505 | TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \ | 554 | TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \ |
506 | TP_ARGS(ip, caller_ip), \ | 555 | TP_ARGS(ip, caller_ip)) |
507 | TP_STRUCT__entry( \ | ||
508 | __field(dev_t, dev) \ | ||
509 | __field(xfs_ino_t, ino) \ | ||
510 | __field(int, count) \ | ||
511 | __field(unsigned long, caller_ip) \ | ||
512 | ), \ | ||
513 | TP_fast_assign( \ | ||
514 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
515 | __entry->ino = ip->i_ino; \ | ||
516 | __entry->count = atomic_read(&VFS_I(ip)->i_count); \ | ||
517 | __entry->caller_ip = caller_ip; \ | ||
518 | ), \ | ||
519 | TP_printk("dev %d:%d ino 0x%llx count %d caller %pf", \ | ||
520 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
521 | __entry->ino, \ | ||
522 | __entry->count, \ | ||
523 | (char *)__entry->caller_ip) \ | ||
524 | ) | ||
525 | DEFINE_INODE_EVENT(xfs_ihold); | 556 | DEFINE_INODE_EVENT(xfs_ihold); |
526 | DEFINE_INODE_EVENT(xfs_irele); | 557 | DEFINE_INODE_EVENT(xfs_irele); |
527 | /* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */ | 558 | /* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */ |
@@ -529,55 +560,59 @@ DEFINE_INODE_EVENT(xfs_inode); | |||
529 | #define xfs_itrace_entry(ip) \ | 560 | #define xfs_itrace_entry(ip) \ |
530 | trace_xfs_inode(ip, _THIS_IP_) | 561 | trace_xfs_inode(ip, _THIS_IP_) |
531 | 562 | ||
532 | #define DEFINE_DQUOT_EVENT(tname) \ | 563 | DECLARE_EVENT_CLASS(xfs_dquot_class, |
533 | TRACE_EVENT(tname, \ | 564 | TP_PROTO(struct xfs_dquot *dqp), |
534 | TP_PROTO(struct xfs_dquot *dqp), \ | 565 | TP_ARGS(dqp), |
535 | TP_ARGS(dqp), \ | 566 | TP_STRUCT__entry( |
536 | TP_STRUCT__entry( \ | 567 | __field(dev_t, dev) |
537 | __field(dev_t, dev) \ | 568 | __field(__be32, id) |
538 | __field(__be32, id) \ | 569 | __field(unsigned, flags) |
539 | __field(unsigned, flags) \ | 570 | __field(unsigned, nrefs) |
540 | __field(unsigned, nrefs) \ | 571 | __field(unsigned long long, res_bcount) |
541 | __field(unsigned long long, res_bcount) \ | 572 | __field(unsigned long long, bcount) |
542 | __field(unsigned long long, bcount) \ | 573 | __field(unsigned long long, icount) |
543 | __field(unsigned long long, icount) \ | 574 | __field(unsigned long long, blk_hardlimit) |
544 | __field(unsigned long long, blk_hardlimit) \ | 575 | __field(unsigned long long, blk_softlimit) |
545 | __field(unsigned long long, blk_softlimit) \ | 576 | __field(unsigned long long, ino_hardlimit) |
546 | __field(unsigned long long, ino_hardlimit) \ | 577 | __field(unsigned long long, ino_softlimit) |
547 | __field(unsigned long long, ino_softlimit) \ | ||
548 | ), \ | ||
549 | TP_fast_assign( \ | ||
550 | __entry->dev = dqp->q_mount->m_super->s_dev; \ | ||
551 | __entry->id = dqp->q_core.d_id; \ | ||
552 | __entry->flags = dqp->dq_flags; \ | ||
553 | __entry->nrefs = dqp->q_nrefs; \ | ||
554 | __entry->res_bcount = dqp->q_res_bcount; \ | ||
555 | __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount); \ | ||
556 | __entry->icount = be64_to_cpu(dqp->q_core.d_icount); \ | ||
557 | __entry->blk_hardlimit = \ | ||
558 | be64_to_cpu(dqp->q_core.d_blk_hardlimit); \ | ||
559 | __entry->blk_softlimit = \ | ||
560 | be64_to_cpu(dqp->q_core.d_blk_softlimit); \ | ||
561 | __entry->ino_hardlimit = \ | ||
562 | be64_to_cpu(dqp->q_core.d_ino_hardlimit); \ | ||
563 | __entry->ino_softlimit = \ | ||
564 | be64_to_cpu(dqp->q_core.d_ino_softlimit); \ | ||
565 | ), \ | 578 | ), \ |
566 | TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx " \ | 579 | TP_fast_assign( |
567 | "bcnt 0x%llx [hard 0x%llx | soft 0x%llx] " \ | 580 | __entry->dev = dqp->q_mount->m_super->s_dev; |
568 | "icnt 0x%llx [hard 0x%llx | soft 0x%llx]", \ | 581 | __entry->id = dqp->q_core.d_id; |
569 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 582 | __entry->flags = dqp->dq_flags; |
570 | be32_to_cpu(__entry->id), \ | 583 | __entry->nrefs = dqp->q_nrefs; |
571 | __print_flags(__entry->flags, "|", XFS_DQ_FLAGS), \ | 584 | __entry->res_bcount = dqp->q_res_bcount; |
572 | __entry->nrefs, \ | 585 | __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount); |
573 | __entry->res_bcount, \ | 586 | __entry->icount = be64_to_cpu(dqp->q_core.d_icount); |
574 | __entry->bcount, \ | 587 | __entry->blk_hardlimit = |
575 | __entry->blk_hardlimit, \ | 588 | be64_to_cpu(dqp->q_core.d_blk_hardlimit); |
576 | __entry->blk_softlimit, \ | 589 | __entry->blk_softlimit = |
577 | __entry->icount, \ | 590 | be64_to_cpu(dqp->q_core.d_blk_softlimit); |
578 | __entry->ino_hardlimit, \ | 591 | __entry->ino_hardlimit = |
579 | __entry->ino_softlimit) \ | 592 | be64_to_cpu(dqp->q_core.d_ino_hardlimit); |
593 | __entry->ino_softlimit = | ||
594 | be64_to_cpu(dqp->q_core.d_ino_softlimit); | ||
595 | ), | ||
596 | TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx " | ||
597 | "bcnt 0x%llx [hard 0x%llx | soft 0x%llx] " | ||
598 | "icnt 0x%llx [hard 0x%llx | soft 0x%llx]", | ||
599 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
600 | be32_to_cpu(__entry->id), | ||
601 | __print_flags(__entry->flags, "|", XFS_DQ_FLAGS), | ||
602 | __entry->nrefs, | ||
603 | __entry->res_bcount, | ||
604 | __entry->bcount, | ||
605 | __entry->blk_hardlimit, | ||
606 | __entry->blk_softlimit, | ||
607 | __entry->icount, | ||
608 | __entry->ino_hardlimit, | ||
609 | __entry->ino_softlimit) | ||
580 | ) | 610 | ) |
611 | |||
612 | #define DEFINE_DQUOT_EVENT(name) \ | ||
613 | DEFINE_EVENT(xfs_dquot_class, name, \ | ||
614 | TP_PROTO(struct xfs_dquot *dqp), \ | ||
615 | TP_ARGS(dqp)) | ||
581 | DEFINE_DQUOT_EVENT(xfs_dqadjust); | 616 | DEFINE_DQUOT_EVENT(xfs_dqadjust); |
582 | DEFINE_DQUOT_EVENT(xfs_dqshake_dirty); | 617 | DEFINE_DQUOT_EVENT(xfs_dqshake_dirty); |
583 | DEFINE_DQUOT_EVENT(xfs_dqshake_unlink); | 618 | DEFINE_DQUOT_EVENT(xfs_dqshake_unlink); |
@@ -610,72 +645,75 @@ DEFINE_DQUOT_EVENT(xfs_dqflush_done); | |||
610 | DEFINE_IGET_EVENT(xfs_dquot_dqalloc); | 645 | DEFINE_IGET_EVENT(xfs_dquot_dqalloc); |
611 | DEFINE_IGET_EVENT(xfs_dquot_dqdetach); | 646 | DEFINE_IGET_EVENT(xfs_dquot_dqdetach); |
612 | 647 | ||
648 | DECLARE_EVENT_CLASS(xfs_loggrant_class, | ||
649 | TP_PROTO(struct log *log, struct xlog_ticket *tic), | ||
650 | TP_ARGS(log, tic), | ||
651 | TP_STRUCT__entry( | ||
652 | __field(dev_t, dev) | ||
653 | __field(unsigned, trans_type) | ||
654 | __field(char, ocnt) | ||
655 | __field(char, cnt) | ||
656 | __field(int, curr_res) | ||
657 | __field(int, unit_res) | ||
658 | __field(unsigned int, flags) | ||
659 | __field(void *, reserve_headq) | ||
660 | __field(void *, write_headq) | ||
661 | __field(int, grant_reserve_cycle) | ||
662 | __field(int, grant_reserve_bytes) | ||
663 | __field(int, grant_write_cycle) | ||
664 | __field(int, grant_write_bytes) | ||
665 | __field(int, curr_cycle) | ||
666 | __field(int, curr_block) | ||
667 | __field(xfs_lsn_t, tail_lsn) | ||
668 | ), | ||
669 | TP_fast_assign( | ||
670 | __entry->dev = log->l_mp->m_super->s_dev; | ||
671 | __entry->trans_type = tic->t_trans_type; | ||
672 | __entry->ocnt = tic->t_ocnt; | ||
673 | __entry->cnt = tic->t_cnt; | ||
674 | __entry->curr_res = tic->t_curr_res; | ||
675 | __entry->unit_res = tic->t_unit_res; | ||
676 | __entry->flags = tic->t_flags; | ||
677 | __entry->reserve_headq = log->l_reserve_headq; | ||
678 | __entry->write_headq = log->l_write_headq; | ||
679 | __entry->grant_reserve_cycle = log->l_grant_reserve_cycle; | ||
680 | __entry->grant_reserve_bytes = log->l_grant_reserve_bytes; | ||
681 | __entry->grant_write_cycle = log->l_grant_write_cycle; | ||
682 | __entry->grant_write_bytes = log->l_grant_write_bytes; | ||
683 | __entry->curr_cycle = log->l_curr_cycle; | ||
684 | __entry->curr_block = log->l_curr_block; | ||
685 | __entry->tail_lsn = log->l_tail_lsn; | ||
686 | ), | ||
687 | TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u " | ||
688 | "t_unit_res %u t_flags %s reserve_headq 0x%p " | ||
689 | "write_headq 0x%p grant_reserve_cycle %d " | ||
690 | "grant_reserve_bytes %d grant_write_cycle %d " | ||
691 | "grant_write_bytes %d curr_cycle %d curr_block %d " | ||
692 | "tail_cycle %d tail_block %d", | ||
693 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
694 | __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES), | ||
695 | __entry->ocnt, | ||
696 | __entry->cnt, | ||
697 | __entry->curr_res, | ||
698 | __entry->unit_res, | ||
699 | __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS), | ||
700 | __entry->reserve_headq, | ||
701 | __entry->write_headq, | ||
702 | __entry->grant_reserve_cycle, | ||
703 | __entry->grant_reserve_bytes, | ||
704 | __entry->grant_write_cycle, | ||
705 | __entry->grant_write_bytes, | ||
706 | __entry->curr_cycle, | ||
707 | __entry->curr_block, | ||
708 | CYCLE_LSN(__entry->tail_lsn), | ||
709 | BLOCK_LSN(__entry->tail_lsn) | ||
710 | ) | ||
711 | ) | ||
613 | 712 | ||
614 | #define DEFINE_LOGGRANT_EVENT(tname) \ | 713 | #define DEFINE_LOGGRANT_EVENT(name) \ |
615 | TRACE_EVENT(tname, \ | 714 | DEFINE_EVENT(xfs_loggrant_class, name, \ |
616 | TP_PROTO(struct log *log, struct xlog_ticket *tic), \ | 715 | TP_PROTO(struct log *log, struct xlog_ticket *tic), \ |
617 | TP_ARGS(log, tic), \ | 716 | TP_ARGS(log, tic)) |
618 | TP_STRUCT__entry( \ | ||
619 | __field(dev_t, dev) \ | ||
620 | __field(unsigned, trans_type) \ | ||
621 | __field(char, ocnt) \ | ||
622 | __field(char, cnt) \ | ||
623 | __field(int, curr_res) \ | ||
624 | __field(int, unit_res) \ | ||
625 | __field(unsigned int, flags) \ | ||
626 | __field(void *, reserve_headq) \ | ||
627 | __field(void *, write_headq) \ | ||
628 | __field(int, grant_reserve_cycle) \ | ||
629 | __field(int, grant_reserve_bytes) \ | ||
630 | __field(int, grant_write_cycle) \ | ||
631 | __field(int, grant_write_bytes) \ | ||
632 | __field(int, curr_cycle) \ | ||
633 | __field(int, curr_block) \ | ||
634 | __field(xfs_lsn_t, tail_lsn) \ | ||
635 | ), \ | ||
636 | TP_fast_assign( \ | ||
637 | __entry->dev = log->l_mp->m_super->s_dev; \ | ||
638 | __entry->trans_type = tic->t_trans_type; \ | ||
639 | __entry->ocnt = tic->t_ocnt; \ | ||
640 | __entry->cnt = tic->t_cnt; \ | ||
641 | __entry->curr_res = tic->t_curr_res; \ | ||
642 | __entry->unit_res = tic->t_unit_res; \ | ||
643 | __entry->flags = tic->t_flags; \ | ||
644 | __entry->reserve_headq = log->l_reserve_headq; \ | ||
645 | __entry->write_headq = log->l_write_headq; \ | ||
646 | __entry->grant_reserve_cycle = log->l_grant_reserve_cycle; \ | ||
647 | __entry->grant_reserve_bytes = log->l_grant_reserve_bytes; \ | ||
648 | __entry->grant_write_cycle = log->l_grant_write_cycle; \ | ||
649 | __entry->grant_write_bytes = log->l_grant_write_bytes; \ | ||
650 | __entry->curr_cycle = log->l_curr_cycle; \ | ||
651 | __entry->curr_block = log->l_curr_block; \ | ||
652 | __entry->tail_lsn = log->l_tail_lsn; \ | ||
653 | ), \ | ||
654 | TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u " \ | ||
655 | "t_unit_res %u t_flags %s reserve_headq 0x%p " \ | ||
656 | "write_headq 0x%p grant_reserve_cycle %d " \ | ||
657 | "grant_reserve_bytes %d grant_write_cycle %d " \ | ||
658 | "grant_write_bytes %d curr_cycle %d curr_block %d " \ | ||
659 | "tail_cycle %d tail_block %d", \ | ||
660 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
661 | __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES), \ | ||
662 | __entry->ocnt, \ | ||
663 | __entry->cnt, \ | ||
664 | __entry->curr_res, \ | ||
665 | __entry->unit_res, \ | ||
666 | __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS), \ | ||
667 | __entry->reserve_headq, \ | ||
668 | __entry->write_headq, \ | ||
669 | __entry->grant_reserve_cycle, \ | ||
670 | __entry->grant_reserve_bytes, \ | ||
671 | __entry->grant_write_cycle, \ | ||
672 | __entry->grant_write_bytes, \ | ||
673 | __entry->curr_cycle, \ | ||
674 | __entry->curr_block, \ | ||
675 | CYCLE_LSN(__entry->tail_lsn), \ | ||
676 | BLOCK_LSN(__entry->tail_lsn) \ | ||
677 | ) \ | ||
678 | ) | ||
679 | DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm); | 717 | DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm); |
680 | DEFINE_LOGGRANT_EVENT(xfs_log_done_perm); | 718 | DEFINE_LOGGRANT_EVENT(xfs_log_done_perm); |
681 | DEFINE_LOGGRANT_EVENT(xfs_log_reserve); | 719 | DEFINE_LOGGRANT_EVENT(xfs_log_reserve); |
@@ -815,7 +853,7 @@ TRACE_EVENT(name, \ | |||
815 | ), \ | 853 | ), \ |
816 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \ | 854 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \ |
817 | "offset 0x%llx count %zd flags %s " \ | 855 | "offset 0x%llx count %zd flags %s " \ |
818 | "startoff 0x%llx startblock 0x%llx blockcount 0x%llx", \ | 856 | "startoff 0x%llx startblock %s blockcount 0x%llx", \ |
819 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 857 | MAJOR(__entry->dev), MINOR(__entry->dev), \ |
820 | __entry->ino, \ | 858 | __entry->ino, \ |
821 | __entry->size, \ | 859 | __entry->size, \ |
@@ -824,7 +862,7 @@ TRACE_EVENT(name, \ | |||
824 | __entry->count, \ | 862 | __entry->count, \ |
825 | __print_flags(__entry->flags, "|", BMAPI_FLAGS), \ | 863 | __print_flags(__entry->flags, "|", BMAPI_FLAGS), \ |
826 | __entry->startoff, \ | 864 | __entry->startoff, \ |
827 | __entry->startblock, \ | 865 | xfs_fmtfsblock(__entry->startblock), \ |
828 | __entry->blockcount) \ | 866 | __entry->blockcount) \ |
829 | ) | 867 | ) |
830 | DEFINE_IOMAP_EVENT(xfs_iomap_enter); | 868 | DEFINE_IOMAP_EVENT(xfs_iomap_enter); |
@@ -897,28 +935,32 @@ TRACE_EVENT(xfs_itruncate_start, | |||
897 | __entry->toss_finish) | 935 | __entry->toss_finish) |
898 | ); | 936 | ); |
899 | 937 | ||
938 | DECLARE_EVENT_CLASS(xfs_itrunc_class, | ||
939 | TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), | ||
940 | TP_ARGS(ip, new_size), | ||
941 | TP_STRUCT__entry( | ||
942 | __field(dev_t, dev) | ||
943 | __field(xfs_ino_t, ino) | ||
944 | __field(xfs_fsize_t, size) | ||
945 | __field(xfs_fsize_t, new_size) | ||
946 | ), | ||
947 | TP_fast_assign( | ||
948 | __entry->dev = VFS_I(ip)->i_sb->s_dev; | ||
949 | __entry->ino = ip->i_ino; | ||
950 | __entry->size = ip->i_d.di_size; | ||
951 | __entry->new_size = new_size; | ||
952 | ), | ||
953 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx", | ||
954 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
955 | __entry->ino, | ||
956 | __entry->size, | ||
957 | __entry->new_size) | ||
958 | ) | ||
959 | |||
900 | #define DEFINE_ITRUNC_EVENT(name) \ | 960 | #define DEFINE_ITRUNC_EVENT(name) \ |
901 | TRACE_EVENT(name, \ | 961 | DEFINE_EVENT(xfs_itrunc_class, name, \ |
902 | TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \ | 962 | TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \ |
903 | TP_ARGS(ip, new_size), \ | 963 | TP_ARGS(ip, new_size)) |
904 | TP_STRUCT__entry( \ | ||
905 | __field(dev_t, dev) \ | ||
906 | __field(xfs_ino_t, ino) \ | ||
907 | __field(xfs_fsize_t, size) \ | ||
908 | __field(xfs_fsize_t, new_size) \ | ||
909 | ), \ | ||
910 | TP_fast_assign( \ | ||
911 | __entry->dev = VFS_I(ip)->i_sb->s_dev; \ | ||
912 | __entry->ino = ip->i_ino; \ | ||
913 | __entry->size = ip->i_d.di_size; \ | ||
914 | __entry->new_size = new_size; \ | ||
915 | ), \ | ||
916 | TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx", \ | ||
917 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
918 | __entry->ino, \ | ||
919 | __entry->size, \ | ||
920 | __entry->new_size) \ | ||
921 | ) | ||
922 | DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start); | 964 | DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start); |
923 | DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end); | 965 | DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end); |
924 | 966 | ||
@@ -1037,28 +1079,28 @@ TRACE_EVENT(xfs_alloc_unbusy, | |||
1037 | 1079 | ||
1038 | TRACE_EVENT(xfs_alloc_busysearch, | 1080 | TRACE_EVENT(xfs_alloc_busysearch, |
1039 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, | 1081 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, |
1040 | xfs_extlen_t len, int found), | 1082 | xfs_extlen_t len, xfs_lsn_t lsn), |
1041 | TP_ARGS(mp, agno, agbno, len, found), | 1083 | TP_ARGS(mp, agno, agbno, len, lsn), |
1042 | TP_STRUCT__entry( | 1084 | TP_STRUCT__entry( |
1043 | __field(dev_t, dev) | 1085 | __field(dev_t, dev) |
1044 | __field(xfs_agnumber_t, agno) | 1086 | __field(xfs_agnumber_t, agno) |
1045 | __field(xfs_agblock_t, agbno) | 1087 | __field(xfs_agblock_t, agbno) |
1046 | __field(xfs_extlen_t, len) | 1088 | __field(xfs_extlen_t, len) |
1047 | __field(int, found) | 1089 | __field(xfs_lsn_t, lsn) |
1048 | ), | 1090 | ), |
1049 | TP_fast_assign( | 1091 | TP_fast_assign( |
1050 | __entry->dev = mp->m_super->s_dev; | 1092 | __entry->dev = mp->m_super->s_dev; |
1051 | __entry->agno = agno; | 1093 | __entry->agno = agno; |
1052 | __entry->agbno = agbno; | 1094 | __entry->agbno = agbno; |
1053 | __entry->len = len; | 1095 | __entry->len = len; |
1054 | __entry->found = found; | 1096 | __entry->lsn = lsn; |
1055 | ), | 1097 | ), |
1056 | TP_printk("dev %d:%d agno %u agbno %u len %u %s", | 1098 | TP_printk("dev %d:%d agno %u agbno %u len %u force lsn 0x%llx", |
1057 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1099 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1058 | __entry->agno, | 1100 | __entry->agno, |
1059 | __entry->agbno, | 1101 | __entry->agbno, |
1060 | __entry->len, | 1102 | __entry->len, |
1061 | __print_symbolic(__entry->found, XFS_BUSY_STATES)) | 1103 | __entry->lsn) |
1062 | ); | 1104 | ); |
1063 | 1105 | ||
1064 | TRACE_EVENT(xfs_agf, | 1106 | TRACE_EVENT(xfs_agf, |
@@ -1152,77 +1194,80 @@ TRACE_EVENT(xfs_free_extent, | |||
1152 | 1194 | ||
1153 | ); | 1195 | ); |
1154 | 1196 | ||
1155 | #define DEFINE_ALLOC_EVENT(name) \ | 1197 | DECLARE_EVENT_CLASS(xfs_alloc_class, |
1156 | TRACE_EVENT(name, \ | 1198 | TP_PROTO(struct xfs_alloc_arg *args), |
1157 | TP_PROTO(struct xfs_alloc_arg *args), \ | 1199 | TP_ARGS(args), |
1158 | TP_ARGS(args), \ | 1200 | TP_STRUCT__entry( |
1159 | TP_STRUCT__entry( \ | 1201 | __field(dev_t, dev) |
1160 | __field(dev_t, dev) \ | 1202 | __field(xfs_agnumber_t, agno) |
1161 | __field(xfs_agnumber_t, agno) \ | 1203 | __field(xfs_agblock_t, agbno) |
1162 | __field(xfs_agblock_t, agbno) \ | 1204 | __field(xfs_extlen_t, minlen) |
1163 | __field(xfs_extlen_t, minlen) \ | 1205 | __field(xfs_extlen_t, maxlen) |
1164 | __field(xfs_extlen_t, maxlen) \ | 1206 | __field(xfs_extlen_t, mod) |
1165 | __field(xfs_extlen_t, mod) \ | 1207 | __field(xfs_extlen_t, prod) |
1166 | __field(xfs_extlen_t, prod) \ | 1208 | __field(xfs_extlen_t, minleft) |
1167 | __field(xfs_extlen_t, minleft) \ | 1209 | __field(xfs_extlen_t, total) |
1168 | __field(xfs_extlen_t, total) \ | 1210 | __field(xfs_extlen_t, alignment) |
1169 | __field(xfs_extlen_t, alignment) \ | 1211 | __field(xfs_extlen_t, minalignslop) |
1170 | __field(xfs_extlen_t, minalignslop) \ | 1212 | __field(xfs_extlen_t, len) |
1171 | __field(xfs_extlen_t, len) \ | 1213 | __field(short, type) |
1172 | __field(short, type) \ | 1214 | __field(short, otype) |
1173 | __field(short, otype) \ | 1215 | __field(char, wasdel) |
1174 | __field(char, wasdel) \ | 1216 | __field(char, wasfromfl) |
1175 | __field(char, wasfromfl) \ | 1217 | __field(char, isfl) |
1176 | __field(char, isfl) \ | 1218 | __field(char, userdata) |
1177 | __field(char, userdata) \ | 1219 | __field(xfs_fsblock_t, firstblock) |
1178 | __field(xfs_fsblock_t, firstblock) \ | 1220 | ), |
1179 | ), \ | 1221 | TP_fast_assign( |
1180 | TP_fast_assign( \ | 1222 | __entry->dev = args->mp->m_super->s_dev; |
1181 | __entry->dev = args->mp->m_super->s_dev; \ | 1223 | __entry->agno = args->agno; |
1182 | __entry->agno = args->agno; \ | 1224 | __entry->agbno = args->agbno; |
1183 | __entry->agbno = args->agbno; \ | 1225 | __entry->minlen = args->minlen; |
1184 | __entry->minlen = args->minlen; \ | 1226 | __entry->maxlen = args->maxlen; |
1185 | __entry->maxlen = args->maxlen; \ | 1227 | __entry->mod = args->mod; |
1186 | __entry->mod = args->mod; \ | 1228 | __entry->prod = args->prod; |
1187 | __entry->prod = args->prod; \ | 1229 | __entry->minleft = args->minleft; |
1188 | __entry->minleft = args->minleft; \ | 1230 | __entry->total = args->total; |
1189 | __entry->total = args->total; \ | 1231 | __entry->alignment = args->alignment; |
1190 | __entry->alignment = args->alignment; \ | 1232 | __entry->minalignslop = args->minalignslop; |
1191 | __entry->minalignslop = args->minalignslop; \ | 1233 | __entry->len = args->len; |
1192 | __entry->len = args->len; \ | 1234 | __entry->type = args->type; |
1193 | __entry->type = args->type; \ | 1235 | __entry->otype = args->otype; |
1194 | __entry->otype = args->otype; \ | 1236 | __entry->wasdel = args->wasdel; |
1195 | __entry->wasdel = args->wasdel; \ | 1237 | __entry->wasfromfl = args->wasfromfl; |
1196 | __entry->wasfromfl = args->wasfromfl; \ | 1238 | __entry->isfl = args->isfl; |
1197 | __entry->isfl = args->isfl; \ | 1239 | __entry->userdata = args->userdata; |
1198 | __entry->userdata = args->userdata; \ | 1240 | __entry->firstblock = args->firstblock; |
1199 | __entry->firstblock = args->firstblock; \ | 1241 | ), |
1200 | ), \ | 1242 | TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u " |
1201 | TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u " \ | 1243 | "prod %u minleft %u total %u alignment %u minalignslop %u " |
1202 | "prod %u minleft %u total %u alignment %u minalignslop %u " \ | 1244 | "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d " |
1203 | "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d " \ | 1245 | "userdata %d firstblock 0x%llx", |
1204 | "userdata %d firstblock 0x%llx", \ | 1246 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1205 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 1247 | __entry->agno, |
1206 | __entry->agno, \ | 1248 | __entry->agbno, |
1207 | __entry->agbno, \ | 1249 | __entry->minlen, |
1208 | __entry->minlen, \ | 1250 | __entry->maxlen, |
1209 | __entry->maxlen, \ | 1251 | __entry->mod, |
1210 | __entry->mod, \ | 1252 | __entry->prod, |
1211 | __entry->prod, \ | 1253 | __entry->minleft, |
1212 | __entry->minleft, \ | 1254 | __entry->total, |
1213 | __entry->total, \ | 1255 | __entry->alignment, |
1214 | __entry->alignment, \ | 1256 | __entry->minalignslop, |
1215 | __entry->minalignslop, \ | 1257 | __entry->len, |
1216 | __entry->len, \ | 1258 | __print_symbolic(__entry->type, XFS_ALLOC_TYPES), |
1217 | __print_symbolic(__entry->type, XFS_ALLOC_TYPES), \ | 1259 | __print_symbolic(__entry->otype, XFS_ALLOC_TYPES), |
1218 | __print_symbolic(__entry->otype, XFS_ALLOC_TYPES), \ | 1260 | __entry->wasdel, |
1219 | __entry->wasdel, \ | 1261 | __entry->wasfromfl, |
1220 | __entry->wasfromfl, \ | 1262 | __entry->isfl, |
1221 | __entry->isfl, \ | 1263 | __entry->userdata, |
1222 | __entry->userdata, \ | 1264 | __entry->firstblock) |
1223 | __entry->firstblock) \ | ||
1224 | ) | 1265 | ) |
1225 | 1266 | ||
1267 | #define DEFINE_ALLOC_EVENT(name) \ | ||
1268 | DEFINE_EVENT(xfs_alloc_class, name, \ | ||
1269 | TP_PROTO(struct xfs_alloc_arg *args), \ | ||
1270 | TP_ARGS(args)) | ||
1226 | DEFINE_ALLOC_EVENT(xfs_alloc_exact_done); | 1271 | DEFINE_ALLOC_EVENT(xfs_alloc_exact_done); |
1227 | DEFINE_ALLOC_EVENT(xfs_alloc_exact_error); | 1272 | DEFINE_ALLOC_EVENT(xfs_alloc_exact_error); |
1228 | DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft); | 1273 | DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft); |
@@ -1245,92 +1290,100 @@ DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp); | |||
1245 | DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed); | 1290 | DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed); |
1246 | DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed); | 1291 | DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed); |
1247 | 1292 | ||
1248 | #define DEFINE_DIR2_TRACE(tname) \ | 1293 | DECLARE_EVENT_CLASS(xfs_dir2_class, |
1249 | TRACE_EVENT(tname, \ | 1294 | TP_PROTO(struct xfs_da_args *args), |
1295 | TP_ARGS(args), | ||
1296 | TP_STRUCT__entry( | ||
1297 | __field(dev_t, dev) | ||
1298 | __field(xfs_ino_t, ino) | ||
1299 | __dynamic_array(char, name, args->namelen) | ||
1300 | __field(int, namelen) | ||
1301 | __field(xfs_dahash_t, hashval) | ||
1302 | __field(xfs_ino_t, inumber) | ||
1303 | __field(int, op_flags) | ||
1304 | ), | ||
1305 | TP_fast_assign( | ||
1306 | __entry->dev = VFS_I(args->dp)->i_sb->s_dev; | ||
1307 | __entry->ino = args->dp->i_ino; | ||
1308 | if (args->namelen) | ||
1309 | memcpy(__get_str(name), args->name, args->namelen); | ||
1310 | __entry->namelen = args->namelen; | ||
1311 | __entry->hashval = args->hashval; | ||
1312 | __entry->inumber = args->inumber; | ||
1313 | __entry->op_flags = args->op_flags; | ||
1314 | ), | ||
1315 | TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x " | ||
1316 | "inumber 0x%llx op_flags %s", | ||
1317 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
1318 | __entry->ino, | ||
1319 | __entry->namelen, | ||
1320 | __entry->namelen ? __get_str(name) : NULL, | ||
1321 | __entry->namelen, | ||
1322 | __entry->hashval, | ||
1323 | __entry->inumber, | ||
1324 | __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS)) | ||
1325 | ) | ||
1326 | |||
1327 | #define DEFINE_DIR2_EVENT(name) \ | ||
1328 | DEFINE_EVENT(xfs_dir2_class, name, \ | ||
1250 | TP_PROTO(struct xfs_da_args *args), \ | 1329 | TP_PROTO(struct xfs_da_args *args), \ |
1251 | TP_ARGS(args), \ | 1330 | TP_ARGS(args)) |
1252 | TP_STRUCT__entry( \ | 1331 | DEFINE_DIR2_EVENT(xfs_dir2_sf_addname); |
1253 | __field(dev_t, dev) \ | 1332 | DEFINE_DIR2_EVENT(xfs_dir2_sf_create); |
1254 | __field(xfs_ino_t, ino) \ | 1333 | DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup); |
1255 | __dynamic_array(char, name, args->namelen) \ | 1334 | DEFINE_DIR2_EVENT(xfs_dir2_sf_replace); |
1256 | __field(int, namelen) \ | 1335 | DEFINE_DIR2_EVENT(xfs_dir2_sf_removename); |
1257 | __field(xfs_dahash_t, hashval) \ | 1336 | DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4); |
1258 | __field(xfs_ino_t, inumber) \ | 1337 | DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8); |
1259 | __field(int, op_flags) \ | 1338 | DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block); |
1260 | ), \ | 1339 | DEFINE_DIR2_EVENT(xfs_dir2_block_addname); |
1261 | TP_fast_assign( \ | 1340 | DEFINE_DIR2_EVENT(xfs_dir2_block_lookup); |
1262 | __entry->dev = VFS_I(args->dp)->i_sb->s_dev; \ | 1341 | DEFINE_DIR2_EVENT(xfs_dir2_block_replace); |
1263 | __entry->ino = args->dp->i_ino; \ | 1342 | DEFINE_DIR2_EVENT(xfs_dir2_block_removename); |
1264 | if (args->namelen) \ | 1343 | DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf); |
1265 | memcpy(__get_str(name), args->name, args->namelen); \ | 1344 | DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf); |
1266 | __entry->namelen = args->namelen; \ | 1345 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname); |
1267 | __entry->hashval = args->hashval; \ | 1346 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup); |
1268 | __entry->inumber = args->inumber; \ | 1347 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace); |
1269 | __entry->op_flags = args->op_flags; \ | 1348 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename); |
1270 | ), \ | 1349 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block); |
1271 | TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x " \ | 1350 | DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node); |
1272 | "inumber 0x%llx op_flags %s", \ | 1351 | DEFINE_DIR2_EVENT(xfs_dir2_node_addname); |
1273 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | 1352 | DEFINE_DIR2_EVENT(xfs_dir2_node_lookup); |
1274 | __entry->ino, \ | 1353 | DEFINE_DIR2_EVENT(xfs_dir2_node_replace); |
1275 | __entry->namelen, \ | 1354 | DEFINE_DIR2_EVENT(xfs_dir2_node_removename); |
1276 | __entry->namelen ? __get_str(name) : NULL, \ | 1355 | DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf); |
1277 | __entry->namelen, \ | 1356 | |
1278 | __entry->hashval, \ | 1357 | DECLARE_EVENT_CLASS(xfs_dir2_space_class, |
1279 | __entry->inumber, \ | 1358 | TP_PROTO(struct xfs_da_args *args, int idx), |
1280 | __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS)) \ | 1359 | TP_ARGS(args, idx), |
1360 | TP_STRUCT__entry( | ||
1361 | __field(dev_t, dev) | ||
1362 | __field(xfs_ino_t, ino) | ||
1363 | __field(int, op_flags) | ||
1364 | __field(int, idx) | ||
1365 | ), | ||
1366 | TP_fast_assign( | ||
1367 | __entry->dev = VFS_I(args->dp)->i_sb->s_dev; | ||
1368 | __entry->ino = args->dp->i_ino; | ||
1369 | __entry->op_flags = args->op_flags; | ||
1370 | __entry->idx = idx; | ||
1371 | ), | ||
1372 | TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d", | ||
1373 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
1374 | __entry->ino, | ||
1375 | __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS), | ||
1376 | __entry->idx) | ||
1281 | ) | 1377 | ) |
1282 | DEFINE_DIR2_TRACE(xfs_dir2_sf_addname); | ||
1283 | DEFINE_DIR2_TRACE(xfs_dir2_sf_create); | ||
1284 | DEFINE_DIR2_TRACE(xfs_dir2_sf_lookup); | ||
1285 | DEFINE_DIR2_TRACE(xfs_dir2_sf_replace); | ||
1286 | DEFINE_DIR2_TRACE(xfs_dir2_sf_removename); | ||
1287 | DEFINE_DIR2_TRACE(xfs_dir2_sf_toino4); | ||
1288 | DEFINE_DIR2_TRACE(xfs_dir2_sf_toino8); | ||
1289 | DEFINE_DIR2_TRACE(xfs_dir2_sf_to_block); | ||
1290 | DEFINE_DIR2_TRACE(xfs_dir2_block_addname); | ||
1291 | DEFINE_DIR2_TRACE(xfs_dir2_block_lookup); | ||
1292 | DEFINE_DIR2_TRACE(xfs_dir2_block_replace); | ||
1293 | DEFINE_DIR2_TRACE(xfs_dir2_block_removename); | ||
1294 | DEFINE_DIR2_TRACE(xfs_dir2_block_to_sf); | ||
1295 | DEFINE_DIR2_TRACE(xfs_dir2_block_to_leaf); | ||
1296 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_addname); | ||
1297 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_lookup); | ||
1298 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_replace); | ||
1299 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_removename); | ||
1300 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_to_block); | ||
1301 | DEFINE_DIR2_TRACE(xfs_dir2_leaf_to_node); | ||
1302 | DEFINE_DIR2_TRACE(xfs_dir2_node_addname); | ||
1303 | DEFINE_DIR2_TRACE(xfs_dir2_node_lookup); | ||
1304 | DEFINE_DIR2_TRACE(xfs_dir2_node_replace); | ||
1305 | DEFINE_DIR2_TRACE(xfs_dir2_node_removename); | ||
1306 | DEFINE_DIR2_TRACE(xfs_dir2_node_to_leaf); | ||
1307 | 1378 | ||
1308 | #define DEFINE_DIR2_SPACE_TRACE(tname) \ | 1379 | #define DEFINE_DIR2_SPACE_EVENT(name) \ |
1309 | TRACE_EVENT(tname, \ | 1380 | DEFINE_EVENT(xfs_dir2_space_class, name, \ |
1310 | TP_PROTO(struct xfs_da_args *args, int idx), \ | 1381 | TP_PROTO(struct xfs_da_args *args, int idx), \ |
1311 | TP_ARGS(args, idx), \ | 1382 | TP_ARGS(args, idx)) |
1312 | TP_STRUCT__entry( \ | 1383 | DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add); |
1313 | __field(dev_t, dev) \ | 1384 | DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove); |
1314 | __field(xfs_ino_t, ino) \ | 1385 | DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode); |
1315 | __field(int, op_flags) \ | 1386 | DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode); |
1316 | __field(int, idx) \ | ||
1317 | ), \ | ||
1318 | TP_fast_assign( \ | ||
1319 | __entry->dev = VFS_I(args->dp)->i_sb->s_dev; \ | ||
1320 | __entry->ino = args->dp->i_ino; \ | ||
1321 | __entry->op_flags = args->op_flags; \ | ||
1322 | __entry->idx = idx; \ | ||
1323 | ), \ | ||
1324 | TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d", \ | ||
1325 | MAJOR(__entry->dev), MINOR(__entry->dev), \ | ||
1326 | __entry->ino, \ | ||
1327 | __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS), \ | ||
1328 | __entry->idx) \ | ||
1329 | ) | ||
1330 | DEFINE_DIR2_SPACE_TRACE(xfs_dir2_leafn_add); | ||
1331 | DEFINE_DIR2_SPACE_TRACE(xfs_dir2_leafn_remove); | ||
1332 | DEFINE_DIR2_SPACE_TRACE(xfs_dir2_grow_inode); | ||
1333 | DEFINE_DIR2_SPACE_TRACE(xfs_dir2_shrink_inode); | ||
1334 | 1387 | ||
1335 | TRACE_EVENT(xfs_dir2_leafn_moveents, | 1388 | TRACE_EVENT(xfs_dir2_leafn_moveents, |
1336 | TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count), | 1389 | TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count), |
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index a1c65fc6d9c4..275b1f4f9430 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -2563,43 +2563,41 @@ xfs_alloc_search_busy(xfs_trans_t *tp, | |||
2563 | xfs_mount_t *mp; | 2563 | xfs_mount_t *mp; |
2564 | xfs_perag_busy_t *bsy; | 2564 | xfs_perag_busy_t *bsy; |
2565 | xfs_agblock_t uend, bend; | 2565 | xfs_agblock_t uend, bend; |
2566 | xfs_lsn_t lsn; | 2566 | xfs_lsn_t lsn = 0; |
2567 | int cnt; | 2567 | int cnt; |
2568 | 2568 | ||
2569 | mp = tp->t_mountp; | 2569 | mp = tp->t_mountp; |
2570 | 2570 | ||
2571 | spin_lock(&mp->m_perag[agno].pagb_lock); | 2571 | spin_lock(&mp->m_perag[agno].pagb_lock); |
2572 | cnt = mp->m_perag[agno].pagb_count; | ||
2573 | 2572 | ||
2574 | uend = bno + len - 1; | 2573 | uend = bno + len - 1; |
2575 | 2574 | ||
2576 | /* search pagb_list for this slot, skipping open slots */ | 2575 | /* |
2577 | for (bsy = mp->m_perag[agno].pagb_list; cnt; bsy++) { | 2576 | * search pagb_list for this slot, skipping open slots. We have to |
2577 | * search the entire array as there may be multiple overlaps and | ||
2578 | * we have to get the most recent LSN for the log force to push out | ||
2579 | * all the transactions that span the range. | ||
2580 | */ | ||
2581 | for (cnt = 0; cnt < mp->m_perag[agno].pagb_count; cnt++) { | ||
2582 | bsy = &mp->m_perag[agno].pagb_list[cnt]; | ||
2583 | if (!bsy->busy_tp) | ||
2584 | continue; | ||
2578 | 2585 | ||
2579 | /* | 2586 | bend = bsy->busy_start + bsy->busy_length - 1; |
2580 | * (start1,length1) within (start2, length2) | 2587 | if (bno > bend || uend < bsy->busy_start) |
2581 | */ | 2588 | continue; |
2582 | if (bsy->busy_tp != NULL) { | ||
2583 | bend = bsy->busy_start + bsy->busy_length - 1; | ||
2584 | if ((bno > bend) || (uend < bsy->busy_start)) { | ||
2585 | cnt--; | ||
2586 | } else { | ||
2587 | break; | ||
2588 | } | ||
2589 | } | ||
2590 | } | ||
2591 | 2589 | ||
2592 | trace_xfs_alloc_busysearch(mp, agno, bno, len, !!cnt); | 2590 | /* (start1,length1) within (start2, length2) */ |
2591 | if (XFS_LSN_CMP(bsy->busy_tp->t_commit_lsn, lsn) > 0) | ||
2592 | lsn = bsy->busy_tp->t_commit_lsn; | ||
2593 | } | ||
2594 | spin_unlock(&mp->m_perag[agno].pagb_lock); | ||
2595 | trace_xfs_alloc_busysearch(tp->t_mountp, agno, bno, len, lsn); | ||
2593 | 2596 | ||
2594 | /* | 2597 | /* |
2595 | * If a block was found, force the log through the LSN of the | 2598 | * If a block was found, force the log through the LSN of the |
2596 | * transaction that freed the block | 2599 | * transaction that freed the block |
2597 | */ | 2600 | */ |
2598 | if (cnt) { | 2601 | if (lsn) |
2599 | lsn = bsy->busy_tp->t_commit_lsn; | ||
2600 | spin_unlock(&mp->m_perag[agno].pagb_lock); | ||
2601 | xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC); | 2602 | xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC); |
2602 | } else { | ||
2603 | spin_unlock(&mp->m_perag[agno].pagb_lock); | ||
2604 | } | ||
2605 | } | 2603 | } |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index ce278b3ae7fc..391d36b0e68c 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2841,10 +2841,14 @@ xfs_iflush( | |||
2841 | mp = ip->i_mount; | 2841 | mp = ip->i_mount; |
2842 | 2842 | ||
2843 | /* | 2843 | /* |
2844 | * If the inode isn't dirty, then just release the inode | 2844 | * If the inode isn't dirty, then just release the inode flush lock and |
2845 | * flush lock and do nothing. | 2845 | * do nothing. Treat stale inodes the same; we cannot rely on the |
2846 | * backing buffer remaining stale in cache for the remaining life of | ||
2847 | * the stale inode and so xfs_itobp() below may give us a buffer that | ||
2848 | * no longer contains inodes below. Doing this stale check here also | ||
2849 | * avoids forcing the log on pinned, stale inodes. | ||
2846 | */ | 2850 | */ |
2847 | if (xfs_inode_clean(ip)) { | 2851 | if (xfs_inode_clean(ip) || xfs_iflags_test(ip, XFS_ISTALE)) { |
2848 | xfs_ifunlock(ip); | 2852 | xfs_ifunlock(ip); |
2849 | return 0; | 2853 | return 0; |
2850 | } | 2854 | } |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 6558ffd8d140..6f268756bf36 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -70,7 +70,6 @@ xfs_setattr( | |||
70 | uint commit_flags=0; | 70 | uint commit_flags=0; |
71 | uid_t uid=0, iuid=0; | 71 | uid_t uid=0, iuid=0; |
72 | gid_t gid=0, igid=0; | 72 | gid_t gid=0, igid=0; |
73 | int timeflags = 0; | ||
74 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; | 73 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; |
75 | int need_iolock = 1; | 74 | int need_iolock = 1; |
76 | 75 | ||
@@ -135,16 +134,13 @@ xfs_setattr( | |||
135 | if (flags & XFS_ATTR_NOLOCK) | 134 | if (flags & XFS_ATTR_NOLOCK) |
136 | need_iolock = 0; | 135 | need_iolock = 0; |
137 | if (!(mask & ATTR_SIZE)) { | 136 | if (!(mask & ATTR_SIZE)) { |
138 | if ((mask != (ATTR_CTIME|ATTR_ATIME|ATTR_MTIME)) || | 137 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); |
139 | (mp->m_flags & XFS_MOUNT_WSYNC)) { | 138 | commit_flags = 0; |
140 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); | 139 | code = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), |
141 | commit_flags = 0; | 140 | 0, 0, 0); |
142 | if ((code = xfs_trans_reserve(tp, 0, | 141 | if (code) { |
143 | XFS_ICHANGE_LOG_RES(mp), 0, | 142 | lock_flags = 0; |
144 | 0, 0))) { | 143 | goto error_return; |
145 | lock_flags = 0; | ||
146 | goto error_return; | ||
147 | } | ||
148 | } | 144 | } |
149 | } else { | 145 | } else { |
150 | if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) && | 146 | if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) && |
@@ -295,15 +291,23 @@ xfs_setattr( | |||
295 | * or we are explicitly asked to change it. This handles | 291 | * or we are explicitly asked to change it. This handles |
296 | * the semantic difference between truncate() and ftruncate() | 292 | * the semantic difference between truncate() and ftruncate() |
297 | * as implemented in the VFS. | 293 | * as implemented in the VFS. |
294 | * | ||
295 | * The regular truncate() case without ATTR_CTIME and ATTR_MTIME | ||
296 | * is a special case where we need to update the times despite | ||
297 | * not having these flags set. For all other operations the | ||
298 | * VFS set these flags explicitly if it wants a timestamp | ||
299 | * update. | ||
298 | */ | 300 | */ |
299 | if (iattr->ia_size != ip->i_size || (mask & ATTR_CTIME)) | 301 | if (iattr->ia_size != ip->i_size && |
300 | timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; | 302 | (!(mask & (ATTR_CTIME | ATTR_MTIME)))) { |
303 | iattr->ia_ctime = iattr->ia_mtime = | ||
304 | current_fs_time(inode->i_sb); | ||
305 | mask |= ATTR_CTIME | ATTR_MTIME; | ||
306 | } | ||
301 | 307 | ||
302 | if (iattr->ia_size > ip->i_size) { | 308 | if (iattr->ia_size > ip->i_size) { |
303 | ip->i_d.di_size = iattr->ia_size; | 309 | ip->i_d.di_size = iattr->ia_size; |
304 | ip->i_size = iattr->ia_size; | 310 | ip->i_size = iattr->ia_size; |
305 | if (!(flags & XFS_ATTR_DMI)) | ||
306 | xfs_ichgtime(ip, XFS_ICHGTIME_CHG); | ||
307 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 311 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
308 | } else if (iattr->ia_size <= ip->i_size || | 312 | } else if (iattr->ia_size <= ip->i_size || |
309 | (iattr->ia_size == 0 && ip->i_d.di_nextents)) { | 313 | (iattr->ia_size == 0 && ip->i_d.di_nextents)) { |
@@ -374,9 +378,6 @@ xfs_setattr( | |||
374 | ip->i_d.di_gid = gid; | 378 | ip->i_d.di_gid = gid; |
375 | inode->i_gid = gid; | 379 | inode->i_gid = gid; |
376 | } | 380 | } |
377 | |||
378 | xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); | ||
379 | timeflags |= XFS_ICHGTIME_CHG; | ||
380 | } | 381 | } |
381 | 382 | ||
382 | /* | 383 | /* |
@@ -393,51 +394,37 @@ xfs_setattr( | |||
393 | 394 | ||
394 | inode->i_mode &= S_IFMT; | 395 | inode->i_mode &= S_IFMT; |
395 | inode->i_mode |= mode & ~S_IFMT; | 396 | inode->i_mode |= mode & ~S_IFMT; |
396 | |||
397 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
398 | timeflags |= XFS_ICHGTIME_CHG; | ||
399 | } | 397 | } |
400 | 398 | ||
401 | /* | 399 | /* |
402 | * Change file access or modified times. | 400 | * Change file access or modified times. |
403 | */ | 401 | */ |
404 | if (mask & (ATTR_ATIME|ATTR_MTIME)) { | 402 | if (mask & ATTR_ATIME) { |
405 | if (mask & ATTR_ATIME) { | 403 | inode->i_atime = iattr->ia_atime; |
406 | inode->i_atime = iattr->ia_atime; | 404 | ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec; |
407 | ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec; | 405 | ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec; |
408 | ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec; | 406 | ip->i_update_core = 1; |
409 | ip->i_update_core = 1; | ||
410 | } | ||
411 | if (mask & ATTR_MTIME) { | ||
412 | inode->i_mtime = iattr->ia_mtime; | ||
413 | ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec; | ||
414 | ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec; | ||
415 | timeflags &= ~XFS_ICHGTIME_MOD; | ||
416 | timeflags |= XFS_ICHGTIME_CHG; | ||
417 | } | ||
418 | if (tp && (mask & (ATTR_MTIME_SET|ATTR_ATIME_SET))) | ||
419 | xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); | ||
420 | } | 407 | } |
421 | 408 | if (mask & ATTR_CTIME) { | |
422 | /* | ||
423 | * Change file inode change time only if ATTR_CTIME set | ||
424 | * AND we have been called by a DMI function. | ||
425 | */ | ||
426 | |||
427 | if ((flags & XFS_ATTR_DMI) && (mask & ATTR_CTIME)) { | ||
428 | inode->i_ctime = iattr->ia_ctime; | 409 | inode->i_ctime = iattr->ia_ctime; |
429 | ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec; | 410 | ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec; |
430 | ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec; | 411 | ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec; |
431 | ip->i_update_core = 1; | 412 | ip->i_update_core = 1; |
432 | timeflags &= ~XFS_ICHGTIME_CHG; | 413 | } |
414 | if (mask & ATTR_MTIME) { | ||
415 | inode->i_mtime = iattr->ia_mtime; | ||
416 | ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec; | ||
417 | ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec; | ||
418 | ip->i_update_core = 1; | ||
433 | } | 419 | } |
434 | 420 | ||
435 | /* | 421 | /* |
436 | * Send out timestamp changes that need to be set to the | 422 | * And finally, log the inode core if any attribute in it |
437 | * current time. Not done when called by a DMI function. | 423 | * has been changed. |
438 | */ | 424 | */ |
439 | if (timeflags && !(flags & XFS_ATTR_DMI)) | 425 | if (mask & (ATTR_UID|ATTR_GID|ATTR_MODE| |
440 | xfs_ichgtime(ip, timeflags); | 426 | ATTR_ATIME|ATTR_CTIME|ATTR_MTIME)) |
427 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
441 | 428 | ||
442 | XFS_STATS_INC(xs_ig_attrchg); | 429 | XFS_STATS_INC(xs_ig_attrchg); |
443 | 430 | ||
@@ -452,12 +439,10 @@ xfs_setattr( | |||
452 | * mix so this probably isn't worth the trouble to optimize. | 439 | * mix so this probably isn't worth the trouble to optimize. |
453 | */ | 440 | */ |
454 | code = 0; | 441 | code = 0; |
455 | if (tp) { | 442 | if (mp->m_flags & XFS_MOUNT_WSYNC) |
456 | if (mp->m_flags & XFS_MOUNT_WSYNC) | 443 | xfs_trans_set_sync(tp); |
457 | xfs_trans_set_sync(tp); | ||
458 | 444 | ||
459 | code = xfs_trans_commit(tp, commit_flags); | 445 | code = xfs_trans_commit(tp, commit_flags); |
460 | } | ||
461 | 446 | ||
462 | xfs_iunlock(ip, lock_flags); | 447 | xfs_iunlock(ip, lock_flags); |
463 | 448 | ||
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 71dafb69cfeb..ffac157fb5b2 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1408,7 +1408,7 @@ extern int drm_ati_pcigart_cleanup(struct drm_device *dev, | |||
1408 | struct drm_ati_pcigart_info * gart_info); | 1408 | struct drm_ati_pcigart_info * gart_info); |
1409 | 1409 | ||
1410 | extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, | 1410 | extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, |
1411 | size_t align, dma_addr_t maxaddr); | 1411 | size_t align); |
1412 | extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); | 1412 | extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); |
1413 | extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); | 1413 | extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); |
1414 | 1414 | ||
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 43009bc2e757..bc4fdf27bd2e 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
@@ -160,6 +160,7 @@ struct drm_mode_get_encoder { | |||
160 | #define DRM_MODE_CONNECTOR_HDMIA 11 | 160 | #define DRM_MODE_CONNECTOR_HDMIA 11 |
161 | #define DRM_MODE_CONNECTOR_HDMIB 12 | 161 | #define DRM_MODE_CONNECTOR_HDMIB 12 |
162 | #define DRM_MODE_CONNECTOR_TV 13 | 162 | #define DRM_MODE_CONNECTOR_TV 13 |
163 | #define DRM_MODE_CONNECTOR_eDP 14 | ||
163 | 164 | ||
164 | struct drm_mode_get_connector { | 165 | struct drm_mode_get_connector { |
165 | 166 | ||
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index ec3f5e80a5df..b64a8d7cdf6d 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h | |||
@@ -188,6 +188,7 @@ typedef struct _drm_i915_sarea { | |||
188 | #define DRM_I915_GEM_MADVISE 0x26 | 188 | #define DRM_I915_GEM_MADVISE 0x26 |
189 | #define DRM_I915_OVERLAY_PUT_IMAGE 0x27 | 189 | #define DRM_I915_OVERLAY_PUT_IMAGE 0x27 |
190 | #define DRM_I915_OVERLAY_ATTRS 0x28 | 190 | #define DRM_I915_OVERLAY_ATTRS 0x28 |
191 | #define DRM_I915_GEM_EXECBUFFER2 0x29 | ||
191 | 192 | ||
192 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 193 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
193 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) | 194 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) |
@@ -207,6 +208,7 @@ typedef struct _drm_i915_sarea { | |||
207 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) | 208 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) |
208 | #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) | 209 | #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) |
209 | #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) | 210 | #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) |
211 | #define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) | ||
210 | #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) | 212 | #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) |
211 | #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) | 213 | #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) |
212 | #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) | 214 | #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) |
@@ -272,6 +274,7 @@ typedef struct drm_i915_irq_wait { | |||
272 | #define I915_PARAM_NUM_FENCES_AVAIL 6 | 274 | #define I915_PARAM_NUM_FENCES_AVAIL 6 |
273 | #define I915_PARAM_HAS_OVERLAY 7 | 275 | #define I915_PARAM_HAS_OVERLAY 7 |
274 | #define I915_PARAM_HAS_PAGEFLIPPING 8 | 276 | #define I915_PARAM_HAS_PAGEFLIPPING 8 |
277 | #define I915_PARAM_HAS_EXECBUF2 9 | ||
275 | 278 | ||
276 | typedef struct drm_i915_getparam { | 279 | typedef struct drm_i915_getparam { |
277 | int param; | 280 | int param; |
@@ -567,6 +570,57 @@ struct drm_i915_gem_execbuffer { | |||
567 | __u64 cliprects_ptr; | 570 | __u64 cliprects_ptr; |
568 | }; | 571 | }; |
569 | 572 | ||
573 | struct drm_i915_gem_exec_object2 { | ||
574 | /** | ||
575 | * User's handle for a buffer to be bound into the GTT for this | ||
576 | * operation. | ||
577 | */ | ||
578 | __u32 handle; | ||
579 | |||
580 | /** Number of relocations to be performed on this buffer */ | ||
581 | __u32 relocation_count; | ||
582 | /** | ||
583 | * Pointer to array of struct drm_i915_gem_relocation_entry containing | ||
584 | * the relocations to be performed in this buffer. | ||
585 | */ | ||
586 | __u64 relocs_ptr; | ||
587 | |||
588 | /** Required alignment in graphics aperture */ | ||
589 | __u64 alignment; | ||
590 | |||
591 | /** | ||
592 | * Returned value of the updated offset of the object, for future | ||
593 | * presumed_offset writes. | ||
594 | */ | ||
595 | __u64 offset; | ||
596 | |||
597 | #define EXEC_OBJECT_NEEDS_FENCE (1<<0) | ||
598 | __u64 flags; | ||
599 | __u64 rsvd1; | ||
600 | __u64 rsvd2; | ||
601 | }; | ||
602 | |||
603 | struct drm_i915_gem_execbuffer2 { | ||
604 | /** | ||
605 | * List of gem_exec_object2 structs | ||
606 | */ | ||
607 | __u64 buffers_ptr; | ||
608 | __u32 buffer_count; | ||
609 | |||
610 | /** Offset in the batchbuffer to start execution from. */ | ||
611 | __u32 batch_start_offset; | ||
612 | /** Bytes used in batchbuffer from batch_start_offset */ | ||
613 | __u32 batch_len; | ||
614 | __u32 DR1; | ||
615 | __u32 DR4; | ||
616 | __u32 num_cliprects; | ||
617 | /** This is a struct drm_clip_rect *cliprects */ | ||
618 | __u64 cliprects_ptr; | ||
619 | __u64 flags; /* currently unused */ | ||
620 | __u64 rsvd1; | ||
621 | __u64 rsvd2; | ||
622 | }; | ||
623 | |||
570 | struct drm_i915_gem_pin { | 624 | struct drm_i915_gem_pin { |
571 | /** Handle of the buffer to be pinned. */ | 625 | /** Handle of the buffer to be pinned. */ |
572 | __u32 handle; | 626 | __u32 handle; |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ce945d4845fc..36924255c0d5 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -251,6 +251,7 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n, | |||
251 | void __init acpi_no_s4_hw_signature(void); | 251 | void __init acpi_no_s4_hw_signature(void); |
252 | void __init acpi_old_suspend_ordering(void); | 252 | void __init acpi_old_suspend_ordering(void); |
253 | void __init acpi_s4_no_nvs(void); | 253 | void __init acpi_s4_no_nvs(void); |
254 | void __init acpi_set_sci_en_on_resume(void); | ||
254 | #endif /* CONFIG_PM_SLEEP */ | 255 | #endif /* CONFIG_PM_SLEEP */ |
255 | 256 | ||
256 | struct acpi_osc_context { | 257 | struct acpi_osc_context { |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 784a919aa0d0..9b98173a8184 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -845,7 +845,6 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev) | |||
845 | * blk_rq_err_bytes() : bytes left till the next error boundary | 845 | * blk_rq_err_bytes() : bytes left till the next error boundary |
846 | * blk_rq_sectors() : sectors left in the entire request | 846 | * blk_rq_sectors() : sectors left in the entire request |
847 | * blk_rq_cur_sectors() : sectors left in the current segment | 847 | * blk_rq_cur_sectors() : sectors left in the current segment |
848 | * blk_rq_err_sectors() : sectors left till the next error boundary | ||
849 | */ | 848 | */ |
850 | static inline sector_t blk_rq_pos(const struct request *rq) | 849 | static inline sector_t blk_rq_pos(const struct request *rq) |
851 | { | 850 | { |
@@ -874,11 +873,6 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq) | |||
874 | return blk_rq_cur_bytes(rq) >> 9; | 873 | return blk_rq_cur_bytes(rq) >> 9; |
875 | } | 874 | } |
876 | 875 | ||
877 | static inline unsigned int blk_rq_err_sectors(const struct request *rq) | ||
878 | { | ||
879 | return blk_rq_err_bytes(rq) >> 9; | ||
880 | } | ||
881 | |||
882 | /* | 876 | /* |
883 | * Request issue related functions. | 877 | * Request issue related functions. |
884 | */ | 878 | */ |
@@ -1116,11 +1110,18 @@ static inline int queue_alignment_offset(struct request_queue *q) | |||
1116 | return q->limits.alignment_offset; | 1110 | return q->limits.alignment_offset; |
1117 | } | 1111 | } |
1118 | 1112 | ||
1113 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset) | ||
1114 | { | ||
1115 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); | ||
1116 | |||
1117 | offset &= granularity - 1; | ||
1118 | return (granularity + lim->alignment_offset - offset) & (granularity - 1); | ||
1119 | } | ||
1120 | |||
1119 | static inline int queue_sector_alignment_offset(struct request_queue *q, | 1121 | static inline int queue_sector_alignment_offset(struct request_queue *q, |
1120 | sector_t sector) | 1122 | sector_t sector) |
1121 | { | 1123 | { |
1122 | return ((sector << 9) - q->limits.alignment_offset) | 1124 | return queue_limit_alignment_offset(&q->limits, sector << 9); |
1123 | & (q->limits.io_min - 1); | ||
1124 | } | 1125 | } |
1125 | 1126 | ||
1126 | static inline int bdev_alignment_offset(struct block_device *bdev) | 1127 | static inline int bdev_alignment_offset(struct block_device *bdev) |
diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h new file mode 100644 index 000000000000..987229752519 --- /dev/null +++ b/include/linux/decompress/unlzo.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef DECOMPRESS_UNLZO_H | ||
2 | #define DECOMPRESS_UNLZO_H | ||
3 | |||
4 | int unlzo(unsigned char *inbuf, int len, | ||
5 | int(*fill)(void*, unsigned int), | ||
6 | int(*flush)(void*, unsigned int), | ||
7 | unsigned char *output, | ||
8 | int *pos, | ||
9 | void(*error)(char *x)); | ||
10 | #endif | ||
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index c6b3ca3af6df..1f716d9f714b 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
@@ -340,6 +340,9 @@ struct fw_cdev_send_response { | |||
340 | * The @closure field is passed back to userspace in the response event. | 340 | * The @closure field is passed back to userspace in the response event. |
341 | * The @handle field is an out parameter, returning a handle to the allocated | 341 | * The @handle field is an out parameter, returning a handle to the allocated |
342 | * range to be used for later deallocation of the range. | 342 | * range to be used for later deallocation of the range. |
343 | * | ||
344 | * The address range is allocated on all local nodes. The address allocation | ||
345 | * is exclusive except for the FCP command and response registers. | ||
343 | */ | 346 | */ |
344 | struct fw_cdev_allocate { | 347 | struct fw_cdev_allocate { |
345 | __u64 offset; | 348 | __u64 offset; |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 9416a461b696..a0e67150a729 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -248,8 +248,8 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, | |||
248 | void *data, size_t length, | 248 | void *data, size_t length, |
249 | void *callback_data); | 249 | void *callback_data); |
250 | /* | 250 | /* |
251 | * Important note: The callback must guarantee that either fw_send_response() | 251 | * Important note: Except for the FCP registers, the callback must guarantee |
252 | * or kfree() is called on the @request. | 252 | * that either fw_send_response() or kfree() is called on the @request. |
253 | */ | 253 | */ |
254 | typedef void (*fw_address_callback_t)(struct fw_card *card, | 254 | typedef void (*fw_address_callback_t)(struct fw_card *card, |
255 | struct fw_request *request, | 255 | struct fw_request *request, |
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 211ff4497269..ab2cc20e21a5 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
@@ -46,7 +46,7 @@ void kmap_flush_unused(void); | |||
46 | 46 | ||
47 | static inline unsigned int nr_free_highpages(void) { return 0; } | 47 | static inline unsigned int nr_free_highpages(void) { return 0; } |
48 | 48 | ||
49 | #define totalhigh_pages 0 | 49 | #define totalhigh_pages 0UL |
50 | 50 | ||
51 | #ifndef ARCH_HAS_KMAP | 51 | #ifndef ARCH_HAS_KMAP |
52 | static inline void *kmap(struct page *page) | 52 | static inline void *kmap(struct page *page) |
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h index fc5db826b48e..02c9af374741 100644 --- a/include/linux/i2c/adp5588.h +++ b/include/linux/i2c/adp5588.h | |||
@@ -89,4 +89,16 @@ struct adp5588_kpad_platform_data { | |||
89 | unsigned short unlock_key2; /* Unlock Key 2 */ | 89 | unsigned short unlock_key2; /* Unlock Key 2 */ |
90 | }; | 90 | }; |
91 | 91 | ||
92 | struct adp5588_gpio_platform_data { | ||
93 | unsigned gpio_start; /* GPIO Chip base # */ | ||
94 | unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ | ||
95 | int (*setup)(struct i2c_client *client, | ||
96 | int gpio, unsigned ngpio, | ||
97 | void *context); | ||
98 | int (*teardown)(struct i2c_client *client, | ||
99 | int gpio, unsigned ngpio, | ||
100 | void *context); | ||
101 | void *context; | ||
102 | }; | ||
103 | |||
92 | #endif | 104 | #endif |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index d9724a28c0c2..163c840437d6 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -832,7 +832,7 @@ struct ieee80211_ht_cap { | |||
832 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 | 832 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 |
833 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 | 833 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 |
834 | #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 | 834 | #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 |
835 | #define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000 | 835 | #define IEEE80211_HT_CAP_RESERVED 0x2000 |
836 | #define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 | 836 | #define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 |
837 | #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 | 837 | #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 |
838 | 838 | ||
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 699e85c01a4d..b2304929434e 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -81,6 +81,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
81 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) | 81 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) |
82 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) | 82 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) |
83 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) | 83 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) |
84 | #define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK) | ||
84 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ | 85 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ |
85 | ACCEPT_SOURCE_ROUTE) | 86 | ACCEPT_SOURCE_ROUTE) |
86 | #define IN_DEV_ACCEPT_LOCAL(in_dev) IN_DEV_ORCONF((in_dev), ACCEPT_LOCAL) | 87 | #define IN_DEV_ACCEPT_LOCAL(in_dev) IN_DEV_ORCONF((in_dev), ACCEPT_LOCAL) |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index f1011f7f3d41..638ce4554c76 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -653,6 +653,7 @@ struct transaction_s | |||
653 | * waiting for it to finish. | 653 | * waiting for it to finish. |
654 | */ | 654 | */ |
655 | unsigned int t_synchronous_commit:1; | 655 | unsigned int t_synchronous_commit:1; |
656 | unsigned int t_flushed_data_blocks:1; | ||
656 | 657 | ||
657 | /* | 658 | /* |
658 | * For use by the filesystem to store fs-specific data | 659 | * For use by the filesystem to store fs-specific data |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 3d44e9c65a8e..7c6b32a1421c 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
@@ -81,7 +81,7 @@ union { \ | |||
81 | } | 81 | } |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * INIT_KFIFO - Initialize a kfifo declared by DECLARED_KFIFO | 84 | * INIT_KFIFO - Initialize a kfifo declared by DECLARE_KFIFO |
85 | * @name: name of the declared kfifo datatype | 85 | * @name: name of the declared kfifo datatype |
86 | */ | 86 | */ |
87 | #define INIT_KFIFO(name) \ | 87 | #define INIT_KFIFO(name) \ |
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 6adcc297e354..19ec41a183f5 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h | |||
@@ -29,8 +29,7 @@ struct pt_regs; | |||
29 | * | 29 | * |
30 | * On some architectures it is required to skip a breakpoint | 30 | * On some architectures it is required to skip a breakpoint |
31 | * exception when it occurs after a breakpoint has been removed. | 31 | * exception when it occurs after a breakpoint has been removed. |
32 | * This can be implemented in the architecture specific portion of | 32 | * This can be implemented in the architecture specific portion of kgdb. |
33 | * for kgdb. | ||
34 | */ | 33 | */ |
35 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); | 34 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); |
36 | 35 | ||
@@ -65,7 +64,7 @@ struct uart_port; | |||
65 | /** | 64 | /** |
66 | * kgdb_breakpoint - compiled in breakpoint | 65 | * kgdb_breakpoint - compiled in breakpoint |
67 | * | 66 | * |
68 | * This will be impelmented a static inline per architecture. This | 67 | * This will be implemented as a static inline per architecture. This |
69 | * function is called by the kgdb core to execute an architecture | 68 | * function is called by the kgdb core to execute an architecture |
70 | * specific trap to cause kgdb to enter the exception processing. | 69 | * specific trap to cause kgdb to enter the exception processing. |
71 | * | 70 | * |
@@ -190,7 +189,7 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code, | |||
190 | * @flags: Current IRQ state | 189 | * @flags: Current IRQ state |
191 | * | 190 | * |
192 | * On SMP systems, we need to get the attention of the other CPUs | 191 | * On SMP systems, we need to get the attention of the other CPUs |
193 | * and get them be in a known state. This should do what is needed | 192 | * and get them into a known state. This should do what is needed |
194 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, | 193 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, |
195 | * the NMI approach is not used for rounding up all the CPUs. For example, | 194 | * the NMI approach is not used for rounding up all the CPUs. For example, |
196 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In | 195 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In |
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h index e880d4cf9e22..08d7dc4ddf40 100644 --- a/include/linux/kmemcheck.h +++ b/include/linux/kmemcheck.h | |||
@@ -36,6 +36,56 @@ int kmemcheck_hide_addr(unsigned long address); | |||
36 | 36 | ||
37 | bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); | 37 | bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); |
38 | 38 | ||
39 | /* | ||
40 | * Bitfield annotations | ||
41 | * | ||
42 | * How to use: If you have a struct using bitfields, for example | ||
43 | * | ||
44 | * struct a { | ||
45 | * int x:8, y:8; | ||
46 | * }; | ||
47 | * | ||
48 | * then this should be rewritten as | ||
49 | * | ||
50 | * struct a { | ||
51 | * kmemcheck_bitfield_begin(flags); | ||
52 | * int x:8, y:8; | ||
53 | * kmemcheck_bitfield_end(flags); | ||
54 | * }; | ||
55 | * | ||
56 | * Now the "flags_begin" and "flags_end" members may be used to refer to the | ||
57 | * beginning and end, respectively, of the bitfield (and things like | ||
58 | * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- | ||
59 | * fields should be annotated: | ||
60 | * | ||
61 | * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); | ||
62 | * kmemcheck_annotate_bitfield(a, flags); | ||
63 | */ | ||
64 | #define kmemcheck_bitfield_begin(name) \ | ||
65 | int name##_begin[0]; | ||
66 | |||
67 | #define kmemcheck_bitfield_end(name) \ | ||
68 | int name##_end[0]; | ||
69 | |||
70 | #define kmemcheck_annotate_bitfield(ptr, name) \ | ||
71 | do { \ | ||
72 | int _n; \ | ||
73 | \ | ||
74 | if (!ptr) \ | ||
75 | break; \ | ||
76 | \ | ||
77 | _n = (long) &((ptr)->name##_end) \ | ||
78 | - (long) &((ptr)->name##_begin); \ | ||
79 | MAYBE_BUILD_BUG_ON(_n < 0); \ | ||
80 | \ | ||
81 | kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ | ||
82 | } while (0) | ||
83 | |||
84 | #define kmemcheck_annotate_variable(var) \ | ||
85 | do { \ | ||
86 | kmemcheck_mark_initialized(&(var), sizeof(var)); \ | ||
87 | } while (0) \ | ||
88 | |||
39 | #else | 89 | #else |
40 | #define kmemcheck_enabled 0 | 90 | #define kmemcheck_enabled 0 |
41 | 91 | ||
@@ -106,60 +156,16 @@ static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size) | |||
106 | return true; | 156 | return true; |
107 | } | 157 | } |
108 | 158 | ||
109 | #endif /* CONFIG_KMEMCHECK */ | 159 | #define kmemcheck_bitfield_begin(name) |
110 | 160 | #define kmemcheck_bitfield_end(name) | |
111 | /* | 161 | #define kmemcheck_annotate_bitfield(ptr, name) \ |
112 | * Bitfield annotations | 162 | do { \ |
113 | * | 163 | } while (0) |
114 | * How to use: If you have a struct using bitfields, for example | ||
115 | * | ||
116 | * struct a { | ||
117 | * int x:8, y:8; | ||
118 | * }; | ||
119 | * | ||
120 | * then this should be rewritten as | ||
121 | * | ||
122 | * struct a { | ||
123 | * kmemcheck_bitfield_begin(flags); | ||
124 | * int x:8, y:8; | ||
125 | * kmemcheck_bitfield_end(flags); | ||
126 | * }; | ||
127 | * | ||
128 | * Now the "flags_begin" and "flags_end" members may be used to refer to the | ||
129 | * beginning and end, respectively, of the bitfield (and things like | ||
130 | * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- | ||
131 | * fields should be annotated: | ||
132 | * | ||
133 | * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); | ||
134 | * kmemcheck_annotate_bitfield(a, flags); | ||
135 | * | ||
136 | * Note: We provide the same definitions for both kmemcheck and non- | ||
137 | * kmemcheck kernels. This makes it harder to introduce accidental errors. It | ||
138 | * is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield(). | ||
139 | */ | ||
140 | #define kmemcheck_bitfield_begin(name) \ | ||
141 | int name##_begin[0]; | ||
142 | |||
143 | #define kmemcheck_bitfield_end(name) \ | ||
144 | int name##_end[0]; | ||
145 | 164 | ||
146 | #define kmemcheck_annotate_bitfield(ptr, name) \ | 165 | #define kmemcheck_annotate_variable(var) \ |
147 | do { \ | 166 | do { \ |
148 | int _n; \ | ||
149 | \ | ||
150 | if (!ptr) \ | ||
151 | break; \ | ||
152 | \ | ||
153 | _n = (long) &((ptr)->name##_end) \ | ||
154 | - (long) &((ptr)->name##_begin); \ | ||
155 | MAYBE_BUILD_BUG_ON(_n < 0); \ | ||
156 | \ | ||
157 | kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ | ||
158 | } while (0) | 167 | } while (0) |
159 | 168 | ||
160 | #define kmemcheck_annotate_variable(var) \ | 169 | #endif /* CONFIG_KMEMCHECK */ |
161 | do { \ | ||
162 | kmemcheck_mark_initialized(&(var), sizeof(var)); \ | ||
163 | } while (0) \ | ||
164 | 170 | ||
165 | #endif /* LINUX_KMEMCHECK_H */ | 171 | #endif /* LINUX_KMEMCHECK_H */ |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 84a524afb3dc..84d020bed083 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -123,6 +123,8 @@ struct vm_region { | |||
123 | struct file *vm_file; /* the backing file or NULL */ | 123 | struct file *vm_file; /* the backing file or NULL */ |
124 | 124 | ||
125 | atomic_t vm_usage; /* region usage count */ | 125 | atomic_t vm_usage; /* region usage count */ |
126 | bool vm_icache_flushed : 1; /* true if the icache has been flushed for | ||
127 | * this region */ | ||
126 | }; | 128 | }; |
127 | 129 | ||
128 | /* | 130 | /* |
diff --git a/include/linux/pci.h b/include/linux/pci.h index bf1e67080849..174e5392e51e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -243,6 +243,7 @@ struct pci_dev { | |||
243 | unsigned int d2_support:1; /* Low power state D2 is supported */ | 243 | unsigned int d2_support:1; /* Low power state D2 is supported */ |
244 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ | 244 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ |
245 | unsigned int wakeup_prepared:1; | 245 | unsigned int wakeup_prepared:1; |
246 | unsigned int d3_delay; /* D3->D0 transition time in ms */ | ||
246 | 247 | ||
247 | #ifdef CONFIG_PCIEASPM | 248 | #ifdef CONFIG_PCIEASPM |
248 | struct pcie_link_state *link_state; /* ASPM link state. */ | 249 | struct pcie_link_state *link_state; /* ASPM link state. */ |
@@ -566,6 +567,9 @@ void pcibios_align_resource(void *, struct resource *, resource_size_t, | |||
566 | resource_size_t); | 567 | resource_size_t); |
567 | void pcibios_update_irq(struct pci_dev *, int irq); | 568 | void pcibios_update_irq(struct pci_dev *, int irq); |
568 | 569 | ||
570 | /* Weak but can be overriden by arch */ | ||
571 | void pci_fixup_cardbus(struct pci_bus *); | ||
572 | |||
569 | /* Generic PCI functions used internally */ | 573 | /* Generic PCI functions used internally */ |
570 | 574 | ||
571 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 575 | extern struct pci_bus *pci_find_bus(int domain, int busnr); |
diff --git a/include/linux/poison.h b/include/linux/poison.h index 7fc194aef8c2..2110a81c5e2a 100644 --- a/include/linux/poison.h +++ b/include/linux/poison.h | |||
@@ -2,13 +2,25 @@ | |||
2 | #define _LINUX_POISON_H | 2 | #define _LINUX_POISON_H |
3 | 3 | ||
4 | /********** include/linux/list.h **********/ | 4 | /********** include/linux/list.h **********/ |
5 | |||
6 | /* | ||
7 | * Architectures might want to move the poison pointer offset | ||
8 | * into some well-recognized area such as 0xdead000000000000, | ||
9 | * that is also not mappable by user-space exploits: | ||
10 | */ | ||
11 | #ifdef CONFIG_ILLEGAL_POINTER_VALUE | ||
12 | # define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL) | ||
13 | #else | ||
14 | # define POISON_POINTER_DELTA 0 | ||
15 | #endif | ||
16 | |||
5 | /* | 17 | /* |
6 | * These are non-NULL pointers that will result in page faults | 18 | * These are non-NULL pointers that will result in page faults |
7 | * under normal circumstances, used to verify that nobody uses | 19 | * under normal circumstances, used to verify that nobody uses |
8 | * non-initialized list entries. | 20 | * non-initialized list entries. |
9 | */ | 21 | */ |
10 | #define LIST_POISON1 ((void *) 0x00100100) | 22 | #define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA) |
11 | #define LIST_POISON2 ((void *) 0x00200200) | 23 | #define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA) |
12 | 24 | ||
13 | /********** include/linux/timer.h **********/ | 25 | /********** include/linux/timer.h **********/ |
14 | /* | 26 | /* |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index c96c1858fe2c..1ba3cf6edfbb 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -62,6 +62,12 @@ void reiserfs_write_unlock(struct super_block *s); | |||
62 | int reiserfs_write_lock_once(struct super_block *s); | 62 | int reiserfs_write_lock_once(struct super_block *s); |
63 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | 63 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); |
64 | 64 | ||
65 | #ifdef CONFIG_REISERFS_CHECK | ||
66 | void reiserfs_lock_check_recursive(struct super_block *s); | ||
67 | #else | ||
68 | static inline void reiserfs_lock_check_recursive(struct super_block *s) { } | ||
69 | #endif | ||
70 | |||
65 | /* | 71 | /* |
66 | * Several mutexes depend on the write lock. | 72 | * Several mutexes depend on the write lock. |
67 | * However sometimes we want to relax the write lock while we hold | 73 | * However sometimes we want to relax the write lock while we hold |
@@ -92,11 +98,31 @@ void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | |||
92 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, | 98 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, |
93 | struct super_block *s) | 99 | struct super_block *s) |
94 | { | 100 | { |
101 | reiserfs_lock_check_recursive(s); | ||
95 | reiserfs_write_unlock(s); | 102 | reiserfs_write_unlock(s); |
96 | mutex_lock(m); | 103 | mutex_lock(m); |
97 | reiserfs_write_lock(s); | 104 | reiserfs_write_lock(s); |
98 | } | 105 | } |
99 | 106 | ||
107 | static inline void | ||
108 | reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass, | ||
109 | struct super_block *s) | ||
110 | { | ||
111 | reiserfs_lock_check_recursive(s); | ||
112 | reiserfs_write_unlock(s); | ||
113 | mutex_lock_nested(m, subclass); | ||
114 | reiserfs_write_lock(s); | ||
115 | } | ||
116 | |||
117 | static inline void | ||
118 | reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s) | ||
119 | { | ||
120 | reiserfs_lock_check_recursive(s); | ||
121 | reiserfs_write_unlock(s); | ||
122 | down_read(sem); | ||
123 | reiserfs_write_lock(s); | ||
124 | } | ||
125 | |||
100 | /* | 126 | /* |
101 | * When we schedule, we usually want to also release the write lock, | 127 | * When we schedule, we usually want to also release the write lock, |
102 | * according to the previous bkl based locking scheme of reiserfs. | 128 | * according to the previous bkl based locking scheme of reiserfs. |
diff --git a/include/linux/resource.h b/include/linux/resource.h index 40fc7e626082..f1e914eefeab 100644 --- a/include/linux/resource.h +++ b/include/linux/resource.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/time.h> | 4 | #include <linux/time.h> |
5 | 5 | ||
6 | struct task_struct; | ||
7 | |||
8 | /* | 6 | /* |
9 | * Resource control/accounting header file for linux | 7 | * Resource control/accounting header file for linux |
10 | */ | 8 | */ |
@@ -70,6 +68,12 @@ struct rlimit { | |||
70 | */ | 68 | */ |
71 | #include <asm/resource.h> | 69 | #include <asm/resource.h> |
72 | 70 | ||
71 | #ifdef __KERNEL__ | ||
72 | |||
73 | struct task_struct; | ||
74 | |||
73 | int getrusage(struct task_struct *p, int who, struct rusage __user *ru); | 75 | int getrusage(struct task_struct *p, int who, struct rusage __user *ru); |
74 | 76 | ||
77 | #endif /* __KERNEL__ */ | ||
78 | |||
75 | #endif | 79 | #endif |
diff --git a/include/linux/sched.h b/include/linux/sched.h index f2f842db03ce..8d4991be9d53 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2601,6 +2601,28 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | |||
2601 | } | 2601 | } |
2602 | #endif /* CONFIG_MM_OWNER */ | 2602 | #endif /* CONFIG_MM_OWNER */ |
2603 | 2603 | ||
2604 | static inline unsigned long task_rlimit(const struct task_struct *tsk, | ||
2605 | unsigned int limit) | ||
2606 | { | ||
2607 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur); | ||
2608 | } | ||
2609 | |||
2610 | static inline unsigned long task_rlimit_max(const struct task_struct *tsk, | ||
2611 | unsigned int limit) | ||
2612 | { | ||
2613 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max); | ||
2614 | } | ||
2615 | |||
2616 | static inline unsigned long rlimit(unsigned int limit) | ||
2617 | { | ||
2618 | return task_rlimit(current, limit); | ||
2619 | } | ||
2620 | |||
2621 | static inline unsigned long rlimit_max(unsigned int limit) | ||
2622 | { | ||
2623 | return task_rlimit_max(current, limit); | ||
2624 | } | ||
2625 | |||
2604 | #endif /* __KERNEL__ */ | 2626 | #endif /* __KERNEL__ */ |
2605 | 2627 | ||
2606 | #endif | 2628 | #endif |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 65793e90d6f6..207466a49f3d 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -195,7 +195,7 @@ struct perf_event_attr; | |||
195 | static const struct syscall_metadata __used \ | 195 | static const struct syscall_metadata __used \ |
196 | __attribute__((__aligned__(4))) \ | 196 | __attribute__((__aligned__(4))) \ |
197 | __attribute__((section("__syscalls_metadata"))) \ | 197 | __attribute__((section("__syscalls_metadata"))) \ |
198 | __syscall_meta_##sname = { \ | 198 | __syscall_meta__##sname = { \ |
199 | .name = "sys_"#sname, \ | 199 | .name = "sys_"#sname, \ |
200 | .nb_args = 0, \ | 200 | .nb_args = 0, \ |
201 | .enter_event = &event_enter__##sname, \ | 201 | .enter_event = &event_enter__##sname, \ |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 877ba039e6a4..bd27fbc9db62 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -482,6 +482,7 @@ enum | |||
482 | NET_IPV4_CONF_ARP_ACCEPT=21, | 482 | NET_IPV4_CONF_ARP_ACCEPT=21, |
483 | NET_IPV4_CONF_ARP_NOTIFY=22, | 483 | NET_IPV4_CONF_ARP_NOTIFY=22, |
484 | NET_IPV4_CONF_ACCEPT_LOCAL=23, | 484 | NET_IPV4_CONF_ACCEPT_LOCAL=23, |
485 | NET_IPV4_CONF_SRC_VMARK=24, | ||
485 | __NET_IPV4_CONF_MAX | 486 | __NET_IPV4_CONF_MAX |
486 | }; | 487 | }; |
487 | 488 | ||
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 6b58367d145e..d512d98dfb7d 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
@@ -94,6 +94,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, | |||
94 | * happens, handle that and return -EFAULT. | 94 | * happens, handle that and return -EFAULT. |
95 | */ | 95 | */ |
96 | extern long probe_kernel_read(void *dst, void *src, size_t size); | 96 | extern long probe_kernel_read(void *dst, void *src, size_t size); |
97 | extern long __probe_kernel_read(void *dst, void *src, size_t size); | ||
97 | 98 | ||
98 | /* | 99 | /* |
99 | * probe_kernel_write(): safely attempt to write to a location | 100 | * probe_kernel_write(): safely attempt to write to a location |
@@ -104,6 +105,7 @@ extern long probe_kernel_read(void *dst, void *src, size_t size); | |||
104 | * Safely write to address @dst from the buffer at @src. If a kernel fault | 105 | * Safely write to address @dst from the buffer at @src. If a kernel fault |
105 | * happens, handle that and return -EFAULT. | 106 | * happens, handle that and return -EFAULT. |
106 | */ | 107 | */ |
107 | extern long probe_kernel_write(void *dst, void *src, size_t size); | 108 | extern long notrace probe_kernel_write(void *dst, void *src, size_t size); |
109 | extern long notrace __probe_kernel_write(void *dst, void *src, size_t size); | ||
108 | 110 | ||
109 | #endif /* __LINUX_UACCESS_H__ */ | 111 | #endif /* __LINUX_UACCESS_H__ */ |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index c18c008f4bbf..76e8903cd204 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -70,6 +70,7 @@ struct writeback_control { | |||
70 | struct bdi_writeback; | 70 | struct bdi_writeback; |
71 | int inode_wait(void *); | 71 | int inode_wait(void *); |
72 | void writeback_inodes_sb(struct super_block *); | 72 | void writeback_inodes_sb(struct super_block *); |
73 | int writeback_inodes_sb_if_idle(struct super_block *); | ||
73 | void sync_inodes_sb(struct super_block *); | 74 | void sync_inodes_sb(struct super_block *); |
74 | void writeback_inodes_wbc(struct writeback_control *wbc); | 75 | void writeback_inodes_wbc(struct writeback_control *wbc); |
75 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); | 76 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 2aff4906b2ae..0bf369752274 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -547,7 +547,6 @@ enum mac80211_rx_flags { | |||
547 | * unspecified depending on the hardware capabilities flags | 547 | * unspecified depending on the hardware capabilities flags |
548 | * @IEEE80211_HW_SIGNAL_* | 548 | * @IEEE80211_HW_SIGNAL_* |
549 | * @noise: noise when receiving this frame, in dBm. | 549 | * @noise: noise when receiving this frame, in dBm. |
550 | * @qual: overall signal quality indication, in percent (0-100). | ||
551 | * @antenna: antenna used | 550 | * @antenna: antenna used |
552 | * @rate_idx: index of data rate into band's supported rates or MCS index if | 551 | * @rate_idx: index of data rate into band's supported rates or MCS index if |
553 | * HT rates are use (RX_FLAG_HT) | 552 | * HT rates are use (RX_FLAG_HT) |
@@ -559,7 +558,6 @@ struct ieee80211_rx_status { | |||
559 | int freq; | 558 | int freq; |
560 | int signal; | 559 | int signal; |
561 | int noise; | 560 | int noise; |
562 | int __deprecated qual; | ||
563 | int antenna; | 561 | int antenna; |
564 | int rate_idx; | 562 | int rate_idx; |
565 | int flag; | 563 | int flag; |
@@ -1737,6 +1735,12 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw, | |||
1737 | local_bh_enable(); | 1735 | local_bh_enable(); |
1738 | } | 1736 | } |
1739 | 1737 | ||
1738 | /* | ||
1739 | * The TX headroom reserved by mac80211 for its own tx_status functions. | ||
1740 | * This is enough for the radiotap header. | ||
1741 | */ | ||
1742 | #define IEEE80211_TX_STATUS_HEADROOM 13 | ||
1743 | |||
1740 | /** | 1744 | /** |
1741 | * ieee80211_tx_status - transmit status callback | 1745 | * ieee80211_tx_status - transmit status callback |
1742 | * | 1746 | * |
diff --git a/include/scsi/libsrp.h b/include/scsi/libsrp.h index 07e3adde21d9..f4105c91af53 100644 --- a/include/scsi/libsrp.h +++ b/include/scsi/libsrp.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __LIBSRP_H__ | 2 | #define __LIBSRP_H__ |
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/kfifo.h> | ||
5 | #include <scsi/scsi_cmnd.h> | 6 | #include <scsi/scsi_cmnd.h> |
6 | #include <scsi/scsi_host.h> | 7 | #include <scsi/scsi_host.h> |
7 | #include <scsi/srp.h> | 8 | #include <scsi/srp.h> |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 73523151a731..c6fe03e902ca 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -414,7 +414,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
414 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 414 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
415 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 415 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
416 | offsetof(typeof(field), item), \ | 416 | offsetof(typeof(field), item), \ |
417 | sizeof(field.item), 0, FILTER_OTHER); \ | 417 | sizeof(field.item), \ |
418 | is_signed_type(type), FILTER_OTHER); \ | ||
418 | if (ret) \ | 419 | if (ret) \ |
419 | return ret; | 420 | return ret; |
420 | 421 | ||
@@ -422,8 +423,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
422 | #define __dynamic_array(type, item, len) \ | 423 | #define __dynamic_array(type, item, len) \ |
423 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ | 424 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ |
424 | offsetof(typeof(field), __data_loc_##item), \ | 425 | offsetof(typeof(field), __data_loc_##item), \ |
425 | sizeof(field.__data_loc_##item), 0, \ | 426 | sizeof(field.__data_loc_##item), \ |
426 | FILTER_OTHER); | 427 | is_signed_type(type), FILTER_OTHER); |
427 | 428 | ||
428 | #undef __string | 429 | #undef __string |
429 | #define __string(item, src) __dynamic_array(char, item, -1) | 430 | #define __string(item, src) __dynamic_array(char, item, -1) |
diff --git a/init/Kconfig b/init/Kconfig index a23da9f01803..d95ca7cd5d45 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -115,10 +115,13 @@ config HAVE_KERNEL_BZIP2 | |||
115 | config HAVE_KERNEL_LZMA | 115 | config HAVE_KERNEL_LZMA |
116 | bool | 116 | bool |
117 | 117 | ||
118 | config HAVE_KERNEL_LZO | ||
119 | bool | ||
120 | |||
118 | choice | 121 | choice |
119 | prompt "Kernel compression mode" | 122 | prompt "Kernel compression mode" |
120 | default KERNEL_GZIP | 123 | default KERNEL_GZIP |
121 | depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA | 124 | depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_LZO |
122 | help | 125 | help |
123 | The linux kernel is a kind of self-extracting executable. | 126 | The linux kernel is a kind of self-extracting executable. |
124 | Several compression algorithms are available, which differ | 127 | Several compression algorithms are available, which differ |
@@ -141,9 +144,8 @@ config KERNEL_GZIP | |||
141 | bool "Gzip" | 144 | bool "Gzip" |
142 | depends on HAVE_KERNEL_GZIP | 145 | depends on HAVE_KERNEL_GZIP |
143 | help | 146 | help |
144 | The old and tried gzip compression. Its compression ratio is | 147 | The old and tried gzip compression. It provides a good balance |
145 | the poorest among the 3 choices; however its speed (both | 148 | between compression ratio and decompression speed. |
146 | compression and decompression) is the fastest. | ||
147 | 149 | ||
148 | config KERNEL_BZIP2 | 150 | config KERNEL_BZIP2 |
149 | bool "Bzip2" | 151 | bool "Bzip2" |
@@ -164,6 +166,14 @@ config KERNEL_LZMA | |||
164 | two. Compression is slowest. The kernel size is about 33% | 166 | two. Compression is slowest. The kernel size is about 33% |
165 | smaller with LZMA in comparison to gzip. | 167 | smaller with LZMA in comparison to gzip. |
166 | 168 | ||
169 | config KERNEL_LZO | ||
170 | bool "LZO" | ||
171 | depends on HAVE_KERNEL_LZO | ||
172 | help | ||
173 | Its compression ratio is the poorest among the 4. The kernel | ||
174 | size is about about 10% bigger than gzip; however its speed | ||
175 | (both compression and decompression) is the fastest. | ||
176 | |||
167 | endchoice | 177 | endchoice |
168 | 178 | ||
169 | config SWAP | 179 | config SWAP |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 0249f4be9b5c..1fbcc748044a 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2468,7 +2468,6 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp, | |||
2468 | /* make sure l doesn't vanish out from under us */ | 2468 | /* make sure l doesn't vanish out from under us */ |
2469 | down_write(&l->mutex); | 2469 | down_write(&l->mutex); |
2470 | mutex_unlock(&cgrp->pidlist_mutex); | 2470 | mutex_unlock(&cgrp->pidlist_mutex); |
2471 | l->use_count++; | ||
2472 | return l; | 2471 | return l; |
2473 | } | 2472 | } |
2474 | } | 2473 | } |
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c index dbcbf6a33a08..50dbd5999588 100644 --- a/kernel/hw_breakpoint.c +++ b/kernel/hw_breakpoint.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/percpu.h> | 40 | #include <linux/percpu.h> |
41 | #include <linux/sched.h> | 41 | #include <linux/sched.h> |
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/cpu.h> | ||
43 | #include <linux/smp.h> | 44 | #include <linux/smp.h> |
44 | 45 | ||
45 | #include <linux/hw_breakpoint.h> | 46 | #include <linux/hw_breakpoint.h> |
@@ -388,7 +389,8 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr, | |||
388 | if (!cpu_events) | 389 | if (!cpu_events) |
389 | return ERR_PTR(-ENOMEM); | 390 | return ERR_PTR(-ENOMEM); |
390 | 391 | ||
391 | for_each_possible_cpu(cpu) { | 392 | get_online_cpus(); |
393 | for_each_online_cpu(cpu) { | ||
392 | pevent = per_cpu_ptr(cpu_events, cpu); | 394 | pevent = per_cpu_ptr(cpu_events, cpu); |
393 | bp = perf_event_create_kernel_counter(attr, cpu, -1, triggered); | 395 | bp = perf_event_create_kernel_counter(attr, cpu, -1, triggered); |
394 | 396 | ||
@@ -399,18 +401,20 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr, | |||
399 | goto fail; | 401 | goto fail; |
400 | } | 402 | } |
401 | } | 403 | } |
404 | put_online_cpus(); | ||
402 | 405 | ||
403 | return cpu_events; | 406 | return cpu_events; |
404 | 407 | ||
405 | fail: | 408 | fail: |
406 | for_each_possible_cpu(cpu) { | 409 | for_each_online_cpu(cpu) { |
407 | pevent = per_cpu_ptr(cpu_events, cpu); | 410 | pevent = per_cpu_ptr(cpu_events, cpu); |
408 | if (IS_ERR(*pevent)) | 411 | if (IS_ERR(*pevent)) |
409 | break; | 412 | break; |
410 | unregister_hw_breakpoint(*pevent); | 413 | unregister_hw_breakpoint(*pevent); |
411 | } | 414 | } |
415 | put_online_cpus(); | ||
416 | |||
412 | free_percpu(cpu_events); | 417 | free_percpu(cpu_events); |
413 | /* return the error if any */ | ||
414 | return ERR_PTR(err); | 418 | return ERR_PTR(err); |
415 | } | 419 | } |
416 | EXPORT_SYMBOL_GPL(register_wide_hw_breakpoint); | 420 | EXPORT_SYMBOL_GPL(register_wide_hw_breakpoint); |
diff --git a/kernel/kmod.c b/kernel/kmod.c index 25b103190364..bf0e231d9702 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -520,13 +520,15 @@ int call_usermodehelper_pipe(char *path, char **argv, char **envp, | |||
520 | return -ENOMEM; | 520 | return -ENOMEM; |
521 | 521 | ||
522 | ret = call_usermodehelper_stdinpipe(sub_info, filp); | 522 | ret = call_usermodehelper_stdinpipe(sub_info, filp); |
523 | if (ret < 0) | 523 | if (ret < 0) { |
524 | goto out; | 524 | call_usermodehelper_freeinfo(sub_info); |
525 | return ret; | ||
526 | } | ||
525 | 527 | ||
526 | return call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC); | 528 | ret = call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC); |
529 | if (ret < 0) /* Failed to execute helper, close pipe */ | ||
530 | filp_close(*filp, NULL); | ||
527 | 531 | ||
528 | out: | ||
529 | call_usermodehelper_freeinfo(sub_info); | ||
530 | return ret; | 532 | return ret; |
531 | } | 533 | } |
532 | EXPORT_SYMBOL(call_usermodehelper_pipe); | 534 | EXPORT_SYMBOL(call_usermodehelper_pipe); |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index e5342a344c43..b7df302a0204 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -1035,7 +1035,7 @@ int __kprobes register_kretprobe(struct kretprobe *rp) | |||
1035 | /* Pre-allocate memory for max kretprobe instances */ | 1035 | /* Pre-allocate memory for max kretprobe instances */ |
1036 | if (rp->maxactive <= 0) { | 1036 | if (rp->maxactive <= 0) { |
1037 | #ifdef CONFIG_PREEMPT | 1037 | #ifdef CONFIG_PREEMPT |
1038 | rp->maxactive = max(10, 2 * num_possible_cpus()); | 1038 | rp->maxactive = max_t(unsigned int, 10, 2*num_possible_cpus()); |
1039 | #else | 1039 | #else |
1040 | rp->maxactive = num_possible_cpus(); | 1040 | rp->maxactive = num_possible_cpus(); |
1041 | #endif | 1041 | #endif |
diff --git a/kernel/module.c b/kernel/module.c index e96b8ed1cb6a..f82386bd9ee9 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1010,6 +1010,12 @@ static const struct kernel_symbol *resolve_symbol(Elf_Shdr *sechdrs, | |||
1010 | * J. Corbet <corbet@lwn.net> | 1010 | * J. Corbet <corbet@lwn.net> |
1011 | */ | 1011 | */ |
1012 | #if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS) | 1012 | #if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS) |
1013 | |||
1014 | static inline bool sect_empty(const Elf_Shdr *sect) | ||
1015 | { | ||
1016 | return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0; | ||
1017 | } | ||
1018 | |||
1013 | struct module_sect_attr | 1019 | struct module_sect_attr |
1014 | { | 1020 | { |
1015 | struct module_attribute mattr; | 1021 | struct module_attribute mattr; |
@@ -1051,8 +1057,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, | |||
1051 | 1057 | ||
1052 | /* Count loaded sections and allocate structures */ | 1058 | /* Count loaded sections and allocate structures */ |
1053 | for (i = 0; i < nsect; i++) | 1059 | for (i = 0; i < nsect; i++) |
1054 | if (sechdrs[i].sh_flags & SHF_ALLOC | 1060 | if (!sect_empty(&sechdrs[i])) |
1055 | && sechdrs[i].sh_size) | ||
1056 | nloaded++; | 1061 | nloaded++; |
1057 | size[0] = ALIGN(sizeof(*sect_attrs) | 1062 | size[0] = ALIGN(sizeof(*sect_attrs) |
1058 | + nloaded * sizeof(sect_attrs->attrs[0]), | 1063 | + nloaded * sizeof(sect_attrs->attrs[0]), |
@@ -1070,9 +1075,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, | |||
1070 | sattr = §_attrs->attrs[0]; | 1075 | sattr = §_attrs->attrs[0]; |
1071 | gattr = §_attrs->grp.attrs[0]; | 1076 | gattr = §_attrs->grp.attrs[0]; |
1072 | for (i = 0; i < nsect; i++) { | 1077 | for (i = 0; i < nsect; i++) { |
1073 | if (! (sechdrs[i].sh_flags & SHF_ALLOC)) | 1078 | if (sect_empty(&sechdrs[i])) |
1074 | continue; | ||
1075 | if (!sechdrs[i].sh_size) | ||
1076 | continue; | 1079 | continue; |
1077 | sattr->address = sechdrs[i].sh_addr; | 1080 | sattr->address = sechdrs[i].sh_addr; |
1078 | sattr->name = kstrdup(secstrings + sechdrs[i].sh_name, | 1081 | sattr->name = kstrdup(secstrings + sechdrs[i].sh_name, |
@@ -1156,7 +1159,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect, | |||
1156 | /* Count notes sections and allocate structures. */ | 1159 | /* Count notes sections and allocate structures. */ |
1157 | notes = 0; | 1160 | notes = 0; |
1158 | for (i = 0; i < nsect; i++) | 1161 | for (i = 0; i < nsect; i++) |
1159 | if ((sechdrs[i].sh_flags & SHF_ALLOC) && | 1162 | if (!sect_empty(&sechdrs[i]) && |
1160 | (sechdrs[i].sh_type == SHT_NOTE)) | 1163 | (sechdrs[i].sh_type == SHT_NOTE)) |
1161 | ++notes; | 1164 | ++notes; |
1162 | 1165 | ||
@@ -1172,7 +1175,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect, | |||
1172 | notes_attrs->notes = notes; | 1175 | notes_attrs->notes = notes; |
1173 | nattr = ¬es_attrs->attrs[0]; | 1176 | nattr = ¬es_attrs->attrs[0]; |
1174 | for (loaded = i = 0; i < nsect; ++i) { | 1177 | for (loaded = i = 0; i < nsect; ++i) { |
1175 | if (!(sechdrs[i].sh_flags & SHF_ALLOC)) | 1178 | if (sect_empty(&sechdrs[i])) |
1176 | continue; | 1179 | continue; |
1177 | if (sechdrs[i].sh_type == SHT_NOTE) { | 1180 | if (sechdrs[i].sh_type == SHT_NOTE) { |
1178 | nattr->attr.name = mod->sect_attrs->attrs[loaded].name; | 1181 | nattr->attr.name = mod->sect_attrs->attrs[loaded].name; |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 1f38270f08c7..603c0d8b5df1 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -5148,7 +5148,7 @@ int perf_event_init_task(struct task_struct *child) | |||
5148 | GFP_KERNEL); | 5148 | GFP_KERNEL); |
5149 | if (!child_ctx) { | 5149 | if (!child_ctx) { |
5150 | ret = -ENOMEM; | 5150 | ret = -ENOMEM; |
5151 | goto exit; | 5151 | break; |
5152 | } | 5152 | } |
5153 | 5153 | ||
5154 | __perf_event_init_context(child_ctx, child); | 5154 | __perf_event_init_context(child_ctx, child); |
@@ -5164,7 +5164,7 @@ int perf_event_init_task(struct task_struct *child) | |||
5164 | } | 5164 | } |
5165 | } | 5165 | } |
5166 | 5166 | ||
5167 | if (inherited_all) { | 5167 | if (child_ctx && inherited_all) { |
5168 | /* | 5168 | /* |
5169 | * Mark the child context as a clone of the parent | 5169 | * Mark the child context as a clone of the parent |
5170 | * context, or of whatever the parent is a clone of. | 5170 | * context, or of whatever the parent is a clone of. |
@@ -5184,7 +5184,6 @@ int perf_event_init_task(struct task_struct *child) | |||
5184 | get_ctx(child_ctx->parent_ctx); | 5184 | get_ctx(child_ctx->parent_ctx); |
5185 | } | 5185 | } |
5186 | 5186 | ||
5187 | exit: | ||
5188 | mutex_unlock(&parent_ctx->mutex); | 5187 | mutex_unlock(&parent_ctx->mutex); |
5189 | 5188 | ||
5190 | perf_unpin_context(parent_ctx); | 5189 | perf_unpin_context(parent_ctx); |
diff --git a/kernel/signal.c b/kernel/signal.c index d09692b40376..934ae5e687b9 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -979,7 +979,8 @@ static void print_fatal_signal(struct pt_regs *regs, int signr) | |||
979 | for (i = 0; i < 16; i++) { | 979 | for (i = 0; i < 16; i++) { |
980 | unsigned char insn; | 980 | unsigned char insn; |
981 | 981 | ||
982 | __get_user(insn, (unsigned char *)(regs->ip + i)); | 982 | if (get_user(insn, (unsigned char *)(regs->ip + i))) |
983 | break; | ||
983 | printk("%02x ", insn); | 984 | printk("%02x ", insn); |
984 | } | 985 | } |
985 | } | 986 | } |
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index d006554888dc..6c22d8a2f289 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -12,17 +12,17 @@ config NOP_TRACER | |||
12 | config HAVE_FTRACE_NMI_ENTER | 12 | config HAVE_FTRACE_NMI_ENTER |
13 | bool | 13 | bool |
14 | help | 14 | help |
15 | See Documentation/trace/ftrace-implementation.txt | 15 | See Documentation/trace/ftrace-design.txt |
16 | 16 | ||
17 | config HAVE_FUNCTION_TRACER | 17 | config HAVE_FUNCTION_TRACER |
18 | bool | 18 | bool |
19 | help | 19 | help |
20 | See Documentation/trace/ftrace-implementation.txt | 20 | See Documentation/trace/ftrace-design.txt |
21 | 21 | ||
22 | config HAVE_FUNCTION_GRAPH_TRACER | 22 | config HAVE_FUNCTION_GRAPH_TRACER |
23 | bool | 23 | bool |
24 | help | 24 | help |
25 | See Documentation/trace/ftrace-implementation.txt | 25 | See Documentation/trace/ftrace-design.txt |
26 | 26 | ||
27 | config HAVE_FUNCTION_GRAPH_FP_TEST | 27 | config HAVE_FUNCTION_GRAPH_FP_TEST |
28 | bool | 28 | bool |
@@ -34,17 +34,17 @@ config HAVE_FUNCTION_GRAPH_FP_TEST | |||
34 | config HAVE_FUNCTION_TRACE_MCOUNT_TEST | 34 | config HAVE_FUNCTION_TRACE_MCOUNT_TEST |
35 | bool | 35 | bool |
36 | help | 36 | help |
37 | See Documentation/trace/ftrace-implementation.txt | 37 | See Documentation/trace/ftrace-design.txt |
38 | 38 | ||
39 | config HAVE_DYNAMIC_FTRACE | 39 | config HAVE_DYNAMIC_FTRACE |
40 | bool | 40 | bool |
41 | help | 41 | help |
42 | See Documentation/trace/ftrace-implementation.txt | 42 | See Documentation/trace/ftrace-design.txt |
43 | 43 | ||
44 | config HAVE_FTRACE_MCOUNT_RECORD | 44 | config HAVE_FTRACE_MCOUNT_RECORD |
45 | bool | 45 | bool |
46 | help | 46 | help |
47 | See Documentation/trace/ftrace-implementation.txt | 47 | See Documentation/trace/ftrace-design.txt |
48 | 48 | ||
49 | config HAVE_HW_BRANCH_TRACER | 49 | config HAVE_HW_BRANCH_TRACER |
50 | bool | 50 | bool |
@@ -52,7 +52,7 @@ config HAVE_HW_BRANCH_TRACER | |||
52 | config HAVE_SYSCALL_TRACEPOINTS | 52 | config HAVE_SYSCALL_TRACEPOINTS |
53 | bool | 53 | bool |
54 | help | 54 | help |
55 | See Documentation/trace/ftrace-implementation.txt | 55 | See Documentation/trace/ftrace-design.txt |
56 | 56 | ||
57 | config TRACER_MAX_TRACE | 57 | config TRACER_MAX_TRACE |
58 | bool | 58 | bool |
@@ -83,7 +83,7 @@ config RING_BUFFER_ALLOW_SWAP | |||
83 | # This allows those options to appear when no other tracer is selected. But the | 83 | # This allows those options to appear when no other tracer is selected. But the |
84 | # options do not appear when something else selects it. We need the two options | 84 | # options do not appear when something else selects it. We need the two options |
85 | # GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the | 85 | # GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the |
86 | # hidding of the automatic options. | 86 | # hiding of the automatic options. |
87 | 87 | ||
88 | config TRACING | 88 | config TRACING |
89 | bool | 89 | bool |
@@ -119,7 +119,7 @@ menuconfig FTRACE | |||
119 | bool "Tracers" | 119 | bool "Tracers" |
120 | default y if DEBUG_KERNEL | 120 | default y if DEBUG_KERNEL |
121 | help | 121 | help |
122 | Enable the kernel tracing infrastructure. | 122 | Enable the kernel tracing infrastructure. |
123 | 123 | ||
124 | if FTRACE | 124 | if FTRACE |
125 | 125 | ||
@@ -133,7 +133,7 @@ config FUNCTION_TRACER | |||
133 | help | 133 | help |
134 | Enable the kernel to trace every kernel function. This is done | 134 | Enable the kernel to trace every kernel function. This is done |
135 | by using a compiler feature to insert a small, 5-byte No-Operation | 135 | by using a compiler feature to insert a small, 5-byte No-Operation |
136 | instruction to the beginning of every kernel function, which NOP | 136 | instruction at the beginning of every kernel function, which NOP |
137 | sequence is then dynamically patched into a tracer call when | 137 | sequence is then dynamically patched into a tracer call when |
138 | tracing is enabled by the administrator. If it's runtime disabled | 138 | tracing is enabled by the administrator. If it's runtime disabled |
139 | (the bootup default), then the overhead of the instructions is very | 139 | (the bootup default), then the overhead of the instructions is very |
@@ -150,7 +150,7 @@ config FUNCTION_GRAPH_TRACER | |||
150 | and its entry. | 150 | and its entry. |
151 | Its first purpose is to trace the duration of functions and | 151 | Its first purpose is to trace the duration of functions and |
152 | draw a call graph for each thread with some information like | 152 | draw a call graph for each thread with some information like |
153 | the return value. This is done by setting the current return | 153 | the return value. This is done by setting the current return |
154 | address on the current task structure into a stack of calls. | 154 | address on the current task structure into a stack of calls. |
155 | 155 | ||
156 | 156 | ||
@@ -173,7 +173,7 @@ config IRQSOFF_TRACER | |||
173 | 173 | ||
174 | echo 0 > /sys/kernel/debug/tracing/tracing_max_latency | 174 | echo 0 > /sys/kernel/debug/tracing/tracing_max_latency |
175 | 175 | ||
176 | (Note that kernel size and overhead increases with this option | 176 | (Note that kernel size and overhead increase with this option |
177 | enabled. This option and the preempt-off timing option can be | 177 | enabled. This option and the preempt-off timing option can be |
178 | used together or separately.) | 178 | used together or separately.) |
179 | 179 | ||
@@ -186,7 +186,7 @@ config PREEMPT_TRACER | |||
186 | select TRACER_MAX_TRACE | 186 | select TRACER_MAX_TRACE |
187 | select RING_BUFFER_ALLOW_SWAP | 187 | select RING_BUFFER_ALLOW_SWAP |
188 | help | 188 | help |
189 | This option measures the time spent in preemption off critical | 189 | This option measures the time spent in preemption-off critical |
190 | sections, with microsecond accuracy. | 190 | sections, with microsecond accuracy. |
191 | 191 | ||
192 | The default measurement method is a maximum search, which is | 192 | The default measurement method is a maximum search, which is |
@@ -195,7 +195,7 @@ config PREEMPT_TRACER | |||
195 | 195 | ||
196 | echo 0 > /sys/kernel/debug/tracing/tracing_max_latency | 196 | echo 0 > /sys/kernel/debug/tracing/tracing_max_latency |
197 | 197 | ||
198 | (Note that kernel size and overhead increases with this option | 198 | (Note that kernel size and overhead increase with this option |
199 | enabled. This option and the irqs-off timing option can be | 199 | enabled. This option and the irqs-off timing option can be |
200 | used together or separately.) | 200 | used together or separately.) |
201 | 201 | ||
@@ -222,7 +222,7 @@ config ENABLE_DEFAULT_TRACERS | |||
222 | depends on !GENERIC_TRACER | 222 | depends on !GENERIC_TRACER |
223 | select TRACING | 223 | select TRACING |
224 | help | 224 | help |
225 | This tracer hooks to various trace points in the kernel | 225 | This tracer hooks to various trace points in the kernel, |
226 | allowing the user to pick and choose which trace point they | 226 | allowing the user to pick and choose which trace point they |
227 | want to trace. It also includes the sched_switch tracer plugin. | 227 | want to trace. It also includes the sched_switch tracer plugin. |
228 | 228 | ||
@@ -265,19 +265,19 @@ choice | |||
265 | The likely/unlikely profiler only looks at the conditions that | 265 | The likely/unlikely profiler only looks at the conditions that |
266 | are annotated with a likely or unlikely macro. | 266 | are annotated with a likely or unlikely macro. |
267 | 267 | ||
268 | The "all branch" profiler will profile every if statement in the | 268 | The "all branch" profiler will profile every if-statement in the |
269 | kernel. This profiler will also enable the likely/unlikely | 269 | kernel. This profiler will also enable the likely/unlikely |
270 | profiler as well. | 270 | profiler. |
271 | 271 | ||
272 | Either of the above profilers add a bit of overhead to the system. | 272 | Either of the above profilers adds a bit of overhead to the system. |
273 | If unsure choose "No branch profiling". | 273 | If unsure, choose "No branch profiling". |
274 | 274 | ||
275 | config BRANCH_PROFILE_NONE | 275 | config BRANCH_PROFILE_NONE |
276 | bool "No branch profiling" | 276 | bool "No branch profiling" |
277 | help | 277 | help |
278 | No branch profiling. Branch profiling adds a bit of overhead. | 278 | No branch profiling. Branch profiling adds a bit of overhead. |
279 | Only enable it if you want to analyse the branching behavior. | 279 | Only enable it if you want to analyse the branching behavior. |
280 | Otherwise keep it disabled. | 280 | Otherwise keep it disabled. |
281 | 281 | ||
282 | config PROFILE_ANNOTATED_BRANCHES | 282 | config PROFILE_ANNOTATED_BRANCHES |
283 | bool "Trace likely/unlikely profiler" | 283 | bool "Trace likely/unlikely profiler" |
@@ -288,7 +288,7 @@ config PROFILE_ANNOTATED_BRANCHES | |||
288 | 288 | ||
289 | /sys/kernel/debug/tracing/profile_annotated_branch | 289 | /sys/kernel/debug/tracing/profile_annotated_branch |
290 | 290 | ||
291 | Note: this will add a significant overhead, only turn this | 291 | Note: this will add a significant overhead; only turn this |
292 | on if you need to profile the system's use of these macros. | 292 | on if you need to profile the system's use of these macros. |
293 | 293 | ||
294 | config PROFILE_ALL_BRANCHES | 294 | config PROFILE_ALL_BRANCHES |
@@ -305,7 +305,7 @@ config PROFILE_ALL_BRANCHES | |||
305 | 305 | ||
306 | This configuration, when enabled, will impose a great overhead | 306 | This configuration, when enabled, will impose a great overhead |
307 | on the system. This should only be enabled when the system | 307 | on the system. This should only be enabled when the system |
308 | is to be analyzed | 308 | is to be analyzed in much detail. |
309 | endchoice | 309 | endchoice |
310 | 310 | ||
311 | config TRACING_BRANCHES | 311 | config TRACING_BRANCHES |
@@ -335,7 +335,7 @@ config POWER_TRACER | |||
335 | depends on X86 | 335 | depends on X86 |
336 | select GENERIC_TRACER | 336 | select GENERIC_TRACER |
337 | help | 337 | help |
338 | This tracer helps developers to analyze and optimize the kernels | 338 | This tracer helps developers to analyze and optimize the kernel's |
339 | power management decisions, specifically the C-state and P-state | 339 | power management decisions, specifically the C-state and P-state |
340 | behavior. | 340 | behavior. |
341 | 341 | ||
@@ -391,14 +391,14 @@ config HW_BRANCH_TRACER | |||
391 | select GENERIC_TRACER | 391 | select GENERIC_TRACER |
392 | help | 392 | help |
393 | This tracer records all branches on the system in a circular | 393 | This tracer records all branches on the system in a circular |
394 | buffer giving access to the last N branches for each cpu. | 394 | buffer, giving access to the last N branches for each cpu. |
395 | 395 | ||
396 | config KMEMTRACE | 396 | config KMEMTRACE |
397 | bool "Trace SLAB allocations" | 397 | bool "Trace SLAB allocations" |
398 | select GENERIC_TRACER | 398 | select GENERIC_TRACER |
399 | help | 399 | help |
400 | kmemtrace provides tracing for slab allocator functions, such as | 400 | kmemtrace provides tracing for slab allocator functions, such as |
401 | kmalloc, kfree, kmem_cache_alloc, kmem_cache_free etc.. Collected | 401 | kmalloc, kfree, kmem_cache_alloc, kmem_cache_free, etc. Collected |
402 | data is then fed to the userspace application in order to analyse | 402 | data is then fed to the userspace application in order to analyse |
403 | allocation hotspots, internal fragmentation and so on, making it | 403 | allocation hotspots, internal fragmentation and so on, making it |
404 | possible to see how well an allocator performs, as well as debug | 404 | possible to see how well an allocator performs, as well as debug |
@@ -417,15 +417,15 @@ config WORKQUEUE_TRACER | |||
417 | bool "Trace workqueues" | 417 | bool "Trace workqueues" |
418 | select GENERIC_TRACER | 418 | select GENERIC_TRACER |
419 | help | 419 | help |
420 | The workqueue tracer provides some statistical informations | 420 | The workqueue tracer provides some statistical information |
421 | about each cpu workqueue thread such as the number of the | 421 | about each cpu workqueue thread such as the number of the |
422 | works inserted and executed since their creation. It can help | 422 | works inserted and executed since their creation. It can help |
423 | to evaluate the amount of work each of them have to perform. | 423 | to evaluate the amount of work each of them has to perform. |
424 | For example it can help a developer to decide whether he should | 424 | For example it can help a developer to decide whether he should |
425 | choose a per cpu workqueue instead of a singlethreaded one. | 425 | choose a per-cpu workqueue instead of a singlethreaded one. |
426 | 426 | ||
427 | config BLK_DEV_IO_TRACE | 427 | config BLK_DEV_IO_TRACE |
428 | bool "Support for tracing block io actions" | 428 | bool "Support for tracing block IO actions" |
429 | depends on SYSFS | 429 | depends on SYSFS |
430 | depends on BLOCK | 430 | depends on BLOCK |
431 | select RELAY | 431 | select RELAY |
@@ -456,15 +456,15 @@ config KPROBE_EVENT | |||
456 | select TRACING | 456 | select TRACING |
457 | default y | 457 | default y |
458 | help | 458 | help |
459 | This allows the user to add tracing events (similar to tracepoints) on the fly | 459 | This allows the user to add tracing events (similar to tracepoints) |
460 | via the ftrace interface. See Documentation/trace/kprobetrace.txt | 460 | on the fly via the ftrace interface. See |
461 | for more details. | 461 | Documentation/trace/kprobetrace.txt for more details. |
462 | 462 | ||
463 | Those events can be inserted wherever kprobes can probe, and record | 463 | Those events can be inserted wherever kprobes can probe, and record |
464 | various register and memory values. | 464 | various register and memory values. |
465 | 465 | ||
466 | This option is also required by perf-probe subcommand of perf tools. If | 466 | This option is also required by perf-probe subcommand of perf tools. |
467 | you want to use perf tools, this option is strongly recommended. | 467 | If you want to use perf tools, this option is strongly recommended. |
468 | 468 | ||
469 | config DYNAMIC_FTRACE | 469 | config DYNAMIC_FTRACE |
470 | bool "enable/disable ftrace tracepoints dynamically" | 470 | bool "enable/disable ftrace tracepoints dynamically" |
@@ -472,32 +472,32 @@ config DYNAMIC_FTRACE | |||
472 | depends on HAVE_DYNAMIC_FTRACE | 472 | depends on HAVE_DYNAMIC_FTRACE |
473 | default y | 473 | default y |
474 | help | 474 | help |
475 | This option will modify all the calls to ftrace dynamically | 475 | This option will modify all the calls to ftrace dynamically |
476 | (will patch them out of the binary image and replaces them | 476 | (will patch them out of the binary image and replace them |
477 | with a No-Op instruction) as they are called. A table is | 477 | with a No-Op instruction) as they are called. A table is |
478 | created to dynamically enable them again. | 478 | created to dynamically enable them again. |
479 | 479 | ||
480 | This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but otherwise | 480 | This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but |
481 | has native performance as long as no tracing is active. | 481 | otherwise has native performance as long as no tracing is active. |
482 | 482 | ||
483 | The changes to the code are done by a kernel thread that | 483 | The changes to the code are done by a kernel thread that |
484 | wakes up once a second and checks to see if any ftrace calls | 484 | wakes up once a second and checks to see if any ftrace calls |
485 | were made. If so, it runs stop_machine (stops all CPUS) | 485 | were made. If so, it runs stop_machine (stops all CPUS) |
486 | and modifies the code to jump over the call to ftrace. | 486 | and modifies the code to jump over the call to ftrace. |
487 | 487 | ||
488 | config FUNCTION_PROFILER | 488 | config FUNCTION_PROFILER |
489 | bool "Kernel function profiler" | 489 | bool "Kernel function profiler" |
490 | depends on FUNCTION_TRACER | 490 | depends on FUNCTION_TRACER |
491 | default n | 491 | default n |
492 | help | 492 | help |
493 | This option enables the kernel function profiler. A file is created | 493 | This option enables the kernel function profiler. A file is created |
494 | in debugfs called function_profile_enabled which defaults to zero. | 494 | in debugfs called function_profile_enabled which defaults to zero. |
495 | When a 1 is echoed into this file profiling begins, and when a | 495 | When a 1 is echoed into this file profiling begins, and when a |
496 | zero is entered, profiling stops. A file in the trace_stats | 496 | zero is entered, profiling stops. A "functions" file is created in |
497 | directory called functions, that show the list of functions that | 497 | the trace_stats directory; this file shows the list of functions that |
498 | have been hit and their counters. | 498 | have been hit and their counters. |
499 | 499 | ||
500 | If in doubt, say N | 500 | If in doubt, say N. |
501 | 501 | ||
502 | config FTRACE_MCOUNT_RECORD | 502 | config FTRACE_MCOUNT_RECORD |
503 | def_bool y | 503 | def_bool y |
@@ -556,8 +556,8 @@ config RING_BUFFER_BENCHMARK | |||
556 | tristate "Ring buffer benchmark stress tester" | 556 | tristate "Ring buffer benchmark stress tester" |
557 | depends on RING_BUFFER | 557 | depends on RING_BUFFER |
558 | help | 558 | help |
559 | This option creates a test to stress the ring buffer and bench mark it. | 559 | This option creates a test to stress the ring buffer and benchmark it. |
560 | It creates its own ring buffer such that it will not interfer with | 560 | It creates its own ring buffer such that it will not interfere with |
561 | any other users of the ring buffer (such as ftrace). It then creates | 561 | any other users of the ring buffer (such as ftrace). It then creates |
562 | a producer and consumer that will run for 10 seconds and sleep for | 562 | a producer and consumer that will run for 10 seconds and sleep for |
563 | 10 seconds. Each interval it will print out the number of events | 563 | 10 seconds. Each interval it will print out the number of events |
@@ -566,7 +566,7 @@ config RING_BUFFER_BENCHMARK | |||
566 | It does not disable interrupts or raise its priority, so it may be | 566 | It does not disable interrupts or raise its priority, so it may be |
567 | affected by processes that are running. | 567 | affected by processes that are running. |
568 | 568 | ||
569 | If unsure, say N | 569 | If unsure, say N. |
570 | 570 | ||
571 | endif # FTRACE | 571 | endif # FTRACE |
572 | 572 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 8b9f20ab8eed..0df1b0f2cb9e 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -3949,7 +3949,7 @@ trace_options_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
3949 | if (!!(topt->flags->val & topt->opt->bit) != val) { | 3949 | if (!!(topt->flags->val & topt->opt->bit) != val) { |
3950 | mutex_lock(&trace_types_lock); | 3950 | mutex_lock(&trace_types_lock); |
3951 | ret = __set_tracer_option(current_trace, topt->flags, | 3951 | ret = __set_tracer_option(current_trace, topt->flags, |
3952 | topt->opt, val); | 3952 | topt->opt, !val); |
3953 | mutex_unlock(&trace_types_lock); | 3953 | mutex_unlock(&trace_types_lock); |
3954 | if (ret) | 3954 | if (ret) |
3955 | return ret; | 3955 | return ret; |
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 458e5bfe26d0..d4fa5dc1ee4e 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -158,7 +158,8 @@ ftrace_format_##name(struct ftrace_event_call *unused, \ | |||
158 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 158 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
159 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 159 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
160 | offsetof(typeof(field), item), \ | 160 | offsetof(typeof(field), item), \ |
161 | sizeof(field.item), 0, FILTER_OTHER); \ | 161 | sizeof(field.item), \ |
162 | is_signed_type(type), FILTER_OTHER); \ | ||
162 | if (ret) \ | 163 | if (ret) \ |
163 | return ret; | 164 | return ret; |
164 | 165 | ||
@@ -168,8 +169,8 @@ ftrace_format_##name(struct ftrace_event_call *unused, \ | |||
168 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 169 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
169 | offsetof(typeof(field), \ | 170 | offsetof(typeof(field), \ |
170 | container.item), \ | 171 | container.item), \ |
171 | sizeof(field.container.item), 0, \ | 172 | sizeof(field.container.item), \ |
172 | FILTER_OTHER); \ | 173 | is_signed_type(type), FILTER_OTHER); \ |
173 | if (ret) \ | 174 | if (ret) \ |
174 | return ret; | 175 | return ret; |
175 | 176 | ||
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 375f81a568dc..6ea90c0e2c96 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -1201,10 +1201,11 @@ static int __probe_event_show_format(struct trace_seq *s, | |||
1201 | #undef SHOW_FIELD | 1201 | #undef SHOW_FIELD |
1202 | #define SHOW_FIELD(type, item, name) \ | 1202 | #define SHOW_FIELD(type, item, name) \ |
1203 | do { \ | 1203 | do { \ |
1204 | ret = trace_seq_printf(s, "\tfield: " #type " %s;\t" \ | 1204 | ret = trace_seq_printf(s, "\tfield:" #type " %s;\t" \ |
1205 | "offset:%u;\tsize:%u;\n", name, \ | 1205 | "offset:%u;\tsize:%u;\tsigned:%d;\n", name,\ |
1206 | (unsigned int)offsetof(typeof(field), item),\ | 1206 | (unsigned int)offsetof(typeof(field), item),\ |
1207 | (unsigned int)sizeof(type)); \ | 1207 | (unsigned int)sizeof(type), \ |
1208 | is_signed_type(type)); \ | ||
1208 | if (!ret) \ | 1209 | if (!ret) \ |
1209 | return 0; \ | 1210 | return 0; \ |
1210 | } while (0) | 1211 | } while (0) |
diff --git a/kernel/trace/trace_ksym.c b/kernel/trace/trace_ksym.c index faf37fa4408c..94103cdcf9d8 100644 --- a/kernel/trace/trace_ksym.c +++ b/kernel/trace/trace_ksym.c | |||
@@ -26,12 +26,13 @@ | |||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | 27 | ||
28 | #include "trace_output.h" | 28 | #include "trace_output.h" |
29 | #include "trace_stat.h" | ||
30 | #include "trace.h" | 29 | #include "trace.h" |
31 | 30 | ||
32 | #include <linux/hw_breakpoint.h> | 31 | #include <linux/hw_breakpoint.h> |
33 | #include <asm/hw_breakpoint.h> | 32 | #include <asm/hw_breakpoint.h> |
34 | 33 | ||
34 | #include <asm/atomic.h> | ||
35 | |||
35 | /* | 36 | /* |
36 | * For now, let us restrict the no. of symbols traced simultaneously to number | 37 | * For now, let us restrict the no. of symbols traced simultaneously to number |
37 | * of available hardware breakpoint registers. | 38 | * of available hardware breakpoint registers. |
@@ -44,7 +45,7 @@ struct trace_ksym { | |||
44 | struct perf_event **ksym_hbp; | 45 | struct perf_event **ksym_hbp; |
45 | struct perf_event_attr attr; | 46 | struct perf_event_attr attr; |
46 | #ifdef CONFIG_PROFILE_KSYM_TRACER | 47 | #ifdef CONFIG_PROFILE_KSYM_TRACER |
47 | unsigned long counter; | 48 | atomic64_t counter; |
48 | #endif | 49 | #endif |
49 | struct hlist_node ksym_hlist; | 50 | struct hlist_node ksym_hlist; |
50 | }; | 51 | }; |
@@ -69,9 +70,8 @@ void ksym_collect_stats(unsigned long hbp_hit_addr) | |||
69 | 70 | ||
70 | rcu_read_lock(); | 71 | rcu_read_lock(); |
71 | hlist_for_each_entry_rcu(entry, node, &ksym_filter_head, ksym_hlist) { | 72 | hlist_for_each_entry_rcu(entry, node, &ksym_filter_head, ksym_hlist) { |
72 | if ((entry->attr.bp_addr == hbp_hit_addr) && | 73 | if (entry->attr.bp_addr == hbp_hit_addr) { |
73 | (entry->counter <= MAX_UL_INT)) { | 74 | atomic64_inc(&entry->counter); |
74 | entry->counter++; | ||
75 | break; | 75 | break; |
76 | } | 76 | } |
77 | } | 77 | } |
@@ -197,7 +197,6 @@ int process_new_ksym_entry(char *ksymname, int op, unsigned long addr) | |||
197 | entry->attr.bp_addr = addr; | 197 | entry->attr.bp_addr = addr; |
198 | entry->attr.bp_len = HW_BREAKPOINT_LEN_4; | 198 | entry->attr.bp_len = HW_BREAKPOINT_LEN_4; |
199 | 199 | ||
200 | ret = -EAGAIN; | ||
201 | entry->ksym_hbp = register_wide_hw_breakpoint(&entry->attr, | 200 | entry->ksym_hbp = register_wide_hw_breakpoint(&entry->attr, |
202 | ksym_hbp_handler); | 201 | ksym_hbp_handler); |
203 | 202 | ||
@@ -300,8 +299,8 @@ static ssize_t ksym_trace_filter_write(struct file *file, | |||
300 | * 2: echo 0 > ksym_trace_filter | 299 | * 2: echo 0 > ksym_trace_filter |
301 | * 3: echo "*:---" > ksym_trace_filter | 300 | * 3: echo "*:---" > ksym_trace_filter |
302 | */ | 301 | */ |
303 | if (!buf[0] || !strcmp(buf, "0") || | 302 | if (!input_string[0] || !strcmp(input_string, "0") || |
304 | !strcmp(buf, "*:---")) { | 303 | !strcmp(input_string, "*:---")) { |
305 | __ksym_trace_reset(); | 304 | __ksym_trace_reset(); |
306 | ret = 0; | 305 | ret = 0; |
307 | goto out; | 306 | goto out; |
@@ -444,102 +443,77 @@ struct tracer ksym_tracer __read_mostly = | |||
444 | .print_line = ksym_trace_output | 443 | .print_line = ksym_trace_output |
445 | }; | 444 | }; |
446 | 445 | ||
447 | __init static int init_ksym_trace(void) | ||
448 | { | ||
449 | struct dentry *d_tracer; | ||
450 | struct dentry *entry; | ||
451 | |||
452 | d_tracer = tracing_init_dentry(); | ||
453 | ksym_filter_entry_count = 0; | ||
454 | |||
455 | entry = debugfs_create_file("ksym_trace_filter", 0644, d_tracer, | ||
456 | NULL, &ksym_tracing_fops); | ||
457 | if (!entry) | ||
458 | pr_warning("Could not create debugfs " | ||
459 | "'ksym_trace_filter' file\n"); | ||
460 | |||
461 | return register_tracer(&ksym_tracer); | ||
462 | } | ||
463 | device_initcall(init_ksym_trace); | ||
464 | |||
465 | |||
466 | #ifdef CONFIG_PROFILE_KSYM_TRACER | 446 | #ifdef CONFIG_PROFILE_KSYM_TRACER |
467 | static int ksym_tracer_stat_headers(struct seq_file *m) | 447 | static int ksym_profile_show(struct seq_file *m, void *v) |
468 | { | 448 | { |
449 | struct hlist_node *node; | ||
450 | struct trace_ksym *entry; | ||
451 | int access_type = 0; | ||
452 | char fn_name[KSYM_NAME_LEN]; | ||
453 | |||
469 | seq_puts(m, " Access Type "); | 454 | seq_puts(m, " Access Type "); |
470 | seq_puts(m, " Symbol Counter\n"); | 455 | seq_puts(m, " Symbol Counter\n"); |
471 | seq_puts(m, " ----------- "); | 456 | seq_puts(m, " ----------- "); |
472 | seq_puts(m, " ------ -------\n"); | 457 | seq_puts(m, " ------ -------\n"); |
473 | return 0; | ||
474 | } | ||
475 | 458 | ||
476 | static int ksym_tracer_stat_show(struct seq_file *m, void *v) | 459 | rcu_read_lock(); |
477 | { | 460 | hlist_for_each_entry_rcu(entry, node, &ksym_filter_head, ksym_hlist) { |
478 | struct hlist_node *stat = v; | ||
479 | struct trace_ksym *entry; | ||
480 | int access_type = 0; | ||
481 | char fn_name[KSYM_NAME_LEN]; | ||
482 | 461 | ||
483 | entry = hlist_entry(stat, struct trace_ksym, ksym_hlist); | 462 | access_type = entry->attr.bp_type; |
484 | 463 | ||
485 | access_type = entry->attr.bp_type; | 464 | switch (access_type) { |
465 | case HW_BREAKPOINT_R: | ||
466 | seq_puts(m, " R "); | ||
467 | break; | ||
468 | case HW_BREAKPOINT_W: | ||
469 | seq_puts(m, " W "); | ||
470 | break; | ||
471 | case HW_BREAKPOINT_R | HW_BREAKPOINT_W: | ||
472 | seq_puts(m, " RW "); | ||
473 | break; | ||
474 | default: | ||
475 | seq_puts(m, " NA "); | ||
476 | } | ||
486 | 477 | ||
487 | switch (access_type) { | 478 | if (lookup_symbol_name(entry->attr.bp_addr, fn_name) >= 0) |
488 | case HW_BREAKPOINT_R: | 479 | seq_printf(m, " %-36s", fn_name); |
489 | seq_puts(m, " R "); | 480 | else |
490 | break; | 481 | seq_printf(m, " %-36s", "<NA>"); |
491 | case HW_BREAKPOINT_W: | 482 | seq_printf(m, " %15llu\n", |
492 | seq_puts(m, " W "); | 483 | (unsigned long long)atomic64_read(&entry->counter)); |
493 | break; | ||
494 | case HW_BREAKPOINT_R | HW_BREAKPOINT_W: | ||
495 | seq_puts(m, " RW "); | ||
496 | break; | ||
497 | default: | ||
498 | seq_puts(m, " NA "); | ||
499 | } | 484 | } |
500 | 485 | rcu_read_unlock(); | |
501 | if (lookup_symbol_name(entry->attr.bp_addr, fn_name) >= 0) | ||
502 | seq_printf(m, " %-36s", fn_name); | ||
503 | else | ||
504 | seq_printf(m, " %-36s", "<NA>"); | ||
505 | seq_printf(m, " %15lu\n", entry->counter); | ||
506 | 486 | ||
507 | return 0; | 487 | return 0; |
508 | } | 488 | } |
509 | 489 | ||
510 | static void *ksym_tracer_stat_start(struct tracer_stat *trace) | 490 | static int ksym_profile_open(struct inode *node, struct file *file) |
511 | { | 491 | { |
512 | return ksym_filter_head.first; | 492 | return single_open(file, ksym_profile_show, NULL); |
513 | } | ||
514 | |||
515 | static void * | ||
516 | ksym_tracer_stat_next(void *v, int idx) | ||
517 | { | ||
518 | struct hlist_node *stat = v; | ||
519 | |||
520 | return stat->next; | ||
521 | } | 493 | } |
522 | 494 | ||
523 | static struct tracer_stat ksym_tracer_stats = { | 495 | static const struct file_operations ksym_profile_fops = { |
524 | .name = "ksym_tracer", | 496 | .open = ksym_profile_open, |
525 | .stat_start = ksym_tracer_stat_start, | 497 | .read = seq_read, |
526 | .stat_next = ksym_tracer_stat_next, | 498 | .llseek = seq_lseek, |
527 | .stat_headers = ksym_tracer_stat_headers, | 499 | .release = single_release, |
528 | .stat_show = ksym_tracer_stat_show | ||
529 | }; | 500 | }; |
501 | #endif /* CONFIG_PROFILE_KSYM_TRACER */ | ||
530 | 502 | ||
531 | __init static int ksym_tracer_stat_init(void) | 503 | __init static int init_ksym_trace(void) |
532 | { | 504 | { |
533 | int ret; | 505 | struct dentry *d_tracer; |
534 | 506 | ||
535 | ret = register_stat_tracer(&ksym_tracer_stats); | 507 | d_tracer = tracing_init_dentry(); |
536 | if (ret) { | ||
537 | printk(KERN_WARNING "Warning: could not register " | ||
538 | "ksym tracer stats\n"); | ||
539 | return 1; | ||
540 | } | ||
541 | 508 | ||
542 | return 0; | 509 | trace_create_file("ksym_trace_filter", 0644, d_tracer, |
510 | NULL, &ksym_tracing_fops); | ||
511 | |||
512 | #ifdef CONFIG_PROFILE_KSYM_TRACER | ||
513 | trace_create_file("ksym_profile", 0444, d_tracer, | ||
514 | NULL, &ksym_profile_fops); | ||
515 | #endif | ||
516 | |||
517 | return register_tracer(&ksym_tracer); | ||
543 | } | 518 | } |
544 | fs_initcall(ksym_tracer_stat_init); | 519 | device_initcall(init_ksym_trace); |
545 | #endif /* CONFIG_PROFILE_KSYM_TRACER */ | ||
diff --git a/lib/Kconfig b/lib/Kconfig index 1cfe51628e1b..97b136ff117e 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -117,6 +117,10 @@ config DECOMPRESS_BZIP2 | |||
117 | config DECOMPRESS_LZMA | 117 | config DECOMPRESS_LZMA |
118 | tristate | 118 | tristate |
119 | 119 | ||
120 | config DECOMPRESS_LZO | ||
121 | select LZO_DECOMPRESS | ||
122 | tristate | ||
123 | |||
120 | # | 124 | # |
121 | # Generic allocator support is selected if needed | 125 | # Generic allocator support is selected if needed |
122 | # | 126 | # |
diff --git a/lib/Makefile b/lib/Makefile index 347ad8db29d3..911b25aed1e7 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -69,6 +69,7 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/ | |||
69 | lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o | 69 | lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o |
70 | lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o | 70 | lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o |
71 | lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o | 71 | lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o |
72 | lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o | ||
72 | 73 | ||
73 | obj-$(CONFIG_TEXTSEARCH) += textsearch.o | 74 | obj-$(CONFIG_TEXTSEARCH) += textsearch.o |
74 | obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o | 75 | obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o |
diff --git a/lib/decompress.c b/lib/decompress.c index d2842f571674..a7606815541f 100644 --- a/lib/decompress.c +++ b/lib/decompress.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/decompress/bunzip2.h> | 9 | #include <linux/decompress/bunzip2.h> |
10 | #include <linux/decompress/unlzma.h> | 10 | #include <linux/decompress/unlzma.h> |
11 | #include <linux/decompress/inflate.h> | 11 | #include <linux/decompress/inflate.h> |
12 | #include <linux/decompress/unlzo.h> | ||
12 | 13 | ||
13 | #include <linux/types.h> | 14 | #include <linux/types.h> |
14 | #include <linux/string.h> | 15 | #include <linux/string.h> |
@@ -22,6 +23,9 @@ | |||
22 | #ifndef CONFIG_DECOMPRESS_LZMA | 23 | #ifndef CONFIG_DECOMPRESS_LZMA |
23 | # define unlzma NULL | 24 | # define unlzma NULL |
24 | #endif | 25 | #endif |
26 | #ifndef CONFIG_DECOMPRESS_LZO | ||
27 | # define unlzo NULL | ||
28 | #endif | ||
25 | 29 | ||
26 | static const struct compress_format { | 30 | static const struct compress_format { |
27 | unsigned char magic[2]; | 31 | unsigned char magic[2]; |
@@ -32,6 +36,7 @@ static const struct compress_format { | |||
32 | { {037, 0236}, "gzip", gunzip }, | 36 | { {037, 0236}, "gzip", gunzip }, |
33 | { {0x42, 0x5a}, "bzip2", bunzip2 }, | 37 | { {0x42, 0x5a}, "bzip2", bunzip2 }, |
34 | { {0x5d, 0x00}, "lzma", unlzma }, | 38 | { {0x5d, 0x00}, "lzma", unlzma }, |
39 | { {0x89, 0x4c}, "lzo", unlzo }, | ||
35 | { {0, 0}, NULL, NULL } | 40 | { {0, 0}, NULL, NULL } |
36 | }; | 41 | }; |
37 | 42 | ||
diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c new file mode 100644 index 000000000000..db521f45626e --- /dev/null +++ b/lib/decompress_unlzo.c | |||
@@ -0,0 +1,209 @@ | |||
1 | /* | ||
2 | * LZO decompressor for the Linux kernel. Code borrowed from the lzo | ||
3 | * implementation by Markus Franz Xaver Johannes Oberhumer. | ||
4 | * | ||
5 | * Linux kernel adaptation: | ||
6 | * Copyright (C) 2009 | ||
7 | * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com> | ||
8 | * | ||
9 | * Original code: | ||
10 | * Copyright (C) 1996-2005 Markus Franz Xaver Johannes Oberhumer | ||
11 | * All Rights Reserved. | ||
12 | * | ||
13 | * lzop and the LZO library are free software; you can redistribute them | ||
14 | * and/or modify them under the terms of the GNU General Public License as | ||
15 | * published by the Free Software Foundation; either version 2 of | ||
16 | * the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; see the file COPYING. | ||
25 | * If not, write to the Free Software Foundation, Inc., | ||
26 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
27 | * | ||
28 | * Markus F.X.J. Oberhumer | ||
29 | * <markus@oberhumer.com> | ||
30 | * http://www.oberhumer.com/opensource/lzop/ | ||
31 | */ | ||
32 | |||
33 | #ifdef STATIC | ||
34 | #include "lzo/lzo1x_decompress.c" | ||
35 | #else | ||
36 | #include <linux/slab.h> | ||
37 | #include <linux/decompress/unlzo.h> | ||
38 | #endif | ||
39 | |||
40 | #include <linux/types.h> | ||
41 | #include <linux/lzo.h> | ||
42 | #include <linux/decompress/mm.h> | ||
43 | |||
44 | #include <linux/compiler.h> | ||
45 | #include <asm/unaligned.h> | ||
46 | |||
47 | static const unsigned char lzop_magic[] = { | ||
48 | 0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a }; | ||
49 | |||
50 | #define LZO_BLOCK_SIZE (256*1024l) | ||
51 | #define HEADER_HAS_FILTER 0x00000800L | ||
52 | |||
53 | STATIC inline int INIT parse_header(u8 *input, u8 *skip) | ||
54 | { | ||
55 | int l; | ||
56 | u8 *parse = input; | ||
57 | u8 level = 0; | ||
58 | u16 version; | ||
59 | |||
60 | /* read magic: 9 first bits */ | ||
61 | for (l = 0; l < 9; l++) { | ||
62 | if (*parse++ != lzop_magic[l]) | ||
63 | return 0; | ||
64 | } | ||
65 | /* get version (2bytes), skip library version (2), | ||
66 | * 'need to be extracted' version (2) and | ||
67 | * method (1) */ | ||
68 | version = get_unaligned_be16(parse); | ||
69 | parse += 7; | ||
70 | if (version >= 0x0940) | ||
71 | level = *parse++; | ||
72 | if (get_unaligned_be32(parse) & HEADER_HAS_FILTER) | ||
73 | parse += 8; /* flags + filter info */ | ||
74 | else | ||
75 | parse += 4; /* flags */ | ||
76 | |||
77 | /* skip mode and mtime_low */ | ||
78 | parse += 8; | ||
79 | if (version >= 0x0940) | ||
80 | parse += 4; /* skip mtime_high */ | ||
81 | |||
82 | l = *parse++; | ||
83 | /* don't care about the file name, and skip checksum */ | ||
84 | parse += l + 4; | ||
85 | |||
86 | *skip = parse - input; | ||
87 | return 1; | ||
88 | } | ||
89 | |||
90 | STATIC inline int INIT unlzo(u8 *input, int in_len, | ||
91 | int (*fill) (void *, unsigned int), | ||
92 | int (*flush) (void *, unsigned int), | ||
93 | u8 *output, int *posp, | ||
94 | void (*error_fn) (char *x)) | ||
95 | { | ||
96 | u8 skip = 0, r = 0; | ||
97 | u32 src_len, dst_len; | ||
98 | size_t tmp; | ||
99 | u8 *in_buf, *in_buf_save, *out_buf; | ||
100 | int obytes_processed = 0; | ||
101 | |||
102 | set_error_fn(error_fn); | ||
103 | |||
104 | if (output) { | ||
105 | out_buf = output; | ||
106 | } else if (!flush) { | ||
107 | error("NULL output pointer and no flush function provided"); | ||
108 | goto exit; | ||
109 | } else { | ||
110 | out_buf = malloc(LZO_BLOCK_SIZE); | ||
111 | if (!out_buf) { | ||
112 | error("Could not allocate output buffer"); | ||
113 | goto exit; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | if (input && fill) { | ||
118 | error("Both input pointer and fill function provided, don't know what to do"); | ||
119 | goto exit_1; | ||
120 | } else if (input) { | ||
121 | in_buf = input; | ||
122 | } else if (!fill || !posp) { | ||
123 | error("NULL input pointer and missing position pointer or fill function"); | ||
124 | goto exit_1; | ||
125 | } else { | ||
126 | in_buf = malloc(lzo1x_worst_compress(LZO_BLOCK_SIZE)); | ||
127 | if (!in_buf) { | ||
128 | error("Could not allocate input buffer"); | ||
129 | goto exit_1; | ||
130 | } | ||
131 | } | ||
132 | in_buf_save = in_buf; | ||
133 | |||
134 | if (posp) | ||
135 | *posp = 0; | ||
136 | |||
137 | if (fill) | ||
138 | fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE)); | ||
139 | |||
140 | if (!parse_header(input, &skip)) { | ||
141 | error("invalid header"); | ||
142 | goto exit_2; | ||
143 | } | ||
144 | in_buf += skip; | ||
145 | |||
146 | if (posp) | ||
147 | *posp = skip; | ||
148 | |||
149 | for (;;) { | ||
150 | /* read uncompressed block size */ | ||
151 | dst_len = get_unaligned_be32(in_buf); | ||
152 | in_buf += 4; | ||
153 | |||
154 | /* exit if last block */ | ||
155 | if (dst_len == 0) { | ||
156 | if (posp) | ||
157 | *posp += 4; | ||
158 | break; | ||
159 | } | ||
160 | |||
161 | if (dst_len > LZO_BLOCK_SIZE) { | ||
162 | error("dest len longer than block size"); | ||
163 | goto exit_2; | ||
164 | } | ||
165 | |||
166 | /* read compressed block size, and skip block checksum info */ | ||
167 | src_len = get_unaligned_be32(in_buf); | ||
168 | in_buf += 8; | ||
169 | |||
170 | if (src_len <= 0 || src_len > dst_len) { | ||
171 | error("file corrupted"); | ||
172 | goto exit_2; | ||
173 | } | ||
174 | |||
175 | /* decompress */ | ||
176 | tmp = dst_len; | ||
177 | r = lzo1x_decompress_safe((u8 *) in_buf, src_len, | ||
178 | out_buf, &tmp); | ||
179 | |||
180 | if (r != LZO_E_OK || dst_len != tmp) { | ||
181 | error("Compressed data violation"); | ||
182 | goto exit_2; | ||
183 | } | ||
184 | |||
185 | obytes_processed += dst_len; | ||
186 | if (flush) | ||
187 | flush(out_buf, dst_len); | ||
188 | if (output) | ||
189 | out_buf += dst_len; | ||
190 | if (posp) | ||
191 | *posp += src_len + 12; | ||
192 | if (fill) { | ||
193 | in_buf = in_buf_save; | ||
194 | fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE)); | ||
195 | } else | ||
196 | in_buf += src_len; | ||
197 | } | ||
198 | |||
199 | exit_2: | ||
200 | if (!input) | ||
201 | free(in_buf); | ||
202 | exit_1: | ||
203 | if (!output) | ||
204 | free(out_buf); | ||
205 | exit: | ||
206 | return obytes_processed; | ||
207 | } | ||
208 | |||
209 | #define decompress unlzo | ||
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index d9b08e0f7f55..7d2f0b33e5a8 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -670,12 +670,13 @@ static int device_dma_allocations(struct device *dev) | |||
670 | return count; | 670 | return count; |
671 | } | 671 | } |
672 | 672 | ||
673 | static int dma_debug_device_change(struct notifier_block *nb, | 673 | static int dma_debug_device_change(struct notifier_block *nb, unsigned long action, void *data) |
674 | unsigned long action, void *data) | ||
675 | { | 674 | { |
676 | struct device *dev = data; | 675 | struct device *dev = data; |
677 | int count; | 676 | int count; |
678 | 677 | ||
678 | if (global_disable) | ||
679 | return 0; | ||
679 | 680 | ||
680 | switch (action) { | 681 | switch (action) { |
681 | case BUS_NOTIFY_UNBOUND_DRIVER: | 682 | case BUS_NOTIFY_UNBOUND_DRIVER: |
@@ -697,6 +698,9 @@ void dma_debug_add_bus(struct bus_type *bus) | |||
697 | { | 698 | { |
698 | struct notifier_block *nb; | 699 | struct notifier_block *nb; |
699 | 700 | ||
701 | if (global_disable) | ||
702 | return; | ||
703 | |||
700 | nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL); | 704 | nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL); |
701 | if (nb == NULL) { | 705 | if (nb == NULL) { |
702 | pr_err("dma_debug_add_bus: out of memory\n"); | 706 | pr_err("dma_debug_add_bus: out of memory\n"); |
@@ -909,6 +913,9 @@ static void check_sync(struct device *dev, | |||
909 | ref->size); | 913 | ref->size); |
910 | } | 914 | } |
911 | 915 | ||
916 | if (entry->direction == DMA_BIDIRECTIONAL) | ||
917 | goto out; | ||
918 | |||
912 | if (ref->direction != entry->direction) { | 919 | if (ref->direction != entry->direction) { |
913 | err_printk(dev, entry, "DMA-API: device driver syncs " | 920 | err_printk(dev, entry, "DMA-API: device driver syncs " |
914 | "DMA memory with different direction " | 921 | "DMA memory with different direction " |
@@ -919,9 +926,6 @@ static void check_sync(struct device *dev, | |||
919 | dir2name[ref->direction]); | 926 | dir2name[ref->direction]); |
920 | } | 927 | } |
921 | 928 | ||
922 | if (entry->direction == DMA_BIDIRECTIONAL) | ||
923 | goto out; | ||
924 | |||
925 | if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) && | 929 | if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) && |
926 | !(ref->direction == DMA_TO_DEVICE)) | 930 | !(ref->direction == DMA_TO_DEVICE)) |
927 | err_printk(dev, entry, "DMA-API: device driver syncs " | 931 | err_printk(dev, entry, "DMA-API: device driver syncs " |
@@ -944,7 +948,6 @@ static void check_sync(struct device *dev, | |||
944 | 948 | ||
945 | out: | 949 | out: |
946 | put_hash_bucket(bucket, &flags); | 950 | put_hash_bucket(bucket, &flags); |
947 | |||
948 | } | 951 | } |
949 | 952 | ||
950 | void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, | 953 | void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, |
diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c index 5dc6b29c1575..f2fd09850223 100644 --- a/lib/lzo/lzo1x_decompress.c +++ b/lib/lzo/lzo1x_decompress.c | |||
@@ -11,11 +11,13 @@ | |||
11 | * Richard Purdie <rpurdie@openedhand.com> | 11 | * Richard Purdie <rpurdie@openedhand.com> |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #ifndef STATIC | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/lzo.h> | 17 | #endif |
17 | #include <asm/byteorder.h> | 18 | |
18 | #include <asm/unaligned.h> | 19 | #include <asm/unaligned.h> |
20 | #include <linux/lzo.h> | ||
19 | #include "lzodefs.h" | 21 | #include "lzodefs.h" |
20 | 22 | ||
21 | #define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x)) | 23 | #define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x)) |
@@ -244,9 +246,10 @@ lookbehind_overrun: | |||
244 | *out_len = op - out; | 246 | *out_len = op - out; |
245 | return LZO_E_LOOKBEHIND_OVERRUN; | 247 | return LZO_E_LOOKBEHIND_OVERRUN; |
246 | } | 248 | } |
247 | 249 | #ifndef STATIC | |
248 | EXPORT_SYMBOL_GPL(lzo1x_decompress_safe); | 250 | EXPORT_SYMBOL_GPL(lzo1x_decompress_safe); |
249 | 251 | ||
250 | MODULE_LICENSE("GPL"); | 252 | MODULE_LICENSE("GPL"); |
251 | MODULE_DESCRIPTION("LZO1X Decompressor"); | 253 | MODULE_DESCRIPTION("LZO1X Decompressor"); |
252 | 254 | ||
255 | #endif | ||
diff --git a/lib/rational.c b/lib/rational.c index b3c099b5478e..3ed247b80662 100644 --- a/lib/rational.c +++ b/lib/rational.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/rational.h> | 9 | #include <linux/rational.h> |
10 | #include <linux/module.h> | ||
10 | 11 | ||
11 | /* | 12 | /* |
12 | * calculate best rational approximation for a given fraction | 13 | * calculate best rational approximation for a given fraction |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index d4996cf46eb6..3b8aeec4e327 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -903,7 +903,7 @@ static char *uuid_string(char *buf, char *end, const u8 *addr, | |||
903 | * IPv6 omits the colons (01020304...0f) | 903 | * IPv6 omits the colons (01020304...0f) |
904 | * IPv4 uses dot-separated decimal with leading 0's (010.123.045.006) | 904 | * IPv4 uses dot-separated decimal with leading 0's (010.123.045.006) |
905 | * - 'I6c' for IPv6 addresses printed as specified by | 905 | * - 'I6c' for IPv6 addresses printed as specified by |
906 | * http://www.ietf.org/id/draft-kawamura-ipv6-text-representation-03.txt | 906 | * http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00 |
907 | * - 'U' For a 16 byte UUID/GUID, it prints the UUID/GUID in the form | 907 | * - 'U' For a 16 byte UUID/GUID, it prints the UUID/GUID in the form |
908 | * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | 908 | * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" |
909 | * Options for %pU are: | 909 | * Options for %pU are: |
@@ -1188,7 +1188,7 @@ qualifier: | |||
1188 | * %pI6 print an IPv6 address with colons | 1188 | * %pI6 print an IPv6 address with colons |
1189 | * %pi6 print an IPv6 address without colons | 1189 | * %pi6 print an IPv6 address without colons |
1190 | * %pI6c print an IPv6 address as specified by | 1190 | * %pI6c print an IPv6 address as specified by |
1191 | * http://www.ietf.org/id/draft-kawamura-ipv6-text-representation-03.txt | 1191 | * http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00 |
1192 | * %pU[bBlL] print a UUID/GUID in big or little endian using lower or upper | 1192 | * %pU[bBlL] print a UUID/GUID in big or little endian using lower or upper |
1193 | * case. | 1193 | * case. |
1194 | * %n is ignored | 1194 | * %n is ignored |
diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c index 8550b0c05d00..05e1559fa156 100644 --- a/lib/zlib_inflate/inffast.c +++ b/lib/zlib_inflate/inffast.c | |||
@@ -4,6 +4,8 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/zutil.h> | 6 | #include <linux/zutil.h> |
7 | #include <asm/unaligned.h> | ||
8 | #include <asm/byteorder.h> | ||
7 | #include "inftrees.h" | 9 | #include "inftrees.h" |
8 | #include "inflate.h" | 10 | #include "inflate.h" |
9 | #include "inffast.h" | 11 | #include "inffast.h" |
@@ -24,9 +26,11 @@ | |||
24 | #ifdef POSTINC | 26 | #ifdef POSTINC |
25 | # define OFF 0 | 27 | # define OFF 0 |
26 | # define PUP(a) *(a)++ | 28 | # define PUP(a) *(a)++ |
29 | # define UP_UNALIGNED(a) get_unaligned((a)++) | ||
27 | #else | 30 | #else |
28 | # define OFF 1 | 31 | # define OFF 1 |
29 | # define PUP(a) *++(a) | 32 | # define PUP(a) *++(a) |
33 | # define UP_UNALIGNED(a) get_unaligned(++(a)) | ||
30 | #endif | 34 | #endif |
31 | 35 | ||
32 | /* | 36 | /* |
@@ -239,18 +243,47 @@ void inflate_fast(z_streamp strm, unsigned start) | |||
239 | } | 243 | } |
240 | } | 244 | } |
241 | else { | 245 | else { |
246 | unsigned short *sout; | ||
247 | unsigned long loops; | ||
248 | |||
242 | from = out - dist; /* copy direct from output */ | 249 | from = out - dist; /* copy direct from output */ |
243 | do { /* minimum length is three */ | 250 | /* minimum length is three */ |
244 | PUP(out) = PUP(from); | 251 | /* Align out addr */ |
245 | PUP(out) = PUP(from); | 252 | if (!((long)(out - 1 + OFF) & 1)) { |
246 | PUP(out) = PUP(from); | 253 | PUP(out) = PUP(from); |
247 | len -= 3; | 254 | len--; |
248 | } while (len > 2); | 255 | } |
249 | if (len) { | 256 | sout = (unsigned short *)(out - OFF); |
250 | PUP(out) = PUP(from); | 257 | if (dist > 2) { |
251 | if (len > 1) | 258 | unsigned short *sfrom; |
252 | PUP(out) = PUP(from); | 259 | |
253 | } | 260 | sfrom = (unsigned short *)(from - OFF); |
261 | loops = len >> 1; | ||
262 | do | ||
263 | PUP(sout) = UP_UNALIGNED(sfrom); | ||
264 | while (--loops); | ||
265 | out = (unsigned char *)sout + OFF; | ||
266 | from = (unsigned char *)sfrom + OFF; | ||
267 | } else { /* dist == 1 or dist == 2 */ | ||
268 | unsigned short pat16; | ||
269 | |||
270 | pat16 = *(sout-2+2*OFF); | ||
271 | if (dist == 1) | ||
272 | #if defined(__BIG_ENDIAN) | ||
273 | pat16 = (pat16 & 0xff) | ((pat16 & 0xff) << 8); | ||
274 | #elif defined(__LITTLE_ENDIAN) | ||
275 | pat16 = (pat16 & 0xff00) | ((pat16 & 0xff00) >> 8); | ||
276 | #else | ||
277 | #error __BIG_ENDIAN nor __LITTLE_ENDIAN is defined | ||
278 | #endif | ||
279 | loops = len >> 1; | ||
280 | do | ||
281 | PUP(sout) = pat16; | ||
282 | while (--loops); | ||
283 | out = (unsigned char *)sout + OFF; | ||
284 | } | ||
285 | if (len & 1) | ||
286 | PUP(out) = PUP(from); | ||
254 | } | 287 | } |
255 | } | 288 | } |
256 | else if ((op & 64) == 0) { /* 2nd level distance code */ | 289 | else if ((op & 64) == 0) { /* 2nd level distance code */ |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 65f38c218207..e91b81b63670 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -402,7 +402,7 @@ static void clear_huge_page(struct page *page, | |||
402 | { | 402 | { |
403 | int i; | 403 | int i; |
404 | 404 | ||
405 | if (unlikely(sz > MAX_ORDER_NR_PAGES)) { | 405 | if (unlikely(sz/PAGE_SIZE > MAX_ORDER_NR_PAGES)) { |
406 | clear_gigantic_page(page, addr, sz); | 406 | clear_gigantic_page(page, addr, sz); |
407 | return; | 407 | return; |
408 | } | 408 | } |
diff --git a/mm/maccess.c b/mm/maccess.c index 9073695ff25f..4e348dbaecd7 100644 --- a/mm/maccess.c +++ b/mm/maccess.c | |||
@@ -14,7 +14,11 @@ | |||
14 | * Safely read from address @src to the buffer at @dst. If a kernel fault | 14 | * Safely read from address @src to the buffer at @dst. If a kernel fault |
15 | * happens, handle that and return -EFAULT. | 15 | * happens, handle that and return -EFAULT. |
16 | */ | 16 | */ |
17 | long probe_kernel_read(void *dst, void *src, size_t size) | 17 | |
18 | long __weak probe_kernel_read(void *dst, void *src, size_t size) | ||
19 | __attribute__((alias("__probe_kernel_read"))); | ||
20 | |||
21 | long __probe_kernel_read(void *dst, void *src, size_t size) | ||
18 | { | 22 | { |
19 | long ret; | 23 | long ret; |
20 | mm_segment_t old_fs = get_fs(); | 24 | mm_segment_t old_fs = get_fs(); |
@@ -39,7 +43,10 @@ EXPORT_SYMBOL_GPL(probe_kernel_read); | |||
39 | * Safely write to address @dst from the buffer at @src. If a kernel fault | 43 | * Safely write to address @dst from the buffer at @src. If a kernel fault |
40 | * happens, handle that and return -EFAULT. | 44 | * happens, handle that and return -EFAULT. |
41 | */ | 45 | */ |
42 | long notrace __weak probe_kernel_write(void *dst, void *src, size_t size) | 46 | long __weak probe_kernel_write(void *dst, void *src, size_t size) |
47 | __attribute__((alias("__probe_kernel_write"))); | ||
48 | |||
49 | long __probe_kernel_write(void *dst, void *src, size_t size) | ||
43 | { | 50 | { |
44 | long ret; | 51 | long ret; |
45 | mm_segment_t old_fs = get_fs(); | 52 | mm_segment_t old_fs = get_fs(); |
@@ -1043,6 +1043,46 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
1043 | } | 1043 | } |
1044 | EXPORT_SYMBOL(do_mmap_pgoff); | 1044 | EXPORT_SYMBOL(do_mmap_pgoff); |
1045 | 1045 | ||
1046 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, | ||
1047 | unsigned long, prot, unsigned long, flags, | ||
1048 | unsigned long, fd, unsigned long, pgoff) | ||
1049 | { | ||
1050 | struct file *file = NULL; | ||
1051 | unsigned long retval = -EBADF; | ||
1052 | |||
1053 | if (!(flags & MAP_ANONYMOUS)) { | ||
1054 | if (unlikely(flags & MAP_HUGETLB)) | ||
1055 | return -EINVAL; | ||
1056 | file = fget(fd); | ||
1057 | if (!file) | ||
1058 | goto out; | ||
1059 | } else if (flags & MAP_HUGETLB) { | ||
1060 | struct user_struct *user = NULL; | ||
1061 | /* | ||
1062 | * VM_NORESERVE is used because the reservations will be | ||
1063 | * taken when vm_ops->mmap() is called | ||
1064 | * A dummy user value is used because we are not locking | ||
1065 | * memory so no accounting is necessary | ||
1066 | */ | ||
1067 | len = ALIGN(len, huge_page_size(&default_hstate)); | ||
1068 | file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, VM_NORESERVE, | ||
1069 | &user, HUGETLB_ANONHUGE_INODE); | ||
1070 | if (IS_ERR(file)) | ||
1071 | return PTR_ERR(file); | ||
1072 | } | ||
1073 | |||
1074 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
1075 | |||
1076 | down_write(¤t->mm->mmap_sem); | ||
1077 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
1078 | up_write(¤t->mm->mmap_sem); | ||
1079 | |||
1080 | if (file) | ||
1081 | fput(file); | ||
1082 | out: | ||
1083 | return retval; | ||
1084 | } | ||
1085 | |||
1046 | /* | 1086 | /* |
1047 | * Some shared mappigns will want the pages marked read-only | 1087 | * Some shared mappigns will want the pages marked read-only |
1048 | * to track write events. If so, we'll downgrade vm_page_prot | 1088 | * to track write events. If so, we'll downgrade vm_page_prot |
diff --git a/mm/nommu.c b/mm/nommu.c index 8687973462bb..17773862619b 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -432,6 +432,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) | |||
432 | /* | 432 | /* |
433 | * Ok, looks good - let it rip. | 433 | * Ok, looks good - let it rip. |
434 | */ | 434 | */ |
435 | flush_icache_range(mm->brk, brk); | ||
435 | return mm->brk = brk; | 436 | return mm->brk = brk; |
436 | } | 437 | } |
437 | 438 | ||
@@ -1353,10 +1354,14 @@ unsigned long do_mmap_pgoff(struct file *file, | |||
1353 | share: | 1354 | share: |
1354 | add_vma_to_mm(current->mm, vma); | 1355 | add_vma_to_mm(current->mm, vma); |
1355 | 1356 | ||
1356 | up_write(&nommu_region_sem); | 1357 | /* we flush the region from the icache only when the first executable |
1358 | * mapping of it is made */ | ||
1359 | if (vma->vm_flags & VM_EXEC && !region->vm_icache_flushed) { | ||
1360 | flush_icache_range(region->vm_start, region->vm_end); | ||
1361 | region->vm_icache_flushed = true; | ||
1362 | } | ||
1357 | 1363 | ||
1358 | if (prot & PROT_EXEC) | 1364 | up_write(&nommu_region_sem); |
1359 | flush_icache_range(result, result + len); | ||
1360 | 1365 | ||
1361 | kleave(" = %lx", result); | 1366 | kleave(" = %lx", result); |
1362 | return result; | 1367 | return result; |
@@ -1398,6 +1403,31 @@ error_getting_region: | |||
1398 | } | 1403 | } |
1399 | EXPORT_SYMBOL(do_mmap_pgoff); | 1404 | EXPORT_SYMBOL(do_mmap_pgoff); |
1400 | 1405 | ||
1406 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, | ||
1407 | unsigned long, prot, unsigned long, flags, | ||
1408 | unsigned long, fd, unsigned long, pgoff) | ||
1409 | { | ||
1410 | struct file *file = NULL; | ||
1411 | unsigned long retval = -EBADF; | ||
1412 | |||
1413 | if (!(flags & MAP_ANONYMOUS)) { | ||
1414 | file = fget(fd); | ||
1415 | if (!file) | ||
1416 | goto out; | ||
1417 | } | ||
1418 | |||
1419 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
1420 | |||
1421 | down_write(¤t->mm->mmap_sem); | ||
1422 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
1423 | up_write(¤t->mm->mmap_sem); | ||
1424 | |||
1425 | if (file) | ||
1426 | fput(file); | ||
1427 | out: | ||
1428 | return retval; | ||
1429 | } | ||
1430 | |||
1401 | /* | 1431 | /* |
1402 | * split a vma into two pieces at address 'addr', a new vma is allocated either | 1432 | * split a vma into two pieces at address 'addr', a new vma is allocated either |
1403 | * for the first part or the tail. | 1433 | * for the first part or the tail. |
@@ -1891,9 +1921,11 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in | |||
1891 | 1921 | ||
1892 | /* only read or write mappings where it is permitted */ | 1922 | /* only read or write mappings where it is permitted */ |
1893 | if (write && vma->vm_flags & VM_MAYWRITE) | 1923 | if (write && vma->vm_flags & VM_MAYWRITE) |
1894 | len -= copy_to_user((void *) addr, buf, len); | 1924 | copy_to_user_page(vma, NULL, addr, |
1925 | (void *) addr, buf, len); | ||
1895 | else if (!write && vma->vm_flags & VM_MAYREAD) | 1926 | else if (!write && vma->vm_flags & VM_MAYREAD) |
1896 | len -= copy_from_user(buf, (void *) addr, len); | 1927 | copy_from_user_page(vma, NULL, addr, |
1928 | buf, (void *) addr, len); | ||
1897 | else | 1929 | else |
1898 | len = 0; | 1930 | len = 0; |
1899 | } else { | 1931 | } else { |
diff --git a/mm/percpu.c b/mm/percpu.c index 442010cc91c6..083e7c91e5f6 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -1271,7 +1271,7 @@ static void pcpu_reclaim(struct work_struct *work) | |||
1271 | */ | 1271 | */ |
1272 | void free_percpu(void *ptr) | 1272 | void free_percpu(void *ptr) |
1273 | { | 1273 | { |
1274 | void *addr = __pcpu_ptr_to_addr(ptr); | 1274 | void *addr; |
1275 | struct pcpu_chunk *chunk; | 1275 | struct pcpu_chunk *chunk; |
1276 | unsigned long flags; | 1276 | unsigned long flags; |
1277 | int off; | 1277 | int off; |
@@ -1279,6 +1279,8 @@ void free_percpu(void *ptr) | |||
1279 | if (!ptr) | 1279 | if (!ptr) |
1280 | return; | 1280 | return; |
1281 | 1281 | ||
1282 | addr = __pcpu_ptr_to_addr(ptr); | ||
1283 | |||
1282 | spin_lock_irqsave(&pcpu_lock, flags); | 1284 | spin_lock_irqsave(&pcpu_lock, flags); |
1283 | 1285 | ||
1284 | chunk = pcpu_chunk_addr_search(addr); | 1286 | chunk = pcpu_chunk_addr_search(addr); |
@@ -654,7 +654,7 @@ static void init_node_lock_keys(int q) | |||
654 | 654 | ||
655 | l3 = s->cs_cachep->nodelists[q]; | 655 | l3 = s->cs_cachep->nodelists[q]; |
656 | if (!l3 || OFF_SLAB(s->cs_cachep)) | 656 | if (!l3 || OFF_SLAB(s->cs_cachep)) |
657 | return; | 657 | continue; |
658 | lockdep_set_class(&l3->list_lock, &on_slab_l3_key); | 658 | lockdep_set_class(&l3->list_lock, &on_slab_l3_key); |
659 | alc = l3->alien; | 659 | alc = l3->alien; |
660 | /* | 660 | /* |
@@ -665,7 +665,7 @@ static void init_node_lock_keys(int q) | |||
665 | * for alloc_alien_cache, | 665 | * for alloc_alien_cache, |
666 | */ | 666 | */ |
667 | if (!alc || (unsigned long)alc == BAD_ALIEN_MAGIC) | 667 | if (!alc || (unsigned long)alc == BAD_ALIEN_MAGIC) |
668 | return; | 668 | continue; |
669 | for_each_node(r) { | 669 | for_each_node(r) { |
670 | if (alc[r]) | 670 | if (alc[r]) |
671 | lockdep_set_class(&alc[r]->lock, | 671 | lockdep_set_class(&alc[r]->lock, |
@@ -4,10 +4,6 @@ | |||
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/err.h> | 5 | #include <linux/err.h> |
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/hugetlb.h> | ||
8 | #include <linux/syscalls.h> | ||
9 | #include <linux/mman.h> | ||
10 | #include <linux/file.h> | ||
11 | #include <asm/uaccess.h> | 7 | #include <asm/uaccess.h> |
12 | 8 | ||
13 | #define CREATE_TRACE_POINTS | 9 | #define CREATE_TRACE_POINTS |
@@ -272,46 +268,6 @@ int __attribute__((weak)) get_user_pages_fast(unsigned long start, | |||
272 | } | 268 | } |
273 | EXPORT_SYMBOL_GPL(get_user_pages_fast); | 269 | EXPORT_SYMBOL_GPL(get_user_pages_fast); |
274 | 270 | ||
275 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, | ||
276 | unsigned long, prot, unsigned long, flags, | ||
277 | unsigned long, fd, unsigned long, pgoff) | ||
278 | { | ||
279 | struct file * file = NULL; | ||
280 | unsigned long retval = -EBADF; | ||
281 | |||
282 | if (!(flags & MAP_ANONYMOUS)) { | ||
283 | if (unlikely(flags & MAP_HUGETLB)) | ||
284 | return -EINVAL; | ||
285 | file = fget(fd); | ||
286 | if (!file) | ||
287 | goto out; | ||
288 | } else if (flags & MAP_HUGETLB) { | ||
289 | struct user_struct *user = NULL; | ||
290 | /* | ||
291 | * VM_NORESERVE is used because the reservations will be | ||
292 | * taken when vm_ops->mmap() is called | ||
293 | * A dummy user value is used because we are not locking | ||
294 | * memory so no accounting is necessary | ||
295 | */ | ||
296 | len = ALIGN(len, huge_page_size(&default_hstate)); | ||
297 | file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, VM_NORESERVE, | ||
298 | &user, HUGETLB_ANONHUGE_INODE); | ||
299 | if (IS_ERR(file)) | ||
300 | return PTR_ERR(file); | ||
301 | } | ||
302 | |||
303 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
304 | |||
305 | down_write(¤t->mm->mmap_sem); | ||
306 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
307 | up_write(¤t->mm->mmap_sem); | ||
308 | |||
309 | if (file) | ||
310 | fput(file); | ||
311 | out: | ||
312 | return retval; | ||
313 | } | ||
314 | |||
315 | /* Tracepoints definitions. */ | 271 | /* Tracepoints definitions. */ |
316 | EXPORT_TRACEPOINT_SYMBOL(kmalloc); | 272 | EXPORT_TRACEPOINT_SYMBOL(kmalloc); |
317 | EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc); | 273 | EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index a23b45f08ec9..de0c2c726420 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -250,8 +250,7 @@ struct pktgen_dev { | |||
250 | __u64 count; /* Default No packets to send */ | 250 | __u64 count; /* Default No packets to send */ |
251 | __u64 sofar; /* How many pkts we've sent so far */ | 251 | __u64 sofar; /* How many pkts we've sent so far */ |
252 | __u64 tx_bytes; /* How many bytes we've transmitted */ | 252 | __u64 tx_bytes; /* How many bytes we've transmitted */ |
253 | __u64 errors; /* Errors when trying to transmit, | 253 | __u64 errors; /* Errors when trying to transmit, */ |
254 | pkts will be re-sent */ | ||
255 | 254 | ||
256 | /* runtime counters relating to clone_skb */ | 255 | /* runtime counters relating to clone_skb */ |
257 | 256 | ||
@@ -3465,6 +3464,12 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3465 | pkt_dev->seq_num++; | 3464 | pkt_dev->seq_num++; |
3466 | pkt_dev->tx_bytes += pkt_dev->last_pkt_size; | 3465 | pkt_dev->tx_bytes += pkt_dev->last_pkt_size; |
3467 | break; | 3466 | break; |
3467 | case NET_XMIT_DROP: | ||
3468 | case NET_XMIT_CN: | ||
3469 | case NET_XMIT_POLICED: | ||
3470 | /* skb has been consumed */ | ||
3471 | pkt_dev->errors++; | ||
3472 | break; | ||
3468 | default: /* Drivers are not supposed to return other values! */ | 3473 | default: /* Drivers are not supposed to return other values! */ |
3469 | if (net_ratelimit()) | 3474 | if (net_ratelimit()) |
3470 | pr_info("pktgen: %s xmit error: %d\n", | 3475 | pr_info("pktgen: %s xmit error: %d\n", |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 5cdbc102a418..040c4f05b653 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1397,6 +1397,7 @@ static struct devinet_sysctl_table { | |||
1397 | DEVINET_SYSCTL_RW_ENTRY(ACCEPT_SOURCE_ROUTE, | 1397 | DEVINET_SYSCTL_RW_ENTRY(ACCEPT_SOURCE_ROUTE, |
1398 | "accept_source_route"), | 1398 | "accept_source_route"), |
1399 | DEVINET_SYSCTL_RW_ENTRY(ACCEPT_LOCAL, "accept_local"), | 1399 | DEVINET_SYSCTL_RW_ENTRY(ACCEPT_LOCAL, "accept_local"), |
1400 | DEVINET_SYSCTL_RW_ENTRY(SRC_VMARK, "src_valid_mark"), | ||
1400 | DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP, "proxy_arp"), | 1401 | DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP, "proxy_arp"), |
1401 | DEVINET_SYSCTL_RW_ENTRY(MEDIUM_ID, "medium_id"), | 1402 | DEVINET_SYSCTL_RW_ENTRY(MEDIUM_ID, "medium_id"), |
1402 | DEVINET_SYSCTL_RW_ENTRY(BOOTP_RELAY, "bootp_relay"), | 1403 | DEVINET_SYSCTL_RW_ENTRY(BOOTP_RELAY, "bootp_relay"), |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 3323168ee52d..82dbf711d6d0 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -252,6 +252,8 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | |||
252 | no_addr = in_dev->ifa_list == NULL; | 252 | no_addr = in_dev->ifa_list == NULL; |
253 | rpf = IN_DEV_RPFILTER(in_dev); | 253 | rpf = IN_DEV_RPFILTER(in_dev); |
254 | accept_local = IN_DEV_ACCEPT_LOCAL(in_dev); | 254 | accept_local = IN_DEV_ACCEPT_LOCAL(in_dev); |
255 | if (mark && !IN_DEV_SRC_VMARK(in_dev)) | ||
256 | fl.mark = 0; | ||
255 | } | 257 | } |
256 | rcu_read_unlock(); | 258 | rcu_read_unlock(); |
257 | 259 | ||
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 3787455fb696..d7dcee680728 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -34,9 +34,28 @@ void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, | |||
34 | 34 | ||
35 | ht_cap->ht_supported = true; | 35 | ht_cap->ht_supported = true; |
36 | 36 | ||
37 | ht_cap->cap = le16_to_cpu(ht_cap_ie->cap_info) & sband->ht_cap.cap; | 37 | /* |
38 | ht_cap->cap &= ~IEEE80211_HT_CAP_SM_PS; | 38 | * The bits listed in this expression should be |
39 | ht_cap->cap |= sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS; | 39 | * the same for the peer and us, if the station |
40 | * advertises more then we can't use those thus | ||
41 | * we mask them out. | ||
42 | */ | ||
43 | ht_cap->cap = le16_to_cpu(ht_cap_ie->cap_info) & | ||
44 | (sband->ht_cap.cap | | ||
45 | ~(IEEE80211_HT_CAP_LDPC_CODING | | ||
46 | IEEE80211_HT_CAP_SUP_WIDTH_20_40 | | ||
47 | IEEE80211_HT_CAP_GRN_FLD | | ||
48 | IEEE80211_HT_CAP_SGI_20 | | ||
49 | IEEE80211_HT_CAP_SGI_40 | | ||
50 | IEEE80211_HT_CAP_DSSSCCK40)); | ||
51 | /* | ||
52 | * The STBC bits are asymmetric -- if we don't have | ||
53 | * TX then mask out the peer's RX and vice versa. | ||
54 | */ | ||
55 | if (!(sband->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)) | ||
56 | ht_cap->cap &= ~IEEE80211_HT_CAP_RX_STBC; | ||
57 | if (!(sband->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)) | ||
58 | ht_cap->cap &= ~IEEE80211_HT_CAP_TX_STBC; | ||
40 | 59 | ||
41 | ampdu_info = ht_cap_ie->ampdu_params_info; | 60 | ampdu_info = ht_cap_ie->ampdu_params_info; |
42 | ht_cap->ampdu_factor = | 61 | ht_cap->ampdu_factor = |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 10d13856f86c..1f2db647bb5c 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -382,6 +382,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
382 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | 382 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, |
383 | u8 *bssid,u8 *addr, u32 supp_rates) | 383 | u8 *bssid,u8 *addr, u32 supp_rates) |
384 | { | 384 | { |
385 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | ||
385 | struct ieee80211_local *local = sdata->local; | 386 | struct ieee80211_local *local = sdata->local; |
386 | struct sta_info *sta; | 387 | struct sta_info *sta; |
387 | int band = local->hw.conf.channel->band; | 388 | int band = local->hw.conf.channel->band; |
@@ -397,6 +398,9 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
397 | return NULL; | 398 | return NULL; |
398 | } | 399 | } |
399 | 400 | ||
401 | if (ifibss->state == IEEE80211_IBSS_MLME_SEARCH) | ||
402 | return NULL; | ||
403 | |||
400 | if (compare_ether_addr(bssid, sdata->u.ibss.bssid)) | 404 | if (compare_ether_addr(bssid, sdata->u.ibss.bssid)) |
401 | return NULL; | 405 | return NULL; |
402 | 406 | ||
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 8116d1a96a4a..0d2d94881f1f 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -515,6 +515,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
515 | * and we need some headroom for passing the frame to monitor | 515 | * and we need some headroom for passing the frame to monitor |
516 | * interfaces, but never both at the same time. | 516 | * interfaces, but never both at the same time. |
517 | */ | 517 | */ |
518 | BUILD_BUG_ON(IEEE80211_TX_STATUS_HEADROOM != | ||
519 | sizeof(struct ieee80211_tx_status_rtap_hdr)); | ||
518 | local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, | 520 | local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, |
519 | sizeof(struct ieee80211_tx_status_rtap_hdr)); | 521 | sizeof(struct ieee80211_tx_status_rtap_hdr)); |
520 | 522 | ||
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index d8d50fb5e823..c79e59f82fd9 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -915,6 +915,14 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
915 | sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL | | 915 | sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL | |
916 | IEEE80211_STA_BEACON_POLL); | 916 | IEEE80211_STA_BEACON_POLL); |
917 | 917 | ||
918 | /* | ||
919 | * Always handle WMM once after association regardless | ||
920 | * of the first value the AP uses. Setting -1 here has | ||
921 | * that effect because the AP values is an unsigned | ||
922 | * 4-bit value. | ||
923 | */ | ||
924 | sdata->u.mgd.wmm_last_param_set = -1; | ||
925 | |||
918 | ieee80211_led_assoc(local, 1); | 926 | ieee80211_led_assoc(local, 1); |
919 | 927 | ||
920 | sdata->vif.bss_conf.assoc = 1; | 928 | sdata->vif.bss_conf.assoc = 1; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 8834cc93c716..27ceaefd7bc8 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1419,6 +1419,10 @@ static bool need_dynamic_ps(struct ieee80211_local *local) | |||
1419 | if (!local->ps_sdata) | 1419 | if (!local->ps_sdata) |
1420 | return false; | 1420 | return false; |
1421 | 1421 | ||
1422 | /* No point if we're going to suspend */ | ||
1423 | if (local->quiescing) | ||
1424 | return false; | ||
1425 | |||
1422 | return true; | 1426 | return true; |
1423 | } | 1427 | } |
1424 | 1428 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 78a6e924c7e1..dc76267e436e 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1039,7 +1039,19 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1039 | 1039 | ||
1040 | /* restart hardware */ | 1040 | /* restart hardware */ |
1041 | if (local->open_count) { | 1041 | if (local->open_count) { |
1042 | /* | ||
1043 | * Upon resume hardware can sometimes be goofy due to | ||
1044 | * various platform / driver / bus issues, so restarting | ||
1045 | * the device may at times not work immediately. Propagate | ||
1046 | * the error. | ||
1047 | */ | ||
1042 | res = drv_start(local); | 1048 | res = drv_start(local); |
1049 | if (res) { | ||
1050 | WARN(local->suspended, "Harware became unavailable " | ||
1051 | "upon resume. This is could be a software issue" | ||
1052 | "prior to suspend or a harware issue\n"); | ||
1053 | return res; | ||
1054 | } | ||
1043 | 1055 | ||
1044 | ieee80211_led_radio(local, true); | 1056 | ieee80211_led_radio(local, true); |
1045 | } | 1057 | } |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 3c3c50f38a1c..f7a7f8380e38 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -644,7 +644,22 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
644 | p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); | 644 | p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); |
645 | if (IS_ERR(p)) { | 645 | if (IS_ERR(p)) { |
646 | err = PTR_ERR(p); | 646 | err = PTR_ERR(p); |
647 | gss_msg->msg.errno = (err == -EAGAIN) ? -EAGAIN : -EACCES; | 647 | switch (err) { |
648 | case -EACCES: | ||
649 | gss_msg->msg.errno = err; | ||
650 | err = mlen; | ||
651 | break; | ||
652 | case -EFAULT: | ||
653 | case -ENOMEM: | ||
654 | case -EINVAL: | ||
655 | case -ENOSYS: | ||
656 | gss_msg->msg.errno = -EAGAIN; | ||
657 | break; | ||
658 | default: | ||
659 | printk(KERN_CRIT "%s: bad return from " | ||
660 | "gss_fill_context: %zd\n", __func__, err); | ||
661 | BUG(); | ||
662 | } | ||
648 | goto err_release_msg; | 663 | goto err_release_msg; |
649 | } | 664 | } |
650 | gss_msg->ctx = gss_get_ctx(ctx); | 665 | gss_msg->ctx = gss_get_ctx(ctx); |
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c index ef45eba22485..2deb0ed72ff4 100644 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c | |||
@@ -131,8 +131,10 @@ gss_import_sec_context_kerberos(const void *p, | |||
131 | struct krb5_ctx *ctx; | 131 | struct krb5_ctx *ctx; |
132 | int tmp; | 132 | int tmp; |
133 | 133 | ||
134 | if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) | 134 | if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) { |
135 | p = ERR_PTR(-ENOMEM); | ||
135 | goto out_err; | 136 | goto out_err; |
137 | } | ||
136 | 138 | ||
137 | p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate)); | 139 | p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate)); |
138 | if (IS_ERR(p)) | 140 | if (IS_ERR(p)) |
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index 6efbb0cd3c7c..76e4c6f4ac3c 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c | |||
@@ -252,7 +252,7 @@ gss_import_sec_context(const void *input_token, size_t bufsize, | |||
252 | struct gss_ctx **ctx_id) | 252 | struct gss_ctx **ctx_id) |
253 | { | 253 | { |
254 | if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL))) | 254 | if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL))) |
255 | return GSS_S_FAILURE; | 255 | return -ENOMEM; |
256 | (*ctx_id)->mech_type = gss_mech_get(mech); | 256 | (*ctx_id)->mech_type = gss_mech_get(mech); |
257 | 257 | ||
258 | return mech->gm_ops | 258 | return mech->gm_ops |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 1c924ee0a1ef..7d1f9e928f69 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -699,7 +699,8 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
699 | spin_unlock_bh(&pool->sp_lock); | 699 | spin_unlock_bh(&pool->sp_lock); |
700 | 700 | ||
701 | len = 0; | 701 | len = 0; |
702 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { | 702 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags) && |
703 | !test_bit(XPT_CLOSE, &xprt->xpt_flags)) { | ||
703 | struct svc_xprt *newxpt; | 704 | struct svc_xprt *newxpt; |
704 | newxpt = xprt->xpt_ops->xpo_accept(xprt); | 705 | newxpt = xprt->xpt_ops->xpo_accept(xprt); |
705 | if (newxpt) { | 706 | if (newxpt) { |
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 1001db4912f7..82e6002c8d67 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -93,7 +93,18 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len) | |||
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | WARN_ON(!bss); | 96 | /* |
97 | * We might be coming here because the driver reported | ||
98 | * a successful association at the same time as the | ||
99 | * user requested a deauth. In that case, we will have | ||
100 | * removed the BSS from the auth_bsses list due to the | ||
101 | * deauth request when the assoc response makes it. If | ||
102 | * the two code paths acquire the lock the other way | ||
103 | * around, that's just the standard situation of a | ||
104 | * deauth being requested while connected. | ||
105 | */ | ||
106 | if (!bss) | ||
107 | goto out; | ||
97 | } else if (wdev->conn) { | 108 | } else if (wdev->conn) { |
98 | cfg80211_sme_failed_assoc(wdev); | 109 | cfg80211_sme_failed_assoc(wdev); |
99 | /* | 110 | /* |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 12dfa62aad18..0c2cbbebca95 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -601,7 +601,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
601 | struct cfg80211_registered_device *rdev; | 601 | struct cfg80211_registered_device *rdev; |
602 | struct wiphy *wiphy; | 602 | struct wiphy *wiphy; |
603 | struct iw_scan_req *wreq = NULL; | 603 | struct iw_scan_req *wreq = NULL; |
604 | struct cfg80211_scan_request *creq; | 604 | struct cfg80211_scan_request *creq = NULL; |
605 | int i, err, n_channels = 0; | 605 | int i, err, n_channels = 0; |
606 | enum ieee80211_band band; | 606 | enum ieee80211_band band; |
607 | 607 | ||
@@ -694,8 +694,10 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
694 | /* translate "Scan for SSID" request */ | 694 | /* translate "Scan for SSID" request */ |
695 | if (wreq) { | 695 | if (wreq) { |
696 | if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { | 696 | if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { |
697 | if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) | 697 | if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) { |
698 | return -EINVAL; | 698 | err = -EINVAL; |
699 | goto out; | ||
700 | } | ||
699 | memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len); | 701 | memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len); |
700 | creq->ssids[0].ssid_len = wreq->essid_len; | 702 | creq->ssids[0].ssid_len = wreq->essid_len; |
701 | } | 703 | } |
@@ -707,12 +709,15 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
707 | err = rdev->ops->scan(wiphy, dev, creq); | 709 | err = rdev->ops->scan(wiphy, dev, creq); |
708 | if (err) { | 710 | if (err) { |
709 | rdev->scan_req = NULL; | 711 | rdev->scan_req = NULL; |
710 | kfree(creq); | 712 | /* creq will be freed below */ |
711 | } else { | 713 | } else { |
712 | nl80211_send_scan_start(rdev, dev); | 714 | nl80211_send_scan_start(rdev, dev); |
715 | /* creq now owned by driver */ | ||
716 | creq = NULL; | ||
713 | dev_hold(dev); | 717 | dev_hold(dev); |
714 | } | 718 | } |
715 | out: | 719 | out: |
720 | kfree(creq); | ||
716 | cfg80211_unlock_rdev(rdev); | 721 | cfg80211_unlock_rdev(rdev); |
717 | return err; | 722 | return err; |
718 | } | 723 | } |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index cb81ca35b0d6..4725a549ad4d 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1445,7 +1445,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
1445 | if (!dev) | 1445 | if (!dev) |
1446 | goto free_dst; | 1446 | goto free_dst; |
1447 | 1447 | ||
1448 | /* Copy neighbout for reachability confirmation */ | 1448 | /* Copy neighbour for reachability confirmation */ |
1449 | dst0->neighbour = neigh_clone(dst->neighbour); | 1449 | dst0->neighbour = neigh_clone(dst->neighbour); |
1450 | 1450 | ||
1451 | xfrm_init_path((struct xfrm_dst *)dst0, dst, nfheader_len); | 1451 | xfrm_init_path((struct xfrm_dst *)dst0, dst, nfheader_len); |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index cd815ac2a50b..0fe48cd91ffa 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -235,3 +235,8 @@ quiet_cmd_lzma = LZMA $@ | |||
235 | cmd_lzma = (cat $(filter-out FORCE,$^) | \ | 235 | cmd_lzma = (cat $(filter-out FORCE,$^) | \ |
236 | lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 236 | lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
237 | (rm -f $@ ; false) | 237 | (rm -f $@ ; false) |
238 | |||
239 | quiet_cmd_lzo = LZO $@ | ||
240 | cmd_lzo = (cat $(filter-out FORCE,$^) | \ | ||
241 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | ||
242 | (rm -f $@ ; false) | ||
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 445e8845f0a4..090f24839700 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -296,46 +296,56 @@ my @status = (); | |||
296 | 296 | ||
297 | foreach my $file (@files) { | 297 | foreach my $file (@files) { |
298 | 298 | ||
299 | #Do not match excluded file patterns | 299 | my %hash; |
300 | 300 | my $tvi = find_first_section(); | |
301 | my $exclude = 0; | 301 | while ($tvi < @typevalue) { |
302 | foreach my $line (@typevalue) { | 302 | my $start = find_starting_index($tvi); |
303 | if ($line =~ m/^(\C):\s*(.*)/) { | 303 | my $end = find_ending_index($tvi); |
304 | my $type = $1; | 304 | my $exclude = 0; |
305 | my $value = $2; | 305 | my $i; |
306 | if ($type eq 'X') { | 306 | |
307 | if (file_match_pattern($file, $value)) { | 307 | #Do not match excluded file patterns |
308 | $exclude = 1; | ||
309 | last; | ||
310 | } | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | 308 | ||
315 | if (!$exclude) { | 309 | for ($i = $start; $i < $end; $i++) { |
316 | my $tvi = 0; | 310 | my $line = $typevalue[$i]; |
317 | my %hash; | ||
318 | foreach my $line (@typevalue) { | ||
319 | if ($line =~ m/^(\C):\s*(.*)/) { | 311 | if ($line =~ m/^(\C):\s*(.*)/) { |
320 | my $type = $1; | 312 | my $type = $1; |
321 | my $value = $2; | 313 | my $value = $2; |
322 | if ($type eq 'F') { | 314 | if ($type eq 'X') { |
323 | if (file_match_pattern($file, $value)) { | 315 | if (file_match_pattern($file, $value)) { |
324 | my $value_pd = ($value =~ tr@/@@); | 316 | $exclude = 1; |
325 | my $file_pd = ($file =~ tr@/@@); | ||
326 | $value_pd++ if (substr($value,-1,1) ne "/"); | ||
327 | if ($pattern_depth == 0 || | ||
328 | (($file_pd - $value_pd) < $pattern_depth)) { | ||
329 | $hash{$tvi} = $value_pd; | ||
330 | } | ||
331 | } | 317 | } |
332 | } | 318 | } |
333 | } | 319 | } |
334 | $tvi++; | ||
335 | } | 320 | } |
336 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | 321 | |
337 | add_categories($line); | 322 | if (!$exclude) { |
323 | for ($i = $start; $i < $end; $i++) { | ||
324 | my $line = $typevalue[$i]; | ||
325 | if ($line =~ m/^(\C):\s*(.*)/) { | ||
326 | my $type = $1; | ||
327 | my $value = $2; | ||
328 | if ($type eq 'F') { | ||
329 | if (file_match_pattern($file, $value)) { | ||
330 | my $value_pd = ($value =~ tr@/@@); | ||
331 | my $file_pd = ($file =~ tr@/@@); | ||
332 | $value_pd++ if (substr($value,-1,1) ne "/"); | ||
333 | if ($pattern_depth == 0 || | ||
334 | (($file_pd - $value_pd) < $pattern_depth)) { | ||
335 | $hash{$tvi} = $value_pd; | ||
336 | } | ||
337 | } | ||
338 | } | ||
339 | } | ||
340 | } | ||
338 | } | 341 | } |
342 | |||
343 | $tvi += ($end - $start); | ||
344 | |||
345 | } | ||
346 | |||
347 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
348 | add_categories($line); | ||
339 | } | 349 | } |
340 | 350 | ||
341 | if ($email && $email_git) { | 351 | if ($email && $email_git) { |
@@ -570,6 +580,20 @@ sub format_email { | |||
570 | return $formatted_email; | 580 | return $formatted_email; |
571 | } | 581 | } |
572 | 582 | ||
583 | sub find_first_section { | ||
584 | my $index = 0; | ||
585 | |||
586 | while ($index < @typevalue) { | ||
587 | my $tv = $typevalue[$index]; | ||
588 | if (($tv =~ m/^(\C):\s*(.*)/)) { | ||
589 | last; | ||
590 | } | ||
591 | $index++; | ||
592 | } | ||
593 | |||
594 | return $index; | ||
595 | } | ||
596 | |||
573 | sub find_starting_index { | 597 | sub find_starting_index { |
574 | my ($index) = @_; | 598 | my ($index) = @_; |
575 | 599 | ||
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 7a374c2eb043..9a2ee845e9d4 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2365,7 +2365,7 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm) | |||
2365 | initrlim = init_task.signal->rlim + i; | 2365 | initrlim = init_task.signal->rlim + i; |
2366 | rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur); | 2366 | rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur); |
2367 | } | 2367 | } |
2368 | update_rlimit_cpu(rlim->rlim_cur); | 2368 | update_rlimit_cpu(current->signal->rlim[RLIMIT_CPU].rlim_cur); |
2369 | } | 2369 | } |
2370 | } | 2370 | } |
2371 | 2371 | ||
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index c5699863643b..656e474dca47 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -441,6 +441,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, | |||
441 | struct snd_pcm_hw_params *params) | 441 | struct snd_pcm_hw_params *params) |
442 | { | 442 | { |
443 | int err; | 443 | int err; |
444 | struct aaci *aaci = substream->private_data; | ||
444 | 445 | ||
445 | aaci_pcm_hw_free(substream); | 446 | aaci_pcm_hw_free(substream); |
446 | if (aacirun->pcm_open) { | 447 | if (aacirun->pcm_open) { |
@@ -560,7 +561,6 @@ static int aaci_pcm_open(struct snd_pcm_substream *substream) | |||
560 | static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, | 561 | static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, |
561 | struct snd_pcm_hw_params *params) | 562 | struct snd_pcm_hw_params *params) |
562 | { | 563 | { |
563 | struct aaci *aaci = substream->private_data; | ||
564 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 564 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
565 | unsigned int channels = params_channels(params); | 565 | unsigned int channels = params_channels(params); |
566 | int ret; | 566 | int ret; |
@@ -659,7 +659,6 @@ static struct snd_pcm_ops aaci_playback_ops = { | |||
659 | static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, | 659 | static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, |
660 | struct snd_pcm_hw_params *params) | 660 | struct snd_pcm_hw_params *params) |
661 | { | 661 | { |
662 | struct aaci *aaci = substream->private_data; | ||
663 | struct aaci_runtime *aacirun = substream->runtime->private_data; | 662 | struct aaci_runtime *aacirun = substream->runtime->private_data; |
664 | int ret; | 663 | int ret; |
665 | 664 | ||
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 29ab46a12e11..25b0641e6b8c 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1918,13 +1918,13 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) | |||
1918 | 1918 | ||
1919 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, | 1919 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, |
1920 | hw->rate_min, hw->rate_max); | 1920 | hw->rate_min, hw->rate_max); |
1921 | if (err < 0) | 1921 | if (err < 0) |
1922 | return err; | 1922 | return err; |
1923 | 1923 | ||
1924 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, | 1924 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, |
1925 | hw->period_bytes_min, hw->period_bytes_max); | 1925 | hw->period_bytes_min, hw->period_bytes_max); |
1926 | if (err < 0) | 1926 | if (err < 0) |
1927 | return err; | 1927 | return err; |
1928 | 1928 | ||
1929 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, | 1929 | err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, |
1930 | hw->periods_min, hw->periods_max); | 1930 | hw->periods_min, hw->periods_max); |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 5fe34a8d8c81..e4581a42ace5 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -42,7 +42,7 @@ static void snd_hda_generate_beep(struct work_struct *work) | |||
42 | return; | 42 | return; |
43 | 43 | ||
44 | /* generate tone */ | 44 | /* generate tone */ |
45 | snd_hda_codec_write_cache(codec, beep->nid, 0, | 45 | snd_hda_codec_write(codec, beep->nid, 0, |
46 | AC_VERB_SET_BEEP_CONTROL, beep->tone); | 46 | AC_VERB_SET_BEEP_CONTROL, beep->tone); |
47 | } | 47 | } |
48 | 48 | ||
@@ -119,7 +119,7 @@ static void snd_hda_do_detach(struct hda_beep *beep) | |||
119 | beep->dev = NULL; | 119 | beep->dev = NULL; |
120 | cancel_work_sync(&beep->beep_work); | 120 | cancel_work_sync(&beep->beep_work); |
121 | /* turn off beep for sure */ | 121 | /* turn off beep for sure */ |
122 | snd_hda_codec_write_cache(beep->codec, beep->nid, 0, | 122 | snd_hda_codec_write(beep->codec, beep->nid, 0, |
123 | AC_VERB_SET_BEEP_CONTROL, 0); | 123 | AC_VERB_SET_BEEP_CONTROL, 0); |
124 | } | 124 | } |
125 | 125 | ||
@@ -192,7 +192,7 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) | |||
192 | beep->enabled = enable; | 192 | beep->enabled = enable; |
193 | if (!enable) { | 193 | if (!enable) { |
194 | /* turn off beep */ | 194 | /* turn off beep */ |
195 | snd_hda_codec_write_cache(beep->codec, beep->nid, 0, | 195 | snd_hda_codec_write(beep->codec, beep->nid, 0, |
196 | AC_VERB_SET_BEEP_CONTROL, 0); | 196 | AC_VERB_SET_BEEP_CONTROL, 0); |
197 | } | 197 | } |
198 | if (beep->mode == HDA_BEEP_MODE_SWREG) { | 198 | if (beep->mode == HDA_BEEP_MODE_SWREG) { |
@@ -239,8 +239,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
239 | mutex_init(&beep->mutex); | 239 | mutex_init(&beep->mutex); |
240 | 240 | ||
241 | if (beep->mode == HDA_BEEP_MODE_ON) { | 241 | if (beep->mode == HDA_BEEP_MODE_ON) { |
242 | beep->enabled = 1; | 242 | int err = snd_hda_do_attach(beep); |
243 | snd_hda_do_register(&beep->register_work); | 243 | if (err < 0) { |
244 | kfree(beep); | ||
245 | codec->beep = NULL; | ||
246 | return err; | ||
247 | } | ||
244 | } | 248 | } |
245 | 249 | ||
246 | return 0; | 250 | return 0; |
@@ -253,7 +257,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec) | |||
253 | if (beep) { | 257 | if (beep) { |
254 | cancel_work_sync(&beep->register_work); | 258 | cancel_work_sync(&beep->register_work); |
255 | cancel_delayed_work(&beep->unregister_work); | 259 | cancel_delayed_work(&beep->unregister_work); |
256 | if (beep->enabled) | 260 | if (beep->dev) |
257 | snd_hda_do_detach(beep); | 261 | snd_hda_do_detach(beep); |
258 | codec->beep = NULL; | 262 | codec->beep = NULL; |
259 | kfree(beep); | 263 | kfree(beep); |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 950ee5cfcacf..f98b47cd6cfb 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1327,11 +1327,13 @@ EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps); | |||
1327 | */ | 1327 | */ |
1328 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) | 1328 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
1329 | { | 1329 | { |
1330 | u32 pincap = snd_hda_query_pin_caps(codec, nid); | 1330 | u32 pincap; |
1331 | |||
1332 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | ||
1333 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
1334 | 1331 | ||
1332 | if (!codec->no_trigger_sense) { | ||
1333 | pincap = snd_hda_query_pin_caps(codec, nid); | ||
1334 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | ||
1335 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
1336 | } | ||
1335 | return snd_hda_codec_read(codec, nid, 0, | 1337 | return snd_hda_codec_read(codec, nid, 0, |
1336 | AC_VERB_GET_PIN_SENSE, 0); | 1338 | AC_VERB_GET_PIN_SENSE, 0); |
1337 | } | 1339 | } |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 1d541b7f5547..0a770a28e71f 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -817,6 +817,7 @@ struct hda_codec { | |||
817 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index | 817 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index |
818 | * (e.g. Conexant codecs) | 818 | * (e.g. Conexant codecs) |
819 | */ | 819 | */ |
820 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ | ||
820 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 821 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
821 | unsigned int power_on :1; /* current (global) power-state */ | 822 | unsigned int power_on :1; /* current (global) power-state */ |
822 | unsigned int power_transition :1; /* power-state in transition */ | 823 | unsigned int power_transition :1; /* power-state in transition */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index ff8ad46cc50e..ec9c348336cc 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -356,6 +356,7 @@ struct azx_dev { | |||
356 | */ | 356 | */ |
357 | unsigned char stream_tag; /* assigned stream */ | 357 | unsigned char stream_tag; /* assigned stream */ |
358 | unsigned char index; /* stream index */ | 358 | unsigned char index; /* stream index */ |
359 | int device; /* last device number assigned to */ | ||
359 | 360 | ||
360 | unsigned int opened :1; | 361 | unsigned int opened :1; |
361 | unsigned int running :1; | 362 | unsigned int running :1; |
@@ -1441,10 +1442,13 @@ static int __devinit azx_codec_configure(struct azx *chip) | |||
1441 | */ | 1442 | */ |
1442 | 1443 | ||
1443 | /* assign a stream for the PCM */ | 1444 | /* assign a stream for the PCM */ |
1444 | static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) | 1445 | static inline struct azx_dev * |
1446 | azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) | ||
1445 | { | 1447 | { |
1446 | int dev, i, nums; | 1448 | int dev, i, nums; |
1447 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { | 1449 | struct azx_dev *res = NULL; |
1450 | |||
1451 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
1448 | dev = chip->playback_index_offset; | 1452 | dev = chip->playback_index_offset; |
1449 | nums = chip->playback_streams; | 1453 | nums = chip->playback_streams; |
1450 | } else { | 1454 | } else { |
@@ -1453,10 +1457,15 @@ static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) | |||
1453 | } | 1457 | } |
1454 | for (i = 0; i < nums; i++, dev++) | 1458 | for (i = 0; i < nums; i++, dev++) |
1455 | if (!chip->azx_dev[dev].opened) { | 1459 | if (!chip->azx_dev[dev].opened) { |
1456 | chip->azx_dev[dev].opened = 1; | 1460 | res = &chip->azx_dev[dev]; |
1457 | return &chip->azx_dev[dev]; | 1461 | if (res->device == substream->pcm->device) |
1462 | break; | ||
1458 | } | 1463 | } |
1459 | return NULL; | 1464 | if (res) { |
1465 | res->opened = 1; | ||
1466 | res->device = substream->pcm->device; | ||
1467 | } | ||
1468 | return res; | ||
1460 | } | 1469 | } |
1461 | 1470 | ||
1462 | /* release the assigned stream */ | 1471 | /* release the assigned stream */ |
@@ -1505,7 +1514,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1505 | int err; | 1514 | int err; |
1506 | 1515 | ||
1507 | mutex_lock(&chip->open_mutex); | 1516 | mutex_lock(&chip->open_mutex); |
1508 | azx_dev = azx_assign_device(chip, substream->stream); | 1517 | azx_dev = azx_assign_device(chip, substream); |
1509 | if (azx_dev == NULL) { | 1518 | if (azx_dev == NULL) { |
1510 | mutex_unlock(&chip->open_mutex); | 1519 | mutex_unlock(&chip->open_mutex); |
1511 | return -EBUSY; | 1520 | return -EBUSY; |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 1a36137e13ec..69a941c7b158 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -1186,6 +1186,8 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
1186 | */ | 1186 | */ |
1187 | spec->multiout.no_share_stream = 1; | 1187 | spec->multiout.no_share_stream = 1; |
1188 | 1188 | ||
1189 | codec->no_trigger_sense = 1; | ||
1190 | |||
1189 | return 0; | 1191 | return 0; |
1190 | } | 1192 | } |
1191 | 1193 | ||
@@ -1371,6 +1373,8 @@ static int patch_ad1983(struct hda_codec *codec) | |||
1371 | 1373 | ||
1372 | codec->patch_ops = ad198x_patch_ops; | 1374 | codec->patch_ops = ad198x_patch_ops; |
1373 | 1375 | ||
1376 | codec->no_trigger_sense = 1; | ||
1377 | |||
1374 | return 0; | 1378 | return 0; |
1375 | } | 1379 | } |
1376 | 1380 | ||
@@ -1813,6 +1817,9 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1813 | codec->patch_ops.unsol_event = ad1981_hp_unsol_event; | 1817 | codec->patch_ops.unsol_event = ad1981_hp_unsol_event; |
1814 | break; | 1818 | break; |
1815 | } | 1819 | } |
1820 | |||
1821 | codec->no_trigger_sense = 1; | ||
1822 | |||
1816 | return 0; | 1823 | return 0; |
1817 | } | 1824 | } |
1818 | 1825 | ||
@@ -3118,6 +3125,8 @@ static int patch_ad1988(struct hda_codec *codec) | |||
3118 | #endif | 3125 | #endif |
3119 | spec->vmaster_nid = 0x04; | 3126 | spec->vmaster_nid = 0x04; |
3120 | 3127 | ||
3128 | codec->no_trigger_sense = 1; | ||
3129 | |||
3121 | return 0; | 3130 | return 0; |
3122 | } | 3131 | } |
3123 | 3132 | ||
@@ -3330,6 +3339,8 @@ static int patch_ad1884(struct hda_codec *codec) | |||
3330 | 3339 | ||
3331 | codec->patch_ops = ad198x_patch_ops; | 3340 | codec->patch_ops = ad198x_patch_ops; |
3332 | 3341 | ||
3342 | codec->no_trigger_sense = 1; | ||
3343 | |||
3333 | return 0; | 3344 | return 0; |
3334 | } | 3345 | } |
3335 | 3346 | ||
@@ -4287,6 +4298,8 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
4287 | break; | 4298 | break; |
4288 | } | 4299 | } |
4289 | 4300 | ||
4301 | codec->no_trigger_sense = 1; | ||
4302 | |||
4290 | return 0; | 4303 | return 0; |
4291 | } | 4304 | } |
4292 | 4305 | ||
@@ -4623,6 +4636,9 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4623 | spec->mixers[2] = ad1882_6stack_mixers; | 4636 | spec->mixers[2] = ad1882_6stack_mixers; |
4624 | break; | 4637 | break; |
4625 | } | 4638 | } |
4639 | |||
4640 | codec->no_trigger_sense = 1; | ||
4641 | |||
4626 | return 0; | 4642 | return 0; |
4627 | } | 4643 | } |
4628 | 4644 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index eeda7beeb57a..2291a8396817 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -4453,14 +4453,7 @@ static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) | |||
4453 | { | 4453 | { |
4454 | if (!nid) | 4454 | if (!nid) |
4455 | return 0; | 4455 | return 0; |
4456 | /* NOTE: we can't use snd_hda_jack_detect() here because STAC/IDT | 4456 | return snd_hda_jack_detect(codec, nid); |
4457 | * codecs behave wrongly when SET_PIN_SENSE is triggered, although | ||
4458 | * the pincap gives TRIG_REQ bit. | ||
4459 | */ | ||
4460 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0) & | ||
4461 | AC_PINSENSE_PRESENCE) | ||
4462 | return 1; | ||
4463 | return 0; | ||
4464 | } | 4457 | } |
4465 | 4458 | ||
4466 | static void stac92xx_line_out_detect(struct hda_codec *codec, | 4459 | static void stac92xx_line_out_detect(struct hda_codec *codec, |
@@ -4962,6 +4955,7 @@ static int patch_stac9200(struct hda_codec *codec) | |||
4962 | if (spec == NULL) | 4955 | if (spec == NULL) |
4963 | return -ENOMEM; | 4956 | return -ENOMEM; |
4964 | 4957 | ||
4958 | codec->no_trigger_sense = 1; | ||
4965 | codec->spec = spec; | 4959 | codec->spec = spec; |
4966 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); | 4960 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
4967 | spec->pin_nids = stac9200_pin_nids; | 4961 | spec->pin_nids = stac9200_pin_nids; |
@@ -5024,6 +5018,7 @@ static int patch_stac925x(struct hda_codec *codec) | |||
5024 | if (spec == NULL) | 5018 | if (spec == NULL) |
5025 | return -ENOMEM; | 5019 | return -ENOMEM; |
5026 | 5020 | ||
5021 | codec->no_trigger_sense = 1; | ||
5027 | codec->spec = spec; | 5022 | codec->spec = spec; |
5028 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); | 5023 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
5029 | spec->pin_nids = stac925x_pin_nids; | 5024 | spec->pin_nids = stac925x_pin_nids; |
@@ -5108,6 +5103,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec) | |||
5108 | if (spec == NULL) | 5103 | if (spec == NULL) |
5109 | return -ENOMEM; | 5104 | return -ENOMEM; |
5110 | 5105 | ||
5106 | codec->no_trigger_sense = 1; | ||
5111 | codec->spec = spec; | 5107 | codec->spec = spec; |
5112 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; | 5108 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; |
5113 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); | 5109 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
@@ -5255,6 +5251,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
5255 | if (spec == NULL) | 5251 | if (spec == NULL) |
5256 | return -ENOMEM; | 5252 | return -ENOMEM; |
5257 | 5253 | ||
5254 | codec->no_trigger_sense = 1; | ||
5258 | codec->spec = spec; | 5255 | codec->spec = spec; |
5259 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; | 5256 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
5260 | spec->digbeep_nid = 0x21; | 5257 | spec->digbeep_nid = 0x21; |
@@ -5418,6 +5415,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
5418 | if (spec == NULL) | 5415 | if (spec == NULL) |
5419 | return -ENOMEM; | 5416 | return -ENOMEM; |
5420 | 5417 | ||
5418 | codec->no_trigger_sense = 1; | ||
5421 | codec->spec = spec; | 5419 | codec->spec = spec; |
5422 | codec->patch_ops = stac92xx_patch_ops; | 5420 | codec->patch_ops = stac92xx_patch_ops; |
5423 | spec->num_pins = STAC92HD71BXX_NUM_PINS; | 5421 | spec->num_pins = STAC92HD71BXX_NUM_PINS; |
@@ -5661,6 +5659,7 @@ static int patch_stac922x(struct hda_codec *codec) | |||
5661 | if (spec == NULL) | 5659 | if (spec == NULL) |
5662 | return -ENOMEM; | 5660 | return -ENOMEM; |
5663 | 5661 | ||
5662 | codec->no_trigger_sense = 1; | ||
5664 | codec->spec = spec; | 5663 | codec->spec = spec; |
5665 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); | 5664 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
5666 | spec->pin_nids = stac922x_pin_nids; | 5665 | spec->pin_nids = stac922x_pin_nids; |
@@ -5764,6 +5763,7 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5764 | if (spec == NULL) | 5763 | if (spec == NULL) |
5765 | return -ENOMEM; | 5764 | return -ENOMEM; |
5766 | 5765 | ||
5766 | codec->no_trigger_sense = 1; | ||
5767 | codec->spec = spec; | 5767 | codec->spec = spec; |
5768 | codec->slave_dig_outs = stac927x_slave_dig_outs; | 5768 | codec->slave_dig_outs = stac927x_slave_dig_outs; |
5769 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); | 5769 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
@@ -5898,6 +5898,7 @@ static int patch_stac9205(struct hda_codec *codec) | |||
5898 | if (spec == NULL) | 5898 | if (spec == NULL) |
5899 | return -ENOMEM; | 5899 | return -ENOMEM; |
5900 | 5900 | ||
5901 | codec->no_trigger_sense = 1; | ||
5901 | codec->spec = spec; | 5902 | codec->spec = spec; |
5902 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); | 5903 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
5903 | spec->pin_nids = stac9205_pin_nids; | 5904 | spec->pin_nids = stac9205_pin_nids; |
@@ -6053,6 +6054,7 @@ static int patch_stac9872(struct hda_codec *codec) | |||
6053 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 6054 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
6054 | if (spec == NULL) | 6055 | if (spec == NULL) |
6055 | return -ENOMEM; | 6056 | return -ENOMEM; |
6057 | codec->no_trigger_sense = 1; | ||
6056 | codec->spec = spec; | 6058 | codec->spec = spec; |
6057 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); | 6059 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); |
6058 | spec->pin_nids = stac9872_pin_nids; | 6060 | spec->pin_nids = stac9872_pin_nids; |
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index 69bd0acc81c8..a1bbe16b7f96 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c | |||
@@ -102,6 +102,12 @@ static int ac97_soc_probe(struct platform_device *pdev) | |||
102 | INIT_LIST_HEAD(&codec->dapm_widgets); | 102 | INIT_LIST_HEAD(&codec->dapm_widgets); |
103 | INIT_LIST_HEAD(&codec->dapm_paths); | 103 | INIT_LIST_HEAD(&codec->dapm_paths); |
104 | 104 | ||
105 | ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); | ||
106 | if (ret < 0) { | ||
107 | printk(KERN_ERR "ASoC: failed to init gen ac97 glue\n"); | ||
108 | goto err; | ||
109 | } | ||
110 | |||
105 | /* register pcms */ | 111 | /* register pcms */ |
106 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | 112 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); |
107 | if (ret < 0) | 113 | if (ret < 0) |
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 265e68c75df8..af8cb6995a1f 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c | |||
@@ -424,23 +424,23 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream, | |||
424 | 424 | ||
425 | /* filter coefficient */ | 425 | /* filter coefficient */ |
426 | switch (params_rate(params)) { | 426 | switch (params_rate(params)) { |
427 | case SNDRV_PCM_RATE_8000: | 427 | case 8000: |
428 | adn |= 0x5 << 1; | 428 | adn |= 0x5 << 1; |
429 | break; | 429 | break; |
430 | case SNDRV_PCM_RATE_11025: | 430 | case 11025: |
431 | adn |= 0x4 << 1; | 431 | adn |= 0x4 << 1; |
432 | break; | 432 | break; |
433 | case SNDRV_PCM_RATE_16000: | 433 | case 16000: |
434 | adn |= 0x3 << 1; | 434 | adn |= 0x3 << 1; |
435 | break; | 435 | break; |
436 | case SNDRV_PCM_RATE_22050: | 436 | case 22050: |
437 | adn |= 0x2 << 1; | 437 | adn |= 0x2 << 1; |
438 | break; | 438 | break; |
439 | case SNDRV_PCM_RATE_32000: | 439 | case 32000: |
440 | adn |= 0x1 << 1; | 440 | adn |= 0x1 << 1; |
441 | break; | 441 | break; |
442 | case SNDRV_PCM_RATE_44100: | 442 | case 44100: |
443 | case SNDRV_PCM_RATE_48000: | 443 | case 48000: |
444 | break; | 444 | break; |
445 | } | 445 | } |
446 | 446 | ||
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 3d850b97037a..31e39ffd1d8e 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c | |||
@@ -378,23 +378,23 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream, | |||
378 | iface |= (1 << 9); | 378 | iface |= (1 << 9); |
379 | 379 | ||
380 | switch (params_rate(params)) { | 380 | switch (params_rate(params)) { |
381 | case SNDRV_PCM_RATE_8000: | 381 | case 8000: |
382 | addcntrl |= (0x5 << 1); | 382 | addcntrl |= (0x5 << 1); |
383 | break; | 383 | break; |
384 | case SNDRV_PCM_RATE_11025: | 384 | case 11025: |
385 | addcntrl |= (0x4 << 1); | 385 | addcntrl |= (0x4 << 1); |
386 | break; | 386 | break; |
387 | case SNDRV_PCM_RATE_16000: | 387 | case 16000: |
388 | addcntrl |= (0x3 << 1); | 388 | addcntrl |= (0x3 << 1); |
389 | break; | 389 | break; |
390 | case SNDRV_PCM_RATE_22050: | 390 | case 22050: |
391 | addcntrl |= (0x2 << 1); | 391 | addcntrl |= (0x2 << 1); |
392 | break; | 392 | break; |
393 | case SNDRV_PCM_RATE_32000: | 393 | case 32000: |
394 | addcntrl |= (0x1 << 1); | 394 | addcntrl |= (0x1 << 1); |
395 | break; | 395 | break; |
396 | case SNDRV_PCM_RATE_44100: | 396 | case 44100: |
397 | case SNDRV_PCM_RATE_48000: | 397 | case 48000: |
398 | break; | 398 | break; |
399 | } | 399 | } |
400 | ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl); | 400 | ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl); |
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index a808675388fc..8812751da8c9 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c | |||
@@ -482,23 +482,23 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream, | |||
482 | 482 | ||
483 | /* filter coefficient */ | 483 | /* filter coefficient */ |
484 | switch (params_rate(params)) { | 484 | switch (params_rate(params)) { |
485 | case SNDRV_PCM_RATE_8000: | 485 | case 8000: |
486 | adn |= 0x5 << 1; | 486 | adn |= 0x5 << 1; |
487 | break; | 487 | break; |
488 | case SNDRV_PCM_RATE_11025: | 488 | case 11025: |
489 | adn |= 0x4 << 1; | 489 | adn |= 0x4 << 1; |
490 | break; | 490 | break; |
491 | case SNDRV_PCM_RATE_16000: | 491 | case 16000: |
492 | adn |= 0x3 << 1; | 492 | adn |= 0x3 << 1; |
493 | break; | 493 | break; |
494 | case SNDRV_PCM_RATE_22050: | 494 | case 22050: |
495 | adn |= 0x2 << 1; | 495 | adn |= 0x2 << 1; |
496 | break; | 496 | break; |
497 | case SNDRV_PCM_RATE_32000: | 497 | case 32000: |
498 | adn |= 0x1 << 1; | 498 | adn |= 0x1 << 1; |
499 | break; | 499 | break; |
500 | case SNDRV_PCM_RATE_44100: | 500 | case 44100: |
501 | case SNDRV_PCM_RATE_48000: | 501 | case 48000: |
502 | break; | 502 | break; |
503 | } | 503 | } |
504 | 504 | ||
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index c7af09729c6e..5263ab18f827 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c | |||
@@ -42,42 +42,12 @@ static struct snd_soc_device fsi_snd_devdata = { | |||
42 | .codec_dev = &soc_codec_dev_ak4642, | 42 | .codec_dev = &soc_codec_dev_ak4642, |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #define AK4642_BUS 0 | ||
46 | #define AK4642_ADR 0x12 | ||
47 | static int ak4642_add_i2c_device(void) | ||
48 | { | ||
49 | struct i2c_board_info info; | ||
50 | struct i2c_adapter *adapter; | ||
51 | struct i2c_client *client; | ||
52 | |||
53 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
54 | info.addr = AK4642_ADR; | ||
55 | strlcpy(info.type, "ak4642", I2C_NAME_SIZE); | ||
56 | |||
57 | adapter = i2c_get_adapter(AK4642_BUS); | ||
58 | if (!adapter) { | ||
59 | printk(KERN_DEBUG "can't get i2c adapter\n"); | ||
60 | return -ENODEV; | ||
61 | } | ||
62 | |||
63 | client = i2c_new_device(adapter, &info); | ||
64 | i2c_put_adapter(adapter); | ||
65 | if (!client) { | ||
66 | printk(KERN_DEBUG "can't add i2c device\n"); | ||
67 | return -ENODEV; | ||
68 | } | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static struct platform_device *fsi_snd_device; | 45 | static struct platform_device *fsi_snd_device; |
74 | 46 | ||
75 | static int __init fsi_ak4642_init(void) | 47 | static int __init fsi_ak4642_init(void) |
76 | { | 48 | { |
77 | int ret = -ENOMEM; | 49 | int ret = -ENOMEM; |
78 | 50 | ||
79 | ak4642_add_i2c_device(); | ||
80 | |||
81 | fsi_snd_device = platform_device_alloc("soc-audio", -1); | 51 | fsi_snd_device = platform_device_alloc("soc-audio", -1); |
82 | if (!fsi_snd_device) | 52 | if (!fsi_snd_device) |
83 | goto out; | 53 | goto out; |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 4390d225686d..652a470b5f74 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -343,13 +343,18 @@ LIB_H += util/include/linux/string.h | |||
343 | LIB_H += util/include/linux/types.h | 343 | LIB_H += util/include/linux/types.h |
344 | LIB_H += util/include/asm/asm-offsets.h | 344 | LIB_H += util/include/asm/asm-offsets.h |
345 | LIB_H += util/include/asm/bitops.h | 345 | LIB_H += util/include/asm/bitops.h |
346 | LIB_H += util/include/asm/bug.h | ||
346 | LIB_H += util/include/asm/byteorder.h | 347 | LIB_H += util/include/asm/byteorder.h |
347 | LIB_H += util/include/asm/swab.h | 348 | LIB_H += util/include/asm/swab.h |
348 | LIB_H += util/include/asm/system.h | 349 | LIB_H += util/include/asm/system.h |
349 | LIB_H += util/include/asm/uaccess.h | 350 | LIB_H += util/include/asm/uaccess.h |
350 | LIB_H += perf.h | 351 | LIB_H += perf.h |
352 | LIB_H += util/cache.h | ||
353 | LIB_H += util/callchain.h | ||
354 | LIB_H += util/debug.h | ||
351 | LIB_H += util/debugfs.h | 355 | LIB_H += util/debugfs.h |
352 | LIB_H += util/event.h | 356 | LIB_H += util/event.h |
357 | LIB_H += util/exec_cmd.h | ||
353 | LIB_H += util/types.h | 358 | LIB_H += util/types.h |
354 | LIB_H += util/levenshtein.h | 359 | LIB_H += util/levenshtein.h |
355 | LIB_H += util/parse-options.h | 360 | LIB_H += util/parse-options.h |
@@ -362,6 +367,7 @@ LIB_H += util/session.h | |||
362 | LIB_H += util/strbuf.h | 367 | LIB_H += util/strbuf.h |
363 | LIB_H += util/string.h | 368 | LIB_H += util/string.h |
364 | LIB_H += util/strlist.h | 369 | LIB_H += util/strlist.h |
370 | LIB_H += util/svghelper.h | ||
365 | LIB_H += util/run-command.h | 371 | LIB_H += util/run-command.h |
366 | LIB_H += util/sigchain.h | 372 | LIB_H += util/sigchain.h |
367 | LIB_H += util/symbol.h | 373 | LIB_H += util/symbol.h |
@@ -370,6 +376,8 @@ LIB_H += util/values.h | |||
370 | LIB_H += util/sort.h | 376 | LIB_H += util/sort.h |
371 | LIB_H += util/hist.h | 377 | LIB_H += util/hist.h |
372 | LIB_H += util/thread.h | 378 | LIB_H += util/thread.h |
379 | LIB_H += util/trace-event.h | ||
380 | LIB_H += util/trace-event-perl.h | ||
373 | LIB_H += util/probe-finder.h | 381 | LIB_H += util/probe-finder.h |
374 | LIB_H += util/probe-event.h | 382 | LIB_H += util/probe-event.h |
375 | 383 | ||
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c index e693e6777af5..1e99ac806913 100644 --- a/tools/perf/builtin-buildid-list.c +++ b/tools/perf/builtin-buildid-list.c | |||
@@ -17,7 +17,7 @@ | |||
17 | static char const *input_name = "perf.data"; | 17 | static char const *input_name = "perf.data"; |
18 | static int force; | 18 | static int force; |
19 | 19 | ||
20 | static const char *const buildid_list_usage[] = { | 20 | static const char * const buildid_list_usage[] = { |
21 | "perf buildid-list [<options>]", | 21 | "perf buildid-list [<options>]", |
22 | NULL | 22 | NULL |
23 | }; | 23 | }; |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4d33b55d5584..bd71b8ceafb7 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -189,8 +189,9 @@ out_delete: | |||
189 | return ret; | 189 | return ret; |
190 | } | 190 | } |
191 | 191 | ||
192 | static const char *const diff_usage[] = { | 192 | static const char * const diff_usage[] = { |
193 | "perf diff [<options>] [old_file] [new_file]", | 193 | "perf diff [<options>] [old_file] [new_file]", |
194 | NULL, | ||
194 | }; | 195 | }; |
195 | 196 | ||
196 | static const struct option options[] = { | 197 | static const struct option options[] = { |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index fc21ad79dd83..7ceb7416c316 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -137,7 +137,7 @@ static void insert_alloc_stat(unsigned long call_site, unsigned long ptr, | |||
137 | if (data && data->ptr == ptr) { | 137 | if (data && data->ptr == ptr) { |
138 | data->hit++; | 138 | data->hit++; |
139 | data->bytes_req += bytes_req; | 139 | data->bytes_req += bytes_req; |
140 | data->bytes_alloc += bytes_req; | 140 | data->bytes_alloc += bytes_alloc; |
141 | } else { | 141 | } else { |
142 | data = malloc(sizeof(*data)); | 142 | data = malloc(sizeof(*data)); |
143 | if (!data) | 143 | if (!data) |
@@ -177,7 +177,7 @@ static void insert_caller_stat(unsigned long call_site, | |||
177 | if (data && data->call_site == call_site) { | 177 | if (data && data->call_site == call_site) { |
178 | data->hit++; | 178 | data->hit++; |
179 | data->bytes_req += bytes_req; | 179 | data->bytes_req += bytes_req; |
180 | data->bytes_alloc += bytes_req; | 180 | data->bytes_alloc += bytes_alloc; |
181 | } else { | 181 | } else { |
182 | data = malloc(sizeof(*data)); | 182 | data = malloc(sizeof(*data)); |
183 | if (!data) | 183 | if (!data) |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 63136d0534d4..265425322734 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -402,7 +402,7 @@ static void atexit_header(void) | |||
402 | perf_header__write(&session->header, output, true); | 402 | perf_header__write(&session->header, output, true); |
403 | } | 403 | } |
404 | 404 | ||
405 | static int __cmd_record(int argc __used, const char **argv) | 405 | static int __cmd_record(int argc, const char **argv) |
406 | { | 406 | { |
407 | int i, counter; | 407 | int i, counter; |
408 | struct stat st; | 408 | struct stat st; |
@@ -411,6 +411,7 @@ static int __cmd_record(int argc __used, const char **argv) | |||
411 | int err; | 411 | int err; |
412 | unsigned long waking = 0; | 412 | unsigned long waking = 0; |
413 | int child_ready_pipe[2], go_pipe[2]; | 413 | int child_ready_pipe[2], go_pipe[2]; |
414 | const bool forks = target_pid == -1 && argc > 0; | ||
414 | char buf; | 415 | char buf; |
415 | 416 | ||
416 | page_size = sysconf(_SC_PAGE_SIZE); | 417 | page_size = sysconf(_SC_PAGE_SIZE); |
@@ -422,7 +423,7 @@ static int __cmd_record(int argc __used, const char **argv) | |||
422 | signal(SIGCHLD, sig_handler); | 423 | signal(SIGCHLD, sig_handler); |
423 | signal(SIGINT, sig_handler); | 424 | signal(SIGINT, sig_handler); |
424 | 425 | ||
425 | if (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0) { | 426 | if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) { |
426 | perror("failed to create pipes"); | 427 | perror("failed to create pipes"); |
427 | exit(-1); | 428 | exit(-1); |
428 | } | 429 | } |
@@ -483,7 +484,7 @@ static int __cmd_record(int argc __used, const char **argv) | |||
483 | 484 | ||
484 | atexit(atexit_header); | 485 | atexit(atexit_header); |
485 | 486 | ||
486 | if (target_pid == -1) { | 487 | if (forks) { |
487 | pid = fork(); | 488 | pid = fork(); |
488 | if (pid < 0) { | 489 | if (pid < 0) { |
489 | perror("failed to fork"); | 490 | perror("failed to fork"); |
@@ -550,7 +551,7 @@ static int __cmd_record(int argc __used, const char **argv) | |||
550 | return err; | 551 | return err; |
551 | } | 552 | } |
552 | 553 | ||
553 | if (!system_wide) | 554 | if (!system_wide && profile_cpu == -1) |
554 | event__synthesize_thread(pid, process_synthesized_event, | 555 | event__synthesize_thread(pid, process_synthesized_event, |
555 | session); | 556 | session); |
556 | else | 557 | else |
@@ -569,7 +570,8 @@ static int __cmd_record(int argc __used, const char **argv) | |||
569 | /* | 570 | /* |
570 | * Let the child rip | 571 | * Let the child rip |
571 | */ | 572 | */ |
572 | close(go_pipe[1]); | 573 | if (forks) |
574 | close(go_pipe[1]); | ||
573 | 575 | ||
574 | for (;;) { | 576 | for (;;) { |
575 | int hits = samples; | 577 | int hits = samples; |
@@ -667,7 +669,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
667 | 669 | ||
668 | argc = parse_options(argc, argv, options, record_usage, | 670 | argc = parse_options(argc, argv, options, record_usage, |
669 | PARSE_OPT_STOP_AT_NON_OPTION); | 671 | PARSE_OPT_STOP_AT_NON_OPTION); |
670 | if (!argc && target_pid == -1 && (!system_wide || profile_cpu == -1)) | 672 | if (!argc && target_pid == -1 && !system_wide && profile_cpu == -1) |
671 | usage_with_options(record_usage, options); | 673 | usage_with_options(record_usage, options); |
672 | 674 | ||
673 | symbol__init(); | 675 | symbol__init(); |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 5c2ab5357ec6..db10c0e8ecae 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -294,8 +294,7 @@ setup: | |||
294 | return 0; | 294 | return 0; |
295 | } | 295 | } |
296 | 296 | ||
297 | //static const char * const report_usage[] = { | 297 | static const char * const report_usage[] = { |
298 | const char * const report_usage[] = { | ||
299 | "perf report [<options>] <command>", | 298 | "perf report [<options>] <command>", |
300 | NULL | 299 | NULL |
301 | }; | 300 | }; |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index e2285e28720f..574a215e800b 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -512,7 +512,7 @@ static char *get_script_path(const char *script_root, const char *suffix) | |||
512 | return path; | 512 | return path; |
513 | } | 513 | } |
514 | 514 | ||
515 | static const char * const annotate_usage[] = { | 515 | static const char * const trace_usage[] = { |
516 | "perf trace [<options>] <command>", | 516 | "perf trace [<options>] <command>", |
517 | NULL | 517 | NULL |
518 | }; | 518 | }; |
@@ -581,7 +581,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used) | |||
581 | 581 | ||
582 | setup_scripting(); | 582 | setup_scripting(); |
583 | 583 | ||
584 | argc = parse_options(argc, argv, options, annotate_usage, | 584 | argc = parse_options(argc, argv, options, trace_usage, |
585 | PARSE_OPT_STOP_AT_NON_OPTION); | 585 | PARSE_OPT_STOP_AT_NON_OPTION); |
586 | 586 | ||
587 | if (symbol__init() < 0) | 587 | if (symbol__init() < 0) |
diff --git a/tools/perf/design.txt b/tools/perf/design.txt index f000c30877ac..8d0de5130db3 100644 --- a/tools/perf/design.txt +++ b/tools/perf/design.txt | |||
@@ -21,7 +21,7 @@ There's one file descriptor per virtual counter used. | |||
21 | The special file descriptor is opened via the perf_event_open() | 21 | The special file descriptor is opened via the perf_event_open() |
22 | system call: | 22 | system call: |
23 | 23 | ||
24 | int sys_perf_event_open(struct perf_event_hw_event *hw_event_uptr, | 24 | int sys_perf_event_open(struct perf_event_attr *hw_event_uptr, |
25 | pid_t pid, int cpu, int group_fd, | 25 | pid_t pid, int cpu, int group_fd, |
26 | unsigned long flags); | 26 | unsigned long flags); |
27 | 27 | ||
@@ -32,9 +32,9 @@ can be used to set the blocking mode, etc. | |||
32 | Multiple counters can be kept open at a time, and the counters | 32 | Multiple counters can be kept open at a time, and the counters |
33 | can be poll()ed. | 33 | can be poll()ed. |
34 | 34 | ||
35 | When creating a new counter fd, 'perf_event_hw_event' is: | 35 | When creating a new counter fd, 'perf_event_attr' is: |
36 | 36 | ||
37 | struct perf_event_hw_event { | 37 | struct perf_event_attr { |
38 | /* | 38 | /* |
39 | * The MSB of the config word signifies if the rest contains cpu | 39 | * The MSB of the config word signifies if the rest contains cpu |
40 | * specific (raw) counter configuration data, if unset, the next | 40 | * specific (raw) counter configuration data, if unset, the next |
@@ -399,7 +399,7 @@ Notification of new events is possible through poll()/select()/epoll() and | |||
399 | fcntl() managing signals. | 399 | fcntl() managing signals. |
400 | 400 | ||
401 | Normally a notification is generated for every page filled, however one can | 401 | Normally a notification is generated for every page filled, however one can |
402 | additionally set perf_event_hw_event.wakeup_events to generate one every | 402 | additionally set perf_event_attr.wakeup_events to generate one every |
403 | so many counter overflow events. | 403 | so many counter overflow events. |
404 | 404 | ||
405 | Future work will include a splice() interface to the ring-buffer. | 405 | Future work will include a splice() interface to the ring-buffer. |
diff --git a/usr/Kconfig b/usr/Kconfig index 1c3039f28909..e2721f5a3504 100644 --- a/usr/Kconfig +++ b/usr/Kconfig | |||
@@ -72,6 +72,15 @@ config RD_LZMA | |||
72 | Support loading of a LZMA encoded initial ramdisk or cpio buffer | 72 | Support loading of a LZMA encoded initial ramdisk or cpio buffer |
73 | If unsure, say N. | 73 | If unsure, say N. |
74 | 74 | ||
75 | config RD_LZO | ||
76 | bool "Support initial ramdisks compressed using LZO" if EMBEDDED | ||
77 | default !EMBEDDED | ||
78 | depends on BLK_DEV_INITRD | ||
79 | select DECOMPRESS_LZO | ||
80 | help | ||
81 | Support loading of a LZO encoded initial ramdisk or cpio buffer | ||
82 | If unsure, say N. | ||
83 | |||
75 | choice | 84 | choice |
76 | prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!="" | 85 | prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!="" |
77 | help | 86 | help |
@@ -108,16 +117,15 @@ config INITRAMFS_COMPRESSION_GZIP | |||
108 | bool "Gzip" | 117 | bool "Gzip" |
109 | depends on RD_GZIP | 118 | depends on RD_GZIP |
110 | help | 119 | help |
111 | The old and tried gzip compression. Its compression ratio is | 120 | The old and tried gzip compression. It provides a good balance |
112 | the poorest among the 3 choices; however its speed (both | 121 | between compression ratio and decompression speed. |
113 | compression and decompression) is the fastest. | ||
114 | 122 | ||
115 | config INITRAMFS_COMPRESSION_BZIP2 | 123 | config INITRAMFS_COMPRESSION_BZIP2 |
116 | bool "Bzip2" | 124 | bool "Bzip2" |
117 | depends on RD_BZIP2 | 125 | depends on RD_BZIP2 |
118 | help | 126 | help |
119 | Its compression ratio and speed is intermediate. | 127 | Its compression ratio and speed is intermediate. |
120 | Decompression speed is slowest among the three. The initramfs | 128 | Decompression speed is slowest among the four. The initramfs |
121 | size is about 10% smaller with bzip2, in comparison to gzip. | 129 | size is about 10% smaller with bzip2, in comparison to gzip. |
122 | Bzip2 uses a large amount of memory. For modern kernels you | 130 | Bzip2 uses a large amount of memory. For modern kernels you |
123 | will need at least 8MB RAM or more for booting. | 131 | will need at least 8MB RAM or more for booting. |
@@ -128,7 +136,15 @@ config INITRAMFS_COMPRESSION_LZMA | |||
128 | help | 136 | help |
129 | The most recent compression algorithm. | 137 | The most recent compression algorithm. |
130 | Its ratio is best, decompression speed is between the other | 138 | Its ratio is best, decompression speed is between the other |
131 | two. Compression is slowest. The initramfs size is about 33% | 139 | three. Compression is slowest. The initramfs size is about 33% |
132 | smaller with LZMA in comparison to gzip. | 140 | smaller with LZMA in comparison to gzip. |
133 | 141 | ||
142 | config INITRAMFS_COMPRESSION_LZO | ||
143 | bool "LZO" | ||
144 | depends on RD_LZO | ||
145 | help | ||
146 | Its compression ratio is the poorest among the four. The kernel | ||
147 | size is about about 10% bigger than gzip; however its speed | ||
148 | (both compression and decompression) is the fastest. | ||
149 | |||
134 | endchoice | 150 | endchoice |
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index fd9c097b760a..f73de631e3ee 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c | |||
@@ -508,8 +508,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
508 | struct kvm_assigned_dev_kernel *match; | 508 | struct kvm_assigned_dev_kernel *match; |
509 | struct pci_dev *dev; | 509 | struct pci_dev *dev; |
510 | 510 | ||
511 | down_read(&kvm->slots_lock); | ||
512 | mutex_lock(&kvm->lock); | 511 | mutex_lock(&kvm->lock); |
512 | down_read(&kvm->slots_lock); | ||
513 | 513 | ||
514 | match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, | 514 | match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, |
515 | assigned_dev->assigned_dev_id); | 515 | assigned_dev->assigned_dev_id); |
@@ -573,8 +573,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
573 | } | 573 | } |
574 | 574 | ||
575 | out: | 575 | out: |
576 | mutex_unlock(&kvm->lock); | ||
577 | up_read(&kvm->slots_lock); | 576 | up_read(&kvm->slots_lock); |
577 | mutex_unlock(&kvm->lock); | ||
578 | return r; | 578 | return r; |
579 | out_list_del: | 579 | out_list_del: |
580 | list_del(&match->list); | 580 | list_del(&match->list); |
@@ -585,8 +585,8 @@ out_put: | |||
585 | pci_dev_put(dev); | 585 | pci_dev_put(dev); |
586 | out_free: | 586 | out_free: |
587 | kfree(match); | 587 | kfree(match); |
588 | mutex_unlock(&kvm->lock); | ||
589 | up_read(&kvm->slots_lock); | 588 | up_read(&kvm->slots_lock); |
589 | mutex_unlock(&kvm->lock); | ||
590 | return r; | 590 | return r; |
591 | } | 591 | } |
592 | 592 | ||
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index b5af88167613..a944be392d6e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -64,7 +64,7 @@ MODULE_LICENSE("GPL"); | |||
64 | /* | 64 | /* |
65 | * Ordering of locks: | 65 | * Ordering of locks: |
66 | * | 66 | * |
67 | * kvm->slots_lock --> kvm->lock --> kvm->irq_lock | 67 | * kvm->lock --> kvm->slots_lock --> kvm->irq_lock |
68 | */ | 68 | */ |
69 | 69 | ||
70 | DEFINE_SPINLOCK(kvm_lock); | 70 | DEFINE_SPINLOCK(kvm_lock); |
@@ -406,8 +406,11 @@ static struct kvm *kvm_create_vm(void) | |||
406 | out: | 406 | out: |
407 | return kvm; | 407 | return kvm; |
408 | 408 | ||
409 | #if defined(KVM_COALESCED_MMIO_PAGE_OFFSET) || \ | ||
410 | (defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)) | ||
409 | out_err: | 411 | out_err: |
410 | hardware_disable_all(); | 412 | hardware_disable_all(); |
413 | #endif | ||
411 | out_err_nodisable: | 414 | out_err_nodisable: |
412 | kfree(kvm); | 415 | kfree(kvm); |
413 | return ERR_PTR(r); | 416 | return ERR_PTR(r); |