diff options
319 files changed, 27566 insertions, 5453 deletions
@@ -32,6 +32,7 @@ Brian Avery <b.avery@hp.com> | |||
32 | Brian King <brking@us.ibm.com> | 32 | Brian King <brking@us.ibm.com> |
33 | Christoph Hellwig <hch@lst.de> | 33 | Christoph Hellwig <hch@lst.de> |
34 | Corey Minyard <minyard@acm.org> | 34 | Corey Minyard <minyard@acm.org> |
35 | Damian Hobson-Garcia <dhobsong@igel.co.jp> | ||
35 | David Brownell <david-b@pacbell.net> | 36 | David Brownell <david-b@pacbell.net> |
36 | David Woodhouse <dwmw2@shinybook.infradead.org> | 37 | David Woodhouse <dwmw2@shinybook.infradead.org> |
37 | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 38 | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
diff --git a/Documentation/ABI/testing/sysfs-block b/Documentation/ABI/testing/sysfs-block index 4873c759d535..c1eb41cb9876 100644 --- a/Documentation/ABI/testing/sysfs-block +++ b/Documentation/ABI/testing/sysfs-block | |||
@@ -142,3 +142,67 @@ Description: | |||
142 | with the previous I/O request are enabled. When set to 2, | 142 | with the previous I/O request are enabled. When set to 2, |
143 | all merge tries are disabled. The default value is 0 - | 143 | all merge tries are disabled. The default value is 0 - |
144 | which enables all types of merge tries. | 144 | which enables all types of merge tries. |
145 | |||
146 | What: /sys/block/<disk>/discard_alignment | ||
147 | Date: May 2011 | ||
148 | Contact: Martin K. Petersen <martin.petersen@oracle.com> | ||
149 | Description: | ||
150 | Devices that support discard functionality may | ||
151 | internally allocate space in units that are bigger than | ||
152 | the exported logical block size. The discard_alignment | ||
153 | parameter indicates how many bytes the beginning of the | ||
154 | device is offset from the internal allocation unit's | ||
155 | natural alignment. | ||
156 | |||
157 | What: /sys/block/<disk>/<partition>/discard_alignment | ||
158 | Date: May 2011 | ||
159 | Contact: Martin K. Petersen <martin.petersen@oracle.com> | ||
160 | Description: | ||
161 | Devices that support discard functionality may | ||
162 | internally allocate space in units that are bigger than | ||
163 | the exported logical block size. The discard_alignment | ||
164 | parameter indicates how many bytes the beginning of the | ||
165 | partition is offset from the internal allocation unit's | ||
166 | natural alignment. | ||
167 | |||
168 | What: /sys/block/<disk>/queue/discard_granularity | ||
169 | Date: May 2011 | ||
170 | Contact: Martin K. Petersen <martin.petersen@oracle.com> | ||
171 | Description: | ||
172 | Devices that support discard functionality may | ||
173 | internally allocate space using units that are bigger | ||
174 | than the logical block size. The discard_granularity | ||
175 | parameter indicates the size of the internal allocation | ||
176 | unit in bytes if reported by the device. Otherwise the | ||
177 | discard_granularity will be set to match the device's | ||
178 | physical block size. A discard_granularity of 0 means | ||
179 | that the device does not support discard functionality. | ||
180 | |||
181 | What: /sys/block/<disk>/queue/discard_max_bytes | ||
182 | Date: May 2011 | ||
183 | Contact: Martin K. Petersen <martin.petersen@oracle.com> | ||
184 | Description: | ||
185 | Devices that support discard functionality may have | ||
186 | internal limits on the number of bytes that can be | ||
187 | trimmed or unmapped in a single operation. Some storage | ||
188 | protocols also have inherent limits on the number of | ||
189 | blocks that can be described in a single command. The | ||
190 | discard_max_bytes parameter is set by the device driver | ||
191 | to the maximum number of bytes that can be discarded in | ||
192 | a single operation. Discard requests issued to the | ||
193 | device must not exceed this limit. A discard_max_bytes | ||
194 | value of 0 means that the device does not support | ||
195 | discard functionality. | ||
196 | |||
197 | What: /sys/block/<disk>/queue/discard_zeroes_data | ||
198 | Date: May 2011 | ||
199 | Contact: Martin K. Petersen <martin.petersen@oracle.com> | ||
200 | Description: | ||
201 | Devices that support discard functionality may return | ||
202 | stale or random data when a previously discarded block | ||
203 | is read back. This can cause problems if the filesystem | ||
204 | expects discarded blocks to be explicitly cleared. If a | ||
205 | device reports that it deterministically returns zeroes | ||
206 | when a discarded area is read the discard_zeroes_data | ||
207 | parameter will be set to one. Otherwise it will be 0 and | ||
208 | the result of reading a discarded area is undefined. | ||
diff --git a/Documentation/blockdev/cciss.txt b/Documentation/blockdev/cciss.txt index 89698e8df7d4..c00c6a5ab21f 100644 --- a/Documentation/blockdev/cciss.txt +++ b/Documentation/blockdev/cciss.txt | |||
@@ -169,3 +169,18 @@ is issued which positions the tape to a known position. Typically you | |||
169 | must rewind the tape (by issuing "mt -f /dev/st0 rewind" for example) | 169 | must rewind the tape (by issuing "mt -f /dev/st0 rewind" for example) |
170 | before i/o can proceed again to a tape drive which was reset. | 170 | before i/o can proceed again to a tape drive which was reset. |
171 | 171 | ||
172 | There is a cciss_tape_cmds module parameter which can be used to make cciss | ||
173 | allocate more commands for use by tape drives. Ordinarily only a few commands | ||
174 | (6) are allocated for tape drives because tape drives are slow and | ||
175 | infrequently used and the primary purpose of Smart Array controllers is to | ||
176 | act as a RAID controller for disk drives, so the vast majority of commands | ||
177 | are allocated for disk devices. However, if you have more than a few tape | ||
178 | drives attached to a smart array, the default number of commands may not be | ||
179 | enought (for example, if you have 8 tape drives, you could only rewind 6 | ||
180 | at one time with the default number of commands.) The cciss_tape_cmds module | ||
181 | parameter allows more commands (up to 16 more) to be allocated for use by | ||
182 | tape drives. For example: | ||
183 | |||
184 | insmod cciss.ko cciss_tape_cmds=16 | ||
185 | |||
186 | Or, as a kernel boot parameter passed in via grub: cciss.cciss_tape_cmds=8 | ||
diff --git a/Documentation/filesystems/9p.txt b/Documentation/filesystems/9p.txt index b22abba78fed..13de64c7f0ab 100644 --- a/Documentation/filesystems/9p.txt +++ b/Documentation/filesystems/9p.txt | |||
@@ -25,6 +25,8 @@ Other applications are described in the following papers: | |||
25 | http://xcpu.org/papers/cellfs-talk.pdf | 25 | http://xcpu.org/papers/cellfs-talk.pdf |
26 | * PROSE I/O: Using 9p to enable Application Partitions | 26 | * PROSE I/O: Using 9p to enable Application Partitions |
27 | http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf | 27 | http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf |
28 | * VirtFS: A Virtualization Aware File System pass-through | ||
29 | http://goo.gl/3WPDg | ||
28 | 30 | ||
29 | USAGE | 31 | USAGE |
30 | ===== | 32 | ===== |
@@ -130,31 +132,20 @@ OPTIONS | |||
130 | RESOURCES | 132 | RESOURCES |
131 | ========= | 133 | ========= |
132 | 134 | ||
133 | Our current recommendation is to use Inferno (http://www.vitanuova.com/nferno/index.html) | 135 | Protocol specifications are maintained on github: |
134 | as the 9p server. You can start a 9p server under Inferno by issuing the | 136 | http://ericvh.github.com/9p-rfc/ |
135 | following command: | ||
136 | ; styxlisten -A tcp!*!564 export '#U*' | ||
137 | 137 | ||
138 | The -A specifies an unauthenticated export. The 564 is the port # (you may | 138 | 9p client and server implementations are listed on |
139 | have to choose a higher port number if running as a normal user). The '#U*' | 139 | http://9p.cat-v.org/implementations |
140 | specifies exporting the root of the Linux name space. You may specify a | ||
141 | subset of the namespace by extending the path: '#U*'/tmp would just export | ||
142 | /tmp. For more information, see the Inferno manual pages covering styxlisten | ||
143 | and export. | ||
144 | 140 | ||
145 | A Linux version of the 9p server is now maintained under the npfs project | 141 | A 9p2000.L server is being developed by LLNL and can be found |
146 | on sourceforge (http://sourceforge.net/projects/npfs). The currently | 142 | at http://code.google.com/p/diod/ |
147 | maintained version is the single-threaded version of the server (named spfs) | ||
148 | available from the same SVN repository. | ||
149 | 143 | ||
150 | There are user and developer mailing lists available through the v9fs project | 144 | There are user and developer mailing lists available through the v9fs project |
151 | on sourceforge (http://sourceforge.net/projects/v9fs). | 145 | on sourceforge (http://sourceforge.net/projects/v9fs). |
152 | 146 | ||
153 | A stand-alone version of the module (which should build for any 2.6 kernel) | 147 | News and other information is maintained on a Wiki. |
154 | is available via (http://github.com/ericvh/9p-sac/tree/master) | 148 | (http://sf.net/apps/mediawiki/v9fs/index.php). |
155 | |||
156 | News and other information is maintained on SWiK (http://swik.net/v9fs) | ||
157 | and the Wiki (http://sf.net/apps/mediawiki/v9fs/index.php). | ||
158 | 149 | ||
159 | Bug reports may be issued through the kernel.org bugzilla | 150 | Bug reports may be issued through the kernel.org bugzilla |
160 | (http://bugzilla.kernel.org) | 151 | (http://bugzilla.kernel.org) |
diff --git a/Documentation/hwmon/emc6w201 b/Documentation/hwmon/emc6w201 new file mode 100644 index 000000000000..32f355aaf56b --- /dev/null +++ b/Documentation/hwmon/emc6w201 | |||
@@ -0,0 +1,42 @@ | |||
1 | Kernel driver emc6w201 | ||
2 | ====================== | ||
3 | |||
4 | Supported chips: | ||
5 | * SMSC EMC6W201 | ||
6 | Prefix: 'emc6w201' | ||
7 | Addresses scanned: I2C 0x2c, 0x2d, 0x2e | ||
8 | Datasheet: Not public | ||
9 | |||
10 | Author: Jean Delvare <khali@linux-fr.org> | ||
11 | |||
12 | |||
13 | Description | ||
14 | ----------- | ||
15 | |||
16 | From the datasheet: | ||
17 | |||
18 | "The EMC6W201 is an environmental monitoring device with automatic fan | ||
19 | control capability and enhanced system acoustics for noise suppression. | ||
20 | This ACPI compliant device provides hardware monitoring for up to six | ||
21 | voltages (including its own VCC) and five external thermal sensors, | ||
22 | measures the speed of up to five fans, and controls the speed of | ||
23 | multiple DC fans using three Pulse Width Modulator (PWM) outputs. Note | ||
24 | that it is possible to control more than three fans by connecting two | ||
25 | fans to one PWM output. The EMC6W201 will be available in a 36-pin | ||
26 | QFN package." | ||
27 | |||
28 | The device is functionally close to the EMC6D100 series, but is | ||
29 | register-incompatible. | ||
30 | |||
31 | The driver currently only supports the monitoring of the voltages, | ||
32 | temperatures and fan speeds. Limits can be changed. Alarms are not | ||
33 | supported, and neither is fan speed control. | ||
34 | |||
35 | |||
36 | Known Systems With EMC6W201 | ||
37 | --------------------------- | ||
38 | |||
39 | The EMC6W201 is a rare device, only found on a few systems, made in | ||
40 | 2005 and 2006. Known systems with this device: | ||
41 | * Dell Precision 670 workstation | ||
42 | * Gigabyte 2CEWH mainboard | ||
diff --git a/Documentation/hwmon/f71882fg b/Documentation/hwmon/f71882fg index df02245d1419..84d2623810f3 100644 --- a/Documentation/hwmon/f71882fg +++ b/Documentation/hwmon/f71882fg | |||
@@ -6,6 +6,10 @@ Supported chips: | |||
6 | Prefix: 'f71808e' | 6 | Prefix: 'f71808e' |
7 | Addresses scanned: none, address read from Super I/O config space | 7 | Addresses scanned: none, address read from Super I/O config space |
8 | Datasheet: Not public | 8 | Datasheet: Not public |
9 | * Fintek F71808A | ||
10 | Prefix: 'f71808a' | ||
11 | Addresses scanned: none, address read from Super I/O config space | ||
12 | Datasheet: Not public | ||
9 | * Fintek F71858FG | 13 | * Fintek F71858FG |
10 | Prefix: 'f71858fg' | 14 | Prefix: 'f71858fg' |
11 | Addresses scanned: none, address read from Super I/O config space | 15 | Addresses scanned: none, address read from Super I/O config space |
diff --git a/Documentation/hwmon/fam15h_power b/Documentation/hwmon/fam15h_power new file mode 100644 index 000000000000..a92918e0bd69 --- /dev/null +++ b/Documentation/hwmon/fam15h_power | |||
@@ -0,0 +1,37 @@ | |||
1 | Kernel driver fam15h_power | ||
2 | ========================== | ||
3 | |||
4 | Supported chips: | ||
5 | * AMD Family 15h Processors | ||
6 | |||
7 | Prefix: 'fam15h_power' | ||
8 | Addresses scanned: PCI space | ||
9 | Datasheets: | ||
10 | BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors | ||
11 | (not yet published) | ||
12 | |||
13 | Author: Andreas Herrmann <andreas.herrmann3@amd.com> | ||
14 | |||
15 | Description | ||
16 | ----------- | ||
17 | |||
18 | This driver permits reading of registers providing power information | ||
19 | of AMD Family 15h processors. | ||
20 | |||
21 | For AMD Family 15h processors the following power values can be | ||
22 | calculated using different processor northbridge function registers: | ||
23 | |||
24 | * BasePwrWatts: Specifies in watts the maximum amount of power | ||
25 | consumed by the processor for NB and logic external to the core. | ||
26 | * ProcessorPwrWatts: Specifies in watts the maximum amount of power | ||
27 | the processor can support. | ||
28 | * CurrPwrWatts: Specifies in watts the current amount of power being | ||
29 | consumed by the processor. | ||
30 | |||
31 | This driver provides ProcessorPwrWatts and CurrPwrWatts: | ||
32 | * power1_crit (ProcessorPwrWatts) | ||
33 | * power1_input (CurrPwrWatts) | ||
34 | |||
35 | On multi-node processors the calculated value is for the entire | ||
36 | package and not for a single node. Thus the driver creates sysfs | ||
37 | attributes only for internal node0 of a multi-node processor. | ||
diff --git a/Documentation/hwmon/k10temp b/Documentation/hwmon/k10temp index d2b56a4fd1f5..0393c89277c0 100644 --- a/Documentation/hwmon/k10temp +++ b/Documentation/hwmon/k10temp | |||
@@ -11,6 +11,7 @@ Supported chips: | |||
11 | Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra) | 11 | Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra) |
12 | * AMD Family 12h processors: "Llano" | 12 | * AMD Family 12h processors: "Llano" |
13 | * AMD Family 14h processors: "Brazos" (C/E/G-Series) | 13 | * AMD Family 14h processors: "Brazos" (C/E/G-Series) |
14 | * AMD Family 15h processors: "Bulldozer" | ||
14 | 15 | ||
15 | Prefix: 'k10temp' | 16 | Prefix: 'k10temp' |
16 | Addresses scanned: PCI space | 17 | Addresses scanned: PCI space |
@@ -40,7 +41,7 @@ Description | |||
40 | ----------- | 41 | ----------- |
41 | 42 | ||
42 | This driver permits reading of the internal temperature sensor of AMD | 43 | This driver permits reading of the internal temperature sensor of AMD |
43 | Family 10h/11h/12h/14h processors. | 44 | Family 10h/11h/12h/14h/15h processors. |
44 | 45 | ||
45 | All these processors have a sensor, but on those for Socket F or AM2+, | 46 | All these processors have a sensor, but on those for Socket F or AM2+, |
46 | the sensor may return inconsistent values (erratum 319). The driver | 47 | the sensor may return inconsistent values (erratum 319). The driver |
diff --git a/Documentation/hwmon/max6650 b/Documentation/hwmon/max6650 index c565650fcfc6..58d9644a2bde 100644 --- a/Documentation/hwmon/max6650 +++ b/Documentation/hwmon/max6650 | |||
@@ -2,9 +2,13 @@ Kernel driver max6650 | |||
2 | ===================== | 2 | ===================== |
3 | 3 | ||
4 | Supported chips: | 4 | Supported chips: |
5 | * Maxim 6650 / 6651 | 5 | * Maxim MAX6650 |
6 | Prefix: 'max6650' | 6 | Prefix: 'max6650' |
7 | Addresses scanned: I2C 0x1b, 0x1f, 0x48, 0x4b | 7 | Addresses scanned: none |
8 | Datasheet: http://pdfserv.maxim-ic.com/en/ds/MAX6650-MAX6651.pdf | ||
9 | * Maxim MAX6651 | ||
10 | Prefix: 'max6651' | ||
11 | Addresses scanned: none | ||
8 | Datasheet: http://pdfserv.maxim-ic.com/en/ds/MAX6650-MAX6651.pdf | 12 | Datasheet: http://pdfserv.maxim-ic.com/en/ds/MAX6650-MAX6651.pdf |
9 | 13 | ||
10 | Authors: | 14 | Authors: |
@@ -15,10 +19,10 @@ Authors: | |||
15 | Description | 19 | Description |
16 | ----------- | 20 | ----------- |
17 | 21 | ||
18 | This driver implements support for the Maxim 6650/6651 | 22 | This driver implements support for the Maxim MAX6650 and MAX6651. |
19 | 23 | ||
20 | The 2 devices are very similar, but the Maxim 6550 has a reduced feature | 24 | The 2 devices are very similar, but the MAX6550 has a reduced feature |
21 | set, e.g. only one fan-input, instead of 4 for the 6651. | 25 | set, e.g. only one fan-input, instead of 4 for the MAX6651. |
22 | 26 | ||
23 | The driver is not able to distinguish between the 2 devices. | 27 | The driver is not able to distinguish between the 2 devices. |
24 | 28 | ||
@@ -36,6 +40,13 @@ fan1_div rw sets the speed range the inputs can handle. Legal | |||
36 | values are 1, 2, 4, and 8. Use lower values for | 40 | values are 1, 2, 4, and 8. Use lower values for |
37 | faster fans. | 41 | faster fans. |
38 | 42 | ||
43 | Usage notes | ||
44 | ----------- | ||
45 | |||
46 | This driver does not auto-detect devices. You will have to instantiate the | ||
47 | devices explicitly. Please see Documentation/i2c/instantiating-devices for | ||
48 | details. | ||
49 | |||
39 | Module parameters | 50 | Module parameters |
40 | ----------------- | 51 | ----------------- |
41 | 52 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 59cd2f5a1122..a26c9ee7703d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -287,35 +287,35 @@ F: sound/pci/ad1889.* | |||
287 | 287 | ||
288 | AD525X ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER | 288 | AD525X ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER |
289 | M: Michael Hennerich <michael.hennerich@analog.com> | 289 | M: Michael Hennerich <michael.hennerich@analog.com> |
290 | L: device-driver-devel@blackfin.uclinux.org | 290 | L: device-drivers-devel@blackfin.uclinux.org |
291 | W: http://wiki.analog.com/AD5254 | 291 | W: http://wiki.analog.com/AD5254 |
292 | S: Supported | 292 | S: Supported |
293 | F: drivers/misc/ad525x_dpot.c | 293 | F: drivers/misc/ad525x_dpot.c |
294 | 294 | ||
295 | AD5398 CURRENT REGULATOR DRIVER (AD5398/AD5821) | 295 | AD5398 CURRENT REGULATOR DRIVER (AD5398/AD5821) |
296 | M: Michael Hennerich <michael.hennerich@analog.com> | 296 | M: Michael Hennerich <michael.hennerich@analog.com> |
297 | L: device-driver-devel@blackfin.uclinux.org | 297 | L: device-drivers-devel@blackfin.uclinux.org |
298 | W: http://wiki.analog.com/AD5398 | 298 | W: http://wiki.analog.com/AD5398 |
299 | S: Supported | 299 | S: Supported |
300 | F: drivers/regulator/ad5398.c | 300 | F: drivers/regulator/ad5398.c |
301 | 301 | ||
302 | AD714X CAPACITANCE TOUCH SENSOR DRIVER (AD7142/3/7/8/7A) | 302 | AD714X CAPACITANCE TOUCH SENSOR DRIVER (AD7142/3/7/8/7A) |
303 | M: Michael Hennerich <michael.hennerich@analog.com> | 303 | M: Michael Hennerich <michael.hennerich@analog.com> |
304 | L: device-driver-devel@blackfin.uclinux.org | 304 | L: device-drivers-devel@blackfin.uclinux.org |
305 | W: http://wiki.analog.com/AD7142 | 305 | W: http://wiki.analog.com/AD7142 |
306 | S: Supported | 306 | S: Supported |
307 | F: drivers/input/misc/ad714x.c | 307 | F: drivers/input/misc/ad714x.c |
308 | 308 | ||
309 | AD7877 TOUCHSCREEN DRIVER | 309 | AD7877 TOUCHSCREEN DRIVER |
310 | M: Michael Hennerich <michael.hennerich@analog.com> | 310 | M: Michael Hennerich <michael.hennerich@analog.com> |
311 | L: device-driver-devel@blackfin.uclinux.org | 311 | L: device-drivers-devel@blackfin.uclinux.org |
312 | W: http://wiki.analog.com/AD7877 | 312 | W: http://wiki.analog.com/AD7877 |
313 | S: Supported | 313 | S: Supported |
314 | F: drivers/input/touchscreen/ad7877.c | 314 | F: drivers/input/touchscreen/ad7877.c |
315 | 315 | ||
316 | AD7879 TOUCHSCREEN DRIVER (AD7879/AD7889) | 316 | AD7879 TOUCHSCREEN DRIVER (AD7879/AD7889) |
317 | M: Michael Hennerich <michael.hennerich@analog.com> | 317 | M: Michael Hennerich <michael.hennerich@analog.com> |
318 | L: device-driver-devel@blackfin.uclinux.org | 318 | L: device-drivers-devel@blackfin.uclinux.org |
319 | W: http://wiki.analog.com/AD7879 | 319 | W: http://wiki.analog.com/AD7879 |
320 | S: Supported | 320 | S: Supported |
321 | F: drivers/input/touchscreen/ad7879.c | 321 | F: drivers/input/touchscreen/ad7879.c |
@@ -341,7 +341,7 @@ F: drivers/net/wireless/adm8211.* | |||
341 | 341 | ||
342 | ADP5520 BACKLIGHT DRIVER WITH IO EXPANDER (ADP5520/ADP5501) | 342 | ADP5520 BACKLIGHT DRIVER WITH IO EXPANDER (ADP5520/ADP5501) |
343 | M: Michael Hennerich <michael.hennerich@analog.com> | 343 | M: Michael Hennerich <michael.hennerich@analog.com> |
344 | L: device-driver-devel@blackfin.uclinux.org | 344 | L: device-drivers-devel@blackfin.uclinux.org |
345 | W: http://wiki.analog.com/ADP5520 | 345 | W: http://wiki.analog.com/ADP5520 |
346 | S: Supported | 346 | S: Supported |
347 | F: drivers/mfd/adp5520.c | 347 | F: drivers/mfd/adp5520.c |
@@ -352,7 +352,7 @@ F: drivers/input/keyboard/adp5520-keys.c | |||
352 | 352 | ||
353 | ADP5588 QWERTY KEYPAD AND IO EXPANDER DRIVER (ADP5588/ADP5587) | 353 | ADP5588 QWERTY KEYPAD AND IO EXPANDER DRIVER (ADP5588/ADP5587) |
354 | M: Michael Hennerich <michael.hennerich@analog.com> | 354 | M: Michael Hennerich <michael.hennerich@analog.com> |
355 | L: device-driver-devel@blackfin.uclinux.org | 355 | L: device-drivers-devel@blackfin.uclinux.org |
356 | W: http://wiki.analog.com/ADP5588 | 356 | W: http://wiki.analog.com/ADP5588 |
357 | S: Supported | 357 | S: Supported |
358 | F: drivers/input/keyboard/adp5588-keys.c | 358 | F: drivers/input/keyboard/adp5588-keys.c |
@@ -360,7 +360,7 @@ F: drivers/gpio/adp5588-gpio.c | |||
360 | 360 | ||
361 | ADP8860 BACKLIGHT DRIVER (ADP8860/ADP8861/ADP8863) | 361 | ADP8860 BACKLIGHT DRIVER (ADP8860/ADP8861/ADP8863) |
362 | M: Michael Hennerich <michael.hennerich@analog.com> | 362 | M: Michael Hennerich <michael.hennerich@analog.com> |
363 | L: device-driver-devel@blackfin.uclinux.org | 363 | L: device-drivers-devel@blackfin.uclinux.org |
364 | W: http://wiki.analog.com/ADP8860 | 364 | W: http://wiki.analog.com/ADP8860 |
365 | S: Supported | 365 | S: Supported |
366 | F: drivers/video/backlight/adp8860_bl.c | 366 | F: drivers/video/backlight/adp8860_bl.c |
@@ -387,7 +387,7 @@ F: drivers/hwmon/adt7475.c | |||
387 | 387 | ||
388 | ADXL34X THREE-AXIS DIGITAL ACCELEROMETER DRIVER (ADXL345/ADXL346) | 388 | ADXL34X THREE-AXIS DIGITAL ACCELEROMETER DRIVER (ADXL345/ADXL346) |
389 | M: Michael Hennerich <michael.hennerich@analog.com> | 389 | M: Michael Hennerich <michael.hennerich@analog.com> |
390 | L: device-driver-devel@blackfin.uclinux.org | 390 | L: device-drivers-devel@blackfin.uclinux.org |
391 | W: http://wiki.analog.com/ADXL345 | 391 | W: http://wiki.analog.com/ADXL345 |
392 | S: Supported | 392 | S: Supported |
393 | F: drivers/input/misc/adxl34x.c | 393 | F: drivers/input/misc/adxl34x.c |
@@ -483,6 +483,13 @@ F: drivers/tty/serial/altera_jtaguart.c | |||
483 | F: include/linux/altera_uart.h | 483 | F: include/linux/altera_uart.h |
484 | F: include/linux/altera_jtaguart.h | 484 | F: include/linux/altera_jtaguart.h |
485 | 485 | ||
486 | AMD FAM15H PROCESSOR POWER MONITORING DRIVER | ||
487 | M: Andreas Herrmann <andreas.herrmann3@amd.com> | ||
488 | L: lm-sensors@lm-sensors.org | ||
489 | S: Maintained | ||
490 | F: Documentation/hwmon/fam15h_power | ||
491 | F: drivers/hwmon/fam15h_power.c | ||
492 | |||
486 | AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER | 493 | AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER |
487 | M: Thomas Dahlmann <dahlmann.thomas@arcor.de> | 494 | M: Thomas Dahlmann <dahlmann.thomas@arcor.de> |
488 | L: linux-geode@lists.infradead.org (moderated for non-subscribers) | 495 | L: linux-geode@lists.infradead.org (moderated for non-subscribers) |
@@ -526,7 +533,7 @@ S: Maintained | |||
526 | F: drivers/infiniband/hw/amso1100/ | 533 | F: drivers/infiniband/hw/amso1100/ |
527 | 534 | ||
528 | ANALOG DEVICES INC ASOC CODEC DRIVERS | 535 | ANALOG DEVICES INC ASOC CODEC DRIVERS |
529 | L: device-driver-devel@blackfin.uclinux.org | 536 | L: device-drivers-devel@blackfin.uclinux.org |
530 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 537 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
531 | W: http://wiki.analog.com/ | 538 | W: http://wiki.analog.com/ |
532 | S: Supported | 539 | S: Supported |
@@ -220,6 +220,14 @@ ifeq ($(ARCH),sh64) | |||
220 | SRCARCH := sh | 220 | SRCARCH := sh |
221 | endif | 221 | endif |
222 | 222 | ||
223 | # Additional ARCH settings for tile | ||
224 | ifeq ($(ARCH),tilepro) | ||
225 | SRCARCH := tile | ||
226 | endif | ||
227 | ifeq ($(ARCH),tilegx) | ||
228 | SRCARCH := tile | ||
229 | endif | ||
230 | |||
223 | # Where to locate arch specific headers | 231 | # Where to locate arch specific headers |
224 | hdr-arch := $(SRCARCH) | 232 | hdr-arch := $(SRCARCH) |
225 | 233 | ||
@@ -1009,7 +1017,8 @@ include/generated/utsrelease.h: include/config/kernel.release FORCE | |||
1009 | 1017 | ||
1010 | PHONY += headerdep | 1018 | PHONY += headerdep |
1011 | headerdep: | 1019 | headerdep: |
1012 | $(Q)find include/ -name '*.h' | xargs --max-args 1 scripts/headerdep.pl | 1020 | $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \ |
1021 | $(srctree)/scripts/headerdep.pl -I$(srctree)/include | ||
1013 | 1022 | ||
1014 | # --------------------------------------------------------------------------- | 1023 | # --------------------------------------------------------------------------- |
1015 | 1024 | ||
@@ -1417,13 +1426,15 @@ tags TAGS cscope gtags: FORCE | |||
1417 | # Scripts to check various things for consistency | 1426 | # Scripts to check various things for consistency |
1418 | # --------------------------------------------------------------------------- | 1427 | # --------------------------------------------------------------------------- |
1419 | 1428 | ||
1429 | PHONY += includecheck versioncheck coccicheck namespacecheck export_report | ||
1430 | |||
1420 | includecheck: | 1431 | includecheck: |
1421 | find * $(RCS_FIND_IGNORE) \ | 1432 | find $(srctree)/* $(RCS_FIND_IGNORE) \ |
1422 | -name '*.[hcS]' -type f -print | sort \ | 1433 | -name '*.[hcS]' -type f -print | sort \ |
1423 | | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl | 1434 | | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl |
1424 | 1435 | ||
1425 | versioncheck: | 1436 | versioncheck: |
1426 | find * $(RCS_FIND_IGNORE) \ | 1437 | find $(srctree)/* $(RCS_FIND_IGNORE) \ |
1427 | -name '*.[hcS]' -type f -print | sort \ | 1438 | -name '*.[hcS]' -type f -print | sort \ |
1428 | | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl | 1439 | | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl |
1429 | 1440 | ||
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index e2507f66f9d5..612b27000c3e 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile | |||
@@ -30,6 +30,11 @@ obj-$(CONFIG_ARCH_SH7377) += entry-intc.o | |||
30 | obj-$(CONFIG_ARCH_SH7372) += entry-intc.o | 30 | obj-$(CONFIG_ARCH_SH7372) += entry-intc.o |
31 | obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o | 31 | obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o |
32 | 32 | ||
33 | # PM objects | ||
34 | obj-$(CONFIG_SUSPEND) += suspend.o | ||
35 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | ||
36 | obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o | ||
37 | |||
33 | # Board objects | 38 | # Board objects |
34 | obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o | 39 | obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o |
35 | obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o | 40 | obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o |
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index 3e6f0aab460b..c95258c274c1 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <linux/input/sh_keysc.h> | 34 | #include <linux/input/sh_keysc.h> |
35 | #include <linux/mmc/host.h> | 35 | #include <linux/mmc/host.h> |
36 | #include <linux/mmc/sh_mmcif.h> | 36 | #include <linux/mmc/sh_mmcif.h> |
37 | #include <linux/mmc/sh_mobile_sdhi.h> | ||
38 | #include <linux/mfd/tmio.h> | ||
37 | #include <linux/sh_clk.h> | 39 | #include <linux/sh_clk.h> |
38 | #include <video/sh_mobile_lcdc.h> | 40 | #include <video/sh_mobile_lcdc.h> |
39 | #include <video/sh_mipi_dsi.h> | 41 | #include <video/sh_mipi_dsi.h> |
@@ -156,10 +158,19 @@ static struct resource sh_mmcif_resources[] = { | |||
156 | }, | 158 | }, |
157 | }; | 159 | }; |
158 | 160 | ||
161 | static struct sh_mmcif_dma sh_mmcif_dma = { | ||
162 | .chan_priv_rx = { | ||
163 | .slave_id = SHDMA_SLAVE_MMCIF_RX, | ||
164 | }, | ||
165 | .chan_priv_tx = { | ||
166 | .slave_id = SHDMA_SLAVE_MMCIF_TX, | ||
167 | }, | ||
168 | }; | ||
159 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { | 169 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { |
160 | .sup_pclk = 0, | 170 | .sup_pclk = 0, |
161 | .ocr = MMC_VDD_165_195, | 171 | .ocr = MMC_VDD_165_195, |
162 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, | 172 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, |
173 | .dma = &sh_mmcif_dma, | ||
163 | }; | 174 | }; |
164 | 175 | ||
165 | static struct platform_device mmc_device = { | 176 | static struct platform_device mmc_device = { |
@@ -296,11 +307,13 @@ static struct platform_device lcdc0_device = { | |||
296 | /* MIPI-DSI */ | 307 | /* MIPI-DSI */ |
297 | static struct resource mipidsi0_resources[] = { | 308 | static struct resource mipidsi0_resources[] = { |
298 | [0] = { | 309 | [0] = { |
310 | .name = "DSI0", | ||
299 | .start = 0xfeab0000, | 311 | .start = 0xfeab0000, |
300 | .end = 0xfeab3fff, | 312 | .end = 0xfeab3fff, |
301 | .flags = IORESOURCE_MEM, | 313 | .flags = IORESOURCE_MEM, |
302 | }, | 314 | }, |
303 | [1] = { | 315 | [1] = { |
316 | .name = "DSI0", | ||
304 | .start = 0xfeab4000, | 317 | .start = 0xfeab4000, |
305 | .end = 0xfeab7fff, | 318 | .end = 0xfeab7fff, |
306 | .flags = IORESOURCE_MEM, | 319 | .flags = IORESOURCE_MEM, |
@@ -325,6 +338,89 @@ static struct platform_device mipidsi0_device = { | |||
325 | }, | 338 | }, |
326 | }; | 339 | }; |
327 | 340 | ||
341 | static struct sh_mobile_sdhi_info sdhi0_info = { | ||
342 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, | ||
343 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, | ||
344 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, | ||
345 | .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, | ||
346 | }; | ||
347 | |||
348 | static struct resource sdhi0_resources[] = { | ||
349 | [0] = { | ||
350 | .name = "SDHI0", | ||
351 | .start = 0xee100000, | ||
352 | .end = 0xee1000ff, | ||
353 | .flags = IORESOURCE_MEM, | ||
354 | }, | ||
355 | [1] = { | ||
356 | .start = gic_spi(83), | ||
357 | .flags = IORESOURCE_IRQ, | ||
358 | }, | ||
359 | [2] = { | ||
360 | .start = gic_spi(84), | ||
361 | .flags = IORESOURCE_IRQ, | ||
362 | }, | ||
363 | [3] = { | ||
364 | .start = gic_spi(85), | ||
365 | .flags = IORESOURCE_IRQ, | ||
366 | }, | ||
367 | }; | ||
368 | |||
369 | static struct platform_device sdhi0_device = { | ||
370 | .name = "sh_mobile_sdhi", | ||
371 | .id = 0, | ||
372 | .num_resources = ARRAY_SIZE(sdhi0_resources), | ||
373 | .resource = sdhi0_resources, | ||
374 | .dev = { | ||
375 | .platform_data = &sdhi0_info, | ||
376 | }, | ||
377 | }; | ||
378 | |||
379 | void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state) | ||
380 | { | ||
381 | gpio_set_value(GPIO_PORT114, state); | ||
382 | } | ||
383 | |||
384 | static struct sh_mobile_sdhi_info sh_sdhi1_platdata = { | ||
385 | .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, | ||
386 | .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, | ||
387 | .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, | ||
388 | .tmio_caps = MMC_CAP_NONREMOVABLE, | ||
389 | .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
390 | .set_pwr = ag5evm_sdhi1_set_pwr, | ||
391 | }; | ||
392 | |||
393 | static struct resource sdhi1_resources[] = { | ||
394 | [0] = { | ||
395 | .name = "SDHI1", | ||
396 | .start = 0xee120000, | ||
397 | .end = 0xee1200ff, | ||
398 | .flags = IORESOURCE_MEM, | ||
399 | }, | ||
400 | [1] = { | ||
401 | .start = gic_spi(87), | ||
402 | .flags = IORESOURCE_IRQ, | ||
403 | }, | ||
404 | [2] = { | ||
405 | .start = gic_spi(88), | ||
406 | .flags = IORESOURCE_IRQ, | ||
407 | }, | ||
408 | [3] = { | ||
409 | .start = gic_spi(89), | ||
410 | .flags = IORESOURCE_IRQ, | ||
411 | }, | ||
412 | }; | ||
413 | |||
414 | static struct platform_device sdhi1_device = { | ||
415 | .name = "sh_mobile_sdhi", | ||
416 | .id = 1, | ||
417 | .dev = { | ||
418 | .platform_data = &sh_sdhi1_platdata, | ||
419 | }, | ||
420 | .num_resources = ARRAY_SIZE(sdhi1_resources), | ||
421 | .resource = sdhi1_resources, | ||
422 | }; | ||
423 | |||
328 | static struct platform_device *ag5evm_devices[] __initdata = { | 424 | static struct platform_device *ag5evm_devices[] __initdata = { |
329 | ð_device, | 425 | ð_device, |
330 | &keysc_device, | 426 | &keysc_device, |
@@ -333,6 +429,8 @@ static struct platform_device *ag5evm_devices[] __initdata = { | |||
333 | &irda_device, | 429 | &irda_device, |
334 | &lcdc0_device, | 430 | &lcdc0_device, |
335 | &mipidsi0_device, | 431 | &mipidsi0_device, |
432 | &sdhi0_device, | ||
433 | &sdhi1_device, | ||
336 | }; | 434 | }; |
337 | 435 | ||
338 | static struct map_desc ag5evm_io_desc[] __initdata = { | 436 | static struct map_desc ag5evm_io_desc[] __initdata = { |
@@ -454,6 +552,26 @@ static void __init ag5evm_init(void) | |||
454 | /* MIPI-DSI clock setup */ | 552 | /* MIPI-DSI clock setup */ |
455 | __raw_writel(0x2a809010, DSI0PHYCR); | 553 | __raw_writel(0x2a809010, DSI0PHYCR); |
456 | 554 | ||
555 | /* enable SDHI0 on CN15 [SD I/F] */ | ||
556 | gpio_request(GPIO_FN_SDHICD0, NULL); | ||
557 | gpio_request(GPIO_FN_SDHIWP0, NULL); | ||
558 | gpio_request(GPIO_FN_SDHICMD0, NULL); | ||
559 | gpio_request(GPIO_FN_SDHICLK0, NULL); | ||
560 | gpio_request(GPIO_FN_SDHID0_3, NULL); | ||
561 | gpio_request(GPIO_FN_SDHID0_2, NULL); | ||
562 | gpio_request(GPIO_FN_SDHID0_1, NULL); | ||
563 | gpio_request(GPIO_FN_SDHID0_0, NULL); | ||
564 | |||
565 | /* enable SDHI1 on CN4 [WLAN I/F] */ | ||
566 | gpio_request(GPIO_FN_SDHICLK1, NULL); | ||
567 | gpio_request(GPIO_FN_SDHICMD1_PU, NULL); | ||
568 | gpio_request(GPIO_FN_SDHID1_3_PU, NULL); | ||
569 | gpio_request(GPIO_FN_SDHID1_2_PU, NULL); | ||
570 | gpio_request(GPIO_FN_SDHID1_1_PU, NULL); | ||
571 | gpio_request(GPIO_FN_SDHID1_0_PU, NULL); | ||
572 | gpio_request(GPIO_PORT114, "sdhi1_power"); | ||
573 | gpio_direction_output(GPIO_PORT114, 0); | ||
574 | |||
457 | #ifdef CONFIG_CACHE_L2X0 | 575 | #ifdef CONFIG_CACHE_L2X0 |
458 | /* Shared attribute override enable, 64K*8way */ | 576 | /* Shared attribute override enable, 64K*8way */ |
459 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); | 577 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); |
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 1e35fa976d64..08acb6ec8139 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -316,8 +316,16 @@ static struct resource sdhi0_resources[] = { | |||
316 | .flags = IORESOURCE_MEM, | 316 | .flags = IORESOURCE_MEM, |
317 | }, | 317 | }, |
318 | [1] = { | 318 | [1] = { |
319 | .start = evt2irq(0x0e00) /* SDHI0 */, | 319 | .start = evt2irq(0x0e00) /* SDHI0_SDHI0I0 */, |
320 | .flags = IORESOURCE_IRQ, | 320 | .flags = IORESOURCE_IRQ, |
321 | }, | ||
322 | [2] = { | ||
323 | .start = evt2irq(0x0e20) /* SDHI0_SDHI0I1 */, | ||
324 | .flags = IORESOURCE_IRQ, | ||
325 | }, | ||
326 | [3] = { | ||
327 | .start = evt2irq(0x0e40) /* SDHI0_SDHI0I2 */, | ||
328 | .flags = IORESOURCE_IRQ, | ||
321 | }, | 329 | }, |
322 | }; | 330 | }; |
323 | 331 | ||
@@ -349,8 +357,16 @@ static struct resource sdhi1_resources[] = { | |||
349 | .flags = IORESOURCE_MEM, | 357 | .flags = IORESOURCE_MEM, |
350 | }, | 358 | }, |
351 | [1] = { | 359 | [1] = { |
352 | .start = evt2irq(0x0e80), | 360 | .start = evt2irq(0x0e80), /* SDHI1_SDHI1I0 */ |
353 | .flags = IORESOURCE_IRQ, | 361 | .flags = IORESOURCE_IRQ, |
362 | }, | ||
363 | [2] = { | ||
364 | .start = evt2irq(0x0ea0), /* SDHI1_SDHI1I1 */ | ||
365 | .flags = IORESOURCE_IRQ, | ||
366 | }, | ||
367 | [3] = { | ||
368 | .start = evt2irq(0x0ec0), /* SDHI1_SDHI1I2 */ | ||
369 | .flags = IORESOURCE_IRQ, | ||
354 | }, | 370 | }, |
355 | }; | 371 | }; |
356 | 372 | ||
@@ -980,11 +996,6 @@ static void __init hdmi_init_pm_clock(void) | |||
980 | goto out; | 996 | goto out; |
981 | } | 997 | } |
982 | 998 | ||
983 | ret = clk_enable(&sh7372_pllc2_clk); | ||
984 | if (ret < 0) { | ||
985 | pr_err("Cannot enable pllc2 clock\n"); | ||
986 | goto out; | ||
987 | } | ||
988 | pr_debug("PLLC2 set frequency %lu\n", rate); | 999 | pr_debug("PLLC2 set frequency %lu\n", rate); |
989 | 1000 | ||
990 | ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); | 1001 | ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); |
@@ -1343,6 +1354,7 @@ static void __init ap4evb_init(void) | |||
1343 | 1354 | ||
1344 | hdmi_init_pm_clock(); | 1355 | hdmi_init_pm_clock(); |
1345 | fsi_init_pm_clock(); | 1356 | fsi_init_pm_clock(); |
1357 | sh7372_pm_init(); | ||
1346 | } | 1358 | } |
1347 | 1359 | ||
1348 | static void __init ap4evb_timer_init(void) | 1360 | static void __init ap4evb_timer_init(void) |
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c index c87a7b7c5832..8e3c5559f27f 100644 --- a/arch/arm/mach-shmobile/board-g4evm.c +++ b/arch/arm/mach-shmobile/board-g4evm.c | |||
@@ -205,7 +205,7 @@ static struct resource sdhi0_resources[] = { | |||
205 | [0] = { | 205 | [0] = { |
206 | .name = "SDHI0", | 206 | .name = "SDHI0", |
207 | .start = 0xe6d50000, | 207 | .start = 0xe6d50000, |
208 | .end = 0xe6d50nff, | 208 | .end = 0xe6d500ff, |
209 | .flags = IORESOURCE_MEM, | 209 | .flags = IORESOURCE_MEM, |
210 | }, | 210 | }, |
211 | [1] = { | 211 | [1] = { |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 7da2ca24229d..448ddbe43335 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/sh_intc.h> | 43 | #include <linux/sh_intc.h> |
44 | #include <linux/tca6416_keypad.h> | 44 | #include <linux/tca6416_keypad.h> |
45 | #include <linux/usb/r8a66597.h> | 45 | #include <linux/usb/r8a66597.h> |
46 | #include <linux/usb/renesas_usbhs.h> | ||
46 | 47 | ||
47 | #include <video/sh_mobile_hdmi.h> | 48 | #include <video/sh_mobile_hdmi.h> |
48 | #include <video/sh_mobile_lcdc.h> | 49 | #include <video/sh_mobile_lcdc.h> |
@@ -143,7 +144,30 @@ | |||
143 | * open | external VBUS | Function | 144 | * open | external VBUS | Function |
144 | * | 145 | * |
145 | * *1 | 146 | * *1 |
146 | * CN31 is used as Host in Linux. | 147 | * CN31 is used as |
148 | * CONFIG_USB_R8A66597_HCD Host | ||
149 | * CONFIG_USB_RENESAS_USBHS Function | ||
150 | * | ||
151 | * CAUTION | ||
152 | * | ||
153 | * renesas_usbhs driver can use external interrupt mode | ||
154 | * (which come from USB-PHY) or autonomy mode (it use own interrupt) | ||
155 | * for detecting connection/disconnection when Function. | ||
156 | * USB will be power OFF while it has been disconnecting | ||
157 | * if external interrupt mode, and it is always power ON if autonomy mode, | ||
158 | * | ||
159 | * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0", | ||
160 | * because Touchscreen is using IRQ7-PORT40. | ||
161 | * It is impossible to use IRQ7 demux on this board. | ||
162 | * | ||
163 | * We can use external interrupt mode USB-Function on "USB1". | ||
164 | * USB1 can become Host by r8a66597, and become Function by renesas_usbhs. | ||
165 | * But don't select both drivers in same time. | ||
166 | * These uses same IRQ number for request_irq(), and aren't supporting | ||
167 | * IRQF_SHARD / IORESOURCE_IRQ_SHAREABLE. | ||
168 | * | ||
169 | * Actually these are old/new version of USB driver. | ||
170 | * This mean its register will be broken if it supports SHARD IRQ, | ||
147 | */ | 171 | */ |
148 | 172 | ||
149 | /* | 173 | /* |
@@ -185,6 +209,7 @@ | |||
185 | * FIXME !! | 209 | * FIXME !! |
186 | * | 210 | * |
187 | * gpio_no_direction | 211 | * gpio_no_direction |
212 | * gpio_pull_down | ||
188 | * are quick_hack. | 213 | * are quick_hack. |
189 | * | 214 | * |
190 | * current gpio frame work doesn't have | 215 | * current gpio frame work doesn't have |
@@ -196,6 +221,16 @@ static void __init gpio_no_direction(u32 addr) | |||
196 | __raw_writeb(0x00, addr); | 221 | __raw_writeb(0x00, addr); |
197 | } | 222 | } |
198 | 223 | ||
224 | static void __init gpio_pull_down(u32 addr) | ||
225 | { | ||
226 | u8 data = __raw_readb(addr); | ||
227 | |||
228 | data &= 0x0F; | ||
229 | data |= 0xA0; | ||
230 | |||
231 | __raw_writeb(data, addr); | ||
232 | } | ||
233 | |||
199 | /* MTD */ | 234 | /* MTD */ |
200 | static struct mtd_partition nor_flash_partitions[] = { | 235 | static struct mtd_partition nor_flash_partitions[] = { |
201 | { | 236 | { |
@@ -458,12 +493,6 @@ static void __init hdmi_init_pm_clock(void) | |||
458 | goto out; | 493 | goto out; |
459 | } | 494 | } |
460 | 495 | ||
461 | ret = clk_enable(&sh7372_pllc2_clk); | ||
462 | if (ret < 0) { | ||
463 | pr_err("Cannot enable pllc2 clock\n"); | ||
464 | goto out; | ||
465 | } | ||
466 | |||
467 | pr_debug("PLLC2 set frequency %lu\n", rate); | 496 | pr_debug("PLLC2 set frequency %lu\n", rate); |
468 | 497 | ||
469 | ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); | 498 | ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); |
@@ -515,6 +544,157 @@ static struct platform_device usb1_host_device = { | |||
515 | .resource = usb1_host_resources, | 544 | .resource = usb1_host_resources, |
516 | }; | 545 | }; |
517 | 546 | ||
547 | /* USB1 (Function) */ | ||
548 | #define USB_PHY_MODE (1 << 4) | ||
549 | #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) | ||
550 | #define USB_PHY_ON (1 << 1) | ||
551 | #define USB_PHY_OFF (1 << 0) | ||
552 | #define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF) | ||
553 | |||
554 | struct usbhs_private { | ||
555 | unsigned int irq; | ||
556 | unsigned int usbphyaddr; | ||
557 | unsigned int usbcrcaddr; | ||
558 | struct renesas_usbhs_platform_info info; | ||
559 | }; | ||
560 | |||
561 | #define usbhs_get_priv(pdev) \ | ||
562 | container_of(renesas_usbhs_get_info(pdev), \ | ||
563 | struct usbhs_private, info) | ||
564 | |||
565 | #define usbhs_is_connected(priv) \ | ||
566 | (!((1 << 7) & __raw_readw(priv->usbcrcaddr))) | ||
567 | |||
568 | static int usbhs1_get_id(struct platform_device *pdev) | ||
569 | { | ||
570 | return USBHS_GADGET; | ||
571 | } | ||
572 | |||
573 | static int usbhs1_get_vbus(struct platform_device *pdev) | ||
574 | { | ||
575 | return usbhs_is_connected(usbhs_get_priv(pdev)); | ||
576 | } | ||
577 | |||
578 | static irqreturn_t usbhs1_interrupt(int irq, void *data) | ||
579 | { | ||
580 | struct platform_device *pdev = data; | ||
581 | struct usbhs_private *priv = usbhs_get_priv(pdev); | ||
582 | |||
583 | dev_dbg(&pdev->dev, "%s\n", __func__); | ||
584 | |||
585 | renesas_usbhs_call_notify_hotplug(pdev); | ||
586 | |||
587 | /* clear status */ | ||
588 | __raw_writew(__raw_readw(priv->usbphyaddr) | USB_PHY_INT_CLR, | ||
589 | priv->usbphyaddr); | ||
590 | |||
591 | return IRQ_HANDLED; | ||
592 | } | ||
593 | |||
594 | static int usbhs1_hardware_init(struct platform_device *pdev) | ||
595 | { | ||
596 | struct usbhs_private *priv = usbhs_get_priv(pdev); | ||
597 | int ret; | ||
598 | |||
599 | irq_set_irq_type(priv->irq, IRQ_TYPE_LEVEL_HIGH); | ||
600 | |||
601 | /* clear interrupt status */ | ||
602 | __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->usbphyaddr); | ||
603 | |||
604 | ret = request_irq(priv->irq, usbhs1_interrupt, 0, | ||
605 | dev_name(&pdev->dev), pdev); | ||
606 | if (ret) { | ||
607 | dev_err(&pdev->dev, "request_irq err\n"); | ||
608 | return ret; | ||
609 | } | ||
610 | |||
611 | /* enable USB phy interrupt */ | ||
612 | __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->usbphyaddr); | ||
613 | |||
614 | return 0; | ||
615 | } | ||
616 | |||
617 | static void usbhs1_hardware_exit(struct platform_device *pdev) | ||
618 | { | ||
619 | struct usbhs_private *priv = usbhs_get_priv(pdev); | ||
620 | |||
621 | /* clear interrupt status */ | ||
622 | __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->usbphyaddr); | ||
623 | |||
624 | free_irq(priv->irq, pdev); | ||
625 | } | ||
626 | |||
627 | static void usbhs1_phy_reset(struct platform_device *pdev) | ||
628 | { | ||
629 | struct usbhs_private *priv = usbhs_get_priv(pdev); | ||
630 | |||
631 | /* init phy */ | ||
632 | __raw_writew(0x8a0a, priv->usbcrcaddr); | ||
633 | } | ||
634 | |||
635 | static u32 usbhs1_pipe_cfg[] = { | ||
636 | USB_ENDPOINT_XFER_CONTROL, | ||
637 | USB_ENDPOINT_XFER_ISOC, | ||
638 | USB_ENDPOINT_XFER_ISOC, | ||
639 | USB_ENDPOINT_XFER_BULK, | ||
640 | USB_ENDPOINT_XFER_BULK, | ||
641 | USB_ENDPOINT_XFER_BULK, | ||
642 | USB_ENDPOINT_XFER_INT, | ||
643 | USB_ENDPOINT_XFER_INT, | ||
644 | USB_ENDPOINT_XFER_INT, | ||
645 | USB_ENDPOINT_XFER_BULK, | ||
646 | USB_ENDPOINT_XFER_BULK, | ||
647 | USB_ENDPOINT_XFER_BULK, | ||
648 | USB_ENDPOINT_XFER_BULK, | ||
649 | USB_ENDPOINT_XFER_BULK, | ||
650 | USB_ENDPOINT_XFER_BULK, | ||
651 | USB_ENDPOINT_XFER_BULK, | ||
652 | }; | ||
653 | |||
654 | static struct usbhs_private usbhs1_private = { | ||
655 | .irq = evt2irq(0x0300), /* IRQ8 */ | ||
656 | .usbphyaddr = 0xE60581E2, /* USBPHY1INTAP */ | ||
657 | .usbcrcaddr = 0xE6058130, /* USBCR4 */ | ||
658 | .info = { | ||
659 | .platform_callback = { | ||
660 | .hardware_init = usbhs1_hardware_init, | ||
661 | .hardware_exit = usbhs1_hardware_exit, | ||
662 | .phy_reset = usbhs1_phy_reset, | ||
663 | .get_id = usbhs1_get_id, | ||
664 | .get_vbus = usbhs1_get_vbus, | ||
665 | }, | ||
666 | .driver_param = { | ||
667 | .buswait_bwait = 4, | ||
668 | .pipe_type = usbhs1_pipe_cfg, | ||
669 | .pipe_size = ARRAY_SIZE(usbhs1_pipe_cfg), | ||
670 | }, | ||
671 | }, | ||
672 | }; | ||
673 | |||
674 | static struct resource usbhs1_resources[] = { | ||
675 | [0] = { | ||
676 | .name = "USBHS", | ||
677 | .start = 0xE68B0000, | ||
678 | .end = 0xE68B00E6 - 1, | ||
679 | .flags = IORESOURCE_MEM, | ||
680 | }, | ||
681 | [1] = { | ||
682 | .start = evt2irq(0x1ce0) /* USB1_USB1I0 */, | ||
683 | .flags = IORESOURCE_IRQ, | ||
684 | }, | ||
685 | }; | ||
686 | |||
687 | static struct platform_device usbhs1_device = { | ||
688 | .name = "renesas_usbhs", | ||
689 | .id = 1, | ||
690 | .dev = { | ||
691 | .platform_data = &usbhs1_private.info, | ||
692 | }, | ||
693 | .num_resources = ARRAY_SIZE(usbhs1_resources), | ||
694 | .resource = usbhs1_resources, | ||
695 | }; | ||
696 | |||
697 | |||
518 | /* LED */ | 698 | /* LED */ |
519 | static struct gpio_led mackerel_leds[] = { | 699 | static struct gpio_led mackerel_leds[] = { |
520 | { | 700 | { |
@@ -690,7 +870,15 @@ static struct resource sdhi0_resources[] = { | |||
690 | .flags = IORESOURCE_MEM, | 870 | .flags = IORESOURCE_MEM, |
691 | }, | 871 | }, |
692 | [1] = { | 872 | [1] = { |
693 | .start = evt2irq(0x0e00) /* SDHI0 */, | 873 | .start = evt2irq(0x0e00) /* SDHI0_SDHI0I0 */, |
874 | .flags = IORESOURCE_IRQ, | ||
875 | }, | ||
876 | [2] = { | ||
877 | .start = evt2irq(0x0e20) /* SDHI0_SDHI0I1 */, | ||
878 | .flags = IORESOURCE_IRQ, | ||
879 | }, | ||
880 | [3] = { | ||
881 | .start = evt2irq(0x0e40) /* SDHI0_SDHI0I2 */, | ||
694 | .flags = IORESOURCE_IRQ, | 882 | .flags = IORESOURCE_IRQ, |
695 | }, | 883 | }, |
696 | }; | 884 | }; |
@@ -705,7 +893,7 @@ static struct platform_device sdhi0_device = { | |||
705 | }, | 893 | }, |
706 | }; | 894 | }; |
707 | 895 | ||
708 | #if !defined(CONFIG_MMC_SH_MMCIF) | 896 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) |
709 | /* SDHI1 */ | 897 | /* SDHI1 */ |
710 | static struct sh_mobile_sdhi_info sdhi1_info = { | 898 | static struct sh_mobile_sdhi_info sdhi1_info = { |
711 | .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, | 899 | .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, |
@@ -725,7 +913,15 @@ static struct resource sdhi1_resources[] = { | |||
725 | .flags = IORESOURCE_MEM, | 913 | .flags = IORESOURCE_MEM, |
726 | }, | 914 | }, |
727 | [1] = { | 915 | [1] = { |
728 | .start = evt2irq(0x0e80), | 916 | .start = evt2irq(0x0e80), /* SDHI1_SDHI1I0 */ |
917 | .flags = IORESOURCE_IRQ, | ||
918 | }, | ||
919 | [2] = { | ||
920 | .start = evt2irq(0x0ea0), /* SDHI1_SDHI1I1 */ | ||
921 | .flags = IORESOURCE_IRQ, | ||
922 | }, | ||
923 | [3] = { | ||
924 | .start = evt2irq(0x0ec0), /* SDHI1_SDHI1I2 */ | ||
729 | .flags = IORESOURCE_IRQ, | 925 | .flags = IORESOURCE_IRQ, |
730 | }, | 926 | }, |
731 | }; | 927 | }; |
@@ -768,7 +964,15 @@ static struct resource sdhi2_resources[] = { | |||
768 | .flags = IORESOURCE_MEM, | 964 | .flags = IORESOURCE_MEM, |
769 | }, | 965 | }, |
770 | [1] = { | 966 | [1] = { |
771 | .start = evt2irq(0x1200), | 967 | .start = evt2irq(0x1200), /* SDHI2_SDHI2I0 */ |
968 | .flags = IORESOURCE_IRQ, | ||
969 | }, | ||
970 | [2] = { | ||
971 | .start = evt2irq(0x1220), /* SDHI2_SDHI2I1 */ | ||
972 | .flags = IORESOURCE_IRQ, | ||
973 | }, | ||
974 | [3] = { | ||
975 | .start = evt2irq(0x1240), /* SDHI2_SDHI2I2 */ | ||
772 | .flags = IORESOURCE_IRQ, | 976 | .flags = IORESOURCE_IRQ, |
773 | }, | 977 | }, |
774 | }; | 978 | }; |
@@ -803,6 +1007,15 @@ static struct resource sh_mmcif_resources[] = { | |||
803 | }, | 1007 | }, |
804 | }; | 1008 | }; |
805 | 1009 | ||
1010 | static struct sh_mmcif_dma sh_mmcif_dma = { | ||
1011 | .chan_priv_rx = { | ||
1012 | .slave_id = SHDMA_SLAVE_MMCIF_RX, | ||
1013 | }, | ||
1014 | .chan_priv_tx = { | ||
1015 | .slave_id = SHDMA_SLAVE_MMCIF_TX, | ||
1016 | }, | ||
1017 | }; | ||
1018 | |||
806 | static struct sh_mmcif_plat_data sh_mmcif_plat = { | 1019 | static struct sh_mmcif_plat_data sh_mmcif_plat = { |
807 | .sup_pclk = 0, | 1020 | .sup_pclk = 0, |
808 | .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, | 1021 | .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, |
@@ -810,6 +1023,7 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = { | |||
810 | MMC_CAP_8_BIT_DATA | | 1023 | MMC_CAP_8_BIT_DATA | |
811 | MMC_CAP_NEEDS_POLL, | 1024 | MMC_CAP_NEEDS_POLL, |
812 | .get_cd = slot_cn7_get_cd, | 1025 | .get_cd = slot_cn7_get_cd, |
1026 | .dma = &sh_mmcif_dma, | ||
813 | }; | 1027 | }; |
814 | 1028 | ||
815 | static struct platform_device sh_mmcif_device = { | 1029 | static struct platform_device sh_mmcif_device = { |
@@ -858,37 +1072,23 @@ static struct soc_camera_link camera_link = { | |||
858 | .priv = &camera_info, | 1072 | .priv = &camera_info, |
859 | }; | 1073 | }; |
860 | 1074 | ||
861 | static void dummy_release(struct device *dev) | 1075 | static struct platform_device *camera_device; |
1076 | |||
1077 | static void mackerel_camera_release(struct device *dev) | ||
862 | { | 1078 | { |
1079 | soc_camera_platform_release(&camera_device); | ||
863 | } | 1080 | } |
864 | 1081 | ||
865 | static struct platform_device camera_device = { | ||
866 | .name = "soc_camera_platform", | ||
867 | .dev = { | ||
868 | .platform_data = &camera_info, | ||
869 | .release = dummy_release, | ||
870 | }, | ||
871 | }; | ||
872 | |||
873 | static int mackerel_camera_add(struct soc_camera_link *icl, | 1082 | static int mackerel_camera_add(struct soc_camera_link *icl, |
874 | struct device *dev) | 1083 | struct device *dev) |
875 | { | 1084 | { |
876 | if (icl != &camera_link) | 1085 | return soc_camera_platform_add(icl, dev, &camera_device, &camera_link, |
877 | return -ENODEV; | 1086 | mackerel_camera_release, 0); |
878 | |||
879 | camera_info.dev = dev; | ||
880 | |||
881 | return platform_device_register(&camera_device); | ||
882 | } | 1087 | } |
883 | 1088 | ||
884 | static void mackerel_camera_del(struct soc_camera_link *icl) | 1089 | static void mackerel_camera_del(struct soc_camera_link *icl) |
885 | { | 1090 | { |
886 | if (icl != &camera_link) | 1091 | soc_camera_platform_del(icl, camera_device, &camera_link); |
887 | return; | ||
888 | |||
889 | platform_device_unregister(&camera_device); | ||
890 | memset(&camera_device.dev.kobj, 0, | ||
891 | sizeof(camera_device.dev.kobj)); | ||
892 | } | 1092 | } |
893 | 1093 | ||
894 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { | 1094 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { |
@@ -935,12 +1135,13 @@ static struct platform_device *mackerel_devices[] __initdata = { | |||
935 | &smc911x_device, | 1135 | &smc911x_device, |
936 | &lcdc_device, | 1136 | &lcdc_device, |
937 | &usb1_host_device, | 1137 | &usb1_host_device, |
1138 | &usbhs1_device, | ||
938 | &leds_device, | 1139 | &leds_device, |
939 | &fsi_device, | 1140 | &fsi_device, |
940 | &fsi_ak4643_device, | 1141 | &fsi_ak4643_device, |
941 | &fsi_hdmi_device, | 1142 | &fsi_hdmi_device, |
942 | &sdhi0_device, | 1143 | &sdhi0_device, |
943 | #if !defined(CONFIG_MMC_SH_MMCIF) | 1144 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) |
944 | &sdhi1_device, | 1145 | &sdhi1_device, |
945 | #endif | 1146 | #endif |
946 | &sdhi2_device, | 1147 | &sdhi2_device, |
@@ -1030,6 +1231,7 @@ static void __init mackerel_map_io(void) | |||
1030 | 1231 | ||
1031 | #define GPIO_PORT9CR 0xE6051009 | 1232 | #define GPIO_PORT9CR 0xE6051009 |
1032 | #define GPIO_PORT10CR 0xE605100A | 1233 | #define GPIO_PORT10CR 0xE605100A |
1234 | #define GPIO_PORT168CR 0xE60520A8 | ||
1033 | #define SRCR4 0xe61580bc | 1235 | #define SRCR4 0xe61580bc |
1034 | #define USCCR1 0xE6058144 | 1236 | #define USCCR1 0xE6058144 |
1035 | static void __init mackerel_init(void) | 1237 | static void __init mackerel_init(void) |
@@ -1088,6 +1290,7 @@ static void __init mackerel_init(void) | |||
1088 | gpio_request(GPIO_FN_OVCN_1_114, NULL); | 1290 | gpio_request(GPIO_FN_OVCN_1_114, NULL); |
1089 | gpio_request(GPIO_FN_EXTLP_1, NULL); | 1291 | gpio_request(GPIO_FN_EXTLP_1, NULL); |
1090 | gpio_request(GPIO_FN_OVCN2_1, NULL); | 1292 | gpio_request(GPIO_FN_OVCN2_1, NULL); |
1293 | gpio_pull_down(GPIO_PORT168CR); | ||
1091 | 1294 | ||
1092 | /* setup USB phy */ | 1295 | /* setup USB phy */ |
1093 | __raw_writew(0x8a0a, 0xE6058130); /* USBCR4 */ | 1296 | __raw_writew(0x8a0a, 0xE6058130); /* USBCR4 */ |
@@ -1140,7 +1343,7 @@ static void __init mackerel_init(void) | |||
1140 | gpio_request(GPIO_FN_SDHID0_1, NULL); | 1343 | gpio_request(GPIO_FN_SDHID0_1, NULL); |
1141 | gpio_request(GPIO_FN_SDHID0_0, NULL); | 1344 | gpio_request(GPIO_FN_SDHID0_0, NULL); |
1142 | 1345 | ||
1143 | #if !defined(CONFIG_MMC_SH_MMCIF) | 1346 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) |
1144 | /* enable SDHI1 */ | 1347 | /* enable SDHI1 */ |
1145 | gpio_request(GPIO_FN_SDHICMD1, NULL); | 1348 | gpio_request(GPIO_FN_SDHICMD1, NULL); |
1146 | gpio_request(GPIO_FN_SDHICLK1, NULL); | 1349 | gpio_request(GPIO_FN_SDHICLK1, NULL); |
@@ -1216,6 +1419,7 @@ static void __init mackerel_init(void) | |||
1216 | platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices)); | 1419 | platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices)); |
1217 | 1420 | ||
1218 | hdmi_init_pm_clock(); | 1421 | hdmi_init_pm_clock(); |
1422 | sh7372_pm_init(); | ||
1219 | } | 1423 | } |
1220 | 1424 | ||
1221 | static void __init mackerel_timer_init(void) | 1425 | static void __init mackerel_timer_init(void) |
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c index e9731b5a73ed..d17eb66f4ac2 100644 --- a/arch/arm/mach-shmobile/clock-sh7372.c +++ b/arch/arm/mach-shmobile/clock-sh7372.c | |||
@@ -44,6 +44,11 @@ | |||
44 | #define DSI1PCKCR 0xe6150098 | 44 | #define DSI1PCKCR 0xe6150098 |
45 | #define PLLC01CR 0xe6150028 | 45 | #define PLLC01CR 0xe6150028 |
46 | #define PLLC2CR 0xe615002c | 46 | #define PLLC2CR 0xe615002c |
47 | #define RMSTPCR0 0xe6150110 | ||
48 | #define RMSTPCR1 0xe6150114 | ||
49 | #define RMSTPCR2 0xe6150118 | ||
50 | #define RMSTPCR3 0xe615011c | ||
51 | #define RMSTPCR4 0xe6150120 | ||
47 | #define SMSTPCR0 0xe6150130 | 52 | #define SMSTPCR0 0xe6150130 |
48 | #define SMSTPCR1 0xe6150134 | 53 | #define SMSTPCR1 0xe6150134 |
49 | #define SMSTPCR2 0xe6150138 | 54 | #define SMSTPCR2 0xe6150138 |
@@ -421,9 +426,6 @@ static unsigned long fsidiv_recalc(struct clk *clk) | |||
421 | 426 | ||
422 | value = __raw_readl(clk->mapping->base); | 427 | value = __raw_readl(clk->mapping->base); |
423 | 428 | ||
424 | if ((value & 0x3) != 0x3) | ||
425 | return 0; | ||
426 | |||
427 | value >>= 16; | 429 | value >>= 16; |
428 | if (value < 2) | 430 | if (value < 2) |
429 | return 0; | 431 | return 0; |
@@ -504,7 +506,7 @@ static struct clk *late_main_clks[] = { | |||
504 | enum { MSTP001, | 506 | enum { MSTP001, |
505 | MSTP131, MSTP130, | 507 | MSTP131, MSTP130, |
506 | MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, | 508 | MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, |
507 | MSTP118, MSTP117, MSTP116, | 509 | MSTP118, MSTP117, MSTP116, MSTP113, |
508 | MSTP106, MSTP101, MSTP100, | 510 | MSTP106, MSTP101, MSTP100, |
509 | MSTP223, | 511 | MSTP223, |
510 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 512 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
@@ -527,6 +529,7 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
527 | [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX */ | 529 | [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX */ |
528 | [MSTP117] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ | 530 | [MSTP117] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ |
529 | [MSTP116] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ | 531 | [MSTP116] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ |
532 | [MSTP113] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 13, 0), /* MERAM */ | ||
530 | [MSTP106] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 6, 0), /* JPU */ | 533 | [MSTP106] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 6, 0), /* JPU */ |
531 | [MSTP101] = MSTP(&div4_clks[DIV4_M1], SMSTPCR1, 1, 0), /* VPU */ | 534 | [MSTP101] = MSTP(&div4_clks[DIV4_M1], SMSTPCR1, 1, 0), /* VPU */ |
532 | [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ | 535 | [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ |
@@ -617,6 +620,7 @@ static struct clk_lookup lookups[] = { | |||
617 | CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX0 */ | 620 | CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX0 */ |
618 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */ | 621 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */ |
619 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */ | 622 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */ |
623 | CLKDEV_DEV_ID("sh_mobile_meram.0", &mstp_clks[MSTP113]), /* MERAM */ | ||
620 | CLKDEV_DEV_ID("uio_pdrv_genirq.5", &mstp_clks[MSTP106]), /* JPU */ | 624 | CLKDEV_DEV_ID("uio_pdrv_genirq.5", &mstp_clks[MSTP106]), /* JPU */ |
621 | CLKDEV_DEV_ID("uio_pdrv_genirq.0", &mstp_clks[MSTP101]), /* VPU */ | 625 | CLKDEV_DEV_ID("uio_pdrv_genirq.0", &mstp_clks[MSTP101]), /* VPU */ |
622 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ | 626 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ |
@@ -634,6 +638,7 @@ static struct clk_lookup lookups[] = { | |||
634 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */ | 638 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */ |
635 | CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USB0 */ | 639 | CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USB0 */ |
636 | CLKDEV_DEV_ID("r8a66597_udc.0", &mstp_clks[MSTP322]), /* USB0 */ | 640 | CLKDEV_DEV_ID("r8a66597_udc.0", &mstp_clks[MSTP322]), /* USB0 */ |
641 | CLKDEV_DEV_ID("renesas_usbhs.0", &mstp_clks[MSTP322]), /* USB0 */ | ||
637 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ | 642 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ |
638 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ | 643 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ |
639 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMC */ | 644 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMC */ |
@@ -644,6 +649,7 @@ static struct clk_lookup lookups[] = { | |||
644 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* IIC4 */ | 649 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* IIC4 */ |
645 | CLKDEV_DEV_ID("r8a66597_hcd.1", &mstp_clks[MSTP406]), /* USB1 */ | 650 | CLKDEV_DEV_ID("r8a66597_hcd.1", &mstp_clks[MSTP406]), /* USB1 */ |
646 | CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */ | 651 | CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */ |
652 | CLKDEV_DEV_ID("renesas_usbhs.1", &mstp_clks[MSTP406]), /* USB1 */ | ||
647 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ | 653 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ |
648 | 654 | ||
649 | CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]), | 655 | CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]), |
@@ -655,6 +661,13 @@ void __init sh7372_clock_init(void) | |||
655 | { | 661 | { |
656 | int k, ret = 0; | 662 | int k, ret = 0; |
657 | 663 | ||
664 | /* make sure MSTP bits on the RT/SH4AL-DSP side are off */ | ||
665 | __raw_writel(0xe4ef8087, RMSTPCR0); | ||
666 | __raw_writel(0xffffffff, RMSTPCR1); | ||
667 | __raw_writel(0x37c7f7ff, RMSTPCR2); | ||
668 | __raw_writel(0xffffffff, RMSTPCR3); | ||
669 | __raw_writel(0xffe0fffd, RMSTPCR4); | ||
670 | |||
658 | for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) | 671 | for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) |
659 | ret = clk_register(main_clks[k]); | 672 | ret = clk_register(main_clks[k]); |
660 | 673 | ||
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 7e58904c1c8c..bcacb1e8cf85 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -266,7 +266,8 @@ enum { MSTP001, | |||
266 | MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, | 266 | MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, |
267 | MSTP219, | 267 | MSTP219, |
268 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 268 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
269 | MSTP331, MSTP329, MSTP325, MSTP323, MSTP312, | 269 | MSTP331, MSTP329, MSTP325, MSTP323, MSTP318, |
270 | MSTP314, MSTP313, MSTP312, MSTP311, | ||
270 | MSTP411, MSTP410, MSTP403, | 271 | MSTP411, MSTP410, MSTP403, |
271 | MSTP_NR }; | 272 | MSTP_NR }; |
272 | 273 | ||
@@ -295,7 +296,11 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
295 | [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ | 296 | [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ |
296 | [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */ | 297 | [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */ |
297 | [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */ | 298 | [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */ |
299 | [MSTP318] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 18, 0), /* SY-DMAC */ | ||
300 | [MSTP314] = MSTP(&div6_clks[DIV6_SDHI0], SMSTPCR3, 14, 0), /* SDHI0 */ | ||
301 | [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */ | ||
298 | [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ | 302 | [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ |
303 | [MSTP311] = MSTP(&div6_clks[DIV6_SDHI2], SMSTPCR3, 11, 0), /* SDHI2 */ | ||
299 | [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */ | 304 | [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */ |
300 | [MSTP410] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 10, 0), /* IIC4 */ | 305 | [MSTP410] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 10, 0), /* IIC4 */ |
301 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ | 306 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ |
@@ -313,6 +318,9 @@ static struct clk_lookup lookups[] = { | |||
313 | CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]), | 318 | CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]), |
314 | CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]), | 319 | CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]), |
315 | CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]), | 320 | CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]), |
321 | CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]), | ||
322 | CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]), | ||
323 | CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]), | ||
316 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), | 324 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), |
317 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), | 325 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), |
318 | CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), | 326 | CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), |
@@ -341,7 +349,11 @@ static struct clk_lookup lookups[] = { | |||
341 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ | 349 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ |
342 | CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ | 350 | CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ |
343 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ | 351 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ |
352 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP318]), /* SY-DMAC */ | ||
353 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ | ||
354 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ | ||
344 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ | 355 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ |
356 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ | ||
345 | CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ | 357 | CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ |
346 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ | 358 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ |
347 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ | 359 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ |
@@ -351,6 +363,11 @@ void __init sh73a0_clock_init(void) | |||
351 | { | 363 | { |
352 | int k, ret = 0; | 364 | int k, ret = 0; |
353 | 365 | ||
366 | /* Set SDHI clocks to a known state */ | ||
367 | __raw_writel(0x108, SD0CKCR); | ||
368 | __raw_writel(0x108, SD1CKCR); | ||
369 | __raw_writel(0x108, SD2CKCR); | ||
370 | |||
354 | /* detect main clock parent */ | 371 | /* detect main clock parent */ |
355 | switch ((__raw_readl(CKSCR) >> 24) & 0x03) { | 372 | switch ((__raw_readl(CKSCR) >> 24) & 0x03) { |
356 | case 0: | 373 | case 0: |
diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c new file mode 100644 index 000000000000..2e44f11f592e --- /dev/null +++ b/arch/arm/mach-shmobile/cpuidle.c | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * CPUIdle support code for SH-Mobile ARM | ||
3 | * | ||
4 | * Copyright (C) 2011 Magnus Damm | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/pm.h> | ||
12 | #include <linux/cpuidle.h> | ||
13 | #include <linux/suspend.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <asm/system.h> | ||
17 | #include <asm/io.h> | ||
18 | |||
19 | static void shmobile_enter_wfi(void) | ||
20 | { | ||
21 | cpu_do_idle(); | ||
22 | } | ||
23 | |||
24 | void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void) = { | ||
25 | shmobile_enter_wfi, /* regular sleep mode */ | ||
26 | }; | ||
27 | |||
28 | static int shmobile_cpuidle_enter(struct cpuidle_device *dev, | ||
29 | struct cpuidle_state *state) | ||
30 | { | ||
31 | ktime_t before, after; | ||
32 | int requested_state = state - &dev->states[0]; | ||
33 | |||
34 | dev->last_state = &dev->states[requested_state]; | ||
35 | before = ktime_get(); | ||
36 | |||
37 | local_irq_disable(); | ||
38 | local_fiq_disable(); | ||
39 | |||
40 | shmobile_cpuidle_modes[requested_state](); | ||
41 | |||
42 | local_irq_enable(); | ||
43 | local_fiq_enable(); | ||
44 | |||
45 | after = ktime_get(); | ||
46 | return ktime_to_ns(ktime_sub(after, before)) >> 10; | ||
47 | } | ||
48 | |||
49 | static struct cpuidle_device shmobile_cpuidle_dev; | ||
50 | static struct cpuidle_driver shmobile_cpuidle_driver = { | ||
51 | .name = "shmobile_cpuidle", | ||
52 | .owner = THIS_MODULE, | ||
53 | }; | ||
54 | |||
55 | void (*shmobile_cpuidle_setup)(struct cpuidle_device *dev); | ||
56 | |||
57 | static int shmobile_cpuidle_init(void) | ||
58 | { | ||
59 | struct cpuidle_device *dev = &shmobile_cpuidle_dev; | ||
60 | struct cpuidle_state *state; | ||
61 | int i; | ||
62 | |||
63 | cpuidle_register_driver(&shmobile_cpuidle_driver); | ||
64 | |||
65 | for (i = 0; i < CPUIDLE_STATE_MAX; i++) { | ||
66 | dev->states[i].name[0] = '\0'; | ||
67 | dev->states[i].desc[0] = '\0'; | ||
68 | dev->states[i].enter = shmobile_cpuidle_enter; | ||
69 | } | ||
70 | |||
71 | i = CPUIDLE_DRIVER_STATE_START; | ||
72 | |||
73 | state = &dev->states[i++]; | ||
74 | snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); | ||
75 | strncpy(state->desc, "WFI", CPUIDLE_DESC_LEN); | ||
76 | state->exit_latency = 1; | ||
77 | state->target_residency = 1 * 2; | ||
78 | state->power_usage = 3; | ||
79 | state->flags = 0; | ||
80 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | ||
81 | |||
82 | dev->safe_state = state; | ||
83 | dev->state_count = i; | ||
84 | |||
85 | if (shmobile_cpuidle_setup) | ||
86 | shmobile_cpuidle_setup(dev); | ||
87 | |||
88 | cpuidle_register_device(dev); | ||
89 | |||
90 | return 0; | ||
91 | } | ||
92 | late_initcall(shmobile_cpuidle_init); | ||
diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S index d4cec6b4c7d9..26079d933d91 100644 --- a/arch/arm/mach-shmobile/headsmp.S +++ b/arch/arm/mach-shmobile/headsmp.S | |||
@@ -24,4 +24,4 @@ | |||
24 | .align 12 | 24 | .align 12 |
25 | ENTRY(shmobile_secondary_vector) | 25 | ENTRY(shmobile_secondary_vector) |
26 | ldr pc, 1f | 26 | ldr pc, 1f |
27 | 1: .long secondary_startup - PAGE_OFFSET + PHYS_OFFSET | 27 | 1: .long secondary_startup - PAGE_OFFSET + PLAT_PHYS_OFFSET |
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index 013ac0ee8256..06aecb31d9c7 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -8,6 +8,10 @@ struct clk; | |||
8 | extern int clk_init(void); | 8 | extern int clk_init(void); |
9 | extern void shmobile_handle_irq_intc(struct pt_regs *); | 9 | extern void shmobile_handle_irq_intc(struct pt_regs *); |
10 | extern void shmobile_handle_irq_gic(struct pt_regs *); | 10 | extern void shmobile_handle_irq_gic(struct pt_regs *); |
11 | extern struct platform_suspend_ops shmobile_suspend_ops; | ||
12 | struct cpuidle_device; | ||
13 | extern void (*shmobile_cpuidle_modes[])(void); | ||
14 | extern void (*shmobile_cpuidle_setup)(struct cpuidle_device *dev); | ||
11 | 15 | ||
12 | extern void sh7367_init_irq(void); | 16 | extern void sh7367_init_irq(void); |
13 | extern void sh7367_add_early_devices(void); | 17 | extern void sh7367_add_early_devices(void); |
@@ -30,6 +34,9 @@ extern void sh7372_add_early_devices(void); | |||
30 | extern void sh7372_add_standard_devices(void); | 34 | extern void sh7372_add_standard_devices(void); |
31 | extern void sh7372_clock_init(void); | 35 | extern void sh7372_clock_init(void); |
32 | extern void sh7372_pinmux_init(void); | 36 | extern void sh7372_pinmux_init(void); |
37 | extern void sh7372_pm_init(void); | ||
38 | extern void sh7372_cpu_suspend(void); | ||
39 | extern void sh7372_cpu_resume(void); | ||
33 | extern struct clk sh7372_extal1_clk; | 40 | extern struct clk sh7372_extal1_clk; |
34 | extern struct clk sh7372_extal2_clk; | 41 | extern struct clk sh7372_extal2_clk; |
35 | 42 | ||
diff --git a/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt b/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt index 3029aba38688..9f134dfeffdc 100644 --- a/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt +++ b/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt | |||
@@ -87,8 +87,7 @@ WAIT 1, 0xFE40009C | |||
87 | ED 0xFE400354, 0x01AD8002 | 87 | ED 0xFE400354, 0x01AD8002 |
88 | 88 | ||
89 | LIST "SCIF0 - Serial port for earlyprintk" | 89 | LIST "SCIF0 - Serial port for earlyprintk" |
90 | EB 0xE6053098, 0x11 | ||
91 | EB 0xE6053098, 0xe1 | 90 | EB 0xE6053098, 0xe1 |
92 | EW 0xE6C40000, 0x0000 | 91 | EW 0xE6C40000, 0x0000 |
93 | EB 0xE6C40004, 0x19 | 92 | EB 0xE6C40004, 0x19 |
94 | EW 0xE6C40008, 0x3000 | 93 | EW 0xE6C40008, 0x0030 |
diff --git a/arch/arm/mach-shmobile/include/mach/head-mackerel.txt b/arch/arm/mach-shmobile/include/mach/head-mackerel.txt index 3029aba38688..9f134dfeffdc 100644 --- a/arch/arm/mach-shmobile/include/mach/head-mackerel.txt +++ b/arch/arm/mach-shmobile/include/mach/head-mackerel.txt | |||
@@ -87,8 +87,7 @@ WAIT 1, 0xFE40009C | |||
87 | ED 0xFE400354, 0x01AD8002 | 87 | ED 0xFE400354, 0x01AD8002 |
88 | 88 | ||
89 | LIST "SCIF0 - Serial port for earlyprintk" | 89 | LIST "SCIF0 - Serial port for earlyprintk" |
90 | EB 0xE6053098, 0x11 | ||
91 | EB 0xE6053098, 0xe1 | 90 | EB 0xE6053098, 0xe1 |
92 | EW 0xE6C40000, 0x0000 | 91 | EW 0xE6C40000, 0x0000 |
93 | EB 0xE6C40004, 0x19 | 92 | EB 0xE6C40004, 0x19 |
94 | EW 0xE6C40008, 0x3000 | 93 | EW 0xE6C40008, 0x0030 |
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h index 5736efcca60c..df20d7670172 100644 --- a/arch/arm/mach-shmobile/include/mach/sh7372.h +++ b/arch/arm/mach-shmobile/include/mach/sh7372.h | |||
@@ -435,6 +435,7 @@ enum { | |||
435 | 435 | ||
436 | /* DMA slave IDs */ | 436 | /* DMA slave IDs */ |
437 | enum { | 437 | enum { |
438 | SHDMA_SLAVE_INVALID, | ||
438 | SHDMA_SLAVE_SCIF0_TX, | 439 | SHDMA_SLAVE_SCIF0_TX, |
439 | SHDMA_SLAVE_SCIF0_RX, | 440 | SHDMA_SLAVE_SCIF0_RX, |
440 | SHDMA_SLAVE_SCIF1_TX, | 441 | SHDMA_SLAVE_SCIF1_TX, |
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h index ceb2cdc92bf9..216c3d695ef1 100644 --- a/arch/arm/mach-shmobile/include/mach/sh73a0.h +++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h | |||
@@ -463,5 +463,35 @@ enum { | |||
463 | GPIO_FN_FSIAIBT_PU, | 463 | GPIO_FN_FSIAIBT_PU, |
464 | GPIO_FN_FSIAISLD_PU, | 464 | GPIO_FN_FSIAISLD_PU, |
465 | }; | 465 | }; |
466 | /* DMA slave IDs */ | ||
467 | enum { | ||
468 | SHDMA_SLAVE_INVALID, | ||
469 | SHDMA_SLAVE_SCIF0_TX, | ||
470 | SHDMA_SLAVE_SCIF0_RX, | ||
471 | SHDMA_SLAVE_SCIF1_TX, | ||
472 | SHDMA_SLAVE_SCIF1_RX, | ||
473 | SHDMA_SLAVE_SCIF2_TX, | ||
474 | SHDMA_SLAVE_SCIF2_RX, | ||
475 | SHDMA_SLAVE_SCIF3_TX, | ||
476 | SHDMA_SLAVE_SCIF3_RX, | ||
477 | SHDMA_SLAVE_SCIF4_TX, | ||
478 | SHDMA_SLAVE_SCIF4_RX, | ||
479 | SHDMA_SLAVE_SCIF5_TX, | ||
480 | SHDMA_SLAVE_SCIF5_RX, | ||
481 | SHDMA_SLAVE_SCIF6_TX, | ||
482 | SHDMA_SLAVE_SCIF6_RX, | ||
483 | SHDMA_SLAVE_SCIF7_TX, | ||
484 | SHDMA_SLAVE_SCIF7_RX, | ||
485 | SHDMA_SLAVE_SCIF8_TX, | ||
486 | SHDMA_SLAVE_SCIF8_RX, | ||
487 | SHDMA_SLAVE_SDHI0_TX, | ||
488 | SHDMA_SLAVE_SDHI0_RX, | ||
489 | SHDMA_SLAVE_SDHI1_TX, | ||
490 | SHDMA_SLAVE_SDHI1_RX, | ||
491 | SHDMA_SLAVE_SDHI2_TX, | ||
492 | SHDMA_SLAVE_SDHI2_RX, | ||
493 | SHDMA_SLAVE_MMCIF_TX, | ||
494 | SHDMA_SLAVE_MMCIF_RX, | ||
495 | }; | ||
466 | 496 | ||
467 | #endif /* __ASM_SH73A0_H__ */ | 497 | #endif /* __ASM_SH73A0_H__ */ |
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c index 7a4960f9c1e3..3b28743c77eb 100644 --- a/arch/arm/mach-shmobile/intc-sh7372.c +++ b/arch/arm/mach-shmobile/intc-sh7372.c | |||
@@ -27,8 +27,6 @@ | |||
27 | 27 | ||
28 | enum { | 28 | enum { |
29 | UNUSED_INTCA = 0, | 29 | UNUSED_INTCA = 0, |
30 | ENABLED, | ||
31 | DISABLED, | ||
32 | 30 | ||
33 | /* interrupt sources INTCA */ | 31 | /* interrupt sources INTCA */ |
34 | IRQ0A, IRQ1A, IRQ2A, IRQ3A, IRQ4A, IRQ5A, IRQ6A, IRQ7A, | 32 | IRQ0A, IRQ1A, IRQ2A, IRQ3A, IRQ4A, IRQ5A, IRQ6A, IRQ7A, |
@@ -49,14 +47,14 @@ enum { | |||
49 | MSIOF2, MSIOF1, | 47 | MSIOF2, MSIOF1, |
50 | SCIFA4, SCIFA5, SCIFB, | 48 | SCIFA4, SCIFA5, SCIFB, |
51 | FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I, | 49 | FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I, |
52 | SDHI0, | 50 | SDHI0_SDHI0I0, SDHI0_SDHI0I1, SDHI0_SDHI0I2, SDHI0_SDHI0I3, |
53 | SDHI1, | 51 | SDHI1_SDHI1I0, SDHI1_SDHI1I1, SDHI1_SDHI1I2, |
54 | IRREM, | 52 | IRREM, |
55 | IRDA, | 53 | IRDA, |
56 | TPU0, | 54 | TPU0, |
57 | TTI20, | 55 | TTI20, |
58 | DDM, | 56 | DDM, |
59 | SDHI2, | 57 | SDHI2_SDHI2I0, SDHI2_SDHI2I1, SDHI2_SDHI2I2, SDHI2_SDHI2I3, |
60 | RWDT0, | 58 | RWDT0, |
61 | DMAC1_1_DEI0, DMAC1_1_DEI1, DMAC1_1_DEI2, DMAC1_1_DEI3, | 59 | DMAC1_1_DEI0, DMAC1_1_DEI1, DMAC1_1_DEI2, DMAC1_1_DEI3, |
62 | DMAC1_2_DEI4, DMAC1_2_DEI5, DMAC1_2_DADERR, | 60 | DMAC1_2_DEI4, DMAC1_2_DEI5, DMAC1_2_DADERR, |
@@ -84,7 +82,7 @@ enum { | |||
84 | 82 | ||
85 | /* interrupt groups INTCA */ | 83 | /* interrupt groups INTCA */ |
86 | DMAC1_1, DMAC1_2, DMAC2_1, DMAC2_2, DMAC3_1, DMAC3_2, SHWYSTAT, | 84 | DMAC1_1, DMAC1_2, DMAC2_1, DMAC2_2, DMAC3_1, DMAC3_2, SHWYSTAT, |
87 | AP_ARM1, AP_ARM2, SPU2, FLCTL, IIC1 | 85 | AP_ARM1, AP_ARM2, SPU2, FLCTL, IIC1, SDHI0, SDHI1, SDHI2 |
88 | }; | 86 | }; |
89 | 87 | ||
90 | static struct intc_vect intca_vectors[] __initdata = { | 88 | static struct intc_vect intca_vectors[] __initdata = { |
@@ -125,17 +123,17 @@ static struct intc_vect intca_vectors[] __initdata = { | |||
125 | INTC_VECT(SCIFB, 0x0d60), | 123 | INTC_VECT(SCIFB, 0x0d60), |
126 | INTC_VECT(FLCTL_FLSTEI, 0x0d80), INTC_VECT(FLCTL_FLTENDI, 0x0da0), | 124 | INTC_VECT(FLCTL_FLSTEI, 0x0d80), INTC_VECT(FLCTL_FLTENDI, 0x0da0), |
127 | INTC_VECT(FLCTL_FLTREQ0I, 0x0dc0), INTC_VECT(FLCTL_FLTREQ1I, 0x0de0), | 125 | INTC_VECT(FLCTL_FLTREQ0I, 0x0dc0), INTC_VECT(FLCTL_FLTREQ1I, 0x0de0), |
128 | INTC_VECT(SDHI0, 0x0e00), INTC_VECT(SDHI0, 0x0e20), | 126 | INTC_VECT(SDHI0_SDHI0I0, 0x0e00), INTC_VECT(SDHI0_SDHI0I1, 0x0e20), |
129 | INTC_VECT(SDHI0, 0x0e40), INTC_VECT(SDHI0, 0x0e60), | 127 | INTC_VECT(SDHI0_SDHI0I2, 0x0e40), INTC_VECT(SDHI0_SDHI0I3, 0x0e60), |
130 | INTC_VECT(SDHI1, 0x0e80), INTC_VECT(SDHI1, 0x0ea0), | 128 | INTC_VECT(SDHI1_SDHI1I0, 0x0e80), INTC_VECT(SDHI1_SDHI1I1, 0x0ea0), |
131 | INTC_VECT(SDHI1, 0x0ec0), | 129 | INTC_VECT(SDHI1_SDHI1I2, 0x0ec0), |
132 | INTC_VECT(IRREM, 0x0f60), | 130 | INTC_VECT(IRREM, 0x0f60), |
133 | INTC_VECT(IRDA, 0x0480), | 131 | INTC_VECT(IRDA, 0x0480), |
134 | INTC_VECT(TPU0, 0x04a0), | 132 | INTC_VECT(TPU0, 0x04a0), |
135 | INTC_VECT(TTI20, 0x1100), | 133 | INTC_VECT(TTI20, 0x1100), |
136 | INTC_VECT(DDM, 0x1140), | 134 | INTC_VECT(DDM, 0x1140), |
137 | INTC_VECT(SDHI2, 0x1200), INTC_VECT(SDHI2, 0x1220), | 135 | INTC_VECT(SDHI2_SDHI2I0, 0x1200), INTC_VECT(SDHI2_SDHI2I1, 0x1220), |
138 | INTC_VECT(SDHI2, 0x1240), INTC_VECT(SDHI2, 0x1260), | 136 | INTC_VECT(SDHI2_SDHI2I2, 0x1240), INTC_VECT(SDHI2_SDHI2I3, 0x1260), |
139 | INTC_VECT(RWDT0, 0x1280), | 137 | INTC_VECT(RWDT0, 0x1280), |
140 | INTC_VECT(DMAC1_1_DEI0, 0x2000), INTC_VECT(DMAC1_1_DEI1, 0x2020), | 138 | INTC_VECT(DMAC1_1_DEI0, 0x2000), INTC_VECT(DMAC1_1_DEI1, 0x2020), |
141 | INTC_VECT(DMAC1_1_DEI2, 0x2040), INTC_VECT(DMAC1_1_DEI3, 0x2060), | 139 | INTC_VECT(DMAC1_1_DEI2, 0x2040), INTC_VECT(DMAC1_1_DEI3, 0x2060), |
@@ -195,6 +193,12 @@ static struct intc_group intca_groups[] __initdata = { | |||
195 | INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLTENDI, | 193 | INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLTENDI, |
196 | FLCTL_FLTREQ0I, FLCTL_FLTREQ1I), | 194 | FLCTL_FLTREQ0I, FLCTL_FLTREQ1I), |
197 | INTC_GROUP(IIC1, IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1), | 195 | INTC_GROUP(IIC1, IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1), |
196 | INTC_GROUP(SDHI0, SDHI0_SDHI0I0, SDHI0_SDHI0I1, | ||
197 | SDHI0_SDHI0I2, SDHI0_SDHI0I3), | ||
198 | INTC_GROUP(SDHI1, SDHI1_SDHI1I0, SDHI1_SDHI1I1, | ||
199 | SDHI1_SDHI1I2), | ||
200 | INTC_GROUP(SDHI2, SDHI2_SDHI2I0, SDHI2_SDHI2I1, | ||
201 | SDHI2_SDHI2I2, SDHI2_SDHI2I3), | ||
198 | INTC_GROUP(SHWYSTAT, SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM), | 202 | INTC_GROUP(SHWYSTAT, SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM), |
199 | }; | 203 | }; |
200 | 204 | ||
@@ -230,10 +234,10 @@ static struct intc_mask_reg intca_mask_registers[] __initdata = { | |||
230 | { SCIFB, SCIFA5, SCIFA4, MSIOF1, | 234 | { SCIFB, SCIFA5, SCIFA4, MSIOF1, |
231 | 0, 0, MSIOF2, 0 } }, | 235 | 0, 0, MSIOF2, 0 } }, |
232 | { 0xe694009c, 0xe69400dc, 8, /* IMR7A / IMCR7A */ | 236 | { 0xe694009c, 0xe69400dc, 8, /* IMR7A / IMCR7A */ |
233 | { DISABLED, ENABLED, ENABLED, ENABLED, | 237 | { SDHI0_SDHI0I3, SDHI0_SDHI0I2, SDHI0_SDHI0I1, SDHI0_SDHI0I0, |
234 | FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } }, | 238 | FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } }, |
235 | { 0xe69400a0, 0xe69400e0, 8, /* IMR8A / IMCR8A */ | 239 | { 0xe69400a0, 0xe69400e0, 8, /* IMR8A / IMCR8A */ |
236 | { 0, ENABLED, ENABLED, ENABLED, | 240 | { 0, SDHI1_SDHI1I2, SDHI1_SDHI1I1, SDHI1_SDHI1I0, |
237 | TTI20, USBHSDMAC0_USHDMI, 0, 0 } }, | 241 | TTI20, USBHSDMAC0_USHDMI, 0, 0 } }, |
238 | { 0xe69400a4, 0xe69400e4, 8, /* IMR9A / IMCR9A */ | 242 | { 0xe69400a4, 0xe69400e4, 8, /* IMR9A / IMCR9A */ |
239 | { CMT1_CMT13, CMT1_CMT12, CMT1_CMT11, CMT1_CMT10, | 243 | { CMT1_CMT13, CMT1_CMT12, CMT1_CMT11, CMT1_CMT10, |
@@ -248,7 +252,7 @@ static struct intc_mask_reg intca_mask_registers[] __initdata = { | |||
248 | { 0, 0, TPU0, 0, | 252 | { 0, 0, TPU0, 0, |
249 | 0, 0, 0, 0 } }, | 253 | 0, 0, 0, 0 } }, |
250 | { 0xe69400b4, 0xe69400f4, 8, /* IMR13A / IMCR13A */ | 254 | { 0xe69400b4, 0xe69400f4, 8, /* IMR13A / IMCR13A */ |
251 | { DISABLED, DISABLED, ENABLED, ENABLED, | 255 | { SDHI2_SDHI2I3, SDHI2_SDHI2I2, SDHI2_SDHI2I1, SDHI2_SDHI2I0, |
252 | 0, CMT3, 0, RWDT0 } }, | 256 | 0, CMT3, 0, RWDT0 } }, |
253 | { 0xe6950080, 0xe69500c0, 8, /* IMR0A3 / IMCR0A3 */ | 257 | { 0xe6950080, 0xe69500c0, 8, /* IMR0A3 / IMCR0A3 */ |
254 | { SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM, 0, | 258 | { SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM, 0, |
@@ -354,14 +358,10 @@ static struct intc_mask_reg intca_ack_registers[] __initdata = { | |||
354 | { IRQ24A, IRQ25A, IRQ26A, IRQ27A, IRQ28A, IRQ29A, IRQ30A, IRQ31A } }, | 358 | { IRQ24A, IRQ25A, IRQ26A, IRQ27A, IRQ28A, IRQ29A, IRQ30A, IRQ31A } }, |
355 | }; | 359 | }; |
356 | 360 | ||
357 | static struct intc_desc intca_desc __initdata = { | 361 | static DECLARE_INTC_DESC_ACK(intca_desc, "sh7372-intca", |
358 | .name = "sh7372-intca", | 362 | intca_vectors, intca_groups, |
359 | .force_enable = ENABLED, | 363 | intca_mask_registers, intca_prio_registers, |
360 | .force_disable = DISABLED, | 364 | intca_sense_registers, intca_ack_registers); |
361 | .hw = INTC_HW_DESC(intca_vectors, intca_groups, | ||
362 | intca_mask_registers, intca_prio_registers, | ||
363 | intca_sense_registers, intca_ack_registers), | ||
364 | }; | ||
365 | 365 | ||
366 | enum { | 366 | enum { |
367 | UNUSED_INTCS = 0, | 367 | UNUSED_INTCS = 0, |
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c new file mode 100644 index 000000000000..8e4aadf14c9f --- /dev/null +++ b/arch/arm/mach-shmobile/pm-sh7372.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | * sh7372 Power management support | ||
3 | * | ||
4 | * Copyright (C) 2011 Magnus Damm | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/pm.h> | ||
12 | #include <linux/suspend.h> | ||
13 | #include <linux/cpuidle.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/list.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/slab.h> | ||
18 | #include <asm/system.h> | ||
19 | #include <asm/io.h> | ||
20 | #include <asm/tlbflush.h> | ||
21 | #include <mach/common.h> | ||
22 | |||
23 | #define SMFRAM 0xe6a70000 | ||
24 | #define SYSTBCR 0xe6150024 | ||
25 | #define SBAR 0xe6180020 | ||
26 | #define APARMBAREA 0xe6f10020 | ||
27 | |||
28 | static void sh7372_enter_core_standby(void) | ||
29 | { | ||
30 | void __iomem *smfram = (void __iomem *)SMFRAM; | ||
31 | |||
32 | __raw_writel(0, APARMBAREA); /* translate 4k */ | ||
33 | __raw_writel(__pa(sh7372_cpu_resume), SBAR); /* set reset vector */ | ||
34 | __raw_writel(0x10, SYSTBCR); /* enable core standby */ | ||
35 | |||
36 | __raw_writel(0, smfram + 0x3c); /* clear page table address */ | ||
37 | |||
38 | sh7372_cpu_suspend(); | ||
39 | cpu_init(); | ||
40 | |||
41 | /* if page table address is non-NULL then we have been powered down */ | ||
42 | if (__raw_readl(smfram + 0x3c)) { | ||
43 | __raw_writel(__raw_readl(smfram + 0x40), | ||
44 | __va(__raw_readl(smfram + 0x3c))); | ||
45 | |||
46 | flush_tlb_all(); | ||
47 | set_cr(__raw_readl(smfram + 0x38)); | ||
48 | } | ||
49 | |||
50 | __raw_writel(0, SYSTBCR); /* disable core standby */ | ||
51 | __raw_writel(0, SBAR); /* disable reset vector translation */ | ||
52 | } | ||
53 | |||
54 | #ifdef CONFIG_CPU_IDLE | ||
55 | static void sh7372_cpuidle_setup(struct cpuidle_device *dev) | ||
56 | { | ||
57 | struct cpuidle_state *state; | ||
58 | int i = dev->state_count; | ||
59 | |||
60 | state = &dev->states[i]; | ||
61 | snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); | ||
62 | strncpy(state->desc, "Core Standby Mode", CPUIDLE_DESC_LEN); | ||
63 | state->exit_latency = 10; | ||
64 | state->target_residency = 20 + 10; | ||
65 | state->power_usage = 1; /* perhaps not */ | ||
66 | state->flags = 0; | ||
67 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | ||
68 | shmobile_cpuidle_modes[i] = sh7372_enter_core_standby; | ||
69 | |||
70 | dev->state_count = i + 1; | ||
71 | } | ||
72 | |||
73 | static void sh7372_cpuidle_init(void) | ||
74 | { | ||
75 | shmobile_cpuidle_setup = sh7372_cpuidle_setup; | ||
76 | } | ||
77 | #else | ||
78 | static void sh7372_cpuidle_init(void) {} | ||
79 | #endif | ||
80 | |||
81 | #ifdef CONFIG_SUSPEND | ||
82 | static int sh7372_enter_suspend(suspend_state_t suspend_state) | ||
83 | { | ||
84 | sh7372_enter_core_standby(); | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static void sh7372_suspend_init(void) | ||
89 | { | ||
90 | shmobile_suspend_ops.enter = sh7372_enter_suspend; | ||
91 | } | ||
92 | #else | ||
93 | static void sh7372_suspend_init(void) {} | ||
94 | #endif | ||
95 | |||
96 | #define DBGREG1 0xe6100020 | ||
97 | #define DBGREG9 0xe6100040 | ||
98 | |||
99 | void __init sh7372_pm_init(void) | ||
100 | { | ||
101 | /* enable DBG hardware block to kick SYSC */ | ||
102 | __raw_writel(0x0000a500, DBGREG9); | ||
103 | __raw_writel(0x0000a501, DBGREG9); | ||
104 | __raw_writel(0x00000000, DBGREG1); | ||
105 | |||
106 | sh7372_suspend_init(); | ||
107 | sh7372_cpuidle_init(); | ||
108 | } | ||
diff --git a/arch/arm/mach-shmobile/setup-sh7367.c b/arch/arm/mach-shmobile/setup-sh7367.c index ce28141662da..2c10190dbb55 100644 --- a/arch/arm/mach-shmobile/setup-sh7367.c +++ b/arch/arm/mach-shmobile/setup-sh7367.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/uio_driver.h> | ||
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | #include <linux/input.h> | 27 | #include <linux/input.h> |
27 | #include <linux/io.h> | 28 | #include <linux/io.h> |
@@ -195,6 +196,214 @@ static struct platform_device cmt10_device = { | |||
195 | .num_resources = ARRAY_SIZE(cmt10_resources), | 196 | .num_resources = ARRAY_SIZE(cmt10_resources), |
196 | }; | 197 | }; |
197 | 198 | ||
199 | /* VPU */ | ||
200 | static struct uio_info vpu_platform_data = { | ||
201 | .name = "VPU5", | ||
202 | .version = "0", | ||
203 | .irq = intcs_evt2irq(0x980), | ||
204 | }; | ||
205 | |||
206 | static struct resource vpu_resources[] = { | ||
207 | [0] = { | ||
208 | .name = "VPU", | ||
209 | .start = 0xfe900000, | ||
210 | .end = 0xfe902807, | ||
211 | .flags = IORESOURCE_MEM, | ||
212 | }, | ||
213 | }; | ||
214 | |||
215 | static struct platform_device vpu_device = { | ||
216 | .name = "uio_pdrv_genirq", | ||
217 | .id = 0, | ||
218 | .dev = { | ||
219 | .platform_data = &vpu_platform_data, | ||
220 | }, | ||
221 | .resource = vpu_resources, | ||
222 | .num_resources = ARRAY_SIZE(vpu_resources), | ||
223 | }; | ||
224 | |||
225 | /* VEU0 */ | ||
226 | static struct uio_info veu0_platform_data = { | ||
227 | .name = "VEU0", | ||
228 | .version = "0", | ||
229 | .irq = intcs_evt2irq(0x700), | ||
230 | }; | ||
231 | |||
232 | static struct resource veu0_resources[] = { | ||
233 | [0] = { | ||
234 | .name = "VEU0", | ||
235 | .start = 0xfe920000, | ||
236 | .end = 0xfe9200b7, | ||
237 | .flags = IORESOURCE_MEM, | ||
238 | }, | ||
239 | }; | ||
240 | |||
241 | static struct platform_device veu0_device = { | ||
242 | .name = "uio_pdrv_genirq", | ||
243 | .id = 1, | ||
244 | .dev = { | ||
245 | .platform_data = &veu0_platform_data, | ||
246 | }, | ||
247 | .resource = veu0_resources, | ||
248 | .num_resources = ARRAY_SIZE(veu0_resources), | ||
249 | }; | ||
250 | |||
251 | /* VEU1 */ | ||
252 | static struct uio_info veu1_platform_data = { | ||
253 | .name = "VEU1", | ||
254 | .version = "0", | ||
255 | .irq = intcs_evt2irq(0x720), | ||
256 | }; | ||
257 | |||
258 | static struct resource veu1_resources[] = { | ||
259 | [0] = { | ||
260 | .name = "VEU1", | ||
261 | .start = 0xfe924000, | ||
262 | .end = 0xfe9240b7, | ||
263 | .flags = IORESOURCE_MEM, | ||
264 | }, | ||
265 | }; | ||
266 | |||
267 | static struct platform_device veu1_device = { | ||
268 | .name = "uio_pdrv_genirq", | ||
269 | .id = 2, | ||
270 | .dev = { | ||
271 | .platform_data = &veu1_platform_data, | ||
272 | }, | ||
273 | .resource = veu1_resources, | ||
274 | .num_resources = ARRAY_SIZE(veu1_resources), | ||
275 | }; | ||
276 | |||
277 | /* VEU2 */ | ||
278 | static struct uio_info veu2_platform_data = { | ||
279 | .name = "VEU2", | ||
280 | .version = "0", | ||
281 | .irq = intcs_evt2irq(0x740), | ||
282 | }; | ||
283 | |||
284 | static struct resource veu2_resources[] = { | ||
285 | [0] = { | ||
286 | .name = "VEU2", | ||
287 | .start = 0xfe928000, | ||
288 | .end = 0xfe9280b7, | ||
289 | .flags = IORESOURCE_MEM, | ||
290 | }, | ||
291 | }; | ||
292 | |||
293 | static struct platform_device veu2_device = { | ||
294 | .name = "uio_pdrv_genirq", | ||
295 | .id = 3, | ||
296 | .dev = { | ||
297 | .platform_data = &veu2_platform_data, | ||
298 | }, | ||
299 | .resource = veu2_resources, | ||
300 | .num_resources = ARRAY_SIZE(veu2_resources), | ||
301 | }; | ||
302 | |||
303 | /* VEU3 */ | ||
304 | static struct uio_info veu3_platform_data = { | ||
305 | .name = "VEU3", | ||
306 | .version = "0", | ||
307 | .irq = intcs_evt2irq(0x760), | ||
308 | }; | ||
309 | |||
310 | static struct resource veu3_resources[] = { | ||
311 | [0] = { | ||
312 | .name = "VEU3", | ||
313 | .start = 0xfe92c000, | ||
314 | .end = 0xfe92c0b7, | ||
315 | .flags = IORESOURCE_MEM, | ||
316 | }, | ||
317 | }; | ||
318 | |||
319 | static struct platform_device veu3_device = { | ||
320 | .name = "uio_pdrv_genirq", | ||
321 | .id = 4, | ||
322 | .dev = { | ||
323 | .platform_data = &veu3_platform_data, | ||
324 | }, | ||
325 | .resource = veu3_resources, | ||
326 | .num_resources = ARRAY_SIZE(veu3_resources), | ||
327 | }; | ||
328 | |||
329 | /* VEU2H */ | ||
330 | static struct uio_info veu2h_platform_data = { | ||
331 | .name = "VEU2H", | ||
332 | .version = "0", | ||
333 | .irq = intcs_evt2irq(0x520), | ||
334 | }; | ||
335 | |||
336 | static struct resource veu2h_resources[] = { | ||
337 | [0] = { | ||
338 | .name = "VEU2H", | ||
339 | .start = 0xfe93c000, | ||
340 | .end = 0xfe93c27b, | ||
341 | .flags = IORESOURCE_MEM, | ||
342 | }, | ||
343 | }; | ||
344 | |||
345 | static struct platform_device veu2h_device = { | ||
346 | .name = "uio_pdrv_genirq", | ||
347 | .id = 5, | ||
348 | .dev = { | ||
349 | .platform_data = &veu2h_platform_data, | ||
350 | }, | ||
351 | .resource = veu2h_resources, | ||
352 | .num_resources = ARRAY_SIZE(veu2h_resources), | ||
353 | }; | ||
354 | |||
355 | /* JPU */ | ||
356 | static struct uio_info jpu_platform_data = { | ||
357 | .name = "JPU", | ||
358 | .version = "0", | ||
359 | .irq = intcs_evt2irq(0x560), | ||
360 | }; | ||
361 | |||
362 | static struct resource jpu_resources[] = { | ||
363 | [0] = { | ||
364 | .name = "JPU", | ||
365 | .start = 0xfe980000, | ||
366 | .end = 0xfe9902d3, | ||
367 | .flags = IORESOURCE_MEM, | ||
368 | }, | ||
369 | }; | ||
370 | |||
371 | static struct platform_device jpu_device = { | ||
372 | .name = "uio_pdrv_genirq", | ||
373 | .id = 6, | ||
374 | .dev = { | ||
375 | .platform_data = &jpu_platform_data, | ||
376 | }, | ||
377 | .resource = jpu_resources, | ||
378 | .num_resources = ARRAY_SIZE(jpu_resources), | ||
379 | }; | ||
380 | |||
381 | /* SPU1 */ | ||
382 | static struct uio_info spu1_platform_data = { | ||
383 | .name = "SPU1", | ||
384 | .version = "0", | ||
385 | .irq = evt2irq(0xfc0), | ||
386 | }; | ||
387 | |||
388 | static struct resource spu1_resources[] = { | ||
389 | [0] = { | ||
390 | .name = "SPU1", | ||
391 | .start = 0xfe300000, | ||
392 | .end = 0xfe3fffff, | ||
393 | .flags = IORESOURCE_MEM, | ||
394 | }, | ||
395 | }; | ||
396 | |||
397 | static struct platform_device spu1_device = { | ||
398 | .name = "uio_pdrv_genirq", | ||
399 | .id = 7, | ||
400 | .dev = { | ||
401 | .platform_data = &spu1_platform_data, | ||
402 | }, | ||
403 | .resource = spu1_resources, | ||
404 | .num_resources = ARRAY_SIZE(spu1_resources), | ||
405 | }; | ||
406 | |||
198 | static struct platform_device *sh7367_early_devices[] __initdata = { | 407 | static struct platform_device *sh7367_early_devices[] __initdata = { |
199 | &scif0_device, | 408 | &scif0_device, |
200 | &scif1_device, | 409 | &scif1_device, |
@@ -206,10 +415,24 @@ static struct platform_device *sh7367_early_devices[] __initdata = { | |||
206 | &cmt10_device, | 415 | &cmt10_device, |
207 | }; | 416 | }; |
208 | 417 | ||
418 | static struct platform_device *sh7367_devices[] __initdata = { | ||
419 | &vpu_device, | ||
420 | &veu0_device, | ||
421 | &veu1_device, | ||
422 | &veu2_device, | ||
423 | &veu3_device, | ||
424 | &veu2h_device, | ||
425 | &jpu_device, | ||
426 | &spu1_device, | ||
427 | }; | ||
428 | |||
209 | void __init sh7367_add_standard_devices(void) | 429 | void __init sh7367_add_standard_devices(void) |
210 | { | 430 | { |
211 | platform_add_devices(sh7367_early_devices, | 431 | platform_add_devices(sh7367_early_devices, |
212 | ARRAY_SIZE(sh7367_early_devices)); | 432 | ARRAY_SIZE(sh7367_early_devices)); |
433 | |||
434 | platform_add_devices(sh7367_devices, | ||
435 | ARRAY_SIZE(sh7367_devices)); | ||
213 | } | 436 | } |
214 | 437 | ||
215 | #define SYMSTPCR2 0xe6158048 | 438 | #define SYMSTPCR2 0xe6158048 |
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c index ff0494f3d00c..cd807eea69e2 100644 --- a/arch/arm/mach-shmobile/setup-sh7372.c +++ b/arch/arm/mach-shmobile/setup-sh7372.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/uio_driver.h> | ||
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | #include <linux/input.h> | 27 | #include <linux/input.h> |
27 | #include <linux/io.h> | 28 | #include <linux/io.h> |
@@ -601,6 +602,214 @@ static struct platform_device dma2_device = { | |||
601 | }, | 602 | }, |
602 | }; | 603 | }; |
603 | 604 | ||
605 | /* VPU */ | ||
606 | static struct uio_info vpu_platform_data = { | ||
607 | .name = "VPU5HG", | ||
608 | .version = "0", | ||
609 | .irq = intcs_evt2irq(0x980), | ||
610 | }; | ||
611 | |||
612 | static struct resource vpu_resources[] = { | ||
613 | [0] = { | ||
614 | .name = "VPU", | ||
615 | .start = 0xfe900000, | ||
616 | .end = 0xfe900157, | ||
617 | .flags = IORESOURCE_MEM, | ||
618 | }, | ||
619 | }; | ||
620 | |||
621 | static struct platform_device vpu_device = { | ||
622 | .name = "uio_pdrv_genirq", | ||
623 | .id = 0, | ||
624 | .dev = { | ||
625 | .platform_data = &vpu_platform_data, | ||
626 | }, | ||
627 | .resource = vpu_resources, | ||
628 | .num_resources = ARRAY_SIZE(vpu_resources), | ||
629 | }; | ||
630 | |||
631 | /* VEU0 */ | ||
632 | static struct uio_info veu0_platform_data = { | ||
633 | .name = "VEU0", | ||
634 | .version = "0", | ||
635 | .irq = intcs_evt2irq(0x700), | ||
636 | }; | ||
637 | |||
638 | static struct resource veu0_resources[] = { | ||
639 | [0] = { | ||
640 | .name = "VEU0", | ||
641 | .start = 0xfe920000, | ||
642 | .end = 0xfe9200cb, | ||
643 | .flags = IORESOURCE_MEM, | ||
644 | }, | ||
645 | }; | ||
646 | |||
647 | static struct platform_device veu0_device = { | ||
648 | .name = "uio_pdrv_genirq", | ||
649 | .id = 1, | ||
650 | .dev = { | ||
651 | .platform_data = &veu0_platform_data, | ||
652 | }, | ||
653 | .resource = veu0_resources, | ||
654 | .num_resources = ARRAY_SIZE(veu0_resources), | ||
655 | }; | ||
656 | |||
657 | /* VEU1 */ | ||
658 | static struct uio_info veu1_platform_data = { | ||
659 | .name = "VEU1", | ||
660 | .version = "0", | ||
661 | .irq = intcs_evt2irq(0x720), | ||
662 | }; | ||
663 | |||
664 | static struct resource veu1_resources[] = { | ||
665 | [0] = { | ||
666 | .name = "VEU1", | ||
667 | .start = 0xfe924000, | ||
668 | .end = 0xfe9240cb, | ||
669 | .flags = IORESOURCE_MEM, | ||
670 | }, | ||
671 | }; | ||
672 | |||
673 | static struct platform_device veu1_device = { | ||
674 | .name = "uio_pdrv_genirq", | ||
675 | .id = 2, | ||
676 | .dev = { | ||
677 | .platform_data = &veu1_platform_data, | ||
678 | }, | ||
679 | .resource = veu1_resources, | ||
680 | .num_resources = ARRAY_SIZE(veu1_resources), | ||
681 | }; | ||
682 | |||
683 | /* VEU2 */ | ||
684 | static struct uio_info veu2_platform_data = { | ||
685 | .name = "VEU2", | ||
686 | .version = "0", | ||
687 | .irq = intcs_evt2irq(0x740), | ||
688 | }; | ||
689 | |||
690 | static struct resource veu2_resources[] = { | ||
691 | [0] = { | ||
692 | .name = "VEU2", | ||
693 | .start = 0xfe928000, | ||
694 | .end = 0xfe928307, | ||
695 | .flags = IORESOURCE_MEM, | ||
696 | }, | ||
697 | }; | ||
698 | |||
699 | static struct platform_device veu2_device = { | ||
700 | .name = "uio_pdrv_genirq", | ||
701 | .id = 3, | ||
702 | .dev = { | ||
703 | .platform_data = &veu2_platform_data, | ||
704 | }, | ||
705 | .resource = veu2_resources, | ||
706 | .num_resources = ARRAY_SIZE(veu2_resources), | ||
707 | }; | ||
708 | |||
709 | /* VEU3 */ | ||
710 | static struct uio_info veu3_platform_data = { | ||
711 | .name = "VEU3", | ||
712 | .version = "0", | ||
713 | .irq = intcs_evt2irq(0x760), | ||
714 | }; | ||
715 | |||
716 | static struct resource veu3_resources[] = { | ||
717 | [0] = { | ||
718 | .name = "VEU3", | ||
719 | .start = 0xfe92c000, | ||
720 | .end = 0xfe92c307, | ||
721 | .flags = IORESOURCE_MEM, | ||
722 | }, | ||
723 | }; | ||
724 | |||
725 | static struct platform_device veu3_device = { | ||
726 | .name = "uio_pdrv_genirq", | ||
727 | .id = 4, | ||
728 | .dev = { | ||
729 | .platform_data = &veu3_platform_data, | ||
730 | }, | ||
731 | .resource = veu3_resources, | ||
732 | .num_resources = ARRAY_SIZE(veu3_resources), | ||
733 | }; | ||
734 | |||
735 | /* JPU */ | ||
736 | static struct uio_info jpu_platform_data = { | ||
737 | .name = "JPU", | ||
738 | .version = "0", | ||
739 | .irq = intcs_evt2irq(0x560), | ||
740 | }; | ||
741 | |||
742 | static struct resource jpu_resources[] = { | ||
743 | [0] = { | ||
744 | .name = "JPU", | ||
745 | .start = 0xfe980000, | ||
746 | .end = 0xfe9902d3, | ||
747 | .flags = IORESOURCE_MEM, | ||
748 | }, | ||
749 | }; | ||
750 | |||
751 | static struct platform_device jpu_device = { | ||
752 | .name = "uio_pdrv_genirq", | ||
753 | .id = 5, | ||
754 | .dev = { | ||
755 | .platform_data = &jpu_platform_data, | ||
756 | }, | ||
757 | .resource = jpu_resources, | ||
758 | .num_resources = ARRAY_SIZE(jpu_resources), | ||
759 | }; | ||
760 | |||
761 | /* SPU2DSP0 */ | ||
762 | static struct uio_info spu0_platform_data = { | ||
763 | .name = "SPU2DSP0", | ||
764 | .version = "0", | ||
765 | .irq = evt2irq(0x1800), | ||
766 | }; | ||
767 | |||
768 | static struct resource spu0_resources[] = { | ||
769 | [0] = { | ||
770 | .name = "SPU2DSP0", | ||
771 | .start = 0xfe200000, | ||
772 | .end = 0xfe2fffff, | ||
773 | .flags = IORESOURCE_MEM, | ||
774 | }, | ||
775 | }; | ||
776 | |||
777 | static struct platform_device spu0_device = { | ||
778 | .name = "uio_pdrv_genirq", | ||
779 | .id = 6, | ||
780 | .dev = { | ||
781 | .platform_data = &spu0_platform_data, | ||
782 | }, | ||
783 | .resource = spu0_resources, | ||
784 | .num_resources = ARRAY_SIZE(spu0_resources), | ||
785 | }; | ||
786 | |||
787 | /* SPU2DSP1 */ | ||
788 | static struct uio_info spu1_platform_data = { | ||
789 | .name = "SPU2DSP1", | ||
790 | .version = "0", | ||
791 | .irq = evt2irq(0x1820), | ||
792 | }; | ||
793 | |||
794 | static struct resource spu1_resources[] = { | ||
795 | [0] = { | ||
796 | .name = "SPU2DSP1", | ||
797 | .start = 0xfe300000, | ||
798 | .end = 0xfe3fffff, | ||
799 | .flags = IORESOURCE_MEM, | ||
800 | }, | ||
801 | }; | ||
802 | |||
803 | static struct platform_device spu1_device = { | ||
804 | .name = "uio_pdrv_genirq", | ||
805 | .id = 7, | ||
806 | .dev = { | ||
807 | .platform_data = &spu1_platform_data, | ||
808 | }, | ||
809 | .resource = spu1_resources, | ||
810 | .num_resources = ARRAY_SIZE(spu1_resources), | ||
811 | }; | ||
812 | |||
604 | static struct platform_device *sh7372_early_devices[] __initdata = { | 813 | static struct platform_device *sh7372_early_devices[] __initdata = { |
605 | &scif0_device, | 814 | &scif0_device, |
606 | &scif1_device, | 815 | &scif1_device, |
@@ -620,6 +829,14 @@ static struct platform_device *sh7372_late_devices[] __initdata = { | |||
620 | &dma0_device, | 829 | &dma0_device, |
621 | &dma1_device, | 830 | &dma1_device, |
622 | &dma2_device, | 831 | &dma2_device, |
832 | &vpu_device, | ||
833 | &veu0_device, | ||
834 | &veu1_device, | ||
835 | &veu2_device, | ||
836 | &veu3_device, | ||
837 | &jpu_device, | ||
838 | &spu0_device, | ||
839 | &spu1_device, | ||
623 | }; | 840 | }; |
624 | 841 | ||
625 | void __init sh7372_add_standard_devices(void) | 842 | void __init sh7372_add_standard_devices(void) |
diff --git a/arch/arm/mach-shmobile/setup-sh7377.c b/arch/arm/mach-shmobile/setup-sh7377.c index 8099b0b8a934..bb405b8e459b 100644 --- a/arch/arm/mach-shmobile/setup-sh7377.c +++ b/arch/arm/mach-shmobile/setup-sh7377.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/uio_driver.h> | ||
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | #include <linux/input.h> | 27 | #include <linux/input.h> |
27 | #include <linux/io.h> | 28 | #include <linux/io.h> |
@@ -38,7 +39,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
38 | .flags = UPF_BOOT_AUTOCONF, | 39 | .flags = UPF_BOOT_AUTOCONF, |
39 | .scscr = SCSCR_RE | SCSCR_TE, | 40 | .scscr = SCSCR_RE | SCSCR_TE, |
40 | .scbrr_algo_id = SCBRR_ALGO_4, | 41 | .scbrr_algo_id = SCBRR_ALGO_4, |
41 | .type = PORT_SCIF, | 42 | .type = PORT_SCIFA, |
42 | .irqs = { evt2irq(0xc00), evt2irq(0xc00), | 43 | .irqs = { evt2irq(0xc00), evt2irq(0xc00), |
43 | evt2irq(0xc00), evt2irq(0xc00) }, | 44 | evt2irq(0xc00), evt2irq(0xc00) }, |
44 | }; | 45 | }; |
@@ -57,7 +58,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
57 | .flags = UPF_BOOT_AUTOCONF, | 58 | .flags = UPF_BOOT_AUTOCONF, |
58 | .scscr = SCSCR_RE | SCSCR_TE, | 59 | .scscr = SCSCR_RE | SCSCR_TE, |
59 | .scbrr_algo_id = SCBRR_ALGO_4, | 60 | .scbrr_algo_id = SCBRR_ALGO_4, |
60 | .type = PORT_SCIF, | 61 | .type = PORT_SCIFA, |
61 | .irqs = { evt2irq(0xc20), evt2irq(0xc20), | 62 | .irqs = { evt2irq(0xc20), evt2irq(0xc20), |
62 | evt2irq(0xc20), evt2irq(0xc20) }, | 63 | evt2irq(0xc20), evt2irq(0xc20) }, |
63 | }; | 64 | }; |
@@ -76,7 +77,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
76 | .flags = UPF_BOOT_AUTOCONF, | 77 | .flags = UPF_BOOT_AUTOCONF, |
77 | .scscr = SCSCR_RE | SCSCR_TE, | 78 | .scscr = SCSCR_RE | SCSCR_TE, |
78 | .scbrr_algo_id = SCBRR_ALGO_4, | 79 | .scbrr_algo_id = SCBRR_ALGO_4, |
79 | .type = PORT_SCIF, | 80 | .type = PORT_SCIFA, |
80 | .irqs = { evt2irq(0xc40), evt2irq(0xc40), | 81 | .irqs = { evt2irq(0xc40), evt2irq(0xc40), |
81 | evt2irq(0xc40), evt2irq(0xc40) }, | 82 | evt2irq(0xc40), evt2irq(0xc40) }, |
82 | }; | 83 | }; |
@@ -95,7 +96,7 @@ static struct plat_sci_port scif3_platform_data = { | |||
95 | .flags = UPF_BOOT_AUTOCONF, | 96 | .flags = UPF_BOOT_AUTOCONF, |
96 | .scscr = SCSCR_RE | SCSCR_TE, | 97 | .scscr = SCSCR_RE | SCSCR_TE, |
97 | .scbrr_algo_id = SCBRR_ALGO_4, | 98 | .scbrr_algo_id = SCBRR_ALGO_4, |
98 | .type = PORT_SCIF, | 99 | .type = PORT_SCIFA, |
99 | .irqs = { evt2irq(0xc60), evt2irq(0xc60), | 100 | .irqs = { evt2irq(0xc60), evt2irq(0xc60), |
100 | evt2irq(0xc60), evt2irq(0xc60) }, | 101 | evt2irq(0xc60), evt2irq(0xc60) }, |
101 | }; | 102 | }; |
@@ -114,7 +115,7 @@ static struct plat_sci_port scif4_platform_data = { | |||
114 | .flags = UPF_BOOT_AUTOCONF, | 115 | .flags = UPF_BOOT_AUTOCONF, |
115 | .scscr = SCSCR_RE | SCSCR_TE, | 116 | .scscr = SCSCR_RE | SCSCR_TE, |
116 | .scbrr_algo_id = SCBRR_ALGO_4, | 117 | .scbrr_algo_id = SCBRR_ALGO_4, |
117 | .type = PORT_SCIF, | 118 | .type = PORT_SCIFA, |
118 | .irqs = { evt2irq(0xd20), evt2irq(0xd20), | 119 | .irqs = { evt2irq(0xd20), evt2irq(0xd20), |
119 | evt2irq(0xd20), evt2irq(0xd20) }, | 120 | evt2irq(0xd20), evt2irq(0xd20) }, |
120 | }; | 121 | }; |
@@ -133,7 +134,7 @@ static struct plat_sci_port scif5_platform_data = { | |||
133 | .flags = UPF_BOOT_AUTOCONF, | 134 | .flags = UPF_BOOT_AUTOCONF, |
134 | .scscr = SCSCR_RE | SCSCR_TE, | 135 | .scscr = SCSCR_RE | SCSCR_TE, |
135 | .scbrr_algo_id = SCBRR_ALGO_4, | 136 | .scbrr_algo_id = SCBRR_ALGO_4, |
136 | .type = PORT_SCIF, | 137 | .type = PORT_SCIFA, |
137 | .irqs = { evt2irq(0xd40), evt2irq(0xd40), | 138 | .irqs = { evt2irq(0xd40), evt2irq(0xd40), |
138 | evt2irq(0xd40), evt2irq(0xd40) }, | 139 | evt2irq(0xd40), evt2irq(0xd40) }, |
139 | }; | 140 | }; |
@@ -152,7 +153,7 @@ static struct plat_sci_port scif6_platform_data = { | |||
152 | .flags = UPF_BOOT_AUTOCONF, | 153 | .flags = UPF_BOOT_AUTOCONF, |
153 | .scscr = SCSCR_RE | SCSCR_TE, | 154 | .scscr = SCSCR_RE | SCSCR_TE, |
154 | .scbrr_algo_id = SCBRR_ALGO_4, | 155 | .scbrr_algo_id = SCBRR_ALGO_4, |
155 | .type = PORT_SCIF, | 156 | .type = PORT_SCIFA, |
156 | .irqs = { intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80), | 157 | .irqs = { intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80), |
157 | intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80) }, | 158 | intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80) }, |
158 | }; | 159 | }; |
@@ -171,7 +172,7 @@ static struct plat_sci_port scif7_platform_data = { | |||
171 | .flags = UPF_BOOT_AUTOCONF, | 172 | .flags = UPF_BOOT_AUTOCONF, |
172 | .scscr = SCSCR_RE | SCSCR_TE, | 173 | .scscr = SCSCR_RE | SCSCR_TE, |
173 | .scbrr_algo_id = SCBRR_ALGO_4, | 174 | .scbrr_algo_id = SCBRR_ALGO_4, |
174 | .type = PORT_SCIF, | 175 | .type = PORT_SCIFB, |
175 | .irqs = { evt2irq(0xd60), evt2irq(0xd60), | 176 | .irqs = { evt2irq(0xd60), evt2irq(0xd60), |
176 | evt2irq(0xd60), evt2irq(0xd60) }, | 177 | evt2irq(0xd60), evt2irq(0xd60) }, |
177 | }; | 178 | }; |
@@ -215,6 +216,214 @@ static struct platform_device cmt10_device = { | |||
215 | .num_resources = ARRAY_SIZE(cmt10_resources), | 216 | .num_resources = ARRAY_SIZE(cmt10_resources), |
216 | }; | 217 | }; |
217 | 218 | ||
219 | /* VPU */ | ||
220 | static struct uio_info vpu_platform_data = { | ||
221 | .name = "VPU5HG", | ||
222 | .version = "0", | ||
223 | .irq = intcs_evt2irq(0x980), | ||
224 | }; | ||
225 | |||
226 | static struct resource vpu_resources[] = { | ||
227 | [0] = { | ||
228 | .name = "VPU", | ||
229 | .start = 0xfe900000, | ||
230 | .end = 0xfe900157, | ||
231 | .flags = IORESOURCE_MEM, | ||
232 | }, | ||
233 | }; | ||
234 | |||
235 | static struct platform_device vpu_device = { | ||
236 | .name = "uio_pdrv_genirq", | ||
237 | .id = 0, | ||
238 | .dev = { | ||
239 | .platform_data = &vpu_platform_data, | ||
240 | }, | ||
241 | .resource = vpu_resources, | ||
242 | .num_resources = ARRAY_SIZE(vpu_resources), | ||
243 | }; | ||
244 | |||
245 | /* VEU0 */ | ||
246 | static struct uio_info veu0_platform_data = { | ||
247 | .name = "VEU0", | ||
248 | .version = "0", | ||
249 | .irq = intcs_evt2irq(0x700), | ||
250 | }; | ||
251 | |||
252 | static struct resource veu0_resources[] = { | ||
253 | [0] = { | ||
254 | .name = "VEU0", | ||
255 | .start = 0xfe920000, | ||
256 | .end = 0xfe9200cb, | ||
257 | .flags = IORESOURCE_MEM, | ||
258 | }, | ||
259 | }; | ||
260 | |||
261 | static struct platform_device veu0_device = { | ||
262 | .name = "uio_pdrv_genirq", | ||
263 | .id = 1, | ||
264 | .dev = { | ||
265 | .platform_data = &veu0_platform_data, | ||
266 | }, | ||
267 | .resource = veu0_resources, | ||
268 | .num_resources = ARRAY_SIZE(veu0_resources), | ||
269 | }; | ||
270 | |||
271 | /* VEU1 */ | ||
272 | static struct uio_info veu1_platform_data = { | ||
273 | .name = "VEU1", | ||
274 | .version = "0", | ||
275 | .irq = intcs_evt2irq(0x720), | ||
276 | }; | ||
277 | |||
278 | static struct resource veu1_resources[] = { | ||
279 | [0] = { | ||
280 | .name = "VEU1", | ||
281 | .start = 0xfe924000, | ||
282 | .end = 0xfe9240cb, | ||
283 | .flags = IORESOURCE_MEM, | ||
284 | }, | ||
285 | }; | ||
286 | |||
287 | static struct platform_device veu1_device = { | ||
288 | .name = "uio_pdrv_genirq", | ||
289 | .id = 2, | ||
290 | .dev = { | ||
291 | .platform_data = &veu1_platform_data, | ||
292 | }, | ||
293 | .resource = veu1_resources, | ||
294 | .num_resources = ARRAY_SIZE(veu1_resources), | ||
295 | }; | ||
296 | |||
297 | /* VEU2 */ | ||
298 | static struct uio_info veu2_platform_data = { | ||
299 | .name = "VEU2", | ||
300 | .version = "0", | ||
301 | .irq = intcs_evt2irq(0x740), | ||
302 | }; | ||
303 | |||
304 | static struct resource veu2_resources[] = { | ||
305 | [0] = { | ||
306 | .name = "VEU2", | ||
307 | .start = 0xfe928000, | ||
308 | .end = 0xfe928307, | ||
309 | .flags = IORESOURCE_MEM, | ||
310 | }, | ||
311 | }; | ||
312 | |||
313 | static struct platform_device veu2_device = { | ||
314 | .name = "uio_pdrv_genirq", | ||
315 | .id = 3, | ||
316 | .dev = { | ||
317 | .platform_data = &veu2_platform_data, | ||
318 | }, | ||
319 | .resource = veu2_resources, | ||
320 | .num_resources = ARRAY_SIZE(veu2_resources), | ||
321 | }; | ||
322 | |||
323 | /* VEU3 */ | ||
324 | static struct uio_info veu3_platform_data = { | ||
325 | .name = "VEU3", | ||
326 | .version = "0", | ||
327 | .irq = intcs_evt2irq(0x760), | ||
328 | }; | ||
329 | |||
330 | static struct resource veu3_resources[] = { | ||
331 | [0] = { | ||
332 | .name = "VEU3", | ||
333 | .start = 0xfe92c000, | ||
334 | .end = 0xfe92c307, | ||
335 | .flags = IORESOURCE_MEM, | ||
336 | }, | ||
337 | }; | ||
338 | |||
339 | static struct platform_device veu3_device = { | ||
340 | .name = "uio_pdrv_genirq", | ||
341 | .id = 4, | ||
342 | .dev = { | ||
343 | .platform_data = &veu3_platform_data, | ||
344 | }, | ||
345 | .resource = veu3_resources, | ||
346 | .num_resources = ARRAY_SIZE(veu3_resources), | ||
347 | }; | ||
348 | |||
349 | /* JPU */ | ||
350 | static struct uio_info jpu_platform_data = { | ||
351 | .name = "JPU", | ||
352 | .version = "0", | ||
353 | .irq = intcs_evt2irq(0x560), | ||
354 | }; | ||
355 | |||
356 | static struct resource jpu_resources[] = { | ||
357 | [0] = { | ||
358 | .name = "JPU", | ||
359 | .start = 0xfe980000, | ||
360 | .end = 0xfe9902d3, | ||
361 | .flags = IORESOURCE_MEM, | ||
362 | }, | ||
363 | }; | ||
364 | |||
365 | static struct platform_device jpu_device = { | ||
366 | .name = "uio_pdrv_genirq", | ||
367 | .id = 5, | ||
368 | .dev = { | ||
369 | .platform_data = &jpu_platform_data, | ||
370 | }, | ||
371 | .resource = jpu_resources, | ||
372 | .num_resources = ARRAY_SIZE(jpu_resources), | ||
373 | }; | ||
374 | |||
375 | /* SPU2DSP0 */ | ||
376 | static struct uio_info spu0_platform_data = { | ||
377 | .name = "SPU2DSP0", | ||
378 | .version = "0", | ||
379 | .irq = evt2irq(0x1800), | ||
380 | }; | ||
381 | |||
382 | static struct resource spu0_resources[] = { | ||
383 | [0] = { | ||
384 | .name = "SPU2DSP0", | ||
385 | .start = 0xfe200000, | ||
386 | .end = 0xfe2fffff, | ||
387 | .flags = IORESOURCE_MEM, | ||
388 | }, | ||
389 | }; | ||
390 | |||
391 | static struct platform_device spu0_device = { | ||
392 | .name = "uio_pdrv_genirq", | ||
393 | .id = 6, | ||
394 | .dev = { | ||
395 | .platform_data = &spu0_platform_data, | ||
396 | }, | ||
397 | .resource = spu0_resources, | ||
398 | .num_resources = ARRAY_SIZE(spu0_resources), | ||
399 | }; | ||
400 | |||
401 | /* SPU2DSP1 */ | ||
402 | static struct uio_info spu1_platform_data = { | ||
403 | .name = "SPU2DSP1", | ||
404 | .version = "0", | ||
405 | .irq = evt2irq(0x1820), | ||
406 | }; | ||
407 | |||
408 | static struct resource spu1_resources[] = { | ||
409 | [0] = { | ||
410 | .name = "SPU2DSP1", | ||
411 | .start = 0xfe300000, | ||
412 | .end = 0xfe3fffff, | ||
413 | .flags = IORESOURCE_MEM, | ||
414 | }, | ||
415 | }; | ||
416 | |||
417 | static struct platform_device spu1_device = { | ||
418 | .name = "uio_pdrv_genirq", | ||
419 | .id = 7, | ||
420 | .dev = { | ||
421 | .platform_data = &spu1_platform_data, | ||
422 | }, | ||
423 | .resource = spu1_resources, | ||
424 | .num_resources = ARRAY_SIZE(spu1_resources), | ||
425 | }; | ||
426 | |||
218 | static struct platform_device *sh7377_early_devices[] __initdata = { | 427 | static struct platform_device *sh7377_early_devices[] __initdata = { |
219 | &scif0_device, | 428 | &scif0_device, |
220 | &scif1_device, | 429 | &scif1_device, |
@@ -227,10 +436,24 @@ static struct platform_device *sh7377_early_devices[] __initdata = { | |||
227 | &cmt10_device, | 436 | &cmt10_device, |
228 | }; | 437 | }; |
229 | 438 | ||
439 | static struct platform_device *sh7377_devices[] __initdata = { | ||
440 | &vpu_device, | ||
441 | &veu0_device, | ||
442 | &veu1_device, | ||
443 | &veu2_device, | ||
444 | &veu3_device, | ||
445 | &jpu_device, | ||
446 | &spu0_device, | ||
447 | &spu1_device, | ||
448 | }; | ||
449 | |||
230 | void __init sh7377_add_standard_devices(void) | 450 | void __init sh7377_add_standard_devices(void) |
231 | { | 451 | { |
232 | platform_add_devices(sh7377_early_devices, | 452 | platform_add_devices(sh7377_early_devices, |
233 | ARRAY_SIZE(sh7377_early_devices)); | 453 | ARRAY_SIZE(sh7377_early_devices)); |
454 | |||
455 | platform_add_devices(sh7377_devices, | ||
456 | ARRAY_SIZE(sh7377_devices)); | ||
234 | } | 457 | } |
235 | 458 | ||
236 | #define SMSTPCR3 0xe615013c | 459 | #define SMSTPCR3 0xe615013c |
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index 685c40a2f5e6..e46821c0a62e 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -27,9 +27,11 @@ | |||
27 | #include <linux/input.h> | 27 | #include <linux/input.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/serial_sci.h> | 29 | #include <linux/serial_sci.h> |
30 | #include <linux/sh_dma.h> | ||
30 | #include <linux/sh_intc.h> | 31 | #include <linux/sh_intc.h> |
31 | #include <linux/sh_timer.h> | 32 | #include <linux/sh_timer.h> |
32 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
34 | #include <mach/sh73a0.h> | ||
33 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
34 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
35 | 37 | ||
@@ -392,6 +394,242 @@ static struct platform_device i2c4_device = { | |||
392 | .num_resources = ARRAY_SIZE(i2c4_resources), | 394 | .num_resources = ARRAY_SIZE(i2c4_resources), |
393 | }; | 395 | }; |
394 | 396 | ||
397 | /* Transmit sizes and respective CHCR register values */ | ||
398 | enum { | ||
399 | XMIT_SZ_8BIT = 0, | ||
400 | XMIT_SZ_16BIT = 1, | ||
401 | XMIT_SZ_32BIT = 2, | ||
402 | XMIT_SZ_64BIT = 7, | ||
403 | XMIT_SZ_128BIT = 3, | ||
404 | XMIT_SZ_256BIT = 4, | ||
405 | XMIT_SZ_512BIT = 5, | ||
406 | }; | ||
407 | |||
408 | /* log2(size / 8) - used to calculate number of transfers */ | ||
409 | #define TS_SHIFT { \ | ||
410 | [XMIT_SZ_8BIT] = 0, \ | ||
411 | [XMIT_SZ_16BIT] = 1, \ | ||
412 | [XMIT_SZ_32BIT] = 2, \ | ||
413 | [XMIT_SZ_64BIT] = 3, \ | ||
414 | [XMIT_SZ_128BIT] = 4, \ | ||
415 | [XMIT_SZ_256BIT] = 5, \ | ||
416 | [XMIT_SZ_512BIT] = 6, \ | ||
417 | } | ||
418 | |||
419 | #define TS_INDEX2VAL(i) ((((i) & 3) << 3) | (((i) & 0xc) << (20 - 2))) | ||
420 | #define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL((xmit_sz))) | ||
421 | #define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL((xmit_sz))) | ||
422 | |||
423 | static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = { | ||
424 | { | ||
425 | .slave_id = SHDMA_SLAVE_SCIF0_TX, | ||
426 | .addr = 0xe6c40020, | ||
427 | .chcr = CHCR_TX(XMIT_SZ_8BIT), | ||
428 | .mid_rid = 0x21, | ||
429 | }, { | ||
430 | .slave_id = SHDMA_SLAVE_SCIF0_RX, | ||
431 | .addr = 0xe6c40024, | ||
432 | .chcr = CHCR_RX(XMIT_SZ_8BIT), | ||
433 | .mid_rid = 0x22, | ||
434 | }, { | ||
435 | .slave_id = SHDMA_SLAVE_SCIF1_TX, | ||
436 | .addr = 0xe6c50020, | ||
437 | .chcr = CHCR_TX(XMIT_SZ_8BIT), | ||
438 | .mid_rid = 0x25, | ||
439 | }, { | ||
440 | .slave_id = SHDMA_SLAVE_SCIF1_RX, | ||
441 | .addr = 0xe6c50024, | ||
442 | .chcr = CHCR_RX(XMIT_SZ_8BIT), | ||
443 | .mid_rid = 0x26, | ||
444 | }, { | ||
445 | .slave_id = SHDMA_SLAVE_SCIF2_TX, | ||
446 | .addr = 0xe6c60020, | ||
447 | .chcr = CHCR_TX(XMIT_SZ_8BIT), | ||
448 | .mid_rid = 0x29, | ||
449 | }, { | ||
450 | .slave_id = SHDMA_SLAVE_SCIF2_RX, | ||
451 | .addr = 0xe6c60024, | ||
452 | .chcr = CHCR_RX(XMIT_SZ_8BIT), | ||
453 | .mid_rid = 0x2a, | ||
454 | }, { | ||
455 | .slave_id = SHDMA_SLAVE_SCIF3_TX, | ||
456 | .addr = 0xe6c70020, | ||
457 | .chcr = CHCR_TX(XMIT_SZ_8BIT), | ||
458 | .mid_rid = 0x2d, | ||
459 | }, { | ||
460 | .slave_id = SHDMA_SLAVE_SCIF3_RX, | ||
461 | .addr = 0xe6c70024, | ||
462 | .chcr = CHCR_RX(XMIT_SZ_8BIT), | ||
463 | .mid_rid = 0x2e, | ||
464 | }, { | ||
465 | .slave_id = SHDMA_SLAVE_SCIF4_TX, | ||
466 | .addr = 0xe6c80020, | ||
467 | .chcr = CHCR_TX(XMIT_SZ_8BIT), | ||
468 | .mid_rid = 0x39, | ||
469 | }, { | ||
470 | .slave_id = SHDMA_SLAVE_SCIF4_RX, | ||
471 | .addr = 0xe6c80024, | ||
472 | .chcr = CHCR_RX(XMIT_SZ_8BIT), | ||
473 | .mid_rid = 0x3a, | ||
474 | }, { | ||
475 | .slave_id = SHDMA_SLAVE_SCIF5_TX, | ||
476 | .addr = 0xe6cb0020, | ||
477 | .chcr = CHCR_TX(XMIT_SZ_8BIT), | ||
478 | .mid_rid = 0x35, | ||
479 | }, { | ||
480 | .slave_id = SHDMA_SLAVE_SCIF5_RX, | ||
481 | .addr = 0xe6cb0024, | ||
482 | .chcr = CHCR_RX(XMIT_SZ_8BIT), | ||
483 | .mid_rid = 0x36, | ||
484 | }, { | ||
485 | .slave_id = SHDMA_SLAVE_SCIF6_TX, | ||
486 | .addr = 0xe6cc0020, | ||
487 | .chcr = CHCR_TX(XMIT_SZ_8BIT), | ||
488 | .mid_rid = 0x1d, | ||
489 | }, { | ||
490 | .slave_id = SHDMA_SLAVE_SCIF6_RX, | ||
491 | .addr = 0xe6cc0024, | ||
492 | .chcr = CHCR_RX(XMIT_SZ_8BIT), | ||
493 | .mid_rid = 0x1e, | ||
494 | }, { | ||
495 | .slave_id = SHDMA_SLAVE_SCIF7_TX, | ||
496 | .addr = 0xe6cd0020, | ||
497 | .chcr = CHCR_TX(XMIT_SZ_8BIT), | ||
498 | .mid_rid = 0x19, | ||
499 | }, { | ||
500 | .slave_id = SHDMA_SLAVE_SCIF7_RX, | ||
501 | .addr = 0xe6cd0024, | ||
502 | .chcr = CHCR_RX(XMIT_SZ_8BIT), | ||
503 | .mid_rid = 0x1a, | ||
504 | }, { | ||
505 | .slave_id = SHDMA_SLAVE_SCIF8_TX, | ||
506 | .addr = 0xe6c30040, | ||
507 | .chcr = CHCR_TX(XMIT_SZ_8BIT), | ||
508 | .mid_rid = 0x3d, | ||
509 | }, { | ||
510 | .slave_id = SHDMA_SLAVE_SCIF8_RX, | ||
511 | .addr = 0xe6c30060, | ||
512 | .chcr = CHCR_RX(XMIT_SZ_8BIT), | ||
513 | .mid_rid = 0x3e, | ||
514 | }, { | ||
515 | .slave_id = SHDMA_SLAVE_SDHI0_TX, | ||
516 | .addr = 0xee100030, | ||
517 | .chcr = CHCR_TX(XMIT_SZ_16BIT), | ||
518 | .mid_rid = 0xc1, | ||
519 | }, { | ||
520 | .slave_id = SHDMA_SLAVE_SDHI0_RX, | ||
521 | .addr = 0xee100030, | ||
522 | .chcr = CHCR_RX(XMIT_SZ_16BIT), | ||
523 | .mid_rid = 0xc2, | ||
524 | }, { | ||
525 | .slave_id = SHDMA_SLAVE_SDHI1_TX, | ||
526 | .addr = 0xee120030, | ||
527 | .chcr = CHCR_TX(XMIT_SZ_16BIT), | ||
528 | .mid_rid = 0xc9, | ||
529 | }, { | ||
530 | .slave_id = SHDMA_SLAVE_SDHI1_RX, | ||
531 | .addr = 0xee120030, | ||
532 | .chcr = CHCR_RX(XMIT_SZ_16BIT), | ||
533 | .mid_rid = 0xca, | ||
534 | }, { | ||
535 | .slave_id = SHDMA_SLAVE_SDHI2_TX, | ||
536 | .addr = 0xee140030, | ||
537 | .chcr = CHCR_TX(XMIT_SZ_16BIT), | ||
538 | .mid_rid = 0xcd, | ||
539 | }, { | ||
540 | .slave_id = SHDMA_SLAVE_SDHI2_RX, | ||
541 | .addr = 0xee140030, | ||
542 | .chcr = CHCR_RX(XMIT_SZ_16BIT), | ||
543 | .mid_rid = 0xce, | ||
544 | }, { | ||
545 | .slave_id = SHDMA_SLAVE_MMCIF_TX, | ||
546 | .addr = 0xe6bd0034, | ||
547 | .chcr = CHCR_TX(XMIT_SZ_32BIT), | ||
548 | .mid_rid = 0xd1, | ||
549 | }, { | ||
550 | .slave_id = SHDMA_SLAVE_MMCIF_RX, | ||
551 | .addr = 0xe6bd0034, | ||
552 | .chcr = CHCR_RX(XMIT_SZ_32BIT), | ||
553 | .mid_rid = 0xd2, | ||
554 | }, | ||
555 | }; | ||
556 | |||
557 | #define DMAE_CHANNEL(_offset) \ | ||
558 | { \ | ||
559 | .offset = _offset - 0x20, \ | ||
560 | .dmars = _offset - 0x20 + 0x40, \ | ||
561 | } | ||
562 | |||
563 | static const struct sh_dmae_channel sh73a0_dmae_channels[] = { | ||
564 | DMAE_CHANNEL(0x8000), | ||
565 | DMAE_CHANNEL(0x8080), | ||
566 | DMAE_CHANNEL(0x8100), | ||
567 | DMAE_CHANNEL(0x8180), | ||
568 | DMAE_CHANNEL(0x8200), | ||
569 | DMAE_CHANNEL(0x8280), | ||
570 | DMAE_CHANNEL(0x8300), | ||
571 | DMAE_CHANNEL(0x8380), | ||
572 | DMAE_CHANNEL(0x8400), | ||
573 | DMAE_CHANNEL(0x8480), | ||
574 | DMAE_CHANNEL(0x8500), | ||
575 | DMAE_CHANNEL(0x8580), | ||
576 | DMAE_CHANNEL(0x8600), | ||
577 | DMAE_CHANNEL(0x8680), | ||
578 | DMAE_CHANNEL(0x8700), | ||
579 | DMAE_CHANNEL(0x8780), | ||
580 | DMAE_CHANNEL(0x8800), | ||
581 | DMAE_CHANNEL(0x8880), | ||
582 | DMAE_CHANNEL(0x8900), | ||
583 | DMAE_CHANNEL(0x8980), | ||
584 | }; | ||
585 | |||
586 | static const unsigned int ts_shift[] = TS_SHIFT; | ||
587 | |||
588 | static struct sh_dmae_pdata sh73a0_dmae_platform_data = { | ||
589 | .slave = sh73a0_dmae_slaves, | ||
590 | .slave_num = ARRAY_SIZE(sh73a0_dmae_slaves), | ||
591 | .channel = sh73a0_dmae_channels, | ||
592 | .channel_num = ARRAY_SIZE(sh73a0_dmae_channels), | ||
593 | .ts_low_shift = 3, | ||
594 | .ts_low_mask = 0x18, | ||
595 | .ts_high_shift = (20 - 2), /* 2 bits for shifted low TS */ | ||
596 | .ts_high_mask = 0x00300000, | ||
597 | .ts_shift = ts_shift, | ||
598 | .ts_shift_num = ARRAY_SIZE(ts_shift), | ||
599 | .dmaor_init = DMAOR_DME, | ||
600 | }; | ||
601 | |||
602 | static struct resource sh73a0_dmae_resources[] = { | ||
603 | { | ||
604 | /* Registers including DMAOR and channels including DMARSx */ | ||
605 | .start = 0xfe000020, | ||
606 | .end = 0xfe008a00 - 1, | ||
607 | .flags = IORESOURCE_MEM, | ||
608 | }, | ||
609 | { | ||
610 | /* DMA error IRQ */ | ||
611 | .start = gic_spi(129), | ||
612 | .end = gic_spi(129), | ||
613 | .flags = IORESOURCE_IRQ, | ||
614 | }, | ||
615 | { | ||
616 | /* IRQ for channels 0-19 */ | ||
617 | .start = gic_spi(109), | ||
618 | .end = gic_spi(128), | ||
619 | .flags = IORESOURCE_IRQ, | ||
620 | }, | ||
621 | }; | ||
622 | |||
623 | static struct platform_device dma0_device = { | ||
624 | .name = "sh-dma-engine", | ||
625 | .id = 0, | ||
626 | .resource = sh73a0_dmae_resources, | ||
627 | .num_resources = ARRAY_SIZE(sh73a0_dmae_resources), | ||
628 | .dev = { | ||
629 | .platform_data = &sh73a0_dmae_platform_data, | ||
630 | }, | ||
631 | }; | ||
632 | |||
395 | static struct platform_device *sh73a0_early_devices[] __initdata = { | 633 | static struct platform_device *sh73a0_early_devices[] __initdata = { |
396 | &scif0_device, | 634 | &scif0_device, |
397 | &scif1_device, | 635 | &scif1_device, |
@@ -413,10 +651,16 @@ static struct platform_device *sh73a0_late_devices[] __initdata = { | |||
413 | &i2c2_device, | 651 | &i2c2_device, |
414 | &i2c3_device, | 652 | &i2c3_device, |
415 | &i2c4_device, | 653 | &i2c4_device, |
654 | &dma0_device, | ||
416 | }; | 655 | }; |
417 | 656 | ||
657 | #define SRCR2 0xe61580b0 | ||
658 | |||
418 | void __init sh73a0_add_standard_devices(void) | 659 | void __init sh73a0_add_standard_devices(void) |
419 | { | 660 | { |
661 | /* Clear software reset bit on SY-DMAC module */ | ||
662 | __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2); | ||
663 | |||
420 | platform_add_devices(sh73a0_early_devices, | 664 | platform_add_devices(sh73a0_early_devices, |
421 | ARRAY_SIZE(sh73a0_early_devices)); | 665 | ARRAY_SIZE(sh73a0_early_devices)); |
422 | platform_add_devices(sh73a0_late_devices, | 666 | platform_add_devices(sh73a0_late_devices, |
diff --git a/arch/arm/mach-shmobile/sleep-sh7372.S b/arch/arm/mach-shmobile/sleep-sh7372.S new file mode 100644 index 000000000000..d37d3ca4d18f --- /dev/null +++ b/arch/arm/mach-shmobile/sleep-sh7372.S | |||
@@ -0,0 +1,260 @@ | |||
1 | /* | ||
2 | * sh7372 lowlevel sleep code for "Core Standby Mode" | ||
3 | * | ||
4 | * Copyright (C) 2011 Magnus Damm | ||
5 | * | ||
6 | * In "Core Standby Mode" the ARM core is off, but L2 cache is still on | ||
7 | * | ||
8 | * Based on mach-omap2/sleep34xx.S | ||
9 | * | ||
10 | * (C) Copyright 2007 Texas Instruments | ||
11 | * Karthik Dasu <karthik-dp@ti.com> | ||
12 | * | ||
13 | * (C) Copyright 2004 Texas Instruments, <www.ti.com> | ||
14 | * Richard Woodruff <r-woodruff2@ti.com> | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or | ||
17 | * modify it under the terms of the GNU General Public License as | ||
18 | * published by the Free Software Foundation; either version 2 of | ||
19 | * the License, or (at your option) any later version. | ||
20 | * | ||
21 | * This program is distributed in the hope that it will be useful, | ||
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the | ||
24 | * GNU General Public License for more details. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License | ||
27 | * along with this program; if not, write to the Free Software | ||
28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
29 | * MA 02111-1307 USA | ||
30 | */ | ||
31 | |||
32 | #include <linux/linkage.h> | ||
33 | #include <asm/assembler.h> | ||
34 | |||
35 | #define SMFRAM 0xe6a70000 | ||
36 | |||
37 | .align | ||
38 | kernel_flush: | ||
39 | .word v7_flush_dcache_all | ||
40 | |||
41 | .align 3 | ||
42 | ENTRY(sh7372_cpu_suspend) | ||
43 | stmfd sp!, {r0-r12, lr} @ save registers on stack | ||
44 | |||
45 | ldr r8, =SMFRAM | ||
46 | |||
47 | mov r4, sp @ Store sp | ||
48 | mrs r5, spsr @ Store spsr | ||
49 | mov r6, lr @ Store lr | ||
50 | stmia r8!, {r4-r6} | ||
51 | |||
52 | mrc p15, 0, r4, c1, c0, 2 @ Coprocessor access control register | ||
53 | mrc p15, 0, r5, c2, c0, 0 @ TTBR0 | ||
54 | mrc p15, 0, r6, c2, c0, 1 @ TTBR1 | ||
55 | mrc p15, 0, r7, c2, c0, 2 @ TTBCR | ||
56 | stmia r8!, {r4-r7} | ||
57 | |||
58 | mrc p15, 0, r4, c3, c0, 0 @ Domain access Control Register | ||
59 | mrc p15, 0, r5, c10, c2, 0 @ PRRR | ||
60 | mrc p15, 0, r6, c10, c2, 1 @ NMRR | ||
61 | stmia r8!,{r4-r6} | ||
62 | |||
63 | mrc p15, 0, r4, c13, c0, 1 @ Context ID | ||
64 | mrc p15, 0, r5, c13, c0, 2 @ User r/w thread and process ID | ||
65 | mrc p15, 0, r6, c12, c0, 0 @ Secure or NS vector base address | ||
66 | mrs r7, cpsr @ Store current cpsr | ||
67 | stmia r8!, {r4-r7} | ||
68 | |||
69 | mrc p15, 0, r4, c1, c0, 0 @ save control register | ||
70 | stmia r8!, {r4} | ||
71 | |||
72 | /* | ||
73 | * jump out to kernel flush routine | ||
74 | * - reuse that code is better | ||
75 | * - it executes in a cached space so is faster than refetch per-block | ||
76 | * - should be faster and will change with kernel | ||
77 | * - 'might' have to copy address, load and jump to it | ||
78 | * Flush all data from the L1 data cache before disabling | ||
79 | * SCTLR.C bit. | ||
80 | */ | ||
81 | ldr r1, kernel_flush | ||
82 | mov lr, pc | ||
83 | bx r1 | ||
84 | |||
85 | /* | ||
86 | * Clear the SCTLR.C bit to prevent further data cache | ||
87 | * allocation. Clearing SCTLR.C would make all the data accesses | ||
88 | * strongly ordered and would not hit the cache. | ||
89 | */ | ||
90 | mrc p15, 0, r0, c1, c0, 0 | ||
91 | bic r0, r0, #(1 << 2) @ Disable the C bit | ||
92 | mcr p15, 0, r0, c1, c0, 0 | ||
93 | isb | ||
94 | |||
95 | /* | ||
96 | * Invalidate L1 data cache. Even though only invalidate is | ||
97 | * necessary exported flush API is used here. Doing clean | ||
98 | * on already clean cache would be almost NOP. | ||
99 | */ | ||
100 | ldr r1, kernel_flush | ||
101 | blx r1 | ||
102 | /* | ||
103 | * The kernel doesn't interwork: v7_flush_dcache_all in particluar will | ||
104 | * always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled. | ||
105 | * This sequence switches back to ARM. Note that .align may insert a | ||
106 | * nop: bx pc needs to be word-aligned in order to work. | ||
107 | */ | ||
108 | THUMB( .thumb ) | ||
109 | THUMB( .align ) | ||
110 | THUMB( bx pc ) | ||
111 | THUMB( nop ) | ||
112 | .arm | ||
113 | |||
114 | /* Data memory barrier and Data sync barrier */ | ||
115 | dsb | ||
116 | dmb | ||
117 | |||
118 | /* | ||
119 | * =================================== | ||
120 | * == WFI instruction => Enter idle == | ||
121 | * =================================== | ||
122 | */ | ||
123 | wfi @ wait for interrupt | ||
124 | |||
125 | /* | ||
126 | * =================================== | ||
127 | * == Resume path for non-OFF modes == | ||
128 | * =================================== | ||
129 | */ | ||
130 | mrc p15, 0, r0, c1, c0, 0 | ||
131 | tst r0, #(1 << 2) @ Check C bit enabled? | ||
132 | orreq r0, r0, #(1 << 2) @ Enable the C bit if cleared | ||
133 | mcreq p15, 0, r0, c1, c0, 0 | ||
134 | isb | ||
135 | |||
136 | /* | ||
137 | * =================================== | ||
138 | * == Exit point from non-OFF modes == | ||
139 | * =================================== | ||
140 | */ | ||
141 | ldmfd sp!, {r0-r12, pc} @ restore regs and return | ||
142 | |||
143 | .pool | ||
144 | |||
145 | .align 12 | ||
146 | .text | ||
147 | .global sh7372_cpu_resume | ||
148 | sh7372_cpu_resume: | ||
149 | |||
150 | mov r1, #0 | ||
151 | /* | ||
152 | * Invalidate all instruction caches to PoU | ||
153 | * and flush branch target cache | ||
154 | */ | ||
155 | mcr p15, 0, r1, c7, c5, 0 | ||
156 | |||
157 | ldr r3, =SMFRAM | ||
158 | |||
159 | ldmia r3!, {r4-r6} | ||
160 | mov sp, r4 @ Restore sp | ||
161 | msr spsr_cxsf, r5 @ Restore spsr | ||
162 | mov lr, r6 @ Restore lr | ||
163 | |||
164 | ldmia r3!, {r4-r7} | ||
165 | mcr p15, 0, r4, c1, c0, 2 @ Coprocessor access Control Register | ||
166 | mcr p15, 0, r5, c2, c0, 0 @ TTBR0 | ||
167 | mcr p15, 0, r6, c2, c0, 1 @ TTBR1 | ||
168 | mcr p15, 0, r7, c2, c0, 2 @ TTBCR | ||
169 | |||
170 | ldmia r3!,{r4-r6} | ||
171 | mcr p15, 0, r4, c3, c0, 0 @ Domain access Control Register | ||
172 | mcr p15, 0, r5, c10, c2, 0 @ PRRR | ||
173 | mcr p15, 0, r6, c10, c2, 1 @ NMRR | ||
174 | |||
175 | ldmia r3!,{r4-r7} | ||
176 | mcr p15, 0, r4, c13, c0, 1 @ Context ID | ||
177 | mcr p15, 0, r5, c13, c0, 2 @ User r/w thread and process ID | ||
178 | mrc p15, 0, r6, c12, c0, 0 @ Secure or NS vector base address | ||
179 | msr cpsr, r7 @ store cpsr | ||
180 | |||
181 | /* Starting to enable MMU here */ | ||
182 | mrc p15, 0, r7, c2, c0, 2 @ Read TTBRControl | ||
183 | /* Extract N (0:2) bits and decide whether to use TTBR0 or TTBR1 */ | ||
184 | and r7, #0x7 | ||
185 | cmp r7, #0x0 | ||
186 | beq usettbr0 | ||
187 | ttbr_error: | ||
188 | /* | ||
189 | * More work needs to be done to support N[0:2] value other than 0 | ||
190 | * So looping here so that the error can be detected | ||
191 | */ | ||
192 | b ttbr_error | ||
193 | |||
194 | .align | ||
195 | cache_pred_disable_mask: | ||
196 | .word 0xFFFFE7FB | ||
197 | ttbrbit_mask: | ||
198 | .word 0xFFFFC000 | ||
199 | table_index_mask: | ||
200 | .word 0xFFF00000 | ||
201 | table_entry: | ||
202 | .word 0x00000C02 | ||
203 | usettbr0: | ||
204 | |||
205 | mrc p15, 0, r2, c2, c0, 0 | ||
206 | ldr r5, ttbrbit_mask | ||
207 | and r2, r5 | ||
208 | mov r4, pc | ||
209 | ldr r5, table_index_mask | ||
210 | and r4, r5 @ r4 = 31 to 20 bits of pc | ||
211 | /* Extract the value to be written to table entry */ | ||
212 | ldr r6, table_entry | ||
213 | /* r6 has the value to be written to table entry */ | ||
214 | add r6, r6, r4 | ||
215 | /* Getting the address of table entry to modify */ | ||
216 | lsr r4, #18 | ||
217 | /* r2 has the location which needs to be modified */ | ||
218 | add r2, r4 | ||
219 | ldr r4, [r2] | ||
220 | str r6, [r2] /* modify the table entry */ | ||
221 | |||
222 | mov r7, r6 | ||
223 | mov r5, r2 | ||
224 | mov r6, r4 | ||
225 | /* r5 = original page table address */ | ||
226 | /* r6 = original page table data */ | ||
227 | |||
228 | mov r0, #0 | ||
229 | mcr p15, 0, r0, c7, c5, 4 @ Flush prefetch buffer | ||
230 | mcr p15, 0, r0, c7, c5, 6 @ Invalidate branch predictor array | ||
231 | mcr p15, 0, r0, c8, c5, 0 @ Invalidate instruction TLB | ||
232 | mcr p15, 0, r0, c8, c6, 0 @ Invalidate data TLB | ||
233 | |||
234 | /* | ||
235 | * Restore control register. This enables the MMU. | ||
236 | * The caches and prediction are not enabled here, they | ||
237 | * will be enabled after restoring the MMU table entry. | ||
238 | */ | ||
239 | ldmia r3!, {r4} | ||
240 | stmia r3!, {r5} /* save original page table address */ | ||
241 | stmia r3!, {r6} /* save original page table data */ | ||
242 | stmia r3!, {r7} /* save modified page table data */ | ||
243 | |||
244 | ldr r2, cache_pred_disable_mask | ||
245 | and r4, r2 | ||
246 | mcr p15, 0, r4, c1, c0, 0 | ||
247 | dsb | ||
248 | isb | ||
249 | |||
250 | ldr r0, =restoremmu_on | ||
251 | bx r0 | ||
252 | |||
253 | /* | ||
254 | * ============================== | ||
255 | * == Exit point from OFF mode == | ||
256 | * ============================== | ||
257 | */ | ||
258 | restoremmu_on: | ||
259 | |||
260 | ldmfd sp!, {r0-r12, pc} @ restore regs and return | ||
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c index a156d2108df1..3ffdbc92ba82 100644 --- a/arch/arm/mach-shmobile/smp-sh73a0.c +++ b/arch/arm/mach-shmobile/smp-sh73a0.c | |||
@@ -59,6 +59,11 @@ unsigned int __init sh73a0_get_core_count(void) | |||
59 | { | 59 | { |
60 | void __iomem *scu_base = scu_base_addr(); | 60 | void __iomem *scu_base = scu_base_addr(); |
61 | 61 | ||
62 | #ifdef CONFIG_HAVE_ARM_TWD | ||
63 | /* twd_base needs to be initialized before percpu_timer_setup() */ | ||
64 | twd_base = (void __iomem *)0xf0000600; | ||
65 | #endif | ||
66 | |||
62 | return scu_get_core_count(scu_base); | 67 | return scu_get_core_count(scu_base); |
63 | } | 68 | } |
64 | 69 | ||
@@ -82,10 +87,6 @@ int __cpuinit sh73a0_boot_secondary(unsigned int cpu) | |||
82 | 87 | ||
83 | void __init sh73a0_smp_prepare_cpus(void) | 88 | void __init sh73a0_smp_prepare_cpus(void) |
84 | { | 89 | { |
85 | #ifdef CONFIG_HAVE_ARM_TWD | ||
86 | twd_base = (void __iomem *)0xf0000600; | ||
87 | #endif | ||
88 | |||
89 | scu_enable(scu_base_addr()); | 90 | scu_enable(scu_base_addr()); |
90 | 91 | ||
91 | /* Map the reset vector (in headsmp.S) */ | 92 | /* Map the reset vector (in headsmp.S) */ |
diff --git a/arch/arm/mach-shmobile/suspend.c b/arch/arm/mach-shmobile/suspend.c new file mode 100644 index 000000000000..c1febe13f709 --- /dev/null +++ b/arch/arm/mach-shmobile/suspend.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Suspend-to-RAM support code for SH-Mobile ARM | ||
3 | * | ||
4 | * Copyright (C) 2011 Magnus Damm | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/pm.h> | ||
12 | #include <linux/suspend.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <asm/system.h> | ||
16 | #include <asm/io.h> | ||
17 | |||
18 | static int shmobile_suspend_default_enter(suspend_state_t suspend_state) | ||
19 | { | ||
20 | cpu_do_idle(); | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | static int shmobile_suspend_begin(suspend_state_t state) | ||
25 | { | ||
26 | disable_hlt(); | ||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static void shmobile_suspend_end(void) | ||
31 | { | ||
32 | enable_hlt(); | ||
33 | } | ||
34 | |||
35 | struct platform_suspend_ops shmobile_suspend_ops = { | ||
36 | .begin = shmobile_suspend_begin, | ||
37 | .end = shmobile_suspend_end, | ||
38 | .enter = shmobile_suspend_default_enter, | ||
39 | .valid = suspend_valid_only_mem, | ||
40 | }; | ||
41 | |||
42 | static int __init shmobile_suspend_init(void) | ||
43 | { | ||
44 | suspend_set_ops(&shmobile_suspend_ops); | ||
45 | return 0; | ||
46 | } | ||
47 | late_initcall(shmobile_suspend_init); | ||
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index 58626013aa32..54429d015954 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig | |||
@@ -12,9 +12,12 @@ menu "Ux500 SoC" | |||
12 | 12 | ||
13 | config UX500_SOC_DB5500 | 13 | config UX500_SOC_DB5500 |
14 | bool "DB5500" | 14 | bool "DB5500" |
15 | select MFD_DB5500_PRCMU | ||
15 | 16 | ||
16 | config UX500_SOC_DB8500 | 17 | config UX500_SOC_DB8500 |
17 | bool "DB8500" | 18 | bool "DB8500" |
19 | select MFD_DB8500_PRCMU | ||
20 | select REGULATOR_DB8500_PRCMU | ||
18 | 21 | ||
19 | endmenu | 22 | endmenu |
20 | 23 | ||
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index b549a8fb4231..1694916e6822 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | obj-y := clock.o cpu.o devices.o devices-common.o \ | 5 | obj-y := clock.o cpu.o devices.o devices-common.o \ |
6 | id.o usb.o | 6 | id.o usb.o |
7 | obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o | 7 | obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o |
8 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o prcmu.o | 8 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o |
9 | obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \ | 9 | obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \ |
10 | board-mop500-regulators.o \ | 10 | board-mop500-regulators.o \ |
11 | board-mop500-uib.o board-mop500-stuib.o \ | 11 | board-mop500-uib.o board-mop500-stuib.o \ |
@@ -17,4 +17,4 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | |||
17 | obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o | 17 | obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o |
18 | obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o | 18 | obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o |
19 | obj-$(CONFIG_U5500_MBOX) += mbox-db5500.o | 19 | obj-$(CONFIG_U5500_MBOX) += mbox-db5500.o |
20 | obj-$(CONFIG_CPU_FREQ) += cpufreq.o | 20 | |
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c index c9dc2eff3cb2..c01bc19e3c5e 100644 --- a/arch/arm/mach-ux500/cpu-db5500.c +++ b/arch/arm/mach-ux500/cpu-db5500.c | |||
@@ -188,6 +188,8 @@ void __init u5500_map_io(void) | |||
188 | ux500_map_io(); | 188 | ux500_map_io(); |
189 | 189 | ||
190 | iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc)); | 190 | iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc)); |
191 | |||
192 | _PRCMU_BASE = __io_address(U5500_PRCMU_BASE); | ||
191 | } | 193 | } |
192 | 194 | ||
193 | static int usb_db5500_rx_dma_cfg[] = { | 195 | static int usb_db5500_rx_dma_cfg[] = { |
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 516126cb357d..c3c417656bd9 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c | |||
@@ -87,6 +87,8 @@ void __init u8500_map_io(void) | |||
87 | iotable_init(u8500_v1_io_desc, ARRAY_SIZE(u8500_v1_io_desc)); | 87 | iotable_init(u8500_v1_io_desc, ARRAY_SIZE(u8500_v1_io_desc)); |
88 | else if (cpu_is_u8500v2()) | 88 | else if (cpu_is_u8500v2()) |
89 | iotable_init(u8500_v2_io_desc, ARRAY_SIZE(u8500_v2_io_desc)); | 89 | iotable_init(u8500_v2_io_desc, ARRAY_SIZE(u8500_v2_io_desc)); |
90 | |||
91 | _PRCMU_BASE = __io_address(U8500_PRCMU_BASE); | ||
90 | } | 92 | } |
91 | 93 | ||
92 | static struct resource db8500_pmu_resources[] = { | 94 | static struct resource db8500_pmu_resources[] = { |
@@ -129,9 +131,14 @@ static struct platform_device db8500_pmu_device = { | |||
129 | .dev.platform_data = &db8500_pmu_platdata, | 131 | .dev.platform_data = &db8500_pmu_platdata, |
130 | }; | 132 | }; |
131 | 133 | ||
134 | static struct platform_device db8500_prcmu_device = { | ||
135 | .name = "db8500-prcmu", | ||
136 | }; | ||
137 | |||
132 | static struct platform_device *platform_devs[] __initdata = { | 138 | static struct platform_device *platform_devs[] __initdata = { |
133 | &u8500_dma40_device, | 139 | &u8500_dma40_device, |
134 | &db8500_pmu_device, | 140 | &db8500_pmu_device, |
141 | &db8500_prcmu_device, | ||
135 | }; | 142 | }; |
136 | 143 | ||
137 | static resource_size_t __initdata db8500_gpio_base[] = { | 144 | static resource_size_t __initdata db8500_gpio_base[] = { |
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index 5a43107c6232..1da23bb87c16 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <linux/platform_device.h> | 8 | #include <linux/platform_device.h> |
9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/mfd/db8500-prcmu.h> | ||
12 | #include <linux/mfd/db5500-prcmu.h> | ||
11 | 13 | ||
12 | #include <asm/cacheflush.h> | 14 | #include <asm/cacheflush.h> |
13 | #include <asm/hardware/cache-l2x0.h> | 15 | #include <asm/hardware/cache-l2x0.h> |
@@ -19,10 +21,11 @@ | |||
19 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
20 | #include <mach/setup.h> | 22 | #include <mach/setup.h> |
21 | #include <mach/devices.h> | 23 | #include <mach/devices.h> |
22 | #include <mach/prcmu.h> | ||
23 | 24 | ||
24 | #include "clock.h" | 25 | #include "clock.h" |
25 | 26 | ||
27 | void __iomem *_PRCMU_BASE; | ||
28 | |||
26 | #ifdef CONFIG_CACHE_L2X0 | 29 | #ifdef CONFIG_CACHE_L2X0 |
27 | static void __iomem *l2x0_base; | 30 | static void __iomem *l2x0_base; |
28 | #endif | 31 | #endif |
@@ -47,6 +50,8 @@ void __init ux500_init_irq(void) | |||
47 | * Init clocks here so that they are available for system timer | 50 | * Init clocks here so that they are available for system timer |
48 | * initialization. | 51 | * initialization. |
49 | */ | 52 | */ |
53 | if (cpu_is_u5500()) | ||
54 | db5500_prcmu_early_init(); | ||
50 | if (cpu_is_u8500()) | 55 | if (cpu_is_u8500()) |
51 | prcmu_early_init(); | 56 | prcmu_early_init(); |
52 | clk_init(); | 57 | clk_init(); |
diff --git a/arch/arm/mach-ux500/cpufreq.c b/arch/arm/mach-ux500/cpufreq.c deleted file mode 100644 index 5c5b747f134d..000000000000 --- a/arch/arm/mach-ux500/cpufreq.c +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | /* | ||
2 | * CPU frequency scaling for u8500 | ||
3 | * Inspired by linux/arch/arm/mach-davinci/cpufreq.c | ||
4 | * | ||
5 | * Copyright (C) STMicroelectronics 2009 | ||
6 | * Copyright (C) ST-Ericsson SA 2010 | ||
7 | * | ||
8 | * License Terms: GNU General Public License v2 | ||
9 | * | ||
10 | * Author: Sundar Iyer <sundar.iyer@stericsson.com> | ||
11 | * Author: Martin Persson <martin.persson@stericsson.com> | ||
12 | * Author: Jonas Aaberg <jonas.aberg@stericsson.com> | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/cpufreq.h> | ||
19 | #include <linux/delay.h> | ||
20 | |||
21 | #include <mach/hardware.h> | ||
22 | #include <mach/prcmu.h> | ||
23 | #include <mach/prcmu-defs.h> | ||
24 | |||
25 | #define DRIVER_NAME "cpufreq-u8500" | ||
26 | #define CPUFREQ_NAME "u8500" | ||
27 | |||
28 | static struct device *dev; | ||
29 | |||
30 | static struct cpufreq_frequency_table freq_table[] = { | ||
31 | [0] = { | ||
32 | .index = 0, | ||
33 | .frequency = 200000, | ||
34 | }, | ||
35 | [1] = { | ||
36 | .index = 1, | ||
37 | .frequency = 300000, | ||
38 | }, | ||
39 | [2] = { | ||
40 | .index = 2, | ||
41 | .frequency = 600000, | ||
42 | }, | ||
43 | [3] = { | ||
44 | /* Used for CPU_OPP_MAX, if available */ | ||
45 | .index = 3, | ||
46 | .frequency = CPUFREQ_TABLE_END, | ||
47 | }, | ||
48 | [4] = { | ||
49 | .index = 4, | ||
50 | .frequency = CPUFREQ_TABLE_END, | ||
51 | }, | ||
52 | }; | ||
53 | |||
54 | static enum prcmu_cpu_opp index2opp[] = { | ||
55 | CPU_OPP_EXT_CLK, | ||
56 | CPU_OPP_50, | ||
57 | CPU_OPP_100, | ||
58 | CPU_OPP_MAX | ||
59 | }; | ||
60 | |||
61 | static int u8500_cpufreq_verify_speed(struct cpufreq_policy *policy) | ||
62 | { | ||
63 | return cpufreq_frequency_table_verify(policy, freq_table); | ||
64 | } | ||
65 | |||
66 | static int u8500_cpufreq_target(struct cpufreq_policy *policy, | ||
67 | unsigned int target_freq, | ||
68 | unsigned int relation) | ||
69 | { | ||
70 | struct cpufreq_freqs freqs; | ||
71 | unsigned int index; | ||
72 | int ret = 0; | ||
73 | |||
74 | /* | ||
75 | * Ensure desired rate is within allowed range. Some govenors | ||
76 | * (ondemand) will just pass target_freq=0 to get the minimum. | ||
77 | */ | ||
78 | if (target_freq < policy->cpuinfo.min_freq) | ||
79 | target_freq = policy->cpuinfo.min_freq; | ||
80 | if (target_freq > policy->cpuinfo.max_freq) | ||
81 | target_freq = policy->cpuinfo.max_freq; | ||
82 | |||
83 | ret = cpufreq_frequency_table_target(policy, freq_table, | ||
84 | target_freq, relation, &index); | ||
85 | if (ret < 0) { | ||
86 | dev_err(dev, "Could not look up next frequency\n"); | ||
87 | return ret; | ||
88 | } | ||
89 | |||
90 | freqs.old = policy->cur; | ||
91 | freqs.new = freq_table[index].frequency; | ||
92 | freqs.cpu = policy->cpu; | ||
93 | |||
94 | if (freqs.old == freqs.new) { | ||
95 | dev_dbg(dev, "Current and target frequencies are equal\n"); | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | dev_dbg(dev, "transition: %u --> %u\n", freqs.old, freqs.new); | ||
100 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
101 | |||
102 | ret = prcmu_set_cpu_opp(index2opp[index]); | ||
103 | if (ret < 0) { | ||
104 | dev_err(dev, "Failed to set OPP level\n"); | ||
105 | return ret; | ||
106 | } | ||
107 | |||
108 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
109 | |||
110 | return ret; | ||
111 | } | ||
112 | |||
113 | static unsigned int u8500_cpufreq_getspeed(unsigned int cpu) | ||
114 | { | ||
115 | int i; | ||
116 | |||
117 | for (i = 0; prcmu_get_cpu_opp() != index2opp[i]; i++) | ||
118 | ; | ||
119 | return freq_table[i].frequency; | ||
120 | } | ||
121 | |||
122 | static int __cpuinit u8500_cpu_init(struct cpufreq_policy *policy) | ||
123 | { | ||
124 | int res; | ||
125 | |||
126 | BUILD_BUG_ON(ARRAY_SIZE(index2opp) + 1 != ARRAY_SIZE(freq_table)); | ||
127 | |||
128 | if (cpu_is_u8500v2()) { | ||
129 | freq_table[1].frequency = 400000; | ||
130 | freq_table[2].frequency = 800000; | ||
131 | if (prcmu_has_arm_maxopp()) | ||
132 | freq_table[3].frequency = 1000000; | ||
133 | } | ||
134 | |||
135 | /* get policy fields based on the table */ | ||
136 | res = cpufreq_frequency_table_cpuinfo(policy, freq_table); | ||
137 | if (!res) | ||
138 | cpufreq_frequency_table_get_attr(freq_table, policy->cpu); | ||
139 | else { | ||
140 | dev_err(dev, "u8500-cpufreq : Failed to read policy table\n"); | ||
141 | return res; | ||
142 | } | ||
143 | |||
144 | policy->min = policy->cpuinfo.min_freq; | ||
145 | policy->max = policy->cpuinfo.max_freq; | ||
146 | policy->cur = u8500_cpufreq_getspeed(policy->cpu); | ||
147 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
148 | |||
149 | /* | ||
150 | * FIXME : Need to take time measurement across the target() | ||
151 | * function with no/some/all drivers in the notification | ||
152 | * list. | ||
153 | */ | ||
154 | policy->cpuinfo.transition_latency = 200 * 1000; /* in ns */ | ||
155 | |||
156 | /* policy sharing between dual CPUs */ | ||
157 | cpumask_copy(policy->cpus, &cpu_present_map); | ||
158 | |||
159 | policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; | ||
160 | |||
161 | return res; | ||
162 | } | ||
163 | |||
164 | static struct freq_attr *u8500_cpufreq_attr[] = { | ||
165 | &cpufreq_freq_attr_scaling_available_freqs, | ||
166 | NULL, | ||
167 | }; | ||
168 | static int u8500_cpu_exit(struct cpufreq_policy *policy) | ||
169 | { | ||
170 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | static struct cpufreq_driver u8500_driver = { | ||
175 | .owner = THIS_MODULE, | ||
176 | .flags = CPUFREQ_STICKY, | ||
177 | .verify = u8500_cpufreq_verify_speed, | ||
178 | .target = u8500_cpufreq_target, | ||
179 | .get = u8500_cpufreq_getspeed, | ||
180 | .init = u8500_cpu_init, | ||
181 | .exit = u8500_cpu_exit, | ||
182 | .name = CPUFREQ_NAME, | ||
183 | .attr = u8500_cpufreq_attr, | ||
184 | }; | ||
185 | |||
186 | static int __init u8500_cpufreq_probe(struct platform_device *pdev) | ||
187 | { | ||
188 | dev = &pdev->dev; | ||
189 | return cpufreq_register_driver(&u8500_driver); | ||
190 | } | ||
191 | |||
192 | static int __exit u8500_cpufreq_remove(struct platform_device *pdev) | ||
193 | { | ||
194 | return cpufreq_unregister_driver(&u8500_driver); | ||
195 | } | ||
196 | |||
197 | static struct platform_driver u8500_cpufreq_driver = { | ||
198 | .driver = { | ||
199 | .name = DRIVER_NAME, | ||
200 | .owner = THIS_MODULE, | ||
201 | }, | ||
202 | .remove = __exit_p(u8500_cpufreq_remove), | ||
203 | }; | ||
204 | |||
205 | static int __init u8500_cpufreq_init(void) | ||
206 | { | ||
207 | return platform_driver_probe(&u8500_cpufreq_driver, | ||
208 | &u8500_cpufreq_probe); | ||
209 | } | ||
210 | |||
211 | device_initcall(u8500_cpufreq_init); | ||
diff --git a/arch/arm/mach-ux500/include/mach/db5500-regs.h b/arch/arm/mach-ux500/include/mach/db5500-regs.h index bd88c1e74060..6ad983294103 100644 --- a/arch/arm/mach-ux500/include/mach/db5500-regs.h +++ b/arch/arm/mach-ux500/include/mach/db5500-regs.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #define U5500_GIC_DIST_BASE 0xA0411000 | 17 | #define U5500_GIC_DIST_BASE 0xA0411000 |
18 | #define U5500_GIC_CPU_BASE 0xA0410100 | 18 | #define U5500_GIC_CPU_BASE 0xA0410100 |
19 | #define U5500_DMA_BASE 0x90030000 | 19 | #define U5500_DMA_BASE 0x90030000 |
20 | #define U5500_STM_BASE 0x90020000 | ||
21 | #define U5500_STM_REG_BASE (U5500_STM_BASE + 0xF000) | ||
20 | #define U5500_MCDE_BASE 0xA0400000 | 22 | #define U5500_MCDE_BASE 0xA0400000 |
21 | #define U5500_MODEM_BASE 0xB0000000 | 23 | #define U5500_MODEM_BASE 0xB0000000 |
22 | #define U5500_L2CC_BASE 0xA0412000 | 24 | #define U5500_L2CC_BASE 0xA0412000 |
@@ -29,7 +31,9 @@ | |||
29 | #define U5500_NAND0_BASE 0x60000000 | 31 | #define U5500_NAND0_BASE 0x60000000 |
30 | #define U5500_NAND1_BASE 0x70000000 | 32 | #define U5500_NAND1_BASE 0x70000000 |
31 | #define U5500_TWD_BASE 0xa0410600 | 33 | #define U5500_TWD_BASE 0xa0410600 |
34 | #define U5500_ICN_BASE 0xA0040000 | ||
32 | #define U5500_B2R2_BASE 0xa0200000 | 35 | #define U5500_B2R2_BASE 0xa0200000 |
36 | #define U5500_BOOT_ROM_BASE 0x90000000 | ||
33 | 37 | ||
34 | #define U5500_FSMC_BASE (U5500_PER1_BASE + 0x0000) | 38 | #define U5500_FSMC_BASE (U5500_PER1_BASE + 0x0000) |
35 | #define U5500_SDI0_BASE (U5500_PER1_BASE + 0x1000) | 39 | #define U5500_SDI0_BASE (U5500_PER1_BASE + 0x1000) |
@@ -60,6 +64,7 @@ | |||
60 | #define U5500_MSP1_BASE (U5500_PER4_BASE + 0x9000) | 64 | #define U5500_MSP1_BASE (U5500_PER4_BASE + 0x9000) |
61 | #define U5500_GPIO2_BASE (U5500_PER4_BASE + 0xA000) | 65 | #define U5500_GPIO2_BASE (U5500_PER4_BASE + 0xA000) |
62 | #define U5500_CDETECT_BASE (U5500_PER4_BASE + 0xF000) | 66 | #define U5500_CDETECT_BASE (U5500_PER4_BASE + 0xF000) |
67 | #define U5500_PRCMU_TCDM_BASE (U5500_PER4_BASE + 0x18000) | ||
63 | 68 | ||
64 | #define U5500_SPI0_BASE (U5500_PER5_BASE + 0x0000) | 69 | #define U5500_SPI0_BASE (U5500_PER5_BASE + 0x0000) |
65 | #define U5500_SPI1_BASE (U5500_PER5_BASE + 0x1000) | 70 | #define U5500_SPI1_BASE (U5500_PER5_BASE + 0x1000) |
@@ -83,7 +88,7 @@ | |||
83 | #define U5500_HASH0_BASE (U5500_PER6_BASE + 0x1000) | 88 | #define U5500_HASH0_BASE (U5500_PER6_BASE + 0x1000) |
84 | #define U5500_HASH1_BASE (U5500_PER6_BASE + 0x2000) | 89 | #define U5500_HASH1_BASE (U5500_PER6_BASE + 0x2000) |
85 | #define U5500_PKA_BASE (U5500_PER6_BASE + 0x4000) | 90 | #define U5500_PKA_BASE (U5500_PER6_BASE + 0x4000) |
86 | #define U5500_PKAM_BASE (U5500_PER6_BASE + 0x5000) | 91 | #define U5500_PKAM_BASE (U5500_PER6_BASE + 0x5100) |
87 | #define U5500_MTU0_BASE (U5500_PER6_BASE + 0x6000) | 92 | #define U5500_MTU0_BASE (U5500_PER6_BASE + 0x6000) |
88 | #define U5500_MTU1_BASE (U5500_PER6_BASE + 0x7000) | 93 | #define U5500_MTU1_BASE (U5500_PER6_BASE + 0x7000) |
89 | #define U5500_CR_BASE (U5500_PER6_BASE + 0x8000) | 94 | #define U5500_CR_BASE (U5500_PER6_BASE + 0x8000) |
@@ -114,8 +119,19 @@ | |||
114 | #define U5500_MBOX2_LOCAL_START (U5500_MBOX_BASE + 0x20) | 119 | #define U5500_MBOX2_LOCAL_START (U5500_MBOX_BASE + 0x20) |
115 | #define U5500_MBOX2_LOCAL_END (U5500_MBOX_BASE + 0x3F) | 120 | #define U5500_MBOX2_LOCAL_END (U5500_MBOX_BASE + 0x3F) |
116 | 121 | ||
117 | #define U5500_ESRAM_BASE 0x40000000 | 122 | #define U5500_ACCCON_BASE_SEC (0xBFFF0000) |
123 | #define U5500_ACCCON_BASE (0xBFFF1000) | ||
124 | #define U5500_ACCCON_CPUVEC_RESET_ADDR_OFFSET (0x00000020) | ||
125 | #define U5500_ACCCON_ACC_CPU_CTRL_OFFSET (0x000000BC) | ||
126 | |||
127 | #define U5500_ESRAM_BASE 0x40000000 | ||
118 | #define U5500_ESRAM_DMA_LCPA_OFFSET 0x10000 | 128 | #define U5500_ESRAM_DMA_LCPA_OFFSET 0x10000 |
119 | #define U5500_DMA_LCPA_BASE (U5500_ESRAM_BASE + U5500_ESRAM_DMA_LCPA_OFFSET) | 129 | #define U5500_DMA_LCPA_BASE (U5500_ESRAM_BASE + U5500_ESRAM_DMA_LCPA_OFFSET) |
120 | 130 | ||
131 | #define U5500_MCDE_SIZE 0x1000 | ||
132 | #define U5500_DSI_LINK_SIZE 0x1000 | ||
133 | #define U5500_DSI_LINK_COUNT 0x2 | ||
134 | #define U5500_DSI_LINK1_BASE (U5500_MCDE_BASE + U5500_MCDE_SIZE) | ||
135 | #define U5500_DSI_LINK2_BASE (U5500_DSI_LINK1_BASE + U5500_DSI_LINK_SIZE) | ||
136 | |||
121 | #endif | 137 | #endif |
diff --git a/arch/arm/mach-ux500/include/mach/db8500-regs.h b/arch/arm/mach-ux500/include/mach/db8500-regs.h index 16647b255378..049997109cf9 100644 --- a/arch/arm/mach-ux500/include/mach/db8500-regs.h +++ b/arch/arm/mach-ux500/include/mach/db8500-regs.h | |||
@@ -15,8 +15,13 @@ | |||
15 | #define U8500_ESRAM_BANK2 (U8500_ESRAM_BANK1 + U8500_ESRAM_BANK_SIZE) | 15 | #define U8500_ESRAM_BANK2 (U8500_ESRAM_BANK1 + U8500_ESRAM_BANK_SIZE) |
16 | #define U8500_ESRAM_BANK3 (U8500_ESRAM_BANK2 + U8500_ESRAM_BANK_SIZE) | 16 | #define U8500_ESRAM_BANK3 (U8500_ESRAM_BANK2 + U8500_ESRAM_BANK_SIZE) |
17 | #define U8500_ESRAM_BANK4 (U8500_ESRAM_BANK3 + U8500_ESRAM_BANK_SIZE) | 17 | #define U8500_ESRAM_BANK4 (U8500_ESRAM_BANK3 + U8500_ESRAM_BANK_SIZE) |
18 | /* Use bank 4 for DMA LCPA */ | 18 | /* |
19 | #define U8500_DMA_LCPA_BASE U8500_ESRAM_BANK4 | 19 | * on V1 DMA uses 4KB for logical parameters position is right after the 64KB |
20 | * reserved for security | ||
21 | */ | ||
22 | #define U8500_ESRAM_DMA_LCPA_OFFSET 0x10000 | ||
23 | |||
24 | #define U8500_DMA_LCPA_BASE (U8500_ESRAM_BANK0 + U8500_ESRAM_DMA_LCPA_OFFSET) | ||
20 | #define U8500_DMA_LCPA_BASE_ED (U8500_ESRAM_BANK4 + 0x4000) | 25 | #define U8500_DMA_LCPA_BASE_ED (U8500_ESRAM_BANK4 + 0x4000) |
21 | 26 | ||
22 | #define U8500_PER3_BASE 0x80000000 | 27 | #define U8500_PER3_BASE 0x80000000 |
@@ -27,9 +32,12 @@ | |||
27 | #define U8500_B2R2_BASE 0x80130000 | 32 | #define U8500_B2R2_BASE 0x80130000 |
28 | #define U8500_HSEM_BASE 0x80140000 | 33 | #define U8500_HSEM_BASE 0x80140000 |
29 | #define U8500_PER4_BASE 0x80150000 | 34 | #define U8500_PER4_BASE 0x80150000 |
35 | #define U8500_TPIU_BASE 0x80190000 | ||
30 | #define U8500_ICN_BASE 0x81000000 | 36 | #define U8500_ICN_BASE 0x81000000 |
31 | 37 | ||
32 | #define U8500_BOOT_ROM_BASE 0x90000000 | 38 | #define U8500_BOOT_ROM_BASE 0x90000000 |
39 | /* ASIC ID is at 0xbf4 offset within this region */ | ||
40 | #define U8500_ASIC_ID_BASE 0x9001D000 | ||
33 | 41 | ||
34 | #define U8500_PER6_BASE 0xa03c0000 | 42 | #define U8500_PER6_BASE 0xa03c0000 |
35 | #define U8500_PER5_BASE 0xa03e0000 | 43 | #define U8500_PER5_BASE 0xa03e0000 |
@@ -70,13 +78,15 @@ | |||
70 | 78 | ||
71 | /* per6 base addresses */ | 79 | /* per6 base addresses */ |
72 | #define U8500_RNG_BASE (U8500_PER6_BASE + 0x0000) | 80 | #define U8500_RNG_BASE (U8500_PER6_BASE + 0x0000) |
73 | #define U8500_PKA_BASE (U8500_PER6_BASE + 0x1000) | 81 | #define U8500_HASH0_BASE (U8500_PER6_BASE + 0x1000) |
74 | #define U8500_PKAM_BASE (U8500_PER6_BASE + 0x2000) | 82 | #define U8500_HASH1_BASE (U8500_PER6_BASE + 0x2000) |
83 | #define U8500_PKA_BASE (U8500_PER6_BASE + 0x4000) | ||
84 | #define U8500_PKAM_BASE (U8500_PER6_BASE + 0x5100) | ||
75 | #define U8500_MTU0_BASE (U8500_PER6_BASE + 0x6000) /* v1 */ | 85 | #define U8500_MTU0_BASE (U8500_PER6_BASE + 0x6000) /* v1 */ |
76 | #define U8500_MTU1_BASE (U8500_PER6_BASE + 0x7000) /* v1 */ | 86 | #define U8500_MTU1_BASE (U8500_PER6_BASE + 0x7000) /* v1 */ |
77 | #define U8500_CR_BASE (U8500_PER6_BASE + 0x8000) /* v1 */ | 87 | #define U8500_CR_BASE (U8500_PER6_BASE + 0x8000) /* v1 */ |
78 | #define U8500_CRYPTO0_BASE (U8500_PER6_BASE + 0xa000) | 88 | #define U8500_CRYP0_BASE (U8500_PER6_BASE + 0xa000) |
79 | #define U8500_CRYPTO1_BASE (U8500_PER6_BASE + 0xb000) | 89 | #define U8500_CRYP1_BASE (U8500_PER6_BASE + 0xb000) |
80 | #define U8500_CLKRST6_BASE (U8500_PER6_BASE + 0xf000) | 90 | #define U8500_CLKRST6_BASE (U8500_PER6_BASE + 0xf000) |
81 | 91 | ||
82 | /* per5 base addresses */ | 92 | /* per5 base addresses */ |
@@ -93,7 +103,8 @@ | |||
93 | #define U8500_DMC_BASE (U8500_PER4_BASE + 0x06000) | 103 | #define U8500_DMC_BASE (U8500_PER4_BASE + 0x06000) |
94 | #define U8500_PRCMU_BASE (U8500_PER4_BASE + 0x07000) | 104 | #define U8500_PRCMU_BASE (U8500_PER4_BASE + 0x07000) |
95 | #define U8500_PRCMU_TCDM_BASE_V1 (U8500_PER4_BASE + 0x0f000) | 105 | #define U8500_PRCMU_TCDM_BASE_V1 (U8500_PER4_BASE + 0x0f000) |
96 | #define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000) | 106 | #define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000) |
107 | #define U8500_PRCMU_TCPM_BASE (U8500_PER4_BASE + 0x60000) | ||
97 | 108 | ||
98 | /* per3 base addresses */ | 109 | /* per3 base addresses */ |
99 | #define U8500_FSMC_BASE (U8500_PER3_BASE + 0x0000) | 110 | #define U8500_FSMC_BASE (U8500_PER3_BASE + 0x0000) |
@@ -124,6 +135,7 @@ | |||
124 | #define U8500_I2C1_BASE (U8500_PER1_BASE + 0x2000) | 135 | #define U8500_I2C1_BASE (U8500_PER1_BASE + 0x2000) |
125 | #define U8500_MSP0_BASE (U8500_PER1_BASE + 0x3000) | 136 | #define U8500_MSP0_BASE (U8500_PER1_BASE + 0x3000) |
126 | #define U8500_MSP1_BASE (U8500_PER1_BASE + 0x4000) | 137 | #define U8500_MSP1_BASE (U8500_PER1_BASE + 0x4000) |
138 | #define U8500_MSP3_BASE (U8500_PER1_BASE + 0x5000) | ||
127 | #define U8500_SDI0_BASE (U8500_PER1_BASE + 0x6000) | 139 | #define U8500_SDI0_BASE (U8500_PER1_BASE + 0x6000) |
128 | #define U8500_I2C2_BASE (U8500_PER1_BASE + 0x8000) | 140 | #define U8500_I2C2_BASE (U8500_PER1_BASE + 0x8000) |
129 | #define U8500_SPI3_BASE (U8500_PER1_BASE + 0x9000) | 141 | #define U8500_SPI3_BASE (U8500_PER1_BASE + 0x9000) |
@@ -143,4 +155,15 @@ | |||
143 | #define U8500_GPIOBANK7_BASE (U8500_GPIO2_BASE + 0x80) | 155 | #define U8500_GPIOBANK7_BASE (U8500_GPIO2_BASE + 0x80) |
144 | #define U8500_GPIOBANK8_BASE U8500_GPIO3_BASE | 156 | #define U8500_GPIOBANK8_BASE U8500_GPIO3_BASE |
145 | 157 | ||
158 | #define U8500_MCDE_SIZE 0x1000 | ||
159 | #define U8500_DSI_LINK_SIZE 0x1000 | ||
160 | #define U8500_DSI_LINK1_BASE (U8500_MCDE_BASE + U8500_MCDE_SIZE) | ||
161 | #define U8500_DSI_LINK2_BASE (U8500_DSI_LINK1_BASE + U8500_DSI_LINK_SIZE) | ||
162 | #define U8500_DSI_LINK3_BASE (U8500_DSI_LINK2_BASE + U8500_DSI_LINK_SIZE) | ||
163 | #define U8500_DSI_LINK_COUNT 0x3 | ||
164 | |||
165 | /* Modem and APE physical addresses */ | ||
166 | #define U8500_MODEM_BASE 0xe000000 | ||
167 | #define U8500_APE_BASE 0x6000000 | ||
168 | |||
146 | #endif | 169 | #endif |
diff --git a/arch/arm/mach-ux500/include/mach/hardware.h b/arch/arm/mach-ux500/include/mach/hardware.h index bf63f2631ba0..2c6f71049f2e 100644 --- a/arch/arm/mach-ux500/include/mach/hardware.h +++ b/arch/arm/mach-ux500/include/mach/hardware.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #ifndef __ASSEMBLY__ | 35 | #ifndef __ASSEMBLY__ |
36 | 36 | ||
37 | #include <mach/id.h> | 37 | #include <mach/id.h> |
38 | extern void __iomem *_PRCMU_BASE; | ||
38 | 39 | ||
39 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) | 40 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) |
40 | 41 | ||
diff --git a/arch/arm/mach-ux500/include/mach/id.h b/arch/arm/mach-ux500/include/mach/id.h index f1288d10b6ab..02b541a37ee5 100644 --- a/arch/arm/mach-ux500/include/mach/id.h +++ b/arch/arm/mach-ux500/include/mach/id.h | |||
@@ -75,6 +75,26 @@ static inline bool __attribute_const__ cpu_is_u8500v2(void) | |||
75 | return cpu_is_u8500() && ((dbx500_revision() & 0xf0) == 0xB0); | 75 | return cpu_is_u8500() && ((dbx500_revision() & 0xf0) == 0xB0); |
76 | } | 76 | } |
77 | 77 | ||
78 | static inline bool cpu_is_u8500v20(void) | ||
79 | { | ||
80 | return cpu_is_u8500() && (dbx500_revision() == 0xB0); | ||
81 | } | ||
82 | |||
83 | static inline bool cpu_is_u8500v21(void) | ||
84 | { | ||
85 | return cpu_is_u8500() && (dbx500_revision() == 0xB1); | ||
86 | } | ||
87 | |||
88 | static inline bool cpu_is_u8500v20_or_later(void) | ||
89 | { | ||
90 | return cpu_is_u8500() && !cpu_is_u8500v10() && !cpu_is_u8500v11(); | ||
91 | } | ||
92 | |||
93 | static inline bool ux500_is_svp(void) | ||
94 | { | ||
95 | return false; | ||
96 | } | ||
97 | |||
78 | #define ux500_unknown_soc() BUG() | 98 | #define ux500_unknown_soc() BUG() |
79 | 99 | ||
80 | #endif | 100 | #endif |
diff --git a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h index 97ef55f84934..47969909836c 100644 --- a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h +++ b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h | |||
@@ -50,6 +50,11 @@ | |||
50 | 50 | ||
51 | #define MOP500_IRQ_END MOP500_NR_IRQS | 51 | #define MOP500_IRQ_END MOP500_NR_IRQS |
52 | 52 | ||
53 | /* | ||
54 | * We may have several boards, but only one will run at a | ||
55 | * time, so the one with most IRQs will bump this ahead, | ||
56 | * but the IRQ_BOARD_START remains the same for either board. | ||
57 | */ | ||
53 | #if MOP500_IRQ_END > IRQ_BOARD_END | 58 | #if MOP500_IRQ_END > IRQ_BOARD_END |
54 | #undef IRQ_BOARD_END | 59 | #undef IRQ_BOARD_END |
55 | #define IRQ_BOARD_END MOP500_IRQ_END | 60 | #define IRQ_BOARD_END MOP500_IRQ_END |
diff --git a/arch/arm/mach-ux500/include/mach/irqs-board-u5500.h b/arch/arm/mach-ux500/include/mach/irqs-board-u5500.h new file mode 100644 index 000000000000..29d972c7717b --- /dev/null +++ b/arch/arm/mach-ux500/include/mach/irqs-board-u5500.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License terms: GNU General Public License (GPL) version 2 | ||
5 | */ | ||
6 | |||
7 | #ifndef __MACH_IRQS_BOARD_U5500_H | ||
8 | #define __MACH_IRQS_BOARD_U5500_H | ||
9 | |||
10 | #define AB5500_NR_IRQS 5 | ||
11 | #define IRQ_AB5500_BASE IRQ_BOARD_START | ||
12 | #define IRQ_AB5500_END (IRQ_AB5500_BASE + AB5500_NR_IRQS) | ||
13 | |||
14 | #define U5500_IRQ_END IRQ_AB5500_END | ||
15 | |||
16 | #if IRQ_BOARD_END < U5500_IRQ_END | ||
17 | #undef IRQ_BOARD_END | ||
18 | #define IRQ_BOARD_END U5500_IRQ_END | ||
19 | #endif | ||
20 | |||
21 | #endif | ||
diff --git a/arch/arm/mach-ux500/include/mach/irqs-db5500.h b/arch/arm/mach-ux500/include/mach/irqs-db5500.h index bfa123dbec3b..77239776a6f2 100644 --- a/arch/arm/mach-ux500/include/mach/irqs-db5500.h +++ b/arch/arm/mach-ux500/include/mach/irqs-db5500.h | |||
@@ -83,4 +83,31 @@ | |||
83 | #define IRQ_DB5500_GPIO6 (IRQ_SHPI_START + 125) | 83 | #define IRQ_DB5500_GPIO6 (IRQ_SHPI_START + 125) |
84 | #define IRQ_DB5500_GPIO7 (IRQ_SHPI_START + 126) | 84 | #define IRQ_DB5500_GPIO7 (IRQ_SHPI_START + 126) |
85 | 85 | ||
86 | #ifdef CONFIG_UX500_SOC_DB5500 | ||
87 | |||
88 | /* | ||
89 | * After the GPIO ones we reserve a range of IRQ:s in which virtual | ||
90 | * IRQ:s representing modem IRQ:s can be allocated | ||
91 | */ | ||
92 | #define IRQ_MODEM_EVENTS_BASE IRQ_SOC_START | ||
93 | #define IRQ_MODEM_EVENTS_NBR 72 | ||
94 | #define IRQ_MODEM_EVENTS_END (IRQ_MODEM_EVENTS_BASE + IRQ_MODEM_EVENTS_NBR) | ||
95 | |||
96 | /* List of virtual IRQ:s that are allocated from the range above */ | ||
97 | #define MBOX_PAIR0_VIRT_IRQ (IRQ_MODEM_EVENTS_BASE + 43) | ||
98 | #define MBOX_PAIR1_VIRT_IRQ (IRQ_MODEM_EVENTS_BASE + 45) | ||
99 | #define MBOX_PAIR2_VIRT_IRQ (IRQ_MODEM_EVENTS_BASE + 41) | ||
100 | |||
101 | /* | ||
102 | * We may have several SoCs, but only one will run at a | ||
103 | * time, so the one with most IRQs will bump this ahead, | ||
104 | * but the IRQ_SOC_START remains the same for either SoC. | ||
105 | */ | ||
106 | #if IRQ_SOC_END < IRQ_MODEM_EVENTS_END | ||
107 | #undef IRQ_SOC_END | ||
108 | #define IRQ_SOC_END IRQ_MODEM_EVENTS_END | ||
109 | #endif | ||
110 | |||
111 | #endif /* CONFIG_UX500_SOC_DB5500 */ | ||
112 | |||
86 | #endif | 113 | #endif |
diff --git a/arch/arm/mach-ux500/include/mach/irqs-db8500.h b/arch/arm/mach-ux500/include/mach/irqs-db8500.h index 8b5d9f0a1633..68bc14974608 100644 --- a/arch/arm/mach-ux500/include/mach/irqs-db8500.h +++ b/arch/arm/mach-ux500/include/mach/irqs-db8500.h | |||
@@ -93,4 +93,58 @@ | |||
93 | #define IRQ_DB8500_GPIO7 (IRQ_SHPI_START + 126) | 93 | #define IRQ_DB8500_GPIO7 (IRQ_SHPI_START + 126) |
94 | #define IRQ_DB8500_GPIO8 (IRQ_SHPI_START + 127) | 94 | #define IRQ_DB8500_GPIO8 (IRQ_SHPI_START + 127) |
95 | 95 | ||
96 | #define IRQ_CA_WAKE_REQ_ED (IRQ_SHPI_START + 71) | ||
97 | #define IRQ_AC_READ_NOTIFICATION_0_ED (IRQ_SHPI_START + 66) | ||
98 | #define IRQ_AC_READ_NOTIFICATION_1_ED (IRQ_SHPI_START + 64) | ||
99 | #define IRQ_CA_MSG_PEND_NOTIFICATION_0_ED (IRQ_SHPI_START + 67) | ||
100 | #define IRQ_CA_MSG_PEND_NOTIFICATION_1_ED (IRQ_SHPI_START + 65) | ||
101 | |||
102 | #define IRQ_CA_WAKE_REQ_V1 (IRQ_SHPI_START + 83) | ||
103 | #define IRQ_AC_READ_NOTIFICATION_0_V1 (IRQ_SHPI_START + 78) | ||
104 | #define IRQ_AC_READ_NOTIFICATION_1_V1 (IRQ_SHPI_START + 76) | ||
105 | #define IRQ_CA_MSG_PEND_NOTIFICATION_0_V1 (IRQ_SHPI_START + 79) | ||
106 | #define IRQ_CA_MSG_PEND_NOTIFICATION_1_V1 (IRQ_SHPI_START + 77) | ||
107 | |||
108 | #ifdef CONFIG_UX500_SOC_DB8500 | ||
109 | |||
110 | /* Virtual interrupts corresponding to the PRCMU wakeups. */ | ||
111 | #define IRQ_PRCMU_BASE IRQ_SOC_START | ||
112 | #define NUM_PRCMU_WAKEUPS (IRQ_PRCMU_END - IRQ_PRCMU_BASE) | ||
113 | |||
114 | #define IRQ_PRCMU_RTC (IRQ_PRCMU_BASE) | ||
115 | #define IRQ_PRCMU_RTT0 (IRQ_PRCMU_BASE + 1) | ||
116 | #define IRQ_PRCMU_RTT1 (IRQ_PRCMU_BASE + 2) | ||
117 | #define IRQ_PRCMU_HSI0 (IRQ_PRCMU_BASE + 3) | ||
118 | #define IRQ_PRCMU_HSI1 (IRQ_PRCMU_BASE + 4) | ||
119 | #define IRQ_PRCMU_CA_WAKE (IRQ_PRCMU_BASE + 5) | ||
120 | #define IRQ_PRCMU_USB (IRQ_PRCMU_BASE + 6) | ||
121 | #define IRQ_PRCMU_ABB (IRQ_PRCMU_BASE + 7) | ||
122 | #define IRQ_PRCMU_ABB_FIFO (IRQ_PRCMU_BASE + 8) | ||
123 | #define IRQ_PRCMU_ARM (IRQ_PRCMU_BASE + 9) | ||
124 | #define IRQ_PRCMU_MODEM_SW_RESET_REQ (IRQ_PRCMU_BASE + 10) | ||
125 | #define IRQ_PRCMU_GPIO0 (IRQ_PRCMU_BASE + 11) | ||
126 | #define IRQ_PRCMU_GPIO1 (IRQ_PRCMU_BASE + 12) | ||
127 | #define IRQ_PRCMU_GPIO2 (IRQ_PRCMU_BASE + 13) | ||
128 | #define IRQ_PRCMU_GPIO3 (IRQ_PRCMU_BASE + 14) | ||
129 | #define IRQ_PRCMU_GPIO4 (IRQ_PRCMU_BASE + 15) | ||
130 | #define IRQ_PRCMU_GPIO5 (IRQ_PRCMU_BASE + 16) | ||
131 | #define IRQ_PRCMU_GPIO6 (IRQ_PRCMU_BASE + 17) | ||
132 | #define IRQ_PRCMU_GPIO7 (IRQ_PRCMU_BASE + 18) | ||
133 | #define IRQ_PRCMU_GPIO8 (IRQ_PRCMU_BASE + 19) | ||
134 | #define IRQ_PRCMU_CA_SLEEP (IRQ_PRCMU_BASE + 20) | ||
135 | #define IRQ_PRCMU_HOTMON_LOW (IRQ_PRCMU_BASE + 21) | ||
136 | #define IRQ_PRCMU_HOTMON_HIGH (IRQ_PRCMU_BASE + 22) | ||
137 | #define IRQ_PRCMU_END (IRQ_PRCMU_BASE + 23) | ||
138 | |||
139 | /* | ||
140 | * We may have several SoCs, but only one will run at a | ||
141 | * time, so the one with most IRQs will bump this ahead, | ||
142 | * but the IRQ_SOC_START remains the same for either SoC. | ||
143 | */ | ||
144 | #if IRQ_SOC_END < IRQ_PRCMU_END | ||
145 | #undef IRQ_SOC_END | ||
146 | #define IRQ_SOC_END IRQ_PRCMU_END | ||
147 | #endif | ||
148 | |||
149 | #endif /* CONFIG_UX500_SOC_DB8500 */ | ||
96 | #endif | 150 | #endif |
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h index ba1294c13c4d..9db68d264c5f 100644 --- a/arch/arm/mach-ux500/include/mach/irqs.h +++ b/arch/arm/mach-ux500/include/mach/irqs.h | |||
@@ -10,49 +10,47 @@ | |||
10 | #ifndef ASM_ARCH_IRQS_H | 10 | #ifndef ASM_ARCH_IRQS_H |
11 | #define ASM_ARCH_IRQS_H | 11 | #define ASM_ARCH_IRQS_H |
12 | 12 | ||
13 | #include <mach/irqs-db5500.h> | 13 | #include <mach/hardware.h> |
14 | #include <mach/irqs-db8500.h> | ||
15 | 14 | ||
16 | #define IRQ_LOCALTIMER 29 | 15 | #define IRQ_LOCALTIMER 29 |
17 | #define IRQ_LOCALWDOG 30 | 16 | #define IRQ_LOCALWDOG 30 |
18 | 17 | ||
19 | /* Shared Peripheral Interrupt (SHPI) */ | 18 | /* Shared Peripheral Interrupt (SHPI) */ |
20 | #define IRQ_SHPI_START 32 | 19 | #define IRQ_SHPI_START 32 |
21 | 20 | ||
22 | /* Interrupt numbers generic for shared peripheral */ | 21 | /* |
22 | * MTU0 preserved for now until plat-nomadik is taught not to use it. Don't | ||
23 | * add any other IRQs here, use the irqs-dbx500.h files. | ||
24 | */ | ||
23 | #define IRQ_MTU0 (IRQ_SHPI_START + 4) | 25 | #define IRQ_MTU0 (IRQ_SHPI_START + 4) |
24 | 26 | ||
25 | /* There are 128 shared peripheral interrupts assigned to | 27 | #define DBX500_NR_INTERNAL_IRQS 160 |
26 | * INTID[160:32]. The first 32 interrupts are reserved. | ||
27 | */ | ||
28 | #define DBX500_NR_INTERNAL_IRQS 161 | ||
29 | 28 | ||
30 | /* After chip-specific IRQ numbers we have the GPIO ones */ | 29 | /* After chip-specific IRQ numbers we have the GPIO ones */ |
31 | #define NOMADIK_NR_GPIO 288 | 30 | #define NOMADIK_NR_GPIO 288 |
32 | #define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + DBX500_NR_INTERNAL_IRQS) | 31 | #define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + DBX500_NR_INTERNAL_IRQS) |
33 | #define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - DBX500_NR_INTERNAL_IRQS) | 32 | #define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - DBX500_NR_INTERNAL_IRQS) |
34 | #define IRQ_BOARD_START NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO) | 33 | #define IRQ_GPIO_END NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO) |
34 | |||
35 | #define IRQ_SOC_START IRQ_GPIO_END | ||
36 | /* This will be overridden by SoC-specific irq headers */ | ||
37 | #define IRQ_SOC_END IRQ_SOC_START | ||
35 | 38 | ||
39 | #include <mach/irqs-db5500.h> | ||
40 | #include <mach/irqs-db8500.h> | ||
41 | |||
42 | #define IRQ_BOARD_START IRQ_SOC_END | ||
36 | /* This will be overridden by board-specific irq headers */ | 43 | /* This will be overridden by board-specific irq headers */ |
37 | #define IRQ_BOARD_END IRQ_BOARD_START | 44 | #define IRQ_BOARD_END IRQ_BOARD_START |
38 | 45 | ||
39 | #ifdef CONFIG_MACH_U8500 | 46 | #ifdef CONFIG_MACH_U8500 |
40 | #include <mach/irqs-board-mop500.h> | 47 | #include <mach/irqs-board-mop500.h> |
41 | #endif | 48 | #endif |
42 | 49 | ||
43 | /* | 50 | #ifdef CONFIG_MACH_U5500 |
44 | * After the board specific IRQ:s we reserve a range of IRQ:s in which virtual | 51 | #include <mach/irqs-board-u5500.h> |
45 | * IRQ:s representing modem IRQ:s can be allocated | 52 | #endif |
46 | */ | ||
47 | #define IRQ_MODEM_EVENTS_BASE (IRQ_BOARD_END + 1) | ||
48 | #define IRQ_MODEM_EVENTS_NBR 72 | ||
49 | #define IRQ_MODEM_EVENTS_END (IRQ_MODEM_EVENTS_BASE + IRQ_MODEM_EVENTS_NBR) | ||
50 | |||
51 | /* List of virtual IRQ:s that are allocated from the range above */ | ||
52 | #define MBOX_PAIR0_VIRT_IRQ (IRQ_MODEM_EVENTS_BASE + 43) | ||
53 | #define MBOX_PAIR1_VIRT_IRQ (IRQ_MODEM_EVENTS_BASE + 45) | ||
54 | #define MBOX_PAIR2_VIRT_IRQ (IRQ_MODEM_EVENTS_BASE + 41) | ||
55 | 53 | ||
56 | #define NR_IRQS IRQ_MODEM_EVENTS_END | 54 | #define NR_IRQS IRQ_BOARD_END |
57 | 55 | ||
58 | #endif /* ASM_ARCH_IRQS_H */ | 56 | #endif /* ASM_ARCH_IRQS_H */ |
diff --git a/arch/arm/mach-ux500/include/mach/prcmu-defs.h b/arch/arm/mach-ux500/include/mach/prcmu-defs.h deleted file mode 100644 index 848ba64b561f..000000000000 --- a/arch/arm/mach-ux500/include/mach/prcmu-defs.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) STMicroelectronics 2009 | ||
3 | * Copyright (C) ST-Ericsson SA 2010 | ||
4 | * | ||
5 | * Author: Sundar Iyer <sundar.iyer@stericsson.com> | ||
6 | * Author: Martin Persson <martin.persson@stericsson.com> | ||
7 | * | ||
8 | * License Terms: GNU General Public License v2 | ||
9 | * | ||
10 | * PRCM Unit definitions | ||
11 | */ | ||
12 | |||
13 | #ifndef __MACH_PRCMU_DEFS_H | ||
14 | #define __MACH_PRCMU_DEFS_H | ||
15 | |||
16 | enum prcmu_cpu_opp { | ||
17 | CPU_OPP_INIT = 0x00, | ||
18 | CPU_OPP_NO_CHANGE = 0x01, | ||
19 | CPU_OPP_100 = 0x02, | ||
20 | CPU_OPP_50 = 0x03, | ||
21 | CPU_OPP_MAX = 0x04, | ||
22 | CPU_OPP_EXT_CLK = 0x07 | ||
23 | }; | ||
24 | enum prcmu_ape_opp { | ||
25 | APE_OPP_NO_CHANGE = 0x00, | ||
26 | APE_OPP_100 = 0x02, | ||
27 | APE_OPP_50 = 0x03, | ||
28 | }; | ||
29 | |||
30 | #endif /* __MACH_PRCMU_DEFS_H */ | ||
diff --git a/arch/arm/mach-ux500/include/mach/prcmu.h b/arch/arm/mach-ux500/include/mach/prcmu.h deleted file mode 100644 index c49e456162ef..000000000000 --- a/arch/arm/mach-ux500/include/mach/prcmu.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) STMicroelectronics 2009 | ||
3 | * Copyright (C) ST-Ericsson SA 2010 | ||
4 | * | ||
5 | * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.com> | ||
6 | * Author: Sundar Iyer <sundar.iyer@stericsson.com> | ||
7 | * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> | ||
8 | * | ||
9 | * License Terms: GNU General Public License v2 | ||
10 | * | ||
11 | * PRCM Unit f/w API | ||
12 | */ | ||
13 | #ifndef __MACH_PRCMU_H | ||
14 | #define __MACH_PRCMU_H | ||
15 | #include <mach/prcmu-defs.h> | ||
16 | |||
17 | void __init prcmu_early_init(void); | ||
18 | int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
19 | int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
20 | int prcmu_set_ape_opp(enum prcmu_ape_opp opp); | ||
21 | int prcmu_set_cpu_opp(enum prcmu_cpu_opp opp); | ||
22 | int prcmu_set_ape_cpu_opps(enum prcmu_ape_opp ape_opp, | ||
23 | enum prcmu_cpu_opp cpu_opp); | ||
24 | int prcmu_get_ape_opp(void); | ||
25 | int prcmu_get_cpu_opp(void); | ||
26 | bool prcmu_has_arm_maxopp(void); | ||
27 | |||
28 | #endif /* __MACH_PRCMU_H */ | ||
diff --git a/arch/arm/mach-ux500/prcmu.c b/arch/arm/mach-ux500/prcmu.c deleted file mode 100644 index c522d26ef348..000000000000 --- a/arch/arm/mach-ux500/prcmu.c +++ /dev/null | |||
@@ -1,394 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) STMicroelectronics 2009 | ||
3 | * Copyright (C) ST-Ericsson SA 2010 | ||
4 | * | ||
5 | * License Terms: GNU General Public License v2 | ||
6 | * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.com> | ||
7 | * Author: Sundar Iyer <sundar.iyer@stericsson.com> | ||
8 | * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> | ||
9 | * | ||
10 | * U8500 PRCM Unit interface driver | ||
11 | * | ||
12 | */ | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/mutex.h> | ||
19 | #include <linux/completion.h> | ||
20 | #include <linux/jiffies.h> | ||
21 | #include <linux/bitops.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | #include <mach/prcmu-regs.h> | ||
26 | #include <mach/prcmu-defs.h> | ||
27 | |||
28 | /* Global var to runtime determine TCDM base for v2 or v1 */ | ||
29 | static __iomem void *tcdm_base; | ||
30 | |||
31 | #define _MBOX_HEADER (tcdm_base + 0xFE8) | ||
32 | #define MBOX_HEADER_REQ_MB0 (_MBOX_HEADER + 0x0) | ||
33 | |||
34 | #define REQ_MB1 (tcdm_base + 0xFD0) | ||
35 | #define REQ_MB5 (tcdm_base + 0xE44) | ||
36 | |||
37 | #define REQ_MB1_ARMOPP (REQ_MB1 + 0x0) | ||
38 | #define REQ_MB1_APEOPP (REQ_MB1 + 0x1) | ||
39 | #define REQ_MB1_BOOSTOPP (REQ_MB1 + 0x2) | ||
40 | |||
41 | #define ACK_MB1 (tcdm_base + 0xE04) | ||
42 | #define ACK_MB5 (tcdm_base + 0xDF4) | ||
43 | |||
44 | #define ACK_MB1_CURR_ARMOPP (ACK_MB1 + 0x0) | ||
45 | #define ACK_MB1_CURR_APEOPP (ACK_MB1 + 0x1) | ||
46 | |||
47 | #define REQ_MB5_I2C_SLAVE_OP (REQ_MB5) | ||
48 | #define REQ_MB5_I2C_HW_BITS (REQ_MB5 + 1) | ||
49 | #define REQ_MB5_I2C_REG (REQ_MB5 + 2) | ||
50 | #define REQ_MB5_I2C_VAL (REQ_MB5 + 3) | ||
51 | |||
52 | #define ACK_MB5_I2C_STATUS (ACK_MB5 + 1) | ||
53 | #define ACK_MB5_I2C_VAL (ACK_MB5 + 3) | ||
54 | |||
55 | #define PRCM_AVS_VARM_MAX_OPP (tcdm_base + 0x2E4) | ||
56 | #define PRCM_AVS_ISMODEENABLE 7 | ||
57 | #define PRCM_AVS_ISMODEENABLE_MASK (1 << PRCM_AVS_ISMODEENABLE) | ||
58 | |||
59 | #define I2C_WRITE(slave) \ | ||
60 | (((slave) << 1) | (cpu_is_u8500v2() ? BIT(6) : 0)) | ||
61 | #define I2C_READ(slave) \ | ||
62 | (((slave) << 1) | (cpu_is_u8500v2() ? BIT(6) : 0) | BIT(0)) | ||
63 | #define I2C_STOP_EN BIT(3) | ||
64 | |||
65 | enum mb1_h { | ||
66 | MB1H_ARM_OPP = 1, | ||
67 | MB1H_APE_OPP, | ||
68 | MB1H_ARM_APE_OPP, | ||
69 | }; | ||
70 | |||
71 | static struct { | ||
72 | struct mutex lock; | ||
73 | struct completion work; | ||
74 | struct { | ||
75 | u8 arm_opp; | ||
76 | u8 ape_opp; | ||
77 | u8 arm_status; | ||
78 | u8 ape_status; | ||
79 | } ack; | ||
80 | } mb1_transfer; | ||
81 | |||
82 | enum ack_mb5_status { | ||
83 | I2C_WR_OK = 0x01, | ||
84 | I2C_RD_OK = 0x02, | ||
85 | }; | ||
86 | |||
87 | #define MBOX_BIT BIT | ||
88 | #define NUM_MBOX 8 | ||
89 | |||
90 | static struct { | ||
91 | struct mutex lock; | ||
92 | struct completion work; | ||
93 | bool failed; | ||
94 | struct { | ||
95 | u8 status; | ||
96 | u8 value; | ||
97 | } ack; | ||
98 | } mb5_transfer; | ||
99 | |||
100 | /** | ||
101 | * prcmu_abb_read() - Read register value(s) from the ABB. | ||
102 | * @slave: The I2C slave address. | ||
103 | * @reg: The (start) register address. | ||
104 | * @value: The read out value(s). | ||
105 | * @size: The number of registers to read. | ||
106 | * | ||
107 | * Reads register value(s) from the ABB. | ||
108 | * @size has to be 1 for the current firmware version. | ||
109 | */ | ||
110 | int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
111 | { | ||
112 | int r; | ||
113 | |||
114 | if (size != 1) | ||
115 | return -EINVAL; | ||
116 | |||
117 | r = mutex_lock_interruptible(&mb5_transfer.lock); | ||
118 | if (r) | ||
119 | return r; | ||
120 | |||
121 | while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(5)) | ||
122 | cpu_relax(); | ||
123 | |||
124 | writeb(I2C_READ(slave), REQ_MB5_I2C_SLAVE_OP); | ||
125 | writeb(I2C_STOP_EN, REQ_MB5_I2C_HW_BITS); | ||
126 | writeb(reg, REQ_MB5_I2C_REG); | ||
127 | |||
128 | writel(MBOX_BIT(5), PRCM_MBOX_CPU_SET); | ||
129 | if (!wait_for_completion_timeout(&mb5_transfer.work, | ||
130 | msecs_to_jiffies(500))) { | ||
131 | pr_err("prcmu: prcmu_abb_read timed out.\n"); | ||
132 | r = -EIO; | ||
133 | goto unlock_and_return; | ||
134 | } | ||
135 | r = ((mb5_transfer.ack.status == I2C_RD_OK) ? 0 : -EIO); | ||
136 | if (!r) | ||
137 | *value = mb5_transfer.ack.value; | ||
138 | |||
139 | unlock_and_return: | ||
140 | mutex_unlock(&mb5_transfer.lock); | ||
141 | return r; | ||
142 | } | ||
143 | EXPORT_SYMBOL(prcmu_abb_read); | ||
144 | |||
145 | /** | ||
146 | * prcmu_abb_write() - Write register value(s) to the ABB. | ||
147 | * @slave: The I2C slave address. | ||
148 | * @reg: The (start) register address. | ||
149 | * @value: The value(s) to write. | ||
150 | * @size: The number of registers to write. | ||
151 | * | ||
152 | * Reads register value(s) from the ABB. | ||
153 | * @size has to be 1 for the current firmware version. | ||
154 | */ | ||
155 | int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | ||
156 | { | ||
157 | int r; | ||
158 | |||
159 | if (size != 1) | ||
160 | return -EINVAL; | ||
161 | |||
162 | r = mutex_lock_interruptible(&mb5_transfer.lock); | ||
163 | if (r) | ||
164 | return r; | ||
165 | |||
166 | |||
167 | while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(5)) | ||
168 | cpu_relax(); | ||
169 | |||
170 | writeb(I2C_WRITE(slave), REQ_MB5_I2C_SLAVE_OP); | ||
171 | writeb(I2C_STOP_EN, REQ_MB5_I2C_HW_BITS); | ||
172 | writeb(reg, REQ_MB5_I2C_REG); | ||
173 | writeb(*value, REQ_MB5_I2C_VAL); | ||
174 | |||
175 | writel(MBOX_BIT(5), PRCM_MBOX_CPU_SET); | ||
176 | if (!wait_for_completion_timeout(&mb5_transfer.work, | ||
177 | msecs_to_jiffies(500))) { | ||
178 | pr_err("prcmu: prcmu_abb_write timed out.\n"); | ||
179 | r = -EIO; | ||
180 | goto unlock_and_return; | ||
181 | } | ||
182 | r = ((mb5_transfer.ack.status == I2C_WR_OK) ? 0 : -EIO); | ||
183 | |||
184 | unlock_and_return: | ||
185 | mutex_unlock(&mb5_transfer.lock); | ||
186 | return r; | ||
187 | } | ||
188 | EXPORT_SYMBOL(prcmu_abb_write); | ||
189 | |||
190 | static int set_ape_cpu_opps(u8 header, enum prcmu_ape_opp ape_opp, | ||
191 | enum prcmu_cpu_opp cpu_opp) | ||
192 | { | ||
193 | bool do_ape; | ||
194 | bool do_arm; | ||
195 | int err = 0; | ||
196 | |||
197 | do_ape = ((header == MB1H_APE_OPP) || (header == MB1H_ARM_APE_OPP)); | ||
198 | do_arm = ((header == MB1H_ARM_OPP) || (header == MB1H_ARM_APE_OPP)); | ||
199 | |||
200 | mutex_lock(&mb1_transfer.lock); | ||
201 | |||
202 | while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) | ||
203 | cpu_relax(); | ||
204 | |||
205 | writeb(0, MBOX_HEADER_REQ_MB0); | ||
206 | writeb(cpu_opp, REQ_MB1_ARMOPP); | ||
207 | writeb(ape_opp, REQ_MB1_APEOPP); | ||
208 | writeb(0, REQ_MB1_BOOSTOPP); | ||
209 | writel(MBOX_BIT(1), PRCM_MBOX_CPU_SET); | ||
210 | wait_for_completion(&mb1_transfer.work); | ||
211 | if ((do_ape) && (mb1_transfer.ack.ape_status != 0)) | ||
212 | err = -EIO; | ||
213 | if ((do_arm) && (mb1_transfer.ack.arm_status != 0)) | ||
214 | err = -EIO; | ||
215 | |||
216 | mutex_unlock(&mb1_transfer.lock); | ||
217 | |||
218 | return err; | ||
219 | } | ||
220 | |||
221 | /** | ||
222 | * prcmu_set_ape_opp() - Set the OPP of the APE. | ||
223 | * @opp: The OPP to set. | ||
224 | * | ||
225 | * This function sets the OPP of the APE. | ||
226 | */ | ||
227 | int prcmu_set_ape_opp(enum prcmu_ape_opp opp) | ||
228 | { | ||
229 | return set_ape_cpu_opps(MB1H_APE_OPP, opp, APE_OPP_NO_CHANGE); | ||
230 | } | ||
231 | EXPORT_SYMBOL(prcmu_set_ape_opp); | ||
232 | |||
233 | /** | ||
234 | * prcmu_set_cpu_opp() - Set the OPP of the CPU. | ||
235 | * @opp: The OPP to set. | ||
236 | * | ||
237 | * This function sets the OPP of the CPU. | ||
238 | */ | ||
239 | int prcmu_set_cpu_opp(enum prcmu_cpu_opp opp) | ||
240 | { | ||
241 | return set_ape_cpu_opps(MB1H_ARM_OPP, CPU_OPP_NO_CHANGE, opp); | ||
242 | } | ||
243 | EXPORT_SYMBOL(prcmu_set_cpu_opp); | ||
244 | |||
245 | /** | ||
246 | * prcmu_set_ape_cpu_opps() - Set the OPPs of the APE and the CPU. | ||
247 | * @ape_opp: The APE OPP to set. | ||
248 | * @cpu_opp: The CPU OPP to set. | ||
249 | * | ||
250 | * This function sets the OPPs of the APE and the CPU. | ||
251 | */ | ||
252 | int prcmu_set_ape_cpu_opps(enum prcmu_ape_opp ape_opp, | ||
253 | enum prcmu_cpu_opp cpu_opp) | ||
254 | { | ||
255 | return set_ape_cpu_opps(MB1H_ARM_APE_OPP, ape_opp, cpu_opp); | ||
256 | } | ||
257 | EXPORT_SYMBOL(prcmu_set_ape_cpu_opps); | ||
258 | |||
259 | /** | ||
260 | * prcmu_get_ape_opp() - Get the OPP of the APE. | ||
261 | * | ||
262 | * This function gets the OPP of the APE. | ||
263 | */ | ||
264 | enum prcmu_ape_opp prcmu_get_ape_opp(void) | ||
265 | { | ||
266 | return readb(ACK_MB1_CURR_APEOPP); | ||
267 | } | ||
268 | EXPORT_SYMBOL(prcmu_get_ape_opp); | ||
269 | |||
270 | /** | ||
271 | * prcmu_get_cpu_opp() - Get the OPP of the CPU. | ||
272 | * | ||
273 | * This function gets the OPP of the CPU. The OPP is specified in %%. | ||
274 | * PRCMU_OPP_EXT is a special OPP value, not specified in %%. | ||
275 | */ | ||
276 | int prcmu_get_cpu_opp(void) | ||
277 | { | ||
278 | return readb(ACK_MB1_CURR_ARMOPP); | ||
279 | } | ||
280 | EXPORT_SYMBOL(prcmu_get_cpu_opp); | ||
281 | |||
282 | bool prcmu_has_arm_maxopp(void) | ||
283 | { | ||
284 | return (readb(PRCM_AVS_VARM_MAX_OPP) & PRCM_AVS_ISMODEENABLE_MASK) | ||
285 | == PRCM_AVS_ISMODEENABLE_MASK; | ||
286 | } | ||
287 | |||
288 | static void read_mailbox_0(void) | ||
289 | { | ||
290 | writel(MBOX_BIT(0), PRCM_ARM_IT1_CLEAR); | ||
291 | } | ||
292 | |||
293 | static void read_mailbox_1(void) | ||
294 | { | ||
295 | mb1_transfer.ack.arm_opp = readb(ACK_MB1_CURR_ARMOPP); | ||
296 | mb1_transfer.ack.ape_opp = readb(ACK_MB1_CURR_APEOPP); | ||
297 | complete(&mb1_transfer.work); | ||
298 | writel(MBOX_BIT(1), PRCM_ARM_IT1_CLEAR); | ||
299 | } | ||
300 | |||
301 | static void read_mailbox_2(void) | ||
302 | { | ||
303 | writel(MBOX_BIT(2), PRCM_ARM_IT1_CLEAR); | ||
304 | } | ||
305 | |||
306 | static void read_mailbox_3(void) | ||
307 | { | ||
308 | writel(MBOX_BIT(3), PRCM_ARM_IT1_CLEAR); | ||
309 | } | ||
310 | |||
311 | static void read_mailbox_4(void) | ||
312 | { | ||
313 | writel(MBOX_BIT(4), PRCM_ARM_IT1_CLEAR); | ||
314 | } | ||
315 | |||
316 | static void read_mailbox_5(void) | ||
317 | { | ||
318 | mb5_transfer.ack.status = readb(ACK_MB5_I2C_STATUS); | ||
319 | mb5_transfer.ack.value = readb(ACK_MB5_I2C_VAL); | ||
320 | complete(&mb5_transfer.work); | ||
321 | writel(MBOX_BIT(5), PRCM_ARM_IT1_CLEAR); | ||
322 | } | ||
323 | |||
324 | static void read_mailbox_6(void) | ||
325 | { | ||
326 | writel(MBOX_BIT(6), PRCM_ARM_IT1_CLEAR); | ||
327 | } | ||
328 | |||
329 | static void read_mailbox_7(void) | ||
330 | { | ||
331 | writel(MBOX_BIT(7), PRCM_ARM_IT1_CLEAR); | ||
332 | } | ||
333 | |||
334 | static void (* const read_mailbox[NUM_MBOX])(void) = { | ||
335 | read_mailbox_0, | ||
336 | read_mailbox_1, | ||
337 | read_mailbox_2, | ||
338 | read_mailbox_3, | ||
339 | read_mailbox_4, | ||
340 | read_mailbox_5, | ||
341 | read_mailbox_6, | ||
342 | read_mailbox_7 | ||
343 | }; | ||
344 | |||
345 | static irqreturn_t prcmu_irq_handler(int irq, void *data) | ||
346 | { | ||
347 | u32 bits; | ||
348 | u8 n; | ||
349 | |||
350 | bits = (readl(PRCM_ARM_IT1_VAL) & (MBOX_BIT(NUM_MBOX) - 1)); | ||
351 | if (unlikely(!bits)) | ||
352 | return IRQ_NONE; | ||
353 | |||
354 | for (n = 0; bits; n++) { | ||
355 | if (bits & MBOX_BIT(n)) { | ||
356 | bits -= MBOX_BIT(n); | ||
357 | read_mailbox[n](); | ||
358 | } | ||
359 | } | ||
360 | return IRQ_HANDLED; | ||
361 | } | ||
362 | |||
363 | void __init prcmu_early_init(void) | ||
364 | { | ||
365 | if (cpu_is_u8500v11() || cpu_is_u8500ed()) { | ||
366 | tcdm_base = __io_address(U8500_PRCMU_TCDM_BASE_V1); | ||
367 | } else if (cpu_is_u8500v2()) { | ||
368 | tcdm_base = __io_address(U8500_PRCMU_TCDM_BASE); | ||
369 | } else { | ||
370 | pr_err("prcmu: Unsupported chip version\n"); | ||
371 | BUG(); | ||
372 | } | ||
373 | } | ||
374 | |||
375 | static int __init prcmu_init(void) | ||
376 | { | ||
377 | if (cpu_is_u8500ed()) { | ||
378 | pr_err("prcmu: Unsupported chip version\n"); | ||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | mutex_init(&mb1_transfer.lock); | ||
383 | init_completion(&mb1_transfer.work); | ||
384 | mutex_init(&mb5_transfer.lock); | ||
385 | init_completion(&mb5_transfer.work); | ||
386 | |||
387 | /* Clean up the mailbox interrupts after pre-kernel code. */ | ||
388 | writel((MBOX_BIT(NUM_MBOX) - 1), PRCM_ARM_IT1_CLEAR); | ||
389 | |||
390 | return request_irq(IRQ_DB8500_PRCMU1, prcmu_irq_handler, 0, | ||
391 | "prcmu", NULL); | ||
392 | } | ||
393 | |||
394 | arch_initcall(prcmu_init); | ||
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 8addb1220b4f..a18180f2d007 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -24,11 +24,13 @@ config BLACKFIN | |||
24 | select HAVE_FUNCTION_TRACER | 24 | select HAVE_FUNCTION_TRACER |
25 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST | 25 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST |
26 | select HAVE_IDE | 26 | select HAVE_IDE |
27 | select HAVE_IRQ_WORK | ||
27 | select HAVE_KERNEL_GZIP if RAMKERNEL | 28 | select HAVE_KERNEL_GZIP if RAMKERNEL |
28 | select HAVE_KERNEL_BZIP2 if RAMKERNEL | 29 | select HAVE_KERNEL_BZIP2 if RAMKERNEL |
29 | select HAVE_KERNEL_LZMA if RAMKERNEL | 30 | select HAVE_KERNEL_LZMA if RAMKERNEL |
30 | select HAVE_KERNEL_LZO if RAMKERNEL | 31 | select HAVE_KERNEL_LZO if RAMKERNEL |
31 | select HAVE_OPROFILE | 32 | select HAVE_OPROFILE |
33 | select HAVE_PERF_EVENTS | ||
32 | select ARCH_WANT_OPTIONAL_GPIOLIB | 34 | select ARCH_WANT_OPTIONAL_GPIOLIB |
33 | select HAVE_GENERIC_HARDIRQS | 35 | select HAVE_GENERIC_HARDIRQS |
34 | select GENERIC_ATOMIC64 | 36 | select GENERIC_ATOMIC64 |
diff --git a/arch/blackfin/Kconfig.debug b/arch/blackfin/Kconfig.debug index 19ccfb3b67d3..e2a3d4c8ab9a 100644 --- a/arch/blackfin/Kconfig.debug +++ b/arch/blackfin/Kconfig.debug | |||
@@ -23,7 +23,7 @@ config DEBUG_VERBOSE | |||
23 | Most people should say N here. | 23 | Most people should say N here. |
24 | 24 | ||
25 | config DEBUG_MMRS | 25 | config DEBUG_MMRS |
26 | bool "Generate Blackfin MMR tree" | 26 | tristate "Generate Blackfin MMR tree" |
27 | select DEBUG_FS | 27 | select DEBUG_FS |
28 | help | 28 | help |
29 | Create a tree of Blackfin MMRs via the debugfs tree. If | 29 | Create a tree of Blackfin MMRs via the debugfs tree. If |
diff --git a/arch/blackfin/configs/BF527-EZKIT-V2_defconfig b/arch/blackfin/configs/BF527-EZKIT-V2_defconfig index 95cf2ba9de17..8465b3e6b862 100644 --- a/arch/blackfin/configs/BF527-EZKIT-V2_defconfig +++ b/arch/blackfin/configs/BF527-EZKIT-V2_defconfig | |||
@@ -121,13 +121,11 @@ CONFIG_LOGO=y | |||
121 | # CONFIG_LOGO_LINUX_VGA16 is not set | 121 | # CONFIG_LOGO_LINUX_VGA16 is not set |
122 | # CONFIG_LOGO_LINUX_CLUT224 is not set | 122 | # CONFIG_LOGO_LINUX_CLUT224 is not set |
123 | # CONFIG_LOGO_BLACKFIN_VGA16 is not set | 123 | # CONFIG_LOGO_BLACKFIN_VGA16 is not set |
124 | CONFIG_SOUND=m | 124 | CONFIG_SOUND=y |
125 | CONFIG_SND=m | 125 | CONFIG_SND=y |
126 | CONFIG_SND_SOC=m | 126 | CONFIG_SND_SOC=y |
127 | CONFIG_SND_BF5XX_I2S=m | 127 | CONFIG_SND_BF5XX_I2S=y |
128 | CONFIG_SND_BF5XX_SOC_SSM2602=m | 128 | CONFIG_SND_BF5XX_SOC_SSM2602=y |
129 | CONFIG_SND_BF5XX_AC97=m | ||
130 | CONFIG_SND_BF5XX_SOC_AD1980=m | ||
131 | CONFIG_HID_A4TECH=y | 129 | CONFIG_HID_A4TECH=y |
132 | CONFIG_HID_APPLE=y | 130 | CONFIG_HID_APPLE=y |
133 | CONFIG_HID_BELKIN=y | 131 | CONFIG_HID_BELKIN=y |
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig index 8be8e33fac52..5e7321b26040 100644 --- a/arch/blackfin/configs/BF527-EZKIT_defconfig +++ b/arch/blackfin/configs/BF527-EZKIT_defconfig | |||
@@ -96,7 +96,7 @@ CONFIG_SERIAL_BFIN_UART1=y | |||
96 | # CONFIG_HW_RANDOM is not set | 96 | # CONFIG_HW_RANDOM is not set |
97 | CONFIG_I2C=y | 97 | CONFIG_I2C=y |
98 | CONFIG_I2C_CHARDEV=m | 98 | CONFIG_I2C_CHARDEV=m |
99 | CONFIG_I2C_BLACKFIN_TWI=m | 99 | CONFIG_I2C_BLACKFIN_TWI=y |
100 | CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100 | 100 | CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100 |
101 | CONFIG_SPI=y | 101 | CONFIG_SPI=y |
102 | CONFIG_SPI_BFIN=y | 102 | CONFIG_SPI_BFIN=y |
@@ -115,13 +115,11 @@ CONFIG_LOGO=y | |||
115 | # CONFIG_LOGO_LINUX_VGA16 is not set | 115 | # CONFIG_LOGO_LINUX_VGA16 is not set |
116 | # CONFIG_LOGO_LINUX_CLUT224 is not set | 116 | # CONFIG_LOGO_LINUX_CLUT224 is not set |
117 | # CONFIG_LOGO_BLACKFIN_VGA16 is not set | 117 | # CONFIG_LOGO_BLACKFIN_VGA16 is not set |
118 | CONFIG_SOUND=m | 118 | CONFIG_SOUND=y |
119 | CONFIG_SND=m | 119 | CONFIG_SND=y |
120 | CONFIG_SND_SOC=m | 120 | CONFIG_SND_SOC=y |
121 | CONFIG_SND_BF5XX_I2S=m | 121 | CONFIG_SND_BF5XX_I2S=y |
122 | CONFIG_SND_BF5XX_SOC_SSM2602=m | 122 | CONFIG_SND_BF5XX_SOC_SSM2602=y |
123 | CONFIG_SND_BF5XX_AC97=m | ||
124 | CONFIG_SND_BF5XX_SOC_AD1980=m | ||
125 | CONFIG_HID_A4TECH=y | 123 | CONFIG_HID_A4TECH=y |
126 | CONFIG_HID_APPLE=y | 124 | CONFIG_HID_APPLE=y |
127 | CONFIG_HID_BELKIN=y | 125 | CONFIG_HID_BELKIN=y |
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig index 0aafde6c8c2d..b90d3792ed52 100644 --- a/arch/blackfin/configs/BF533-STAMP_defconfig +++ b/arch/blackfin/configs/BF533-STAMP_defconfig | |||
@@ -99,8 +99,6 @@ CONFIG_SND_PCM_OSS=m | |||
99 | CONFIG_SND_SOC=m | 99 | CONFIG_SND_SOC=m |
100 | CONFIG_SND_BF5XX_I2S=m | 100 | CONFIG_SND_BF5XX_I2S=m |
101 | CONFIG_SND_BF5XX_SOC_AD73311=m | 101 | CONFIG_SND_BF5XX_SOC_AD73311=m |
102 | CONFIG_SND_BF5XX_AC97=m | ||
103 | CONFIG_SND_BF5XX_SOC_AD1980=m | ||
104 | # CONFIG_USB_SUPPORT is not set | 102 | # CONFIG_USB_SUPPORT is not set |
105 | CONFIG_RTC_CLASS=y | 103 | CONFIG_RTC_CLASS=y |
106 | CONFIG_RTC_DRV_BFIN=y | 104 | CONFIG_RTC_DRV_BFIN=y |
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig index c9077fb58135..005362537a7b 100644 --- a/arch/blackfin/configs/BF537-STAMP_defconfig +++ b/arch/blackfin/configs/BF537-STAMP_defconfig | |||
@@ -110,8 +110,6 @@ CONFIG_SND_PCM_OSS=m | |||
110 | CONFIG_SND_SOC=m | 110 | CONFIG_SND_SOC=m |
111 | CONFIG_SND_BF5XX_I2S=m | 111 | CONFIG_SND_BF5XX_I2S=m |
112 | CONFIG_SND_BF5XX_SOC_AD73311=m | 112 | CONFIG_SND_BF5XX_SOC_AD73311=m |
113 | CONFIG_SND_BF5XX_AC97=m | ||
114 | CONFIG_SND_BF5XX_SOC_AD1980=m | ||
115 | # CONFIG_USB_SUPPORT is not set | 113 | # CONFIG_USB_SUPPORT is not set |
116 | CONFIG_RTC_CLASS=y | 114 | CONFIG_RTC_CLASS=y |
117 | CONFIG_RTC_DRV_BFIN=y | 115 | CONFIG_RTC_DRV_BFIN=y |
diff --git a/arch/blackfin/include/asm/bfin-global.h b/arch/blackfin/include/asm/bfin-global.h index 121cc04d877d..17bcbf60bcae 100644 --- a/arch/blackfin/include/asm/bfin-global.h +++ b/arch/blackfin/include/asm/bfin-global.h | |||
@@ -49,16 +49,6 @@ extern void dump_bfin_trace_buffer(void); | |||
49 | #define dump_bfin_trace_buffer() | 49 | #define dump_bfin_trace_buffer() |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | /* init functions only */ | ||
53 | extern int init_arch_irq(void); | ||
54 | extern void init_exception_vectors(void); | ||
55 | extern void program_IAR(void); | ||
56 | |||
57 | extern asmlinkage void lower_to_irq14(void); | ||
58 | extern asmlinkage void bfin_return_from_exception(void); | ||
59 | extern asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs); | ||
60 | extern int bfin_internal_set_wake(unsigned int irq, unsigned int state); | ||
61 | |||
62 | extern void *l1_data_A_sram_alloc(size_t); | 52 | extern void *l1_data_A_sram_alloc(size_t); |
63 | extern void *l1_data_B_sram_alloc(size_t); | 53 | extern void *l1_data_B_sram_alloc(size_t); |
64 | extern void *l1_inst_sram_alloc(size_t); | 54 | extern void *l1_inst_sram_alloc(size_t); |
diff --git a/arch/blackfin/include/asm/bfin_pfmon.h b/arch/blackfin/include/asm/bfin_pfmon.h new file mode 100644 index 000000000000..accd47e2db40 --- /dev/null +++ b/arch/blackfin/include/asm/bfin_pfmon.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Blackfin Performance Monitor definitions | ||
3 | * | ||
4 | * Copyright 2005-2011 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the ADI BSD license or GPL-2 (or later). | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASM_BFIN_PFMON_H__ | ||
10 | #define __ASM_BFIN_PFMON_H__ | ||
11 | |||
12 | /* PFCTL Masks */ | ||
13 | #define PFMON_MASK 0xff | ||
14 | #define PFCEN_MASK 0x3 | ||
15 | #define PFCEN_DISABLE 0x0 | ||
16 | #define PFCEN_ENABLE_USER 0x1 | ||
17 | #define PFCEN_ENABLE_SUPV 0x2 | ||
18 | #define PFCEN_ENABLE_ALL (PFCEN_ENABLE_USER | PFCEN_ENABLE_SUPV) | ||
19 | |||
20 | #define PFPWR_P 0 | ||
21 | #define PEMUSW0_P 2 | ||
22 | #define PFCEN0_P 3 | ||
23 | #define PFMON0_P 5 | ||
24 | #define PEMUSW1_P 13 | ||
25 | #define PFCEN1_P 14 | ||
26 | #define PFMON1_P 16 | ||
27 | #define PFCNT0_P 24 | ||
28 | #define PFCNT1_P 25 | ||
29 | |||
30 | #define PFPWR (1 << PFPWR_P) | ||
31 | #define PEMUSW(n, x) ((x) << ((n) ? PEMUSW1_P : PEMUSW0_P)) | ||
32 | #define PEMUSW0 PEMUSW(0, 1) | ||
33 | #define PEMUSW1 PEMUSW(1, 1) | ||
34 | #define PFCEN(n, x) ((x) << ((n) ? PFCEN1_P : PFCEN0_P)) | ||
35 | #define PFCEN0 PFCEN(0, PFCEN_MASK) | ||
36 | #define PFCEN1 PFCEN(1, PFCEN_MASK) | ||
37 | #define PFCNT(n, x) ((x) << ((n) ? PFCNT1_P : PFCNT0_P)) | ||
38 | #define PFCNT0 PFCNT(0, 1) | ||
39 | #define PFCNT1 PFCNT(1, 1) | ||
40 | #define PFMON(n, x) ((x) << ((n) ? PFMON1_P : PFMON0_P)) | ||
41 | #define PFMON0 PFMON(0, PFMON_MASK) | ||
42 | #define PFMON1 PFMON(1, PFMON_MASK) | ||
43 | |||
44 | #endif | ||
diff --git a/arch/blackfin/include/asm/bfin_sport.h b/arch/blackfin/include/asm/bfin_sport.h index d27600c262c2..f8568a31d0ab 100644 --- a/arch/blackfin/include/asm/bfin_sport.h +++ b/arch/blackfin/include/asm/bfin_sport.h | |||
@@ -100,6 +100,10 @@ struct sport_register { | |||
100 | }; | 100 | }; |
101 | #undef __BFP | 101 | #undef __BFP |
102 | 102 | ||
103 | struct bfin_snd_platform_data { | ||
104 | const unsigned short *pin_req; | ||
105 | }; | ||
106 | |||
103 | #define bfin_read_sport_rx32(base) \ | 107 | #define bfin_read_sport_rx32(base) \ |
104 | ({ \ | 108 | ({ \ |
105 | struct sport_register *__mmrs = (void *)base; \ | 109 | struct sport_register *__mmrs = (void *)base; \ |
diff --git a/arch/blackfin/include/asm/cacheflush.h b/arch/blackfin/include/asm/cacheflush.h index 77135b62818e..9a5b2c572ebf 100644 --- a/arch/blackfin/include/asm/cacheflush.h +++ b/arch/blackfin/include/asm/cacheflush.h | |||
@@ -39,8 +39,13 @@ extern void blackfin_invalidate_entire_icache(void); | |||
39 | 39 | ||
40 | static inline void flush_icache_range(unsigned start, unsigned end) | 40 | static inline void flush_icache_range(unsigned start, unsigned end) |
41 | { | 41 | { |
42 | #if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) || defined(CONFIG_BFIN_L2_WRITEBACK) | 42 | #if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) |
43 | blackfin_dcache_flush_range(start, end); | 43 | if (end <= physical_mem_end) |
44 | blackfin_dcache_flush_range(start, end); | ||
45 | #endif | ||
46 | #if defined(CONFIG_BFIN_L2_WRITEBACK) | ||
47 | if (start >= L2_START && end <= L2_START + L2_LENGTH) | ||
48 | blackfin_dcache_flush_range(start, end); | ||
44 | #endif | 49 | #endif |
45 | 50 | ||
46 | /* Make sure all write buffers in the data side of the core | 51 | /* Make sure all write buffers in the data side of the core |
@@ -52,9 +57,17 @@ static inline void flush_icache_range(unsigned start, unsigned end) | |||
52 | * the pipeline. | 57 | * the pipeline. |
53 | */ | 58 | */ |
54 | SSYNC(); | 59 | SSYNC(); |
55 | #if defined(CONFIG_BFIN_ICACHE) | 60 | #if defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) |
56 | blackfin_icache_flush_range(start, end); | 61 | if (end <= physical_mem_end) { |
57 | flush_icache_range_others(start, end); | 62 | blackfin_icache_flush_range(start, end); |
63 | flush_icache_range_others(start, end); | ||
64 | } | ||
65 | #endif | ||
66 | #if defined(CONFIG_BFIN_L2_ICACHEABLE) | ||
67 | if (start >= L2_START && end <= L2_START + L2_LENGTH) { | ||
68 | blackfin_icache_flush_range(start, end); | ||
69 | flush_icache_range_others(start, end); | ||
70 | } | ||
58 | #endif | 71 | #endif |
59 | } | 72 | } |
60 | 73 | ||
diff --git a/arch/blackfin/include/asm/cpu.h b/arch/blackfin/include/asm/cpu.h index 16883e582e3c..05043786da21 100644 --- a/arch/blackfin/include/asm/cpu.h +++ b/arch/blackfin/include/asm/cpu.h | |||
@@ -10,11 +10,8 @@ | |||
10 | 10 | ||
11 | #include <linux/percpu.h> | 11 | #include <linux/percpu.h> |
12 | 12 | ||
13 | struct task_struct; | ||
14 | |||
15 | struct blackfin_cpudata { | 13 | struct blackfin_cpudata { |
16 | struct cpu cpu; | 14 | struct cpu cpu; |
17 | struct task_struct *idle; | ||
18 | unsigned int imemctl; | 15 | unsigned int imemctl; |
19 | unsigned int dmemctl; | 16 | unsigned int dmemctl; |
20 | }; | 17 | }; |
diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h index 7600fe0696af..823679011457 100644 --- a/arch/blackfin/include/asm/def_LPBlackfin.h +++ b/arch/blackfin/include/asm/def_LPBlackfin.h | |||
@@ -52,10 +52,10 @@ | |||
52 | 52 | ||
53 | #define bfin_read(addr) \ | 53 | #define bfin_read(addr) \ |
54 | ({ \ | 54 | ({ \ |
55 | sizeof(*(addr)) == 1 ? bfin_read8(addr) : \ | 55 | sizeof(*(addr)) == 1 ? bfin_read8(addr) : \ |
56 | sizeof(*(addr)) == 2 ? bfin_read16(addr) : \ | 56 | sizeof(*(addr)) == 2 ? bfin_read16(addr) : \ |
57 | sizeof(*(addr)) == 4 ? bfin_read32(addr) : \ | 57 | sizeof(*(addr)) == 4 ? bfin_read32(addr) : \ |
58 | ({ BUG(); 0; }); \ | 58 | ({ BUG(); 0; }); \ |
59 | }) | 59 | }) |
60 | #define bfin_write(addr, val) \ | 60 | #define bfin_write(addr, val) \ |
61 | do { \ | 61 | do { \ |
@@ -69,13 +69,13 @@ do { \ | |||
69 | 69 | ||
70 | #define bfin_write_or(addr, bits) \ | 70 | #define bfin_write_or(addr, bits) \ |
71 | do { \ | 71 | do { \ |
72 | void *__addr = (void *)(addr); \ | 72 | typeof(addr) __addr = (addr); \ |
73 | bfin_write(__addr, bfin_read(__addr) | (bits)); \ | 73 | bfin_write(__addr, bfin_read(__addr) | (bits)); \ |
74 | } while (0) | 74 | } while (0) |
75 | 75 | ||
76 | #define bfin_write_and(addr, bits) \ | 76 | #define bfin_write_and(addr, bits) \ |
77 | do { \ | 77 | do { \ |
78 | void *__addr = (void *)(addr); \ | 78 | typeof(addr) __addr = (addr); \ |
79 | bfin_write(__addr, bfin_read(__addr) & (bits)); \ | 79 | bfin_write(__addr, bfin_read(__addr) & (bits)); \ |
80 | } while (0) | 80 | } while (0) |
81 | 81 | ||
diff --git a/arch/blackfin/include/asm/irq_handler.h b/arch/blackfin/include/asm/irq_handler.h index 7fbe42307b9a..ee73f79aef10 100644 --- a/arch/blackfin/include/asm/irq_handler.h +++ b/arch/blackfin/include/asm/irq_handler.h | |||
@@ -10,6 +10,16 @@ | |||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/linkage.h> | 11 | #include <linux/linkage.h> |
12 | 12 | ||
13 | /* init functions only */ | ||
14 | extern int __init init_arch_irq(void); | ||
15 | extern void init_exception_vectors(void); | ||
16 | extern void __init program_IAR(void); | ||
17 | #ifdef init_mach_irq | ||
18 | extern void __init init_mach_irq(void); | ||
19 | #else | ||
20 | # define init_mach_irq() | ||
21 | #endif | ||
22 | |||
13 | /* BASE LEVEL interrupt handler routines */ | 23 | /* BASE LEVEL interrupt handler routines */ |
14 | asmlinkage void evt_exception(void); | 24 | asmlinkage void evt_exception(void); |
15 | asmlinkage void trap(void); | 25 | asmlinkage void trap(void); |
@@ -37,4 +47,19 @@ extern void return_from_exception(void); | |||
37 | extern int bfin_request_exception(unsigned int exception, void (*handler)(void)); | 47 | extern int bfin_request_exception(unsigned int exception, void (*handler)(void)); |
38 | extern int bfin_free_exception(unsigned int exception, void (*handler)(void)); | 48 | extern int bfin_free_exception(unsigned int exception, void (*handler)(void)); |
39 | 49 | ||
50 | extern asmlinkage void lower_to_irq14(void); | ||
51 | extern asmlinkage void bfin_return_from_exception(void); | ||
52 | extern asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs); | ||
53 | extern int bfin_internal_set_wake(unsigned int irq, unsigned int state); | ||
54 | |||
55 | struct irq_data; | ||
56 | extern void bfin_handle_irq(unsigned irq); | ||
57 | extern void bfin_ack_noop(struct irq_data *); | ||
58 | extern void bfin_internal_mask_irq(unsigned int irq); | ||
59 | extern void bfin_internal_unmask_irq(unsigned int irq); | ||
60 | |||
61 | struct irq_desc; | ||
62 | extern void bfin_demux_mac_status_irq(unsigned int, struct irq_desc *); | ||
63 | extern void bfin_demux_gpio_irq(unsigned int, struct irq_desc *); | ||
64 | |||
40 | #endif | 65 | #endif |
diff --git a/arch/blackfin/include/asm/kgdb.h b/arch/blackfin/include/asm/kgdb.h index 8651afe12990..3ac0c72e9fee 100644 --- a/arch/blackfin/include/asm/kgdb.h +++ b/arch/blackfin/include/asm/kgdb.h | |||
@@ -103,7 +103,11 @@ static inline void arch_kgdb_breakpoint(void) | |||
103 | asm("EXCPT 2;"); | 103 | asm("EXCPT 2;"); |
104 | } | 104 | } |
105 | #define BREAK_INSTR_SIZE 2 | 105 | #define BREAK_INSTR_SIZE 2 |
106 | #define CACHE_FLUSH_IS_SAFE 1 | 106 | #ifdef CONFIG_SMP |
107 | # define CACHE_FLUSH_IS_SAFE 0 | ||
108 | #else | ||
109 | # define CACHE_FLUSH_IS_SAFE 1 | ||
110 | #endif | ||
107 | #define HW_INST_WATCHPOINT_NUM 6 | 111 | #define HW_INST_WATCHPOINT_NUM 6 |
108 | #define HW_WATCHPOINT_NUM 8 | 112 | #define HW_WATCHPOINT_NUM 8 |
109 | #define TYPE_INST_WATCHPOINT 0 | 113 | #define TYPE_INST_WATCHPOINT 0 |
diff --git a/arch/blackfin/include/asm/perf_event.h b/arch/blackfin/include/asm/perf_event.h new file mode 100644 index 000000000000..3d2b1716322f --- /dev/null +++ b/arch/blackfin/include/asm/perf_event.h | |||
@@ -0,0 +1 @@ | |||
#define MAX_HWEVENTS 2 | |||
diff --git a/arch/blackfin/include/asm/ptrace.h b/arch/blackfin/include/asm/ptrace.h index 832d7c009a2c..1066d63e62b5 100644 --- a/arch/blackfin/include/asm/ptrace.h +++ b/arch/blackfin/include/asm/ptrace.h | |||
@@ -108,8 +108,6 @@ struct pt_regs { | |||
108 | extern void show_regs(struct pt_regs *); | 108 | extern void show_regs(struct pt_regs *); |
109 | 109 | ||
110 | #define arch_has_single_step() (1) | 110 | #define arch_has_single_step() (1) |
111 | extern void user_enable_single_step(struct task_struct *child); | ||
112 | extern void user_disable_single_step(struct task_struct *child); | ||
113 | /* common code demands this function */ | 111 | /* common code demands this function */ |
114 | #define ptrace_disable(child) user_disable_single_step(child) | 112 | #define ptrace_disable(child) user_disable_single_step(child) |
115 | 113 | ||
diff --git a/arch/blackfin/include/mach-common/irq.h b/arch/blackfin/include/mach-common/irq.h new file mode 100644 index 000000000000..cab14e911dc2 --- /dev/null +++ b/arch/blackfin/include/mach-common/irq.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Common Blackfin IRQ definitions (i.e. the CEC) | ||
3 | * | ||
4 | * Copyright 2005-2011 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later | ||
7 | */ | ||
8 | |||
9 | #ifndef _MACH_COMMON_IRQ_H_ | ||
10 | #define _MACH_COMMON_IRQ_H_ | ||
11 | |||
12 | /* | ||
13 | * Core events interrupt source definitions | ||
14 | * | ||
15 | * Event Source Event Name | ||
16 | * Emulation EMU 0 (highest priority) | ||
17 | * Reset RST 1 | ||
18 | * NMI NMI 2 | ||
19 | * Exception EVX 3 | ||
20 | * Reserved -- 4 | ||
21 | * Hardware Error IVHW 5 | ||
22 | * Core Timer IVTMR 6 | ||
23 | * Peripherals IVG7 7 | ||
24 | * Peripherals IVG8 8 | ||
25 | * Peripherals IVG9 9 | ||
26 | * Peripherals IVG10 10 | ||
27 | * Peripherals IVG11 11 | ||
28 | * Peripherals IVG12 12 | ||
29 | * Peripherals IVG13 13 | ||
30 | * Softirq IVG14 14 | ||
31 | * System Call IVG15 15 (lowest priority) | ||
32 | */ | ||
33 | |||
34 | /* The ABSTRACT IRQ definitions */ | ||
35 | #define IRQ_EMU 0 /* Emulation */ | ||
36 | #define IRQ_RST 1 /* reset */ | ||
37 | #define IRQ_NMI 2 /* Non Maskable */ | ||
38 | #define IRQ_EVX 3 /* Exception */ | ||
39 | #define IRQ_UNUSED 4 /* - unused interrupt */ | ||
40 | #define IRQ_HWERR 5 /* Hardware Error */ | ||
41 | #define IRQ_CORETMR 6 /* Core timer */ | ||
42 | |||
43 | #define BFIN_IRQ(x) ((x) + 7) | ||
44 | |||
45 | #define IVG7 7 | ||
46 | #define IVG8 8 | ||
47 | #define IVG9 9 | ||
48 | #define IVG10 10 | ||
49 | #define IVG11 11 | ||
50 | #define IVG12 12 | ||
51 | #define IVG13 13 | ||
52 | #define IVG14 14 | ||
53 | #define IVG15 15 | ||
54 | |||
55 | #define NR_IRQS (NR_MACH_IRQS + NR_SPARE_IRQS) | ||
56 | |||
57 | #endif | ||
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile index ca5ccc777772..d550b24d9e9b 100644 --- a/arch/blackfin/kernel/Makefile +++ b/arch/blackfin/kernel/Makefile | |||
@@ -33,7 +33,10 @@ obj-$(CONFIG_EARLY_PRINTK) += shadow_console.o | |||
33 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 33 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
34 | obj-$(CONFIG_DEBUG_VERBOSE) += trace.o | 34 | obj-$(CONFIG_DEBUG_VERBOSE) += trace.o |
35 | obj-$(CONFIG_BFIN_PSEUDODBG_INSNS) += pseudodbg.o | 35 | obj-$(CONFIG_BFIN_PSEUDODBG_INSNS) += pseudodbg.o |
36 | obj-$(CONFIG_PERF_EVENTS) += perf_event.o | ||
36 | 37 | ||
37 | # the kgdb test puts code into L2 and without linker | 38 | # the kgdb test puts code into L2 and without linker |
38 | # relaxation, we need to force long calls to/from it | 39 | # relaxation, we need to force long calls to/from it |
39 | CFLAGS_kgdb_test.o := -mlong-calls -O0 | 40 | CFLAGS_kgdb_test.o := -mlong-calls -O0 |
41 | |||
42 | obj-$(CONFIG_DEBUG_MMRS) += debug-mmrs.o | ||
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c index 6ce8dce753c9..71dbaa4a48af 100644 --- a/arch/blackfin/kernel/bfin_dma_5xx.c +++ b/arch/blackfin/kernel/bfin_dma_5xx.c | |||
@@ -36,6 +36,11 @@ static int __init blackfin_dma_init(void) | |||
36 | 36 | ||
37 | printk(KERN_INFO "Blackfin DMA Controller\n"); | 37 | printk(KERN_INFO "Blackfin DMA Controller\n"); |
38 | 38 | ||
39 | |||
40 | #if ANOMALY_05000480 | ||
41 | bfin_write_DMAC_TC_PER(0x0111); | ||
42 | #endif | ||
43 | |||
39 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { | 44 | for (i = 0; i < MAX_DMA_CHANNELS; i++) { |
40 | atomic_set(&dma_ch[i].chan_status, 0); | 45 | atomic_set(&dma_ch[i].chan_status, 0); |
41 | dma_ch[i].regs = dma_io_base_addr[i]; | 46 | dma_ch[i].regs = dma_io_base_addr[i]; |
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index 170cf90735ba..bcf8cf6fe412 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
@@ -10,10 +10,12 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/err.h> | 11 | #include <linux/err.h> |
12 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_fs.h> |
13 | #include <linux/seq_file.h> | ||
13 | #include <asm/blackfin.h> | 14 | #include <asm/blackfin.h> |
14 | #include <asm/gpio.h> | 15 | #include <asm/gpio.h> |
15 | #include <asm/portmux.h> | 16 | #include <asm/portmux.h> |
16 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
18 | #include <asm/irq_handler.h> | ||
17 | 19 | ||
18 | #if ANOMALY_05000311 || ANOMALY_05000323 | 20 | #if ANOMALY_05000311 || ANOMALY_05000323 |
19 | enum { | 21 | enum { |
@@ -534,7 +536,7 @@ static const unsigned int sic_iwr_irqs[] = { | |||
534 | #if defined(BF533_FAMILY) | 536 | #if defined(BF533_FAMILY) |
535 | IRQ_PROG_INTB | 537 | IRQ_PROG_INTB |
536 | #elif defined(BF537_FAMILY) | 538 | #elif defined(BF537_FAMILY) |
537 | IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX | 539 | IRQ_PF_INTB_WATCH, IRQ_PORTG_INTB, IRQ_PH_INTB_MAC_TX |
538 | #elif defined(BF538_FAMILY) | 540 | #elif defined(BF538_FAMILY) |
539 | IRQ_PORTF_INTB | 541 | IRQ_PORTF_INTB |
540 | #elif defined(CONFIG_BF52x) || defined(CONFIG_BF51x) | 542 | #elif defined(CONFIG_BF52x) || defined(CONFIG_BF51x) |
@@ -1203,35 +1205,43 @@ void bfin_reset_boot_spi_cs(unsigned short pin) | |||
1203 | } | 1205 | } |
1204 | 1206 | ||
1205 | #if defined(CONFIG_PROC_FS) | 1207 | #if defined(CONFIG_PROC_FS) |
1206 | static int gpio_proc_read(char *buf, char **start, off_t offset, | 1208 | static int gpio_proc_show(struct seq_file *m, void *v) |
1207 | int len, int *unused_i, void *unused_v) | ||
1208 | { | 1209 | { |
1209 | int c, irq, gpio, outlen = 0; | 1210 | int c, irq, gpio; |
1210 | 1211 | ||
1211 | for (c = 0; c < MAX_RESOURCES; c++) { | 1212 | for (c = 0; c < MAX_RESOURCES; c++) { |
1212 | irq = is_reserved(gpio_irq, c, 1); | 1213 | irq = is_reserved(gpio_irq, c, 1); |
1213 | gpio = is_reserved(gpio, c, 1); | 1214 | gpio = is_reserved(gpio, c, 1); |
1214 | if (!check_gpio(c) && (gpio || irq)) | 1215 | if (!check_gpio(c) && (gpio || irq)) |
1215 | len = sprintf(buf, "GPIO_%d: \t%s%s \t\tGPIO %s\n", c, | 1216 | seq_printf(m, "GPIO_%d: \t%s%s \t\tGPIO %s\n", c, |
1216 | get_label(c), (gpio && irq) ? " *" : "", | 1217 | get_label(c), (gpio && irq) ? " *" : "", |
1217 | get_gpio_dir(c) ? "OUTPUT" : "INPUT"); | 1218 | get_gpio_dir(c) ? "OUTPUT" : "INPUT"); |
1218 | else if (is_reserved(peri, c, 1)) | 1219 | else if (is_reserved(peri, c, 1)) |
1219 | len = sprintf(buf, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c)); | 1220 | seq_printf(m, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c)); |
1220 | else | 1221 | else |
1221 | continue; | 1222 | continue; |
1222 | buf += len; | ||
1223 | outlen += len; | ||
1224 | } | 1223 | } |
1225 | return outlen; | 1224 | |
1225 | return 0; | ||
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | static int gpio_proc_open(struct inode *inode, struct file *file) | ||
1229 | { | ||
1230 | return single_open(file, gpio_proc_show, NULL); | ||
1231 | } | ||
1232 | |||
1233 | static const struct file_operations gpio_proc_ops = { | ||
1234 | .open = gpio_proc_open, | ||
1235 | .read = seq_read, | ||
1236 | .llseek = seq_lseek, | ||
1237 | .release = single_release, | ||
1238 | }; | ||
1239 | |||
1228 | static __init int gpio_register_proc(void) | 1240 | static __init int gpio_register_proc(void) |
1229 | { | 1241 | { |
1230 | struct proc_dir_entry *proc_gpio; | 1242 | struct proc_dir_entry *proc_gpio; |
1231 | 1243 | ||
1232 | proc_gpio = create_proc_entry("gpio", S_IRUGO, NULL); | 1244 | proc_gpio = proc_create("gpio", S_IRUGO, NULL, &gpio_proc_ops); |
1233 | if (proc_gpio) | ||
1234 | proc_gpio->read_proc = gpio_proc_read; | ||
1235 | return proc_gpio != NULL; | 1245 | return proc_gpio != NULL; |
1236 | } | 1246 | } |
1237 | __initcall(gpio_register_proc); | 1247 | __initcall(gpio_register_proc); |
diff --git a/arch/blackfin/kernel/bfin_ksyms.c b/arch/blackfin/kernel/bfin_ksyms.c index 2c264b51566a..c446591b961d 100644 --- a/arch/blackfin/kernel/bfin_ksyms.c +++ b/arch/blackfin/kernel/bfin_ksyms.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <asm/cacheflush.h> | 12 | #include <asm/cacheflush.h> |
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/irq_handler.h> | ||
14 | 15 | ||
15 | /* Allow people to have their own Blackfin exception handler in a module */ | 16 | /* Allow people to have their own Blackfin exception handler in a module */ |
16 | EXPORT_SYMBOL(bfin_return_from_exception); | 17 | EXPORT_SYMBOL(bfin_return_from_exception); |
diff --git a/arch/blackfin/kernel/debug-mmrs.c b/arch/blackfin/kernel/debug-mmrs.c new file mode 100644 index 000000000000..94b1d8a0256a --- /dev/null +++ b/arch/blackfin/kernel/debug-mmrs.c | |||
@@ -0,0 +1,1860 @@ | |||
1 | /* | ||
2 | * debugfs interface to core/system MMRs | ||
3 | * | ||
4 | * Copyright 2007-2011 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later | ||
7 | */ | ||
8 | |||
9 | #include <linux/debugfs.h> | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/module.h> | ||
13 | |||
14 | #include <asm/blackfin.h> | ||
15 | #include <asm/gpio.h> | ||
16 | #include <asm/bfin_can.h> | ||
17 | #include <asm/bfin_dma.h> | ||
18 | #include <asm/bfin_ppi.h> | ||
19 | #include <asm/bfin_serial.h> | ||
20 | #include <asm/bfin5xx_spi.h> | ||
21 | #include <asm/bfin_twi.h> | ||
22 | |||
23 | /* Common code defines PORT_MUX on us, so redirect the MMR back locally */ | ||
24 | #ifdef BFIN_PORT_MUX | ||
25 | #undef PORT_MUX | ||
26 | #define PORT_MUX BFIN_PORT_MUX | ||
27 | #endif | ||
28 | |||
29 | #define _d(name, bits, addr, perms) debugfs_create_x##bits(name, perms, parent, (u##bits *)addr) | ||
30 | #define d(name, bits, addr) _d(name, bits, addr, S_IRUSR|S_IWUSR) | ||
31 | #define d_RO(name, bits, addr) _d(name, bits, addr, S_IRUSR) | ||
32 | #define d_WO(name, bits, addr) _d(name, bits, addr, S_IWUSR) | ||
33 | |||
34 | #define D_RO(name, bits) d_RO(#name, bits, name) | ||
35 | #define D_WO(name, bits) d_WO(#name, bits, name) | ||
36 | #define D32(name) d(#name, 32, name) | ||
37 | #define D16(name) d(#name, 16, name) | ||
38 | |||
39 | #define REGS_OFF(peri, mmr) offsetof(struct bfin_##peri##_regs, mmr) | ||
40 | #define __REGS(peri, sname, rname) \ | ||
41 | do { \ | ||
42 | struct bfin_##peri##_regs r; \ | ||
43 | void *addr = (void *)(base + REGS_OFF(peri, rname)); \ | ||
44 | strcpy(_buf, sname); \ | ||
45 | if (sizeof(r.rname) == 2) \ | ||
46 | debugfs_create_x16(buf, S_IRUSR|S_IWUSR, parent, addr); \ | ||
47 | else \ | ||
48 | debugfs_create_x32(buf, S_IRUSR|S_IWUSR, parent, addr); \ | ||
49 | } while (0) | ||
50 | #define REGS_STR_PFX(buf, pfx, num) \ | ||
51 | ({ \ | ||
52 | buf + (num >= 0 ? \ | ||
53 | sprintf(buf, #pfx "%i_", num) : \ | ||
54 | sprintf(buf, #pfx "_")); \ | ||
55 | }) | ||
56 | #define REGS_STR_PFX_C(buf, pfx, num) \ | ||
57 | ({ \ | ||
58 | buf + (num >= 0 ? \ | ||
59 | sprintf(buf, #pfx "%c_", 'A' + num) : \ | ||
60 | sprintf(buf, #pfx "_")); \ | ||
61 | }) | ||
62 | |||
63 | /* | ||
64 | * Core registers (not memory mapped) | ||
65 | */ | ||
66 | extern u32 last_seqstat; | ||
67 | |||
68 | static int debug_cclk_get(void *data, u64 *val) | ||
69 | { | ||
70 | *val = get_cclk(); | ||
71 | return 0; | ||
72 | } | ||
73 | DEFINE_SIMPLE_ATTRIBUTE(fops_debug_cclk, debug_cclk_get, NULL, "0x%08llx\n"); | ||
74 | |||
75 | static int debug_sclk_get(void *data, u64 *val) | ||
76 | { | ||
77 | *val = get_sclk(); | ||
78 | return 0; | ||
79 | } | ||
80 | DEFINE_SIMPLE_ATTRIBUTE(fops_debug_sclk, debug_sclk_get, NULL, "0x%08llx\n"); | ||
81 | |||
82 | #define DEFINE_SYSREG(sr, pre, post) \ | ||
83 | static int sysreg_##sr##_get(void *data, u64 *val) \ | ||
84 | { \ | ||
85 | unsigned long tmp; \ | ||
86 | pre; \ | ||
87 | __asm__ __volatile__("%0 = " #sr ";" : "=d"(tmp)); \ | ||
88 | *val = tmp; \ | ||
89 | return 0; \ | ||
90 | } \ | ||
91 | static int sysreg_##sr##_set(void *data, u64 val) \ | ||
92 | { \ | ||
93 | unsigned long tmp = val; \ | ||
94 | __asm__ __volatile__(#sr " = %0;" : : "d"(tmp)); \ | ||
95 | post; \ | ||
96 | return 0; \ | ||
97 | } \ | ||
98 | DEFINE_SIMPLE_ATTRIBUTE(fops_sysreg_##sr, sysreg_##sr##_get, sysreg_##sr##_set, "0x%08llx\n") | ||
99 | |||
100 | DEFINE_SYSREG(cycles, , ); | ||
101 | DEFINE_SYSREG(cycles2, __asm__ __volatile__("%0 = cycles;" : "=d"(tmp)), ); | ||
102 | DEFINE_SYSREG(emudat, , ); | ||
103 | DEFINE_SYSREG(seqstat, , ); | ||
104 | DEFINE_SYSREG(syscfg, , CSYNC()); | ||
105 | #define D_SYSREG(sr) debugfs_create_file(#sr, S_IRUSR|S_IWUSR, parent, NULL, &fops_sysreg_##sr) | ||
106 | |||
107 | /* | ||
108 | * CAN | ||
109 | */ | ||
110 | #define CAN_OFF(mmr) REGS_OFF(can, mmr) | ||
111 | #define __CAN(uname, lname) __REGS(can, #uname, lname) | ||
112 | static void __init __maybe_unused | ||
113 | bfin_debug_mmrs_can(struct dentry *parent, unsigned long base, int num) | ||
114 | { | ||
115 | static struct dentry *am, *mb; | ||
116 | int i, j; | ||
117 | char buf[32], *_buf = REGS_STR_PFX(buf, CAN, num); | ||
118 | |||
119 | if (!am) { | ||
120 | am = debugfs_create_dir("am", parent); | ||
121 | mb = debugfs_create_dir("mb", parent); | ||
122 | } | ||
123 | |||
124 | __CAN(MC1, mc1); | ||
125 | __CAN(MD1, md1); | ||
126 | __CAN(TRS1, trs1); | ||
127 | __CAN(TRR1, trr1); | ||
128 | __CAN(TA1, ta1); | ||
129 | __CAN(AA1, aa1); | ||
130 | __CAN(RMP1, rmp1); | ||
131 | __CAN(RML1, rml1); | ||
132 | __CAN(MBTIF1, mbtif1); | ||
133 | __CAN(MBRIF1, mbrif1); | ||
134 | __CAN(MBIM1, mbim1); | ||
135 | __CAN(RFH1, rfh1); | ||
136 | __CAN(OPSS1, opss1); | ||
137 | |||
138 | __CAN(MC2, mc2); | ||
139 | __CAN(MD2, md2); | ||
140 | __CAN(TRS2, trs2); | ||
141 | __CAN(TRR2, trr2); | ||
142 | __CAN(TA2, ta2); | ||
143 | __CAN(AA2, aa2); | ||
144 | __CAN(RMP2, rmp2); | ||
145 | __CAN(RML2, rml2); | ||
146 | __CAN(MBTIF2, mbtif2); | ||
147 | __CAN(MBRIF2, mbrif2); | ||
148 | __CAN(MBIM2, mbim2); | ||
149 | __CAN(RFH2, rfh2); | ||
150 | __CAN(OPSS2, opss2); | ||
151 | |||
152 | __CAN(CLOCK, clock); | ||
153 | __CAN(TIMING, timing); | ||
154 | __CAN(DEBUG, debug); | ||
155 | __CAN(STATUS, status); | ||
156 | __CAN(CEC, cec); | ||
157 | __CAN(GIS, gis); | ||
158 | __CAN(GIM, gim); | ||
159 | __CAN(GIF, gif); | ||
160 | __CAN(CONTROL, control); | ||
161 | __CAN(INTR, intr); | ||
162 | __CAN(VERSION, version); | ||
163 | __CAN(MBTD, mbtd); | ||
164 | __CAN(EWR, ewr); | ||
165 | __CAN(ESR, esr); | ||
166 | /*__CAN(UCREG, ucreg); no longer exists */ | ||
167 | __CAN(UCCNT, uccnt); | ||
168 | __CAN(UCRC, ucrc); | ||
169 | __CAN(UCCNF, uccnf); | ||
170 | __CAN(VERSION2, version2); | ||
171 | |||
172 | for (i = 0; i < 32; ++i) { | ||
173 | sprintf(_buf, "AM%02iL", i); | ||
174 | debugfs_create_x16(buf, S_IRUSR|S_IWUSR, am, | ||
175 | (u16 *)(base + CAN_OFF(msk[i].aml))); | ||
176 | sprintf(_buf, "AM%02iH", i); | ||
177 | debugfs_create_x16(buf, S_IRUSR|S_IWUSR, am, | ||
178 | (u16 *)(base + CAN_OFF(msk[i].amh))); | ||
179 | |||
180 | for (j = 0; j < 3; ++j) { | ||
181 | sprintf(_buf, "MB%02i_DATA%i", i, j); | ||
182 | debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb, | ||
183 | (u16 *)(base + CAN_OFF(chl[i].data[j*2]))); | ||
184 | } | ||
185 | sprintf(_buf, "MB%02i_LENGTH", i); | ||
186 | debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb, | ||
187 | (u16 *)(base + CAN_OFF(chl[i].dlc))); | ||
188 | sprintf(_buf, "MB%02i_TIMESTAMP", i); | ||
189 | debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb, | ||
190 | (u16 *)(base + CAN_OFF(chl[i].tsv))); | ||
191 | sprintf(_buf, "MB%02i_ID0", i); | ||
192 | debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb, | ||
193 | (u16 *)(base + CAN_OFF(chl[i].id0))); | ||
194 | sprintf(_buf, "MB%02i_ID1", i); | ||
195 | debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb, | ||
196 | (u16 *)(base + CAN_OFF(chl[i].id1))); | ||
197 | } | ||
198 | } | ||
199 | #define CAN(num) bfin_debug_mmrs_can(parent, CAN##num##_MC1, num) | ||
200 | |||
201 | /* | ||
202 | * DMA | ||
203 | */ | ||
204 | #define __DMA(uname, lname) __REGS(dma, #uname, lname) | ||
205 | static void __init __maybe_unused | ||
206 | bfin_debug_mmrs_dma(struct dentry *parent, unsigned long base, int num, char mdma, const char *pfx) | ||
207 | { | ||
208 | char buf[32], *_buf; | ||
209 | |||
210 | if (mdma) | ||
211 | _buf = buf + sprintf(buf, "%s_%c%i_", pfx, mdma, num); | ||
212 | else | ||
213 | _buf = buf + sprintf(buf, "%s%i_", pfx, num); | ||
214 | |||
215 | __DMA(NEXT_DESC_PTR, next_desc_ptr); | ||
216 | __DMA(START_ADDR, start_addr); | ||
217 | __DMA(CONFIG, config); | ||
218 | __DMA(X_COUNT, x_count); | ||
219 | __DMA(X_MODIFY, x_modify); | ||
220 | __DMA(Y_COUNT, y_count); | ||
221 | __DMA(Y_MODIFY, y_modify); | ||
222 | __DMA(CURR_DESC_PTR, curr_desc_ptr); | ||
223 | __DMA(CURR_ADDR, curr_addr); | ||
224 | __DMA(IRQ_STATUS, irq_status); | ||
225 | __DMA(PERIPHERAL_MAP, peripheral_map); | ||
226 | __DMA(CURR_X_COUNT, curr_x_count); | ||
227 | __DMA(CURR_Y_COUNT, curr_y_count); | ||
228 | } | ||
229 | #define _DMA(num, base, mdma, pfx) bfin_debug_mmrs_dma(parent, base, num, mdma, pfx "DMA") | ||
230 | #define DMA(num) _DMA(num, DMA##num##_NEXT_DESC_PTR, 0, "") | ||
231 | #define _MDMA(num, x) \ | ||
232 | do { \ | ||
233 | _DMA(num, x##DMA_D##num##_CONFIG, 'D', #x); \ | ||
234 | _DMA(num, x##DMA_S##num##_CONFIG, 'S', #x); \ | ||
235 | } while (0) | ||
236 | #define MDMA(num) _MDMA(num, M) | ||
237 | #define IMDMA(num) _MDMA(num, IM) | ||
238 | |||
239 | /* | ||
240 | * EPPI | ||
241 | */ | ||
242 | #define __EPPI(uname, lname) __REGS(eppi, #uname, lname) | ||
243 | static void __init __maybe_unused | ||
244 | bfin_debug_mmrs_eppi(struct dentry *parent, unsigned long base, int num) | ||
245 | { | ||
246 | char buf[32], *_buf = REGS_STR_PFX(buf, EPPI, num); | ||
247 | __EPPI(STATUS, status); | ||
248 | __EPPI(HCOUNT, hcount); | ||
249 | __EPPI(HDELAY, hdelay); | ||
250 | __EPPI(VCOUNT, vcount); | ||
251 | __EPPI(VDELAY, vdelay); | ||
252 | __EPPI(FRAME, frame); | ||
253 | __EPPI(LINE, line); | ||
254 | __EPPI(CLKDIV, clkdiv); | ||
255 | __EPPI(CONTROL, control); | ||
256 | __EPPI(FS1W_HBL, fs1w_hbl); | ||
257 | __EPPI(FS1P_AVPL, fs1p_avpl); | ||
258 | __EPPI(FS2W_LVB, fs2w_lvb); | ||
259 | __EPPI(FS2P_LAVF, fs2p_lavf); | ||
260 | __EPPI(CLIP, clip); | ||
261 | } | ||
262 | #define EPPI(num) bfin_debug_mmrs_eppi(parent, EPPI##num##_STATUS, num) | ||
263 | |||
264 | /* | ||
265 | * General Purpose Timers | ||
266 | */ | ||
267 | #define GPTIMER_OFF(mmr) (TIMER0_##mmr - TIMER0_CONFIG) | ||
268 | #define __GPTIMER(name) \ | ||
269 | do { \ | ||
270 | strcpy(_buf, #name); \ | ||
271 | debugfs_create_x16(buf, S_IRUSR|S_IWUSR, parent, (u16 *)(base + GPTIMER_OFF(name))); \ | ||
272 | } while (0) | ||
273 | static void __init __maybe_unused | ||
274 | bfin_debug_mmrs_gptimer(struct dentry *parent, unsigned long base, int num) | ||
275 | { | ||
276 | char buf[32], *_buf = REGS_STR_PFX(buf, TIMER, num); | ||
277 | __GPTIMER(CONFIG); | ||
278 | __GPTIMER(COUNTER); | ||
279 | __GPTIMER(PERIOD); | ||
280 | __GPTIMER(WIDTH); | ||
281 | } | ||
282 | #define GPTIMER(num) bfin_debug_mmrs_gptimer(parent, TIMER##num##_CONFIG, num) | ||
283 | |||
284 | /* | ||
285 | * Handshake MDMA | ||
286 | */ | ||
287 | #define __HMDMA(uname, lname) __REGS(hmdma, #uname, lname) | ||
288 | static void __init __maybe_unused | ||
289 | bfin_debug_mmrs_hmdma(struct dentry *parent, unsigned long base, int num) | ||
290 | { | ||
291 | char buf[32], *_buf = REGS_STR_PFX(buf, HMDMA, num); | ||
292 | __HMDMA(CONTROL, control); | ||
293 | __HMDMA(ECINIT, ecinit); | ||
294 | __HMDMA(BCINIT, bcinit); | ||
295 | __HMDMA(ECURGENT, ecurgent); | ||
296 | __HMDMA(ECOVERFLOW, ecoverflow); | ||
297 | __HMDMA(ECOUNT, ecount); | ||
298 | __HMDMA(BCOUNT, bcount); | ||
299 | } | ||
300 | #define HMDMA(num) bfin_debug_mmrs_hmdma(parent, HMDMA##num##_CONTROL, num) | ||
301 | |||
302 | /* | ||
303 | * Port/GPIO | ||
304 | */ | ||
305 | #define bfin_gpio_regs gpio_port_t | ||
306 | #define __PORT(uname, lname) __REGS(gpio, #uname, lname) | ||
307 | static void __init __maybe_unused | ||
308 | bfin_debug_mmrs_port(struct dentry *parent, unsigned long base, int num) | ||
309 | { | ||
310 | char buf[32], *_buf; | ||
311 | #ifdef __ADSPBF54x__ | ||
312 | _buf = REGS_STR_PFX_C(buf, PORT, num); | ||
313 | __PORT(FER, port_fer); | ||
314 | __PORT(SET, data_set); | ||
315 | __PORT(CLEAR, data_clear); | ||
316 | __PORT(DIR_SET, dir_set); | ||
317 | __PORT(DIR_CLEAR, dir_clear); | ||
318 | __PORT(INEN, inen); | ||
319 | __PORT(MUX, port_mux); | ||
320 | #else | ||
321 | _buf = buf + sprintf(buf, "PORT%cIO_", num); | ||
322 | __PORT(CLEAR, data_clear); | ||
323 | __PORT(SET, data_set); | ||
324 | __PORT(TOGGLE, toggle); | ||
325 | __PORT(MASKA, maska); | ||
326 | __PORT(MASKA_CLEAR, maska_clear); | ||
327 | __PORT(MASKA_SET, maska_set); | ||
328 | __PORT(MASKA_TOGGLE, maska_toggle); | ||
329 | __PORT(MASKB, maskb); | ||
330 | __PORT(MASKB_CLEAR, maskb_clear); | ||
331 | __PORT(MASKB_SET, maskb_set); | ||
332 | __PORT(MASKB_TOGGLE, maskb_toggle); | ||
333 | __PORT(DIR, dir); | ||
334 | __PORT(POLAR, polar); | ||
335 | __PORT(EDGE, edge); | ||
336 | __PORT(BOTH, both); | ||
337 | __PORT(INEN, inen); | ||
338 | #endif | ||
339 | _buf[-1] = '\0'; | ||
340 | d(buf, 16, base + REGS_OFF(gpio, data)); | ||
341 | } | ||
342 | #define PORT(base, num) bfin_debug_mmrs_port(parent, base, num) | ||
343 | |||
344 | /* | ||
345 | * PPI | ||
346 | */ | ||
347 | #define __PPI(uname, lname) __REGS(ppi, #uname, lname) | ||
348 | static void __init __maybe_unused | ||
349 | bfin_debug_mmrs_ppi(struct dentry *parent, unsigned long base, int num) | ||
350 | { | ||
351 | char buf[32], *_buf = REGS_STR_PFX(buf, PPI, num); | ||
352 | __PPI(CONTROL, control); | ||
353 | __PPI(STATUS, status); | ||
354 | __PPI(COUNT, count); | ||
355 | __PPI(DELAY, delay); | ||
356 | __PPI(FRAME, frame); | ||
357 | } | ||
358 | #define PPI(num) bfin_debug_mmrs_ppi(parent, PPI##num##_STATUS, num) | ||
359 | |||
360 | /* | ||
361 | * SPI | ||
362 | */ | ||
363 | #define __SPI(uname, lname) __REGS(spi, #uname, lname) | ||
364 | static void __init __maybe_unused | ||
365 | bfin_debug_mmrs_spi(struct dentry *parent, unsigned long base, int num) | ||
366 | { | ||
367 | char buf[32], *_buf = REGS_STR_PFX(buf, SPI, num); | ||
368 | __SPI(CTL, ctl); | ||
369 | __SPI(FLG, flg); | ||
370 | __SPI(STAT, stat); | ||
371 | __SPI(TDBR, tdbr); | ||
372 | __SPI(RDBR, rdbr); | ||
373 | __SPI(BAUD, baud); | ||
374 | __SPI(SHADOW, shadow); | ||
375 | } | ||
376 | #define SPI(num) bfin_debug_mmrs_spi(parent, SPI##num##_REGBASE, num) | ||
377 | |||
378 | /* | ||
379 | * SPORT | ||
380 | */ | ||
381 | static inline int sport_width(void *mmr) | ||
382 | { | ||
383 | unsigned long lmmr = (unsigned long)mmr; | ||
384 | if ((lmmr & 0xff) == 0x10) | ||
385 | /* SPORT#_TX has 0x10 offset -> SPORT#_TCR2 has 0x04 offset */ | ||
386 | lmmr -= 0xc; | ||
387 | else | ||
388 | /* SPORT#_RX has 0x18 offset -> SPORT#_RCR2 has 0x24 offset */ | ||
389 | lmmr += 0xc; | ||
390 | /* extract SLEN field from control register 2 and add 1 */ | ||
391 | return (bfin_read16(lmmr) & 0x1f) + 1; | ||
392 | } | ||
393 | static int sport_set(void *mmr, u64 val) | ||
394 | { | ||
395 | unsigned long flags; | ||
396 | local_irq_save(flags); | ||
397 | if (sport_width(mmr) <= 16) | ||
398 | bfin_write16(mmr, val); | ||
399 | else | ||
400 | bfin_write32(mmr, val); | ||
401 | local_irq_restore(flags); | ||
402 | return 0; | ||
403 | } | ||
404 | static int sport_get(void *mmr, u64 *val) | ||
405 | { | ||
406 | unsigned long flags; | ||
407 | local_irq_save(flags); | ||
408 | if (sport_width(mmr) <= 16) | ||
409 | *val = bfin_read16(mmr); | ||
410 | else | ||
411 | *val = bfin_read32(mmr); | ||
412 | local_irq_restore(flags); | ||
413 | return 0; | ||
414 | } | ||
415 | DEFINE_SIMPLE_ATTRIBUTE(fops_sport, sport_get, sport_set, "0x%08llx\n"); | ||
416 | /*DEFINE_SIMPLE_ATTRIBUTE(fops_sport_ro, sport_get, NULL, "0x%08llx\n");*/ | ||
417 | DEFINE_SIMPLE_ATTRIBUTE(fops_sport_wo, NULL, sport_set, "0x%08llx\n"); | ||
418 | #define SPORT_OFF(mmr) (SPORT0_##mmr - SPORT0_TCR1) | ||
419 | #define _D_SPORT(name, perms, fops) \ | ||
420 | do { \ | ||
421 | strcpy(_buf, #name); \ | ||
422 | debugfs_create_file(buf, perms, parent, (void *)(base + SPORT_OFF(name)), fops); \ | ||
423 | } while (0) | ||
424 | #define __SPORT_RW(name) _D_SPORT(name, S_IRUSR|S_IWUSR, &fops_sport) | ||
425 | #define __SPORT_RO(name) _D_SPORT(name, S_IRUSR, &fops_sport_ro) | ||
426 | #define __SPORT_WO(name) _D_SPORT(name, S_IWUSR, &fops_sport_wo) | ||
427 | #define __SPORT(name, bits) \ | ||
428 | do { \ | ||
429 | strcpy(_buf, #name); \ | ||
430 | debugfs_create_x##bits(buf, S_IRUSR|S_IWUSR, parent, (u##bits *)(base + SPORT_OFF(name))); \ | ||
431 | } while (0) | ||
432 | static void __init __maybe_unused | ||
433 | bfin_debug_mmrs_sport(struct dentry *parent, unsigned long base, int num) | ||
434 | { | ||
435 | char buf[32], *_buf = REGS_STR_PFX(buf, SPORT, num); | ||
436 | __SPORT(CHNL, 16); | ||
437 | __SPORT(MCMC1, 16); | ||
438 | __SPORT(MCMC2, 16); | ||
439 | __SPORT(MRCS0, 32); | ||
440 | __SPORT(MRCS1, 32); | ||
441 | __SPORT(MRCS2, 32); | ||
442 | __SPORT(MRCS3, 32); | ||
443 | __SPORT(MTCS0, 32); | ||
444 | __SPORT(MTCS1, 32); | ||
445 | __SPORT(MTCS2, 32); | ||
446 | __SPORT(MTCS3, 32); | ||
447 | __SPORT(RCLKDIV, 16); | ||
448 | __SPORT(RCR1, 16); | ||
449 | __SPORT(RCR2, 16); | ||
450 | __SPORT(RFSDIV, 16); | ||
451 | __SPORT_RW(RX); | ||
452 | __SPORT(STAT, 16); | ||
453 | __SPORT(TCLKDIV, 16); | ||
454 | __SPORT(TCR1, 16); | ||
455 | __SPORT(TCR2, 16); | ||
456 | __SPORT(TFSDIV, 16); | ||
457 | __SPORT_WO(TX); | ||
458 | } | ||
459 | #define SPORT(num) bfin_debug_mmrs_sport(parent, SPORT##num##_TCR1, num) | ||
460 | |||
461 | /* | ||
462 | * TWI | ||
463 | */ | ||
464 | #define __TWI(uname, lname) __REGS(twi, #uname, lname) | ||
465 | static void __init __maybe_unused | ||
466 | bfin_debug_mmrs_twi(struct dentry *parent, unsigned long base, int num) | ||
467 | { | ||
468 | char buf[32], *_buf = REGS_STR_PFX(buf, TWI, num); | ||
469 | __TWI(CLKDIV, clkdiv); | ||
470 | __TWI(CONTROL, control); | ||
471 | __TWI(SLAVE_CTL, slave_ctl); | ||
472 | __TWI(SLAVE_STAT, slave_stat); | ||
473 | __TWI(SLAVE_ADDR, slave_addr); | ||
474 | __TWI(MASTER_CTL, master_ctl); | ||
475 | __TWI(MASTER_STAT, master_stat); | ||
476 | __TWI(MASTER_ADDR, master_addr); | ||
477 | __TWI(INT_STAT, int_stat); | ||
478 | __TWI(INT_MASK, int_mask); | ||
479 | __TWI(FIFO_CTL, fifo_ctl); | ||
480 | __TWI(FIFO_STAT, fifo_stat); | ||
481 | __TWI(XMT_DATA8, xmt_data8); | ||
482 | __TWI(XMT_DATA16, xmt_data16); | ||
483 | __TWI(RCV_DATA8, rcv_data8); | ||
484 | __TWI(RCV_DATA16, rcv_data16); | ||
485 | } | ||
486 | #define TWI(num) bfin_debug_mmrs_twi(parent, TWI##num##_CLKDIV, num) | ||
487 | |||
488 | /* | ||
489 | * UART | ||
490 | */ | ||
491 | #define __UART(uname, lname) __REGS(uart, #uname, lname) | ||
492 | static void __init __maybe_unused | ||
493 | bfin_debug_mmrs_uart(struct dentry *parent, unsigned long base, int num) | ||
494 | { | ||
495 | char buf[32], *_buf = REGS_STR_PFX(buf, UART, num); | ||
496 | #ifdef BFIN_UART_BF54X_STYLE | ||
497 | __UART(DLL, dll); | ||
498 | __UART(DLH, dlh); | ||
499 | __UART(GCTL, gctl); | ||
500 | __UART(LCR, lcr); | ||
501 | __UART(MCR, mcr); | ||
502 | __UART(LSR, lsr); | ||
503 | __UART(MSR, msr); | ||
504 | __UART(SCR, scr); | ||
505 | __UART(IER_SET, ier_set); | ||
506 | __UART(IER_CLEAR, ier_clear); | ||
507 | __UART(THR, thr); | ||
508 | __UART(RBR, rbr); | ||
509 | #else | ||
510 | __UART(DLL, dll); | ||
511 | __UART(THR, thr); | ||
512 | __UART(RBR, rbr); | ||
513 | __UART(DLH, dlh); | ||
514 | __UART(IER, ier); | ||
515 | __UART(IIR, iir); | ||
516 | __UART(LCR, lcr); | ||
517 | __UART(MCR, mcr); | ||
518 | __UART(LSR, lsr); | ||
519 | __UART(MSR, msr); | ||
520 | __UART(SCR, scr); | ||
521 | __UART(GCTL, gctl); | ||
522 | #endif | ||
523 | } | ||
524 | #define UART(num) bfin_debug_mmrs_uart(parent, UART##num##_DLL, num) | ||
525 | |||
526 | /* | ||
527 | * The actual debugfs generation | ||
528 | */ | ||
529 | static struct dentry *debug_mmrs_dentry; | ||
530 | |||
531 | static int __init bfin_debug_mmrs_init(void) | ||
532 | { | ||
533 | struct dentry *top, *parent; | ||
534 | |||
535 | pr_info("debug-mmrs: setting up Blackfin MMR debugfs\n"); | ||
536 | |||
537 | top = debugfs_create_dir("blackfin", NULL); | ||
538 | if (top == NULL) | ||
539 | return -1; | ||
540 | |||
541 | parent = debugfs_create_dir("core_regs", top); | ||
542 | debugfs_create_file("cclk", S_IRUSR, parent, NULL, &fops_debug_cclk); | ||
543 | debugfs_create_file("sclk", S_IRUSR, parent, NULL, &fops_debug_sclk); | ||
544 | debugfs_create_x32("last_seqstat", S_IRUSR, parent, &last_seqstat); | ||
545 | D_SYSREG(cycles); | ||
546 | D_SYSREG(cycles2); | ||
547 | D_SYSREG(emudat); | ||
548 | D_SYSREG(seqstat); | ||
549 | D_SYSREG(syscfg); | ||
550 | |||
551 | /* Core MMRs */ | ||
552 | parent = debugfs_create_dir("ctimer", top); | ||
553 | D32(TCNTL); | ||
554 | D32(TCOUNT); | ||
555 | D32(TPERIOD); | ||
556 | D32(TSCALE); | ||
557 | |||
558 | parent = debugfs_create_dir("cec", top); | ||
559 | D32(EVT0); | ||
560 | D32(EVT1); | ||
561 | D32(EVT2); | ||
562 | D32(EVT3); | ||
563 | D32(EVT4); | ||
564 | D32(EVT5); | ||
565 | D32(EVT6); | ||
566 | D32(EVT7); | ||
567 | D32(EVT8); | ||
568 | D32(EVT9); | ||
569 | D32(EVT10); | ||
570 | D32(EVT11); | ||
571 | D32(EVT12); | ||
572 | D32(EVT13); | ||
573 | D32(EVT14); | ||
574 | D32(EVT15); | ||
575 | D32(EVT_OVERRIDE); | ||
576 | D32(IMASK); | ||
577 | D32(IPEND); | ||
578 | D32(ILAT); | ||
579 | D32(IPRIO); | ||
580 | |||
581 | parent = debugfs_create_dir("debug", top); | ||
582 | D32(DBGSTAT); | ||
583 | D32(DSPID); | ||
584 | |||
585 | parent = debugfs_create_dir("mmu", top); | ||
586 | D32(SRAM_BASE_ADDRESS); | ||
587 | D32(DCPLB_ADDR0); | ||
588 | D32(DCPLB_ADDR10); | ||
589 | D32(DCPLB_ADDR11); | ||
590 | D32(DCPLB_ADDR12); | ||
591 | D32(DCPLB_ADDR13); | ||
592 | D32(DCPLB_ADDR14); | ||
593 | D32(DCPLB_ADDR15); | ||
594 | D32(DCPLB_ADDR1); | ||
595 | D32(DCPLB_ADDR2); | ||
596 | D32(DCPLB_ADDR3); | ||
597 | D32(DCPLB_ADDR4); | ||
598 | D32(DCPLB_ADDR5); | ||
599 | D32(DCPLB_ADDR6); | ||
600 | D32(DCPLB_ADDR7); | ||
601 | D32(DCPLB_ADDR8); | ||
602 | D32(DCPLB_ADDR9); | ||
603 | D32(DCPLB_DATA0); | ||
604 | D32(DCPLB_DATA10); | ||
605 | D32(DCPLB_DATA11); | ||
606 | D32(DCPLB_DATA12); | ||
607 | D32(DCPLB_DATA13); | ||
608 | D32(DCPLB_DATA14); | ||
609 | D32(DCPLB_DATA15); | ||
610 | D32(DCPLB_DATA1); | ||
611 | D32(DCPLB_DATA2); | ||
612 | D32(DCPLB_DATA3); | ||
613 | D32(DCPLB_DATA4); | ||
614 | D32(DCPLB_DATA5); | ||
615 | D32(DCPLB_DATA6); | ||
616 | D32(DCPLB_DATA7); | ||
617 | D32(DCPLB_DATA8); | ||
618 | D32(DCPLB_DATA9); | ||
619 | D32(DCPLB_FAULT_ADDR); | ||
620 | D32(DCPLB_STATUS); | ||
621 | D32(DMEM_CONTROL); | ||
622 | D32(DTEST_COMMAND); | ||
623 | D32(DTEST_DATA0); | ||
624 | D32(DTEST_DATA1); | ||
625 | |||
626 | D32(ICPLB_ADDR0); | ||
627 | D32(ICPLB_ADDR1); | ||
628 | D32(ICPLB_ADDR2); | ||
629 | D32(ICPLB_ADDR3); | ||
630 | D32(ICPLB_ADDR4); | ||
631 | D32(ICPLB_ADDR5); | ||
632 | D32(ICPLB_ADDR6); | ||
633 | D32(ICPLB_ADDR7); | ||
634 | D32(ICPLB_ADDR8); | ||
635 | D32(ICPLB_ADDR9); | ||
636 | D32(ICPLB_ADDR10); | ||
637 | D32(ICPLB_ADDR11); | ||
638 | D32(ICPLB_ADDR12); | ||
639 | D32(ICPLB_ADDR13); | ||
640 | D32(ICPLB_ADDR14); | ||
641 | D32(ICPLB_ADDR15); | ||
642 | D32(ICPLB_DATA0); | ||
643 | D32(ICPLB_DATA1); | ||
644 | D32(ICPLB_DATA2); | ||
645 | D32(ICPLB_DATA3); | ||
646 | D32(ICPLB_DATA4); | ||
647 | D32(ICPLB_DATA5); | ||
648 | D32(ICPLB_DATA6); | ||
649 | D32(ICPLB_DATA7); | ||
650 | D32(ICPLB_DATA8); | ||
651 | D32(ICPLB_DATA9); | ||
652 | D32(ICPLB_DATA10); | ||
653 | D32(ICPLB_DATA11); | ||
654 | D32(ICPLB_DATA12); | ||
655 | D32(ICPLB_DATA13); | ||
656 | D32(ICPLB_DATA14); | ||
657 | D32(ICPLB_DATA15); | ||
658 | D32(ICPLB_FAULT_ADDR); | ||
659 | D32(ICPLB_STATUS); | ||
660 | D32(IMEM_CONTROL); | ||
661 | if (!ANOMALY_05000481) { | ||
662 | D32(ITEST_COMMAND); | ||
663 | D32(ITEST_DATA0); | ||
664 | D32(ITEST_DATA1); | ||
665 | } | ||
666 | |||
667 | parent = debugfs_create_dir("perf", top); | ||
668 | D32(PFCNTR0); | ||
669 | D32(PFCNTR1); | ||
670 | D32(PFCTL); | ||
671 | |||
672 | parent = debugfs_create_dir("trace", top); | ||
673 | D32(TBUF); | ||
674 | D32(TBUFCTL); | ||
675 | D32(TBUFSTAT); | ||
676 | |||
677 | parent = debugfs_create_dir("watchpoint", top); | ||
678 | D32(WPIACTL); | ||
679 | D32(WPIA0); | ||
680 | D32(WPIA1); | ||
681 | D32(WPIA2); | ||
682 | D32(WPIA3); | ||
683 | D32(WPIA4); | ||
684 | D32(WPIA5); | ||
685 | D32(WPIACNT0); | ||
686 | D32(WPIACNT1); | ||
687 | D32(WPIACNT2); | ||
688 | D32(WPIACNT3); | ||
689 | D32(WPIACNT4); | ||
690 | D32(WPIACNT5); | ||
691 | D32(WPDACTL); | ||
692 | D32(WPDA0); | ||
693 | D32(WPDA1); | ||
694 | D32(WPDACNT0); | ||
695 | D32(WPDACNT1); | ||
696 | D32(WPSTAT); | ||
697 | |||
698 | /* System MMRs */ | ||
699 | #ifdef ATAPI_CONTROL | ||
700 | parent = debugfs_create_dir("atapi", top); | ||
701 | D16(ATAPI_CONTROL); | ||
702 | D16(ATAPI_DEV_ADDR); | ||
703 | D16(ATAPI_DEV_RXBUF); | ||
704 | D16(ATAPI_DEV_TXBUF); | ||
705 | D16(ATAPI_DMA_TFRCNT); | ||
706 | D16(ATAPI_INT_MASK); | ||
707 | D16(ATAPI_INT_STATUS); | ||
708 | D16(ATAPI_LINE_STATUS); | ||
709 | D16(ATAPI_MULTI_TIM_0); | ||
710 | D16(ATAPI_MULTI_TIM_1); | ||
711 | D16(ATAPI_MULTI_TIM_2); | ||
712 | D16(ATAPI_PIO_TFRCNT); | ||
713 | D16(ATAPI_PIO_TIM_0); | ||
714 | D16(ATAPI_PIO_TIM_1); | ||
715 | D16(ATAPI_REG_TIM_0); | ||
716 | D16(ATAPI_SM_STATE); | ||
717 | D16(ATAPI_STATUS); | ||
718 | D16(ATAPI_TERMINATE); | ||
719 | D16(ATAPI_UDMAOUT_TFRCNT); | ||
720 | D16(ATAPI_ULTRA_TIM_0); | ||
721 | D16(ATAPI_ULTRA_TIM_1); | ||
722 | D16(ATAPI_ULTRA_TIM_2); | ||
723 | D16(ATAPI_ULTRA_TIM_3); | ||
724 | D16(ATAPI_UMAIN_TFRCNT); | ||
725 | D16(ATAPI_XFER_LEN); | ||
726 | #endif | ||
727 | |||
728 | #if defined(CAN_MC1) || defined(CAN0_MC1) || defined(CAN1_MC1) | ||
729 | parent = debugfs_create_dir("can", top); | ||
730 | # ifdef CAN_MC1 | ||
731 | bfin_debug_mmrs_can(parent, CAN_MC1, -1); | ||
732 | # endif | ||
733 | # ifdef CAN0_MC1 | ||
734 | CAN(0); | ||
735 | # endif | ||
736 | # ifdef CAN1_MC1 | ||
737 | CAN(1); | ||
738 | # endif | ||
739 | #endif | ||
740 | |||
741 | #ifdef CNT_COMMAND | ||
742 | parent = debugfs_create_dir("counter", top); | ||
743 | D16(CNT_COMMAND); | ||
744 | D16(CNT_CONFIG); | ||
745 | D32(CNT_COUNTER); | ||
746 | D16(CNT_DEBOUNCE); | ||
747 | D16(CNT_IMASK); | ||
748 | D32(CNT_MAX); | ||
749 | D32(CNT_MIN); | ||
750 | D16(CNT_STATUS); | ||
751 | #endif | ||
752 | |||
753 | parent = debugfs_create_dir("dmac", top); | ||
754 | #ifdef DMA_TC_CNT | ||
755 | D16(DMAC_TC_CNT); | ||
756 | D16(DMAC_TC_PER); | ||
757 | #endif | ||
758 | #ifdef DMAC0_TC_CNT | ||
759 | D16(DMAC0_TC_CNT); | ||
760 | D16(DMAC0_TC_PER); | ||
761 | #endif | ||
762 | #ifdef DMAC1_TC_CNT | ||
763 | D16(DMAC1_TC_CNT); | ||
764 | D16(DMAC1_TC_PER); | ||
765 | #endif | ||
766 | #ifdef DMAC1_PERIMUX | ||
767 | D16(DMAC1_PERIMUX); | ||
768 | #endif | ||
769 | |||
770 | #ifdef __ADSPBF561__ | ||
771 | /* XXX: should rewrite the MMR map */ | ||
772 | # define DMA0_NEXT_DESC_PTR DMA2_0_NEXT_DESC_PTR | ||
773 | # define DMA1_NEXT_DESC_PTR DMA2_1_NEXT_DESC_PTR | ||
774 | # define DMA2_NEXT_DESC_PTR DMA2_2_NEXT_DESC_PTR | ||
775 | # define DMA3_NEXT_DESC_PTR DMA2_3_NEXT_DESC_PTR | ||
776 | # define DMA4_NEXT_DESC_PTR DMA2_4_NEXT_DESC_PTR | ||
777 | # define DMA5_NEXT_DESC_PTR DMA2_5_NEXT_DESC_PTR | ||
778 | # define DMA6_NEXT_DESC_PTR DMA2_6_NEXT_DESC_PTR | ||
779 | # define DMA7_NEXT_DESC_PTR DMA2_7_NEXT_DESC_PTR | ||
780 | # define DMA8_NEXT_DESC_PTR DMA2_8_NEXT_DESC_PTR | ||
781 | # define DMA9_NEXT_DESC_PTR DMA2_9_NEXT_DESC_PTR | ||
782 | # define DMA10_NEXT_DESC_PTR DMA2_10_NEXT_DESC_PTR | ||
783 | # define DMA11_NEXT_DESC_PTR DMA2_11_NEXT_DESC_PTR | ||
784 | # define DMA12_NEXT_DESC_PTR DMA1_0_NEXT_DESC_PTR | ||
785 | # define DMA13_NEXT_DESC_PTR DMA1_1_NEXT_DESC_PTR | ||
786 | # define DMA14_NEXT_DESC_PTR DMA1_2_NEXT_DESC_PTR | ||
787 | # define DMA15_NEXT_DESC_PTR DMA1_3_NEXT_DESC_PTR | ||
788 | # define DMA16_NEXT_DESC_PTR DMA1_4_NEXT_DESC_PTR | ||
789 | # define DMA17_NEXT_DESC_PTR DMA1_5_NEXT_DESC_PTR | ||
790 | # define DMA18_NEXT_DESC_PTR DMA1_6_NEXT_DESC_PTR | ||
791 | # define DMA19_NEXT_DESC_PTR DMA1_7_NEXT_DESC_PTR | ||
792 | # define DMA20_NEXT_DESC_PTR DMA1_8_NEXT_DESC_PTR | ||
793 | # define DMA21_NEXT_DESC_PTR DMA1_9_NEXT_DESC_PTR | ||
794 | # define DMA22_NEXT_DESC_PTR DMA1_10_NEXT_DESC_PTR | ||
795 | # define DMA23_NEXT_DESC_PTR DMA1_11_NEXT_DESC_PTR | ||
796 | #endif | ||
797 | parent = debugfs_create_dir("dma", top); | ||
798 | DMA(0); | ||
799 | DMA(1); | ||
800 | DMA(1); | ||
801 | DMA(2); | ||
802 | DMA(3); | ||
803 | DMA(4); | ||
804 | DMA(5); | ||
805 | DMA(6); | ||
806 | DMA(7); | ||
807 | #ifdef DMA8_NEXT_DESC_PTR | ||
808 | DMA(8); | ||
809 | DMA(9); | ||
810 | DMA(10); | ||
811 | DMA(11); | ||
812 | #endif | ||
813 | #ifdef DMA12_NEXT_DESC_PTR | ||
814 | DMA(12); | ||
815 | DMA(13); | ||
816 | DMA(14); | ||
817 | DMA(15); | ||
818 | DMA(16); | ||
819 | DMA(17); | ||
820 | DMA(18); | ||
821 | DMA(19); | ||
822 | #endif | ||
823 | #ifdef DMA20_NEXT_DESC_PTR | ||
824 | DMA(20); | ||
825 | DMA(21); | ||
826 | DMA(22); | ||
827 | DMA(23); | ||
828 | #endif | ||
829 | |||
830 | parent = debugfs_create_dir("ebiu_amc", top); | ||
831 | D32(EBIU_AMBCTL0); | ||
832 | D32(EBIU_AMBCTL1); | ||
833 | D16(EBIU_AMGCTL); | ||
834 | #ifdef EBIU_MBSCTL | ||
835 | D16(EBIU_MBSCTL); | ||
836 | D32(EBIU_ARBSTAT); | ||
837 | D32(EBIU_MODE); | ||
838 | D16(EBIU_FCTL); | ||
839 | #endif | ||
840 | |||
841 | #ifdef EBIU_SDGCTL | ||
842 | parent = debugfs_create_dir("ebiu_sdram", top); | ||
843 | # ifdef __ADSPBF561__ | ||
844 | D32(EBIU_SDBCTL); | ||
845 | # else | ||
846 | D16(EBIU_SDBCTL); | ||
847 | # endif | ||
848 | D32(EBIU_SDGCTL); | ||
849 | D16(EBIU_SDRRC); | ||
850 | D16(EBIU_SDSTAT); | ||
851 | #endif | ||
852 | |||
853 | #ifdef EBIU_DDRACCT | ||
854 | parent = debugfs_create_dir("ebiu_ddr", top); | ||
855 | D32(EBIU_DDRACCT); | ||
856 | D32(EBIU_DDRARCT); | ||
857 | D32(EBIU_DDRBRC0); | ||
858 | D32(EBIU_DDRBRC1); | ||
859 | D32(EBIU_DDRBRC2); | ||
860 | D32(EBIU_DDRBRC3); | ||
861 | D32(EBIU_DDRBRC4); | ||
862 | D32(EBIU_DDRBRC5); | ||
863 | D32(EBIU_DDRBRC6); | ||
864 | D32(EBIU_DDRBRC7); | ||
865 | D32(EBIU_DDRBWC0); | ||
866 | D32(EBIU_DDRBWC1); | ||
867 | D32(EBIU_DDRBWC2); | ||
868 | D32(EBIU_DDRBWC3); | ||
869 | D32(EBIU_DDRBWC4); | ||
870 | D32(EBIU_DDRBWC5); | ||
871 | D32(EBIU_DDRBWC6); | ||
872 | D32(EBIU_DDRBWC7); | ||
873 | D32(EBIU_DDRCTL0); | ||
874 | D32(EBIU_DDRCTL1); | ||
875 | D32(EBIU_DDRCTL2); | ||
876 | D32(EBIU_DDRCTL3); | ||
877 | D32(EBIU_DDRGC0); | ||
878 | D32(EBIU_DDRGC1); | ||
879 | D32(EBIU_DDRGC2); | ||
880 | D32(EBIU_DDRGC3); | ||
881 | D32(EBIU_DDRMCCL); | ||
882 | D32(EBIU_DDRMCEN); | ||
883 | D32(EBIU_DDRQUE); | ||
884 | D32(EBIU_DDRTACT); | ||
885 | D32(EBIU_ERRADD); | ||
886 | D16(EBIU_ERRMST); | ||
887 | D16(EBIU_RSTCTL); | ||
888 | #endif | ||
889 | |||
890 | #ifdef EMAC_ADDRHI | ||
891 | parent = debugfs_create_dir("emac", top); | ||
892 | D32(EMAC_ADDRHI); | ||
893 | D32(EMAC_ADDRLO); | ||
894 | D32(EMAC_FLC); | ||
895 | D32(EMAC_HASHHI); | ||
896 | D32(EMAC_HASHLO); | ||
897 | D32(EMAC_MMC_CTL); | ||
898 | D32(EMAC_MMC_RIRQE); | ||
899 | D32(EMAC_MMC_RIRQS); | ||
900 | D32(EMAC_MMC_TIRQE); | ||
901 | D32(EMAC_MMC_TIRQS); | ||
902 | D32(EMAC_OPMODE); | ||
903 | D32(EMAC_RXC_ALIGN); | ||
904 | D32(EMAC_RXC_ALLFRM); | ||
905 | D32(EMAC_RXC_ALLOCT); | ||
906 | D32(EMAC_RXC_BROAD); | ||
907 | D32(EMAC_RXC_DMAOVF); | ||
908 | D32(EMAC_RXC_EQ64); | ||
909 | D32(EMAC_RXC_FCS); | ||
910 | D32(EMAC_RXC_GE1024); | ||
911 | D32(EMAC_RXC_LNERRI); | ||
912 | D32(EMAC_RXC_LNERRO); | ||
913 | D32(EMAC_RXC_LONG); | ||
914 | D32(EMAC_RXC_LT1024); | ||
915 | D32(EMAC_RXC_LT128); | ||
916 | D32(EMAC_RXC_LT256); | ||
917 | D32(EMAC_RXC_LT512); | ||
918 | D32(EMAC_RXC_MACCTL); | ||
919 | D32(EMAC_RXC_MULTI); | ||
920 | D32(EMAC_RXC_OCTET); | ||
921 | D32(EMAC_RXC_OK); | ||
922 | D32(EMAC_RXC_OPCODE); | ||
923 | D32(EMAC_RXC_PAUSE); | ||
924 | D32(EMAC_RXC_SHORT); | ||
925 | D32(EMAC_RXC_TYPED); | ||
926 | D32(EMAC_RXC_UNICST); | ||
927 | D32(EMAC_RX_IRQE); | ||
928 | D32(EMAC_RX_STAT); | ||
929 | D32(EMAC_RX_STKY); | ||
930 | D32(EMAC_STAADD); | ||
931 | D32(EMAC_STADAT); | ||
932 | D32(EMAC_SYSCTL); | ||
933 | D32(EMAC_SYSTAT); | ||
934 | D32(EMAC_TXC_1COL); | ||
935 | D32(EMAC_TXC_ABORT); | ||
936 | D32(EMAC_TXC_ALLFRM); | ||
937 | D32(EMAC_TXC_ALLOCT); | ||
938 | D32(EMAC_TXC_BROAD); | ||
939 | D32(EMAC_TXC_CRSERR); | ||
940 | D32(EMAC_TXC_DEFER); | ||
941 | D32(EMAC_TXC_DMAUND); | ||
942 | D32(EMAC_TXC_EQ64); | ||
943 | D32(EMAC_TXC_GE1024); | ||
944 | D32(EMAC_TXC_GT1COL); | ||
945 | D32(EMAC_TXC_LATECL); | ||
946 | D32(EMAC_TXC_LT1024); | ||
947 | D32(EMAC_TXC_LT128); | ||
948 | D32(EMAC_TXC_LT256); | ||
949 | D32(EMAC_TXC_LT512); | ||
950 | D32(EMAC_TXC_MACCTL); | ||
951 | D32(EMAC_TXC_MULTI); | ||
952 | D32(EMAC_TXC_OCTET); | ||
953 | D32(EMAC_TXC_OK); | ||
954 | D32(EMAC_TXC_UNICST); | ||
955 | D32(EMAC_TXC_XS_COL); | ||
956 | D32(EMAC_TXC_XS_DFR); | ||
957 | D32(EMAC_TX_IRQE); | ||
958 | D32(EMAC_TX_STAT); | ||
959 | D32(EMAC_TX_STKY); | ||
960 | D32(EMAC_VLAN1); | ||
961 | D32(EMAC_VLAN2); | ||
962 | D32(EMAC_WKUP_CTL); | ||
963 | D32(EMAC_WKUP_FFCMD); | ||
964 | D32(EMAC_WKUP_FFCRC0); | ||
965 | D32(EMAC_WKUP_FFCRC1); | ||
966 | D32(EMAC_WKUP_FFMSK0); | ||
967 | D32(EMAC_WKUP_FFMSK1); | ||
968 | D32(EMAC_WKUP_FFMSK2); | ||
969 | D32(EMAC_WKUP_FFMSK3); | ||
970 | D32(EMAC_WKUP_FFOFF); | ||
971 | # ifdef EMAC_PTP_ACCR | ||
972 | D32(EMAC_PTP_ACCR); | ||
973 | D32(EMAC_PTP_ADDEND); | ||
974 | D32(EMAC_PTP_ALARMHI); | ||
975 | D32(EMAC_PTP_ALARMLO); | ||
976 | D16(EMAC_PTP_CTL); | ||
977 | D32(EMAC_PTP_FOFF); | ||
978 | D32(EMAC_PTP_FV1); | ||
979 | D32(EMAC_PTP_FV2); | ||
980 | D32(EMAC_PTP_FV3); | ||
981 | D16(EMAC_PTP_ID_OFF); | ||
982 | D32(EMAC_PTP_ID_SNAP); | ||
983 | D16(EMAC_PTP_IE); | ||
984 | D16(EMAC_PTP_ISTAT); | ||
985 | D32(EMAC_PTP_OFFSET); | ||
986 | D32(EMAC_PTP_PPS_PERIOD); | ||
987 | D32(EMAC_PTP_PPS_STARTHI); | ||
988 | D32(EMAC_PTP_PPS_STARTLO); | ||
989 | D32(EMAC_PTP_RXSNAPHI); | ||
990 | D32(EMAC_PTP_RXSNAPLO); | ||
991 | D32(EMAC_PTP_TIMEHI); | ||
992 | D32(EMAC_PTP_TIMELO); | ||
993 | D32(EMAC_PTP_TXSNAPHI); | ||
994 | D32(EMAC_PTP_TXSNAPLO); | ||
995 | # endif | ||
996 | #endif | ||
997 | |||
998 | #if defined(EPPI0_STATUS) || defined(EPPI1_STATUS) || defined(EPPI2_STATUS) | ||
999 | parent = debugfs_create_dir("eppi", top); | ||
1000 | # ifdef EPPI0_STATUS | ||
1001 | EPPI(0); | ||
1002 | # endif | ||
1003 | # ifdef EPPI1_STATUS | ||
1004 | EPPI(1); | ||
1005 | # endif | ||
1006 | # ifdef EPPI2_STATUS | ||
1007 | EPPI(2); | ||
1008 | # endif | ||
1009 | #endif | ||
1010 | |||
1011 | parent = debugfs_create_dir("gptimer", top); | ||
1012 | #ifdef TIMER_DISABLE | ||
1013 | D16(TIMER_DISABLE); | ||
1014 | D16(TIMER_ENABLE); | ||
1015 | D32(TIMER_STATUS); | ||
1016 | #endif | ||
1017 | #ifdef TIMER_DISABLE0 | ||
1018 | D16(TIMER_DISABLE0); | ||
1019 | D16(TIMER_ENABLE0); | ||
1020 | D32(TIMER_STATUS0); | ||
1021 | #endif | ||
1022 | #ifdef TIMER_DISABLE1 | ||
1023 | D16(TIMER_DISABLE1); | ||
1024 | D16(TIMER_ENABLE1); | ||
1025 | D32(TIMER_STATUS1); | ||
1026 | #endif | ||
1027 | /* XXX: Should convert BF561 MMR names */ | ||
1028 | #ifdef TMRS4_DISABLE | ||
1029 | D16(TMRS4_DISABLE); | ||
1030 | D16(TMRS4_ENABLE); | ||
1031 | D32(TMRS4_STATUS); | ||
1032 | D16(TMRS8_DISABLE); | ||
1033 | D16(TMRS8_ENABLE); | ||
1034 | D32(TMRS8_STATUS); | ||
1035 | #endif | ||
1036 | GPTIMER(0); | ||
1037 | GPTIMER(1); | ||
1038 | GPTIMER(2); | ||
1039 | #ifdef TIMER3_CONFIG | ||
1040 | GPTIMER(3); | ||
1041 | GPTIMER(4); | ||
1042 | GPTIMER(5); | ||
1043 | GPTIMER(6); | ||
1044 | GPTIMER(7); | ||
1045 | #endif | ||
1046 | #ifdef TIMER8_CONFIG | ||
1047 | GPTIMER(8); | ||
1048 | GPTIMER(9); | ||
1049 | GPTIMER(10); | ||
1050 | #endif | ||
1051 | #ifdef TIMER11_CONFIG | ||
1052 | GPTIMER(11); | ||
1053 | #endif | ||
1054 | |||
1055 | #ifdef HMDMA0_CONTROL | ||
1056 | parent = debugfs_create_dir("hmdma", top); | ||
1057 | HMDMA(0); | ||
1058 | HMDMA(1); | ||
1059 | #endif | ||
1060 | |||
1061 | #ifdef HOST_CONTROL | ||
1062 | parent = debugfs_create_dir("hostdp", top); | ||
1063 | D16(HOST_CONTROL); | ||
1064 | D16(HOST_STATUS); | ||
1065 | D16(HOST_TIMEOUT); | ||
1066 | #endif | ||
1067 | |||
1068 | #ifdef IMDMA_S0_CONFIG | ||
1069 | parent = debugfs_create_dir("imdma", top); | ||
1070 | IMDMA(0); | ||
1071 | IMDMA(1); | ||
1072 | #endif | ||
1073 | |||
1074 | #ifdef KPAD_CTL | ||
1075 | parent = debugfs_create_dir("keypad", top); | ||
1076 | D16(KPAD_CTL); | ||
1077 | D16(KPAD_PRESCALE); | ||
1078 | D16(KPAD_MSEL); | ||
1079 | D16(KPAD_ROWCOL); | ||
1080 | D16(KPAD_STAT); | ||
1081 | D16(KPAD_SOFTEVAL); | ||
1082 | #endif | ||
1083 | |||
1084 | parent = debugfs_create_dir("mdma", top); | ||
1085 | MDMA(0); | ||
1086 | MDMA(1); | ||
1087 | #ifdef MDMA_D2_CONFIG | ||
1088 | MDMA(2); | ||
1089 | MDMA(3); | ||
1090 | #endif | ||
1091 | |||
1092 | #ifdef MXVR_CONFIG | ||
1093 | parent = debugfs_create_dir("mxvr", top); | ||
1094 | D16(MXVR_CONFIG); | ||
1095 | # ifdef MXVR_PLL_CTL_0 | ||
1096 | D32(MXVR_PLL_CTL_0); | ||
1097 | # endif | ||
1098 | D32(MXVR_STATE_0); | ||
1099 | D32(MXVR_STATE_1); | ||
1100 | D32(MXVR_INT_STAT_0); | ||
1101 | D32(MXVR_INT_STAT_1); | ||
1102 | D32(MXVR_INT_EN_0); | ||
1103 | D32(MXVR_INT_EN_1); | ||
1104 | D16(MXVR_POSITION); | ||
1105 | D16(MXVR_MAX_POSITION); | ||
1106 | D16(MXVR_DELAY); | ||
1107 | D16(MXVR_MAX_DELAY); | ||
1108 | D32(MXVR_LADDR); | ||
1109 | D16(MXVR_GADDR); | ||
1110 | D32(MXVR_AADDR); | ||
1111 | D32(MXVR_ALLOC_0); | ||
1112 | D32(MXVR_ALLOC_1); | ||
1113 | D32(MXVR_ALLOC_2); | ||
1114 | D32(MXVR_ALLOC_3); | ||
1115 | D32(MXVR_ALLOC_4); | ||
1116 | D32(MXVR_ALLOC_5); | ||
1117 | D32(MXVR_ALLOC_6); | ||
1118 | D32(MXVR_ALLOC_7); | ||
1119 | D32(MXVR_ALLOC_8); | ||
1120 | D32(MXVR_ALLOC_9); | ||
1121 | D32(MXVR_ALLOC_10); | ||
1122 | D32(MXVR_ALLOC_11); | ||
1123 | D32(MXVR_ALLOC_12); | ||
1124 | D32(MXVR_ALLOC_13); | ||
1125 | D32(MXVR_ALLOC_14); | ||
1126 | D32(MXVR_SYNC_LCHAN_0); | ||
1127 | D32(MXVR_SYNC_LCHAN_1); | ||
1128 | D32(MXVR_SYNC_LCHAN_2); | ||
1129 | D32(MXVR_SYNC_LCHAN_3); | ||
1130 | D32(MXVR_SYNC_LCHAN_4); | ||
1131 | D32(MXVR_SYNC_LCHAN_5); | ||
1132 | D32(MXVR_SYNC_LCHAN_6); | ||
1133 | D32(MXVR_SYNC_LCHAN_7); | ||
1134 | D32(MXVR_DMA0_CONFIG); | ||
1135 | D32(MXVR_DMA0_START_ADDR); | ||
1136 | D16(MXVR_DMA0_COUNT); | ||
1137 | D32(MXVR_DMA0_CURR_ADDR); | ||
1138 | D16(MXVR_DMA0_CURR_COUNT); | ||
1139 | D32(MXVR_DMA1_CONFIG); | ||
1140 | D32(MXVR_DMA1_START_ADDR); | ||
1141 | D16(MXVR_DMA1_COUNT); | ||
1142 | D32(MXVR_DMA1_CURR_ADDR); | ||
1143 | D16(MXVR_DMA1_CURR_COUNT); | ||
1144 | D32(MXVR_DMA2_CONFIG); | ||
1145 | D32(MXVR_DMA2_START_ADDR); | ||
1146 | D16(MXVR_DMA2_COUNT); | ||
1147 | D32(MXVR_DMA2_CURR_ADDR); | ||
1148 | D16(MXVR_DMA2_CURR_COUNT); | ||
1149 | D32(MXVR_DMA3_CONFIG); | ||
1150 | D32(MXVR_DMA3_START_ADDR); | ||
1151 | D16(MXVR_DMA3_COUNT); | ||
1152 | D32(MXVR_DMA3_CURR_ADDR); | ||
1153 | D16(MXVR_DMA3_CURR_COUNT); | ||
1154 | D32(MXVR_DMA4_CONFIG); | ||
1155 | D32(MXVR_DMA4_START_ADDR); | ||
1156 | D16(MXVR_DMA4_COUNT); | ||
1157 | D32(MXVR_DMA4_CURR_ADDR); | ||
1158 | D16(MXVR_DMA4_CURR_COUNT); | ||
1159 | D32(MXVR_DMA5_CONFIG); | ||
1160 | D32(MXVR_DMA5_START_ADDR); | ||
1161 | D16(MXVR_DMA5_COUNT); | ||
1162 | D32(MXVR_DMA5_CURR_ADDR); | ||
1163 | D16(MXVR_DMA5_CURR_COUNT); | ||
1164 | D32(MXVR_DMA6_CONFIG); | ||
1165 | D32(MXVR_DMA6_START_ADDR); | ||
1166 | D16(MXVR_DMA6_COUNT); | ||
1167 | D32(MXVR_DMA6_CURR_ADDR); | ||
1168 | D16(MXVR_DMA6_CURR_COUNT); | ||
1169 | D32(MXVR_DMA7_CONFIG); | ||
1170 | D32(MXVR_DMA7_START_ADDR); | ||
1171 | D16(MXVR_DMA7_COUNT); | ||
1172 | D32(MXVR_DMA7_CURR_ADDR); | ||
1173 | D16(MXVR_DMA7_CURR_COUNT); | ||
1174 | D16(MXVR_AP_CTL); | ||
1175 | D32(MXVR_APRB_START_ADDR); | ||
1176 | D32(MXVR_APRB_CURR_ADDR); | ||
1177 | D32(MXVR_APTB_START_ADDR); | ||
1178 | D32(MXVR_APTB_CURR_ADDR); | ||
1179 | D32(MXVR_CM_CTL); | ||
1180 | D32(MXVR_CMRB_START_ADDR); | ||
1181 | D32(MXVR_CMRB_CURR_ADDR); | ||
1182 | D32(MXVR_CMTB_START_ADDR); | ||
1183 | D32(MXVR_CMTB_CURR_ADDR); | ||
1184 | D32(MXVR_RRDB_START_ADDR); | ||
1185 | D32(MXVR_RRDB_CURR_ADDR); | ||
1186 | D32(MXVR_PAT_DATA_0); | ||
1187 | D32(MXVR_PAT_EN_0); | ||
1188 | D32(MXVR_PAT_DATA_1); | ||
1189 | D32(MXVR_PAT_EN_1); | ||
1190 | D16(MXVR_FRAME_CNT_0); | ||
1191 | D16(MXVR_FRAME_CNT_1); | ||
1192 | D32(MXVR_ROUTING_0); | ||
1193 | D32(MXVR_ROUTING_1); | ||
1194 | D32(MXVR_ROUTING_2); | ||
1195 | D32(MXVR_ROUTING_3); | ||
1196 | D32(MXVR_ROUTING_4); | ||
1197 | D32(MXVR_ROUTING_5); | ||
1198 | D32(MXVR_ROUTING_6); | ||
1199 | D32(MXVR_ROUTING_7); | ||
1200 | D32(MXVR_ROUTING_8); | ||
1201 | D32(MXVR_ROUTING_9); | ||
1202 | D32(MXVR_ROUTING_10); | ||
1203 | D32(MXVR_ROUTING_11); | ||
1204 | D32(MXVR_ROUTING_12); | ||
1205 | D32(MXVR_ROUTING_13); | ||
1206 | D32(MXVR_ROUTING_14); | ||
1207 | # ifdef MXVR_PLL_CTL_1 | ||
1208 | D32(MXVR_PLL_CTL_1); | ||
1209 | # endif | ||
1210 | D16(MXVR_BLOCK_CNT); | ||
1211 | # ifdef MXVR_CLK_CTL | ||
1212 | D32(MXVR_CLK_CTL); | ||
1213 | # endif | ||
1214 | # ifdef MXVR_CDRPLL_CTL | ||
1215 | D32(MXVR_CDRPLL_CTL); | ||
1216 | # endif | ||
1217 | # ifdef MXVR_FMPLL_CTL | ||
1218 | D32(MXVR_FMPLL_CTL); | ||
1219 | # endif | ||
1220 | # ifdef MXVR_PIN_CTL | ||
1221 | D16(MXVR_PIN_CTL); | ||
1222 | # endif | ||
1223 | # ifdef MXVR_SCLK_CNT | ||
1224 | D16(MXVR_SCLK_CNT); | ||
1225 | # endif | ||
1226 | #endif | ||
1227 | |||
1228 | #ifdef NFC_ADDR | ||
1229 | parent = debugfs_create_dir("nfc", top); | ||
1230 | D_WO(NFC_ADDR, 16); | ||
1231 | D_WO(NFC_CMD, 16); | ||
1232 | D_RO(NFC_COUNT, 16); | ||
1233 | D16(NFC_CTL); | ||
1234 | D_WO(NFC_DATA_RD, 16); | ||
1235 | D_WO(NFC_DATA_WR, 16); | ||
1236 | D_RO(NFC_ECC0, 16); | ||
1237 | D_RO(NFC_ECC1, 16); | ||
1238 | D_RO(NFC_ECC2, 16); | ||
1239 | D_RO(NFC_ECC3, 16); | ||
1240 | D16(NFC_IRQMASK); | ||
1241 | D16(NFC_IRQSTAT); | ||
1242 | D_WO(NFC_PGCTL, 16); | ||
1243 | D_RO(NFC_READ, 16); | ||
1244 | D16(NFC_RST); | ||
1245 | D_RO(NFC_STAT, 16); | ||
1246 | #endif | ||
1247 | |||
1248 | #ifdef OTP_CONTROL | ||
1249 | parent = debugfs_create_dir("otp", top); | ||
1250 | D16(OTP_CONTROL); | ||
1251 | D16(OTP_BEN); | ||
1252 | D16(OTP_STATUS); | ||
1253 | D32(OTP_TIMING); | ||
1254 | D32(OTP_DATA0); | ||
1255 | D32(OTP_DATA1); | ||
1256 | D32(OTP_DATA2); | ||
1257 | D32(OTP_DATA3); | ||
1258 | #endif | ||
1259 | |||
1260 | #ifdef PIXC_CTL | ||
1261 | parent = debugfs_create_dir("pixc", top); | ||
1262 | D16(PIXC_CTL); | ||
1263 | D16(PIXC_PPL); | ||
1264 | D16(PIXC_LPF); | ||
1265 | D16(PIXC_AHSTART); | ||
1266 | D16(PIXC_AHEND); | ||
1267 | D16(PIXC_AVSTART); | ||
1268 | D16(PIXC_AVEND); | ||
1269 | D16(PIXC_ATRANSP); | ||
1270 | D16(PIXC_BHSTART); | ||
1271 | D16(PIXC_BHEND); | ||
1272 | D16(PIXC_BVSTART); | ||
1273 | D16(PIXC_BVEND); | ||
1274 | D16(PIXC_BTRANSP); | ||
1275 | D16(PIXC_INTRSTAT); | ||
1276 | D32(PIXC_RYCON); | ||
1277 | D32(PIXC_GUCON); | ||
1278 | D32(PIXC_BVCON); | ||
1279 | D32(PIXC_CCBIAS); | ||
1280 | D32(PIXC_TC); | ||
1281 | #endif | ||
1282 | |||
1283 | parent = debugfs_create_dir("pll", top); | ||
1284 | D16(PLL_CTL); | ||
1285 | D16(PLL_DIV); | ||
1286 | D16(PLL_LOCKCNT); | ||
1287 | D16(PLL_STAT); | ||
1288 | D16(VR_CTL); | ||
1289 | D32(CHIPID); /* it's part of this hardware block */ | ||
1290 | |||
1291 | #if defined(PPI_STATUS) || defined(PPI0_STATUS) || defined(PPI1_STATUS) | ||
1292 | parent = debugfs_create_dir("ppi", top); | ||
1293 | # ifdef PPI_STATUS | ||
1294 | bfin_debug_mmrs_ppi(parent, PPI_STATUS, -1); | ||
1295 | # endif | ||
1296 | # ifdef PPI0_STATUS | ||
1297 | PPI(0); | ||
1298 | # endif | ||
1299 | # ifdef PPI1_STATUS | ||
1300 | PPI(1); | ||
1301 | # endif | ||
1302 | #endif | ||
1303 | |||
1304 | #ifdef PWM_CTRL | ||
1305 | parent = debugfs_create_dir("pwm", top); | ||
1306 | D16(PWM_CTRL); | ||
1307 | D16(PWM_STAT); | ||
1308 | D16(PWM_TM); | ||
1309 | D16(PWM_DT); | ||
1310 | D16(PWM_GATE); | ||
1311 | D16(PWM_CHA); | ||
1312 | D16(PWM_CHB); | ||
1313 | D16(PWM_CHC); | ||
1314 | D16(PWM_SEG); | ||
1315 | D16(PWM_SYNCWT); | ||
1316 | D16(PWM_CHAL); | ||
1317 | D16(PWM_CHBL); | ||
1318 | D16(PWM_CHCL); | ||
1319 | D16(PWM_LSI); | ||
1320 | D16(PWM_STAT2); | ||
1321 | #endif | ||
1322 | |||
1323 | #ifdef RSI_CONFIG | ||
1324 | parent = debugfs_create_dir("rsi", top); | ||
1325 | D32(RSI_ARGUMENT); | ||
1326 | D16(RSI_CEATA_CONTROL); | ||
1327 | D16(RSI_CLK_CONTROL); | ||
1328 | D16(RSI_COMMAND); | ||
1329 | D16(RSI_CONFIG); | ||
1330 | D16(RSI_DATA_CNT); | ||
1331 | D16(RSI_DATA_CONTROL); | ||
1332 | D16(RSI_DATA_LGTH); | ||
1333 | D32(RSI_DATA_TIMER); | ||
1334 | D16(RSI_EMASK); | ||
1335 | D16(RSI_ESTAT); | ||
1336 | D32(RSI_FIFO); | ||
1337 | D16(RSI_FIFO_CNT); | ||
1338 | D32(RSI_MASK0); | ||
1339 | D32(RSI_MASK1); | ||
1340 | D16(RSI_PID0); | ||
1341 | D16(RSI_PID1); | ||
1342 | D16(RSI_PID2); | ||
1343 | D16(RSI_PID3); | ||
1344 | D16(RSI_PWR_CONTROL); | ||
1345 | D16(RSI_RD_WAIT_EN); | ||
1346 | D32(RSI_RESPONSE0); | ||
1347 | D32(RSI_RESPONSE1); | ||
1348 | D32(RSI_RESPONSE2); | ||
1349 | D32(RSI_RESPONSE3); | ||
1350 | D16(RSI_RESP_CMD); | ||
1351 | D32(RSI_STATUS); | ||
1352 | D_WO(RSI_STATUSCL, 16); | ||
1353 | #endif | ||
1354 | |||
1355 | #ifdef RTC_ALARM | ||
1356 | parent = debugfs_create_dir("rtc", top); | ||
1357 | D32(RTC_ALARM); | ||
1358 | D16(RTC_ICTL); | ||
1359 | D16(RTC_ISTAT); | ||
1360 | D16(RTC_PREN); | ||
1361 | D32(RTC_STAT); | ||
1362 | D16(RTC_SWCNT); | ||
1363 | #endif | ||
1364 | |||
1365 | #ifdef SDH_CFG | ||
1366 | parent = debugfs_create_dir("sdh", top); | ||
1367 | D32(SDH_ARGUMENT); | ||
1368 | D16(SDH_CFG); | ||
1369 | D16(SDH_CLK_CTL); | ||
1370 | D16(SDH_COMMAND); | ||
1371 | D_RO(SDH_DATA_CNT, 16); | ||
1372 | D16(SDH_DATA_CTL); | ||
1373 | D16(SDH_DATA_LGTH); | ||
1374 | D32(SDH_DATA_TIMER); | ||
1375 | D16(SDH_E_MASK); | ||
1376 | D16(SDH_E_STATUS); | ||
1377 | D32(SDH_FIFO); | ||
1378 | D_RO(SDH_FIFO_CNT, 16); | ||
1379 | D32(SDH_MASK0); | ||
1380 | D32(SDH_MASK1); | ||
1381 | D_RO(SDH_PID0, 16); | ||
1382 | D_RO(SDH_PID1, 16); | ||
1383 | D_RO(SDH_PID2, 16); | ||
1384 | D_RO(SDH_PID3, 16); | ||
1385 | D_RO(SDH_PID4, 16); | ||
1386 | D_RO(SDH_PID5, 16); | ||
1387 | D_RO(SDH_PID6, 16); | ||
1388 | D_RO(SDH_PID7, 16); | ||
1389 | D16(SDH_PWR_CTL); | ||
1390 | D16(SDH_RD_WAIT_EN); | ||
1391 | D_RO(SDH_RESPONSE0, 32); | ||
1392 | D_RO(SDH_RESPONSE1, 32); | ||
1393 | D_RO(SDH_RESPONSE2, 32); | ||
1394 | D_RO(SDH_RESPONSE3, 32); | ||
1395 | D_RO(SDH_RESP_CMD, 16); | ||
1396 | D_RO(SDH_STATUS, 32); | ||
1397 | D_WO(SDH_STATUS_CLR, 16); | ||
1398 | #endif | ||
1399 | |||
1400 | #ifdef SECURE_CONTROL | ||
1401 | parent = debugfs_create_dir("security", top); | ||
1402 | D16(SECURE_CONTROL); | ||
1403 | D16(SECURE_STATUS); | ||
1404 | D32(SECURE_SYSSWT); | ||
1405 | #endif | ||
1406 | |||
1407 | parent = debugfs_create_dir("sic", top); | ||
1408 | D16(SWRST); | ||
1409 | D16(SYSCR); | ||
1410 | D16(SIC_RVECT); | ||
1411 | D32(SIC_IAR0); | ||
1412 | D32(SIC_IAR1); | ||
1413 | D32(SIC_IAR2); | ||
1414 | #ifdef SIC_IAR3 | ||
1415 | D32(SIC_IAR3); | ||
1416 | #endif | ||
1417 | #ifdef SIC_IAR4 | ||
1418 | D32(SIC_IAR4); | ||
1419 | D32(SIC_IAR5); | ||
1420 | D32(SIC_IAR6); | ||
1421 | #endif | ||
1422 | #ifdef SIC_IAR7 | ||
1423 | D32(SIC_IAR7); | ||
1424 | #endif | ||
1425 | #ifdef SIC_IAR8 | ||
1426 | D32(SIC_IAR8); | ||
1427 | D32(SIC_IAR9); | ||
1428 | D32(SIC_IAR10); | ||
1429 | D32(SIC_IAR11); | ||
1430 | #endif | ||
1431 | #ifdef SIC_IMASK | ||
1432 | D32(SIC_IMASK); | ||
1433 | D32(SIC_ISR); | ||
1434 | D32(SIC_IWR); | ||
1435 | #endif | ||
1436 | #ifdef SIC_IMASK0 | ||
1437 | D32(SIC_IMASK0); | ||
1438 | D32(SIC_IMASK1); | ||
1439 | D32(SIC_ISR0); | ||
1440 | D32(SIC_ISR1); | ||
1441 | D32(SIC_IWR0); | ||
1442 | D32(SIC_IWR1); | ||
1443 | #endif | ||
1444 | #ifdef SIC_IMASK2 | ||
1445 | D32(SIC_IMASK2); | ||
1446 | D32(SIC_ISR2); | ||
1447 | D32(SIC_IWR2); | ||
1448 | #endif | ||
1449 | #ifdef SICB_RVECT | ||
1450 | D16(SICB_SWRST); | ||
1451 | D16(SICB_SYSCR); | ||
1452 | D16(SICB_RVECT); | ||
1453 | D32(SICB_IAR0); | ||
1454 | D32(SICB_IAR1); | ||
1455 | D32(SICB_IAR2); | ||
1456 | D32(SICB_IAR3); | ||
1457 | D32(SICB_IAR4); | ||
1458 | D32(SICB_IAR5); | ||
1459 | D32(SICB_IAR6); | ||
1460 | D32(SICB_IAR7); | ||
1461 | D32(SICB_IMASK0); | ||
1462 | D32(SICB_IMASK1); | ||
1463 | D32(SICB_ISR0); | ||
1464 | D32(SICB_ISR1); | ||
1465 | D32(SICB_IWR0); | ||
1466 | D32(SICB_IWR1); | ||
1467 | #endif | ||
1468 | |||
1469 | parent = debugfs_create_dir("spi", top); | ||
1470 | #ifdef SPI0_REGBASE | ||
1471 | SPI(0); | ||
1472 | #endif | ||
1473 | #ifdef SPI1_REGBASE | ||
1474 | SPI(1); | ||
1475 | #endif | ||
1476 | #ifdef SPI2_REGBASE | ||
1477 | SPI(2); | ||
1478 | #endif | ||
1479 | |||
1480 | parent = debugfs_create_dir("sport", top); | ||
1481 | #ifdef SPORT0_STAT | ||
1482 | SPORT(0); | ||
1483 | #endif | ||
1484 | #ifdef SPORT1_STAT | ||
1485 | SPORT(1); | ||
1486 | #endif | ||
1487 | #ifdef SPORT2_STAT | ||
1488 | SPORT(2); | ||
1489 | #endif | ||
1490 | #ifdef SPORT3_STAT | ||
1491 | SPORT(3); | ||
1492 | #endif | ||
1493 | |||
1494 | #if defined(TWI_CLKDIV) || defined(TWI0_CLKDIV) || defined(TWI1_CLKDIV) | ||
1495 | parent = debugfs_create_dir("twi", top); | ||
1496 | # ifdef TWI_CLKDIV | ||
1497 | bfin_debug_mmrs_twi(parent, TWI_CLKDIV, -1); | ||
1498 | # endif | ||
1499 | # ifdef TWI0_CLKDIV | ||
1500 | TWI(0); | ||
1501 | # endif | ||
1502 | # ifdef TWI1_CLKDIV | ||
1503 | TWI(1); | ||
1504 | # endif | ||
1505 | #endif | ||
1506 | |||
1507 | parent = debugfs_create_dir("uart", top); | ||
1508 | #ifdef BFIN_UART_DLL | ||
1509 | bfin_debug_mmrs_uart(parent, BFIN_UART_DLL, -1); | ||
1510 | #endif | ||
1511 | #ifdef UART0_DLL | ||
1512 | UART(0); | ||
1513 | #endif | ||
1514 | #ifdef UART1_DLL | ||
1515 | UART(1); | ||
1516 | #endif | ||
1517 | #ifdef UART2_DLL | ||
1518 | UART(2); | ||
1519 | #endif | ||
1520 | #ifdef UART3_DLL | ||
1521 | UART(3); | ||
1522 | #endif | ||
1523 | |||
1524 | #ifdef USB_FADDR | ||
1525 | parent = debugfs_create_dir("usb", top); | ||
1526 | D16(USB_FADDR); | ||
1527 | D16(USB_POWER); | ||
1528 | D16(USB_INTRTX); | ||
1529 | D16(USB_INTRRX); | ||
1530 | D16(USB_INTRTXE); | ||
1531 | D16(USB_INTRRXE); | ||
1532 | D16(USB_INTRUSB); | ||
1533 | D16(USB_INTRUSBE); | ||
1534 | D16(USB_FRAME); | ||
1535 | D16(USB_INDEX); | ||
1536 | D16(USB_TESTMODE); | ||
1537 | D16(USB_GLOBINTR); | ||
1538 | D16(USB_GLOBAL_CTL); | ||
1539 | D16(USB_TX_MAX_PACKET); | ||
1540 | D16(USB_CSR0); | ||
1541 | D16(USB_TXCSR); | ||
1542 | D16(USB_RX_MAX_PACKET); | ||
1543 | D16(USB_RXCSR); | ||
1544 | D16(USB_COUNT0); | ||
1545 | D16(USB_RXCOUNT); | ||
1546 | D16(USB_TXTYPE); | ||
1547 | D16(USB_NAKLIMIT0); | ||
1548 | D16(USB_TXINTERVAL); | ||
1549 | D16(USB_RXTYPE); | ||
1550 | D16(USB_RXINTERVAL); | ||
1551 | D16(USB_TXCOUNT); | ||
1552 | D16(USB_EP0_FIFO); | ||
1553 | D16(USB_EP1_FIFO); | ||
1554 | D16(USB_EP2_FIFO); | ||
1555 | D16(USB_EP3_FIFO); | ||
1556 | D16(USB_EP4_FIFO); | ||
1557 | D16(USB_EP5_FIFO); | ||
1558 | D16(USB_EP6_FIFO); | ||
1559 | D16(USB_EP7_FIFO); | ||
1560 | D16(USB_OTG_DEV_CTL); | ||
1561 | D16(USB_OTG_VBUS_IRQ); | ||
1562 | D16(USB_OTG_VBUS_MASK); | ||
1563 | D16(USB_LINKINFO); | ||
1564 | D16(USB_VPLEN); | ||
1565 | D16(USB_HS_EOF1); | ||
1566 | D16(USB_FS_EOF1); | ||
1567 | D16(USB_LS_EOF1); | ||
1568 | D16(USB_APHY_CNTRL); | ||
1569 | D16(USB_APHY_CALIB); | ||
1570 | D16(USB_APHY_CNTRL2); | ||
1571 | D16(USB_PHY_TEST); | ||
1572 | D16(USB_PLLOSC_CTRL); | ||
1573 | D16(USB_SRP_CLKDIV); | ||
1574 | D16(USB_EP_NI0_TXMAXP); | ||
1575 | D16(USB_EP_NI0_TXCSR); | ||
1576 | D16(USB_EP_NI0_RXMAXP); | ||
1577 | D16(USB_EP_NI0_RXCSR); | ||
1578 | D16(USB_EP_NI0_RXCOUNT); | ||
1579 | D16(USB_EP_NI0_TXTYPE); | ||
1580 | D16(USB_EP_NI0_TXINTERVAL); | ||
1581 | D16(USB_EP_NI0_RXTYPE); | ||
1582 | D16(USB_EP_NI0_RXINTERVAL); | ||
1583 | D16(USB_EP_NI0_TXCOUNT); | ||
1584 | D16(USB_EP_NI1_TXMAXP); | ||
1585 | D16(USB_EP_NI1_TXCSR); | ||
1586 | D16(USB_EP_NI1_RXMAXP); | ||
1587 | D16(USB_EP_NI1_RXCSR); | ||
1588 | D16(USB_EP_NI1_RXCOUNT); | ||
1589 | D16(USB_EP_NI1_TXTYPE); | ||
1590 | D16(USB_EP_NI1_TXINTERVAL); | ||
1591 | D16(USB_EP_NI1_RXTYPE); | ||
1592 | D16(USB_EP_NI1_RXINTERVAL); | ||
1593 | D16(USB_EP_NI1_TXCOUNT); | ||
1594 | D16(USB_EP_NI2_TXMAXP); | ||
1595 | D16(USB_EP_NI2_TXCSR); | ||
1596 | D16(USB_EP_NI2_RXMAXP); | ||
1597 | D16(USB_EP_NI2_RXCSR); | ||
1598 | D16(USB_EP_NI2_RXCOUNT); | ||
1599 | D16(USB_EP_NI2_TXTYPE); | ||
1600 | D16(USB_EP_NI2_TXINTERVAL); | ||
1601 | D16(USB_EP_NI2_RXTYPE); | ||
1602 | D16(USB_EP_NI2_RXINTERVAL); | ||
1603 | D16(USB_EP_NI2_TXCOUNT); | ||
1604 | D16(USB_EP_NI3_TXMAXP); | ||
1605 | D16(USB_EP_NI3_TXCSR); | ||
1606 | D16(USB_EP_NI3_RXMAXP); | ||
1607 | D16(USB_EP_NI3_RXCSR); | ||
1608 | D16(USB_EP_NI3_RXCOUNT); | ||
1609 | D16(USB_EP_NI3_TXTYPE); | ||
1610 | D16(USB_EP_NI3_TXINTERVAL); | ||
1611 | D16(USB_EP_NI3_RXTYPE); | ||
1612 | D16(USB_EP_NI3_RXINTERVAL); | ||
1613 | D16(USB_EP_NI3_TXCOUNT); | ||
1614 | D16(USB_EP_NI4_TXMAXP); | ||
1615 | D16(USB_EP_NI4_TXCSR); | ||
1616 | D16(USB_EP_NI4_RXMAXP); | ||
1617 | D16(USB_EP_NI4_RXCSR); | ||
1618 | D16(USB_EP_NI4_RXCOUNT); | ||
1619 | D16(USB_EP_NI4_TXTYPE); | ||
1620 | D16(USB_EP_NI4_TXINTERVAL); | ||
1621 | D16(USB_EP_NI4_RXTYPE); | ||
1622 | D16(USB_EP_NI4_RXINTERVAL); | ||
1623 | D16(USB_EP_NI4_TXCOUNT); | ||
1624 | D16(USB_EP_NI5_TXMAXP); | ||
1625 | D16(USB_EP_NI5_TXCSR); | ||
1626 | D16(USB_EP_NI5_RXMAXP); | ||
1627 | D16(USB_EP_NI5_RXCSR); | ||
1628 | D16(USB_EP_NI5_RXCOUNT); | ||
1629 | D16(USB_EP_NI5_TXTYPE); | ||
1630 | D16(USB_EP_NI5_TXINTERVAL); | ||
1631 | D16(USB_EP_NI5_RXTYPE); | ||
1632 | D16(USB_EP_NI5_RXINTERVAL); | ||
1633 | D16(USB_EP_NI5_TXCOUNT); | ||
1634 | D16(USB_EP_NI6_TXMAXP); | ||
1635 | D16(USB_EP_NI6_TXCSR); | ||
1636 | D16(USB_EP_NI6_RXMAXP); | ||
1637 | D16(USB_EP_NI6_RXCSR); | ||
1638 | D16(USB_EP_NI6_RXCOUNT); | ||
1639 | D16(USB_EP_NI6_TXTYPE); | ||
1640 | D16(USB_EP_NI6_TXINTERVAL); | ||
1641 | D16(USB_EP_NI6_RXTYPE); | ||
1642 | D16(USB_EP_NI6_RXINTERVAL); | ||
1643 | D16(USB_EP_NI6_TXCOUNT); | ||
1644 | D16(USB_EP_NI7_TXMAXP); | ||
1645 | D16(USB_EP_NI7_TXCSR); | ||
1646 | D16(USB_EP_NI7_RXMAXP); | ||
1647 | D16(USB_EP_NI7_RXCSR); | ||
1648 | D16(USB_EP_NI7_RXCOUNT); | ||
1649 | D16(USB_EP_NI7_TXTYPE); | ||
1650 | D16(USB_EP_NI7_TXINTERVAL); | ||
1651 | D16(USB_EP_NI7_RXTYPE); | ||
1652 | D16(USB_EP_NI7_RXINTERVAL); | ||
1653 | D16(USB_EP_NI7_TXCOUNT); | ||
1654 | D16(USB_DMA_INTERRUPT); | ||
1655 | D16(USB_DMA0CONTROL); | ||
1656 | D16(USB_DMA0ADDRLOW); | ||
1657 | D16(USB_DMA0ADDRHIGH); | ||
1658 | D16(USB_DMA0COUNTLOW); | ||
1659 | D16(USB_DMA0COUNTHIGH); | ||
1660 | D16(USB_DMA1CONTROL); | ||
1661 | D16(USB_DMA1ADDRLOW); | ||
1662 | D16(USB_DMA1ADDRHIGH); | ||
1663 | D16(USB_DMA1COUNTLOW); | ||
1664 | D16(USB_DMA1COUNTHIGH); | ||
1665 | D16(USB_DMA2CONTROL); | ||
1666 | D16(USB_DMA2ADDRLOW); | ||
1667 | D16(USB_DMA2ADDRHIGH); | ||
1668 | D16(USB_DMA2COUNTLOW); | ||
1669 | D16(USB_DMA2COUNTHIGH); | ||
1670 | D16(USB_DMA3CONTROL); | ||
1671 | D16(USB_DMA3ADDRLOW); | ||
1672 | D16(USB_DMA3ADDRHIGH); | ||
1673 | D16(USB_DMA3COUNTLOW); | ||
1674 | D16(USB_DMA3COUNTHIGH); | ||
1675 | D16(USB_DMA4CONTROL); | ||
1676 | D16(USB_DMA4ADDRLOW); | ||
1677 | D16(USB_DMA4ADDRHIGH); | ||
1678 | D16(USB_DMA4COUNTLOW); | ||
1679 | D16(USB_DMA4COUNTHIGH); | ||
1680 | D16(USB_DMA5CONTROL); | ||
1681 | D16(USB_DMA5ADDRLOW); | ||
1682 | D16(USB_DMA5ADDRHIGH); | ||
1683 | D16(USB_DMA5COUNTLOW); | ||
1684 | D16(USB_DMA5COUNTHIGH); | ||
1685 | D16(USB_DMA6CONTROL); | ||
1686 | D16(USB_DMA6ADDRLOW); | ||
1687 | D16(USB_DMA6ADDRHIGH); | ||
1688 | D16(USB_DMA6COUNTLOW); | ||
1689 | D16(USB_DMA6COUNTHIGH); | ||
1690 | D16(USB_DMA7CONTROL); | ||
1691 | D16(USB_DMA7ADDRLOW); | ||
1692 | D16(USB_DMA7ADDRHIGH); | ||
1693 | D16(USB_DMA7COUNTLOW); | ||
1694 | D16(USB_DMA7COUNTHIGH); | ||
1695 | #endif | ||
1696 | |||
1697 | #ifdef WDOG_CNT | ||
1698 | parent = debugfs_create_dir("watchdog", top); | ||
1699 | D32(WDOG_CNT); | ||
1700 | D16(WDOG_CTL); | ||
1701 | D32(WDOG_STAT); | ||
1702 | #endif | ||
1703 | #ifdef WDOGA_CNT | ||
1704 | parent = debugfs_create_dir("watchdog", top); | ||
1705 | D32(WDOGA_CNT); | ||
1706 | D16(WDOGA_CTL); | ||
1707 | D32(WDOGA_STAT); | ||
1708 | D32(WDOGB_CNT); | ||
1709 | D16(WDOGB_CTL); | ||
1710 | D32(WDOGB_STAT); | ||
1711 | #endif | ||
1712 | |||
1713 | /* BF533 glue */ | ||
1714 | #ifdef FIO_FLAG_D | ||
1715 | #define PORTFIO FIO_FLAG_D | ||
1716 | #endif | ||
1717 | /* BF561 glue */ | ||
1718 | #ifdef FIO0_FLAG_D | ||
1719 | #define PORTFIO FIO0_FLAG_D | ||
1720 | #endif | ||
1721 | #ifdef FIO1_FLAG_D | ||
1722 | #define PORTGIO FIO1_FLAG_D | ||
1723 | #endif | ||
1724 | #ifdef FIO2_FLAG_D | ||
1725 | #define PORTHIO FIO2_FLAG_D | ||
1726 | #endif | ||
1727 | parent = debugfs_create_dir("port", top); | ||
1728 | #ifdef PORTFIO | ||
1729 | PORT(PORTFIO, 'F'); | ||
1730 | #endif | ||
1731 | #ifdef PORTGIO | ||
1732 | PORT(PORTGIO, 'G'); | ||
1733 | #endif | ||
1734 | #ifdef PORTHIO | ||
1735 | PORT(PORTHIO, 'H'); | ||
1736 | #endif | ||
1737 | |||
1738 | #ifdef __ADSPBF51x__ | ||
1739 | D16(PORTF_FER); | ||
1740 | D16(PORTF_DRIVE); | ||
1741 | D16(PORTF_HYSTERESIS); | ||
1742 | D16(PORTF_MUX); | ||
1743 | |||
1744 | D16(PORTG_FER); | ||
1745 | D16(PORTG_DRIVE); | ||
1746 | D16(PORTG_HYSTERESIS); | ||
1747 | D16(PORTG_MUX); | ||
1748 | |||
1749 | D16(PORTH_FER); | ||
1750 | D16(PORTH_DRIVE); | ||
1751 | D16(PORTH_HYSTERESIS); | ||
1752 | D16(PORTH_MUX); | ||
1753 | |||
1754 | D16(MISCPORT_DRIVE); | ||
1755 | D16(MISCPORT_HYSTERESIS); | ||
1756 | #endif /* BF51x */ | ||
1757 | |||
1758 | #ifdef __ADSPBF52x__ | ||
1759 | D16(PORTF_FER); | ||
1760 | D16(PORTF_DRIVE); | ||
1761 | D16(PORTF_HYSTERESIS); | ||
1762 | D16(PORTF_MUX); | ||
1763 | D16(PORTF_SLEW); | ||
1764 | |||
1765 | D16(PORTG_FER); | ||
1766 | D16(PORTG_DRIVE); | ||
1767 | D16(PORTG_HYSTERESIS); | ||
1768 | D16(PORTG_MUX); | ||
1769 | D16(PORTG_SLEW); | ||
1770 | |||
1771 | D16(PORTH_FER); | ||
1772 | D16(PORTH_DRIVE); | ||
1773 | D16(PORTH_HYSTERESIS); | ||
1774 | D16(PORTH_MUX); | ||
1775 | D16(PORTH_SLEW); | ||
1776 | |||
1777 | D16(MISCPORT_DRIVE); | ||
1778 | D16(MISCPORT_HYSTERESIS); | ||
1779 | D16(MISCPORT_SLEW); | ||
1780 | #endif /* BF52x */ | ||
1781 | |||
1782 | #ifdef BF537_FAMILY | ||
1783 | D16(PORTF_FER); | ||
1784 | D16(PORTG_FER); | ||
1785 | D16(PORTH_FER); | ||
1786 | D16(PORT_MUX); | ||
1787 | #endif /* BF534 BF536 BF537 */ | ||
1788 | |||
1789 | #ifdef BF538_FAMILY | ||
1790 | D16(PORTCIO_FER); | ||
1791 | D16(PORTCIO); | ||
1792 | D16(PORTCIO_CLEAR); | ||
1793 | D16(PORTCIO_SET); | ||
1794 | D16(PORTCIO_TOGGLE); | ||
1795 | D16(PORTCIO_DIR); | ||
1796 | D16(PORTCIO_INEN); | ||
1797 | |||
1798 | D16(PORTDIO); | ||
1799 | D16(PORTDIO_CLEAR); | ||
1800 | D16(PORTDIO_DIR); | ||
1801 | D16(PORTDIO_FER); | ||
1802 | D16(PORTDIO_INEN); | ||
1803 | D16(PORTDIO_SET); | ||
1804 | D16(PORTDIO_TOGGLE); | ||
1805 | |||
1806 | D16(PORTEIO); | ||
1807 | D16(PORTEIO_CLEAR); | ||
1808 | D16(PORTEIO_DIR); | ||
1809 | D16(PORTEIO_FER); | ||
1810 | D16(PORTEIO_INEN); | ||
1811 | D16(PORTEIO_SET); | ||
1812 | D16(PORTEIO_TOGGLE); | ||
1813 | #endif /* BF538 BF539 */ | ||
1814 | |||
1815 | #ifdef __ADSPBF54x__ | ||
1816 | { | ||
1817 | int num; | ||
1818 | unsigned long base; | ||
1819 | char *_buf, buf[32]; | ||
1820 | |||
1821 | base = PORTA_FER; | ||
1822 | for (num = 0; num < 10; ++num) { | ||
1823 | PORT(base, num); | ||
1824 | base += sizeof(struct bfin_gpio_regs); | ||
1825 | } | ||
1826 | |||
1827 | #define __PINT(uname, lname) __REGS(pint, #uname, lname) | ||
1828 | parent = debugfs_create_dir("pint", top); | ||
1829 | base = PINT0_MASK_SET; | ||
1830 | for (num = 0; num < 4; ++num) { | ||
1831 | _buf = REGS_STR_PFX(buf, PINT, num); | ||
1832 | __PINT(MASK_SET, mask_set); | ||
1833 | __PINT(MASK_CLEAR, mask_clear); | ||
1834 | __PINT(IRQ, irq); | ||
1835 | __PINT(ASSIGN, assign); | ||
1836 | __PINT(EDGE_SET, edge_set); | ||
1837 | __PINT(EDGE_CLEAR, edge_clear); | ||
1838 | __PINT(INVERT_SET, invert_set); | ||
1839 | __PINT(INVERT_CLEAR, invert_clear); | ||
1840 | __PINT(PINSTATE, pinstate); | ||
1841 | __PINT(LATCH, latch); | ||
1842 | base += sizeof(struct bfin_pint_regs); | ||
1843 | } | ||
1844 | |||
1845 | } | ||
1846 | #endif /* BF54x */ | ||
1847 | |||
1848 | debug_mmrs_dentry = top; | ||
1849 | |||
1850 | return 0; | ||
1851 | } | ||
1852 | module_init(bfin_debug_mmrs_init); | ||
1853 | |||
1854 | static void __exit bfin_debug_mmrs_exit(void) | ||
1855 | { | ||
1856 | debugfs_remove_recursive(debug_mmrs_dentry); | ||
1857 | } | ||
1858 | module_exit(bfin_debug_mmrs_exit); | ||
1859 | |||
1860 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/blackfin/kernel/ipipe.c b/arch/blackfin/kernel/ipipe.c index f37019c847c9..486426f8a0d7 100644 --- a/arch/blackfin/kernel/ipipe.c +++ b/arch/blackfin/kernel/ipipe.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <asm/system.h> | 34 | #include <asm/system.h> |
35 | #include <asm/atomic.h> | 35 | #include <asm/atomic.h> |
36 | #include <asm/irq_handler.h> | ||
36 | 37 | ||
37 | DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs); | 38 | DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs); |
38 | 39 | ||
diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c index 1696d34f51c2..ff3d747154ac 100644 --- a/arch/blackfin/kernel/irqchip.c +++ b/arch/blackfin/kernel/irqchip.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kallsyms.h> | 11 | #include <linux/kallsyms.h> |
12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
14 | #include <asm/irq_handler.h> | ||
14 | #include <asm/trace.h> | 15 | #include <asm/trace.h> |
15 | #include <asm/pda.h> | 16 | #include <asm/pda.h> |
16 | 17 | ||
diff --git a/arch/blackfin/kernel/nmi.c b/arch/blackfin/kernel/nmi.c index 401eb1d8e3b4..679d0db35256 100644 --- a/arch/blackfin/kernel/nmi.c +++ b/arch/blackfin/kernel/nmi.c | |||
@@ -145,16 +145,16 @@ int check_nmi_wdt_touched(void) | |||
145 | { | 145 | { |
146 | unsigned int this_cpu = smp_processor_id(); | 146 | unsigned int this_cpu = smp_processor_id(); |
147 | unsigned int cpu; | 147 | unsigned int cpu; |
148 | cpumask_t mask; | ||
148 | 149 | ||
149 | cpumask_t mask = cpu_online_map; | 150 | cpumask_copy(&mask, cpu_online_mask); |
150 | |||
151 | if (!atomic_read(&nmi_touched[this_cpu])) | 151 | if (!atomic_read(&nmi_touched[this_cpu])) |
152 | return 0; | 152 | return 0; |
153 | 153 | ||
154 | atomic_set(&nmi_touched[this_cpu], 0); | 154 | atomic_set(&nmi_touched[this_cpu], 0); |
155 | 155 | ||
156 | cpu_clear(this_cpu, mask); | 156 | cpumask_clear_cpu(this_cpu, &mask); |
157 | for_each_cpu_mask(cpu, mask) { | 157 | for_each_cpu(cpu, &mask) { |
158 | invalidate_dcache_range((unsigned long)(&nmi_touched[cpu]), | 158 | invalidate_dcache_range((unsigned long)(&nmi_touched[cpu]), |
159 | (unsigned long)(&nmi_touched[cpu])); | 159 | (unsigned long)(&nmi_touched[cpu])); |
160 | if (!atomic_read(&nmi_touched[cpu])) | 160 | if (!atomic_read(&nmi_touched[cpu])) |
diff --git a/arch/blackfin/kernel/perf_event.c b/arch/blackfin/kernel/perf_event.c new file mode 100644 index 000000000000..04300f29c0e7 --- /dev/null +++ b/arch/blackfin/kernel/perf_event.c | |||
@@ -0,0 +1,498 @@ | |||
1 | /* | ||
2 | * Blackfin performance counters | ||
3 | * | ||
4 | * Copyright 2011 Analog Devices Inc. | ||
5 | * | ||
6 | * Ripped from SuperH version: | ||
7 | * | ||
8 | * Copyright (C) 2009 Paul Mundt | ||
9 | * | ||
10 | * Heavily based on the x86 and PowerPC implementations. | ||
11 | * | ||
12 | * x86: | ||
13 | * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> | ||
14 | * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar | ||
15 | * Copyright (C) 2009 Jaswinder Singh Rajput | ||
16 | * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter | ||
17 | * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | ||
18 | * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com> | ||
19 | * | ||
20 | * ppc: | ||
21 | * Copyright 2008-2009 Paul Mackerras, IBM Corporation. | ||
22 | * | ||
23 | * Licensed under the GPL-2 or later. | ||
24 | */ | ||
25 | |||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/perf_event.h> | ||
29 | #include <asm/bfin_pfmon.h> | ||
30 | |||
31 | /* | ||
32 | * We have two counters, and each counter can support an event type. | ||
33 | * The 'o' is PFCNTx=1 and 's' is PFCNTx=0 | ||
34 | * | ||
35 | * 0x04 o pc invariant branches | ||
36 | * 0x06 o mispredicted branches | ||
37 | * 0x09 o predicted branches taken | ||
38 | * 0x0B o EXCPT insn | ||
39 | * 0x0C o CSYNC/SSYNC insn | ||
40 | * 0x0D o Insns committed | ||
41 | * 0x0E o Interrupts taken | ||
42 | * 0x0F o Misaligned address exceptions | ||
43 | * 0x80 o Code memory fetches stalled due to DMA | ||
44 | * 0x83 o 64bit insn fetches delivered | ||
45 | * 0x9A o data cache fills (bank a) | ||
46 | * 0x9B o data cache fills (bank b) | ||
47 | * 0x9C o data cache lines evicted (bank a) | ||
48 | * 0x9D o data cache lines evicted (bank b) | ||
49 | * 0x9E o data cache high priority fills | ||
50 | * 0x9F o data cache low priority fills | ||
51 | * 0x00 s loop 0 iterations | ||
52 | * 0x01 s loop 1 iterations | ||
53 | * 0x0A s CSYNC/SSYNC stalls | ||
54 | * 0x10 s DAG read/after write hazards | ||
55 | * 0x13 s RAW data hazards | ||
56 | * 0x81 s code TAG stalls | ||
57 | * 0x82 s code fill stalls | ||
58 | * 0x90 s processor to memory stalls | ||
59 | * 0x91 s data memory stalls not hidden by 0x90 | ||
60 | * 0x92 s data store buffer full stalls | ||
61 | * 0x93 s data memory write buffer full stalls due to high->low priority | ||
62 | * 0x95 s data memory fill buffer stalls | ||
63 | * 0x96 s data TAG collision stalls | ||
64 | * 0x97 s data collision stalls | ||
65 | * 0x98 s data stalls | ||
66 | * 0x99 s data stalls sent to processor | ||
67 | */ | ||
68 | |||
69 | static const int event_map[] = { | ||
70 | /* use CYCLES cpu register */ | ||
71 | [PERF_COUNT_HW_CPU_CYCLES] = -1, | ||
72 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x0D, | ||
73 | [PERF_COUNT_HW_CACHE_REFERENCES] = -1, | ||
74 | [PERF_COUNT_HW_CACHE_MISSES] = 0x83, | ||
75 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x09, | ||
76 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x06, | ||
77 | [PERF_COUNT_HW_BUS_CYCLES] = -1, | ||
78 | }; | ||
79 | |||
80 | #define C(x) PERF_COUNT_HW_CACHE_##x | ||
81 | |||
82 | static const int cache_events[PERF_COUNT_HW_CACHE_MAX] | ||
83 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
84 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = | ||
85 | { | ||
86 | [C(L1D)] = { /* Data bank A */ | ||
87 | [C(OP_READ)] = { | ||
88 | [C(RESULT_ACCESS)] = 0, | ||
89 | [C(RESULT_MISS) ] = 0x9A, | ||
90 | }, | ||
91 | [C(OP_WRITE)] = { | ||
92 | [C(RESULT_ACCESS)] = 0, | ||
93 | [C(RESULT_MISS) ] = 0, | ||
94 | }, | ||
95 | [C(OP_PREFETCH)] = { | ||
96 | [C(RESULT_ACCESS)] = 0, | ||
97 | [C(RESULT_MISS) ] = 0, | ||
98 | }, | ||
99 | }, | ||
100 | |||
101 | [C(L1I)] = { | ||
102 | [C(OP_READ)] = { | ||
103 | [C(RESULT_ACCESS)] = 0, | ||
104 | [C(RESULT_MISS) ] = 0x83, | ||
105 | }, | ||
106 | [C(OP_WRITE)] = { | ||
107 | [C(RESULT_ACCESS)] = -1, | ||
108 | [C(RESULT_MISS) ] = -1, | ||
109 | }, | ||
110 | [C(OP_PREFETCH)] = { | ||
111 | [C(RESULT_ACCESS)] = 0, | ||
112 | [C(RESULT_MISS) ] = 0, | ||
113 | }, | ||
114 | }, | ||
115 | |||
116 | [C(LL)] = { | ||
117 | [C(OP_READ)] = { | ||
118 | [C(RESULT_ACCESS)] = -1, | ||
119 | [C(RESULT_MISS) ] = -1, | ||
120 | }, | ||
121 | [C(OP_WRITE)] = { | ||
122 | [C(RESULT_ACCESS)] = -1, | ||
123 | [C(RESULT_MISS) ] = -1, | ||
124 | }, | ||
125 | [C(OP_PREFETCH)] = { | ||
126 | [C(RESULT_ACCESS)] = -1, | ||
127 | [C(RESULT_MISS) ] = -1, | ||
128 | }, | ||
129 | }, | ||
130 | |||
131 | [C(DTLB)] = { | ||
132 | [C(OP_READ)] = { | ||
133 | [C(RESULT_ACCESS)] = -1, | ||
134 | [C(RESULT_MISS) ] = -1, | ||
135 | }, | ||
136 | [C(OP_WRITE)] = { | ||
137 | [C(RESULT_ACCESS)] = -1, | ||
138 | [C(RESULT_MISS) ] = -1, | ||
139 | }, | ||
140 | [C(OP_PREFETCH)] = { | ||
141 | [C(RESULT_ACCESS)] = -1, | ||
142 | [C(RESULT_MISS) ] = -1, | ||
143 | }, | ||
144 | }, | ||
145 | |||
146 | [C(ITLB)] = { | ||
147 | [C(OP_READ)] = { | ||
148 | [C(RESULT_ACCESS)] = -1, | ||
149 | [C(RESULT_MISS) ] = -1, | ||
150 | }, | ||
151 | [C(OP_WRITE)] = { | ||
152 | [C(RESULT_ACCESS)] = -1, | ||
153 | [C(RESULT_MISS) ] = -1, | ||
154 | }, | ||
155 | [C(OP_PREFETCH)] = { | ||
156 | [C(RESULT_ACCESS)] = -1, | ||
157 | [C(RESULT_MISS) ] = -1, | ||
158 | }, | ||
159 | }, | ||
160 | |||
161 | [C(BPU)] = { | ||
162 | [C(OP_READ)] = { | ||
163 | [C(RESULT_ACCESS)] = -1, | ||
164 | [C(RESULT_MISS) ] = -1, | ||
165 | }, | ||
166 | [C(OP_WRITE)] = { | ||
167 | [C(RESULT_ACCESS)] = -1, | ||
168 | [C(RESULT_MISS) ] = -1, | ||
169 | }, | ||
170 | [C(OP_PREFETCH)] = { | ||
171 | [C(RESULT_ACCESS)] = -1, | ||
172 | [C(RESULT_MISS) ] = -1, | ||
173 | }, | ||
174 | }, | ||
175 | }; | ||
176 | |||
177 | const char *perf_pmu_name(void) | ||
178 | { | ||
179 | return "bfin"; | ||
180 | } | ||
181 | EXPORT_SYMBOL(perf_pmu_name); | ||
182 | |||
183 | int perf_num_counters(void) | ||
184 | { | ||
185 | return ARRAY_SIZE(event_map); | ||
186 | } | ||
187 | EXPORT_SYMBOL(perf_num_counters); | ||
188 | |||
189 | static u64 bfin_pfmon_read(int idx) | ||
190 | { | ||
191 | return bfin_read32(PFCNTR0 + (idx * 4)); | ||
192 | } | ||
193 | |||
194 | static void bfin_pfmon_disable(struct hw_perf_event *hwc, int idx) | ||
195 | { | ||
196 | bfin_write_PFCTL(bfin_read_PFCTL() & ~PFCEN(idx, PFCEN_MASK)); | ||
197 | } | ||
198 | |||
199 | static void bfin_pfmon_enable(struct hw_perf_event *hwc, int idx) | ||
200 | { | ||
201 | u32 val, mask; | ||
202 | |||
203 | val = PFPWR; | ||
204 | if (idx) { | ||
205 | mask = ~(PFCNT1 | PFMON1 | PFCEN1 | PEMUSW1); | ||
206 | /* The packed config is for event0, so shift it to event1 slots */ | ||
207 | val |= (hwc->config << (PFMON1_P - PFMON0_P)); | ||
208 | val |= (hwc->config & PFCNT0) << (PFCNT1_P - PFCNT0_P); | ||
209 | bfin_write_PFCNTR1(0); | ||
210 | } else { | ||
211 | mask = ~(PFCNT0 | PFMON0 | PFCEN0 | PEMUSW0); | ||
212 | val |= hwc->config; | ||
213 | bfin_write_PFCNTR0(0); | ||
214 | } | ||
215 | |||
216 | bfin_write_PFCTL((bfin_read_PFCTL() & mask) | val); | ||
217 | } | ||
218 | |||
219 | static void bfin_pfmon_disable_all(void) | ||
220 | { | ||
221 | bfin_write_PFCTL(bfin_read_PFCTL() & ~PFPWR); | ||
222 | } | ||
223 | |||
224 | static void bfin_pfmon_enable_all(void) | ||
225 | { | ||
226 | bfin_write_PFCTL(bfin_read_PFCTL() | PFPWR); | ||
227 | } | ||
228 | |||
229 | struct cpu_hw_events { | ||
230 | struct perf_event *events[MAX_HWEVENTS]; | ||
231 | unsigned long used_mask[BITS_TO_LONGS(MAX_HWEVENTS)]; | ||
232 | }; | ||
233 | DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events); | ||
234 | |||
235 | static int hw_perf_cache_event(int config, int *evp) | ||
236 | { | ||
237 | unsigned long type, op, result; | ||
238 | int ev; | ||
239 | |||
240 | /* unpack config */ | ||
241 | type = config & 0xff; | ||
242 | op = (config >> 8) & 0xff; | ||
243 | result = (config >> 16) & 0xff; | ||
244 | |||
245 | if (type >= PERF_COUNT_HW_CACHE_MAX || | ||
246 | op >= PERF_COUNT_HW_CACHE_OP_MAX || | ||
247 | result >= PERF_COUNT_HW_CACHE_RESULT_MAX) | ||
248 | return -EINVAL; | ||
249 | |||
250 | ev = cache_events[type][op][result]; | ||
251 | if (ev == 0) | ||
252 | return -EOPNOTSUPP; | ||
253 | if (ev == -1) | ||
254 | return -EINVAL; | ||
255 | *evp = ev; | ||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | static void bfin_perf_event_update(struct perf_event *event, | ||
260 | struct hw_perf_event *hwc, int idx) | ||
261 | { | ||
262 | u64 prev_raw_count, new_raw_count; | ||
263 | s64 delta; | ||
264 | int shift = 0; | ||
265 | |||
266 | /* | ||
267 | * Depending on the counter configuration, they may or may not | ||
268 | * be chained, in which case the previous counter value can be | ||
269 | * updated underneath us if the lower-half overflows. | ||
270 | * | ||
271 | * Our tactic to handle this is to first atomically read and | ||
272 | * exchange a new raw count - then add that new-prev delta | ||
273 | * count to the generic counter atomically. | ||
274 | * | ||
275 | * As there is no interrupt associated with the overflow events, | ||
276 | * this is the simplest approach for maintaining consistency. | ||
277 | */ | ||
278 | again: | ||
279 | prev_raw_count = local64_read(&hwc->prev_count); | ||
280 | new_raw_count = bfin_pfmon_read(idx); | ||
281 | |||
282 | if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, | ||
283 | new_raw_count) != prev_raw_count) | ||
284 | goto again; | ||
285 | |||
286 | /* | ||
287 | * Now we have the new raw value and have updated the prev | ||
288 | * timestamp already. We can now calculate the elapsed delta | ||
289 | * (counter-)time and add that to the generic counter. | ||
290 | * | ||
291 | * Careful, not all hw sign-extends above the physical width | ||
292 | * of the count. | ||
293 | */ | ||
294 | delta = (new_raw_count << shift) - (prev_raw_count << shift); | ||
295 | delta >>= shift; | ||
296 | |||
297 | local64_add(delta, &event->count); | ||
298 | } | ||
299 | |||
300 | static void bfin_pmu_stop(struct perf_event *event, int flags) | ||
301 | { | ||
302 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
303 | struct hw_perf_event *hwc = &event->hw; | ||
304 | int idx = hwc->idx; | ||
305 | |||
306 | if (!(event->hw.state & PERF_HES_STOPPED)) { | ||
307 | bfin_pfmon_disable(hwc, idx); | ||
308 | cpuc->events[idx] = NULL; | ||
309 | event->hw.state |= PERF_HES_STOPPED; | ||
310 | } | ||
311 | |||
312 | if ((flags & PERF_EF_UPDATE) && !(event->hw.state & PERF_HES_UPTODATE)) { | ||
313 | bfin_perf_event_update(event, &event->hw, idx); | ||
314 | event->hw.state |= PERF_HES_UPTODATE; | ||
315 | } | ||
316 | } | ||
317 | |||
318 | static void bfin_pmu_start(struct perf_event *event, int flags) | ||
319 | { | ||
320 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
321 | struct hw_perf_event *hwc = &event->hw; | ||
322 | int idx = hwc->idx; | ||
323 | |||
324 | if (WARN_ON_ONCE(idx == -1)) | ||
325 | return; | ||
326 | |||
327 | if (flags & PERF_EF_RELOAD) | ||
328 | WARN_ON_ONCE(!(event->hw.state & PERF_HES_UPTODATE)); | ||
329 | |||
330 | cpuc->events[idx] = event; | ||
331 | event->hw.state = 0; | ||
332 | bfin_pfmon_enable(hwc, idx); | ||
333 | } | ||
334 | |||
335 | static void bfin_pmu_del(struct perf_event *event, int flags) | ||
336 | { | ||
337 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
338 | |||
339 | bfin_pmu_stop(event, PERF_EF_UPDATE); | ||
340 | __clear_bit(event->hw.idx, cpuc->used_mask); | ||
341 | |||
342 | perf_event_update_userpage(event); | ||
343 | } | ||
344 | |||
345 | static int bfin_pmu_add(struct perf_event *event, int flags) | ||
346 | { | ||
347 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
348 | struct hw_perf_event *hwc = &event->hw; | ||
349 | int idx = hwc->idx; | ||
350 | int ret = -EAGAIN; | ||
351 | |||
352 | perf_pmu_disable(event->pmu); | ||
353 | |||
354 | if (__test_and_set_bit(idx, cpuc->used_mask)) { | ||
355 | idx = find_first_zero_bit(cpuc->used_mask, MAX_HWEVENTS); | ||
356 | if (idx == MAX_HWEVENTS) | ||
357 | goto out; | ||
358 | |||
359 | __set_bit(idx, cpuc->used_mask); | ||
360 | hwc->idx = idx; | ||
361 | } | ||
362 | |||
363 | bfin_pfmon_disable(hwc, idx); | ||
364 | |||
365 | event->hw.state = PERF_HES_UPTODATE | PERF_HES_STOPPED; | ||
366 | if (flags & PERF_EF_START) | ||
367 | bfin_pmu_start(event, PERF_EF_RELOAD); | ||
368 | |||
369 | perf_event_update_userpage(event); | ||
370 | ret = 0; | ||
371 | out: | ||
372 | perf_pmu_enable(event->pmu); | ||
373 | return ret; | ||
374 | } | ||
375 | |||
376 | static void bfin_pmu_read(struct perf_event *event) | ||
377 | { | ||
378 | bfin_perf_event_update(event, &event->hw, event->hw.idx); | ||
379 | } | ||
380 | |||
381 | static int bfin_pmu_event_init(struct perf_event *event) | ||
382 | { | ||
383 | struct perf_event_attr *attr = &event->attr; | ||
384 | struct hw_perf_event *hwc = &event->hw; | ||
385 | int config = -1; | ||
386 | int ret; | ||
387 | |||
388 | if (attr->exclude_hv || attr->exclude_idle) | ||
389 | return -EPERM; | ||
390 | |||
391 | /* | ||
392 | * All of the on-chip counters are "limited", in that they have | ||
393 | * no interrupts, and are therefore unable to do sampling without | ||
394 | * further work and timer assistance. | ||
395 | */ | ||
396 | if (hwc->sample_period) | ||
397 | return -EINVAL; | ||
398 | |||
399 | ret = 0; | ||
400 | switch (attr->type) { | ||
401 | case PERF_TYPE_RAW: | ||
402 | config = PFMON(0, attr->config & PFMON_MASK) | | ||
403 | PFCNT(0, !(attr->config & 0x100)); | ||
404 | break; | ||
405 | case PERF_TYPE_HW_CACHE: | ||
406 | ret = hw_perf_cache_event(attr->config, &config); | ||
407 | break; | ||
408 | case PERF_TYPE_HARDWARE: | ||
409 | if (attr->config >= ARRAY_SIZE(event_map)) | ||
410 | return -EINVAL; | ||
411 | |||
412 | config = event_map[attr->config]; | ||
413 | break; | ||
414 | } | ||
415 | |||
416 | if (config == -1) | ||
417 | return -EINVAL; | ||
418 | |||
419 | if (!attr->exclude_kernel) | ||
420 | config |= PFCEN(0, PFCEN_ENABLE_SUPV); | ||
421 | if (!attr->exclude_user) | ||
422 | config |= PFCEN(0, PFCEN_ENABLE_USER); | ||
423 | |||
424 | hwc->config |= config; | ||
425 | |||
426 | return ret; | ||
427 | } | ||
428 | |||
429 | static void bfin_pmu_enable(struct pmu *pmu) | ||
430 | { | ||
431 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
432 | struct perf_event *event; | ||
433 | struct hw_perf_event *hwc; | ||
434 | int i; | ||
435 | |||
436 | for (i = 0; i < MAX_HWEVENTS; ++i) { | ||
437 | event = cpuc->events[i]; | ||
438 | if (!event) | ||
439 | continue; | ||
440 | hwc = &event->hw; | ||
441 | bfin_pfmon_enable(hwc, hwc->idx); | ||
442 | } | ||
443 | |||
444 | bfin_pfmon_enable_all(); | ||
445 | } | ||
446 | |||
447 | static void bfin_pmu_disable(struct pmu *pmu) | ||
448 | { | ||
449 | bfin_pfmon_disable_all(); | ||
450 | } | ||
451 | |||
452 | static struct pmu pmu = { | ||
453 | .pmu_enable = bfin_pmu_enable, | ||
454 | .pmu_disable = bfin_pmu_disable, | ||
455 | .event_init = bfin_pmu_event_init, | ||
456 | .add = bfin_pmu_add, | ||
457 | .del = bfin_pmu_del, | ||
458 | .start = bfin_pmu_start, | ||
459 | .stop = bfin_pmu_stop, | ||
460 | .read = bfin_pmu_read, | ||
461 | }; | ||
462 | |||
463 | static void bfin_pmu_setup(int cpu) | ||
464 | { | ||
465 | struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu); | ||
466 | |||
467 | memset(cpuhw, 0, sizeof(struct cpu_hw_events)); | ||
468 | } | ||
469 | |||
470 | static int __cpuinit | ||
471 | bfin_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) | ||
472 | { | ||
473 | unsigned int cpu = (long)hcpu; | ||
474 | |||
475 | switch (action & ~CPU_TASKS_FROZEN) { | ||
476 | case CPU_UP_PREPARE: | ||
477 | bfin_write_PFCTL(0); | ||
478 | bfin_pmu_setup(cpu); | ||
479 | break; | ||
480 | |||
481 | default: | ||
482 | break; | ||
483 | } | ||
484 | |||
485 | return NOTIFY_OK; | ||
486 | } | ||
487 | |||
488 | static int __init bfin_pmu_init(void) | ||
489 | { | ||
490 | int ret; | ||
491 | |||
492 | ret = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW); | ||
493 | if (!ret) | ||
494 | perf_cpu_notifier(bfin_pmu_notifier); | ||
495 | |||
496 | return ret; | ||
497 | } | ||
498 | early_initcall(bfin_pmu_init); | ||
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index b407bc8ad918..6a660fa921b5 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c | |||
@@ -171,10 +171,8 @@ asmlinkage int bfin_clone(struct pt_regs *regs) | |||
171 | unsigned long newsp; | 171 | unsigned long newsp; |
172 | 172 | ||
173 | #ifdef __ARCH_SYNC_CORE_DCACHE | 173 | #ifdef __ARCH_SYNC_CORE_DCACHE |
174 | if (current->rt.nr_cpus_allowed == num_possible_cpus()) { | 174 | if (current->rt.nr_cpus_allowed == num_possible_cpus()) |
175 | current->cpus_allowed = cpumask_of_cpu(smp_processor_id()); | 175 | set_cpus_allowed_ptr(current, cpumask_of(smp_processor_id())); |
176 | current->rt.nr_cpus_allowed = 1; | ||
177 | } | ||
178 | #endif | 176 | #endif |
179 | 177 | ||
180 | /* syscall2 puts clone_flags in r0 and usp in r1 */ | 178 | /* syscall2 puts clone_flags in r0 and usp in r1 */ |
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c index 53d08dee8531..488bdc51aaa5 100644 --- a/arch/blackfin/kernel/reboot.c +++ b/arch/blackfin/kernel/reboot.c | |||
@@ -23,6 +23,9 @@ | |||
23 | __attribute__ ((__l1_text__, __noreturn__)) | 23 | __attribute__ ((__l1_text__, __noreturn__)) |
24 | static void bfin_reset(void) | 24 | static void bfin_reset(void) |
25 | { | 25 | { |
26 | if (!ANOMALY_05000353 && !ANOMALY_05000386) | ||
27 | bfrom_SoftReset((void *)(L1_SCRATCH_START + L1_SCRATCH_LENGTH - 20)); | ||
28 | |||
26 | /* Wait for completion of "system" events such as cache line | 29 | /* Wait for completion of "system" events such as cache line |
27 | * line fills so that we avoid infinite stalls later on as | 30 | * line fills so that we avoid infinite stalls later on as |
28 | * much as possible. This code is in L1, so it won't trigger | 31 | * much as possible. This code is in L1, so it won't trigger |
@@ -30,46 +33,40 @@ static void bfin_reset(void) | |||
30 | */ | 33 | */ |
31 | __builtin_bfin_ssync(); | 34 | __builtin_bfin_ssync(); |
32 | 35 | ||
33 | /* The bootrom checks to see how it was reset and will | 36 | /* Initiate System software reset. */ |
34 | * automatically perform a software reset for us when | 37 | bfin_write_SWRST(0x7); |
35 | * it starts executing after the core reset. | ||
36 | */ | ||
37 | if (ANOMALY_05000353 || ANOMALY_05000386) { | ||
38 | /* Initiate System software reset. */ | ||
39 | bfin_write_SWRST(0x7); | ||
40 | 38 | ||
41 | /* Due to the way reset is handled in the hardware, we need | 39 | /* Due to the way reset is handled in the hardware, we need |
42 | * to delay for 10 SCLKS. The only reliable way to do this is | 40 | * to delay for 10 SCLKS. The only reliable way to do this is |
43 | * to calculate the CCLK/SCLK ratio and multiply 10. For now, | 41 | * to calculate the CCLK/SCLK ratio and multiply 10. For now, |
44 | * we'll assume worse case which is a 1:15 ratio. | 42 | * we'll assume worse case which is a 1:15 ratio. |
45 | */ | 43 | */ |
46 | asm( | 44 | asm( |
47 | "LSETUP (1f, 1f) LC0 = %0\n" | 45 | "LSETUP (1f, 1f) LC0 = %0\n" |
48 | "1: nop;" | 46 | "1: nop;" |
49 | : | 47 | : |
50 | : "a" (15 * 10) | 48 | : "a" (15 * 10) |
51 | : "LC0", "LB0", "LT0" | 49 | : "LC0", "LB0", "LT0" |
52 | ); | 50 | ); |
53 | 51 | ||
54 | /* Clear System software reset */ | 52 | /* Clear System software reset */ |
55 | bfin_write_SWRST(0); | 53 | bfin_write_SWRST(0); |
56 | 54 | ||
57 | /* The BF526 ROM will crash during reset */ | 55 | /* The BF526 ROM will crash during reset */ |
58 | #if defined(__ADSPBF522__) || defined(__ADSPBF524__) || defined(__ADSPBF526__) | 56 | #if defined(__ADSPBF522__) || defined(__ADSPBF524__) || defined(__ADSPBF526__) |
59 | bfin_read_SWRST(); | 57 | bfin_read_SWRST(); |
60 | #endif | 58 | #endif |
61 | 59 | ||
62 | /* Wait for the SWRST write to complete. Cannot rely on SSYNC | 60 | /* Wait for the SWRST write to complete. Cannot rely on SSYNC |
63 | * though as the System state is all reset now. | 61 | * though as the System state is all reset now. |
64 | */ | 62 | */ |
65 | asm( | 63 | asm( |
66 | "LSETUP (1f, 1f) LC1 = %0\n" | 64 | "LSETUP (1f, 1f) LC1 = %0\n" |
67 | "1: nop;" | 65 | "1: nop;" |
68 | : | 66 | : |
69 | : "a" (15 * 1) | 67 | : "a" (15 * 1) |
70 | : "LC1", "LB1", "LT1" | 68 | : "LC1", "LB1", "LT1" |
71 | ); | 69 | ); |
72 | } | ||
73 | 70 | ||
74 | while (1) | 71 | while (1) |
75 | /* Issue core reset */ | 72 | /* Issue core reset */ |
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 805c6132c779..536bd9d7e0cf 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <asm/cpu.h> | 29 | #include <asm/cpu.h> |
30 | #include <asm/fixed_code.h> | 30 | #include <asm/fixed_code.h> |
31 | #include <asm/early_printk.h> | 31 | #include <asm/early_printk.h> |
32 | #include <asm/irq_handler.h> | ||
32 | 33 | ||
33 | u16 _bfin_swrst; | 34 | u16 _bfin_swrst; |
34 | EXPORT_SYMBOL(_bfin_swrst); | 35 | EXPORT_SYMBOL(_bfin_swrst); |
@@ -105,6 +106,8 @@ void __cpuinit bfin_setup_caches(unsigned int cpu) | |||
105 | bfin_dcache_init(dcplb_tbl[cpu]); | 106 | bfin_dcache_init(dcplb_tbl[cpu]); |
106 | #endif | 107 | #endif |
107 | 108 | ||
109 | bfin_setup_cpudata(cpu); | ||
110 | |||
108 | /* | 111 | /* |
109 | * In cache coherence emulation mode, we need to have the | 112 | * In cache coherence emulation mode, we need to have the |
110 | * D-cache enabled before running any atomic operation which | 113 | * D-cache enabled before running any atomic operation which |
@@ -163,7 +166,6 @@ void __cpuinit bfin_setup_cpudata(unsigned int cpu) | |||
163 | { | 166 | { |
164 | struct blackfin_cpudata *cpudata = &per_cpu(cpu_data, cpu); | 167 | struct blackfin_cpudata *cpudata = &per_cpu(cpu_data, cpu); |
165 | 168 | ||
166 | cpudata->idle = current; | ||
167 | cpudata->imemctl = bfin_read_IMEM_CONTROL(); | 169 | cpudata->imemctl = bfin_read_IMEM_CONTROL(); |
168 | cpudata->dmemctl = bfin_read_DMEM_CONTROL(); | 170 | cpudata->dmemctl = bfin_read_DMEM_CONTROL(); |
169 | } | 171 | } |
@@ -851,6 +853,7 @@ void __init native_machine_early_platform_add_devices(void) | |||
851 | 853 | ||
852 | void __init setup_arch(char **cmdline_p) | 854 | void __init setup_arch(char **cmdline_p) |
853 | { | 855 | { |
856 | u32 mmr; | ||
854 | unsigned long sclk, cclk; | 857 | unsigned long sclk, cclk; |
855 | 858 | ||
856 | native_machine_early_platform_add_devices(); | 859 | native_machine_early_platform_add_devices(); |
@@ -902,10 +905,10 @@ void __init setup_arch(char **cmdline_p) | |||
902 | bfin_write_EBIU_FCTL(CONFIG_EBIU_FCTLVAL); | 905 | bfin_write_EBIU_FCTL(CONFIG_EBIU_FCTLVAL); |
903 | #endif | 906 | #endif |
904 | #ifdef CONFIG_BFIN_HYSTERESIS_CONTROL | 907 | #ifdef CONFIG_BFIN_HYSTERESIS_CONTROL |
905 | bfin_write_PORTF_HYSTERISIS(HYST_PORTF_0_15); | 908 | bfin_write_PORTF_HYSTERESIS(HYST_PORTF_0_15); |
906 | bfin_write_PORTG_HYSTERISIS(HYST_PORTG_0_15); | 909 | bfin_write_PORTG_HYSTERESIS(HYST_PORTG_0_15); |
907 | bfin_write_PORTH_HYSTERISIS(HYST_PORTH_0_15); | 910 | bfin_write_PORTH_HYSTERESIS(HYST_PORTH_0_15); |
908 | bfin_write_MISCPORT_HYSTERISIS((bfin_read_MISCPORT_HYSTERISIS() & | 911 | bfin_write_MISCPORT_HYSTERESIS((bfin_read_MISCPORT_HYSTERESIS() & |
909 | ~HYST_NONEGPIO_MASK) | HYST_NONEGPIO); | 912 | ~HYST_NONEGPIO_MASK) | HYST_NONEGPIO); |
910 | #endif | 913 | #endif |
911 | 914 | ||
@@ -921,17 +924,14 @@ void __init setup_arch(char **cmdline_p) | |||
921 | bfin_read_IMDMA_D1_IRQ_STATUS(); | 924 | bfin_read_IMDMA_D1_IRQ_STATUS(); |
922 | } | 925 | } |
923 | #endif | 926 | #endif |
924 | printk(KERN_INFO "Hardware Trace "); | ||
925 | if (bfin_read_TBUFCTL() & 0x1) | ||
926 | printk(KERN_CONT "Active "); | ||
927 | else | ||
928 | printk(KERN_CONT "Off "); | ||
929 | if (bfin_read_TBUFCTL() & 0x2) | ||
930 | printk(KERN_CONT "and Enabled\n"); | ||
931 | else | ||
932 | printk(KERN_CONT "and Disabled\n"); | ||
933 | 927 | ||
934 | printk(KERN_INFO "Boot Mode: %i\n", bfin_read_SYSCR() & 0xF); | 928 | mmr = bfin_read_TBUFCTL(); |
929 | printk(KERN_INFO "Hardware Trace %s and %sabled\n", | ||
930 | (mmr & 0x1) ? "active" : "off", | ||
931 | (mmr & 0x2) ? "en" : "dis"); | ||
932 | |||
933 | mmr = bfin_read_SYSCR(); | ||
934 | printk(KERN_INFO "Boot Mode: %i\n", mmr & 0xF); | ||
935 | 935 | ||
936 | /* Newer parts mirror SWRST bits in SYSCR */ | 936 | /* Newer parts mirror SWRST bits in SYSCR */ |
937 | #if defined(CONFIG_BF53x) || defined(CONFIG_BF561) || \ | 937 | #if defined(CONFIG_BF53x) || defined(CONFIG_BF561) || \ |
@@ -939,7 +939,7 @@ void __init setup_arch(char **cmdline_p) | |||
939 | _bfin_swrst = bfin_read_SWRST(); | 939 | _bfin_swrst = bfin_read_SWRST(); |
940 | #else | 940 | #else |
941 | /* Clear boot mode field */ | 941 | /* Clear boot mode field */ |
942 | _bfin_swrst = bfin_read_SYSCR() & ~0xf; | 942 | _bfin_swrst = mmr & ~0xf; |
943 | #endif | 943 | #endif |
944 | 944 | ||
945 | #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT | 945 | #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT |
@@ -1036,8 +1036,6 @@ void __init setup_arch(char **cmdline_p) | |||
1036 | static int __init topology_init(void) | 1036 | static int __init topology_init(void) |
1037 | { | 1037 | { |
1038 | unsigned int cpu; | 1038 | unsigned int cpu; |
1039 | /* Record CPU-private information for the boot processor. */ | ||
1040 | bfin_setup_cpudata(0); | ||
1041 | 1039 | ||
1042 | for_each_possible_cpu(cpu) { | 1040 | for_each_possible_cpu(cpu) { |
1043 | register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu); | 1041 | register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu); |
@@ -1283,12 +1281,14 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1283 | dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS, | 1281 | dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS, |
1284 | BFIN_DLINES); | 1282 | BFIN_DLINES); |
1285 | #ifdef __ARCH_SYNC_CORE_DCACHE | 1283 | #ifdef __ARCH_SYNC_CORE_DCACHE |
1286 | seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", dcache_invld_count[cpu_num]); | 1284 | seq_printf(m, "dcache flushes\t: %lu\n", dcache_invld_count[cpu_num]); |
1287 | #endif | 1285 | #endif |
1288 | #ifdef __ARCH_SYNC_CORE_ICACHE | 1286 | #ifdef __ARCH_SYNC_CORE_ICACHE |
1289 | seq_printf(m, "SMP Icache Flushes\t: %lu\n\n", icache_invld_count[cpu_num]); | 1287 | seq_printf(m, "icache flushes\t: %lu\n", icache_invld_count[cpu_num]); |
1290 | #endif | 1288 | #endif |
1291 | 1289 | ||
1290 | seq_printf(m, "\n"); | ||
1291 | |||
1292 | if (cpu_num != num_possible_cpus() - 1) | 1292 | if (cpu_num != num_possible_cpus() - 1) |
1293 | return 0; | 1293 | return 0; |
1294 | 1294 | ||
@@ -1312,13 +1312,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1312 | " in data cache\n"); | 1312 | " in data cache\n"); |
1313 | } | 1313 | } |
1314 | seq_printf(m, "board name\t: %s\n", bfin_board_name); | 1314 | seq_printf(m, "board name\t: %s\n", bfin_board_name); |
1315 | seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n", | 1315 | seq_printf(m, "board memory\t: %ld kB (0x%08lx -> 0x%08lx)\n", |
1316 | physical_mem_end >> 10, (void *)0, (void *)physical_mem_end); | 1316 | physical_mem_end >> 10, 0ul, physical_mem_end); |
1317 | seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n", | 1317 | seq_printf(m, "kernel memory\t: %d kB (0x%08lx -> 0x%08lx)\n", |
1318 | ((int)memory_end - (int)_rambase) >> 10, | 1318 | ((int)memory_end - (int)_rambase) >> 10, |
1319 | (void *)_rambase, | 1319 | _rambase, memory_end); |
1320 | (void *)memory_end); | ||
1321 | seq_printf(m, "\n"); | ||
1322 | 1320 | ||
1323 | return 0; | 1321 | return 0; |
1324 | } | 1322 | } |
@@ -1326,7 +1324,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1326 | static void *c_start(struct seq_file *m, loff_t *pos) | 1324 | static void *c_start(struct seq_file *m, loff_t *pos) |
1327 | { | 1325 | { |
1328 | if (*pos == 0) | 1326 | if (*pos == 0) |
1329 | *pos = first_cpu(cpu_online_map); | 1327 | *pos = cpumask_first(cpu_online_mask); |
1330 | if (*pos >= num_online_cpus()) | 1328 | if (*pos >= num_online_cpus()) |
1331 | return NULL; | 1329 | return NULL; |
1332 | 1330 | ||
@@ -1335,7 +1333,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) | |||
1335 | 1333 | ||
1336 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | 1334 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
1337 | { | 1335 | { |
1338 | *pos = next_cpu(*pos, cpu_online_map); | 1336 | *pos = cpumask_next(*pos, cpu_online_mask); |
1339 | 1337 | ||
1340 | return c_start(m, pos); | 1338 | return c_start(m, pos); |
1341 | } | 1339 | } |
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S index 8d85c8c6f857..3ac5b66d14aa 100644 --- a/arch/blackfin/kernel/vmlinux.lds.S +++ b/arch/blackfin/kernel/vmlinux.lds.S | |||
@@ -155,14 +155,8 @@ SECTIONS | |||
155 | SECURITY_INITCALL | 155 | SECURITY_INITCALL |
156 | INIT_RAM_FS | 156 | INIT_RAM_FS |
157 | 157 | ||
158 | . = ALIGN(4); | ||
159 | ___per_cpu_load = .; | 158 | ___per_cpu_load = .; |
160 | ___per_cpu_start = .; | 159 | PERCPU_INPUT(32) |
161 | *(.data.percpu.first) | ||
162 | *(.data.percpu.page_aligned) | ||
163 | *(.data.percpu) | ||
164 | *(.data.percpu.shared_aligned) | ||
165 | ___per_cpu_end = .; | ||
166 | 160 | ||
167 | EXIT_DATA | 161 | EXIT_DATA |
168 | __einitdata = .; | 162 | __einitdata = .; |
diff --git a/arch/blackfin/mach-bf518/include/mach/anomaly.h b/arch/blackfin/mach-bf518/include/mach/anomaly.h index 24918c5f7ea1..d2f076fbbc9e 100644 --- a/arch/blackfin/mach-bf518/include/mach/anomaly.h +++ b/arch/blackfin/mach-bf518/include/mach/anomaly.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * and can be replaced with that version at any time | 5 | * and can be replaced with that version at any time |
6 | * DO NOT EDIT THIS FILE | 6 | * DO NOT EDIT THIS FILE |
7 | * | 7 | * |
8 | * Copyright 2004-2010 Analog Devices Inc. | 8 | * Copyright 2004-2011 Analog Devices Inc. |
9 | * Licensed under the ADI BSD license. | 9 | * Licensed under the ADI BSD license. |
10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd | 10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd |
11 | */ | 11 | */ |
@@ -141,6 +141,7 @@ | |||
141 | #define ANOMALY_05000364 (0) | 141 | #define ANOMALY_05000364 (0) |
142 | #define ANOMALY_05000371 (0) | 142 | #define ANOMALY_05000371 (0) |
143 | #define ANOMALY_05000380 (0) | 143 | #define ANOMALY_05000380 (0) |
144 | #define ANOMALY_05000383 (0) | ||
144 | #define ANOMALY_05000386 (0) | 145 | #define ANOMALY_05000386 (0) |
145 | #define ANOMALY_05000389 (0) | 146 | #define ANOMALY_05000389 (0) |
146 | #define ANOMALY_05000400 (0) | 147 | #define ANOMALY_05000400 (0) |
@@ -155,6 +156,7 @@ | |||
155 | #define ANOMALY_05000467 (0) | 156 | #define ANOMALY_05000467 (0) |
156 | #define ANOMALY_05000474 (0) | 157 | #define ANOMALY_05000474 (0) |
157 | #define ANOMALY_05000475 (0) | 158 | #define ANOMALY_05000475 (0) |
159 | #define ANOMALY_05000480 (0) | ||
158 | #define ANOMALY_05000485 (0) | 160 | #define ANOMALY_05000485 (0) |
159 | 161 | ||
160 | #endif | 162 | #endif |
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF512.h b/arch/blackfin/mach-bf518/include/mach/cdefBF512.h index b657d37a3402..bb79627f0929 100644 --- a/arch/blackfin/mach-bf518/include/mach/cdefBF512.h +++ b/arch/blackfin/mach-bf518/include/mach/cdefBF512.h | |||
@@ -990,18 +990,18 @@ | |||
990 | #define bfin_write_PORTG_SLEW(val) bfin_write16(PORTG_SLEW, val) | 990 | #define bfin_write_PORTG_SLEW(val) bfin_write16(PORTG_SLEW, val) |
991 | #define bfin_read_PORTH_SLEW() bfin_read16(PORTH_SLEW) | 991 | #define bfin_read_PORTH_SLEW() bfin_read16(PORTH_SLEW) |
992 | #define bfin_write_PORTH_SLEW(val) bfin_write16(PORTH_SLEW, val) | 992 | #define bfin_write_PORTH_SLEW(val) bfin_write16(PORTH_SLEW, val) |
993 | #define bfin_read_PORTF_HYSTERISIS() bfin_read16(PORTF_HYSTERISIS) | 993 | #define bfin_read_PORTF_HYSTERESIS() bfin_read16(PORTF_HYSTERESIS) |
994 | #define bfin_write_PORTF_HYSTERISIS(val) bfin_write16(PORTF_HYSTERISIS, val) | 994 | #define bfin_write_PORTF_HYSTERESIS(val) bfin_write16(PORTF_HYSTERESIS, val) |
995 | #define bfin_read_PORTG_HYSTERISIS() bfin_read16(PORTG_HYSTERISIS) | 995 | #define bfin_read_PORTG_HYSTERESIS() bfin_read16(PORTG_HYSTERESIS) |
996 | #define bfin_write_PORTG_HYSTERISIS(val) bfin_write16(PORTG_HYSTERISIS, val) | 996 | #define bfin_write_PORTG_HYSTERESIS(val) bfin_write16(PORTG_HYSTERESIS, val) |
997 | #define bfin_read_PORTH_HYSTERISIS() bfin_read16(PORTH_HYSTERISIS) | 997 | #define bfin_read_PORTH_HYSTERESIS() bfin_read16(PORTH_HYSTERESIS) |
998 | #define bfin_write_PORTH_HYSTERISIS(val) bfin_write16(PORTH_HYSTERISIS, val) | 998 | #define bfin_write_PORTH_HYSTERESIS(val) bfin_write16(PORTH_HYSTERESIS, val) |
999 | #define bfin_read_MISCPORT_DRIVE() bfin_read16(MISCPORT_DRIVE) | 999 | #define bfin_read_MISCPORT_DRIVE() bfin_read16(MISCPORT_DRIVE) |
1000 | #define bfin_write_MISCPORT_DRIVE(val) bfin_write16(MISCPORT_DRIVE, val) | 1000 | #define bfin_write_MISCPORT_DRIVE(val) bfin_write16(MISCPORT_DRIVE, val) |
1001 | #define bfin_read_MISCPORT_SLEW() bfin_read16(MISCPORT_SLEW) | 1001 | #define bfin_read_MISCPORT_SLEW() bfin_read16(MISCPORT_SLEW) |
1002 | #define bfin_write_MISCPORT_SLEW(val) bfin_write16(MISCPORT_SLEW, val) | 1002 | #define bfin_write_MISCPORT_SLEW(val) bfin_write16(MISCPORT_SLEW, val) |
1003 | #define bfin_read_MISCPORT_HYSTERISIS() bfin_read16(MISCPORT_HYSTERISIS) | 1003 | #define bfin_read_MISCPORT_HYSTERESIS() bfin_read16(MISCPORT_HYSTERESIS) |
1004 | #define bfin_write_MISCPORT_HYSTERISIS(val) bfin_write16(MISCPORT_HYSTERISIS, val) | 1004 | #define bfin_write_MISCPORT_HYSTERESIS(val) bfin_write16(MISCPORT_HYSTERESIS, val) |
1005 | 1005 | ||
1006 | /* HOST Port Registers */ | 1006 | /* HOST Port Registers */ |
1007 | 1007 | ||
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF512.h b/arch/blackfin/mach-bf518/include/mach/defBF512.h index cb1172f50757..729704078cd7 100644 --- a/arch/blackfin/mach-bf518/include/mach/defBF512.h +++ b/arch/blackfin/mach-bf518/include/mach/defBF512.h | |||
@@ -561,12 +561,12 @@ | |||
561 | #define PORTF_SLEW 0xFFC03230 /* Port F slew control */ | 561 | #define PORTF_SLEW 0xFFC03230 /* Port F slew control */ |
562 | #define PORTG_SLEW 0xFFC03234 /* Port G slew control */ | 562 | #define PORTG_SLEW 0xFFC03234 /* Port G slew control */ |
563 | #define PORTH_SLEW 0xFFC03238 /* Port H slew control */ | 563 | #define PORTH_SLEW 0xFFC03238 /* Port H slew control */ |
564 | #define PORTF_HYSTERISIS 0xFFC03240 /* Port F Schmitt trigger control */ | 564 | #define PORTF_HYSTERESIS 0xFFC03240 /* Port F Schmitt trigger control */ |
565 | #define PORTG_HYSTERISIS 0xFFC03244 /* Port G Schmitt trigger control */ | 565 | #define PORTG_HYSTERESIS 0xFFC03244 /* Port G Schmitt trigger control */ |
566 | #define PORTH_HYSTERISIS 0xFFC03248 /* Port H Schmitt trigger control */ | 566 | #define PORTH_HYSTERESIS 0xFFC03248 /* Port H Schmitt trigger control */ |
567 | #define MISCPORT_DRIVE 0xFFC03280 /* Misc Port drive strength control */ | 567 | #define MISCPORT_DRIVE 0xFFC03280 /* Misc Port drive strength control */ |
568 | #define MISCPORT_SLEW 0xFFC03284 /* Misc Port slew control */ | 568 | #define MISCPORT_SLEW 0xFFC03284 /* Misc Port slew control */ |
569 | #define MISCPORT_HYSTERISIS 0xFFC03288 /* Misc Port Schmitt trigger control */ | 569 | #define MISCPORT_HYSTERESIS 0xFFC03288 /* Misc Port Schmitt trigger control */ |
570 | 570 | ||
571 | 571 | ||
572 | /*********************************************************************************** | 572 | /*********************************************************************************** |
diff --git a/arch/blackfin/mach-bf518/include/mach/irq.h b/arch/blackfin/mach-bf518/include/mach/irq.h index 435e76e31aaa..edf8efd457dc 100644 --- a/arch/blackfin/mach-bf518/include/mach/irq.h +++ b/arch/blackfin/mach-bf518/include/mach/irq.h | |||
@@ -7,38 +7,9 @@ | |||
7 | #ifndef _BF518_IRQ_H_ | 7 | #ifndef _BF518_IRQ_H_ |
8 | #define _BF518_IRQ_H_ | 8 | #define _BF518_IRQ_H_ |
9 | 9 | ||
10 | /* | 10 | #include <mach-common/irq.h> |
11 | * Interrupt source definitions | 11 | |
12 | Event Source Core Event Name | 12 | #define NR_PERI_INTS (2 * 32) |
13 | Core Emulation ** | ||
14 | Events (highest priority) EMU 0 | ||
15 | Reset RST 1 | ||
16 | NMI NMI 2 | ||
17 | Exception EVX 3 | ||
18 | Reserved -- 4 | ||
19 | Hardware Error IVHW 5 | ||
20 | Core Timer IVTMR 6 * | ||
21 | |||
22 | ..... | ||
23 | |||
24 | Software Interrupt 1 IVG14 31 | ||
25 | Software Interrupt 2 -- | ||
26 | (lowest priority) IVG15 32 * | ||
27 | */ | ||
28 | |||
29 | #define NR_PERI_INTS (2 * 32) | ||
30 | |||
31 | /* The ABSTRACT IRQ definitions */ | ||
32 | /** the first seven of the following are fixed, the rest you change if you need to **/ | ||
33 | #define IRQ_EMU 0 /* Emulation */ | ||
34 | #define IRQ_RST 1 /* reset */ | ||
35 | #define IRQ_NMI 2 /* Non Maskable */ | ||
36 | #define IRQ_EVX 3 /* Exception */ | ||
37 | #define IRQ_UNUSED 4 /* - unused interrupt */ | ||
38 | #define IRQ_HWERR 5 /* Hardware Error */ | ||
39 | #define IRQ_CORETMR 6 /* Core timer */ | ||
40 | |||
41 | #define BFIN_IRQ(x) ((x) + 7) | ||
42 | 13 | ||
43 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ | 14 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ |
44 | #define IRQ_DMA0_ERROR BFIN_IRQ(1) /* DMA Error 0 (generic) */ | 15 | #define IRQ_DMA0_ERROR BFIN_IRQ(1) /* DMA Error 0 (generic) */ |
@@ -54,23 +25,23 @@ | |||
54 | #define IRQ_UART0_ERROR BFIN_IRQ(12) /* UART0 Status */ | 25 | #define IRQ_UART0_ERROR BFIN_IRQ(12) /* UART0 Status */ |
55 | #define IRQ_UART1_ERROR BFIN_IRQ(13) /* UART1 Status */ | 26 | #define IRQ_UART1_ERROR BFIN_IRQ(13) /* UART1 Status */ |
56 | #define IRQ_RTC BFIN_IRQ(14) /* RTC */ | 27 | #define IRQ_RTC BFIN_IRQ(14) /* RTC */ |
57 | #define IRQ_PPI BFIN_IRQ(15) /* DMA Channel 0 (PPI) */ | 28 | #define IRQ_PPI BFIN_IRQ(15) /* DMA Channel 0 (PPI) */ |
58 | #define IRQ_SPORT0_RX BFIN_IRQ(16) /* DMA 3 Channel (SPORT0 RX) */ | 29 | #define IRQ_SPORT0_RX BFIN_IRQ(16) /* DMA 3 Channel (SPORT0 RX) */ |
59 | #define IRQ_SPORT0_TX BFIN_IRQ(17) /* DMA 4 Channel (SPORT0 TX) */ | 30 | #define IRQ_SPORT0_TX BFIN_IRQ(17) /* DMA 4 Channel (SPORT0 TX) */ |
60 | #define IRQ_RSI BFIN_IRQ(17) /* DMA 4 Channel (RSI) */ | 31 | #define IRQ_RSI BFIN_IRQ(17) /* DMA 4 Channel (RSI) */ |
61 | #define IRQ_SPORT1_RX BFIN_IRQ(18) /* DMA 5 Channel (SPORT1 RX/SPI) */ | 32 | #define IRQ_SPORT1_RX BFIN_IRQ(18) /* DMA 5 Channel (SPORT1 RX/SPI) */ |
62 | #define IRQ_SPI1 BFIN_IRQ(18) /* DMA 5 Channel (SPI1) */ | 33 | #define IRQ_SPI1 BFIN_IRQ(18) /* DMA 5 Channel (SPI1) */ |
63 | #define IRQ_SPORT1_TX BFIN_IRQ(19) /* DMA 6 Channel (SPORT1 TX) */ | 34 | #define IRQ_SPORT1_TX BFIN_IRQ(19) /* DMA 6 Channel (SPORT1 TX) */ |
64 | #define IRQ_TWI BFIN_IRQ(20) /* TWI */ | 35 | #define IRQ_TWI BFIN_IRQ(20) /* TWI */ |
65 | #define IRQ_SPI0 BFIN_IRQ(21) /* DMA 7 Channel (SPI0) */ | 36 | #define IRQ_SPI0 BFIN_IRQ(21) /* DMA 7 Channel (SPI0) */ |
66 | #define IRQ_UART0_RX BFIN_IRQ(22) /* DMA8 Channel (UART0 RX) */ | 37 | #define IRQ_UART0_RX BFIN_IRQ(22) /* DMA8 Channel (UART0 RX) */ |
67 | #define IRQ_UART0_TX BFIN_IRQ(23) /* DMA9 Channel (UART0 TX) */ | 38 | #define IRQ_UART0_TX BFIN_IRQ(23) /* DMA9 Channel (UART0 TX) */ |
68 | #define IRQ_UART1_RX BFIN_IRQ(24) /* DMA10 Channel (UART1 RX) */ | 39 | #define IRQ_UART1_RX BFIN_IRQ(24) /* DMA10 Channel (UART1 RX) */ |
69 | #define IRQ_UART1_TX BFIN_IRQ(25) /* DMA11 Channel (UART1 TX) */ | 40 | #define IRQ_UART1_TX BFIN_IRQ(25) /* DMA11 Channel (UART1 TX) */ |
70 | #define IRQ_OPTSEC BFIN_IRQ(26) /* OTPSEC Interrupt */ | 41 | #define IRQ_OPTSEC BFIN_IRQ(26) /* OTPSEC Interrupt */ |
71 | #define IRQ_CNT BFIN_IRQ(27) /* GP Counter */ | 42 | #define IRQ_CNT BFIN_IRQ(27) /* GP Counter */ |
72 | #define IRQ_MAC_RX BFIN_IRQ(28) /* DMA1 Channel (MAC RX) */ | 43 | #define IRQ_MAC_RX BFIN_IRQ(28) /* DMA1 Channel (MAC RX) */ |
73 | #define IRQ_PORTH_INTA BFIN_IRQ(29) /* Port H Interrupt A */ | 44 | #define IRQ_PORTH_INTA BFIN_IRQ(29) /* Port H Interrupt A */ |
74 | #define IRQ_MAC_TX BFIN_IRQ(30) /* DMA2 Channel (MAC TX) */ | 45 | #define IRQ_MAC_TX BFIN_IRQ(30) /* DMA2 Channel (MAC TX) */ |
75 | #define IRQ_PORTH_INTB BFIN_IRQ(31) /* Port H Interrupt B */ | 46 | #define IRQ_PORTH_INTB BFIN_IRQ(31) /* Port H Interrupt B */ |
76 | #define IRQ_TIMER0 BFIN_IRQ(32) /* Timer 0 */ | 47 | #define IRQ_TIMER0 BFIN_IRQ(32) /* Timer 0 */ |
@@ -96,101 +67,90 @@ | |||
96 | #define IRQ_PWM_SYNC BFIN_IRQ(54) /* PWM Sync Interrupt */ | 67 | #define IRQ_PWM_SYNC BFIN_IRQ(54) /* PWM Sync Interrupt */ |
97 | #define IRQ_PTP_STAT BFIN_IRQ(55) /* PTP Stat Interrupt */ | 68 | #define IRQ_PTP_STAT BFIN_IRQ(55) /* PTP Stat Interrupt */ |
98 | 69 | ||
99 | #define SYS_IRQS BFIN_IRQ(63) /* 70 */ | 70 | #define SYS_IRQS BFIN_IRQ(63) /* 70 */ |
100 | 71 | ||
101 | #define IRQ_PF0 71 | 72 | #define IRQ_PF0 71 |
102 | #define IRQ_PF1 72 | 73 | #define IRQ_PF1 72 |
103 | #define IRQ_PF2 73 | 74 | #define IRQ_PF2 73 |
104 | #define IRQ_PF3 74 | 75 | #define IRQ_PF3 74 |
105 | #define IRQ_PF4 75 | 76 | #define IRQ_PF4 75 |
106 | #define IRQ_PF5 76 | 77 | #define IRQ_PF5 76 |
107 | #define IRQ_PF6 77 | 78 | #define IRQ_PF6 77 |
108 | #define IRQ_PF7 78 | 79 | #define IRQ_PF7 78 |
109 | #define IRQ_PF8 79 | 80 | #define IRQ_PF8 79 |
110 | #define IRQ_PF9 80 | 81 | #define IRQ_PF9 80 |
111 | #define IRQ_PF10 81 | 82 | #define IRQ_PF10 81 |
112 | #define IRQ_PF11 82 | 83 | #define IRQ_PF11 82 |
113 | #define IRQ_PF12 83 | 84 | #define IRQ_PF12 83 |
114 | #define IRQ_PF13 84 | 85 | #define IRQ_PF13 84 |
115 | #define IRQ_PF14 85 | 86 | #define IRQ_PF14 85 |
116 | #define IRQ_PF15 86 | 87 | #define IRQ_PF15 86 |
117 | 88 | ||
118 | #define IRQ_PG0 87 | 89 | #define IRQ_PG0 87 |
119 | #define IRQ_PG1 88 | 90 | #define IRQ_PG1 88 |
120 | #define IRQ_PG2 89 | 91 | #define IRQ_PG2 89 |
121 | #define IRQ_PG3 90 | 92 | #define IRQ_PG3 90 |
122 | #define IRQ_PG4 91 | 93 | #define IRQ_PG4 91 |
123 | #define IRQ_PG5 92 | 94 | #define IRQ_PG5 92 |
124 | #define IRQ_PG6 93 | 95 | #define IRQ_PG6 93 |
125 | #define IRQ_PG7 94 | 96 | #define IRQ_PG7 94 |
126 | #define IRQ_PG8 95 | 97 | #define IRQ_PG8 95 |
127 | #define IRQ_PG9 96 | 98 | #define IRQ_PG9 96 |
128 | #define IRQ_PG10 97 | 99 | #define IRQ_PG10 97 |
129 | #define IRQ_PG11 98 | 100 | #define IRQ_PG11 98 |
130 | #define IRQ_PG12 99 | 101 | #define IRQ_PG12 99 |
131 | #define IRQ_PG13 100 | 102 | #define IRQ_PG13 100 |
132 | #define IRQ_PG14 101 | 103 | #define IRQ_PG14 101 |
133 | #define IRQ_PG15 102 | 104 | #define IRQ_PG15 102 |
134 | 105 | ||
135 | #define IRQ_PH0 103 | 106 | #define IRQ_PH0 103 |
136 | #define IRQ_PH1 104 | 107 | #define IRQ_PH1 104 |
137 | #define IRQ_PH2 105 | 108 | #define IRQ_PH2 105 |
138 | #define IRQ_PH3 106 | 109 | #define IRQ_PH3 106 |
139 | #define IRQ_PH4 107 | 110 | #define IRQ_PH4 107 |
140 | #define IRQ_PH5 108 | 111 | #define IRQ_PH5 108 |
141 | #define IRQ_PH6 109 | 112 | #define IRQ_PH6 109 |
142 | #define IRQ_PH7 110 | 113 | #define IRQ_PH7 110 |
143 | #define IRQ_PH8 111 | 114 | #define IRQ_PH8 111 |
144 | #define IRQ_PH9 112 | 115 | #define IRQ_PH9 112 |
145 | #define IRQ_PH10 113 | 116 | #define IRQ_PH10 113 |
146 | #define IRQ_PH11 114 | 117 | #define IRQ_PH11 114 |
147 | #define IRQ_PH12 115 | 118 | #define IRQ_PH12 115 |
148 | #define IRQ_PH13 116 | 119 | #define IRQ_PH13 116 |
149 | #define IRQ_PH14 117 | 120 | #define IRQ_PH14 117 |
150 | #define IRQ_PH15 118 | 121 | #define IRQ_PH15 118 |
151 | 122 | ||
152 | #define GPIO_IRQ_BASE IRQ_PF0 | 123 | #define GPIO_IRQ_BASE IRQ_PF0 |
153 | 124 | ||
154 | #define IRQ_MAC_PHYINT 119 /* PHY_INT Interrupt */ | 125 | #define IRQ_MAC_PHYINT 119 /* PHY_INT Interrupt */ |
155 | #define IRQ_MAC_MMCINT 120 /* MMC Counter Interrupt */ | 126 | #define IRQ_MAC_MMCINT 120 /* MMC Counter Interrupt */ |
156 | #define IRQ_MAC_RXFSINT 121 /* RX Frame-Status Interrupt */ | 127 | #define IRQ_MAC_RXFSINT 121 /* RX Frame-Status Interrupt */ |
157 | #define IRQ_MAC_TXFSINT 122 /* TX Frame-Status Interrupt */ | 128 | #define IRQ_MAC_TXFSINT 122 /* TX Frame-Status Interrupt */ |
158 | #define IRQ_MAC_WAKEDET 123 /* Wake-Up Interrupt */ | 129 | #define IRQ_MAC_WAKEDET 123 /* Wake-Up Interrupt */ |
159 | #define IRQ_MAC_RXDMAERR 124 /* RX DMA Direction Error Interrupt */ | 130 | #define IRQ_MAC_RXDMAERR 124 /* RX DMA Direction Error Interrupt */ |
160 | #define IRQ_MAC_TXDMAERR 125 /* TX DMA Direction Error Interrupt */ | 131 | #define IRQ_MAC_TXDMAERR 125 /* TX DMA Direction Error Interrupt */ |
161 | #define IRQ_MAC_STMDONE 126 /* Station Mgt. Transfer Done Interrupt */ | 132 | #define IRQ_MAC_STMDONE 126 /* Station Mgt. Transfer Done Interrupt */ |
162 | 133 | ||
163 | #define NR_MACH_IRQS (IRQ_MAC_STMDONE + 1) | 134 | #define NR_MACH_IRQS (IRQ_MAC_STMDONE + 1) |
164 | #define NR_IRQS (NR_MACH_IRQS + NR_SPARE_IRQS) | ||
165 | |||
166 | #define IVG7 7 | ||
167 | #define IVG8 8 | ||
168 | #define IVG9 9 | ||
169 | #define IVG10 10 | ||
170 | #define IVG11 11 | ||
171 | #define IVG12 12 | ||
172 | #define IVG13 13 | ||
173 | #define IVG14 14 | ||
174 | #define IVG15 15 | ||
175 | 135 | ||
176 | /* IAR0 BIT FIELDS */ | 136 | /* IAR0 BIT FIELDS */ |
177 | #define IRQ_PLL_WAKEUP_POS 0 | 137 | #define IRQ_PLL_WAKEUP_POS 0 |
178 | #define IRQ_DMA0_ERROR_POS 4 | 138 | #define IRQ_DMA0_ERROR_POS 4 |
179 | #define IRQ_DMAR0_BLK_POS 8 | 139 | #define IRQ_DMAR0_BLK_POS 8 |
180 | #define IRQ_DMAR1_BLK_POS 12 | 140 | #define IRQ_DMAR1_BLK_POS 12 |
181 | #define IRQ_DMAR0_OVR_POS 16 | 141 | #define IRQ_DMAR0_OVR_POS 16 |
182 | #define IRQ_DMAR1_OVR_POS 20 | 142 | #define IRQ_DMAR1_OVR_POS 20 |
183 | #define IRQ_PPI_ERROR_POS 24 | 143 | #define IRQ_PPI_ERROR_POS 24 |
184 | #define IRQ_MAC_ERROR_POS 28 | 144 | #define IRQ_MAC_ERROR_POS 28 |
185 | 145 | ||
186 | /* IAR1 BIT FIELDS */ | 146 | /* IAR1 BIT FIELDS */ |
187 | #define IRQ_SPORT0_ERROR_POS 0 | 147 | #define IRQ_SPORT0_ERROR_POS 0 |
188 | #define IRQ_SPORT1_ERROR_POS 4 | 148 | #define IRQ_SPORT1_ERROR_POS 4 |
189 | #define IRQ_PTP_ERROR_POS 8 | 149 | #define IRQ_PTP_ERROR_POS 8 |
190 | #define IRQ_UART0_ERROR_POS 16 | 150 | #define IRQ_UART0_ERROR_POS 16 |
191 | #define IRQ_UART1_ERROR_POS 20 | 151 | #define IRQ_UART1_ERROR_POS 20 |
192 | #define IRQ_RTC_POS 24 | 152 | #define IRQ_RTC_POS 24 |
193 | #define IRQ_PPI_POS 28 | 153 | #define IRQ_PPI_POS 28 |
194 | 154 | ||
195 | /* IAR2 BIT FIELDS */ | 155 | /* IAR2 BIT FIELDS */ |
196 | #define IRQ_SPORT0_RX_POS 0 | 156 | #define IRQ_SPORT0_RX_POS 0 |
@@ -199,19 +159,19 @@ | |||
199 | #define IRQ_SPORT1_RX_POS 8 | 159 | #define IRQ_SPORT1_RX_POS 8 |
200 | #define IRQ_SPI1_POS 8 | 160 | #define IRQ_SPI1_POS 8 |
201 | #define IRQ_SPORT1_TX_POS 12 | 161 | #define IRQ_SPORT1_TX_POS 12 |
202 | #define IRQ_TWI_POS 16 | 162 | #define IRQ_TWI_POS 16 |
203 | #define IRQ_SPI0_POS 20 | 163 | #define IRQ_SPI0_POS 20 |
204 | #define IRQ_UART0_RX_POS 24 | 164 | #define IRQ_UART0_RX_POS 24 |
205 | #define IRQ_UART0_TX_POS 28 | 165 | #define IRQ_UART0_TX_POS 28 |
206 | 166 | ||
207 | /* IAR3 BIT FIELDS */ | 167 | /* IAR3 BIT FIELDS */ |
208 | #define IRQ_UART1_RX_POS 0 | 168 | #define IRQ_UART1_RX_POS 0 |
209 | #define IRQ_UART1_TX_POS 4 | 169 | #define IRQ_UART1_TX_POS 4 |
210 | #define IRQ_OPTSEC_POS 8 | 170 | #define IRQ_OPTSEC_POS 8 |
211 | #define IRQ_CNT_POS 12 | 171 | #define IRQ_CNT_POS 12 |
212 | #define IRQ_MAC_RX_POS 16 | 172 | #define IRQ_MAC_RX_POS 16 |
213 | #define IRQ_PORTH_INTA_POS 20 | 173 | #define IRQ_PORTH_INTA_POS 20 |
214 | #define IRQ_MAC_TX_POS 24 | 174 | #define IRQ_MAC_TX_POS 24 |
215 | #define IRQ_PORTH_INTB_POS 28 | 175 | #define IRQ_PORTH_INTB_POS 28 |
216 | 176 | ||
217 | /* IAR4 BIT FIELDS */ | 177 | /* IAR4 BIT FIELDS */ |
@@ -227,19 +187,19 @@ | |||
227 | /* IAR5 BIT FIELDS */ | 187 | /* IAR5 BIT FIELDS */ |
228 | #define IRQ_PORTG_INTA_POS 0 | 188 | #define IRQ_PORTG_INTA_POS 0 |
229 | #define IRQ_PORTG_INTB_POS 4 | 189 | #define IRQ_PORTG_INTB_POS 4 |
230 | #define IRQ_MEM_DMA0_POS 8 | 190 | #define IRQ_MEM_DMA0_POS 8 |
231 | #define IRQ_MEM_DMA1_POS 12 | 191 | #define IRQ_MEM_DMA1_POS 12 |
232 | #define IRQ_WATCH_POS 16 | 192 | #define IRQ_WATCH_POS 16 |
233 | #define IRQ_PORTF_INTA_POS 20 | 193 | #define IRQ_PORTF_INTA_POS 20 |
234 | #define IRQ_PORTF_INTB_POS 24 | 194 | #define IRQ_PORTF_INTB_POS 24 |
235 | #define IRQ_SPI0_ERROR_POS 28 | 195 | #define IRQ_SPI0_ERROR_POS 28 |
236 | 196 | ||
237 | /* IAR6 BIT FIELDS */ | 197 | /* IAR6 BIT FIELDS */ |
238 | #define IRQ_SPI1_ERROR_POS 0 | 198 | #define IRQ_SPI1_ERROR_POS 0 |
239 | #define IRQ_RSI_INT0_POS 12 | 199 | #define IRQ_RSI_INT0_POS 12 |
240 | #define IRQ_RSI_INT1_POS 16 | 200 | #define IRQ_RSI_INT1_POS 16 |
241 | #define IRQ_PWM_TRIP_POS 20 | 201 | #define IRQ_PWM_TRIP_POS 20 |
242 | #define IRQ_PWM_SYNC_POS 24 | 202 | #define IRQ_PWM_SYNC_POS 24 |
243 | #define IRQ_PTP_STAT_POS 28 | 203 | #define IRQ_PTP_STAT_POS 28 |
244 | 204 | ||
245 | #endif /* _BF518_IRQ_H_ */ | 205 | #endif |
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c index 2cd2ff6f3043..e67ac7720668 100644 --- a/arch/blackfin/mach-bf527/boards/ezkit.c +++ b/arch/blackfin/mach-bf527/boards/ezkit.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/portmux.h> | 26 | #include <asm/portmux.h> |
27 | #include <asm/dpmc.h> | 27 | #include <asm/dpmc.h> |
28 | #include <linux/spi/ad7877.h> | 28 | #include <linux/spi/ad7877.h> |
29 | #include <asm/bfin_sport.h> | ||
29 | 30 | ||
30 | /* | 31 | /* |
31 | * Name the Board for the /proc/cpuinfo | 32 | * Name the Board for the /proc/cpuinfo |
@@ -526,11 +527,69 @@ static struct bfin5xx_spi_chip spidev_chip_info = { | |||
526 | }; | 527 | }; |
527 | #endif | 528 | #endif |
528 | 529 | ||
530 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ | ||
531 | defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) | ||
532 | |||
533 | static const u16 bfin_snd_pin[][7] = { | ||
534 | {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, | ||
535 | P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0, 0}, | ||
536 | {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, | ||
537 | P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_TFS, 0}, | ||
538 | }; | ||
539 | |||
540 | static struct bfin_snd_platform_data bfin_snd_data[] = { | ||
541 | { | ||
542 | .pin_req = &bfin_snd_pin[0][0], | ||
543 | }, | ||
544 | { | ||
545 | .pin_req = &bfin_snd_pin[1][0], | ||
546 | }, | ||
547 | }; | ||
548 | |||
549 | #define BFIN_SND_RES(x) \ | ||
550 | [x] = { \ | ||
551 | { \ | ||
552 | .start = SPORT##x##_TCR1, \ | ||
553 | .end = SPORT##x##_TCR1, \ | ||
554 | .flags = IORESOURCE_MEM \ | ||
555 | }, \ | ||
556 | { \ | ||
557 | .start = CH_SPORT##x##_RX, \ | ||
558 | .end = CH_SPORT##x##_RX, \ | ||
559 | .flags = IORESOURCE_DMA, \ | ||
560 | }, \ | ||
561 | { \ | ||
562 | .start = CH_SPORT##x##_TX, \ | ||
563 | .end = CH_SPORT##x##_TX, \ | ||
564 | .flags = IORESOURCE_DMA, \ | ||
565 | }, \ | ||
566 | { \ | ||
567 | .start = IRQ_SPORT##x##_ERROR, \ | ||
568 | .end = IRQ_SPORT##x##_ERROR, \ | ||
569 | .flags = IORESOURCE_IRQ, \ | ||
570 | } \ | ||
571 | } | ||
572 | |||
573 | static struct resource bfin_snd_resources[][4] = { | ||
574 | BFIN_SND_RES(0), | ||
575 | BFIN_SND_RES(1), | ||
576 | }; | ||
577 | |||
578 | static struct platform_device bfin_pcm = { | ||
579 | .name = "bfin-pcm-audio", | ||
580 | .id = -1, | ||
581 | }; | ||
582 | #endif | ||
583 | |||
529 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) | 584 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) |
530 | static struct platform_device bfin_i2s = { | 585 | static struct platform_device bfin_i2s = { |
531 | .name = "bfin-i2s", | 586 | .name = "bfin-i2s", |
532 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | 587 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
533 | /* TODO: add platform data here */ | 588 | .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]), |
589 | .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM], | ||
590 | .dev = { | ||
591 | .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM], | ||
592 | }, | ||
534 | }; | 593 | }; |
535 | #endif | 594 | #endif |
536 | 595 | ||
@@ -538,7 +597,11 @@ static struct platform_device bfin_i2s = { | |||
538 | static struct platform_device bfin_tdm = { | 597 | static struct platform_device bfin_tdm = { |
539 | .name = "bfin-tdm", | 598 | .name = "bfin-tdm", |
540 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | 599 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
541 | /* TODO: add platform data here */ | 600 | .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]), |
601 | .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM], | ||
602 | .dev = { | ||
603 | .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM], | ||
604 | }, | ||
542 | }; | 605 | }; |
543 | #endif | 606 | #endif |
544 | 607 | ||
@@ -583,7 +646,9 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = { | |||
583 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ | 646 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
584 | .bus_num = 0, | 647 | .bus_num = 0, |
585 | .chip_select = 4, | 648 | .chip_select = 4, |
649 | .platform_data = "ad1836", | ||
586 | .controller_data = &ad1836_spi_chip_info, | 650 | .controller_data = &ad1836_spi_chip_info, |
651 | .mode = SPI_MODE_3, | ||
587 | }, | 652 | }, |
588 | #endif | 653 | #endif |
589 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) | 654 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) |
@@ -1211,6 +1276,11 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
1211 | &ezkit_flash_device, | 1276 | &ezkit_flash_device, |
1212 | #endif | 1277 | #endif |
1213 | 1278 | ||
1279 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ | ||
1280 | defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) | ||
1281 | &bfin_pcm, | ||
1282 | #endif | ||
1283 | |||
1214 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) | 1284 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) |
1215 | &bfin_i2s, | 1285 | &bfin_i2s, |
1216 | #endif | 1286 | #endif |
diff --git a/arch/blackfin/mach-bf527/include/mach/anomaly.h b/arch/blackfin/mach-bf527/include/mach/anomaly.h index 9358afa05c90..e66a7e89cd3c 100644 --- a/arch/blackfin/mach-bf527/include/mach/anomaly.h +++ b/arch/blackfin/mach-bf527/include/mach/anomaly.h | |||
@@ -5,14 +5,14 @@ | |||
5 | * and can be replaced with that version at any time | 5 | * and can be replaced with that version at any time |
6 | * DO NOT EDIT THIS FILE | 6 | * DO NOT EDIT THIS FILE |
7 | * | 7 | * |
8 | * Copyright 2004-2010 Analog Devices Inc. | 8 | * Copyright 2004-2011 Analog Devices Inc. |
9 | * Licensed under the ADI BSD license. | 9 | * Licensed under the ADI BSD license. |
10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd | 10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* This file should be up to date with: | 13 | /* This file should be up to date with: |
14 | * - Revision E, 03/15/2010; ADSP-BF526 Blackfin Processor Anomaly List | 14 | * - Revision E, 03/15/2010; ADSP-BF526 Blackfin Processor Anomaly List |
15 | * - Revision G, 08/25/2009; ADSP-BF527 Blackfin Processor Anomaly List | 15 | * - Revision H, 04/29/2010; ADSP-BF527 Blackfin Processor Anomaly List |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #ifndef _MACH_ANOMALY_H_ | 18 | #ifndef _MACH_ANOMALY_H_ |
@@ -220,6 +220,8 @@ | |||
220 | #define ANOMALY_05000483 (1) | 220 | #define ANOMALY_05000483 (1) |
221 | /* PLL_CTL Change Using bfrom_SysControl() Can Result in Processor Overclocking */ | 221 | /* PLL_CTL Change Using bfrom_SysControl() Can Result in Processor Overclocking */ |
222 | #define ANOMALY_05000485 (_ANOMALY_BF526_BF527(< 2, < 3)) | 222 | #define ANOMALY_05000485 (_ANOMALY_BF526_BF527(< 2, < 3)) |
223 | /* The CODEC Zero-Cross Detect Feature is not Functional */ | ||
224 | #define ANOMALY_05000487 (1) | ||
223 | /* IFLUSH sucks at life */ | 225 | /* IFLUSH sucks at life */ |
224 | #define ANOMALY_05000491 (1) | 226 | #define ANOMALY_05000491 (1) |
225 | 227 | ||
@@ -268,11 +270,13 @@ | |||
268 | #define ANOMALY_05000323 (0) | 270 | #define ANOMALY_05000323 (0) |
269 | #define ANOMALY_05000362 (1) | 271 | #define ANOMALY_05000362 (1) |
270 | #define ANOMALY_05000363 (0) | 272 | #define ANOMALY_05000363 (0) |
273 | #define ANOMALY_05000383 (0) | ||
271 | #define ANOMALY_05000400 (0) | 274 | #define ANOMALY_05000400 (0) |
272 | #define ANOMALY_05000402 (0) | 275 | #define ANOMALY_05000402 (0) |
273 | #define ANOMALY_05000412 (0) | 276 | #define ANOMALY_05000412 (0) |
274 | #define ANOMALY_05000447 (0) | 277 | #define ANOMALY_05000447 (0) |
275 | #define ANOMALY_05000448 (0) | 278 | #define ANOMALY_05000448 (0) |
276 | #define ANOMALY_05000474 (0) | 279 | #define ANOMALY_05000474 (0) |
280 | #define ANOMALY_05000480 (0) | ||
277 | 281 | ||
278 | #endif | 282 | #endif |
diff --git a/arch/blackfin/mach-bf527/include/mach/cdefBF522.h b/arch/blackfin/mach-bf527/include/mach/cdefBF522.h index 618dfcdfa91a..2c12e879aa4e 100644 --- a/arch/blackfin/mach-bf527/include/mach/cdefBF522.h +++ b/arch/blackfin/mach-bf527/include/mach/cdefBF522.h | |||
@@ -1007,18 +1007,18 @@ | |||
1007 | #define bfin_write_PORTG_SLEW(val) bfin_write16(PORTG_SLEW, val) | 1007 | #define bfin_write_PORTG_SLEW(val) bfin_write16(PORTG_SLEW, val) |
1008 | #define bfin_read_PORTH_SLEW() bfin_read16(PORTH_SLEW) | 1008 | #define bfin_read_PORTH_SLEW() bfin_read16(PORTH_SLEW) |
1009 | #define bfin_write_PORTH_SLEW(val) bfin_write16(PORTH_SLEW, val) | 1009 | #define bfin_write_PORTH_SLEW(val) bfin_write16(PORTH_SLEW, val) |
1010 | #define bfin_read_PORTF_HYSTERISIS() bfin_read16(PORTF_HYSTERISIS) | 1010 | #define bfin_read_PORTF_HYSTERESIS() bfin_read16(PORTF_HYSTERESIS) |
1011 | #define bfin_write_PORTF_HYSTERISIS(val) bfin_write16(PORTF_HYSTERISIS, val) | 1011 | #define bfin_write_PORTF_HYSTERESIS(val) bfin_write16(PORTF_HYSTERESIS, val) |
1012 | #define bfin_read_PORTG_HYSTERISIS() bfin_read16(PORTG_HYSTERISIS) | 1012 | #define bfin_read_PORTG_HYSTERESIS() bfin_read16(PORTG_HYSTERESIS) |
1013 | #define bfin_write_PORTG_HYSTERISIS(val) bfin_write16(PORTG_HYSTERISIS, val) | 1013 | #define bfin_write_PORTG_HYSTERESIS(val) bfin_write16(PORTG_HYSTERESIS, val) |
1014 | #define bfin_read_PORTH_HYSTERISIS() bfin_read16(PORTH_HYSTERISIS) | 1014 | #define bfin_read_PORTH_HYSTERESIS() bfin_read16(PORTH_HYSTERESIS) |
1015 | #define bfin_write_PORTH_HYSTERISIS(val) bfin_write16(PORTH_HYSTERISIS, val) | 1015 | #define bfin_write_PORTH_HYSTERESIS(val) bfin_write16(PORTH_HYSTERESIS, val) |
1016 | #define bfin_read_MISCPORT_DRIVE() bfin_read16(MISCPORT_DRIVE) | 1016 | #define bfin_read_MISCPORT_DRIVE() bfin_read16(MISCPORT_DRIVE) |
1017 | #define bfin_write_MISCPORT_DRIVE(val) bfin_write16(MISCPORT_DRIVE, val) | 1017 | #define bfin_write_MISCPORT_DRIVE(val) bfin_write16(MISCPORT_DRIVE, val) |
1018 | #define bfin_read_MISCPORT_SLEW() bfin_read16(MISCPORT_SLEW) | 1018 | #define bfin_read_MISCPORT_SLEW() bfin_read16(MISCPORT_SLEW) |
1019 | #define bfin_write_MISCPORT_SLEW(val) bfin_write16(MISCPORT_SLEW, val) | 1019 | #define bfin_write_MISCPORT_SLEW(val) bfin_write16(MISCPORT_SLEW, val) |
1020 | #define bfin_read_MISCPORT_HYSTERISIS() bfin_read16(MISCPORT_HYSTERISIS) | 1020 | #define bfin_read_MISCPORT_HYSTERESIS() bfin_read16(MISCPORT_HYSTERESIS) |
1021 | #define bfin_write_MISCPORT_HYSTERISIS(val) bfin_write16(MISCPORT_HYSTERISIS, val) | 1021 | #define bfin_write_MISCPORT_HYSTERESIS(val) bfin_write16(MISCPORT_HYSTERESIS, val) |
1022 | 1022 | ||
1023 | /* HOST Port Registers */ | 1023 | /* HOST Port Registers */ |
1024 | 1024 | ||
diff --git a/arch/blackfin/mach-bf527/include/mach/defBF522.h b/arch/blackfin/mach-bf527/include/mach/defBF522.h index 84ef11e52644..37d353a19722 100644 --- a/arch/blackfin/mach-bf527/include/mach/defBF522.h +++ b/arch/blackfin/mach-bf527/include/mach/defBF522.h | |||
@@ -562,12 +562,12 @@ | |||
562 | #define PORTF_SLEW 0xFFC03230 /* Port F slew control */ | 562 | #define PORTF_SLEW 0xFFC03230 /* Port F slew control */ |
563 | #define PORTG_SLEW 0xFFC03234 /* Port G slew control */ | 563 | #define PORTG_SLEW 0xFFC03234 /* Port G slew control */ |
564 | #define PORTH_SLEW 0xFFC03238 /* Port H slew control */ | 564 | #define PORTH_SLEW 0xFFC03238 /* Port H slew control */ |
565 | #define PORTF_HYSTERISIS 0xFFC03240 /* Port F Schmitt trigger control */ | 565 | #define PORTF_HYSTERESIS 0xFFC03240 /* Port F Schmitt trigger control */ |
566 | #define PORTG_HYSTERISIS 0xFFC03244 /* Port G Schmitt trigger control */ | 566 | #define PORTG_HYSTERESIS 0xFFC03244 /* Port G Schmitt trigger control */ |
567 | #define PORTH_HYSTERISIS 0xFFC03248 /* Port H Schmitt trigger control */ | 567 | #define PORTH_HYSTERESIS 0xFFC03248 /* Port H Schmitt trigger control */ |
568 | #define MISCPORT_DRIVE 0xFFC03280 /* Misc Port drive strength control */ | 568 | #define MISCPORT_DRIVE 0xFFC03280 /* Misc Port drive strength control */ |
569 | #define MISCPORT_SLEW 0xFFC03284 /* Misc Port slew control */ | 569 | #define MISCPORT_SLEW 0xFFC03284 /* Misc Port slew control */ |
570 | #define MISCPORT_HYSTERISIS 0xFFC03288 /* Misc Port Schmitt trigger control */ | 570 | #define MISCPORT_HYSTERESIS 0xFFC03288 /* Misc Port Schmitt trigger control */ |
571 | 571 | ||
572 | 572 | ||
573 | /*********************************************************************************** | 573 | /*********************************************************************************** |
diff --git a/arch/blackfin/mach-bf527/include/mach/irq.h b/arch/blackfin/mach-bf527/include/mach/irq.h index 704d9253e41d..ed7310ff819b 100644 --- a/arch/blackfin/mach-bf527/include/mach/irq.h +++ b/arch/blackfin/mach-bf527/include/mach/irq.h | |||
@@ -7,38 +7,9 @@ | |||
7 | #ifndef _BF527_IRQ_H_ | 7 | #ifndef _BF527_IRQ_H_ |
8 | #define _BF527_IRQ_H_ | 8 | #define _BF527_IRQ_H_ |
9 | 9 | ||
10 | /* | 10 | #include <mach-common/irq.h> |
11 | * Interrupt source definitions | 11 | |
12 | Event Source Core Event Name | 12 | #define NR_PERI_INTS (2 * 32) |
13 | Core Emulation ** | ||
14 | Events (highest priority) EMU 0 | ||
15 | Reset RST 1 | ||
16 | NMI NMI 2 | ||
17 | Exception EVX 3 | ||
18 | Reserved -- 4 | ||
19 | Hardware Error IVHW 5 | ||
20 | Core Timer IVTMR 6 * | ||
21 | |||
22 | ..... | ||
23 | |||
24 | Software Interrupt 1 IVG14 31 | ||
25 | Software Interrupt 2 -- | ||
26 | (lowest priority) IVG15 32 * | ||
27 | */ | ||
28 | |||
29 | #define NR_PERI_INTS (2 * 32) | ||
30 | |||
31 | /* The ABSTRACT IRQ definitions */ | ||
32 | /** the first seven of the following are fixed, the rest you change if you need to **/ | ||
33 | #define IRQ_EMU 0 /* Emulation */ | ||
34 | #define IRQ_RST 1 /* reset */ | ||
35 | #define IRQ_NMI 2 /* Non Maskable */ | ||
36 | #define IRQ_EVX 3 /* Exception */ | ||
37 | #define IRQ_UNUSED 4 /* - unused interrupt */ | ||
38 | #define IRQ_HWERR 5 /* Hardware Error */ | ||
39 | #define IRQ_CORETMR 6 /* Core timer */ | ||
40 | |||
41 | #define BFIN_IRQ(x) ((x) + 7) | ||
42 | 13 | ||
43 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ | 14 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ |
44 | #define IRQ_DMA0_ERROR BFIN_IRQ(1) /* DMA Error 0 (generic) */ | 15 | #define IRQ_DMA0_ERROR BFIN_IRQ(1) /* DMA Error 0 (generic) */ |
@@ -53,21 +24,21 @@ | |||
53 | #define IRQ_UART0_ERROR BFIN_IRQ(12) /* UART0 Status */ | 24 | #define IRQ_UART0_ERROR BFIN_IRQ(12) /* UART0 Status */ |
54 | #define IRQ_UART1_ERROR BFIN_IRQ(13) /* UART1 Status */ | 25 | #define IRQ_UART1_ERROR BFIN_IRQ(13) /* UART1 Status */ |
55 | #define IRQ_RTC BFIN_IRQ(14) /* RTC */ | 26 | #define IRQ_RTC BFIN_IRQ(14) /* RTC */ |
56 | #define IRQ_PPI BFIN_IRQ(15) /* DMA Channel 0 (PPI/NAND) */ | 27 | #define IRQ_PPI BFIN_IRQ(15) /* DMA Channel 0 (PPI/NAND) */ |
57 | #define IRQ_SPORT0_RX BFIN_IRQ(16) /* DMA 3 Channel (SPORT0 RX) */ | 28 | #define IRQ_SPORT0_RX BFIN_IRQ(16) /* DMA 3 Channel (SPORT0 RX) */ |
58 | #define IRQ_SPORT0_TX BFIN_IRQ(17) /* DMA 4 Channel (SPORT0 TX) */ | 29 | #define IRQ_SPORT0_TX BFIN_IRQ(17) /* DMA 4 Channel (SPORT0 TX) */ |
59 | #define IRQ_SPORT1_RX BFIN_IRQ(18) /* DMA 5 Channel (SPORT1 RX) */ | 30 | #define IRQ_SPORT1_RX BFIN_IRQ(18) /* DMA 5 Channel (SPORT1 RX) */ |
60 | #define IRQ_SPORT1_TX BFIN_IRQ(19) /* DMA 6 Channel (SPORT1 TX) */ | 31 | #define IRQ_SPORT1_TX BFIN_IRQ(19) /* DMA 6 Channel (SPORT1 TX) */ |
61 | #define IRQ_TWI BFIN_IRQ(20) /* TWI */ | 32 | #define IRQ_TWI BFIN_IRQ(20) /* TWI */ |
62 | #define IRQ_SPI BFIN_IRQ(21) /* DMA 7 Channel (SPI) */ | 33 | #define IRQ_SPI BFIN_IRQ(21) /* DMA 7 Channel (SPI) */ |
63 | #define IRQ_UART0_RX BFIN_IRQ(22) /* DMA8 Channel (UART0 RX) */ | 34 | #define IRQ_UART0_RX BFIN_IRQ(22) /* DMA8 Channel (UART0 RX) */ |
64 | #define IRQ_UART0_TX BFIN_IRQ(23) /* DMA9 Channel (UART0 TX) */ | 35 | #define IRQ_UART0_TX BFIN_IRQ(23) /* DMA9 Channel (UART0 TX) */ |
65 | #define IRQ_UART1_RX BFIN_IRQ(24) /* DMA10 Channel (UART1 RX) */ | 36 | #define IRQ_UART1_RX BFIN_IRQ(24) /* DMA10 Channel (UART1 RX) */ |
66 | #define IRQ_UART1_TX BFIN_IRQ(25) /* DMA11 Channel (UART1 TX) */ | 37 | #define IRQ_UART1_TX BFIN_IRQ(25) /* DMA11 Channel (UART1 TX) */ |
67 | #define IRQ_OPTSEC BFIN_IRQ(26) /* OTPSEC Interrupt */ | 38 | #define IRQ_OPTSEC BFIN_IRQ(26) /* OTPSEC Interrupt */ |
68 | #define IRQ_CNT BFIN_IRQ(27) /* GP Counter */ | 39 | #define IRQ_CNT BFIN_IRQ(27) /* GP Counter */ |
69 | #define IRQ_MAC_RX BFIN_IRQ(28) /* DMA1 Channel (MAC RX/HDMA) */ | 40 | #define IRQ_MAC_RX BFIN_IRQ(28) /* DMA1 Channel (MAC RX/HDMA) */ |
70 | #define IRQ_PORTH_INTA BFIN_IRQ(29) /* Port H Interrupt A */ | 41 | #define IRQ_PORTH_INTA BFIN_IRQ(29) /* Port H Interrupt A */ |
71 | #define IRQ_MAC_TX BFIN_IRQ(30) /* DMA2 Channel (MAC TX/NAND) */ | 42 | #define IRQ_MAC_TX BFIN_IRQ(30) /* DMA2 Channel (MAC TX/NAND) */ |
72 | #define IRQ_NFC BFIN_IRQ(30) /* DMA2 Channel (MAC TX/NAND) */ | 43 | #define IRQ_NFC BFIN_IRQ(30) /* DMA2 Channel (MAC TX/NAND) */ |
73 | #define IRQ_PORTH_INTB BFIN_IRQ(31) /* Port H Interrupt B */ | 44 | #define IRQ_PORTH_INTB BFIN_IRQ(31) /* Port H Interrupt B */ |
@@ -96,119 +67,108 @@ | |||
96 | #define IRQ_USB_INT2 BFIN_IRQ(54) /* USB_INT2 Interrupt */ | 67 | #define IRQ_USB_INT2 BFIN_IRQ(54) /* USB_INT2 Interrupt */ |
97 | #define IRQ_USB_DMA BFIN_IRQ(55) /* USB_DMAINT Interrupt */ | 68 | #define IRQ_USB_DMA BFIN_IRQ(55) /* USB_DMAINT Interrupt */ |
98 | 69 | ||
99 | #define SYS_IRQS BFIN_IRQ(63) /* 70 */ | 70 | #define SYS_IRQS BFIN_IRQ(63) /* 70 */ |
100 | 71 | ||
101 | #define IRQ_PF0 71 | 72 | #define IRQ_PF0 71 |
102 | #define IRQ_PF1 72 | 73 | #define IRQ_PF1 72 |
103 | #define IRQ_PF2 73 | 74 | #define IRQ_PF2 73 |
104 | #define IRQ_PF3 74 | 75 | #define IRQ_PF3 74 |
105 | #define IRQ_PF4 75 | 76 | #define IRQ_PF4 75 |
106 | #define IRQ_PF5 76 | 77 | #define IRQ_PF5 76 |
107 | #define IRQ_PF6 77 | 78 | #define IRQ_PF6 77 |
108 | #define IRQ_PF7 78 | 79 | #define IRQ_PF7 78 |
109 | #define IRQ_PF8 79 | 80 | #define IRQ_PF8 79 |
110 | #define IRQ_PF9 80 | 81 | #define IRQ_PF9 80 |
111 | #define IRQ_PF10 81 | 82 | #define IRQ_PF10 81 |
112 | #define IRQ_PF11 82 | 83 | #define IRQ_PF11 82 |
113 | #define IRQ_PF12 83 | 84 | #define IRQ_PF12 83 |
114 | #define IRQ_PF13 84 | 85 | #define IRQ_PF13 84 |
115 | #define IRQ_PF14 85 | 86 | #define IRQ_PF14 85 |
116 | #define IRQ_PF15 86 | 87 | #define IRQ_PF15 86 |
117 | 88 | ||
118 | #define IRQ_PG0 87 | 89 | #define IRQ_PG0 87 |
119 | #define IRQ_PG1 88 | 90 | #define IRQ_PG1 88 |
120 | #define IRQ_PG2 89 | 91 | #define IRQ_PG2 89 |
121 | #define IRQ_PG3 90 | 92 | #define IRQ_PG3 90 |
122 | #define IRQ_PG4 91 | 93 | #define IRQ_PG4 91 |
123 | #define IRQ_PG5 92 | 94 | #define IRQ_PG5 92 |
124 | #define IRQ_PG6 93 | 95 | #define IRQ_PG6 93 |
125 | #define IRQ_PG7 94 | 96 | #define IRQ_PG7 94 |
126 | #define IRQ_PG8 95 | 97 | #define IRQ_PG8 95 |
127 | #define IRQ_PG9 96 | 98 | #define IRQ_PG9 96 |
128 | #define IRQ_PG10 97 | 99 | #define IRQ_PG10 97 |
129 | #define IRQ_PG11 98 | 100 | #define IRQ_PG11 98 |
130 | #define IRQ_PG12 99 | 101 | #define IRQ_PG12 99 |
131 | #define IRQ_PG13 100 | 102 | #define IRQ_PG13 100 |
132 | #define IRQ_PG14 101 | 103 | #define IRQ_PG14 101 |
133 | #define IRQ_PG15 102 | 104 | #define IRQ_PG15 102 |
134 | 105 | ||
135 | #define IRQ_PH0 103 | 106 | #define IRQ_PH0 103 |
136 | #define IRQ_PH1 104 | 107 | #define IRQ_PH1 104 |
137 | #define IRQ_PH2 105 | 108 | #define IRQ_PH2 105 |
138 | #define IRQ_PH3 106 | 109 | #define IRQ_PH3 106 |
139 | #define IRQ_PH4 107 | 110 | #define IRQ_PH4 107 |
140 | #define IRQ_PH5 108 | 111 | #define IRQ_PH5 108 |
141 | #define IRQ_PH6 109 | 112 | #define IRQ_PH6 109 |
142 | #define IRQ_PH7 110 | 113 | #define IRQ_PH7 110 |
143 | #define IRQ_PH8 111 | 114 | #define IRQ_PH8 111 |
144 | #define IRQ_PH9 112 | 115 | #define IRQ_PH9 112 |
145 | #define IRQ_PH10 113 | 116 | #define IRQ_PH10 113 |
146 | #define IRQ_PH11 114 | 117 | #define IRQ_PH11 114 |
147 | #define IRQ_PH12 115 | 118 | #define IRQ_PH12 115 |
148 | #define IRQ_PH13 116 | 119 | #define IRQ_PH13 116 |
149 | #define IRQ_PH14 117 | 120 | #define IRQ_PH14 117 |
150 | #define IRQ_PH15 118 | 121 | #define IRQ_PH15 118 |
151 | 122 | ||
152 | #define GPIO_IRQ_BASE IRQ_PF0 | 123 | #define GPIO_IRQ_BASE IRQ_PF0 |
153 | 124 | ||
154 | #define IRQ_MAC_PHYINT 119 /* PHY_INT Interrupt */ | 125 | #define IRQ_MAC_PHYINT 119 /* PHY_INT Interrupt */ |
155 | #define IRQ_MAC_MMCINT 120 /* MMC Counter Interrupt */ | 126 | #define IRQ_MAC_MMCINT 120 /* MMC Counter Interrupt */ |
156 | #define IRQ_MAC_RXFSINT 121 /* RX Frame-Status Interrupt */ | 127 | #define IRQ_MAC_RXFSINT 121 /* RX Frame-Status Interrupt */ |
157 | #define IRQ_MAC_TXFSINT 122 /* TX Frame-Status Interrupt */ | 128 | #define IRQ_MAC_TXFSINT 122 /* TX Frame-Status Interrupt */ |
158 | #define IRQ_MAC_WAKEDET 123 /* Wake-Up Interrupt */ | 129 | #define IRQ_MAC_WAKEDET 123 /* Wake-Up Interrupt */ |
159 | #define IRQ_MAC_RXDMAERR 124 /* RX DMA Direction Error Interrupt */ | 130 | #define IRQ_MAC_RXDMAERR 124 /* RX DMA Direction Error Interrupt */ |
160 | #define IRQ_MAC_TXDMAERR 125 /* TX DMA Direction Error Interrupt */ | 131 | #define IRQ_MAC_TXDMAERR 125 /* TX DMA Direction Error Interrupt */ |
161 | #define IRQ_MAC_STMDONE 126 /* Station Mgt. Transfer Done Interrupt */ | 132 | #define IRQ_MAC_STMDONE 126 /* Station Mgt. Transfer Done Interrupt */ |
162 | 133 | ||
163 | #define NR_MACH_IRQS (IRQ_MAC_STMDONE + 1) | 134 | #define NR_MACH_IRQS (IRQ_MAC_STMDONE + 1) |
164 | #define NR_IRQS (NR_MACH_IRQS + NR_SPARE_IRQS) | ||
165 | |||
166 | #define IVG7 7 | ||
167 | #define IVG8 8 | ||
168 | #define IVG9 9 | ||
169 | #define IVG10 10 | ||
170 | #define IVG11 11 | ||
171 | #define IVG12 12 | ||
172 | #define IVG13 13 | ||
173 | #define IVG14 14 | ||
174 | #define IVG15 15 | ||
175 | 135 | ||
176 | /* IAR0 BIT FIELDS */ | 136 | /* IAR0 BIT FIELDS */ |
177 | #define IRQ_PLL_WAKEUP_POS 0 | 137 | #define IRQ_PLL_WAKEUP_POS 0 |
178 | #define IRQ_DMA0_ERROR_POS 4 | 138 | #define IRQ_DMA0_ERROR_POS 4 |
179 | #define IRQ_DMAR0_BLK_POS 8 | 139 | #define IRQ_DMAR0_BLK_POS 8 |
180 | #define IRQ_DMAR1_BLK_POS 12 | 140 | #define IRQ_DMAR1_BLK_POS 12 |
181 | #define IRQ_DMAR0_OVR_POS 16 | 141 | #define IRQ_DMAR0_OVR_POS 16 |
182 | #define IRQ_DMAR1_OVR_POS 20 | 142 | #define IRQ_DMAR1_OVR_POS 20 |
183 | #define IRQ_PPI_ERROR_POS 24 | 143 | #define IRQ_PPI_ERROR_POS 24 |
184 | #define IRQ_MAC_ERROR_POS 28 | 144 | #define IRQ_MAC_ERROR_POS 28 |
185 | 145 | ||
186 | /* IAR1 BIT FIELDS */ | 146 | /* IAR1 BIT FIELDS */ |
187 | #define IRQ_SPORT0_ERROR_POS 0 | 147 | #define IRQ_SPORT0_ERROR_POS 0 |
188 | #define IRQ_SPORT1_ERROR_POS 4 | 148 | #define IRQ_SPORT1_ERROR_POS 4 |
189 | #define IRQ_UART0_ERROR_POS 16 | 149 | #define IRQ_UART0_ERROR_POS 16 |
190 | #define IRQ_UART1_ERROR_POS 20 | 150 | #define IRQ_UART1_ERROR_POS 20 |
191 | #define IRQ_RTC_POS 24 | 151 | #define IRQ_RTC_POS 24 |
192 | #define IRQ_PPI_POS 28 | 152 | #define IRQ_PPI_POS 28 |
193 | 153 | ||
194 | /* IAR2 BIT FIELDS */ | 154 | /* IAR2 BIT FIELDS */ |
195 | #define IRQ_SPORT0_RX_POS 0 | 155 | #define IRQ_SPORT0_RX_POS 0 |
196 | #define IRQ_SPORT0_TX_POS 4 | 156 | #define IRQ_SPORT0_TX_POS 4 |
197 | #define IRQ_SPORT1_RX_POS 8 | 157 | #define IRQ_SPORT1_RX_POS 8 |
198 | #define IRQ_SPORT1_TX_POS 12 | 158 | #define IRQ_SPORT1_TX_POS 12 |
199 | #define IRQ_TWI_POS 16 | 159 | #define IRQ_TWI_POS 16 |
200 | #define IRQ_SPI_POS 20 | 160 | #define IRQ_SPI_POS 20 |
201 | #define IRQ_UART0_RX_POS 24 | 161 | #define IRQ_UART0_RX_POS 24 |
202 | #define IRQ_UART0_TX_POS 28 | 162 | #define IRQ_UART0_TX_POS 28 |
203 | 163 | ||
204 | /* IAR3 BIT FIELDS */ | 164 | /* IAR3 BIT FIELDS */ |
205 | #define IRQ_UART1_RX_POS 0 | 165 | #define IRQ_UART1_RX_POS 0 |
206 | #define IRQ_UART1_TX_POS 4 | 166 | #define IRQ_UART1_TX_POS 4 |
207 | #define IRQ_OPTSEC_POS 8 | 167 | #define IRQ_OPTSEC_POS 8 |
208 | #define IRQ_CNT_POS 12 | 168 | #define IRQ_CNT_POS 12 |
209 | #define IRQ_MAC_RX_POS 16 | 169 | #define IRQ_MAC_RX_POS 16 |
210 | #define IRQ_PORTH_INTA_POS 20 | 170 | #define IRQ_PORTH_INTA_POS 20 |
211 | #define IRQ_MAC_TX_POS 24 | 171 | #define IRQ_MAC_TX_POS 24 |
212 | #define IRQ_PORTH_INTB_POS 28 | 172 | #define IRQ_PORTH_INTB_POS 28 |
213 | 173 | ||
214 | /* IAR4 BIT FIELDS */ | 174 | /* IAR4 BIT FIELDS */ |
@@ -224,21 +184,21 @@ | |||
224 | /* IAR5 BIT FIELDS */ | 184 | /* IAR5 BIT FIELDS */ |
225 | #define IRQ_PORTG_INTA_POS 0 | 185 | #define IRQ_PORTG_INTA_POS 0 |
226 | #define IRQ_PORTG_INTB_POS 4 | 186 | #define IRQ_PORTG_INTB_POS 4 |
227 | #define IRQ_MEM_DMA0_POS 8 | 187 | #define IRQ_MEM_DMA0_POS 8 |
228 | #define IRQ_MEM_DMA1_POS 12 | 188 | #define IRQ_MEM_DMA1_POS 12 |
229 | #define IRQ_WATCH_POS 16 | 189 | #define IRQ_WATCH_POS 16 |
230 | #define IRQ_PORTF_INTA_POS 20 | 190 | #define IRQ_PORTF_INTA_POS 20 |
231 | #define IRQ_PORTF_INTB_POS 24 | 191 | #define IRQ_PORTF_INTB_POS 24 |
232 | #define IRQ_SPI_ERROR_POS 28 | 192 | #define IRQ_SPI_ERROR_POS 28 |
233 | 193 | ||
234 | /* IAR6 BIT FIELDS */ | 194 | /* IAR6 BIT FIELDS */ |
235 | #define IRQ_NFC_ERROR_POS 0 | 195 | #define IRQ_NFC_ERROR_POS 0 |
236 | #define IRQ_HDMA_ERROR_POS 4 | 196 | #define IRQ_HDMA_ERROR_POS 4 |
237 | #define IRQ_HDMA_POS 8 | 197 | #define IRQ_HDMA_POS 8 |
238 | #define IRQ_USB_EINT_POS 12 | 198 | #define IRQ_USB_EINT_POS 12 |
239 | #define IRQ_USB_INT0_POS 16 | 199 | #define IRQ_USB_INT0_POS 16 |
240 | #define IRQ_USB_INT1_POS 20 | 200 | #define IRQ_USB_INT1_POS 20 |
241 | #define IRQ_USB_INT2_POS 24 | 201 | #define IRQ_USB_INT2_POS 24 |
242 | #define IRQ_USB_DMA_POS 28 | 202 | #define IRQ_USB_DMA_POS 28 |
243 | 203 | ||
244 | #endif /* _BF527_IRQ_H_ */ | 204 | #endif |
diff --git a/arch/blackfin/mach-bf533/include/mach/anomaly.h b/arch/blackfin/mach-bf533/include/mach/anomaly.h index 78f872187918..72aa59440f82 100644 --- a/arch/blackfin/mach-bf533/include/mach/anomaly.h +++ b/arch/blackfin/mach-bf533/include/mach/anomaly.h | |||
@@ -5,13 +5,13 @@ | |||
5 | * and can be replaced with that version at any time | 5 | * and can be replaced with that version at any time |
6 | * DO NOT EDIT THIS FILE | 6 | * DO NOT EDIT THIS FILE |
7 | * | 7 | * |
8 | * Copyright 2004-2010 Analog Devices Inc. | 8 | * Copyright 2004-2011 Analog Devices Inc. |
9 | * Licensed under the ADI BSD license. | 9 | * Licensed under the ADI BSD license. |
10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd | 10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* This file should be up to date with: | 13 | /* This file should be up to date with: |
14 | * - Revision E, 09/18/2008; ADSP-BF531/BF532/BF533 Blackfin Processor Anomaly List | 14 | * - Revision F, 05/25/2010; ADSP-BF531/BF532/BF533 Blackfin Processor Anomaly List |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef _MACH_ANOMALY_H_ | 17 | #ifndef _MACH_ANOMALY_H_ |
@@ -206,6 +206,10 @@ | |||
206 | #define ANOMALY_05000443 (1) | 206 | #define ANOMALY_05000443 (1) |
207 | /* False Hardware Error when RETI Points to Invalid Memory */ | 207 | /* False Hardware Error when RETI Points to Invalid Memory */ |
208 | #define ANOMALY_05000461 (1) | 208 | #define ANOMALY_05000461 (1) |
209 | /* Synchronization Problem at Startup May Cause SPORT Transmit Channels to Misalign */ | ||
210 | #define ANOMALY_05000462 (1) | ||
211 | /* Boot Failure When SDRAM Control Signals Toggle Coming Out Of Reset */ | ||
212 | #define ANOMALY_05000471 (1) | ||
209 | /* Interrupted 32-Bit SPORT Data Register Access Results In Underflow */ | 213 | /* Interrupted 32-Bit SPORT Data Register Access Results In Underflow */ |
210 | #define ANOMALY_05000473 (1) | 214 | #define ANOMALY_05000473 (1) |
211 | /* Possible Lockup Condition whem Modifying PLL from External Memory */ | 215 | /* Possible Lockup Condition whem Modifying PLL from External Memory */ |
@@ -351,12 +355,14 @@ | |||
351 | #define ANOMALY_05000362 (1) | 355 | #define ANOMALY_05000362 (1) |
352 | #define ANOMALY_05000364 (0) | 356 | #define ANOMALY_05000364 (0) |
353 | #define ANOMALY_05000380 (0) | 357 | #define ANOMALY_05000380 (0) |
358 | #define ANOMALY_05000383 (0) | ||
354 | #define ANOMALY_05000386 (1) | 359 | #define ANOMALY_05000386 (1) |
355 | #define ANOMALY_05000389 (0) | 360 | #define ANOMALY_05000389 (0) |
356 | #define ANOMALY_05000412 (0) | 361 | #define ANOMALY_05000412 (0) |
357 | #define ANOMALY_05000430 (0) | 362 | #define ANOMALY_05000430 (0) |
358 | #define ANOMALY_05000432 (0) | 363 | #define ANOMALY_05000432 (0) |
359 | #define ANOMALY_05000435 (0) | 364 | #define ANOMALY_05000435 (0) |
365 | #define ANOMALY_05000440 (0) | ||
360 | #define ANOMALY_05000447 (0) | 366 | #define ANOMALY_05000447 (0) |
361 | #define ANOMALY_05000448 (0) | 367 | #define ANOMALY_05000448 (0) |
362 | #define ANOMALY_05000456 (0) | 368 | #define ANOMALY_05000456 (0) |
@@ -364,6 +370,7 @@ | |||
364 | #define ANOMALY_05000465 (0) | 370 | #define ANOMALY_05000465 (0) |
365 | #define ANOMALY_05000467 (0) | 371 | #define ANOMALY_05000467 (0) |
366 | #define ANOMALY_05000474 (0) | 372 | #define ANOMALY_05000474 (0) |
373 | #define ANOMALY_05000480 (0) | ||
367 | #define ANOMALY_05000485 (0) | 374 | #define ANOMALY_05000485 (0) |
368 | 375 | ||
369 | #endif | 376 | #endif |
diff --git a/arch/blackfin/mach-bf533/include/mach/irq.h b/arch/blackfin/mach-bf533/include/mach/irq.h index 1f7e9765d954..709733754142 100644 --- a/arch/blackfin/mach-bf533/include/mach/irq.h +++ b/arch/blackfin/mach-bf533/include/mach/irq.h | |||
@@ -7,83 +7,36 @@ | |||
7 | #ifndef _BF533_IRQ_H_ | 7 | #ifndef _BF533_IRQ_H_ |
8 | #define _BF533_IRQ_H_ | 8 | #define _BF533_IRQ_H_ |
9 | 9 | ||
10 | /* | 10 | #include <mach-common/irq.h> |
11 | * Interrupt source definitions | ||
12 | Event Source Core Event Name | ||
13 | Core Emulation ** | ||
14 | Events (highest priority) EMU 0 | ||
15 | Reset RST 1 | ||
16 | NMI NMI 2 | ||
17 | Exception EVX 3 | ||
18 | Reserved -- 4 | ||
19 | Hardware Error IVHW 5 | ||
20 | Core Timer IVTMR 6 * | ||
21 | PLL Wakeup Interrupt IVG7 7 | ||
22 | DMA Error (generic) IVG7 8 | ||
23 | PPI Error Interrupt IVG7 9 | ||
24 | SPORT0 Error Interrupt IVG7 10 | ||
25 | SPORT1 Error Interrupt IVG7 11 | ||
26 | SPI Error Interrupt IVG7 12 | ||
27 | UART Error Interrupt IVG7 13 | ||
28 | RTC Interrupt IVG8 14 | ||
29 | DMA0 Interrupt (PPI) IVG8 15 | ||
30 | DMA1 (SPORT0 RX) IVG9 16 | ||
31 | DMA2 (SPORT0 TX) IVG9 17 | ||
32 | DMA3 (SPORT1 RX) IVG9 18 | ||
33 | DMA4 (SPORT1 TX) IVG9 19 | ||
34 | DMA5 (PPI) IVG10 20 | ||
35 | DMA6 (UART RX) IVG10 21 | ||
36 | DMA7 (UART TX) IVG10 22 | ||
37 | Timer0 IVG11 23 | ||
38 | Timer1 IVG11 24 | ||
39 | Timer2 IVG11 25 | ||
40 | PF Interrupt A IVG12 26 | ||
41 | PF Interrupt B IVG12 27 | ||
42 | DMA8/9 Interrupt IVG13 28 | ||
43 | DMA10/11 Interrupt IVG13 29 | ||
44 | Watchdog Timer IVG13 30 | ||
45 | 11 | ||
46 | Softirq IVG14 31 | 12 | #define NR_PERI_INTS 24 |
47 | System Call -- | ||
48 | (lowest priority) IVG15 32 * | ||
49 | */ | ||
50 | #define SYS_IRQS 31 | ||
51 | #define NR_PERI_INTS 24 | ||
52 | 13 | ||
53 | /* The ABSTRACT IRQ definitions */ | 14 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ |
54 | /** the first seven of the following are fixed, the rest you change if you need to **/ | 15 | #define IRQ_DMA_ERROR BFIN_IRQ(1) /* DMA Error (general) */ |
55 | #define IRQ_EMU 0 /*Emulation */ | 16 | #define IRQ_PPI_ERROR BFIN_IRQ(2) /* PPI Error Interrupt */ |
56 | #define IRQ_RST 1 /*reset */ | 17 | #define IRQ_SPORT0_ERROR BFIN_IRQ(3) /* SPORT0 Error Interrupt */ |
57 | #define IRQ_NMI 2 /*Non Maskable */ | 18 | #define IRQ_SPORT1_ERROR BFIN_IRQ(4) /* SPORT1 Error Interrupt */ |
58 | #define IRQ_EVX 3 /*Exception */ | 19 | #define IRQ_SPI_ERROR BFIN_IRQ(5) /* SPI Error Interrupt */ |
59 | #define IRQ_UNUSED 4 /*- unused interrupt*/ | 20 | #define IRQ_UART0_ERROR BFIN_IRQ(6) /* UART Error Interrupt */ |
60 | #define IRQ_HWERR 5 /*Hardware Error */ | 21 | #define IRQ_RTC BFIN_IRQ(7) /* RTC Interrupt */ |
61 | #define IRQ_CORETMR 6 /*Core timer */ | 22 | #define IRQ_PPI BFIN_IRQ(8) /* DMA0 Interrupt (PPI) */ |
23 | #define IRQ_SPORT0_RX BFIN_IRQ(9) /* DMA1 Interrupt (SPORT0 RX) */ | ||
24 | #define IRQ_SPORT0_TX BFIN_IRQ(10) /* DMA2 Interrupt (SPORT0 TX) */ | ||
25 | #define IRQ_SPORT1_RX BFIN_IRQ(11) /* DMA3 Interrupt (SPORT1 RX) */ | ||
26 | #define IRQ_SPORT1_TX BFIN_IRQ(12) /* DMA4 Interrupt (SPORT1 TX) */ | ||
27 | #define IRQ_SPI BFIN_IRQ(13) /* DMA5 Interrupt (SPI) */ | ||
28 | #define IRQ_UART0_RX BFIN_IRQ(14) /* DMA6 Interrupt (UART RX) */ | ||
29 | #define IRQ_UART0_TX BFIN_IRQ(15) /* DMA7 Interrupt (UART TX) */ | ||
30 | #define IRQ_TIMER0 BFIN_IRQ(16) /* Timer 0 */ | ||
31 | #define IRQ_TIMER1 BFIN_IRQ(17) /* Timer 1 */ | ||
32 | #define IRQ_TIMER2 BFIN_IRQ(18) /* Timer 2 */ | ||
33 | #define IRQ_PROG_INTA BFIN_IRQ(19) /* Programmable Flags A (8) */ | ||
34 | #define IRQ_PROG_INTB BFIN_IRQ(20) /* Programmable Flags B (8) */ | ||
35 | #define IRQ_MEM_DMA0 BFIN_IRQ(21) /* DMA8/9 Interrupt (Memory DMA Stream 0) */ | ||
36 | #define IRQ_MEM_DMA1 BFIN_IRQ(22) /* DMA10/11 Interrupt (Memory DMA Stream 1) */ | ||
37 | #define IRQ_WATCH BFIN_IRQ(23) /* Watch Dog Timer */ | ||
62 | 38 | ||
63 | #define IRQ_PLL_WAKEUP 7 /*PLL Wakeup Interrupt */ | 39 | #define SYS_IRQS 31 |
64 | #define IRQ_DMA_ERROR 8 /*DMA Error (general) */ | ||
65 | #define IRQ_PPI_ERROR 9 /*PPI Error Interrupt */ | ||
66 | #define IRQ_SPORT0_ERROR 10 /*SPORT0 Error Interrupt */ | ||
67 | #define IRQ_SPORT1_ERROR 11 /*SPORT1 Error Interrupt */ | ||
68 | #define IRQ_SPI_ERROR 12 /*SPI Error Interrupt */ | ||
69 | #define IRQ_UART0_ERROR 13 /*UART Error Interrupt */ | ||
70 | #define IRQ_RTC 14 /*RTC Interrupt */ | ||
71 | #define IRQ_PPI 15 /*DMA0 Interrupt (PPI) */ | ||
72 | #define IRQ_SPORT0_RX 16 /*DMA1 Interrupt (SPORT0 RX) */ | ||
73 | #define IRQ_SPORT0_TX 17 /*DMA2 Interrupt (SPORT0 TX) */ | ||
74 | #define IRQ_SPORT1_RX 18 /*DMA3 Interrupt (SPORT1 RX) */ | ||
75 | #define IRQ_SPORT1_TX 19 /*DMA4 Interrupt (SPORT1 TX) */ | ||
76 | #define IRQ_SPI 20 /*DMA5 Interrupt (SPI) */ | ||
77 | #define IRQ_UART0_RX 21 /*DMA6 Interrupt (UART RX) */ | ||
78 | #define IRQ_UART0_TX 22 /*DMA7 Interrupt (UART TX) */ | ||
79 | #define IRQ_TIMER0 23 /*Timer 0 */ | ||
80 | #define IRQ_TIMER1 24 /*Timer 1 */ | ||
81 | #define IRQ_TIMER2 25 /*Timer 2 */ | ||
82 | #define IRQ_PROG_INTA 26 /*Programmable Flags A (8) */ | ||
83 | #define IRQ_PROG_INTB 27 /*Programmable Flags B (8) */ | ||
84 | #define IRQ_MEM_DMA0 28 /*DMA8/9 Interrupt (Memory DMA Stream 0) */ | ||
85 | #define IRQ_MEM_DMA1 29 /*DMA10/11 Interrupt (Memory DMA Stream 1) */ | ||
86 | #define IRQ_WATCH 30 /*Watch Dog Timer */ | ||
87 | 40 | ||
88 | #define IRQ_PF0 33 | 41 | #define IRQ_PF0 33 |
89 | #define IRQ_PF1 34 | 42 | #define IRQ_PF1 34 |
@@ -105,46 +58,35 @@ Core Emulation ** | |||
105 | #define GPIO_IRQ_BASE IRQ_PF0 | 58 | #define GPIO_IRQ_BASE IRQ_PF0 |
106 | 59 | ||
107 | #define NR_MACH_IRQS (IRQ_PF15 + 1) | 60 | #define NR_MACH_IRQS (IRQ_PF15 + 1) |
108 | #define NR_IRQS (NR_MACH_IRQS + NR_SPARE_IRQS) | ||
109 | |||
110 | #define IVG7 7 | ||
111 | #define IVG8 8 | ||
112 | #define IVG9 9 | ||
113 | #define IVG10 10 | ||
114 | #define IVG11 11 | ||
115 | #define IVG12 12 | ||
116 | #define IVG13 13 | ||
117 | #define IVG14 14 | ||
118 | #define IVG15 15 | ||
119 | 61 | ||
120 | /* IAR0 BIT FIELDS*/ | 62 | /* IAR0 BIT FIELDS */ |
121 | #define RTC_ERROR_POS 28 | 63 | #define RTC_ERROR_POS 28 |
122 | #define UART_ERROR_POS 24 | 64 | #define UART_ERROR_POS 24 |
123 | #define SPORT1_ERROR_POS 20 | 65 | #define SPORT1_ERROR_POS 20 |
124 | #define SPI_ERROR_POS 16 | 66 | #define SPI_ERROR_POS 16 |
125 | #define SPORT0_ERROR_POS 12 | 67 | #define SPORT0_ERROR_POS 12 |
126 | #define PPI_ERROR_POS 8 | 68 | #define PPI_ERROR_POS 8 |
127 | #define DMA_ERROR_POS 4 | 69 | #define DMA_ERROR_POS 4 |
128 | #define PLLWAKE_ERROR_POS 0 | 70 | #define PLLWAKE_ERROR_POS 0 |
129 | 71 | ||
130 | /* IAR1 BIT FIELDS*/ | 72 | /* IAR1 BIT FIELDS */ |
131 | #define DMA7_UARTTX_POS 28 | 73 | #define DMA7_UARTTX_POS 28 |
132 | #define DMA6_UARTRX_POS 24 | 74 | #define DMA6_UARTRX_POS 24 |
133 | #define DMA5_SPI_POS 20 | 75 | #define DMA5_SPI_POS 20 |
134 | #define DMA4_SPORT1TX_POS 16 | 76 | #define DMA4_SPORT1TX_POS 16 |
135 | #define DMA3_SPORT1RX_POS 12 | 77 | #define DMA3_SPORT1RX_POS 12 |
136 | #define DMA2_SPORT0TX_POS 8 | 78 | #define DMA2_SPORT0TX_POS 8 |
137 | #define DMA1_SPORT0RX_POS 4 | 79 | #define DMA1_SPORT0RX_POS 4 |
138 | #define DMA0_PPI_POS 0 | 80 | #define DMA0_PPI_POS 0 |
139 | 81 | ||
140 | /* IAR2 BIT FIELDS*/ | 82 | /* IAR2 BIT FIELDS */ |
141 | #define WDTIMER_POS 28 | 83 | #define WDTIMER_POS 28 |
142 | #define MEMDMA1_POS 24 | 84 | #define MEMDMA1_POS 24 |
143 | #define MEMDMA0_POS 20 | 85 | #define MEMDMA0_POS 20 |
144 | #define PFB_POS 16 | 86 | #define PFB_POS 16 |
145 | #define PFA_POS 12 | 87 | #define PFA_POS 12 |
146 | #define TIMER2_POS 8 | 88 | #define TIMER2_POS 8 |
147 | #define TIMER1_POS 4 | 89 | #define TIMER1_POS 4 |
148 | #define TIMER0_POS 0 | 90 | #define TIMER0_POS 0 |
149 | 91 | ||
150 | #endif /* _BF533_IRQ_H_ */ | 92 | #endif |
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c index 3fa335405b31..e16dc4560048 100644 --- a/arch/blackfin/mach-bf537/boards/stamp.c +++ b/arch/blackfin/mach-bf537/boards/stamp.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/reboot.h> | 35 | #include <asm/reboot.h> |
36 | #include <asm/portmux.h> | 36 | #include <asm/portmux.h> |
37 | #include <asm/dpmc.h> | 37 | #include <asm/dpmc.h> |
38 | #include <asm/bfin_sport.h> | ||
38 | #ifdef CONFIG_REGULATOR_FIXED_VOLTAGE | 39 | #ifdef CONFIG_REGULATOR_FIXED_VOLTAGE |
39 | #include <linux/regulator/fixed.h> | 40 | #include <linux/regulator/fixed.h> |
40 | #endif | 41 | #endif |
@@ -2585,27 +2586,103 @@ static struct platform_device bfin_dpmc = { | |||
2585 | }, | 2586 | }, |
2586 | }; | 2587 | }; |
2587 | 2588 | ||
2588 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) | 2589 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ |
2590 | defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \ | ||
2591 | defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) | ||
2592 | |||
2593 | #define SPORT_REQ(x) \ | ||
2594 | [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \ | ||
2595 | P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0} | ||
2596 | |||
2597 | static const u16 bfin_snd_pin[][7] = { | ||
2598 | SPORT_REQ(0), | ||
2599 | SPORT_REQ(1), | ||
2600 | }; | ||
2601 | |||
2602 | static struct bfin_snd_platform_data bfin_snd_data[] = { | ||
2603 | { | ||
2604 | .pin_req = &bfin_snd_pin[0][0], | ||
2605 | }, | ||
2606 | { | ||
2607 | .pin_req = &bfin_snd_pin[1][0], | ||
2608 | }, | ||
2609 | }; | ||
2610 | |||
2611 | #define BFIN_SND_RES(x) \ | ||
2612 | [x] = { \ | ||
2613 | { \ | ||
2614 | .start = SPORT##x##_TCR1, \ | ||
2615 | .end = SPORT##x##_TCR1, \ | ||
2616 | .flags = IORESOURCE_MEM \ | ||
2617 | }, \ | ||
2618 | { \ | ||
2619 | .start = CH_SPORT##x##_RX, \ | ||
2620 | .end = CH_SPORT##x##_RX, \ | ||
2621 | .flags = IORESOURCE_DMA, \ | ||
2622 | }, \ | ||
2623 | { \ | ||
2624 | .start = CH_SPORT##x##_TX, \ | ||
2625 | .end = CH_SPORT##x##_TX, \ | ||
2626 | .flags = IORESOURCE_DMA, \ | ||
2627 | }, \ | ||
2628 | { \ | ||
2629 | .start = IRQ_SPORT##x##_ERROR, \ | ||
2630 | .end = IRQ_SPORT##x##_ERROR, \ | ||
2631 | .flags = IORESOURCE_IRQ, \ | ||
2632 | } \ | ||
2633 | } | ||
2634 | |||
2635 | static struct resource bfin_snd_resources[][4] = { | ||
2636 | BFIN_SND_RES(0), | ||
2637 | BFIN_SND_RES(1), | ||
2638 | }; | ||
2639 | |||
2640 | static struct platform_device bfin_pcm = { | ||
2641 | .name = "bfin-pcm-audio", | ||
2642 | .id = -1, | ||
2643 | }; | ||
2644 | #endif | ||
2645 | |||
2646 | #if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE) | ||
2647 | static struct platform_device bfin_ad73311_codec_device = { | ||
2648 | .name = "ad73311", | ||
2649 | .id = -1, | ||
2650 | }; | ||
2651 | #endif | ||
2652 | |||
2653 | #if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE) | ||
2589 | static struct platform_device bfin_i2s = { | 2654 | static struct platform_device bfin_i2s = { |
2590 | .name = "bfin-i2s", | 2655 | .name = "bfin-i2s", |
2591 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | 2656 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
2592 | /* TODO: add platform data here */ | 2657 | .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]), |
2658 | .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM], | ||
2659 | .dev = { | ||
2660 | .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM], | ||
2661 | }, | ||
2593 | }; | 2662 | }; |
2594 | #endif | 2663 | #endif |
2595 | 2664 | ||
2596 | #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) | 2665 | #if defined(CONFIG_SND_BF5XX_SOC_TDM) || defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE) |
2597 | static struct platform_device bfin_tdm = { | 2666 | static struct platform_device bfin_tdm = { |
2598 | .name = "bfin-tdm", | 2667 | .name = "bfin-tdm", |
2599 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | 2668 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
2600 | /* TODO: add platform data here */ | 2669 | .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]), |
2670 | .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM], | ||
2671 | .dev = { | ||
2672 | .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM], | ||
2673 | }, | ||
2601 | }; | 2674 | }; |
2602 | #endif | 2675 | #endif |
2603 | 2676 | ||
2604 | #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) | 2677 | #if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE) |
2605 | static struct platform_device bfin_ac97 = { | 2678 | static struct platform_device bfin_ac97 = { |
2606 | .name = "bfin-ac97", | 2679 | .name = "bfin-ac97", |
2607 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | 2680 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
2608 | /* TODO: add platform data here */ | 2681 | .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]), |
2682 | .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM], | ||
2683 | .dev = { | ||
2684 | .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM], | ||
2685 | }, | ||
2609 | }; | 2686 | }; |
2610 | #endif | 2687 | #endif |
2611 | 2688 | ||
@@ -2796,17 +2873,28 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
2796 | &stamp_flash_device, | 2873 | &stamp_flash_device, |
2797 | #endif | 2874 | #endif |
2798 | 2875 | ||
2799 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) | 2876 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ |
2877 | defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \ | ||
2878 | defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) | ||
2879 | &bfin_pcm, | ||
2880 | #endif | ||
2881 | |||
2882 | #if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE) | ||
2883 | &bfin_ad73311_codec_device, | ||
2884 | #endif | ||
2885 | |||
2886 | #if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE) | ||
2800 | &bfin_i2s, | 2887 | &bfin_i2s, |
2801 | #endif | 2888 | #endif |
2802 | 2889 | ||
2803 | #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) | 2890 | #if defined(CONFIG_SND_BF5XX_SOC_TDM) || defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE) |
2804 | &bfin_tdm, | 2891 | &bfin_tdm, |
2805 | #endif | 2892 | #endif |
2806 | 2893 | ||
2807 | #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) | 2894 | #if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE) |
2808 | &bfin_ac97, | 2895 | &bfin_ac97, |
2809 | #endif | 2896 | #endif |
2897 | |||
2810 | #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE) | 2898 | #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE) |
2811 | #if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \ | 2899 | #if defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER) || \ |
2812 | defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE) | 2900 | defined(CONFIG_REGULATOR_VIRTUAL_CONSUMER_MODULE) |
diff --git a/arch/blackfin/mach-bf537/include/mach/anomaly.h b/arch/blackfin/mach-bf537/include/mach/anomaly.h index 43df6afd22ad..7f8e5a9f5db6 100644 --- a/arch/blackfin/mach-bf537/include/mach/anomaly.h +++ b/arch/blackfin/mach-bf537/include/mach/anomaly.h | |||
@@ -5,13 +5,13 @@ | |||
5 | * and can be replaced with that version at any time | 5 | * and can be replaced with that version at any time |
6 | * DO NOT EDIT THIS FILE | 6 | * DO NOT EDIT THIS FILE |
7 | * | 7 | * |
8 | * Copyright 2004-2010 Analog Devices Inc. | 8 | * Copyright 2004-2011 Analog Devices Inc. |
9 | * Licensed under the ADI BSD license. | 9 | * Licensed under the ADI BSD license. |
10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd | 10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* This file should be up to date with: | 13 | /* This file should be up to date with: |
14 | * - Revision D, 09/18/2008; ADSP-BF534/ADSP-BF536/ADSP-BF537 Blackfin Processor Anomaly List | 14 | * - Revision E, 05/25/2010; ADSP-BF534/ADSP-BF536/ADSP-BF537 Blackfin Processor Anomaly List |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef _MACH_ANOMALY_H_ | 17 | #ifndef _MACH_ANOMALY_H_ |
@@ -160,12 +160,16 @@ | |||
160 | #define ANOMALY_05000443 (1) | 160 | #define ANOMALY_05000443 (1) |
161 | /* False Hardware Error when RETI Points to Invalid Memory */ | 161 | /* False Hardware Error when RETI Points to Invalid Memory */ |
162 | #define ANOMALY_05000461 (1) | 162 | #define ANOMALY_05000461 (1) |
163 | /* Synchronization Problem at Startup May Cause SPORT Transmit Channels to Misalign */ | ||
164 | #define ANOMALY_05000462 (1) | ||
163 | /* Interrupted 32-Bit SPORT Data Register Access Results In Underflow */ | 165 | /* Interrupted 32-Bit SPORT Data Register Access Results In Underflow */ |
164 | #define ANOMALY_05000473 (1) | 166 | #define ANOMALY_05000473 (1) |
165 | /* Possible Lockup Condition whem Modifying PLL from External Memory */ | 167 | /* Possible Lockup Condition whem Modifying PLL from External Memory */ |
166 | #define ANOMALY_05000475 (1) | 168 | #define ANOMALY_05000475 (1) |
167 | /* TESTSET Instruction Cannot Be Interrupted */ | 169 | /* TESTSET Instruction Cannot Be Interrupted */ |
168 | #define ANOMALY_05000477 (1) | 170 | #define ANOMALY_05000477 (1) |
171 | /* Multiple Simultaneous Urgent DMA Requests May Cause DMA System Instability */ | ||
172 | #define ANOMALY_05000480 (__SILICON_REVISION__ < 3) | ||
169 | /* Reads of ITEST_COMMAND and ITEST_DATA Registers Cause Cache Corruption */ | 173 | /* Reads of ITEST_COMMAND and ITEST_DATA Registers Cause Cache Corruption */ |
170 | #define ANOMALY_05000481 (1) | 174 | #define ANOMALY_05000481 (1) |
171 | /* IFLUSH sucks at life */ | 175 | /* IFLUSH sucks at life */ |
@@ -204,6 +208,7 @@ | |||
204 | #define ANOMALY_05000363 (0) | 208 | #define ANOMALY_05000363 (0) |
205 | #define ANOMALY_05000364 (0) | 209 | #define ANOMALY_05000364 (0) |
206 | #define ANOMALY_05000380 (0) | 210 | #define ANOMALY_05000380 (0) |
211 | #define ANOMALY_05000383 (0) | ||
207 | #define ANOMALY_05000386 (1) | 212 | #define ANOMALY_05000386 (1) |
208 | #define ANOMALY_05000389 (0) | 213 | #define ANOMALY_05000389 (0) |
209 | #define ANOMALY_05000400 (0) | 214 | #define ANOMALY_05000400 (0) |
@@ -211,6 +216,7 @@ | |||
211 | #define ANOMALY_05000430 (0) | 216 | #define ANOMALY_05000430 (0) |
212 | #define ANOMALY_05000432 (0) | 217 | #define ANOMALY_05000432 (0) |
213 | #define ANOMALY_05000435 (0) | 218 | #define ANOMALY_05000435 (0) |
219 | #define ANOMALY_05000440 (0) | ||
214 | #define ANOMALY_05000447 (0) | 220 | #define ANOMALY_05000447 (0) |
215 | #define ANOMALY_05000448 (0) | 221 | #define ANOMALY_05000448 (0) |
216 | #define ANOMALY_05000456 (0) | 222 | #define ANOMALY_05000456 (0) |
diff --git a/arch/blackfin/mach-bf537/include/mach/irq.h b/arch/blackfin/mach-bf537/include/mach/irq.h index 1a6d617c5fcf..b6ed8235bda4 100644 --- a/arch/blackfin/mach-bf537/include/mach/irq.h +++ b/arch/blackfin/mach-bf537/include/mach/irq.h | |||
@@ -7,193 +7,178 @@ | |||
7 | #ifndef _BF537_IRQ_H_ | 7 | #ifndef _BF537_IRQ_H_ |
8 | #define _BF537_IRQ_H_ | 8 | #define _BF537_IRQ_H_ |
9 | 9 | ||
10 | /* | 10 | #include <mach-common/irq.h> |
11 | * Interrupt source definitions | 11 | |
12 | * Event Source Core Event Name | 12 | #define NR_PERI_INTS 32 |
13 | * Core Emulation ** | 13 | |
14 | * Events (highest priority) EMU 0 | 14 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ |
15 | * Reset RST 1 | 15 | #define IRQ_DMA_ERROR BFIN_IRQ(1) /* DMA Error (general) */ |
16 | * NMI NMI 2 | 16 | #define IRQ_GENERIC_ERROR BFIN_IRQ(2) /* GENERIC Error Interrupt */ |
17 | * Exception EVX 3 | 17 | #define IRQ_RTC BFIN_IRQ(3) /* RTC Interrupt */ |
18 | * Reserved -- 4 | 18 | #define IRQ_PPI BFIN_IRQ(4) /* DMA0 Interrupt (PPI) */ |
19 | * Hardware Error IVHW 5 | 19 | #define IRQ_SPORT0_RX BFIN_IRQ(5) /* DMA3 Interrupt (SPORT0 RX) */ |
20 | * Core Timer IVTMR 6 | 20 | #define IRQ_SPORT0_TX BFIN_IRQ(6) /* DMA4 Interrupt (SPORT0 TX) */ |
21 | * ..... | 21 | #define IRQ_SPORT1_RX BFIN_IRQ(7) /* DMA5 Interrupt (SPORT1 RX) */ |
22 | * | 22 | #define IRQ_SPORT1_TX BFIN_IRQ(8) /* DMA6 Interrupt (SPORT1 TX) */ |
23 | * Softirq IVG14 | 23 | #define IRQ_TWI BFIN_IRQ(9) /* TWI Interrupt */ |
24 | * System Call -- | 24 | #define IRQ_SPI BFIN_IRQ(10) /* DMA7 Interrupt (SPI) */ |
25 | * (lowest priority) IVG15 | 25 | #define IRQ_UART0_RX BFIN_IRQ(11) /* DMA8 Interrupt (UART0 RX) */ |
26 | */ | 26 | #define IRQ_UART0_TX BFIN_IRQ(12) /* DMA9 Interrupt (UART0 TX) */ |
27 | 27 | #define IRQ_UART1_RX BFIN_IRQ(13) /* DMA10 Interrupt (UART1 RX) */ | |
28 | #define SYS_IRQS 39 | 28 | #define IRQ_UART1_TX BFIN_IRQ(14) /* DMA11 Interrupt (UART1 TX) */ |
29 | #define NR_PERI_INTS 32 | 29 | #define IRQ_CAN_RX BFIN_IRQ(15) /* CAN Receive Interrupt */ |
30 | 30 | #define IRQ_CAN_TX BFIN_IRQ(16) /* CAN Transmit Interrupt */ | |
31 | /* The ABSTRACT IRQ definitions */ | 31 | #define IRQ_PH_INTA_MAC_RX BFIN_IRQ(17) /* Port H Interrupt A & DMA1 Interrupt (Ethernet RX) */ |
32 | /** the first seven of the following are fixed, the rest you change if you need to **/ | 32 | #define IRQ_PH_INTB_MAC_TX BFIN_IRQ(18) /* Port H Interrupt B & DMA2 Interrupt (Ethernet TX) */ |
33 | #define IRQ_EMU 0 /*Emulation */ | 33 | #define IRQ_TIMER0 BFIN_IRQ(19) /* Timer 0 */ |
34 | #define IRQ_RST 1 /*reset */ | 34 | #define IRQ_TIMER1 BFIN_IRQ(20) /* Timer 1 */ |
35 | #define IRQ_NMI 2 /*Non Maskable */ | 35 | #define IRQ_TIMER2 BFIN_IRQ(21) /* Timer 2 */ |
36 | #define IRQ_EVX 3 /*Exception */ | 36 | #define IRQ_TIMER3 BFIN_IRQ(22) /* Timer 3 */ |
37 | #define IRQ_UNUSED 4 /*- unused interrupt*/ | 37 | #define IRQ_TIMER4 BFIN_IRQ(23) /* Timer 4 */ |
38 | #define IRQ_HWERR 5 /*Hardware Error */ | 38 | #define IRQ_TIMER5 BFIN_IRQ(24) /* Timer 5 */ |
39 | #define IRQ_CORETMR 6 /*Core timer */ | 39 | #define IRQ_TIMER6 BFIN_IRQ(25) /* Timer 6 */ |
40 | 40 | #define IRQ_TIMER7 BFIN_IRQ(26) /* Timer 7 */ | |
41 | #define IRQ_PLL_WAKEUP 7 /*PLL Wakeup Interrupt */ | 41 | #define IRQ_PF_INTA_PG_INTA BFIN_IRQ(27) /* Ports F&G Interrupt A */ |
42 | #define IRQ_DMA_ERROR 8 /*DMA Error (general) */ | 42 | #define IRQ_PORTG_INTB BFIN_IRQ(28) /* Port G Interrupt B */ |
43 | #define IRQ_GENERIC_ERROR 9 /*GENERIC Error Interrupt */ | 43 | #define IRQ_MEM_DMA0 BFIN_IRQ(29) /* (Memory DMA Stream 0) */ |
44 | #define IRQ_RTC 10 /*RTC Interrupt */ | 44 | #define IRQ_MEM_DMA1 BFIN_IRQ(30) /* (Memory DMA Stream 1) */ |
45 | #define IRQ_PPI 11 /*DMA0 Interrupt (PPI) */ | 45 | #define IRQ_PF_INTB_WATCH BFIN_IRQ(31) /* Watchdog & Port F Interrupt B */ |
46 | #define IRQ_SPORT0_RX 12 /*DMA3 Interrupt (SPORT0 RX) */ | 46 | |
47 | #define IRQ_SPORT0_TX 13 /*DMA4 Interrupt (SPORT0 TX) */ | 47 | #define SYS_IRQS 39 |
48 | #define IRQ_SPORT1_RX 14 /*DMA5 Interrupt (SPORT1 RX) */ | 48 | |
49 | #define IRQ_SPORT1_TX 15 /*DMA6 Interrupt (SPORT1 TX) */ | 49 | #define IRQ_PPI_ERROR 42 /* PPI Error Interrupt */ |
50 | #define IRQ_TWI 16 /*TWI Interrupt */ | 50 | #define IRQ_CAN_ERROR 43 /* CAN Error Interrupt */ |
51 | #define IRQ_SPI 17 /*DMA7 Interrupt (SPI) */ | 51 | #define IRQ_MAC_ERROR 44 /* MAC Status/Error Interrupt */ |
52 | #define IRQ_UART0_RX 18 /*DMA8 Interrupt (UART0 RX) */ | 52 | #define IRQ_SPORT0_ERROR 45 /* SPORT0 Error Interrupt */ |
53 | #define IRQ_UART0_TX 19 /*DMA9 Interrupt (UART0 TX) */ | 53 | #define IRQ_SPORT1_ERROR 46 /* SPORT1 Error Interrupt */ |
54 | #define IRQ_UART1_RX 20 /*DMA10 Interrupt (UART1 RX) */ | 54 | #define IRQ_SPI_ERROR 47 /* SPI Error Interrupt */ |
55 | #define IRQ_UART1_TX 21 /*DMA11 Interrupt (UART1 TX) */ | 55 | #define IRQ_UART0_ERROR 48 /* UART Error Interrupt */ |
56 | #define IRQ_CAN_RX 22 /*CAN Receive Interrupt */ | 56 | #define IRQ_UART1_ERROR 49 /* UART Error Interrupt */ |
57 | #define IRQ_CAN_TX 23 /*CAN Transmit Interrupt */ | 57 | |
58 | #define IRQ_MAC_RX 24 /*DMA1 (Ethernet RX) Interrupt */ | 58 | #define IRQ_PF0 50 |
59 | #define IRQ_MAC_TX 25 /*DMA2 (Ethernet TX) Interrupt */ | 59 | #define IRQ_PF1 51 |
60 | #define IRQ_TIMER0 26 /*Timer 0 */ | 60 | #define IRQ_PF2 52 |
61 | #define IRQ_TIMER1 27 /*Timer 1 */ | 61 | #define IRQ_PF3 53 |
62 | #define IRQ_TIMER2 28 /*Timer 2 */ | 62 | #define IRQ_PF4 54 |
63 | #define IRQ_TIMER3 29 /*Timer 3 */ | 63 | #define IRQ_PF5 55 |
64 | #define IRQ_TIMER4 30 /*Timer 4 */ | 64 | #define IRQ_PF6 56 |
65 | #define IRQ_TIMER5 31 /*Timer 5 */ | 65 | #define IRQ_PF7 57 |
66 | #define IRQ_TIMER6 32 /*Timer 6 */ | 66 | #define IRQ_PF8 58 |
67 | #define IRQ_TIMER7 33 /*Timer 7 */ | 67 | #define IRQ_PF9 59 |
68 | #define IRQ_PROG_INTA 34 /* PF Ports F&G (PF15:0) Interrupt A */ | 68 | #define IRQ_PF10 60 |
69 | #define IRQ_PORTG_INTB 35 /* PF Port G (PF15:0) Interrupt B */ | 69 | #define IRQ_PF11 61 |
70 | #define IRQ_MEM_DMA0 36 /*(Memory DMA Stream 0) */ | 70 | #define IRQ_PF12 62 |
71 | #define IRQ_MEM_DMA1 37 /*(Memory DMA Stream 1) */ | 71 | #define IRQ_PF13 63 |
72 | #define IRQ_PROG_INTB 38 /* PF Ports F (PF15:0) Interrupt B */ | 72 | #define IRQ_PF14 64 |
73 | #define IRQ_WATCH 38 /*Watch Dog Timer */ | 73 | #define IRQ_PF15 65 |
74 | 74 | ||
75 | #define IRQ_PPI_ERROR 42 /*PPI Error Interrupt */ | 75 | #define IRQ_PG0 66 |
76 | #define IRQ_CAN_ERROR 43 /*CAN Error Interrupt */ | 76 | #define IRQ_PG1 67 |
77 | #define IRQ_MAC_ERROR 44 /*MAC Status/Error Interrupt */ | 77 | #define IRQ_PG2 68 |
78 | #define IRQ_SPORT0_ERROR 45 /*SPORT0 Error Interrupt */ | 78 | #define IRQ_PG3 69 |
79 | #define IRQ_SPORT1_ERROR 46 /*SPORT1 Error Interrupt */ | 79 | #define IRQ_PG4 70 |
80 | #define IRQ_SPI_ERROR 47 /*SPI Error Interrupt */ | 80 | #define IRQ_PG5 71 |
81 | #define IRQ_UART0_ERROR 48 /*UART Error Interrupt */ | 81 | #define IRQ_PG6 72 |
82 | #define IRQ_UART1_ERROR 49 /*UART Error Interrupt */ | 82 | #define IRQ_PG7 73 |
83 | 83 | #define IRQ_PG8 74 | |
84 | #define IRQ_PF0 50 | 84 | #define IRQ_PG9 75 |
85 | #define IRQ_PF1 51 | 85 | #define IRQ_PG10 76 |
86 | #define IRQ_PF2 52 | 86 | #define IRQ_PG11 77 |
87 | #define IRQ_PF3 53 | 87 | #define IRQ_PG12 78 |
88 | #define IRQ_PF4 54 | 88 | #define IRQ_PG13 79 |
89 | #define IRQ_PF5 55 | 89 | #define IRQ_PG14 80 |
90 | #define IRQ_PF6 56 | 90 | #define IRQ_PG15 81 |
91 | #define IRQ_PF7 57 | 91 | |
92 | #define IRQ_PF8 58 | 92 | #define IRQ_PH0 82 |
93 | #define IRQ_PF9 59 | 93 | #define IRQ_PH1 83 |
94 | #define IRQ_PF10 60 | 94 | #define IRQ_PH2 84 |
95 | #define IRQ_PF11 61 | 95 | #define IRQ_PH3 85 |
96 | #define IRQ_PF12 62 | 96 | #define IRQ_PH4 86 |
97 | #define IRQ_PF13 63 | 97 | #define IRQ_PH5 87 |
98 | #define IRQ_PF14 64 | 98 | #define IRQ_PH6 88 |
99 | #define IRQ_PF15 65 | 99 | #define IRQ_PH7 89 |
100 | 100 | #define IRQ_PH8 90 | |
101 | #define IRQ_PG0 66 | 101 | #define IRQ_PH9 91 |
102 | #define IRQ_PG1 67 | 102 | #define IRQ_PH10 92 |
103 | #define IRQ_PG2 68 | 103 | #define IRQ_PH11 93 |
104 | #define IRQ_PG3 69 | 104 | #define IRQ_PH12 94 |
105 | #define IRQ_PG4 70 | 105 | #define IRQ_PH13 95 |
106 | #define IRQ_PG5 71 | 106 | #define IRQ_PH14 96 |
107 | #define IRQ_PG6 72 | 107 | #define IRQ_PH15 97 |
108 | #define IRQ_PG7 73 | 108 | |
109 | #define IRQ_PG8 74 | 109 | #define GPIO_IRQ_BASE IRQ_PF0 |
110 | #define IRQ_PG9 75 | 110 | |
111 | #define IRQ_PG10 76 | 111 | #define IRQ_MAC_PHYINT 98 /* PHY_INT Interrupt */ |
112 | #define IRQ_PG11 77 | 112 | #define IRQ_MAC_MMCINT 99 /* MMC Counter Interrupt */ |
113 | #define IRQ_PG12 78 | 113 | #define IRQ_MAC_RXFSINT 100 /* RX Frame-Status Interrupt */ |
114 | #define IRQ_PG13 79 | 114 | #define IRQ_MAC_TXFSINT 101 /* TX Frame-Status Interrupt */ |
115 | #define IRQ_PG14 80 | 115 | #define IRQ_MAC_WAKEDET 102 /* Wake-Up Interrupt */ |
116 | #define IRQ_PG15 81 | 116 | #define IRQ_MAC_RXDMAERR 103 /* RX DMA Direction Error Interrupt */ |
117 | 117 | #define IRQ_MAC_TXDMAERR 104 /* TX DMA Direction Error Interrupt */ | |
118 | #define IRQ_PH0 82 | 118 | #define IRQ_MAC_STMDONE 105 /* Station Mgt. Transfer Done Interrupt */ |
119 | #define IRQ_PH1 83 | 119 | |
120 | #define IRQ_PH2 84 | 120 | #define IRQ_MAC_RX 106 /* DMA1 Interrupt (Ethernet RX) */ |
121 | #define IRQ_PH3 85 | 121 | #define IRQ_PORTH_INTA 107 /* Port H Interrupt A */ |
122 | #define IRQ_PH4 86 | 122 | |
123 | #define IRQ_PH5 87 | 123 | #if 0 /* No Interrupt B support (yet) */ |
124 | #define IRQ_PH6 88 | 124 | #define IRQ_MAC_TX 108 /* DMA2 Interrupt (Ethernet TX) */ |
125 | #define IRQ_PH7 89 | 125 | #define IRQ_PORTH_INTB 109 /* Port H Interrupt B */ |
126 | #define IRQ_PH8 90 | 126 | #else |
127 | #define IRQ_PH9 91 | 127 | #define IRQ_MAC_TX IRQ_PH_INTB_MAC_TX |
128 | #define IRQ_PH10 92 | 128 | #endif |
129 | #define IRQ_PH11 93 | 129 | |
130 | #define IRQ_PH12 94 | 130 | #define IRQ_PORTF_INTA 110 /* Port F Interrupt A */ |
131 | #define IRQ_PH13 95 | 131 | #define IRQ_PORTG_INTA 111 /* Port G Interrupt A */ |
132 | #define IRQ_PH14 96 | 132 | |
133 | #define IRQ_PH15 97 | 133 | #if 0 /* No Interrupt B support (yet) */ |
134 | 134 | #define IRQ_WATCH 112 /* Watchdog Timer */ | |
135 | #define GPIO_IRQ_BASE IRQ_PF0 | 135 | #define IRQ_PORTF_INTB 113 /* Port F Interrupt B */ |
136 | 136 | #else | |
137 | #define IRQ_MAC_PHYINT 98 /* PHY_INT Interrupt */ | 137 | #define IRQ_WATCH IRQ_PF_INTB_WATCH |
138 | #define IRQ_MAC_MMCINT 99 /* MMC Counter Interrupt */ | 138 | #endif |
139 | #define IRQ_MAC_RXFSINT 100 /* RX Frame-Status Interrupt */ | 139 | |
140 | #define IRQ_MAC_TXFSINT 101 /* TX Frame-Status Interrupt */ | 140 | #define NR_MACH_IRQS (113 + 1) |
141 | #define IRQ_MAC_WAKEDET 102 /* Wake-Up Interrupt */ | 141 | |
142 | #define IRQ_MAC_RXDMAERR 103 /* RX DMA Direction Error Interrupt */ | 142 | /* IAR0 BIT FIELDS */ |
143 | #define IRQ_MAC_TXDMAERR 104 /* TX DMA Direction Error Interrupt */ | 143 | #define IRQ_PLL_WAKEUP_POS 0 |
144 | #define IRQ_MAC_STMDONE 105 /* Station Mgt. Transfer Done Interrupt */ | 144 | #define IRQ_DMA_ERROR_POS 4 |
145 | 145 | #define IRQ_ERROR_POS 8 | |
146 | #define NR_MACH_IRQS (IRQ_MAC_STMDONE + 1) | 146 | #define IRQ_RTC_POS 12 |
147 | #define NR_IRQS (NR_MACH_IRQS + NR_SPARE_IRQS) | 147 | #define IRQ_PPI_POS 16 |
148 | 148 | #define IRQ_SPORT0_RX_POS 20 | |
149 | #define IVG7 7 | 149 | #define IRQ_SPORT0_TX_POS 24 |
150 | #define IVG8 8 | 150 | #define IRQ_SPORT1_RX_POS 28 |
151 | #define IVG9 9 | 151 | |
152 | #define IVG10 10 | 152 | /* IAR1 BIT FIELDS */ |
153 | #define IVG11 11 | 153 | #define IRQ_SPORT1_TX_POS 0 |
154 | #define IVG12 12 | 154 | #define IRQ_TWI_POS 4 |
155 | #define IVG13 13 | 155 | #define IRQ_SPI_POS 8 |
156 | #define IVG14 14 | 156 | #define IRQ_UART0_RX_POS 12 |
157 | #define IVG15 15 | 157 | #define IRQ_UART0_TX_POS 16 |
158 | 158 | #define IRQ_UART1_RX_POS 20 | |
159 | /* IAR0 BIT FIELDS*/ | 159 | #define IRQ_UART1_TX_POS 24 |
160 | #define IRQ_PLL_WAKEUP_POS 0 | 160 | #define IRQ_CAN_RX_POS 28 |
161 | #define IRQ_DMA_ERROR_POS 4 | 161 | |
162 | #define IRQ_ERROR_POS 8 | 162 | /* IAR2 BIT FIELDS */ |
163 | #define IRQ_RTC_POS 12 | 163 | #define IRQ_CAN_TX_POS 0 |
164 | #define IRQ_PPI_POS 16 | 164 | #define IRQ_MAC_RX_POS 4 |
165 | #define IRQ_SPORT0_RX_POS 20 | 165 | #define IRQ_MAC_TX_POS 8 |
166 | #define IRQ_SPORT0_TX_POS 24 | 166 | #define IRQ_TIMER0_POS 12 |
167 | #define IRQ_SPORT1_RX_POS 28 | 167 | #define IRQ_TIMER1_POS 16 |
168 | 168 | #define IRQ_TIMER2_POS 20 | |
169 | /* IAR1 BIT FIELDS*/ | 169 | #define IRQ_TIMER3_POS 24 |
170 | #define IRQ_SPORT1_TX_POS 0 | 170 | #define IRQ_TIMER4_POS 28 |
171 | #define IRQ_TWI_POS 4 | 171 | |
172 | #define IRQ_SPI_POS 8 | 172 | /* IAR3 BIT FIELDS */ |
173 | #define IRQ_UART0_RX_POS 12 | 173 | #define IRQ_TIMER5_POS 0 |
174 | #define IRQ_UART0_TX_POS 16 | 174 | #define IRQ_TIMER6_POS 4 |
175 | #define IRQ_UART1_RX_POS 20 | 175 | #define IRQ_TIMER7_POS 8 |
176 | #define IRQ_UART1_TX_POS 24 | 176 | #define IRQ_PROG_INTA_POS 12 |
177 | #define IRQ_CAN_RX_POS 28 | 177 | #define IRQ_PORTG_INTB_POS 16 |
178 | 178 | #define IRQ_MEM_DMA0_POS 20 | |
179 | /* IAR2 BIT FIELDS*/ | 179 | #define IRQ_MEM_DMA1_POS 24 |
180 | #define IRQ_CAN_TX_POS 0 | 180 | #define IRQ_WATCH_POS 28 |
181 | #define IRQ_MAC_RX_POS 4 | 181 | |
182 | #define IRQ_MAC_TX_POS 8 | 182 | #define init_mach_irq init_mach_irq |
183 | #define IRQ_TIMER0_POS 12 | 183 | |
184 | #define IRQ_TIMER1_POS 16 | 184 | #endif |
185 | #define IRQ_TIMER2_POS 20 | ||
186 | #define IRQ_TIMER3_POS 24 | ||
187 | #define IRQ_TIMER4_POS 28 | ||
188 | |||
189 | /* IAR3 BIT FIELDS*/ | ||
190 | #define IRQ_TIMER5_POS 0 | ||
191 | #define IRQ_TIMER6_POS 4 | ||
192 | #define IRQ_TIMER7_POS 8 | ||
193 | #define IRQ_PROG_INTA_POS 12 | ||
194 | #define IRQ_PORTG_INTB_POS 16 | ||
195 | #define IRQ_MEM_DMA0_POS 20 | ||
196 | #define IRQ_MEM_DMA1_POS 24 | ||
197 | #define IRQ_WATCH_POS 28 | ||
198 | |||
199 | #endif /* _BF537_IRQ_H_ */ | ||
diff --git a/arch/blackfin/mach-bf537/ints-priority.c b/arch/blackfin/mach-bf537/ints-priority.c index f6500622b35d..2137a209a22b 100644 --- a/arch/blackfin/mach-bf537/ints-priority.c +++ b/arch/blackfin/mach-bf537/ints-priority.c | |||
@@ -10,6 +10,13 @@ | |||
10 | #include <linux/irq.h> | 10 | #include <linux/irq.h> |
11 | #include <asm/blackfin.h> | 11 | #include <asm/blackfin.h> |
12 | 12 | ||
13 | #include <asm/irq_handler.h> | ||
14 | #include <asm/bfin5xx_spi.h> | ||
15 | #include <asm/bfin_sport.h> | ||
16 | #include <asm/bfin_can.h> | ||
17 | #include <asm/bfin_dma.h> | ||
18 | #include <asm/dpmc.h> | ||
19 | |||
13 | void __init program_IAR(void) | 20 | void __init program_IAR(void) |
14 | { | 21 | { |
15 | /* Program the IAR0 Register with the configured priority */ | 22 | /* Program the IAR0 Register with the configured priority */ |
@@ -51,3 +58,159 @@ void __init program_IAR(void) | |||
51 | 58 | ||
52 | SSYNC(); | 59 | SSYNC(); |
53 | } | 60 | } |
61 | |||
62 | #define SPI_ERR_MASK (BIT_STAT_TXCOL | BIT_STAT_RBSY | BIT_STAT_MODF | BIT_STAT_TXE) /* SPI_STAT */ | ||
63 | #define SPORT_ERR_MASK (ROVF | RUVF | TOVF | TUVF) /* SPORT_STAT */ | ||
64 | #define PPI_ERR_MASK (0xFFFF & ~FLD) /* PPI_STATUS */ | ||
65 | #define EMAC_ERR_MASK (PHYINT | MMCINT | RXFSINT | TXFSINT | WAKEDET | RXDMAERR | TXDMAERR | STMDONE) /* EMAC_SYSTAT */ | ||
66 | #define UART_ERR_MASK (0x6) /* UART_IIR */ | ||
67 | #define CAN_ERR_MASK (EWTIF | EWRIF | EPIF | BOIF | WUIF | UIAIF | AAIF | RMLIF | UCEIF | EXTIF | ADIF) /* CAN_GIF */ | ||
68 | |||
69 | static int error_int_mask; | ||
70 | |||
71 | static void bf537_generic_error_mask_irq(struct irq_data *d) | ||
72 | { | ||
73 | error_int_mask &= ~(1L << (d->irq - IRQ_PPI_ERROR)); | ||
74 | if (!error_int_mask) | ||
75 | bfin_internal_mask_irq(IRQ_GENERIC_ERROR); | ||
76 | } | ||
77 | |||
78 | static void bf537_generic_error_unmask_irq(struct irq_data *d) | ||
79 | { | ||
80 | bfin_internal_unmask_irq(IRQ_GENERIC_ERROR); | ||
81 | error_int_mask |= 1L << (d->irq - IRQ_PPI_ERROR); | ||
82 | } | ||
83 | |||
84 | static struct irq_chip bf537_generic_error_irqchip = { | ||
85 | .name = "ERROR", | ||
86 | .irq_ack = bfin_ack_noop, | ||
87 | .irq_mask_ack = bf537_generic_error_mask_irq, | ||
88 | .irq_mask = bf537_generic_error_mask_irq, | ||
89 | .irq_unmask = bf537_generic_error_unmask_irq, | ||
90 | }; | ||
91 | |||
92 | static void bf537_demux_error_irq(unsigned int int_err_irq, | ||
93 | struct irq_desc *inta_desc) | ||
94 | { | ||
95 | int irq = 0; | ||
96 | |||
97 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) | ||
98 | if (bfin_read_EMAC_SYSTAT() & EMAC_ERR_MASK) | ||
99 | irq = IRQ_MAC_ERROR; | ||
100 | else | ||
101 | #endif | ||
102 | if (bfin_read_SPORT0_STAT() & SPORT_ERR_MASK) | ||
103 | irq = IRQ_SPORT0_ERROR; | ||
104 | else if (bfin_read_SPORT1_STAT() & SPORT_ERR_MASK) | ||
105 | irq = IRQ_SPORT1_ERROR; | ||
106 | else if (bfin_read_PPI_STATUS() & PPI_ERR_MASK) | ||
107 | irq = IRQ_PPI_ERROR; | ||
108 | else if (bfin_read_CAN_GIF() & CAN_ERR_MASK) | ||
109 | irq = IRQ_CAN_ERROR; | ||
110 | else if (bfin_read_SPI_STAT() & SPI_ERR_MASK) | ||
111 | irq = IRQ_SPI_ERROR; | ||
112 | else if ((bfin_read_UART0_IIR() & UART_ERR_MASK) == UART_ERR_MASK) | ||
113 | irq = IRQ_UART0_ERROR; | ||
114 | else if ((bfin_read_UART1_IIR() & UART_ERR_MASK) == UART_ERR_MASK) | ||
115 | irq = IRQ_UART1_ERROR; | ||
116 | |||
117 | if (irq) { | ||
118 | if (error_int_mask & (1L << (irq - IRQ_PPI_ERROR))) | ||
119 | bfin_handle_irq(irq); | ||
120 | else { | ||
121 | |||
122 | switch (irq) { | ||
123 | case IRQ_PPI_ERROR: | ||
124 | bfin_write_PPI_STATUS(PPI_ERR_MASK); | ||
125 | break; | ||
126 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) | ||
127 | case IRQ_MAC_ERROR: | ||
128 | bfin_write_EMAC_SYSTAT(EMAC_ERR_MASK); | ||
129 | break; | ||
130 | #endif | ||
131 | case IRQ_SPORT0_ERROR: | ||
132 | bfin_write_SPORT0_STAT(SPORT_ERR_MASK); | ||
133 | break; | ||
134 | |||
135 | case IRQ_SPORT1_ERROR: | ||
136 | bfin_write_SPORT1_STAT(SPORT_ERR_MASK); | ||
137 | break; | ||
138 | |||
139 | case IRQ_CAN_ERROR: | ||
140 | bfin_write_CAN_GIS(CAN_ERR_MASK); | ||
141 | break; | ||
142 | |||
143 | case IRQ_SPI_ERROR: | ||
144 | bfin_write_SPI_STAT(SPI_ERR_MASK); | ||
145 | break; | ||
146 | |||
147 | default: | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | pr_debug("IRQ %d:" | ||
152 | " MASKED PERIPHERAL ERROR INTERRUPT ASSERTED\n", | ||
153 | irq); | ||
154 | } | ||
155 | } else | ||
156 | pr_err("%s: IRQ ?: PERIPHERAL ERROR INTERRUPT ASSERTED BUT NO SOURCE FOUND\n", | ||
157 | __func__); | ||
158 | |||
159 | } | ||
160 | |||
161 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | ||
162 | static int mac_rx_int_mask; | ||
163 | |||
164 | static void bf537_mac_rx_mask_irq(struct irq_data *d) | ||
165 | { | ||
166 | mac_rx_int_mask &= ~(1L << (d->irq - IRQ_MAC_RX)); | ||
167 | if (!mac_rx_int_mask) | ||
168 | bfin_internal_mask_irq(IRQ_PH_INTA_MAC_RX); | ||
169 | } | ||
170 | |||
171 | static void bf537_mac_rx_unmask_irq(struct irq_data *d) | ||
172 | { | ||
173 | bfin_internal_unmask_irq(IRQ_PH_INTA_MAC_RX); | ||
174 | mac_rx_int_mask |= 1L << (d->irq - IRQ_MAC_RX); | ||
175 | } | ||
176 | |||
177 | static struct irq_chip bf537_mac_rx_irqchip = { | ||
178 | .name = "ERROR", | ||
179 | .irq_ack = bfin_ack_noop, | ||
180 | .irq_mask_ack = bf537_mac_rx_mask_irq, | ||
181 | .irq_mask = bf537_mac_rx_mask_irq, | ||
182 | .irq_unmask = bf537_mac_rx_unmask_irq, | ||
183 | }; | ||
184 | |||
185 | static void bf537_demux_mac_rx_irq(unsigned int int_irq, | ||
186 | struct irq_desc *desc) | ||
187 | { | ||
188 | if (bfin_read_DMA1_IRQ_STATUS() & (DMA_DONE | DMA_ERR)) | ||
189 | bfin_handle_irq(IRQ_MAC_RX); | ||
190 | else | ||
191 | bfin_demux_gpio_irq(int_irq, desc); | ||
192 | } | ||
193 | #endif | ||
194 | |||
195 | void __init init_mach_irq(void) | ||
196 | { | ||
197 | int irq; | ||
198 | |||
199 | #if defined(CONFIG_BF537) || defined(CONFIG_BF536) | ||
200 | /* Clear EMAC Interrupt Status bits so we can demux it later */ | ||
201 | bfin_write_EMAC_SYSTAT(-1); | ||
202 | #endif | ||
203 | |||
204 | irq_set_chained_handler(IRQ_GENERIC_ERROR, bf537_demux_error_irq); | ||
205 | for (irq = IRQ_PPI_ERROR; irq <= IRQ_UART1_ERROR; irq++) | ||
206 | irq_set_chip_and_handler(irq, &bf537_generic_error_irqchip, | ||
207 | handle_level_irq); | ||
208 | |||
209 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | ||
210 | irq_set_chained_handler(IRQ_PH_INTA_MAC_RX, bf537_demux_mac_rx_irq); | ||
211 | irq_set_chip_and_handler(IRQ_MAC_RX, &bf537_mac_rx_irqchip, handle_level_irq); | ||
212 | irq_set_chip_and_handler(IRQ_PORTH_INTA, &bf537_mac_rx_irqchip, handle_level_irq); | ||
213 | |||
214 | irq_set_chained_handler(IRQ_MAC_ERROR, bfin_demux_mac_status_irq); | ||
215 | #endif | ||
216 | } | ||
diff --git a/arch/blackfin/mach-bf538/include/mach/anomaly.h b/arch/blackfin/mach-bf538/include/mach/anomaly.h index 8774b481c78e..55e7d0712a94 100644 --- a/arch/blackfin/mach-bf538/include/mach/anomaly.h +++ b/arch/blackfin/mach-bf538/include/mach/anomaly.h | |||
@@ -5,14 +5,14 @@ | |||
5 | * and can be replaced with that version at any time | 5 | * and can be replaced with that version at any time |
6 | * DO NOT EDIT THIS FILE | 6 | * DO NOT EDIT THIS FILE |
7 | * | 7 | * |
8 | * Copyright 2004-2010 Analog Devices Inc. | 8 | * Copyright 2004-2011 Analog Devices Inc. |
9 | * Licensed under the ADI BSD license. | 9 | * Licensed under the ADI BSD license. |
10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd | 10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* This file should be up to date with: | 13 | /* This file should be up to date with: |
14 | * - Revision H, 07/10/2009; ADSP-BF538/BF538F Blackfin Processor Anomaly List | 14 | * - Revision I, 05/25/2010; ADSP-BF538/BF538F Blackfin Processor Anomaly List |
15 | * - Revision M, 07/10/2009; ADSP-BF539/BF539F Blackfin Processor Anomaly List | 15 | * - Revision N, 05/25/2010; ADSP-BF539/BF539F Blackfin Processor Anomaly List |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #ifndef _MACH_ANOMALY_H_ | 18 | #ifndef _MACH_ANOMALY_H_ |
@@ -179,6 +179,7 @@ | |||
179 | #define ANOMALY_05000363 (0) | 179 | #define ANOMALY_05000363 (0) |
180 | #define ANOMALY_05000364 (0) | 180 | #define ANOMALY_05000364 (0) |
181 | #define ANOMALY_05000380 (0) | 181 | #define ANOMALY_05000380 (0) |
182 | #define ANOMALY_05000383 (0) | ||
182 | #define ANOMALY_05000386 (1) | 183 | #define ANOMALY_05000386 (1) |
183 | #define ANOMALY_05000389 (0) | 184 | #define ANOMALY_05000389 (0) |
184 | #define ANOMALY_05000400 (0) | 185 | #define ANOMALY_05000400 (0) |
@@ -186,6 +187,7 @@ | |||
186 | #define ANOMALY_05000430 (0) | 187 | #define ANOMALY_05000430 (0) |
187 | #define ANOMALY_05000432 (0) | 188 | #define ANOMALY_05000432 (0) |
188 | #define ANOMALY_05000435 (0) | 189 | #define ANOMALY_05000435 (0) |
190 | #define ANOMALY_05000440 (0) | ||
189 | #define ANOMALY_05000447 (0) | 191 | #define ANOMALY_05000447 (0) |
190 | #define ANOMALY_05000448 (0) | 192 | #define ANOMALY_05000448 (0) |
191 | #define ANOMALY_05000456 (0) | 193 | #define ANOMALY_05000456 (0) |
@@ -193,6 +195,7 @@ | |||
193 | #define ANOMALY_05000465 (0) | 195 | #define ANOMALY_05000465 (0) |
194 | #define ANOMALY_05000467 (0) | 196 | #define ANOMALY_05000467 (0) |
195 | #define ANOMALY_05000474 (0) | 197 | #define ANOMALY_05000474 (0) |
198 | #define ANOMALY_05000480 (0) | ||
196 | #define ANOMALY_05000485 (0) | 199 | #define ANOMALY_05000485 (0) |
197 | 200 | ||
198 | #endif | 201 | #endif |
diff --git a/arch/blackfin/mach-bf538/include/mach/irq.h b/arch/blackfin/mach-bf538/include/mach/irq.h index 7a479d224dc7..07ca069d37cd 100644 --- a/arch/blackfin/mach-bf538/include/mach/irq.h +++ b/arch/blackfin/mach-bf538/include/mach/irq.h | |||
@@ -7,38 +7,9 @@ | |||
7 | #ifndef _BF538_IRQ_H_ | 7 | #ifndef _BF538_IRQ_H_ |
8 | #define _BF538_IRQ_H_ | 8 | #define _BF538_IRQ_H_ |
9 | 9 | ||
10 | /* | 10 | #include <mach-common/irq.h> |
11 | * Interrupt source definitions | 11 | |
12 | Event Source Core Event Name | 12 | #define NR_PERI_INTS (2 * 32) |
13 | Core Emulation ** | ||
14 | Events (highest priority) EMU 0 | ||
15 | Reset RST 1 | ||
16 | NMI NMI 2 | ||
17 | Exception EVX 3 | ||
18 | Reserved -- 4 | ||
19 | Hardware Error IVHW 5 | ||
20 | Core Timer IVTMR 6 * | ||
21 | |||
22 | ..... | ||
23 | |||
24 | Software Interrupt 1 IVG14 31 | ||
25 | Software Interrupt 2 -- | ||
26 | (lowest priority) IVG15 32 * | ||
27 | */ | ||
28 | |||
29 | #define NR_PERI_INTS (2 * 32) | ||
30 | |||
31 | /* The ABSTRACT IRQ definitions */ | ||
32 | /** the first seven of the following are fixed, the rest you change if you need to **/ | ||
33 | #define IRQ_EMU 0 /* Emulation */ | ||
34 | #define IRQ_RST 1 /* reset */ | ||
35 | #define IRQ_NMI 2 /* Non Maskable */ | ||
36 | #define IRQ_EVX 3 /* Exception */ | ||
37 | #define IRQ_UNUSED 4 /* - unused interrupt */ | ||
38 | #define IRQ_HWERR 5 /* Hardware Error */ | ||
39 | #define IRQ_CORETMR 6 /* Core timer */ | ||
40 | |||
41 | #define BFIN_IRQ(x) ((x) + 7) | ||
42 | 13 | ||
43 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ | 14 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ |
44 | #define IRQ_DMA0_ERROR BFIN_IRQ(1) /* DMA Error 0 (generic) */ | 15 | #define IRQ_DMA0_ERROR BFIN_IRQ(1) /* DMA Error 0 (generic) */ |
@@ -91,37 +62,26 @@ | |||
91 | 62 | ||
92 | #define SYS_IRQS BFIN_IRQ(63) /* 70 */ | 63 | #define SYS_IRQS BFIN_IRQ(63) /* 70 */ |
93 | 64 | ||
94 | #define IRQ_PF0 71 | 65 | #define IRQ_PF0 71 |
95 | #define IRQ_PF1 72 | 66 | #define IRQ_PF1 72 |
96 | #define IRQ_PF2 73 | 67 | #define IRQ_PF2 73 |
97 | #define IRQ_PF3 74 | 68 | #define IRQ_PF3 74 |
98 | #define IRQ_PF4 75 | 69 | #define IRQ_PF4 75 |
99 | #define IRQ_PF5 76 | 70 | #define IRQ_PF5 76 |
100 | #define IRQ_PF6 77 | 71 | #define IRQ_PF6 77 |
101 | #define IRQ_PF7 78 | 72 | #define IRQ_PF7 78 |
102 | #define IRQ_PF8 79 | 73 | #define IRQ_PF8 79 |
103 | #define IRQ_PF9 80 | 74 | #define IRQ_PF9 80 |
104 | #define IRQ_PF10 81 | 75 | #define IRQ_PF10 81 |
105 | #define IRQ_PF11 82 | 76 | #define IRQ_PF11 82 |
106 | #define IRQ_PF12 83 | 77 | #define IRQ_PF12 83 |
107 | #define IRQ_PF13 84 | 78 | #define IRQ_PF13 84 |
108 | #define IRQ_PF14 85 | 79 | #define IRQ_PF14 85 |
109 | #define IRQ_PF15 86 | 80 | #define IRQ_PF15 86 |
110 | 81 | ||
111 | #define GPIO_IRQ_BASE IRQ_PF0 | 82 | #define GPIO_IRQ_BASE IRQ_PF0 |
112 | 83 | ||
113 | #define NR_MACH_IRQS (IRQ_PF15 + 1) | 84 | #define NR_MACH_IRQS (IRQ_PF15 + 1) |
114 | #define NR_IRQS (NR_MACH_IRQS + NR_SPARE_IRQS) | ||
115 | |||
116 | #define IVG7 7 | ||
117 | #define IVG8 8 | ||
118 | #define IVG9 9 | ||
119 | #define IVG10 10 | ||
120 | #define IVG11 11 | ||
121 | #define IVG12 12 | ||
122 | #define IVG13 13 | ||
123 | #define IVG14 14 | ||
124 | #define IVG15 15 | ||
125 | 85 | ||
126 | /* IAR0 BIT FIELDS */ | 86 | /* IAR0 BIT FIELDS */ |
127 | #define IRQ_PLL_WAKEUP_POS 0 | 87 | #define IRQ_PLL_WAKEUP_POS 0 |
@@ -184,4 +144,5 @@ | |||
184 | #define IRQ_CAN_TX_POS 0 | 144 | #define IRQ_CAN_TX_POS 0 |
185 | #define IRQ_MEM1_DMA0_POS 4 | 145 | #define IRQ_MEM1_DMA0_POS 4 |
186 | #define IRQ_MEM1_DMA1_POS 8 | 146 | #define IRQ_MEM1_DMA1_POS 8 |
187 | #endif /* _BF538_IRQ_H_ */ | 147 | |
148 | #endif | ||
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index 93e19a54a880..311bf9970fe7 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/gpio.h> | 22 | #include <asm/gpio.h> |
23 | #include <asm/nand.h> | 23 | #include <asm/nand.h> |
24 | #include <asm/dpmc.h> | 24 | #include <asm/dpmc.h> |
25 | #include <asm/bfin_sport.h> | ||
25 | #include <asm/portmux.h> | 26 | #include <asm/portmux.h> |
26 | #include <asm/bfin_sdh.h> | 27 | #include <asm/bfin_sdh.h> |
27 | #include <mach/bf54x_keys.h> | 28 | #include <mach/bf54x_keys.h> |
@@ -956,7 +957,15 @@ static struct mtd_partition ezkit_partitions[] = { | |||
956 | .offset = MTDPART_OFS_APPEND, | 957 | .offset = MTDPART_OFS_APPEND, |
957 | }, { | 958 | }, { |
958 | .name = "file system(nor)", | 959 | .name = "file system(nor)", |
959 | .size = MTDPART_SIZ_FULL, | 960 | .size = 0x1000000 - 0x80000 - 0x400000 - 0x8000 * 4, |
961 | .offset = MTDPART_OFS_APPEND, | ||
962 | }, { | ||
963 | .name = "config(nor)", | ||
964 | .size = 0x8000 * 3, | ||
965 | .offset = MTDPART_OFS_APPEND, | ||
966 | }, { | ||
967 | .name = "u-boot env(nor)", | ||
968 | .size = 0x8000, | ||
960 | .offset = MTDPART_OFS_APPEND, | 969 | .offset = MTDPART_OFS_APPEND, |
961 | } | 970 | } |
962 | }; | 971 | }; |
@@ -1312,27 +1321,110 @@ static struct platform_device bfin_dpmc = { | |||
1312 | }, | 1321 | }, |
1313 | }; | 1322 | }; |
1314 | 1323 | ||
1315 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) | 1324 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ |
1325 | defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \ | ||
1326 | defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) | ||
1327 | |||
1328 | #define SPORT_REQ(x) \ | ||
1329 | [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \ | ||
1330 | P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0} | ||
1331 | |||
1332 | static const u16 bfin_snd_pin[][7] = { | ||
1333 | SPORT_REQ(0), | ||
1334 | SPORT_REQ(1), | ||
1335 | }; | ||
1336 | |||
1337 | static struct bfin_snd_platform_data bfin_snd_data[] = { | ||
1338 | { | ||
1339 | .pin_req = &bfin_snd_pin[0][0], | ||
1340 | }, | ||
1341 | { | ||
1342 | .pin_req = &bfin_snd_pin[1][0], | ||
1343 | }, | ||
1344 | }; | ||
1345 | |||
1346 | #define BFIN_SND_RES(x) \ | ||
1347 | [x] = { \ | ||
1348 | { \ | ||
1349 | .start = SPORT##x##_TCR1, \ | ||
1350 | .end = SPORT##x##_TCR1, \ | ||
1351 | .flags = IORESOURCE_MEM \ | ||
1352 | }, \ | ||
1353 | { \ | ||
1354 | .start = CH_SPORT##x##_RX, \ | ||
1355 | .end = CH_SPORT##x##_RX, \ | ||
1356 | .flags = IORESOURCE_DMA, \ | ||
1357 | }, \ | ||
1358 | { \ | ||
1359 | .start = CH_SPORT##x##_TX, \ | ||
1360 | .end = CH_SPORT##x##_TX, \ | ||
1361 | .flags = IORESOURCE_DMA, \ | ||
1362 | }, \ | ||
1363 | { \ | ||
1364 | .start = IRQ_SPORT##x##_ERROR, \ | ||
1365 | .end = IRQ_SPORT##x##_ERROR, \ | ||
1366 | .flags = IORESOURCE_IRQ, \ | ||
1367 | } \ | ||
1368 | } | ||
1369 | |||
1370 | static struct resource bfin_snd_resources[][4] = { | ||
1371 | BFIN_SND_RES(0), | ||
1372 | BFIN_SND_RES(1), | ||
1373 | }; | ||
1374 | |||
1375 | static struct platform_device bfin_pcm = { | ||
1376 | .name = "bfin-pcm-audio", | ||
1377 | .id = -1, | ||
1378 | }; | ||
1379 | #endif | ||
1380 | |||
1381 | #if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE) | ||
1382 | static struct platform_device bfin_ad73311_codec_device = { | ||
1383 | .name = "ad73311", | ||
1384 | .id = -1, | ||
1385 | }; | ||
1386 | #endif | ||
1387 | |||
1388 | #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE) | ||
1389 | static struct platform_device bfin_ad1980_codec_device = { | ||
1390 | .name = "ad1980", | ||
1391 | .id = -1, | ||
1392 | }; | ||
1393 | #endif | ||
1394 | |||
1395 | #if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE) | ||
1316 | static struct platform_device bfin_i2s = { | 1396 | static struct platform_device bfin_i2s = { |
1317 | .name = "bfin-i2s", | 1397 | .name = "bfin-i2s", |
1318 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | 1398 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
1319 | /* TODO: add platform data here */ | 1399 | .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]), |
1400 | .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM], | ||
1401 | .dev = { | ||
1402 | .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM], | ||
1403 | }, | ||
1320 | }; | 1404 | }; |
1321 | #endif | 1405 | #endif |
1322 | 1406 | ||
1323 | #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) | 1407 | #if defined(CONFIG_SND_BF5XX_SOC_TDM) || defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE) |
1324 | static struct platform_device bfin_tdm = { | 1408 | static struct platform_device bfin_tdm = { |
1325 | .name = "bfin-tdm", | 1409 | .name = "bfin-tdm", |
1326 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | 1410 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
1327 | /* TODO: add platform data here */ | 1411 | .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]), |
1412 | .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM], | ||
1413 | .dev = { | ||
1414 | .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM], | ||
1415 | }, | ||
1328 | }; | 1416 | }; |
1329 | #endif | 1417 | #endif |
1330 | 1418 | ||
1331 | #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) | 1419 | #if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE) |
1332 | static struct platform_device bfin_ac97 = { | 1420 | static struct platform_device bfin_ac97 = { |
1333 | .name = "bfin-ac97", | 1421 | .name = "bfin-ac97", |
1334 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | 1422 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
1335 | /* TODO: add platform data here */ | 1423 | .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]), |
1424 | .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM], | ||
1425 | .dev = { | ||
1426 | .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM], | ||
1427 | }, | ||
1336 | }; | 1428 | }; |
1337 | #endif | 1429 | #endif |
1338 | 1430 | ||
@@ -1450,6 +1542,16 @@ static struct platform_device *ezkit_devices[] __initdata = { | |||
1450 | &ezkit_flash_device, | 1542 | &ezkit_flash_device, |
1451 | #endif | 1543 | #endif |
1452 | 1544 | ||
1545 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ | ||
1546 | defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \ | ||
1547 | defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) | ||
1548 | &bfin_pcm, | ||
1549 | #endif | ||
1550 | |||
1551 | #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE) | ||
1552 | &bfin_ad1980_codec_device, | ||
1553 | #endif | ||
1554 | |||
1453 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) | 1555 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) |
1454 | &bfin_i2s, | 1556 | &bfin_i2s, |
1455 | #endif | 1557 | #endif |
diff --git a/arch/blackfin/mach-bf548/include/mach/anomaly.h b/arch/blackfin/mach-bf548/include/mach/anomaly.h index ffd0537295ac..9e70785bdde3 100644 --- a/arch/blackfin/mach-bf548/include/mach/anomaly.h +++ b/arch/blackfin/mach-bf548/include/mach/anomaly.h | |||
@@ -5,13 +5,13 @@ | |||
5 | * and can be replaced with that version at any time | 5 | * and can be replaced with that version at any time |
6 | * DO NOT EDIT THIS FILE | 6 | * DO NOT EDIT THIS FILE |
7 | * | 7 | * |
8 | * Copyright 2004-2010 Analog Devices Inc. | 8 | * Copyright 2004-2011 Analog Devices Inc. |
9 | * Licensed under the ADI BSD license. | 9 | * Licensed under the ADI BSD license. |
10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd | 10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* This file should be up to date with: | 13 | /* This file should be up to date with: |
14 | * - Revision I, 07/23/2009; ADSP-BF542/BF544/BF547/BF548/BF549 Blackfin Processor Anomaly List | 14 | * - Revision J, 06/03/2010; ADSP-BF542/BF544/BF547/BF548/BF549 Blackfin Processor Anomaly List |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef _MACH_ANOMALY_H_ | 17 | #ifndef _MACH_ANOMALY_H_ |
@@ -220,6 +220,8 @@ | |||
220 | #define ANOMALY_05000481 (1) | 220 | #define ANOMALY_05000481 (1) |
221 | /* Possible USB Data Corruption When Multiple Endpoints Are Accessed by the Core */ | 221 | /* Possible USB Data Corruption When Multiple Endpoints Are Accessed by the Core */ |
222 | #define ANOMALY_05000483 (1) | 222 | #define ANOMALY_05000483 (1) |
223 | /* DDR Trim May Not Be Performed for Certain VLEV Values in OTP Page PBS00L */ | ||
224 | #define ANOMALY_05000484 (__SILICON_REVISION__ < 3) | ||
223 | /* PLL_CTL Change Using bfrom_SysControl() Can Result in Processor Overclocking */ | 225 | /* PLL_CTL Change Using bfrom_SysControl() Can Result in Processor Overclocking */ |
224 | #define ANOMALY_05000485 (__SILICON_REVISION__ >= 2) | 226 | #define ANOMALY_05000485 (__SILICON_REVISION__ >= 2) |
225 | /* IFLUSH sucks at life */ | 227 | /* IFLUSH sucks at life */ |
@@ -274,6 +276,8 @@ | |||
274 | #define ANOMALY_05000412 (0) | 276 | #define ANOMALY_05000412 (0) |
275 | #define ANOMALY_05000432 (0) | 277 | #define ANOMALY_05000432 (0) |
276 | #define ANOMALY_05000435 (0) | 278 | #define ANOMALY_05000435 (0) |
279 | #define ANOMALY_05000440 (0) | ||
277 | #define ANOMALY_05000475 (0) | 280 | #define ANOMALY_05000475 (0) |
281 | #define ANOMALY_05000480 (0) | ||
278 | 282 | ||
279 | #endif | 283 | #endif |
diff --git a/arch/blackfin/mach-bf548/include/mach/irq.h b/arch/blackfin/mach-bf548/include/mach/irq.h index 7f87787e7738..533b8095b540 100644 --- a/arch/blackfin/mach-bf548/include/mach/irq.h +++ b/arch/blackfin/mach-bf548/include/mach/irq.h | |||
@@ -7,38 +7,9 @@ | |||
7 | #ifndef _BF548_IRQ_H_ | 7 | #ifndef _BF548_IRQ_H_ |
8 | #define _BF548_IRQ_H_ | 8 | #define _BF548_IRQ_H_ |
9 | 9 | ||
10 | /* | 10 | #include <mach-common/irq.h> |
11 | * Interrupt source definitions | ||
12 | Event Source Core Event Name | ||
13 | Core Emulation ** | ||
14 | Events (highest priority) EMU 0 | ||
15 | Reset RST 1 | ||
16 | NMI NMI 2 | ||
17 | Exception EVX 3 | ||
18 | Reserved -- 4 | ||
19 | Hardware Error IVHW 5 | ||
20 | Core Timer IVTMR 6 * | ||
21 | |||
22 | ..... | ||
23 | |||
24 | Software Interrupt 1 IVG14 31 | ||
25 | Software Interrupt 2 -- | ||
26 | (lowest priority) IVG15 32 * | ||
27 | */ | ||
28 | |||
29 | #define NR_PERI_INTS (32 * 3) | ||
30 | |||
31 | /* The ABSTRACT IRQ definitions */ | ||
32 | /** the first seven of the following are fixed, the rest you change if you need to **/ | ||
33 | #define IRQ_EMU 0 /* Emulation */ | ||
34 | #define IRQ_RST 1 /* reset */ | ||
35 | #define IRQ_NMI 2 /* Non Maskable */ | ||
36 | #define IRQ_EVX 3 /* Exception */ | ||
37 | #define IRQ_UNUSED 4 /* - unused interrupt*/ | ||
38 | #define IRQ_HWERR 5 /* Hardware Error */ | ||
39 | #define IRQ_CORETMR 6 /* Core timer */ | ||
40 | 11 | ||
41 | #define BFIN_IRQ(x) ((x) + 7) | 12 | #define NR_PERI_INTS (3 * 32) |
42 | 13 | ||
43 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ | 14 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ |
44 | #define IRQ_DMAC0_ERROR BFIN_IRQ(1) /* DMAC0 Status Interrupt */ | 15 | #define IRQ_DMAC0_ERROR BFIN_IRQ(1) /* DMAC0 Status Interrupt */ |
@@ -311,49 +282,37 @@ Events (highest priority) EMU 0 | |||
311 | #define IRQ_PJ14 BFIN_PJ_IRQ(14) /* N/A */ | 282 | #define IRQ_PJ14 BFIN_PJ_IRQ(14) /* N/A */ |
312 | #define IRQ_PJ15 BFIN_PJ_IRQ(15) /* N/A */ | 283 | #define IRQ_PJ15 BFIN_PJ_IRQ(15) /* N/A */ |
313 | 284 | ||
314 | #define GPIO_IRQ_BASE IRQ_PA0 | 285 | #define GPIO_IRQ_BASE IRQ_PA0 |
315 | 286 | ||
316 | #define NR_MACH_IRQS (IRQ_PJ15 + 1) | 287 | #define NR_MACH_IRQS (IRQ_PJ15 + 1) |
317 | #define NR_IRQS (NR_MACH_IRQS + NR_SPARE_IRQS) | ||
318 | 288 | ||
319 | /* For compatibility reasons with existing code */ | 289 | /* For compatibility reasons with existing code */ |
320 | 290 | ||
321 | #define IRQ_DMAC0_ERR IRQ_DMAC0_ERROR | 291 | #define IRQ_DMAC0_ERR IRQ_DMAC0_ERROR |
322 | #define IRQ_EPPI0_ERR IRQ_EPPI0_ERROR | 292 | #define IRQ_EPPI0_ERR IRQ_EPPI0_ERROR |
323 | #define IRQ_SPORT0_ERR IRQ_SPORT0_ERROR | 293 | #define IRQ_SPORT0_ERR IRQ_SPORT0_ERROR |
324 | #define IRQ_SPORT1_ERR IRQ_SPORT1_ERROR | 294 | #define IRQ_SPORT1_ERR IRQ_SPORT1_ERROR |
325 | #define IRQ_SPI0_ERR IRQ_SPI0_ERROR | 295 | #define IRQ_SPI0_ERR IRQ_SPI0_ERROR |
326 | #define IRQ_UART0_ERR IRQ_UART0_ERROR | 296 | #define IRQ_UART0_ERR IRQ_UART0_ERROR |
327 | #define IRQ_DMAC1_ERR IRQ_DMAC1_ERROR | 297 | #define IRQ_DMAC1_ERR IRQ_DMAC1_ERROR |
328 | #define IRQ_SPORT2_ERR IRQ_SPORT2_ERROR | 298 | #define IRQ_SPORT2_ERR IRQ_SPORT2_ERROR |
329 | #define IRQ_SPORT3_ERR IRQ_SPORT3_ERROR | 299 | #define IRQ_SPORT3_ERR IRQ_SPORT3_ERROR |
330 | #define IRQ_SPI1_ERR IRQ_SPI1_ERROR | 300 | #define IRQ_SPI1_ERR IRQ_SPI1_ERROR |
331 | #define IRQ_SPI2_ERR IRQ_SPI2_ERROR | 301 | #define IRQ_SPI2_ERR IRQ_SPI2_ERROR |
332 | #define IRQ_UART1_ERR IRQ_UART1_ERROR | 302 | #define IRQ_UART1_ERR IRQ_UART1_ERROR |
333 | #define IRQ_UART2_ERR IRQ_UART2_ERROR | 303 | #define IRQ_UART2_ERR IRQ_UART2_ERROR |
334 | #define IRQ_CAN0_ERR IRQ_CAN0_ERROR | 304 | #define IRQ_CAN0_ERR IRQ_CAN0_ERROR |
335 | #define IRQ_MXVR_ERR IRQ_MXVR_ERROR | 305 | #define IRQ_MXVR_ERR IRQ_MXVR_ERROR |
336 | #define IRQ_EPPI1_ERR IRQ_EPPI1_ERROR | 306 | #define IRQ_EPPI1_ERR IRQ_EPPI1_ERROR |
337 | #define IRQ_EPPI2_ERR IRQ_EPPI2_ERROR | 307 | #define IRQ_EPPI2_ERR IRQ_EPPI2_ERROR |
338 | #define IRQ_UART3_ERR IRQ_UART3_ERROR | 308 | #define IRQ_UART3_ERR IRQ_UART3_ERROR |
339 | #define IRQ_HOST_ERR IRQ_HOST_ERROR | 309 | #define IRQ_HOST_ERR IRQ_HOST_ERROR |
340 | #define IRQ_PIXC_ERR IRQ_PIXC_ERROR | 310 | #define IRQ_PIXC_ERR IRQ_PIXC_ERROR |
341 | #define IRQ_NFC_ERR IRQ_NFC_ERROR | 311 | #define IRQ_NFC_ERR IRQ_NFC_ERROR |
342 | #define IRQ_ATAPI_ERR IRQ_ATAPI_ERROR | 312 | #define IRQ_ATAPI_ERR IRQ_ATAPI_ERROR |
343 | #define IRQ_CAN1_ERR IRQ_CAN1_ERROR | 313 | #define IRQ_CAN1_ERR IRQ_CAN1_ERROR |
344 | #define IRQ_HS_DMA_ERR IRQ_HS_DMA_ERROR | 314 | #define IRQ_HS_DMA_ERR IRQ_HS_DMA_ERROR |
345 | 315 | ||
346 | |||
347 | #define IVG7 7 | ||
348 | #define IVG8 8 | ||
349 | #define IVG9 9 | ||
350 | #define IVG10 10 | ||
351 | #define IVG11 11 | ||
352 | #define IVG12 12 | ||
353 | #define IVG13 13 | ||
354 | #define IVG14 14 | ||
355 | #define IVG15 15 | ||
356 | |||
357 | /* IAR0 BIT FIELDS */ | 316 | /* IAR0 BIT FIELDS */ |
358 | #define IRQ_PLL_WAKEUP_POS 0 | 317 | #define IRQ_PLL_WAKEUP_POS 0 |
359 | #define IRQ_DMAC0_ERR_POS 4 | 318 | #define IRQ_DMAC0_ERR_POS 4 |
@@ -492,4 +451,4 @@ struct bfin_pint_regs { | |||
492 | 451 | ||
493 | #endif | 452 | #endif |
494 | 453 | ||
495 | #endif /* _BF548_IRQ_H_ */ | 454 | #endif |
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c index f667e7704197..5067984a62e7 100644 --- a/arch/blackfin/mach-bf561/boards/ezkit.c +++ b/arch/blackfin/mach-bf561/boards/ezkit.c | |||
@@ -247,7 +247,15 @@ static struct mtd_partition ezkit_partitions[] = { | |||
247 | .offset = MTDPART_OFS_APPEND, | 247 | .offset = MTDPART_OFS_APPEND, |
248 | }, { | 248 | }, { |
249 | .name = "file system(nor)", | 249 | .name = "file system(nor)", |
250 | .size = MTDPART_SIZ_FULL, | 250 | .size = 0x800000 - 0x40000 - 0x1C0000 - 0x2000 * 8, |
251 | .offset = MTDPART_OFS_APPEND, | ||
252 | }, { | ||
253 | .name = "config(nor)", | ||
254 | .size = 0x2000 * 7, | ||
255 | .offset = MTDPART_OFS_APPEND, | ||
256 | }, { | ||
257 | .name = "u-boot env(nor)", | ||
258 | .size = 0x2000, | ||
251 | .offset = MTDPART_OFS_APPEND, | 259 | .offset = MTDPART_OFS_APPEND, |
252 | } | 260 | } |
253 | }; | 261 | }; |
diff --git a/arch/blackfin/mach-bf561/include/mach/anomaly.h b/arch/blackfin/mach-bf561/include/mach/anomaly.h index 6a3499b02097..22b5ab773027 100644 --- a/arch/blackfin/mach-bf561/include/mach/anomaly.h +++ b/arch/blackfin/mach-bf561/include/mach/anomaly.h | |||
@@ -5,13 +5,13 @@ | |||
5 | * and can be replaced with that version at any time | 5 | * and can be replaced with that version at any time |
6 | * DO NOT EDIT THIS FILE | 6 | * DO NOT EDIT THIS FILE |
7 | * | 7 | * |
8 | * Copyright 2004-2010 Analog Devices Inc. | 8 | * Copyright 2004-2011 Analog Devices Inc. |
9 | * Licensed under the ADI BSD license. | 9 | * Licensed under the ADI BSD license. |
10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd | 10 | * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* This file should be up to date with: | 13 | /* This file should be up to date with: |
14 | * - Revision Q, 11/07/2008; ADSP-BF561 Blackfin Processor Anomaly List | 14 | * - Revision R, 05/25/2010; ADSP-BF561 Blackfin Processor Anomaly List |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef _MACH_ANOMALY_H_ | 17 | #ifndef _MACH_ANOMALY_H_ |
@@ -290,12 +290,18 @@ | |||
290 | #define ANOMALY_05000428 (__SILICON_REVISION__ > 3) | 290 | #define ANOMALY_05000428 (__SILICON_REVISION__ > 3) |
291 | /* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */ | 291 | /* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */ |
292 | #define ANOMALY_05000443 (1) | 292 | #define ANOMALY_05000443 (1) |
293 | /* SCKELOW Feature Is Not Functional */ | ||
294 | #define ANOMALY_05000458 (1) | ||
293 | /* False Hardware Error when RETI Points to Invalid Memory */ | 295 | /* False Hardware Error when RETI Points to Invalid Memory */ |
294 | #define ANOMALY_05000461 (1) | 296 | #define ANOMALY_05000461 (1) |
297 | /* Synchronization Problem at Startup May Cause SPORT Transmit Channels to Misalign */ | ||
298 | #define ANOMALY_05000462 (1) | ||
299 | /* Boot Failure When SDRAM Control Signals Toggle Coming Out Of Reset */ | ||
300 | #define ANOMALY_05000471 (1) | ||
295 | /* Interrupted 32-Bit SPORT Data Register Access Results In Underflow */ | 301 | /* Interrupted 32-Bit SPORT Data Register Access Results In Underflow */ |
296 | #define ANOMALY_05000473 (1) | 302 | #define ANOMALY_05000473 (1) |
297 | /* Possible Lockup Condition whem Modifying PLL from External Memory */ | 303 | /* Possible Lockup Condition whem Modifying PLL from External Memory */ |
298 | #define ANOMALY_05000475 (__SILICON_REVISION__ < 4) | 304 | #define ANOMALY_05000475 (1) |
299 | /* TESTSET Instruction Cannot Be Interrupted */ | 305 | /* TESTSET Instruction Cannot Be Interrupted */ |
300 | #define ANOMALY_05000477 (1) | 306 | #define ANOMALY_05000477 (1) |
301 | /* Reads of ITEST_COMMAND and ITEST_DATA Registers Cause Cache Corruption */ | 307 | /* Reads of ITEST_COMMAND and ITEST_DATA Registers Cause Cache Corruption */ |
@@ -314,12 +320,14 @@ | |||
314 | #define ANOMALY_05000353 (1) | 320 | #define ANOMALY_05000353 (1) |
315 | #define ANOMALY_05000364 (0) | 321 | #define ANOMALY_05000364 (0) |
316 | #define ANOMALY_05000380 (0) | 322 | #define ANOMALY_05000380 (0) |
323 | #define ANOMALY_05000383 (0) | ||
317 | #define ANOMALY_05000386 (1) | 324 | #define ANOMALY_05000386 (1) |
318 | #define ANOMALY_05000389 (0) | 325 | #define ANOMALY_05000389 (0) |
319 | #define ANOMALY_05000400 (0) | 326 | #define ANOMALY_05000400 (0) |
320 | #define ANOMALY_05000430 (0) | 327 | #define ANOMALY_05000430 (0) |
321 | #define ANOMALY_05000432 (0) | 328 | #define ANOMALY_05000432 (0) |
322 | #define ANOMALY_05000435 (0) | 329 | #define ANOMALY_05000435 (0) |
330 | #define ANOMALY_05000440 (0) | ||
323 | #define ANOMALY_05000447 (0) | 331 | #define ANOMALY_05000447 (0) |
324 | #define ANOMALY_05000448 (0) | 332 | #define ANOMALY_05000448 (0) |
325 | #define ANOMALY_05000456 (0) | 333 | #define ANOMALY_05000456 (0) |
@@ -327,6 +335,7 @@ | |||
327 | #define ANOMALY_05000465 (0) | 335 | #define ANOMALY_05000465 (0) |
328 | #define ANOMALY_05000467 (0) | 336 | #define ANOMALY_05000467 (0) |
329 | #define ANOMALY_05000474 (0) | 337 | #define ANOMALY_05000474 (0) |
338 | #define ANOMALY_05000480 (0) | ||
330 | #define ANOMALY_05000485 (0) | 339 | #define ANOMALY_05000485 (0) |
331 | 340 | ||
332 | #endif | 341 | #endif |
diff --git a/arch/blackfin/mach-bf561/include/mach/irq.h b/arch/blackfin/mach-bf561/include/mach/irq.h index c95566ade51b..d6998520f70f 100644 --- a/arch/blackfin/mach-bf561/include/mach/irq.h +++ b/arch/blackfin/mach-bf561/include/mach/irq.h | |||
@@ -7,212 +7,98 @@ | |||
7 | #ifndef _BF561_IRQ_H_ | 7 | #ifndef _BF561_IRQ_H_ |
8 | #define _BF561_IRQ_H_ | 8 | #define _BF561_IRQ_H_ |
9 | 9 | ||
10 | /*********************************************************************** | 10 | #include <mach-common/irq.h> |
11 | * Interrupt source definitions: | 11 | |
12 | Event Source Core Event Name IRQ No | 12 | #define NR_PERI_INTS (2 * 32) |
13 | (highest priority) | 13 | |
14 | Emulation Events EMU 0 | 14 | #define IRQ_PLL_WAKEUP BFIN_IRQ(0) /* PLL Wakeup Interrupt */ |
15 | Reset RST 1 | 15 | #define IRQ_DMA1_ERROR BFIN_IRQ(1) /* DMA1 Error (general) */ |
16 | NMI NMI 2 | 16 | #define IRQ_DMA_ERROR IRQ_DMA1_ERROR /* DMA1 Error (general) */ |
17 | Exception EVX 3 | 17 | #define IRQ_DMA2_ERROR BFIN_IRQ(2) /* DMA2 Error (general) */ |
18 | Reserved -- 4 | 18 | #define IRQ_IMDMA_ERROR BFIN_IRQ(3) /* IMDMA Error Interrupt */ |
19 | Hardware Error IVHW 5 | 19 | #define IRQ_PPI1_ERROR BFIN_IRQ(4) /* PPI1 Error Interrupt */ |
20 | Core Timer IVTMR 6 * | 20 | #define IRQ_PPI_ERROR IRQ_PPI1_ERROR /* PPI1 Error Interrupt */ |
21 | 21 | #define IRQ_PPI2_ERROR BFIN_IRQ(5) /* PPI2 Error Interrupt */ | |
22 | PLL Wakeup Interrupt IVG7 7 | 22 | #define IRQ_SPORT0_ERROR BFIN_IRQ(6) /* SPORT0 Error Interrupt */ |
23 | DMA1 Error (generic) IVG7 8 | 23 | #define IRQ_SPORT1_ERROR BFIN_IRQ(7) /* SPORT1 Error Interrupt */ |
24 | DMA2 Error (generic) IVG7 9 | 24 | #define IRQ_SPI_ERROR BFIN_IRQ(8) /* SPI Error Interrupt */ |
25 | IMDMA Error (generic) IVG7 10 | 25 | #define IRQ_UART_ERROR BFIN_IRQ(9) /* UART Error Interrupt */ |
26 | PPI1 Error Interrupt IVG7 11 | 26 | #define IRQ_RESERVED_ERROR BFIN_IRQ(10) /* Reversed */ |
27 | PPI2 Error Interrupt IVG7 12 | 27 | #define IRQ_DMA1_0 BFIN_IRQ(11) /* DMA1 0 Interrupt(PPI1) */ |
28 | SPORT0 Error Interrupt IVG7 13 | 28 | #define IRQ_PPI IRQ_DMA1_0 /* DMA1 0 Interrupt(PPI1) */ |
29 | SPORT1 Error Interrupt IVG7 14 | 29 | #define IRQ_PPI0 IRQ_DMA1_0 /* DMA1 0 Interrupt(PPI1) */ |
30 | SPI Error Interrupt IVG7 15 | 30 | #define IRQ_DMA1_1 BFIN_IRQ(12) /* DMA1 1 Interrupt(PPI2) */ |
31 | UART Error Interrupt IVG7 16 | 31 | #define IRQ_PPI1 IRQ_DMA1_1 /* DMA1 1 Interrupt(PPI2) */ |
32 | Reserved Interrupt IVG7 17 | 32 | #define IRQ_DMA1_2 BFIN_IRQ(13) /* DMA1 2 Interrupt */ |
33 | 33 | #define IRQ_DMA1_3 BFIN_IRQ(14) /* DMA1 3 Interrupt */ | |
34 | DMA1 0 Interrupt(PPI1) IVG8 18 | 34 | #define IRQ_DMA1_4 BFIN_IRQ(15) /* DMA1 4 Interrupt */ |
35 | DMA1 1 Interrupt(PPI2) IVG8 19 | 35 | #define IRQ_DMA1_5 BFIN_IRQ(16) /* DMA1 5 Interrupt */ |
36 | DMA1 2 Interrupt IVG8 20 | 36 | #define IRQ_DMA1_6 BFIN_IRQ(17) /* DMA1 6 Interrupt */ |
37 | DMA1 3 Interrupt IVG8 21 | 37 | #define IRQ_DMA1_7 BFIN_IRQ(18) /* DMA1 7 Interrupt */ |
38 | DMA1 4 Interrupt IVG8 22 | 38 | #define IRQ_DMA1_8 BFIN_IRQ(19) /* DMA1 8 Interrupt */ |
39 | DMA1 5 Interrupt IVG8 23 | 39 | #define IRQ_DMA1_9 BFIN_IRQ(20) /* DMA1 9 Interrupt */ |
40 | DMA1 6 Interrupt IVG8 24 | 40 | #define IRQ_DMA1_10 BFIN_IRQ(21) /* DMA1 10 Interrupt */ |
41 | DMA1 7 Interrupt IVG8 25 | 41 | #define IRQ_DMA1_11 BFIN_IRQ(22) /* DMA1 11 Interrupt */ |
42 | DMA1 8 Interrupt IVG8 26 | 42 | #define IRQ_DMA2_0 BFIN_IRQ(23) /* DMA2 0 (SPORT0 RX) */ |
43 | DMA1 9 Interrupt IVG8 27 | 43 | #define IRQ_SPORT0_RX IRQ_DMA2_0 /* DMA2 0 (SPORT0 RX) */ |
44 | DMA1 10 Interrupt IVG8 28 | 44 | #define IRQ_DMA2_1 BFIN_IRQ(24) /* DMA2 1 (SPORT0 TX) */ |
45 | DMA1 11 Interrupt IVG8 29 | 45 | #define IRQ_SPORT0_TX IRQ_DMA2_1 /* DMA2 1 (SPORT0 TX) */ |
46 | 46 | #define IRQ_DMA2_2 BFIN_IRQ(25) /* DMA2 2 (SPORT1 RX) */ | |
47 | DMA2 0 (SPORT0 RX) IVG9 30 | 47 | #define IRQ_SPORT1_RX IRQ_DMA2_2 /* DMA2 2 (SPORT1 RX) */ |
48 | DMA2 1 (SPORT0 TX) IVG9 31 | 48 | #define IRQ_DMA2_3 BFIN_IRQ(26) /* DMA2 3 (SPORT2 TX) */ |
49 | DMA2 2 (SPORT1 RX) IVG9 32 | 49 | #define IRQ_SPORT1_TX IRQ_DMA2_3 /* DMA2 3 (SPORT2 TX) */ |
50 | DMA2 3 (SPORT2 TX) IVG9 33 | 50 | #define IRQ_DMA2_4 BFIN_IRQ(27) /* DMA2 4 (SPI) */ |
51 | DMA2 4 (SPI) IVG9 34 | 51 | #define IRQ_SPI IRQ_DMA2_4 /* DMA2 4 (SPI) */ |
52 | DMA2 5 (UART RX) IVG9 35 | 52 | #define IRQ_DMA2_5 BFIN_IRQ(28) /* DMA2 5 (UART RX) */ |
53 | DMA2 6 (UART TX) IVG9 36 | 53 | #define IRQ_UART_RX IRQ_DMA2_5 /* DMA2 5 (UART RX) */ |
54 | DMA2 7 Interrupt IVG9 37 | 54 | #define IRQ_DMA2_6 BFIN_IRQ(29) /* DMA2 6 (UART TX) */ |
55 | DMA2 8 Interrupt IVG9 38 | 55 | #define IRQ_UART_TX IRQ_DMA2_6 /* DMA2 6 (UART TX) */ |
56 | DMA2 9 Interrupt IVG9 39 | 56 | #define IRQ_DMA2_7 BFIN_IRQ(30) /* DMA2 7 Interrupt */ |
57 | DMA2 10 Interrupt IVG9 40 | 57 | #define IRQ_DMA2_8 BFIN_IRQ(31) /* DMA2 8 Interrupt */ |
58 | DMA2 11 Interrupt IVG9 41 | 58 | #define IRQ_DMA2_9 BFIN_IRQ(32) /* DMA2 9 Interrupt */ |
59 | 59 | #define IRQ_DMA2_10 BFIN_IRQ(33) /* DMA2 10 Interrupt */ | |
60 | TIMER 0 Interrupt IVG10 42 | 60 | #define IRQ_DMA2_11 BFIN_IRQ(34) /* DMA2 11 Interrupt */ |
61 | TIMER 1 Interrupt IVG10 43 | 61 | #define IRQ_TIMER0 BFIN_IRQ(35) /* TIMER 0 Interrupt */ |
62 | TIMER 2 Interrupt IVG10 44 | 62 | #define IRQ_TIMER1 BFIN_IRQ(36) /* TIMER 1 Interrupt */ |
63 | TIMER 3 Interrupt IVG10 45 | 63 | #define IRQ_TIMER2 BFIN_IRQ(37) /* TIMER 2 Interrupt */ |
64 | TIMER 4 Interrupt IVG10 46 | 64 | #define IRQ_TIMER3 BFIN_IRQ(38) /* TIMER 3 Interrupt */ |
65 | TIMER 5 Interrupt IVG10 47 | 65 | #define IRQ_TIMER4 BFIN_IRQ(39) /* TIMER 4 Interrupt */ |
66 | TIMER 6 Interrupt IVG10 48 | 66 | #define IRQ_TIMER5 BFIN_IRQ(40) /* TIMER 5 Interrupt */ |
67 | TIMER 7 Interrupt IVG10 49 | 67 | #define IRQ_TIMER6 BFIN_IRQ(41) /* TIMER 6 Interrupt */ |
68 | TIMER 8 Interrupt IVG10 50 | 68 | #define IRQ_TIMER7 BFIN_IRQ(42) /* TIMER 7 Interrupt */ |
69 | TIMER 9 Interrupt IVG10 51 | 69 | #define IRQ_TIMER8 BFIN_IRQ(43) /* TIMER 8 Interrupt */ |
70 | TIMER 10 Interrupt IVG10 52 | 70 | #define IRQ_TIMER9 BFIN_IRQ(44) /* TIMER 9 Interrupt */ |
71 | TIMER 11 Interrupt IVG10 53 | 71 | #define IRQ_TIMER10 BFIN_IRQ(45) /* TIMER 10 Interrupt */ |
72 | 72 | #define IRQ_TIMER11 BFIN_IRQ(46) /* TIMER 11 Interrupt */ | |
73 | Programmable Flags0 A (8) IVG11 54 | 73 | #define IRQ_PROG0_INTA BFIN_IRQ(47) /* Programmable Flags0 A (8) */ |
74 | Programmable Flags0 B (8) IVG11 55 | 74 | #define IRQ_PROG_INTA IRQ_PROG0_INTA /* Programmable Flags0 A (8) */ |
75 | Programmable Flags1 A (8) IVG11 56 | 75 | #define IRQ_PROG0_INTB BFIN_IRQ(48) /* Programmable Flags0 B (8) */ |
76 | Programmable Flags1 B (8) IVG11 57 | 76 | #define IRQ_PROG_INTB IRQ_PROG0_INTB /* Programmable Flags0 B (8) */ |
77 | Programmable Flags2 A (8) IVG11 58 | 77 | #define IRQ_PROG1_INTA BFIN_IRQ(49) /* Programmable Flags1 A (8) */ |
78 | Programmable Flags2 B (8) IVG11 59 | 78 | #define IRQ_PROG1_INTB BFIN_IRQ(50) /* Programmable Flags1 B (8) */ |
79 | 79 | #define IRQ_PROG2_INTA BFIN_IRQ(51) /* Programmable Flags2 A (8) */ | |
80 | MDMA1 0 write/read INT IVG8 60 | 80 | #define IRQ_PROG2_INTB BFIN_IRQ(52) /* Programmable Flags2 B (8) */ |
81 | MDMA1 1 write/read INT IVG8 61 | 81 | #define IRQ_DMA1_WRRD0 BFIN_IRQ(53) /* MDMA1 0 write/read INT */ |
82 | 82 | #define IRQ_DMA_WRRD0 IRQ_DMA1_WRRD0 /* MDMA1 0 write/read INT */ | |
83 | MDMA2 0 write/read INT IVG9 62 | ||
84 | MDMA2 1 write/read INT IVG9 63 | ||
85 | |||
86 | IMDMA 0 write/read INT IVG12 64 | ||
87 | IMDMA 1 write/read INT IVG12 65 | ||
88 | |||
89 | Watch Dog Timer IVG13 66 | ||
90 | |||
91 | Reserved interrupt IVG7 67 | ||
92 | Reserved interrupt IVG7 68 | ||
93 | Supplemental interrupt 0 IVG7 69 | ||
94 | supplemental interrupt 1 IVG7 70 | ||
95 | |||
96 | Softirq IVG14 | ||
97 | System Call -- | ||
98 | (lowest priority) IVG15 | ||
99 | |||
100 | **********************************************************************/ | ||
101 | |||
102 | #define SYS_IRQS 71 | ||
103 | #define NR_PERI_INTS 64 | ||
104 | |||
105 | /* | ||
106 | * The ABSTRACT IRQ definitions | ||
107 | * the first seven of the following are fixed, | ||
108 | * the rest you change if you need to. | ||
109 | */ | ||
110 | /* IVG 0-6*/ | ||
111 | #define IRQ_EMU 0 /* Emulation */ | ||
112 | #define IRQ_RST 1 /* Reset */ | ||
113 | #define IRQ_NMI 2 /* Non Maskable Interrupt */ | ||
114 | #define IRQ_EVX 3 /* Exception */ | ||
115 | #define IRQ_UNUSED 4 /* Reserved interrupt */ | ||
116 | #define IRQ_HWERR 5 /* Hardware Error */ | ||
117 | #define IRQ_CORETMR 6 /* Core timer */ | ||
118 | |||
119 | #define IVG_BASE 7 | ||
120 | /* IVG 7 */ | ||
121 | #define IRQ_PLL_WAKEUP (IVG_BASE + 0) /* PLL Wakeup Interrupt */ | ||
122 | #define IRQ_DMA1_ERROR (IVG_BASE + 1) /* DMA1 Error (general) */ | ||
123 | #define IRQ_DMA_ERROR IRQ_DMA1_ERROR /* DMA1 Error (general) */ | ||
124 | #define IRQ_DMA2_ERROR (IVG_BASE + 2) /* DMA2 Error (general) */ | ||
125 | #define IRQ_IMDMA_ERROR (IVG_BASE + 3) /* IMDMA Error Interrupt */ | ||
126 | #define IRQ_PPI1_ERROR (IVG_BASE + 4) /* PPI1 Error Interrupt */ | ||
127 | #define IRQ_PPI_ERROR IRQ_PPI1_ERROR /* PPI1 Error Interrupt */ | ||
128 | #define IRQ_PPI2_ERROR (IVG_BASE + 5) /* PPI2 Error Interrupt */ | ||
129 | #define IRQ_SPORT0_ERROR (IVG_BASE + 6) /* SPORT0 Error Interrupt */ | ||
130 | #define IRQ_SPORT1_ERROR (IVG_BASE + 7) /* SPORT1 Error Interrupt */ | ||
131 | #define IRQ_SPI_ERROR (IVG_BASE + 8) /* SPI Error Interrupt */ | ||
132 | #define IRQ_UART_ERROR (IVG_BASE + 9) /* UART Error Interrupt */ | ||
133 | #define IRQ_RESERVED_ERROR (IVG_BASE + 10) /* Reversed Interrupt */ | ||
134 | /* IVG 8 */ | ||
135 | #define IRQ_DMA1_0 (IVG_BASE + 11) /* DMA1 0 Interrupt(PPI1) */ | ||
136 | #define IRQ_PPI IRQ_DMA1_0 /* DMA1 0 Interrupt(PPI1) */ | ||
137 | #define IRQ_PPI0 IRQ_DMA1_0 /* DMA1 0 Interrupt(PPI1) */ | ||
138 | #define IRQ_DMA1_1 (IVG_BASE + 12) /* DMA1 1 Interrupt(PPI2) */ | ||
139 | #define IRQ_PPI1 IRQ_DMA1_1 /* DMA1 1 Interrupt(PPI2) */ | ||
140 | #define IRQ_DMA1_2 (IVG_BASE + 13) /* DMA1 2 Interrupt */ | ||
141 | #define IRQ_DMA1_3 (IVG_BASE + 14) /* DMA1 3 Interrupt */ | ||
142 | #define IRQ_DMA1_4 (IVG_BASE + 15) /* DMA1 4 Interrupt */ | ||
143 | #define IRQ_DMA1_5 (IVG_BASE + 16) /* DMA1 5 Interrupt */ | ||
144 | #define IRQ_DMA1_6 (IVG_BASE + 17) /* DMA1 6 Interrupt */ | ||
145 | #define IRQ_DMA1_7 (IVG_BASE + 18) /* DMA1 7 Interrupt */ | ||
146 | #define IRQ_DMA1_8 (IVG_BASE + 19) /* DMA1 8 Interrupt */ | ||
147 | #define IRQ_DMA1_9 (IVG_BASE + 20) /* DMA1 9 Interrupt */ | ||
148 | #define IRQ_DMA1_10 (IVG_BASE + 21) /* DMA1 10 Interrupt */ | ||
149 | #define IRQ_DMA1_11 (IVG_BASE + 22) /* DMA1 11 Interrupt */ | ||
150 | /* IVG 9 */ | ||
151 | #define IRQ_DMA2_0 (IVG_BASE + 23) /* DMA2 0 (SPORT0 RX) */ | ||
152 | #define IRQ_SPORT0_RX IRQ_DMA2_0 /* DMA2 0 (SPORT0 RX) */ | ||
153 | #define IRQ_DMA2_1 (IVG_BASE + 24) /* DMA2 1 (SPORT0 TX) */ | ||
154 | #define IRQ_SPORT0_TX IRQ_DMA2_1 /* DMA2 1 (SPORT0 TX) */ | ||
155 | #define IRQ_DMA2_2 (IVG_BASE + 25) /* DMA2 2 (SPORT1 RX) */ | ||
156 | #define IRQ_SPORT1_RX IRQ_DMA2_2 /* DMA2 2 (SPORT1 RX) */ | ||
157 | #define IRQ_DMA2_3 (IVG_BASE + 26) /* DMA2 3 (SPORT2 TX) */ | ||
158 | #define IRQ_SPORT1_TX IRQ_DMA2_3 /* DMA2 3 (SPORT2 TX) */ | ||
159 | #define IRQ_DMA2_4 (IVG_BASE + 27) /* DMA2 4 (SPI) */ | ||
160 | #define IRQ_SPI IRQ_DMA2_4 /* DMA2 4 (SPI) */ | ||
161 | #define IRQ_DMA2_5 (IVG_BASE + 28) /* DMA2 5 (UART RX) */ | ||
162 | #define IRQ_UART_RX IRQ_DMA2_5 /* DMA2 5 (UART RX) */ | ||
163 | #define IRQ_DMA2_6 (IVG_BASE + 29) /* DMA2 6 (UART TX) */ | ||
164 | #define IRQ_UART_TX IRQ_DMA2_6 /* DMA2 6 (UART TX) */ | ||
165 | #define IRQ_DMA2_7 (IVG_BASE + 30) /* DMA2 7 Interrupt */ | ||
166 | #define IRQ_DMA2_8 (IVG_BASE + 31) /* DMA2 8 Interrupt */ | ||
167 | #define IRQ_DMA2_9 (IVG_BASE + 32) /* DMA2 9 Interrupt */ | ||
168 | #define IRQ_DMA2_10 (IVG_BASE + 33) /* DMA2 10 Interrupt */ | ||
169 | #define IRQ_DMA2_11 (IVG_BASE + 34) /* DMA2 11 Interrupt */ | ||
170 | /* IVG 10 */ | ||
171 | #define IRQ_TIMER0 (IVG_BASE + 35) /* TIMER 0 Interrupt */ | ||
172 | #define IRQ_TIMER1 (IVG_BASE + 36) /* TIMER 1 Interrupt */ | ||
173 | #define IRQ_TIMER2 (IVG_BASE + 37) /* TIMER 2 Interrupt */ | ||
174 | #define IRQ_TIMER3 (IVG_BASE + 38) /* TIMER 3 Interrupt */ | ||
175 | #define IRQ_TIMER4 (IVG_BASE + 39) /* TIMER 4 Interrupt */ | ||
176 | #define IRQ_TIMER5 (IVG_BASE + 40) /* TIMER 5 Interrupt */ | ||
177 | #define IRQ_TIMER6 (IVG_BASE + 41) /* TIMER 6 Interrupt */ | ||
178 | #define IRQ_TIMER7 (IVG_BASE + 42) /* TIMER 7 Interrupt */ | ||
179 | #define IRQ_TIMER8 (IVG_BASE + 43) /* TIMER 8 Interrupt */ | ||
180 | #define IRQ_TIMER9 (IVG_BASE + 44) /* TIMER 9 Interrupt */ | ||
181 | #define IRQ_TIMER10 (IVG_BASE + 45) /* TIMER 10 Interrupt */ | ||
182 | #define IRQ_TIMER11 (IVG_BASE + 46) /* TIMER 11 Interrupt */ | ||
183 | /* IVG 11 */ | ||
184 | #define IRQ_PROG0_INTA (IVG_BASE + 47) /* Programmable Flags0 A (8) */ | ||
185 | #define IRQ_PROG_INTA IRQ_PROG0_INTA /* Programmable Flags0 A (8) */ | ||
186 | #define IRQ_PROG0_INTB (IVG_BASE + 48) /* Programmable Flags0 B (8) */ | ||
187 | #define IRQ_PROG_INTB IRQ_PROG0_INTB /* Programmable Flags0 B (8) */ | ||
188 | #define IRQ_PROG1_INTA (IVG_BASE + 49) /* Programmable Flags1 A (8) */ | ||
189 | #define IRQ_PROG1_INTB (IVG_BASE + 50) /* Programmable Flags1 B (8) */ | ||
190 | #define IRQ_PROG2_INTA (IVG_BASE + 51) /* Programmable Flags2 A (8) */ | ||
191 | #define IRQ_PROG2_INTB (IVG_BASE + 52) /* Programmable Flags2 B (8) */ | ||
192 | /* IVG 8 */ | ||
193 | #define IRQ_DMA1_WRRD0 (IVG_BASE + 53) /* MDMA1 0 write/read INT */ | ||
194 | #define IRQ_DMA_WRRD0 IRQ_DMA1_WRRD0 /* MDMA1 0 write/read INT */ | ||
195 | #define IRQ_MEM_DMA0 IRQ_DMA1_WRRD0 | 83 | #define IRQ_MEM_DMA0 IRQ_DMA1_WRRD0 |
196 | #define IRQ_DMA1_WRRD1 (IVG_BASE + 54) /* MDMA1 1 write/read INT */ | 84 | #define IRQ_DMA1_WRRD1 BFIN_IRQ(54) /* MDMA1 1 write/read INT */ |
197 | #define IRQ_DMA_WRRD1 IRQ_DMA1_WRRD1 /* MDMA1 1 write/read INT */ | 85 | #define IRQ_DMA_WRRD1 IRQ_DMA1_WRRD1 /* MDMA1 1 write/read INT */ |
198 | #define IRQ_MEM_DMA1 IRQ_DMA1_WRRD1 | 86 | #define IRQ_MEM_DMA1 IRQ_DMA1_WRRD1 |
199 | /* IVG 9 */ | 87 | #define IRQ_DMA2_WRRD0 BFIN_IRQ(55) /* MDMA2 0 write/read INT */ |
200 | #define IRQ_DMA2_WRRD0 (IVG_BASE + 55) /* MDMA2 0 write/read INT */ | ||
201 | #define IRQ_MEM_DMA2 IRQ_DMA2_WRRD0 | 88 | #define IRQ_MEM_DMA2 IRQ_DMA2_WRRD0 |
202 | #define IRQ_DMA2_WRRD1 (IVG_BASE + 56) /* MDMA2 1 write/read INT */ | 89 | #define IRQ_DMA2_WRRD1 BFIN_IRQ(56) /* MDMA2 1 write/read INT */ |
203 | #define IRQ_MEM_DMA3 IRQ_DMA2_WRRD1 | 90 | #define IRQ_MEM_DMA3 IRQ_DMA2_WRRD1 |
204 | /* IVG 12 */ | 91 | #define IRQ_IMDMA_WRRD0 BFIN_IRQ(57) /* IMDMA 0 write/read INT */ |
205 | #define IRQ_IMDMA_WRRD0 (IVG_BASE + 57) /* IMDMA 0 write/read INT */ | ||
206 | #define IRQ_IMEM_DMA0 IRQ_IMDMA_WRRD0 | 92 | #define IRQ_IMEM_DMA0 IRQ_IMDMA_WRRD0 |
207 | #define IRQ_IMDMA_WRRD1 (IVG_BASE + 58) /* IMDMA 1 write/read INT */ | 93 | #define IRQ_IMDMA_WRRD1 BFIN_IRQ(58) /* IMDMA 1 write/read INT */ |
208 | #define IRQ_IMEM_DMA1 IRQ_IMDMA_WRRD1 | 94 | #define IRQ_IMEM_DMA1 IRQ_IMDMA_WRRD1 |
209 | /* IVG 13 */ | 95 | #define IRQ_WATCH BFIN_IRQ(59) /* Watch Dog Timer */ |
210 | #define IRQ_WATCH (IVG_BASE + 59) /* Watch Dog Timer */ | 96 | #define IRQ_RESERVED_1 BFIN_IRQ(60) /* Reserved interrupt */ |
211 | /* IVG 7 */ | 97 | #define IRQ_RESERVED_2 BFIN_IRQ(61) /* Reserved interrupt */ |
212 | #define IRQ_RESERVED_1 (IVG_BASE + 60) /* Reserved interrupt */ | 98 | #define IRQ_SUPPLE_0 BFIN_IRQ(62) /* Supplemental interrupt 0 */ |
213 | #define IRQ_RESERVED_2 (IVG_BASE + 61) /* Reserved interrupt */ | 99 | #define IRQ_SUPPLE_1 BFIN_IRQ(63) /* supplemental interrupt 1 */ |
214 | #define IRQ_SUPPLE_0 (IVG_BASE + 62) /* Supplemental interrupt 0 */ | 100 | |
215 | #define IRQ_SUPPLE_1 (IVG_BASE + 63) /* supplemental interrupt 1 */ | 101 | #define SYS_IRQS 71 |
216 | 102 | ||
217 | #define IRQ_PF0 73 | 103 | #define IRQ_PF0 73 |
218 | #define IRQ_PF1 74 | 104 | #define IRQ_PF1 74 |
@@ -266,158 +152,85 @@ | |||
266 | #define GPIO_IRQ_BASE IRQ_PF0 | 152 | #define GPIO_IRQ_BASE IRQ_PF0 |
267 | 153 | ||
268 | #define NR_MACH_IRQS (IRQ_PF47 + 1) | 154 | #define NR_MACH_IRQS (IRQ_PF47 + 1) |
269 | #define NR_IRQS (NR_MACH_IRQS + NR_SPARE_IRQS) | ||
270 | |||
271 | #define IVG7 7 | ||
272 | #define IVG8 8 | ||
273 | #define IVG9 9 | ||
274 | #define IVG10 10 | ||
275 | #define IVG11 11 | ||
276 | #define IVG12 12 | ||
277 | #define IVG13 13 | ||
278 | #define IVG14 14 | ||
279 | #define IVG15 15 | ||
280 | |||
281 | /* | ||
282 | * DEFAULT PRIORITIES: | ||
283 | */ | ||
284 | |||
285 | #define CONFIG_DEF_PLL_WAKEUP 7 | ||
286 | #define CONFIG_DEF_DMA1_ERROR 7 | ||
287 | #define CONFIG_DEF_DMA2_ERROR 7 | ||
288 | #define CONFIG_DEF_IMDMA_ERROR 7 | ||
289 | #define CONFIG_DEF_PPI1_ERROR 7 | ||
290 | #define CONFIG_DEF_PPI2_ERROR 7 | ||
291 | #define CONFIG_DEF_SPORT0_ERROR 7 | ||
292 | #define CONFIG_DEF_SPORT1_ERROR 7 | ||
293 | #define CONFIG_DEF_SPI_ERROR 7 | ||
294 | #define CONFIG_DEF_UART_ERROR 7 | ||
295 | #define CONFIG_DEF_RESERVED_ERROR 7 | ||
296 | #define CONFIG_DEF_DMA1_0 8 | ||
297 | #define CONFIG_DEF_DMA1_1 8 | ||
298 | #define CONFIG_DEF_DMA1_2 8 | ||
299 | #define CONFIG_DEF_DMA1_3 8 | ||
300 | #define CONFIG_DEF_DMA1_4 8 | ||
301 | #define CONFIG_DEF_DMA1_5 8 | ||
302 | #define CONFIG_DEF_DMA1_6 8 | ||
303 | #define CONFIG_DEF_DMA1_7 8 | ||
304 | #define CONFIG_DEF_DMA1_8 8 | ||
305 | #define CONFIG_DEF_DMA1_9 8 | ||
306 | #define CONFIG_DEF_DMA1_10 8 | ||
307 | #define CONFIG_DEF_DMA1_11 8 | ||
308 | #define CONFIG_DEF_DMA2_0 9 | ||
309 | #define CONFIG_DEF_DMA2_1 9 | ||
310 | #define CONFIG_DEF_DMA2_2 9 | ||
311 | #define CONFIG_DEF_DMA2_3 9 | ||
312 | #define CONFIG_DEF_DMA2_4 9 | ||
313 | #define CONFIG_DEF_DMA2_5 9 | ||
314 | #define CONFIG_DEF_DMA2_6 9 | ||
315 | #define CONFIG_DEF_DMA2_7 9 | ||
316 | #define CONFIG_DEF_DMA2_8 9 | ||
317 | #define CONFIG_DEF_DMA2_9 9 | ||
318 | #define CONFIG_DEF_DMA2_10 9 | ||
319 | #define CONFIG_DEF_DMA2_11 9 | ||
320 | #define CONFIG_DEF_TIMER0 10 | ||
321 | #define CONFIG_DEF_TIMER1 10 | ||
322 | #define CONFIG_DEF_TIMER2 10 | ||
323 | #define CONFIG_DEF_TIMER3 10 | ||
324 | #define CONFIG_DEF_TIMER4 10 | ||
325 | #define CONFIG_DEF_TIMER5 10 | ||
326 | #define CONFIG_DEF_TIMER6 10 | ||
327 | #define CONFIG_DEF_TIMER7 10 | ||
328 | #define CONFIG_DEF_TIMER8 10 | ||
329 | #define CONFIG_DEF_TIMER9 10 | ||
330 | #define CONFIG_DEF_TIMER10 10 | ||
331 | #define CONFIG_DEF_TIMER11 10 | ||
332 | #define CONFIG_DEF_PROG0_INTA 11 | ||
333 | #define CONFIG_DEF_PROG0_INTB 11 | ||
334 | #define CONFIG_DEF_PROG1_INTA 11 | ||
335 | #define CONFIG_DEF_PROG1_INTB 11 | ||
336 | #define CONFIG_DEF_PROG2_INTA 11 | ||
337 | #define CONFIG_DEF_PROG2_INTB 11 | ||
338 | #define CONFIG_DEF_DMA1_WRRD0 8 | ||
339 | #define CONFIG_DEF_DMA1_WRRD1 8 | ||
340 | #define CONFIG_DEF_DMA2_WRRD0 9 | ||
341 | #define CONFIG_DEF_DMA2_WRRD1 9 | ||
342 | #define CONFIG_DEF_IMDMA_WRRD0 12 | ||
343 | #define CONFIG_DEF_IMDMA_WRRD1 12 | ||
344 | #define CONFIG_DEF_WATCH 13 | ||
345 | #define CONFIG_DEF_RESERVED_1 7 | ||
346 | #define CONFIG_DEF_RESERVED_2 7 | ||
347 | #define CONFIG_DEF_SUPPLE_0 7 | ||
348 | #define CONFIG_DEF_SUPPLE_1 7 | ||
349 | 155 | ||
350 | /* IAR0 BIT FIELDS */ | 156 | /* IAR0 BIT FIELDS */ |
351 | #define IRQ_PLL_WAKEUP_POS 0 | 157 | #define IRQ_PLL_WAKEUP_POS 0 |
352 | #define IRQ_DMA1_ERROR_POS 4 | 158 | #define IRQ_DMA1_ERROR_POS 4 |
353 | #define IRQ_DMA2_ERROR_POS 8 | 159 | #define IRQ_DMA2_ERROR_POS 8 |
354 | #define IRQ_IMDMA_ERROR_POS 12 | 160 | #define IRQ_IMDMA_ERROR_POS 12 |
355 | #define IRQ_PPI0_ERROR_POS 16 | 161 | #define IRQ_PPI0_ERROR_POS 16 |
356 | #define IRQ_PPI1_ERROR_POS 20 | 162 | #define IRQ_PPI1_ERROR_POS 20 |
357 | #define IRQ_SPORT0_ERROR_POS 24 | 163 | #define IRQ_SPORT0_ERROR_POS 24 |
358 | #define IRQ_SPORT1_ERROR_POS 28 | 164 | #define IRQ_SPORT1_ERROR_POS 28 |
165 | |||
359 | /* IAR1 BIT FIELDS */ | 166 | /* IAR1 BIT FIELDS */ |
360 | #define IRQ_SPI_ERROR_POS 0 | 167 | #define IRQ_SPI_ERROR_POS 0 |
361 | #define IRQ_UART_ERROR_POS 4 | 168 | #define IRQ_UART_ERROR_POS 4 |
362 | #define IRQ_RESERVED_ERROR_POS 8 | 169 | #define IRQ_RESERVED_ERROR_POS 8 |
363 | #define IRQ_DMA1_0_POS 12 | 170 | #define IRQ_DMA1_0_POS 12 |
364 | #define IRQ_DMA1_1_POS 16 | 171 | #define IRQ_DMA1_1_POS 16 |
365 | #define IRQ_DMA1_2_POS 20 | 172 | #define IRQ_DMA1_2_POS 20 |
366 | #define IRQ_DMA1_3_POS 24 | 173 | #define IRQ_DMA1_3_POS 24 |
367 | #define IRQ_DMA1_4_POS 28 | 174 | #define IRQ_DMA1_4_POS 28 |
175 | |||
368 | /* IAR2 BIT FIELDS */ | 176 | /* IAR2 BIT FIELDS */ |
369 | #define IRQ_DMA1_5_POS 0 | 177 | #define IRQ_DMA1_5_POS 0 |
370 | #define IRQ_DMA1_6_POS 4 | 178 | #define IRQ_DMA1_6_POS 4 |
371 | #define IRQ_DMA1_7_POS 8 | 179 | #define IRQ_DMA1_7_POS 8 |
372 | #define IRQ_DMA1_8_POS 12 | 180 | #define IRQ_DMA1_8_POS 12 |
373 | #define IRQ_DMA1_9_POS 16 | 181 | #define IRQ_DMA1_9_POS 16 |
374 | #define IRQ_DMA1_10_POS 20 | 182 | #define IRQ_DMA1_10_POS 20 |
375 | #define IRQ_DMA1_11_POS 24 | 183 | #define IRQ_DMA1_11_POS 24 |
376 | #define IRQ_DMA2_0_POS 28 | 184 | #define IRQ_DMA2_0_POS 28 |
185 | |||
377 | /* IAR3 BIT FIELDS */ | 186 | /* IAR3 BIT FIELDS */ |
378 | #define IRQ_DMA2_1_POS 0 | 187 | #define IRQ_DMA2_1_POS 0 |
379 | #define IRQ_DMA2_2_POS 4 | 188 | #define IRQ_DMA2_2_POS 4 |
380 | #define IRQ_DMA2_3_POS 8 | 189 | #define IRQ_DMA2_3_POS 8 |
381 | #define IRQ_DMA2_4_POS 12 | 190 | #define IRQ_DMA2_4_POS 12 |
382 | #define IRQ_DMA2_5_POS 16 | 191 | #define IRQ_DMA2_5_POS 16 |
383 | #define IRQ_DMA2_6_POS 20 | 192 | #define IRQ_DMA2_6_POS 20 |
384 | #define IRQ_DMA2_7_POS 24 | 193 | #define IRQ_DMA2_7_POS 24 |
385 | #define IRQ_DMA2_8_POS 28 | 194 | #define IRQ_DMA2_8_POS 28 |
195 | |||
386 | /* IAR4 BIT FIELDS */ | 196 | /* IAR4 BIT FIELDS */ |
387 | #define IRQ_DMA2_9_POS 0 | 197 | #define IRQ_DMA2_9_POS 0 |
388 | #define IRQ_DMA2_10_POS 4 | 198 | #define IRQ_DMA2_10_POS 4 |
389 | #define IRQ_DMA2_11_POS 8 | 199 | #define IRQ_DMA2_11_POS 8 |
390 | #define IRQ_TIMER0_POS 12 | 200 | #define IRQ_TIMER0_POS 12 |
391 | #define IRQ_TIMER1_POS 16 | 201 | #define IRQ_TIMER1_POS 16 |
392 | #define IRQ_TIMER2_POS 20 | 202 | #define IRQ_TIMER2_POS 20 |
393 | #define IRQ_TIMER3_POS 24 | 203 | #define IRQ_TIMER3_POS 24 |
394 | #define IRQ_TIMER4_POS 28 | 204 | #define IRQ_TIMER4_POS 28 |
205 | |||
395 | /* IAR5 BIT FIELDS */ | 206 | /* IAR5 BIT FIELDS */ |
396 | #define IRQ_TIMER5_POS 0 | 207 | #define IRQ_TIMER5_POS 0 |
397 | #define IRQ_TIMER6_POS 4 | 208 | #define IRQ_TIMER6_POS 4 |
398 | #define IRQ_TIMER7_POS 8 | 209 | #define IRQ_TIMER7_POS 8 |
399 | #define IRQ_TIMER8_POS 12 | 210 | #define IRQ_TIMER8_POS 12 |
400 | #define IRQ_TIMER9_POS 16 | 211 | #define IRQ_TIMER9_POS 16 |
401 | #define IRQ_TIMER10_POS 20 | 212 | #define IRQ_TIMER10_POS 20 |
402 | #define IRQ_TIMER11_POS 24 | 213 | #define IRQ_TIMER11_POS 24 |
403 | #define IRQ_PROG0_INTA_POS 28 | 214 | #define IRQ_PROG0_INTA_POS 28 |
215 | |||
404 | /* IAR6 BIT FIELDS */ | 216 | /* IAR6 BIT FIELDS */ |
405 | #define IRQ_PROG0_INTB_POS 0 | 217 | #define IRQ_PROG0_INTB_POS 0 |
406 | #define IRQ_PROG1_INTA_POS 4 | 218 | #define IRQ_PROG1_INTA_POS 4 |
407 | #define IRQ_PROG1_INTB_POS 8 | 219 | #define IRQ_PROG1_INTB_POS 8 |
408 | #define IRQ_PROG2_INTA_POS 12 | 220 | #define IRQ_PROG2_INTA_POS 12 |
409 | #define IRQ_PROG2_INTB_POS 16 | 221 | #define IRQ_PROG2_INTB_POS 16 |
410 | #define IRQ_DMA1_WRRD0_POS 20 | 222 | #define IRQ_DMA1_WRRD0_POS 20 |
411 | #define IRQ_DMA1_WRRD1_POS 24 | 223 | #define IRQ_DMA1_WRRD1_POS 24 |
412 | #define IRQ_DMA2_WRRD0_POS 28 | 224 | #define IRQ_DMA2_WRRD0_POS 28 |
413 | /* IAR7 BIT FIELDS */ | ||
414 | #define IRQ_DMA2_WRRD1_POS 0 | ||
415 | #define IRQ_IMDMA_WRRD0_POS 4 | ||
416 | #define IRQ_IMDMA_WRRD1_POS 8 | ||
417 | #define IRQ_WDTIMER_POS 12 | ||
418 | #define IRQ_RESERVED_1_POS 16 | ||
419 | #define IRQ_RESERVED_2_POS 20 | ||
420 | #define IRQ_SUPPLE_0_POS 24 | ||
421 | #define IRQ_SUPPLE_1_POS 28 | ||
422 | 225 | ||
423 | #endif /* _BF561_IRQ_H_ */ | 226 | /* IAR7 BIT FIELDS */ |
227 | #define IRQ_DMA2_WRRD1_POS 0 | ||
228 | #define IRQ_IMDMA_WRRD0_POS 4 | ||
229 | #define IRQ_IMDMA_WRRD1_POS 8 | ||
230 | #define IRQ_WDTIMER_POS 12 | ||
231 | #define IRQ_RESERVED_1_POS 16 | ||
232 | #define IRQ_RESERVED_2_POS 20 | ||
233 | #define IRQ_SUPPLE_0_POS 24 | ||
234 | #define IRQ_SUPPLE_1_POS 28 | ||
235 | |||
236 | #endif | ||
diff --git a/arch/blackfin/mach-bf561/smp.c b/arch/blackfin/mach-bf561/smp.c index 7b07740cf68c..85abd8be1343 100644 --- a/arch/blackfin/mach-bf561/smp.c +++ b/arch/blackfin/mach-bf561/smp.c | |||
@@ -24,17 +24,23 @@ static DEFINE_SPINLOCK(boot_lock); | |||
24 | 24 | ||
25 | void __init platform_init_cpus(void) | 25 | void __init platform_init_cpus(void) |
26 | { | 26 | { |
27 | cpu_set(0, cpu_possible_map); /* CoreA */ | 27 | struct cpumask mask; |
28 | cpu_set(1, cpu_possible_map); /* CoreB */ | 28 | |
29 | cpumask_set_cpu(0, &mask); /* CoreA */ | ||
30 | cpumask_set_cpu(1, &mask); /* CoreB */ | ||
31 | init_cpu_possible(&mask); | ||
29 | } | 32 | } |
30 | 33 | ||
31 | void __init platform_prepare_cpus(unsigned int max_cpus) | 34 | void __init platform_prepare_cpus(unsigned int max_cpus) |
32 | { | 35 | { |
36 | struct cpumask mask; | ||
37 | |||
33 | bfin_relocate_coreb_l1_mem(); | 38 | bfin_relocate_coreb_l1_mem(); |
34 | 39 | ||
35 | /* Both cores ought to be present on a bf561! */ | 40 | /* Both cores ought to be present on a bf561! */ |
36 | cpu_set(0, cpu_present_map); /* CoreA */ | 41 | cpumask_set_cpu(0, &mask); /* CoreA */ |
37 | cpu_set(1, cpu_present_map); /* CoreB */ | 42 | cpumask_set_cpu(1, &mask); /* CoreB */ |
43 | init_cpu_present(&mask); | ||
38 | } | 44 | } |
39 | 45 | ||
40 | int __init setup_profiling_timer(unsigned int multiplier) /* not supported */ | 46 | int __init setup_profiling_timer(unsigned int multiplier) /* not supported */ |
@@ -62,9 +68,6 @@ void __cpuinit platform_secondary_init(unsigned int cpu) | |||
62 | bfin_write_SICB_IWR1(IWR_DISABLE_ALL); | 68 | bfin_write_SICB_IWR1(IWR_DISABLE_ALL); |
63 | SSYNC(); | 69 | SSYNC(); |
64 | 70 | ||
65 | /* Store CPU-private information to the cpu_data array. */ | ||
66 | bfin_setup_cpudata(cpu); | ||
67 | |||
68 | /* We are done with local CPU inits, unblock the boot CPU. */ | 71 | /* We are done with local CPU inits, unblock the boot CPU. */ |
69 | set_cpu_online(cpu, true); | 72 | set_cpu_online(cpu, true); |
70 | spin_lock(&boot_lock); | 73 | spin_lock(&boot_lock); |
diff --git a/arch/blackfin/mach-common/dpmc.c b/arch/blackfin/mach-common/dpmc.c index 5e4112e518a9..f5685a496c58 100644 --- a/arch/blackfin/mach-common/dpmc.c +++ b/arch/blackfin/mach-common/dpmc.c | |||
@@ -85,10 +85,11 @@ static void bfin_wakeup_cpu(void) | |||
85 | { | 85 | { |
86 | unsigned int cpu; | 86 | unsigned int cpu; |
87 | unsigned int this_cpu = smp_processor_id(); | 87 | unsigned int this_cpu = smp_processor_id(); |
88 | cpumask_t mask = cpu_online_map; | 88 | cpumask_t mask; |
89 | 89 | ||
90 | cpu_clear(this_cpu, mask); | 90 | cpumask_copy(&mask, cpu_online_mask); |
91 | for_each_cpu_mask(cpu, mask) | 91 | cpumask_clear_cpu(this_cpu, &mask); |
92 | for_each_cpu(cpu, &mask) | ||
92 | platform_send_ipi_cpu(cpu, IRQ_SUPPLE_0); | 93 | platform_send_ipi_cpu(cpu, IRQ_SUPPLE_0); |
93 | } | 94 | } |
94 | 95 | ||
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c index 43d9fb195c1e..1177369f9922 100644 --- a/arch/blackfin/mach-common/ints-priority.c +++ b/arch/blackfin/mach-common/ints-priority.c | |||
@@ -19,32 +19,14 @@ | |||
19 | #ifdef CONFIG_IPIPE | 19 | #ifdef CONFIG_IPIPE |
20 | #include <linux/ipipe.h> | 20 | #include <linux/ipipe.h> |
21 | #endif | 21 | #endif |
22 | #ifdef CONFIG_KGDB | ||
23 | #include <linux/kgdb.h> | ||
24 | #endif | ||
25 | #include <asm/traps.h> | 22 | #include <asm/traps.h> |
26 | #include <asm/blackfin.h> | 23 | #include <asm/blackfin.h> |
27 | #include <asm/gpio.h> | 24 | #include <asm/gpio.h> |
28 | #include <asm/irq_handler.h> | 25 | #include <asm/irq_handler.h> |
29 | #include <asm/dpmc.h> | 26 | #include <asm/dpmc.h> |
30 | #include <asm/bfin5xx_spi.h> | ||
31 | #include <asm/bfin_sport.h> | ||
32 | #include <asm/bfin_can.h> | ||
33 | 27 | ||
34 | #define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1)) | 28 | #define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1)) |
35 | 29 | ||
36 | #ifdef BF537_FAMILY | ||
37 | # define BF537_GENERIC_ERROR_INT_DEMUX | ||
38 | # define SPI_ERR_MASK (BIT_STAT_TXCOL | BIT_STAT_RBSY | BIT_STAT_MODF | BIT_STAT_TXE) /* SPI_STAT */ | ||
39 | # define SPORT_ERR_MASK (ROVF | RUVF | TOVF | TUVF) /* SPORT_STAT */ | ||
40 | # define PPI_ERR_MASK (0xFFFF & ~FLD) /* PPI_STATUS */ | ||
41 | # define EMAC_ERR_MASK (PHYINT | MMCINT | RXFSINT | TXFSINT | WAKEDET | RXDMAERR | TXDMAERR | STMDONE) /* EMAC_SYSTAT */ | ||
42 | # define UART_ERR_MASK (0x6) /* UART_IIR */ | ||
43 | # define CAN_ERR_MASK (EWTIF | EWRIF | EPIF | BOIF | WUIF | UIAIF | AAIF | RMLIF | UCEIF | EXTIF | ADIF) /* CAN_GIF */ | ||
44 | #else | ||
45 | # undef BF537_GENERIC_ERROR_INT_DEMUX | ||
46 | #endif | ||
47 | |||
48 | /* | 30 | /* |
49 | * NOTES: | 31 | * NOTES: |
50 | * - we have separated the physical Hardware interrupt from the | 32 | * - we have separated the physical Hardware interrupt from the |
@@ -63,22 +45,19 @@ unsigned long bfin_irq_flags = 0x1f; | |||
63 | EXPORT_SYMBOL(bfin_irq_flags); | 45 | EXPORT_SYMBOL(bfin_irq_flags); |
64 | #endif | 46 | #endif |
65 | 47 | ||
66 | /* The number of spurious interrupts */ | ||
67 | atomic_t num_spurious; | ||
68 | |||
69 | #ifdef CONFIG_PM | 48 | #ifdef CONFIG_PM |
70 | unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */ | 49 | unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */ |
71 | unsigned vr_wakeup; | 50 | unsigned vr_wakeup; |
72 | #endif | 51 | #endif |
73 | 52 | ||
74 | struct ivgx { | 53 | static struct ivgx { |
75 | /* irq number for request_irq, available in mach-bf5xx/irq.h */ | 54 | /* irq number for request_irq, available in mach-bf5xx/irq.h */ |
76 | unsigned int irqno; | 55 | unsigned int irqno; |
77 | /* corresponding bit in the SIC_ISR register */ | 56 | /* corresponding bit in the SIC_ISR register */ |
78 | unsigned int isrflag; | 57 | unsigned int isrflag; |
79 | } ivg_table[NR_PERI_INTS]; | 58 | } ivg_table[NR_PERI_INTS]; |
80 | 59 | ||
81 | struct ivg_slice { | 60 | static struct ivg_slice { |
82 | /* position of first irq in ivg_table for given ivg */ | 61 | /* position of first irq in ivg_table for given ivg */ |
83 | struct ivgx *ifirst; | 62 | struct ivgx *ifirst; |
84 | struct ivgx *istop; | 63 | struct ivgx *istop; |
@@ -125,7 +104,7 @@ static void __init search_IAR(void) | |||
125 | * This is for core internal IRQs | 104 | * This is for core internal IRQs |
126 | */ | 105 | */ |
127 | 106 | ||
128 | static void bfin_ack_noop(struct irq_data *d) | 107 | void bfin_ack_noop(struct irq_data *d) |
129 | { | 108 | { |
130 | /* Dummy function. */ | 109 | /* Dummy function. */ |
131 | } | 110 | } |
@@ -154,26 +133,24 @@ static void bfin_core_unmask_irq(struct irq_data *d) | |||
154 | return; | 133 | return; |
155 | } | 134 | } |
156 | 135 | ||
157 | static void bfin_internal_mask_irq(unsigned int irq) | 136 | void bfin_internal_mask_irq(unsigned int irq) |
158 | { | 137 | { |
159 | unsigned long flags; | 138 | unsigned long flags = hard_local_irq_save(); |
160 | 139 | ||
161 | #ifdef CONFIG_BF53x | 140 | #ifdef SIC_IMASK0 |
162 | flags = hard_local_irq_save(); | 141 | unsigned mask_bank = SIC_SYSIRQ(irq) / 32; |
163 | bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() & | 142 | unsigned mask_bit = SIC_SYSIRQ(irq) % 32; |
164 | ~(1 << SIC_SYSIRQ(irq))); | ||
165 | #else | ||
166 | unsigned mask_bank, mask_bit; | ||
167 | flags = hard_local_irq_save(); | ||
168 | mask_bank = SIC_SYSIRQ(irq) / 32; | ||
169 | mask_bit = SIC_SYSIRQ(irq) % 32; | ||
170 | bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) & | 143 | bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) & |
171 | ~(1 << mask_bit)); | 144 | ~(1 << mask_bit)); |
172 | #ifdef CONFIG_SMP | 145 | # ifdef CONFIG_SMP |
173 | bfin_write_SICB_IMASK(mask_bank, bfin_read_SICB_IMASK(mask_bank) & | 146 | bfin_write_SICB_IMASK(mask_bank, bfin_read_SICB_IMASK(mask_bank) & |
174 | ~(1 << mask_bit)); | 147 | ~(1 << mask_bit)); |
148 | # endif | ||
149 | #else | ||
150 | bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() & | ||
151 | ~(1 << SIC_SYSIRQ(irq))); | ||
175 | #endif | 152 | #endif |
176 | #endif | 153 | |
177 | hard_local_irq_restore(flags); | 154 | hard_local_irq_restore(flags); |
178 | } | 155 | } |
179 | 156 | ||
@@ -186,33 +163,31 @@ static void bfin_internal_mask_irq_chip(struct irq_data *d) | |||
186 | static void bfin_internal_unmask_irq_affinity(unsigned int irq, | 163 | static void bfin_internal_unmask_irq_affinity(unsigned int irq, |
187 | const struct cpumask *affinity) | 164 | const struct cpumask *affinity) |
188 | #else | 165 | #else |
189 | static void bfin_internal_unmask_irq(unsigned int irq) | 166 | void bfin_internal_unmask_irq(unsigned int irq) |
190 | #endif | 167 | #endif |
191 | { | 168 | { |
192 | unsigned long flags; | 169 | unsigned long flags = hard_local_irq_save(); |
193 | 170 | ||
194 | #ifdef CONFIG_BF53x | 171 | #ifdef SIC_IMASK0 |
195 | flags = hard_local_irq_save(); | 172 | unsigned mask_bank = SIC_SYSIRQ(irq) / 32; |
196 | bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | | 173 | unsigned mask_bit = SIC_SYSIRQ(irq) % 32; |
197 | (1 << SIC_SYSIRQ(irq))); | 174 | # ifdef CONFIG_SMP |
198 | #else | ||
199 | unsigned mask_bank, mask_bit; | ||
200 | flags = hard_local_irq_save(); | ||
201 | mask_bank = SIC_SYSIRQ(irq) / 32; | ||
202 | mask_bit = SIC_SYSIRQ(irq) % 32; | ||
203 | #ifdef CONFIG_SMP | ||
204 | if (cpumask_test_cpu(0, affinity)) | 175 | if (cpumask_test_cpu(0, affinity)) |
205 | #endif | 176 | # endif |
206 | bfin_write_SIC_IMASK(mask_bank, | 177 | bfin_write_SIC_IMASK(mask_bank, |
207 | bfin_read_SIC_IMASK(mask_bank) | | 178 | bfin_read_SIC_IMASK(mask_bank) | |
208 | (1 << mask_bit)); | 179 | (1 << mask_bit)); |
209 | #ifdef CONFIG_SMP | 180 | # ifdef CONFIG_SMP |
210 | if (cpumask_test_cpu(1, affinity)) | 181 | if (cpumask_test_cpu(1, affinity)) |
211 | bfin_write_SICB_IMASK(mask_bank, | 182 | bfin_write_SICB_IMASK(mask_bank, |
212 | bfin_read_SICB_IMASK(mask_bank) | | 183 | bfin_read_SICB_IMASK(mask_bank) | |
213 | (1 << mask_bit)); | 184 | (1 << mask_bit)); |
185 | # endif | ||
186 | #else | ||
187 | bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | | ||
188 | (1 << SIC_SYSIRQ(irq))); | ||
214 | #endif | 189 | #endif |
215 | #endif | 190 | |
216 | hard_local_irq_restore(flags); | 191 | hard_local_irq_restore(flags); |
217 | } | 192 | } |
218 | 193 | ||
@@ -295,6 +270,8 @@ static int bfin_internal_set_wake_chip(struct irq_data *d, unsigned int state) | |||
295 | { | 270 | { |
296 | return bfin_internal_set_wake(d->irq, state); | 271 | return bfin_internal_set_wake(d->irq, state); |
297 | } | 272 | } |
273 | #else | ||
274 | # define bfin_internal_set_wake_chip NULL | ||
298 | #endif | 275 | #endif |
299 | 276 | ||
300 | static struct irq_chip bfin_core_irqchip = { | 277 | static struct irq_chip bfin_core_irqchip = { |
@@ -315,12 +292,10 @@ static struct irq_chip bfin_internal_irqchip = { | |||
315 | #ifdef CONFIG_SMP | 292 | #ifdef CONFIG_SMP |
316 | .irq_set_affinity = bfin_internal_set_affinity, | 293 | .irq_set_affinity = bfin_internal_set_affinity, |
317 | #endif | 294 | #endif |
318 | #ifdef CONFIG_PM | ||
319 | .irq_set_wake = bfin_internal_set_wake_chip, | 295 | .irq_set_wake = bfin_internal_set_wake_chip, |
320 | #endif | ||
321 | }; | 296 | }; |
322 | 297 | ||
323 | static void bfin_handle_irq(unsigned irq) | 298 | void bfin_handle_irq(unsigned irq) |
324 | { | 299 | { |
325 | #ifdef CONFIG_IPIPE | 300 | #ifdef CONFIG_IPIPE |
326 | struct pt_regs regs; /* Contents not used. */ | 301 | struct pt_regs regs; /* Contents not used. */ |
@@ -332,102 +307,6 @@ static void bfin_handle_irq(unsigned irq) | |||
332 | #endif /* !CONFIG_IPIPE */ | 307 | #endif /* !CONFIG_IPIPE */ |
333 | } | 308 | } |
334 | 309 | ||
335 | #ifdef BF537_GENERIC_ERROR_INT_DEMUX | ||
336 | static int error_int_mask; | ||
337 | |||
338 | static void bfin_generic_error_mask_irq(struct irq_data *d) | ||
339 | { | ||
340 | error_int_mask &= ~(1L << (d->irq - IRQ_PPI_ERROR)); | ||
341 | if (!error_int_mask) | ||
342 | bfin_internal_mask_irq(IRQ_GENERIC_ERROR); | ||
343 | } | ||
344 | |||
345 | static void bfin_generic_error_unmask_irq(struct irq_data *d) | ||
346 | { | ||
347 | bfin_internal_unmask_irq(IRQ_GENERIC_ERROR); | ||
348 | error_int_mask |= 1L << (d->irq - IRQ_PPI_ERROR); | ||
349 | } | ||
350 | |||
351 | static struct irq_chip bfin_generic_error_irqchip = { | ||
352 | .name = "ERROR", | ||
353 | .irq_ack = bfin_ack_noop, | ||
354 | .irq_mask_ack = bfin_generic_error_mask_irq, | ||
355 | .irq_mask = bfin_generic_error_mask_irq, | ||
356 | .irq_unmask = bfin_generic_error_unmask_irq, | ||
357 | }; | ||
358 | |||
359 | static void bfin_demux_error_irq(unsigned int int_err_irq, | ||
360 | struct irq_desc *inta_desc) | ||
361 | { | ||
362 | int irq = 0; | ||
363 | |||
364 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) | ||
365 | if (bfin_read_EMAC_SYSTAT() & EMAC_ERR_MASK) | ||
366 | irq = IRQ_MAC_ERROR; | ||
367 | else | ||
368 | #endif | ||
369 | if (bfin_read_SPORT0_STAT() & SPORT_ERR_MASK) | ||
370 | irq = IRQ_SPORT0_ERROR; | ||
371 | else if (bfin_read_SPORT1_STAT() & SPORT_ERR_MASK) | ||
372 | irq = IRQ_SPORT1_ERROR; | ||
373 | else if (bfin_read_PPI_STATUS() & PPI_ERR_MASK) | ||
374 | irq = IRQ_PPI_ERROR; | ||
375 | else if (bfin_read_CAN_GIF() & CAN_ERR_MASK) | ||
376 | irq = IRQ_CAN_ERROR; | ||
377 | else if (bfin_read_SPI_STAT() & SPI_ERR_MASK) | ||
378 | irq = IRQ_SPI_ERROR; | ||
379 | else if ((bfin_read_UART0_IIR() & UART_ERR_MASK) == UART_ERR_MASK) | ||
380 | irq = IRQ_UART0_ERROR; | ||
381 | else if ((bfin_read_UART1_IIR() & UART_ERR_MASK) == UART_ERR_MASK) | ||
382 | irq = IRQ_UART1_ERROR; | ||
383 | |||
384 | if (irq) { | ||
385 | if (error_int_mask & (1L << (irq - IRQ_PPI_ERROR))) | ||
386 | bfin_handle_irq(irq); | ||
387 | else { | ||
388 | |||
389 | switch (irq) { | ||
390 | case IRQ_PPI_ERROR: | ||
391 | bfin_write_PPI_STATUS(PPI_ERR_MASK); | ||
392 | break; | ||
393 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) | ||
394 | case IRQ_MAC_ERROR: | ||
395 | bfin_write_EMAC_SYSTAT(EMAC_ERR_MASK); | ||
396 | break; | ||
397 | #endif | ||
398 | case IRQ_SPORT0_ERROR: | ||
399 | bfin_write_SPORT0_STAT(SPORT_ERR_MASK); | ||
400 | break; | ||
401 | |||
402 | case IRQ_SPORT1_ERROR: | ||
403 | bfin_write_SPORT1_STAT(SPORT_ERR_MASK); | ||
404 | break; | ||
405 | |||
406 | case IRQ_CAN_ERROR: | ||
407 | bfin_write_CAN_GIS(CAN_ERR_MASK); | ||
408 | break; | ||
409 | |||
410 | case IRQ_SPI_ERROR: | ||
411 | bfin_write_SPI_STAT(SPI_ERR_MASK); | ||
412 | break; | ||
413 | |||
414 | default: | ||
415 | break; | ||
416 | } | ||
417 | |||
418 | pr_debug("IRQ %d:" | ||
419 | " MASKED PERIPHERAL ERROR INTERRUPT ASSERTED\n", | ||
420 | irq); | ||
421 | } | ||
422 | } else | ||
423 | printk(KERN_ERR | ||
424 | "%s : %s : LINE %d :\nIRQ ?: PERIPHERAL ERROR" | ||
425 | " INTERRUPT ASSERTED BUT NO SOURCE FOUND\n", | ||
426 | __func__, __FILE__, __LINE__); | ||
427 | |||
428 | } | ||
429 | #endif /* BF537_GENERIC_ERROR_INT_DEMUX */ | ||
430 | |||
431 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 310 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
432 | static int mac_stat_int_mask; | 311 | static int mac_stat_int_mask; |
433 | 312 | ||
@@ -468,7 +347,7 @@ static void bfin_mac_status_mask_irq(struct irq_data *d) | |||
468 | unsigned int irq = d->irq; | 347 | unsigned int irq = d->irq; |
469 | 348 | ||
470 | mac_stat_int_mask &= ~(1L << (irq - IRQ_MAC_PHYINT)); | 349 | mac_stat_int_mask &= ~(1L << (irq - IRQ_MAC_PHYINT)); |
471 | #ifdef BF537_GENERIC_ERROR_INT_DEMUX | 350 | #ifdef BF537_FAMILY |
472 | switch (irq) { | 351 | switch (irq) { |
473 | case IRQ_MAC_PHYINT: | 352 | case IRQ_MAC_PHYINT: |
474 | bfin_write_EMAC_SYSCTL(bfin_read_EMAC_SYSCTL() & ~PHYIE); | 353 | bfin_write_EMAC_SYSCTL(bfin_read_EMAC_SYSCTL() & ~PHYIE); |
@@ -487,7 +366,7 @@ static void bfin_mac_status_unmask_irq(struct irq_data *d) | |||
487 | { | 366 | { |
488 | unsigned int irq = d->irq; | 367 | unsigned int irq = d->irq; |
489 | 368 | ||
490 | #ifdef BF537_GENERIC_ERROR_INT_DEMUX | 369 | #ifdef BF537_FAMILY |
491 | switch (irq) { | 370 | switch (irq) { |
492 | case IRQ_MAC_PHYINT: | 371 | case IRQ_MAC_PHYINT: |
493 | bfin_write_EMAC_SYSCTL(bfin_read_EMAC_SYSCTL() | PHYIE); | 372 | bfin_write_EMAC_SYSCTL(bfin_read_EMAC_SYSCTL() | PHYIE); |
@@ -505,12 +384,14 @@ static void bfin_mac_status_unmask_irq(struct irq_data *d) | |||
505 | #ifdef CONFIG_PM | 384 | #ifdef CONFIG_PM |
506 | int bfin_mac_status_set_wake(struct irq_data *d, unsigned int state) | 385 | int bfin_mac_status_set_wake(struct irq_data *d, unsigned int state) |
507 | { | 386 | { |
508 | #ifdef BF537_GENERIC_ERROR_INT_DEMUX | 387 | #ifdef BF537_FAMILY |
509 | return bfin_internal_set_wake(IRQ_GENERIC_ERROR, state); | 388 | return bfin_internal_set_wake(IRQ_GENERIC_ERROR, state); |
510 | #else | 389 | #else |
511 | return bfin_internal_set_wake(IRQ_MAC_ERROR, state); | 390 | return bfin_internal_set_wake(IRQ_MAC_ERROR, state); |
512 | #endif | 391 | #endif |
513 | } | 392 | } |
393 | #else | ||
394 | # define bfin_mac_status_set_wake NULL | ||
514 | #endif | 395 | #endif |
515 | 396 | ||
516 | static struct irq_chip bfin_mac_status_irqchip = { | 397 | static struct irq_chip bfin_mac_status_irqchip = { |
@@ -519,13 +400,11 @@ static struct irq_chip bfin_mac_status_irqchip = { | |||
519 | .irq_mask_ack = bfin_mac_status_mask_irq, | 400 | .irq_mask_ack = bfin_mac_status_mask_irq, |
520 | .irq_mask = bfin_mac_status_mask_irq, | 401 | .irq_mask = bfin_mac_status_mask_irq, |
521 | .irq_unmask = bfin_mac_status_unmask_irq, | 402 | .irq_unmask = bfin_mac_status_unmask_irq, |
522 | #ifdef CONFIG_PM | ||
523 | .irq_set_wake = bfin_mac_status_set_wake, | 403 | .irq_set_wake = bfin_mac_status_set_wake, |
524 | #endif | ||
525 | }; | 404 | }; |
526 | 405 | ||
527 | static void bfin_demux_mac_status_irq(unsigned int int_err_irq, | 406 | void bfin_demux_mac_status_irq(unsigned int int_err_irq, |
528 | struct irq_desc *inta_desc) | 407 | struct irq_desc *inta_desc) |
529 | { | 408 | { |
530 | int i, irq = 0; | 409 | int i, irq = 0; |
531 | u32 status = bfin_read_EMAC_SYSTAT(); | 410 | u32 status = bfin_read_EMAC_SYSTAT(); |
@@ -680,29 +559,48 @@ static int bfin_gpio_irq_type(struct irq_data *d, unsigned int type) | |||
680 | } | 559 | } |
681 | 560 | ||
682 | #ifdef CONFIG_PM | 561 | #ifdef CONFIG_PM |
683 | int bfin_gpio_set_wake(struct irq_data *d, unsigned int state) | 562 | static int bfin_gpio_set_wake(struct irq_data *d, unsigned int state) |
684 | { | 563 | { |
685 | return gpio_pm_wakeup_ctrl(irq_to_gpio(d->irq), state); | 564 | return gpio_pm_wakeup_ctrl(irq_to_gpio(d->irq), state); |
686 | } | 565 | } |
566 | #else | ||
567 | # define bfin_gpio_set_wake NULL | ||
687 | #endif | 568 | #endif |
688 | 569 | ||
689 | static void bfin_demux_gpio_irq(unsigned int inta_irq, | 570 | static void bfin_demux_gpio_block(unsigned int irq) |
690 | struct irq_desc *desc) | ||
691 | { | 571 | { |
692 | unsigned int i, gpio, mask, irq, search = 0; | 572 | unsigned int gpio, mask; |
573 | |||
574 | gpio = irq_to_gpio(irq); | ||
575 | mask = get_gpiop_data(gpio) & get_gpiop_maska(gpio); | ||
576 | |||
577 | while (mask) { | ||
578 | if (mask & 1) | ||
579 | bfin_handle_irq(irq); | ||
580 | irq++; | ||
581 | mask >>= 1; | ||
582 | } | ||
583 | } | ||
584 | |||
585 | void bfin_demux_gpio_irq(unsigned int inta_irq, | ||
586 | struct irq_desc *desc) | ||
587 | { | ||
588 | unsigned int irq; | ||
693 | 589 | ||
694 | switch (inta_irq) { | 590 | switch (inta_irq) { |
695 | #if defined(CONFIG_BF53x) | 591 | #if defined(BF537_FAMILY) |
696 | case IRQ_PROG_INTA: | 592 | case IRQ_PF_INTA_PG_INTA: |
697 | irq = IRQ_PF0; | 593 | bfin_demux_gpio_block(IRQ_PF0); |
698 | search = 1; | 594 | irq = IRQ_PG0; |
699 | break; | 595 | break; |
700 | # if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) | 596 | case IRQ_PH_INTA_MAC_RX: |
701 | case IRQ_MAC_RX: | ||
702 | irq = IRQ_PH0; | 597 | irq = IRQ_PH0; |
703 | break; | 598 | break; |
704 | # endif | 599 | #elif defined(BF533_FAMILY) |
705 | #elif defined(CONFIG_BF538) || defined(CONFIG_BF539) | 600 | case IRQ_PROG_INTA: |
601 | irq = IRQ_PF0; | ||
602 | break; | ||
603 | #elif defined(BF538_FAMILY) | ||
706 | case IRQ_PORTF_INTA: | 604 | case IRQ_PORTF_INTA: |
707 | irq = IRQ_PF0; | 605 | irq = IRQ_PF0; |
708 | break; | 606 | break; |
@@ -732,31 +630,7 @@ static void bfin_demux_gpio_irq(unsigned int inta_irq, | |||
732 | return; | 630 | return; |
733 | } | 631 | } |
734 | 632 | ||
735 | if (search) { | 633 | bfin_demux_gpio_block(irq); |
736 | for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { | ||
737 | irq += i; | ||
738 | |||
739 | mask = get_gpiop_data(i) & get_gpiop_maska(i); | ||
740 | |||
741 | while (mask) { | ||
742 | if (mask & 1) | ||
743 | bfin_handle_irq(irq); | ||
744 | irq++; | ||
745 | mask >>= 1; | ||
746 | } | ||
747 | } | ||
748 | } else { | ||
749 | gpio = irq_to_gpio(irq); | ||
750 | mask = get_gpiop_data(gpio) & get_gpiop_maska(gpio); | ||
751 | |||
752 | do { | ||
753 | if (mask & 1) | ||
754 | bfin_handle_irq(irq); | ||
755 | irq++; | ||
756 | mask >>= 1; | ||
757 | } while (mask); | ||
758 | } | ||
759 | |||
760 | } | 634 | } |
761 | 635 | ||
762 | #else /* CONFIG_BF54x */ | 636 | #else /* CONFIG_BF54x */ |
@@ -974,15 +848,11 @@ static int bfin_gpio_irq_type(struct irq_data *d, unsigned int type) | |||
974 | } | 848 | } |
975 | 849 | ||
976 | #ifdef CONFIG_PM | 850 | #ifdef CONFIG_PM |
977 | u32 pint_saved_masks[NR_PINT_SYS_IRQS]; | 851 | static int bfin_gpio_set_wake(struct irq_data *d, unsigned int state) |
978 | u32 pint_wakeup_masks[NR_PINT_SYS_IRQS]; | ||
979 | |||
980 | int bfin_gpio_set_wake(struct irq_data *d, unsigned int state) | ||
981 | { | 852 | { |
982 | u32 pint_irq; | 853 | u32 pint_irq; |
983 | u32 pint_val = irq2pint_lut[d->irq - SYS_IRQS]; | 854 | u32 pint_val = irq2pint_lut[d->irq - SYS_IRQS]; |
984 | u32 bank = PINT_2_BANK(pint_val); | 855 | u32 bank = PINT_2_BANK(pint_val); |
985 | u32 pintbit = PINT_BIT(pint_val); | ||
986 | 856 | ||
987 | switch (bank) { | 857 | switch (bank) { |
988 | case 0: | 858 | case 0: |
@@ -1003,46 +873,14 @@ int bfin_gpio_set_wake(struct irq_data *d, unsigned int state) | |||
1003 | 873 | ||
1004 | bfin_internal_set_wake(pint_irq, state); | 874 | bfin_internal_set_wake(pint_irq, state); |
1005 | 875 | ||
1006 | if (state) | ||
1007 | pint_wakeup_masks[bank] |= pintbit; | ||
1008 | else | ||
1009 | pint_wakeup_masks[bank] &= ~pintbit; | ||
1010 | |||
1011 | return 0; | 876 | return 0; |
1012 | } | 877 | } |
1013 | 878 | #else | |
1014 | u32 bfin_pm_setup(void) | 879 | # define bfin_gpio_set_wake NULL |
1015 | { | ||
1016 | u32 val, i; | ||
1017 | |||
1018 | for (i = 0; i < NR_PINT_SYS_IRQS; i++) { | ||
1019 | val = pint[i]->mask_clear; | ||
1020 | pint_saved_masks[i] = val; | ||
1021 | if (val ^ pint_wakeup_masks[i]) { | ||
1022 | pint[i]->mask_clear = val; | ||
1023 | pint[i]->mask_set = pint_wakeup_masks[i]; | ||
1024 | } | ||
1025 | } | ||
1026 | |||
1027 | return 0; | ||
1028 | } | ||
1029 | |||
1030 | void bfin_pm_restore(void) | ||
1031 | { | ||
1032 | u32 i, val; | ||
1033 | |||
1034 | for (i = 0; i < NR_PINT_SYS_IRQS; i++) { | ||
1035 | val = pint_saved_masks[i]; | ||
1036 | if (val ^ pint_wakeup_masks[i]) { | ||
1037 | pint[i]->mask_clear = pint[i]->mask_clear; | ||
1038 | pint[i]->mask_set = val; | ||
1039 | } | ||
1040 | } | ||
1041 | } | ||
1042 | #endif | 880 | #endif |
1043 | 881 | ||
1044 | static void bfin_demux_gpio_irq(unsigned int inta_irq, | 882 | void bfin_demux_gpio_irq(unsigned int inta_irq, |
1045 | struct irq_desc *desc) | 883 | struct irq_desc *desc) |
1046 | { | 884 | { |
1047 | u32 bank, pint_val; | 885 | u32 bank, pint_val; |
1048 | u32 request, irq; | 886 | u32 request, irq; |
@@ -1091,9 +929,7 @@ static struct irq_chip bfin_gpio_irqchip = { | |||
1091 | .irq_set_type = bfin_gpio_irq_type, | 929 | .irq_set_type = bfin_gpio_irq_type, |
1092 | .irq_startup = bfin_gpio_irq_startup, | 930 | .irq_startup = bfin_gpio_irq_startup, |
1093 | .irq_shutdown = bfin_gpio_irq_shutdown, | 931 | .irq_shutdown = bfin_gpio_irq_shutdown, |
1094 | #ifdef CONFIG_PM | ||
1095 | .irq_set_wake = bfin_gpio_set_wake, | 932 | .irq_set_wake = bfin_gpio_set_wake, |
1096 | #endif | ||
1097 | }; | 933 | }; |
1098 | 934 | ||
1099 | void __cpuinit init_exception_vectors(void) | 935 | void __cpuinit init_exception_vectors(void) |
@@ -1127,12 +963,12 @@ int __init init_arch_irq(void) | |||
1127 | { | 963 | { |
1128 | int irq; | 964 | int irq; |
1129 | unsigned long ilat = 0; | 965 | unsigned long ilat = 0; |
966 | |||
1130 | /* Disable all the peripheral intrs - page 4-29 HW Ref manual */ | 967 | /* Disable all the peripheral intrs - page 4-29 HW Ref manual */ |
1131 | #if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) \ | 968 | #ifdef SIC_IMASK0 |
1132 | || defined(BF538_FAMILY) || defined(CONFIG_BF51x) | ||
1133 | bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); | 969 | bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); |
1134 | bfin_write_SIC_IMASK1(SIC_UNMASK_ALL); | 970 | bfin_write_SIC_IMASK1(SIC_UNMASK_ALL); |
1135 | # ifdef CONFIG_BF54x | 971 | # ifdef SIC_IMASK2 |
1136 | bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); | 972 | bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); |
1137 | # endif | 973 | # endif |
1138 | # ifdef CONFIG_SMP | 974 | # ifdef CONFIG_SMP |
@@ -1145,11 +981,6 @@ int __init init_arch_irq(void) | |||
1145 | 981 | ||
1146 | local_irq_disable(); | 982 | local_irq_disable(); |
1147 | 983 | ||
1148 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) | ||
1149 | /* Clear EMAC Interrupt Status bits so we can demux it later */ | ||
1150 | bfin_write_EMAC_SYSTAT(-1); | ||
1151 | #endif | ||
1152 | |||
1153 | #ifdef CONFIG_BF54x | 984 | #ifdef CONFIG_BF54x |
1154 | # ifdef CONFIG_PINTx_REASSIGN | 985 | # ifdef CONFIG_PINTx_REASSIGN |
1155 | pint[0]->assign = CONFIG_PINT0_ASSIGN; | 986 | pint[0]->assign = CONFIG_PINT0_ASSIGN; |
@@ -1168,11 +999,11 @@ int __init init_arch_irq(void) | |||
1168 | irq_set_chip(irq, &bfin_internal_irqchip); | 999 | irq_set_chip(irq, &bfin_internal_irqchip); |
1169 | 1000 | ||
1170 | switch (irq) { | 1001 | switch (irq) { |
1171 | #if defined(CONFIG_BF53x) | 1002 | #if defined(BF537_FAMILY) |
1003 | case IRQ_PH_INTA_MAC_RX: | ||
1004 | case IRQ_PF_INTA_PG_INTA: | ||
1005 | #elif defined(BF533_FAMILY) | ||
1172 | case IRQ_PROG_INTA: | 1006 | case IRQ_PROG_INTA: |
1173 | # if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) | ||
1174 | case IRQ_MAC_RX: | ||
1175 | # endif | ||
1176 | #elif defined(CONFIG_BF54x) | 1007 | #elif defined(CONFIG_BF54x) |
1177 | case IRQ_PINT0: | 1008 | case IRQ_PINT0: |
1178 | case IRQ_PINT1: | 1009 | case IRQ_PINT1: |
@@ -1186,16 +1017,11 @@ int __init init_arch_irq(void) | |||
1186 | case IRQ_PROG0_INTA: | 1017 | case IRQ_PROG0_INTA: |
1187 | case IRQ_PROG1_INTA: | 1018 | case IRQ_PROG1_INTA: |
1188 | case IRQ_PROG2_INTA: | 1019 | case IRQ_PROG2_INTA: |
1189 | #elif defined(CONFIG_BF538) || defined(CONFIG_BF539) | 1020 | #elif defined(BF538_FAMILY) |
1190 | case IRQ_PORTF_INTA: | 1021 | case IRQ_PORTF_INTA: |
1191 | #endif | 1022 | #endif |
1192 | irq_set_chained_handler(irq, bfin_demux_gpio_irq); | 1023 | irq_set_chained_handler(irq, bfin_demux_gpio_irq); |
1193 | break; | 1024 | break; |
1194 | #ifdef BF537_GENERIC_ERROR_INT_DEMUX | ||
1195 | case IRQ_GENERIC_ERROR: | ||
1196 | irq_set_chained_handler(irq, bfin_demux_error_irq); | ||
1197 | break; | ||
1198 | #endif | ||
1199 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 1025 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
1200 | case IRQ_MAC_ERROR: | 1026 | case IRQ_MAC_ERROR: |
1201 | irq_set_chained_handler(irq, | 1027 | irq_set_chained_handler(irq, |
@@ -1213,11 +1039,10 @@ int __init init_arch_irq(void) | |||
1213 | case IRQ_CORETMR: | 1039 | case IRQ_CORETMR: |
1214 | # ifdef CONFIG_SMP | 1040 | # ifdef CONFIG_SMP |
1215 | irq_set_handler(irq, handle_percpu_irq); | 1041 | irq_set_handler(irq, handle_percpu_irq); |
1216 | break; | ||
1217 | # else | 1042 | # else |
1218 | irq_set_handler(irq, handle_simple_irq); | 1043 | irq_set_handler(irq, handle_simple_irq); |
1219 | break; | ||
1220 | # endif | 1044 | # endif |
1045 | break; | ||
1221 | #endif | 1046 | #endif |
1222 | 1047 | ||
1223 | #ifdef CONFIG_TICKSOURCE_GPTMR0 | 1048 | #ifdef CONFIG_TICKSOURCE_GPTMR0 |
@@ -1226,26 +1051,17 @@ int __init init_arch_irq(void) | |||
1226 | break; | 1051 | break; |
1227 | #endif | 1052 | #endif |
1228 | 1053 | ||
1229 | #ifdef CONFIG_IPIPE | ||
1230 | default: | 1054 | default: |
1055 | #ifdef CONFIG_IPIPE | ||
1231 | irq_set_handler(irq, handle_level_irq); | 1056 | irq_set_handler(irq, handle_level_irq); |
1232 | break; | 1057 | #else |
1233 | #else /* !CONFIG_IPIPE */ | ||
1234 | default: | ||
1235 | irq_set_handler(irq, handle_simple_irq); | 1058 | irq_set_handler(irq, handle_simple_irq); |
1059 | #endif | ||
1236 | break; | 1060 | break; |
1237 | #endif /* !CONFIG_IPIPE */ | ||
1238 | } | 1061 | } |
1239 | } | 1062 | } |
1240 | 1063 | ||
1241 | #ifdef BF537_GENERIC_ERROR_INT_DEMUX | 1064 | init_mach_irq(); |
1242 | for (irq = IRQ_PPI_ERROR; irq <= IRQ_UART1_ERROR; irq++) | ||
1243 | irq_set_chip_and_handler(irq, &bfin_generic_error_irqchip, | ||
1244 | handle_level_irq); | ||
1245 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | ||
1246 | irq_set_chained_handler(IRQ_MAC_ERROR, bfin_demux_mac_status_irq); | ||
1247 | #endif | ||
1248 | #endif | ||
1249 | 1065 | ||
1250 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 1066 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
1251 | for (irq = IRQ_MAC_PHYINT; irq <= IRQ_MAC_STMDONE; irq++) | 1067 | for (irq = IRQ_MAC_PHYINT; irq <= IRQ_MAC_STMDONE; irq++) |
@@ -1307,53 +1123,54 @@ int __init init_arch_irq(void) | |||
1307 | #ifdef CONFIG_DO_IRQ_L1 | 1123 | #ifdef CONFIG_DO_IRQ_L1 |
1308 | __attribute__((l1_text)) | 1124 | __attribute__((l1_text)) |
1309 | #endif | 1125 | #endif |
1310 | void do_irq(int vec, struct pt_regs *fp) | 1126 | static int vec_to_irq(int vec) |
1311 | { | 1127 | { |
1312 | if (vec == EVT_IVTMR_P) { | 1128 | struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst; |
1313 | vec = IRQ_CORETMR; | 1129 | struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop; |
1314 | } else { | 1130 | unsigned long sic_status[3]; |
1315 | struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst; | 1131 | |
1316 | struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop; | 1132 | if (likely(vec == EVT_IVTMR_P)) |
1317 | #if defined(SIC_ISR0) | 1133 | return IRQ_CORETMR; |
1318 | unsigned long sic_status[3]; | ||
1319 | 1134 | ||
1320 | if (smp_processor_id()) { | 1135 | #ifdef SIC_ISR |
1136 | sic_status[0] = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR(); | ||
1137 | #else | ||
1138 | if (smp_processor_id()) { | ||
1321 | # ifdef SICB_ISR0 | 1139 | # ifdef SICB_ISR0 |
1322 | /* This will be optimized out in UP mode. */ | 1140 | /* This will be optimized out in UP mode. */ |
1323 | sic_status[0] = bfin_read_SICB_ISR0() & bfin_read_SICB_IMASK0(); | 1141 | sic_status[0] = bfin_read_SICB_ISR0() & bfin_read_SICB_IMASK0(); |
1324 | sic_status[1] = bfin_read_SICB_ISR1() & bfin_read_SICB_IMASK1(); | 1142 | sic_status[1] = bfin_read_SICB_ISR1() & bfin_read_SICB_IMASK1(); |
1325 | # endif | ||
1326 | } else { | ||
1327 | sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0(); | ||
1328 | sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1(); | ||
1329 | } | ||
1330 | # ifdef SIC_ISR2 | ||
1331 | sic_status[2] = bfin_read_SIC_ISR2() & bfin_read_SIC_IMASK2(); | ||
1332 | # endif | 1143 | # endif |
1333 | for (;; ivg++) { | 1144 | } else { |
1334 | if (ivg >= ivg_stop) { | 1145 | sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0(); |
1335 | atomic_inc(&num_spurious); | 1146 | sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1(); |
1336 | return; | 1147 | } |
1337 | } | 1148 | #endif |
1338 | if (sic_status[(ivg->irqno - IVG7) / 32] & ivg->isrflag) | 1149 | #ifdef SIC_ISR2 |
1339 | break; | 1150 | sic_status[2] = bfin_read_SIC_ISR2() & bfin_read_SIC_IMASK2(); |
1340 | } | 1151 | #endif |
1341 | #else | ||
1342 | unsigned long sic_status; | ||
1343 | |||
1344 | sic_status = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR(); | ||
1345 | 1152 | ||
1346 | for (;; ivg++) { | 1153 | for (;; ivg++) { |
1347 | if (ivg >= ivg_stop) { | 1154 | if (ivg >= ivg_stop) |
1348 | atomic_inc(&num_spurious); | 1155 | return -1; |
1349 | return; | 1156 | #ifdef SIC_ISR |
1350 | } else if (sic_status & ivg->isrflag) | 1157 | if (sic_status[0] & ivg->isrflag) |
1351 | break; | 1158 | #else |
1352 | } | 1159 | if (sic_status[(ivg->irqno - IVG7) / 32] & ivg->isrflag) |
1353 | #endif | 1160 | #endif |
1354 | vec = ivg->irqno; | 1161 | return ivg->irqno; |
1355 | } | 1162 | } |
1356 | asm_do_IRQ(vec, fp); | 1163 | } |
1164 | |||
1165 | #ifdef CONFIG_DO_IRQ_L1 | ||
1166 | __attribute__((l1_text)) | ||
1167 | #endif | ||
1168 | void do_irq(int vec, struct pt_regs *fp) | ||
1169 | { | ||
1170 | int irq = vec_to_irq(vec); | ||
1171 | if (irq == -1) | ||
1172 | return; | ||
1173 | asm_do_IRQ(irq, fp); | ||
1357 | } | 1174 | } |
1358 | 1175 | ||
1359 | #ifdef CONFIG_IPIPE | 1176 | #ifdef CONFIG_IPIPE |
@@ -1391,40 +1208,9 @@ asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs *regs) | |||
1391 | struct ivgx *ivg = ivg7_13[vec-IVG7].ifirst; | 1208 | struct ivgx *ivg = ivg7_13[vec-IVG7].ifirst; |
1392 | int irq, s = 0; | 1209 | int irq, s = 0; |
1393 | 1210 | ||
1394 | if (likely(vec == EVT_IVTMR_P)) | 1211 | irq = vec_to_irq(vec); |
1395 | irq = IRQ_CORETMR; | 1212 | if (irq == -1) |
1396 | else { | 1213 | return 0; |
1397 | #if defined(SIC_ISR0) | ||
1398 | unsigned long sic_status[3]; | ||
1399 | |||
1400 | sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0(); | ||
1401 | sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1(); | ||
1402 | # ifdef SIC_ISR2 | ||
1403 | sic_status[2] = bfin_read_SIC_ISR2() & bfin_read_SIC_IMASK2(); | ||
1404 | # endif | ||
1405 | for (;; ivg++) { | ||
1406 | if (ivg >= ivg_stop) { | ||
1407 | atomic_inc(&num_spurious); | ||
1408 | return 0; | ||
1409 | } | ||
1410 | if (sic_status[(ivg->irqno - IVG7) / 32] & ivg->isrflag) | ||
1411 | break; | ||
1412 | } | ||
1413 | #else | ||
1414 | unsigned long sic_status; | ||
1415 | |||
1416 | sic_status = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR(); | ||
1417 | |||
1418 | for (;; ivg++) { | ||
1419 | if (ivg >= ivg_stop) { | ||
1420 | atomic_inc(&num_spurious); | ||
1421 | return 0; | ||
1422 | } else if (sic_status & ivg->isrflag) | ||
1423 | break; | ||
1424 | } | ||
1425 | #endif | ||
1426 | irq = ivg->irqno; | ||
1427 | } | ||
1428 | 1214 | ||
1429 | if (irq == IRQ_SYSTMR) { | 1215 | if (irq == IRQ_SYSTMR) { |
1430 | #if !defined(CONFIG_GENERIC_CLOCKEVENTS) || defined(CONFIG_TICKSOURCE_GPTMR0) | 1216 | #if !defined(CONFIG_GENERIC_CLOCKEVENTS) || defined(CONFIG_TICKSOURCE_GPTMR0) |
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c index 1fbd94c44457..35e7e1eb0188 100644 --- a/arch/blackfin/mach-common/smp.c +++ b/arch/blackfin/mach-common/smp.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <asm/atomic.h> | 26 | #include <asm/atomic.h> |
27 | #include <asm/cacheflush.h> | 27 | #include <asm/cacheflush.h> |
28 | #include <asm/irq_handler.h> | ||
28 | #include <asm/mmu_context.h> | 29 | #include <asm/mmu_context.h> |
29 | #include <asm/pgtable.h> | 30 | #include <asm/pgtable.h> |
30 | #include <asm/pgalloc.h> | 31 | #include <asm/pgalloc.h> |
@@ -96,7 +97,7 @@ static void ipi_cpu_stop(unsigned int cpu) | |||
96 | dump_stack(); | 97 | dump_stack(); |
97 | spin_unlock(&stop_lock); | 98 | spin_unlock(&stop_lock); |
98 | 99 | ||
99 | cpu_clear(cpu, cpu_online_map); | 100 | set_cpu_online(cpu, false); |
100 | 101 | ||
101 | local_irq_disable(); | 102 | local_irq_disable(); |
102 | 103 | ||
@@ -146,7 +147,7 @@ static void ipi_call_function(unsigned int cpu, struct ipi_message *msg) | |||
146 | */ | 147 | */ |
147 | resync_core_dcache(); | 148 | resync_core_dcache(); |
148 | #endif | 149 | #endif |
149 | cpu_clear(cpu, *msg->call_struct.waitmask); | 150 | cpumask_clear_cpu(cpu, msg->call_struct.waitmask); |
150 | } | 151 | } |
151 | } | 152 | } |
152 | 153 | ||
@@ -222,9 +223,10 @@ static inline void smp_send_message(cpumask_t callmap, unsigned long type, | |||
222 | struct ipi_message_queue *msg_queue; | 223 | struct ipi_message_queue *msg_queue; |
223 | struct ipi_message *msg; | 224 | struct ipi_message *msg; |
224 | unsigned long flags, next_msg; | 225 | unsigned long flags, next_msg; |
225 | cpumask_t waitmask = callmap; /* waitmask is shared by all cpus */ | 226 | cpumask_t waitmask; /* waitmask is shared by all cpus */ |
226 | 227 | ||
227 | for_each_cpu_mask(cpu, callmap) { | 228 | cpumask_copy(&waitmask, &callmap); |
229 | for_each_cpu(cpu, &callmap) { | ||
228 | msg_queue = &per_cpu(ipi_msg_queue, cpu); | 230 | msg_queue = &per_cpu(ipi_msg_queue, cpu); |
229 | spin_lock_irqsave(&msg_queue->lock, flags); | 231 | spin_lock_irqsave(&msg_queue->lock, flags); |
230 | if (msg_queue->count < BFIN_IPI_MSGQ_LEN) { | 232 | if (msg_queue->count < BFIN_IPI_MSGQ_LEN) { |
@@ -246,7 +248,7 @@ static inline void smp_send_message(cpumask_t callmap, unsigned long type, | |||
246 | } | 248 | } |
247 | 249 | ||
248 | if (wait) { | 250 | if (wait) { |
249 | while (!cpus_empty(waitmask)) | 251 | while (!cpumask_empty(&waitmask)) |
250 | blackfin_dcache_invalidate_range( | 252 | blackfin_dcache_invalidate_range( |
251 | (unsigned long)(&waitmask), | 253 | (unsigned long)(&waitmask), |
252 | (unsigned long)(&waitmask)); | 254 | (unsigned long)(&waitmask)); |
@@ -265,9 +267,9 @@ int smp_call_function(void (*func)(void *info), void *info, int wait) | |||
265 | cpumask_t callmap; | 267 | cpumask_t callmap; |
266 | 268 | ||
267 | preempt_disable(); | 269 | preempt_disable(); |
268 | callmap = cpu_online_map; | 270 | cpumask_copy(&callmap, cpu_online_mask); |
269 | cpu_clear(smp_processor_id(), callmap); | 271 | cpumask_clear_cpu(smp_processor_id(), &callmap); |
270 | if (!cpus_empty(callmap)) | 272 | if (!cpumask_empty(&callmap)) |
271 | smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait); | 273 | smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait); |
272 | 274 | ||
273 | preempt_enable(); | 275 | preempt_enable(); |
@@ -284,8 +286,8 @@ int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | |||
284 | 286 | ||
285 | if (cpu_is_offline(cpu)) | 287 | if (cpu_is_offline(cpu)) |
286 | return 0; | 288 | return 0; |
287 | cpus_clear(callmap); | 289 | cpumask_clear(&callmap); |
288 | cpu_set(cpu, callmap); | 290 | cpumask_set_cpu(cpu, &callmap); |
289 | 291 | ||
290 | smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait); | 292 | smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait); |
291 | 293 | ||
@@ -308,9 +310,9 @@ void smp_send_stop(void) | |||
308 | cpumask_t callmap; | 310 | cpumask_t callmap; |
309 | 311 | ||
310 | preempt_disable(); | 312 | preempt_disable(); |
311 | callmap = cpu_online_map; | 313 | cpumask_copy(&callmap, cpu_online_mask); |
312 | cpu_clear(smp_processor_id(), callmap); | 314 | cpumask_clear_cpu(smp_processor_id(), &callmap); |
313 | if (!cpus_empty(callmap)) | 315 | if (!cpumask_empty(&callmap)) |
314 | smp_send_message(callmap, BFIN_IPI_CPU_STOP, NULL, NULL, 0); | 316 | smp_send_message(callmap, BFIN_IPI_CPU_STOP, NULL, NULL, 0); |
315 | 317 | ||
316 | preempt_enable(); | 318 | preempt_enable(); |
diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c index dfd304a4a3ea..29d98faa1efd 100644 --- a/arch/blackfin/mm/sram-alloc.c +++ b/arch/blackfin/mm/sram-alloc.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/poll.h> | 16 | #include <linux/poll.h> |
17 | #include <linux/proc_fs.h> | 17 | #include <linux/proc_fs.h> |
18 | #include <linux/seq_file.h> | ||
18 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
19 | #include <linux/rtc.h> | 20 | #include <linux/rtc.h> |
20 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
@@ -764,7 +765,7 @@ EXPORT_SYMBOL(sram_alloc_with_lsl); | |||
764 | /* Need to keep line of output the same. Currently, that is 44 bytes | 765 | /* Need to keep line of output the same. Currently, that is 44 bytes |
765 | * (including newline). | 766 | * (including newline). |
766 | */ | 767 | */ |
767 | static int _sram_proc_read(char *buf, int *len, int count, const char *desc, | 768 | static int _sram_proc_show(struct seq_file *m, const char *desc, |
768 | struct sram_piece *pfree_head, | 769 | struct sram_piece *pfree_head, |
769 | struct sram_piece *pused_head) | 770 | struct sram_piece *pused_head) |
770 | { | 771 | { |
@@ -773,13 +774,13 @@ static int _sram_proc_read(char *buf, int *len, int count, const char *desc, | |||
773 | if (!pfree_head || !pused_head) | 774 | if (!pfree_head || !pused_head) |
774 | return -1; | 775 | return -1; |
775 | 776 | ||
776 | *len += sprintf(&buf[*len], "--- SRAM %-14s Size PID State \n", desc); | 777 | seq_printf(m, "--- SRAM %-14s Size PID State \n", desc); |
777 | 778 | ||
778 | /* search the relevant memory slot */ | 779 | /* search the relevant memory slot */ |
779 | pslot = pused_head->next; | 780 | pslot = pused_head->next; |
780 | 781 | ||
781 | while (pslot != NULL) { | 782 | while (pslot != NULL) { |
782 | *len += sprintf(&buf[*len], "%p-%p %10i %5i %-10s\n", | 783 | seq_printf(m, "%p-%p %10i %5i %-10s\n", |
783 | pslot->paddr, pslot->paddr + pslot->size, | 784 | pslot->paddr, pslot->paddr + pslot->size, |
784 | pslot->size, pslot->pid, "ALLOCATED"); | 785 | pslot->size, pslot->pid, "ALLOCATED"); |
785 | 786 | ||
@@ -789,7 +790,7 @@ static int _sram_proc_read(char *buf, int *len, int count, const char *desc, | |||
789 | pslot = pfree_head->next; | 790 | pslot = pfree_head->next; |
790 | 791 | ||
791 | while (pslot != NULL) { | 792 | while (pslot != NULL) { |
792 | *len += sprintf(&buf[*len], "%p-%p %10i %5i %-10s\n", | 793 | seq_printf(m, "%p-%p %10i %5i %-10s\n", |
793 | pslot->paddr, pslot->paddr + pslot->size, | 794 | pslot->paddr, pslot->paddr + pslot->size, |
794 | pslot->size, pslot->pid, "FREE"); | 795 | pslot->size, pslot->pid, "FREE"); |
795 | 796 | ||
@@ -798,54 +799,62 @@ static int _sram_proc_read(char *buf, int *len, int count, const char *desc, | |||
798 | 799 | ||
799 | return 0; | 800 | return 0; |
800 | } | 801 | } |
801 | static int sram_proc_read(char *buf, char **start, off_t offset, int count, | 802 | static int sram_proc_show(struct seq_file *m, void *v) |
802 | int *eof, void *data) | ||
803 | { | 803 | { |
804 | int len = 0; | ||
805 | unsigned int cpu; | 804 | unsigned int cpu; |
806 | 805 | ||
807 | for (cpu = 0; cpu < num_possible_cpus(); ++cpu) { | 806 | for (cpu = 0; cpu < num_possible_cpus(); ++cpu) { |
808 | if (_sram_proc_read(buf, &len, count, "Scratchpad", | 807 | if (_sram_proc_show(m, "Scratchpad", |
809 | &per_cpu(free_l1_ssram_head, cpu), &per_cpu(used_l1_ssram_head, cpu))) | 808 | &per_cpu(free_l1_ssram_head, cpu), &per_cpu(used_l1_ssram_head, cpu))) |
810 | goto not_done; | 809 | goto not_done; |
811 | #if L1_DATA_A_LENGTH != 0 | 810 | #if L1_DATA_A_LENGTH != 0 |
812 | if (_sram_proc_read(buf, &len, count, "L1 Data A", | 811 | if (_sram_proc_show(m, "L1 Data A", |
813 | &per_cpu(free_l1_data_A_sram_head, cpu), | 812 | &per_cpu(free_l1_data_A_sram_head, cpu), |
814 | &per_cpu(used_l1_data_A_sram_head, cpu))) | 813 | &per_cpu(used_l1_data_A_sram_head, cpu))) |
815 | goto not_done; | 814 | goto not_done; |
816 | #endif | 815 | #endif |
817 | #if L1_DATA_B_LENGTH != 0 | 816 | #if L1_DATA_B_LENGTH != 0 |
818 | if (_sram_proc_read(buf, &len, count, "L1 Data B", | 817 | if (_sram_proc_show(m, "L1 Data B", |
819 | &per_cpu(free_l1_data_B_sram_head, cpu), | 818 | &per_cpu(free_l1_data_B_sram_head, cpu), |
820 | &per_cpu(used_l1_data_B_sram_head, cpu))) | 819 | &per_cpu(used_l1_data_B_sram_head, cpu))) |
821 | goto not_done; | 820 | goto not_done; |
822 | #endif | 821 | #endif |
823 | #if L1_CODE_LENGTH != 0 | 822 | #if L1_CODE_LENGTH != 0 |
824 | if (_sram_proc_read(buf, &len, count, "L1 Instruction", | 823 | if (_sram_proc_show(m, "L1 Instruction", |
825 | &per_cpu(free_l1_inst_sram_head, cpu), | 824 | &per_cpu(free_l1_inst_sram_head, cpu), |
826 | &per_cpu(used_l1_inst_sram_head, cpu))) | 825 | &per_cpu(used_l1_inst_sram_head, cpu))) |
827 | goto not_done; | 826 | goto not_done; |
828 | #endif | 827 | #endif |
829 | } | 828 | } |
830 | #if L2_LENGTH != 0 | 829 | #if L2_LENGTH != 0 |
831 | if (_sram_proc_read(buf, &len, count, "L2", &free_l2_sram_head, | 830 | if (_sram_proc_show(m, "L2", &free_l2_sram_head, &used_l2_sram_head)) |
832 | &used_l2_sram_head)) | ||
833 | goto not_done; | 831 | goto not_done; |
834 | #endif | 832 | #endif |
835 | *eof = 1; | ||
836 | not_done: | 833 | not_done: |
837 | return len; | 834 | return 0; |
835 | } | ||
836 | |||
837 | static int sram_proc_open(struct inode *inode, struct file *file) | ||
838 | { | ||
839 | return single_open(file, sram_proc_show, NULL); | ||
838 | } | 840 | } |
839 | 841 | ||
842 | static const struct file_operations sram_proc_ops = { | ||
843 | .open = sram_proc_open, | ||
844 | .read = seq_read, | ||
845 | .llseek = seq_lseek, | ||
846 | .release = single_release, | ||
847 | }; | ||
848 | |||
840 | static int __init sram_proc_init(void) | 849 | static int __init sram_proc_init(void) |
841 | { | 850 | { |
842 | struct proc_dir_entry *ptr; | 851 | struct proc_dir_entry *ptr; |
843 | ptr = create_proc_entry("sram", S_IFREG | S_IRUGO, NULL); | 852 | |
853 | ptr = proc_create("sram", S_IRUGO, NULL, &sram_proc_ops); | ||
844 | if (!ptr) { | 854 | if (!ptr) { |
845 | printk(KERN_WARNING "unable to create /proc/sram\n"); | 855 | printk(KERN_WARNING "unable to create /proc/sram\n"); |
846 | return -1; | 856 | return -1; |
847 | } | 857 | } |
848 | ptr->read_proc = sram_proc_read; | ||
849 | return 0; | 858 | return 0; |
850 | } | 859 | } |
851 | late_initcall(sram_proc_init); | 860 | late_initcall(sram_proc_init); |
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index e32b0c23c4c8..635e1bfb1c5d 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
@@ -339,6 +339,14 @@ config NO_IOPORT | |||
339 | 339 | ||
340 | source "drivers/pci/Kconfig" | 340 | source "drivers/pci/Kconfig" |
341 | 341 | ||
342 | config HOTPLUG | ||
343 | bool "Support for hot-pluggable devices" | ||
344 | ---help--- | ||
345 | Say Y here if you want to plug devices into your computer while | ||
346 | the system is running, and be able to use them quickly. In many | ||
347 | cases, the devices can likewise be unplugged at any time too. | ||
348 | One well-known example of this is USB. | ||
349 | |||
342 | source "drivers/pci/hotplug/Kconfig" | 350 | source "drivers/pci/hotplug/Kconfig" |
343 | 351 | ||
344 | endmenu | 352 | endmenu |
diff --git a/arch/tile/configs/tile_defconfig b/arch/tile/configs/tile_defconfig deleted file mode 100644 index 0fe54445fda5..000000000000 --- a/arch/tile/configs/tile_defconfig +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | # CONFIG_SWAP is not set | ||
3 | CONFIG_SYSVIPC=y | ||
4 | CONFIG_BLK_DEV_INITRD=y | ||
5 | CONFIG_INITRAMFS_SOURCE="usr/contents.txt" | ||
6 | CONFIG_EXPERT=y | ||
7 | # CONFIG_COMPAT_BRK is not set | ||
8 | CONFIG_PROFILING=y | ||
9 | CONFIG_MODULES=y | ||
10 | CONFIG_MODULE_UNLOAD=y | ||
11 | # CONFIG_BLK_DEV_BSG is not set | ||
12 | # CONFIG_IOSCHED_DEADLINE is not set | ||
13 | # CONFIG_IOSCHED_CFQ is not set | ||
14 | CONFIG_NO_HZ=y | ||
15 | CONFIG_HIGH_RES_TIMERS=y | ||
16 | CONFIG_HZ_100=y | ||
17 | CONFIG_NET=y | ||
18 | CONFIG_PACKET=y | ||
19 | CONFIG_UNIX=y | ||
20 | CONFIG_INET=y | ||
21 | CONFIG_IP_MULTICAST=y | ||
22 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
23 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
24 | # CONFIG_INET_LRO is not set | ||
25 | # CONFIG_INET_DIAG is not set | ||
26 | CONFIG_IPV6=y | ||
27 | # CONFIG_WIRELESS is not set | ||
28 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
29 | CONFIG_SCSI=y | ||
30 | CONFIG_BLK_DEV_SD=y | ||
31 | CONFIG_SCSI_CONSTANTS=y | ||
32 | CONFIG_SCSI_LOGGING=y | ||
33 | CONFIG_NETDEVICES=y | ||
34 | CONFIG_TUN=y | ||
35 | # CONFIG_NETDEV_10000 is not set | ||
36 | # CONFIG_WLAN is not set | ||
37 | # CONFIG_INPUT_MOUSEDEV is not set | ||
38 | # CONFIG_INPUT_KEYBOARD is not set | ||
39 | # CONFIG_INPUT_MOUSE is not set | ||
40 | # CONFIG_SERIO is not set | ||
41 | # CONFIG_VT is not set | ||
42 | # CONFIG_LEGACY_PTYS is not set | ||
43 | # CONFIG_HW_RANDOM is not set | ||
44 | CONFIG_WATCHDOG=y | ||
45 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
46 | # CONFIG_HID_SUPPORT is not set | ||
47 | CONFIG_RTC_CLASS=y | ||
48 | # CONFIG_RTC_INTF_SYSFS is not set | ||
49 | # CONFIG_RTC_INTF_PROC is not set | ||
50 | CONFIG_EXT2_FS=y | ||
51 | CONFIG_EXT3_FS=y | ||
52 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | ||
53 | CONFIG_FUSE_FS=y | ||
54 | CONFIG_MSDOS_FS=y | ||
55 | CONFIG_VFAT_FS=m | ||
56 | CONFIG_TMPFS=y | ||
57 | CONFIG_HUGETLBFS=y | ||
58 | CONFIG_NFS_FS=m | ||
59 | CONFIG_NFS_V3=y | ||
60 | CONFIG_NLS_CODEPAGE_437=y | ||
61 | CONFIG_NLS_ISO8859_1=y | ||
62 | CONFIG_FRAME_WARN=2048 | ||
63 | CONFIG_MAGIC_SYSRQ=y | ||
64 | CONFIG_DEBUG_KERNEL=y | ||
65 | CONFIG_DETECT_HUNG_TASK=y | ||
66 | CONFIG_DEBUG_SPINLOCK_SLEEP=y | ||
67 | CONFIG_DEBUG_INFO=y | ||
68 | CONFIG_DEBUG_VM=y | ||
69 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
70 | CONFIG_DEBUG_STACKOVERFLOW=y | ||
71 | CONFIG_DEBUG_EXTRA_FLAGS="-femit-struct-debug-baseonly" | ||
diff --git a/arch/tile/configs/tilegx_defconfig b/arch/tile/configs/tilegx_defconfig new file mode 100644 index 000000000000..09f1c7fad8bf --- /dev/null +++ b/arch/tile/configs/tilegx_defconfig | |||
@@ -0,0 +1,1833 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux/tilegx 2.6.39-rc5 Kernel Configuration | ||
4 | # Wed May 4 11:08:04 2011 | ||
5 | # | ||
6 | CONFIG_TILE=y | ||
7 | CONFIG_MMU=y | ||
8 | CONFIG_GENERIC_CSUM=y | ||
9 | CONFIG_SEMAPHORE_SLEEPERS=y | ||
10 | CONFIG_HAVE_ARCH_ALLOC_REMAP=y | ||
11 | CONFIG_HAVE_SETUP_PER_CPU_AREA=y | ||
12 | CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y | ||
13 | CONFIG_SYS_SUPPORTS_HUGETLBFS=y | ||
14 | CONFIG_GENERIC_TIME=y | ||
15 | CONFIG_GENERIC_CLOCKEVENTS=y | ||
16 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | ||
17 | CONFIG_DEFAULT_MIGRATION_COST=10000000 | ||
18 | CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y | ||
19 | CONFIG_ARCH_PHYS_ADDR_T_64BIT=y | ||
20 | CONFIG_ARCH_DMA_ADDR_T_64BIT=y | ||
21 | CONFIG_LOCKDEP_SUPPORT=y | ||
22 | CONFIG_STACKTRACE_SUPPORT=y | ||
23 | CONFIG_ARCH_DISCONTIGMEM_ENABLE=y | ||
24 | CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y | ||
25 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | ||
26 | CONFIG_STRICT_DEVMEM=y | ||
27 | CONFIG_SMP=y | ||
28 | # CONFIG_DEBUG_COPY_FROM_USER is not set | ||
29 | CONFIG_HVC_TILE=y | ||
30 | CONFIG_TILEGX=y | ||
31 | CONFIG_64BIT=y | ||
32 | CONFIG_ARCH_DEFCONFIG="arch/tile/configs/tilegx_defconfig" | ||
33 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
34 | CONFIG_CONSTRUCTORS=y | ||
35 | |||
36 | # | ||
37 | # General setup | ||
38 | # | ||
39 | CONFIG_EXPERIMENTAL=y | ||
40 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
41 | CONFIG_CROSS_COMPILE="" | ||
42 | CONFIG_LOCALVERSION="" | ||
43 | # CONFIG_LOCALVERSION_AUTO is not set | ||
44 | CONFIG_SWAP=y | ||
45 | CONFIG_SYSVIPC=y | ||
46 | CONFIG_SYSVIPC_SYSCTL=y | ||
47 | CONFIG_POSIX_MQUEUE=y | ||
48 | CONFIG_POSIX_MQUEUE_SYSCTL=y | ||
49 | CONFIG_BSD_PROCESS_ACCT=y | ||
50 | CONFIG_BSD_PROCESS_ACCT_V3=y | ||
51 | # CONFIG_FHANDLE is not set | ||
52 | CONFIG_TASKSTATS=y | ||
53 | CONFIG_TASK_DELAY_ACCT=y | ||
54 | CONFIG_TASK_XACCT=y | ||
55 | CONFIG_TASK_IO_ACCOUNTING=y | ||
56 | CONFIG_AUDIT=y | ||
57 | CONFIG_HAVE_GENERIC_HARDIRQS=y | ||
58 | |||
59 | # | ||
60 | # IRQ subsystem | ||
61 | # | ||
62 | CONFIG_GENERIC_HARDIRQS=y | ||
63 | CONFIG_GENERIC_IRQ_PROBE=y | ||
64 | CONFIG_GENERIC_IRQ_SHOW=y | ||
65 | CONFIG_GENERIC_PENDING_IRQ=y | ||
66 | |||
67 | # | ||
68 | # RCU Subsystem | ||
69 | # | ||
70 | CONFIG_TREE_RCU=y | ||
71 | # CONFIG_PREEMPT_RCU is not set | ||
72 | # CONFIG_RCU_TRACE is not set | ||
73 | CONFIG_RCU_FANOUT=64 | ||
74 | # CONFIG_RCU_FANOUT_EXACT is not set | ||
75 | # CONFIG_RCU_FAST_NO_HZ is not set | ||
76 | # CONFIG_TREE_RCU_TRACE is not set | ||
77 | # CONFIG_IKCONFIG is not set | ||
78 | CONFIG_LOG_BUF_SHIFT=19 | ||
79 | CONFIG_CGROUPS=y | ||
80 | CONFIG_CGROUP_DEBUG=y | ||
81 | CONFIG_CGROUP_NS=y | ||
82 | # CONFIG_CGROUP_FREEZER is not set | ||
83 | CONFIG_CGROUP_DEVICE=y | ||
84 | CONFIG_CPUSETS=y | ||
85 | CONFIG_PROC_PID_CPUSET=y | ||
86 | CONFIG_CGROUP_CPUACCT=y | ||
87 | CONFIG_RESOURCE_COUNTERS=y | ||
88 | CONFIG_CGROUP_MEM_RES_CTLR=y | ||
89 | CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y | ||
90 | CONFIG_CGROUP_MEM_RES_CTLR_SWAP_ENABLED=y | ||
91 | CONFIG_CGROUP_SCHED=y | ||
92 | CONFIG_FAIR_GROUP_SCHED=y | ||
93 | CONFIG_RT_GROUP_SCHED=y | ||
94 | CONFIG_BLK_CGROUP=y | ||
95 | # CONFIG_DEBUG_BLK_CGROUP is not set | ||
96 | CONFIG_NAMESPACES=y | ||
97 | CONFIG_UTS_NS=y | ||
98 | CONFIG_IPC_NS=y | ||
99 | CONFIG_USER_NS=y | ||
100 | CONFIG_PID_NS=y | ||
101 | CONFIG_NET_NS=y | ||
102 | # CONFIG_SCHED_AUTOGROUP is not set | ||
103 | CONFIG_MM_OWNER=y | ||
104 | # CONFIG_SYSFS_DEPRECATED is not set | ||
105 | CONFIG_RELAY=y | ||
106 | CONFIG_BLK_DEV_INITRD=y | ||
107 | CONFIG_INITRAMFS_SOURCE="usr/contents.txt" | ||
108 | CONFIG_INITRAMFS_ROOT_UID=0 | ||
109 | CONFIG_INITRAMFS_ROOT_GID=0 | ||
110 | CONFIG_RD_GZIP=y | ||
111 | # CONFIG_RD_BZIP2 is not set | ||
112 | # CONFIG_RD_LZMA is not set | ||
113 | # CONFIG_RD_XZ is not set | ||
114 | # CONFIG_RD_LZO is not set | ||
115 | CONFIG_INITRAMFS_COMPRESSION_NONE=y | ||
116 | # CONFIG_INITRAMFS_COMPRESSION_GZIP is not set | ||
117 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
118 | CONFIG_SYSCTL=y | ||
119 | CONFIG_ANON_INODES=y | ||
120 | CONFIG_EXPERT=y | ||
121 | CONFIG_SYSCTL_SYSCALL=y | ||
122 | CONFIG_KALLSYMS=y | ||
123 | # CONFIG_KALLSYMS_ALL is not set | ||
124 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
125 | CONFIG_HOTPLUG=y | ||
126 | CONFIG_PRINTK=y | ||
127 | CONFIG_BUG=y | ||
128 | CONFIG_ELF_CORE=y | ||
129 | CONFIG_BASE_FULL=y | ||
130 | CONFIG_FUTEX=y | ||
131 | CONFIG_EPOLL=y | ||
132 | CONFIG_SIGNALFD=y | ||
133 | CONFIG_TIMERFD=y | ||
134 | CONFIG_EVENTFD=y | ||
135 | CONFIG_SHMEM=y | ||
136 | CONFIG_AIO=y | ||
137 | CONFIG_EMBEDDED=y | ||
138 | |||
139 | # | ||
140 | # Kernel Performance Events And Counters | ||
141 | # | ||
142 | CONFIG_VM_EVENT_COUNTERS=y | ||
143 | CONFIG_PCI_QUIRKS=y | ||
144 | CONFIG_SLUB_DEBUG=y | ||
145 | # CONFIG_COMPAT_BRK is not set | ||
146 | # CONFIG_SLAB is not set | ||
147 | CONFIG_SLUB=y | ||
148 | # CONFIG_SLOB is not set | ||
149 | CONFIG_PROFILING=y | ||
150 | CONFIG_USE_GENERIC_SMP_HELPERS=y | ||
151 | |||
152 | # | ||
153 | # GCOV-based kernel profiling | ||
154 | # | ||
155 | # CONFIG_GCOV_KERNEL is not set | ||
156 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | ||
157 | CONFIG_SLABINFO=y | ||
158 | CONFIG_RT_MUTEXES=y | ||
159 | CONFIG_BASE_SMALL=0 | ||
160 | CONFIG_MODULES=y | ||
161 | CONFIG_MODULE_FORCE_LOAD=y | ||
162 | CONFIG_MODULE_UNLOAD=y | ||
163 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
164 | # CONFIG_MODVERSIONS is not set | ||
165 | # CONFIG_MODULE_SRCVERSION_ALL is not set | ||
166 | CONFIG_STOP_MACHINE=y | ||
167 | CONFIG_BLOCK=y | ||
168 | CONFIG_BLK_DEV_BSG=y | ||
169 | CONFIG_BLK_DEV_INTEGRITY=y | ||
170 | # CONFIG_BLK_DEV_THROTTLING is not set | ||
171 | CONFIG_BLOCK_COMPAT=y | ||
172 | |||
173 | # | ||
174 | # IO Schedulers | ||
175 | # | ||
176 | CONFIG_IOSCHED_NOOP=y | ||
177 | CONFIG_IOSCHED_DEADLINE=y | ||
178 | CONFIG_IOSCHED_CFQ=y | ||
179 | CONFIG_CFQ_GROUP_IOSCHED=y | ||
180 | # CONFIG_DEFAULT_DEADLINE is not set | ||
181 | CONFIG_DEFAULT_CFQ=y | ||
182 | # CONFIG_DEFAULT_NOOP is not set | ||
183 | CONFIG_DEFAULT_IOSCHED="cfq" | ||
184 | CONFIG_PADATA=y | ||
185 | # CONFIG_INLINE_SPIN_TRYLOCK is not set | ||
186 | # CONFIG_INLINE_SPIN_TRYLOCK_BH is not set | ||
187 | # CONFIG_INLINE_SPIN_LOCK is not set | ||
188 | # CONFIG_INLINE_SPIN_LOCK_BH is not set | ||
189 | # CONFIG_INLINE_SPIN_LOCK_IRQ is not set | ||
190 | # CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set | ||
191 | CONFIG_INLINE_SPIN_UNLOCK=y | ||
192 | # CONFIG_INLINE_SPIN_UNLOCK_BH is not set | ||
193 | CONFIG_INLINE_SPIN_UNLOCK_IRQ=y | ||
194 | # CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set | ||
195 | # CONFIG_INLINE_READ_TRYLOCK is not set | ||
196 | # CONFIG_INLINE_READ_LOCK is not set | ||
197 | # CONFIG_INLINE_READ_LOCK_BH is not set | ||
198 | # CONFIG_INLINE_READ_LOCK_IRQ is not set | ||
199 | # CONFIG_INLINE_READ_LOCK_IRQSAVE is not set | ||
200 | CONFIG_INLINE_READ_UNLOCK=y | ||
201 | # CONFIG_INLINE_READ_UNLOCK_BH is not set | ||
202 | CONFIG_INLINE_READ_UNLOCK_IRQ=y | ||
203 | # CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set | ||
204 | # CONFIG_INLINE_WRITE_TRYLOCK is not set | ||
205 | # CONFIG_INLINE_WRITE_LOCK is not set | ||
206 | # CONFIG_INLINE_WRITE_LOCK_BH is not set | ||
207 | # CONFIG_INLINE_WRITE_LOCK_IRQ is not set | ||
208 | # CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set | ||
209 | CONFIG_INLINE_WRITE_UNLOCK=y | ||
210 | # CONFIG_INLINE_WRITE_UNLOCK_BH is not set | ||
211 | CONFIG_INLINE_WRITE_UNLOCK_IRQ=y | ||
212 | # CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set | ||
213 | CONFIG_MUTEX_SPIN_ON_OWNER=y | ||
214 | |||
215 | # | ||
216 | # Tilera-specific configuration | ||
217 | # | ||
218 | CONFIG_NR_CPUS=100 | ||
219 | CONFIG_TICK_ONESHOT=y | ||
220 | CONFIG_NO_HZ=y | ||
221 | CONFIG_HIGH_RES_TIMERS=y | ||
222 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y | ||
223 | CONFIG_HZ_100=y | ||
224 | # CONFIG_HZ_250 is not set | ||
225 | # CONFIG_HZ_300 is not set | ||
226 | # CONFIG_HZ_1000 is not set | ||
227 | CONFIG_HZ=100 | ||
228 | CONFIG_SCHED_HRTICK=y | ||
229 | # CONFIG_KEXEC is not set | ||
230 | CONFIG_COMPAT=y | ||
231 | CONFIG_SYSVIPC_COMPAT=y | ||
232 | # CONFIG_HIGHMEM is not set | ||
233 | CONFIG_NUMA=y | ||
234 | CONFIG_NODES_SHIFT=2 | ||
235 | CONFIG_PAGE_OFFSET=0xC0000000 | ||
236 | CONFIG_SELECT_MEMORY_MODEL=y | ||
237 | CONFIG_DISCONTIGMEM_MANUAL=y | ||
238 | CONFIG_DISCONTIGMEM=y | ||
239 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
240 | CONFIG_NEED_MULTIPLE_NODES=y | ||
241 | CONFIG_PAGEFLAGS_EXTENDED=y | ||
242 | CONFIG_SPLIT_PTLOCK_CPUS=4 | ||
243 | # CONFIG_COMPACTION is not set | ||
244 | CONFIG_MIGRATION=y | ||
245 | CONFIG_PHYS_ADDR_T_64BIT=y | ||
246 | CONFIG_ZONE_DMA_FLAG=0 | ||
247 | CONFIG_VIRT_TO_BUS=y | ||
248 | # CONFIG_KSM is not set | ||
249 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 | ||
250 | # CONFIG_CMDLINE_BOOL is not set | ||
251 | CONFIG_VMALLOC_RESERVE=0x1000000 | ||
252 | CONFIG_HARDWALL=y | ||
253 | CONFIG_KERNEL_PL=1 | ||
254 | |||
255 | # | ||
256 | # Bus options | ||
257 | # | ||
258 | CONFIG_PCI=y | ||
259 | CONFIG_PCI_DOMAINS=y | ||
260 | # CONFIG_NO_IOMEM is not set | ||
261 | # CONFIG_NO_IOPORT is not set | ||
262 | # CONFIG_ARCH_SUPPORTS_MSI is not set | ||
263 | CONFIG_PCI_DEBUG=y | ||
264 | # CONFIG_PCI_STUB is not set | ||
265 | # CONFIG_PCI_IOV is not set | ||
266 | # CONFIG_HOTPLUG_PCI is not set | ||
267 | |||
268 | # | ||
269 | # Executable file formats | ||
270 | # | ||
271 | CONFIG_KCORE_ELF=y | ||
272 | CONFIG_BINFMT_ELF=y | ||
273 | CONFIG_COMPAT_BINFMT_ELF=y | ||
274 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
275 | # CONFIG_HAVE_AOUT is not set | ||
276 | CONFIG_BINFMT_MISC=y | ||
277 | CONFIG_NET=y | ||
278 | |||
279 | # | ||
280 | # Networking options | ||
281 | # | ||
282 | CONFIG_PACKET=y | ||
283 | CONFIG_UNIX=y | ||
284 | CONFIG_XFRM=y | ||
285 | CONFIG_XFRM_USER=y | ||
286 | CONFIG_XFRM_SUB_POLICY=y | ||
287 | CONFIG_XFRM_MIGRATE=y | ||
288 | CONFIG_XFRM_STATISTICS=y | ||
289 | CONFIG_XFRM_IPCOMP=m | ||
290 | CONFIG_NET_KEY=m | ||
291 | CONFIG_NET_KEY_MIGRATE=y | ||
292 | CONFIG_INET=y | ||
293 | CONFIG_IP_MULTICAST=y | ||
294 | CONFIG_IP_ADVANCED_ROUTER=y | ||
295 | # CONFIG_IP_FIB_TRIE_STATS is not set | ||
296 | CONFIG_IP_MULTIPLE_TABLES=y | ||
297 | CONFIG_IP_ROUTE_MULTIPATH=y | ||
298 | CONFIG_IP_ROUTE_VERBOSE=y | ||
299 | CONFIG_IP_ROUTE_CLASSID=y | ||
300 | # CONFIG_IP_PNP is not set | ||
301 | CONFIG_NET_IPIP=m | ||
302 | # CONFIG_NET_IPGRE_DEMUX is not set | ||
303 | CONFIG_IP_MROUTE=y | ||
304 | # CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set | ||
305 | CONFIG_IP_PIMSM_V1=y | ||
306 | CONFIG_IP_PIMSM_V2=y | ||
307 | # CONFIG_ARPD is not set | ||
308 | CONFIG_SYN_COOKIES=y | ||
309 | CONFIG_INET_AH=m | ||
310 | CONFIG_INET_ESP=m | ||
311 | CONFIG_INET_IPCOMP=m | ||
312 | CONFIG_INET_XFRM_TUNNEL=m | ||
313 | CONFIG_INET_TUNNEL=m | ||
314 | CONFIG_INET_XFRM_MODE_TRANSPORT=m | ||
315 | CONFIG_INET_XFRM_MODE_TUNNEL=m | ||
316 | CONFIG_INET_XFRM_MODE_BEET=m | ||
317 | CONFIG_INET_LRO=y | ||
318 | CONFIG_INET_DIAG=m | ||
319 | CONFIG_INET_TCP_DIAG=m | ||
320 | CONFIG_TCP_CONG_ADVANCED=y | ||
321 | CONFIG_TCP_CONG_BIC=m | ||
322 | CONFIG_TCP_CONG_CUBIC=y | ||
323 | CONFIG_TCP_CONG_WESTWOOD=m | ||
324 | CONFIG_TCP_CONG_HTCP=m | ||
325 | CONFIG_TCP_CONG_HSTCP=m | ||
326 | CONFIG_TCP_CONG_HYBLA=m | ||
327 | CONFIG_TCP_CONG_VEGAS=m | ||
328 | CONFIG_TCP_CONG_SCALABLE=m | ||
329 | CONFIG_TCP_CONG_LP=m | ||
330 | CONFIG_TCP_CONG_VENO=m | ||
331 | CONFIG_TCP_CONG_YEAH=m | ||
332 | CONFIG_TCP_CONG_ILLINOIS=m | ||
333 | CONFIG_DEFAULT_CUBIC=y | ||
334 | # CONFIG_DEFAULT_RENO is not set | ||
335 | CONFIG_DEFAULT_TCP_CONG="cubic" | ||
336 | CONFIG_TCP_MD5SIG=y | ||
337 | CONFIG_IPV6=y | ||
338 | CONFIG_IPV6_PRIVACY=y | ||
339 | CONFIG_IPV6_ROUTER_PREF=y | ||
340 | CONFIG_IPV6_ROUTE_INFO=y | ||
341 | CONFIG_IPV6_OPTIMISTIC_DAD=y | ||
342 | CONFIG_INET6_AH=m | ||
343 | CONFIG_INET6_ESP=m | ||
344 | CONFIG_INET6_IPCOMP=m | ||
345 | CONFIG_IPV6_MIP6=m | ||
346 | CONFIG_INET6_XFRM_TUNNEL=m | ||
347 | CONFIG_INET6_TUNNEL=m | ||
348 | CONFIG_INET6_XFRM_MODE_TRANSPORT=m | ||
349 | CONFIG_INET6_XFRM_MODE_TUNNEL=m | ||
350 | CONFIG_INET6_XFRM_MODE_BEET=m | ||
351 | CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m | ||
352 | CONFIG_IPV6_SIT=m | ||
353 | # CONFIG_IPV6_SIT_6RD is not set | ||
354 | CONFIG_IPV6_NDISC_NODETYPE=y | ||
355 | CONFIG_IPV6_TUNNEL=m | ||
356 | CONFIG_IPV6_MULTIPLE_TABLES=y | ||
357 | # CONFIG_IPV6_SUBTREES is not set | ||
358 | CONFIG_IPV6_MROUTE=y | ||
359 | # CONFIG_IPV6_MROUTE_MULTIPLE_TABLES is not set | ||
360 | CONFIG_IPV6_PIMSM_V2=y | ||
361 | CONFIG_NETLABEL=y | ||
362 | CONFIG_NETWORK_SECMARK=y | ||
363 | # CONFIG_NETWORK_PHY_TIMESTAMPING is not set | ||
364 | CONFIG_NETFILTER=y | ||
365 | # CONFIG_NETFILTER_DEBUG is not set | ||
366 | CONFIG_NETFILTER_ADVANCED=y | ||
367 | CONFIG_BRIDGE_NETFILTER=y | ||
368 | |||
369 | # | ||
370 | # Core Netfilter Configuration | ||
371 | # | ||
372 | CONFIG_NETFILTER_NETLINK=m | ||
373 | CONFIG_NETFILTER_NETLINK_QUEUE=m | ||
374 | CONFIG_NETFILTER_NETLINK_LOG=m | ||
375 | CONFIG_NF_CONNTRACK=y | ||
376 | CONFIG_NF_CONNTRACK_MARK=y | ||
377 | CONFIG_NF_CONNTRACK_SECMARK=y | ||
378 | CONFIG_NF_CONNTRACK_ZONES=y | ||
379 | CONFIG_NF_CONNTRACK_EVENTS=y | ||
380 | # CONFIG_NF_CONNTRACK_TIMESTAMP is not set | ||
381 | CONFIG_NF_CT_PROTO_DCCP=m | ||
382 | CONFIG_NF_CT_PROTO_GRE=m | ||
383 | CONFIG_NF_CT_PROTO_SCTP=m | ||
384 | CONFIG_NF_CT_PROTO_UDPLITE=m | ||
385 | CONFIG_NF_CONNTRACK_AMANDA=m | ||
386 | CONFIG_NF_CONNTRACK_FTP=m | ||
387 | CONFIG_NF_CONNTRACK_H323=m | ||
388 | CONFIG_NF_CONNTRACK_IRC=m | ||
389 | CONFIG_NF_CONNTRACK_BROADCAST=m | ||
390 | CONFIG_NF_CONNTRACK_NETBIOS_NS=m | ||
391 | # CONFIG_NF_CONNTRACK_SNMP is not set | ||
392 | CONFIG_NF_CONNTRACK_PPTP=m | ||
393 | CONFIG_NF_CONNTRACK_SANE=m | ||
394 | CONFIG_NF_CONNTRACK_SIP=m | ||
395 | CONFIG_NF_CONNTRACK_TFTP=m | ||
396 | # CONFIG_NF_CT_NETLINK is not set | ||
397 | CONFIG_NETFILTER_TPROXY=m | ||
398 | CONFIG_NETFILTER_XTABLES=y | ||
399 | |||
400 | # | ||
401 | # Xtables combined modules | ||
402 | # | ||
403 | CONFIG_NETFILTER_XT_MARK=m | ||
404 | CONFIG_NETFILTER_XT_CONNMARK=m | ||
405 | |||
406 | # | ||
407 | # Xtables targets | ||
408 | # | ||
409 | # CONFIG_NETFILTER_XT_TARGET_AUDIT is not set | ||
410 | # CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set | ||
411 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | ||
412 | CONFIG_NETFILTER_XT_TARGET_CONNMARK=m | ||
413 | CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m | ||
414 | CONFIG_NETFILTER_XT_TARGET_CT=m | ||
415 | CONFIG_NETFILTER_XT_TARGET_DSCP=m | ||
416 | CONFIG_NETFILTER_XT_TARGET_HL=m | ||
417 | CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m | ||
418 | CONFIG_NETFILTER_XT_TARGET_MARK=m | ||
419 | CONFIG_NETFILTER_XT_TARGET_NFLOG=m | ||
420 | CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m | ||
421 | CONFIG_NETFILTER_XT_TARGET_NOTRACK=m | ||
422 | CONFIG_NETFILTER_XT_TARGET_RATEEST=m | ||
423 | CONFIG_NETFILTER_XT_TARGET_TEE=m | ||
424 | CONFIG_NETFILTER_XT_TARGET_TPROXY=m | ||
425 | CONFIG_NETFILTER_XT_TARGET_TRACE=m | ||
426 | CONFIG_NETFILTER_XT_TARGET_SECMARK=m | ||
427 | CONFIG_NETFILTER_XT_TARGET_TCPMSS=m | ||
428 | CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m | ||
429 | |||
430 | # | ||
431 | # Xtables matches | ||
432 | # | ||
433 | # CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set | ||
434 | CONFIG_NETFILTER_XT_MATCH_CLUSTER=m | ||
435 | CONFIG_NETFILTER_XT_MATCH_COMMENT=m | ||
436 | CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m | ||
437 | CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m | ||
438 | CONFIG_NETFILTER_XT_MATCH_CONNMARK=m | ||
439 | CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y | ||
440 | # CONFIG_NETFILTER_XT_MATCH_CPU is not set | ||
441 | CONFIG_NETFILTER_XT_MATCH_DCCP=m | ||
442 | # CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set | ||
443 | CONFIG_NETFILTER_XT_MATCH_DSCP=m | ||
444 | CONFIG_NETFILTER_XT_MATCH_ESP=m | ||
445 | CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m | ||
446 | CONFIG_NETFILTER_XT_MATCH_HELPER=m | ||
447 | CONFIG_NETFILTER_XT_MATCH_HL=m | ||
448 | CONFIG_NETFILTER_XT_MATCH_IPRANGE=m | ||
449 | CONFIG_NETFILTER_XT_MATCH_IPVS=m | ||
450 | CONFIG_NETFILTER_XT_MATCH_LENGTH=m | ||
451 | CONFIG_NETFILTER_XT_MATCH_LIMIT=m | ||
452 | CONFIG_NETFILTER_XT_MATCH_MAC=m | ||
453 | CONFIG_NETFILTER_XT_MATCH_MARK=m | ||
454 | CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m | ||
455 | CONFIG_NETFILTER_XT_MATCH_OSF=m | ||
456 | CONFIG_NETFILTER_XT_MATCH_OWNER=m | ||
457 | CONFIG_NETFILTER_XT_MATCH_POLICY=m | ||
458 | CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m | ||
459 | CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m | ||
460 | CONFIG_NETFILTER_XT_MATCH_QUOTA=m | ||
461 | CONFIG_NETFILTER_XT_MATCH_RATEEST=m | ||
462 | CONFIG_NETFILTER_XT_MATCH_REALM=m | ||
463 | CONFIG_NETFILTER_XT_MATCH_RECENT=m | ||
464 | CONFIG_NETFILTER_XT_MATCH_SCTP=m | ||
465 | CONFIG_NETFILTER_XT_MATCH_SOCKET=m | ||
466 | CONFIG_NETFILTER_XT_MATCH_STATE=y | ||
467 | CONFIG_NETFILTER_XT_MATCH_STATISTIC=m | ||
468 | CONFIG_NETFILTER_XT_MATCH_STRING=m | ||
469 | CONFIG_NETFILTER_XT_MATCH_TCPMSS=m | ||
470 | CONFIG_NETFILTER_XT_MATCH_TIME=m | ||
471 | CONFIG_NETFILTER_XT_MATCH_U32=m | ||
472 | # CONFIG_IP_SET is not set | ||
473 | CONFIG_IP_VS=m | ||
474 | CONFIG_IP_VS_IPV6=y | ||
475 | # CONFIG_IP_VS_DEBUG is not set | ||
476 | CONFIG_IP_VS_TAB_BITS=12 | ||
477 | |||
478 | # | ||
479 | # IPVS transport protocol load balancing support | ||
480 | # | ||
481 | CONFIG_IP_VS_PROTO_TCP=y | ||
482 | CONFIG_IP_VS_PROTO_UDP=y | ||
483 | CONFIG_IP_VS_PROTO_AH_ESP=y | ||
484 | CONFIG_IP_VS_PROTO_ESP=y | ||
485 | CONFIG_IP_VS_PROTO_AH=y | ||
486 | CONFIG_IP_VS_PROTO_SCTP=y | ||
487 | |||
488 | # | ||
489 | # IPVS scheduler | ||
490 | # | ||
491 | CONFIG_IP_VS_RR=m | ||
492 | CONFIG_IP_VS_WRR=m | ||
493 | CONFIG_IP_VS_LC=m | ||
494 | CONFIG_IP_VS_WLC=m | ||
495 | CONFIG_IP_VS_LBLC=m | ||
496 | CONFIG_IP_VS_LBLCR=m | ||
497 | # CONFIG_IP_VS_DH is not set | ||
498 | # CONFIG_IP_VS_SH is not set | ||
499 | CONFIG_IP_VS_SED=m | ||
500 | CONFIG_IP_VS_NQ=m | ||
501 | |||
502 | # | ||
503 | # IPVS application helper | ||
504 | # | ||
505 | # CONFIG_IP_VS_NFCT is not set | ||
506 | # CONFIG_IP_VS_PE_SIP is not set | ||
507 | |||
508 | # | ||
509 | # IP: Netfilter Configuration | ||
510 | # | ||
511 | CONFIG_NF_DEFRAG_IPV4=y | ||
512 | CONFIG_NF_CONNTRACK_IPV4=y | ||
513 | # CONFIG_NF_CONNTRACK_PROC_COMPAT is not set | ||
514 | CONFIG_IP_NF_QUEUE=m | ||
515 | CONFIG_IP_NF_IPTABLES=y | ||
516 | CONFIG_IP_NF_MATCH_AH=m | ||
517 | CONFIG_IP_NF_MATCH_ECN=m | ||
518 | CONFIG_IP_NF_MATCH_TTL=m | ||
519 | CONFIG_IP_NF_FILTER=y | ||
520 | CONFIG_IP_NF_TARGET_REJECT=y | ||
521 | CONFIG_IP_NF_TARGET_LOG=m | ||
522 | CONFIG_IP_NF_TARGET_ULOG=m | ||
523 | # CONFIG_NF_NAT is not set | ||
524 | CONFIG_IP_NF_MANGLE=m | ||
525 | # CONFIG_IP_NF_TARGET_CLUSTERIP is not set | ||
526 | CONFIG_IP_NF_TARGET_ECN=m | ||
527 | CONFIG_IP_NF_TARGET_TTL=m | ||
528 | CONFIG_IP_NF_RAW=m | ||
529 | CONFIG_IP_NF_SECURITY=m | ||
530 | CONFIG_IP_NF_ARPTABLES=m | ||
531 | CONFIG_IP_NF_ARPFILTER=m | ||
532 | CONFIG_IP_NF_ARP_MANGLE=m | ||
533 | |||
534 | # | ||
535 | # IPv6: Netfilter Configuration | ||
536 | # | ||
537 | CONFIG_NF_DEFRAG_IPV6=m | ||
538 | CONFIG_NF_CONNTRACK_IPV6=m | ||
539 | CONFIG_IP6_NF_QUEUE=m | ||
540 | CONFIG_IP6_NF_IPTABLES=m | ||
541 | CONFIG_IP6_NF_MATCH_AH=m | ||
542 | CONFIG_IP6_NF_MATCH_EUI64=m | ||
543 | CONFIG_IP6_NF_MATCH_FRAG=m | ||
544 | CONFIG_IP6_NF_MATCH_OPTS=m | ||
545 | CONFIG_IP6_NF_MATCH_HL=m | ||
546 | CONFIG_IP6_NF_MATCH_IPV6HEADER=m | ||
547 | CONFIG_IP6_NF_MATCH_MH=m | ||
548 | CONFIG_IP6_NF_MATCH_RT=m | ||
549 | CONFIG_IP6_NF_TARGET_HL=m | ||
550 | CONFIG_IP6_NF_TARGET_LOG=m | ||
551 | CONFIG_IP6_NF_FILTER=m | ||
552 | CONFIG_IP6_NF_TARGET_REJECT=m | ||
553 | CONFIG_IP6_NF_MANGLE=m | ||
554 | CONFIG_IP6_NF_RAW=m | ||
555 | CONFIG_IP6_NF_SECURITY=m | ||
556 | CONFIG_BRIDGE_NF_EBTABLES=m | ||
557 | CONFIG_BRIDGE_EBT_BROUTE=m | ||
558 | CONFIG_BRIDGE_EBT_T_FILTER=m | ||
559 | CONFIG_BRIDGE_EBT_T_NAT=m | ||
560 | CONFIG_BRIDGE_EBT_802_3=m | ||
561 | CONFIG_BRIDGE_EBT_AMONG=m | ||
562 | CONFIG_BRIDGE_EBT_ARP=m | ||
563 | CONFIG_BRIDGE_EBT_IP=m | ||
564 | CONFIG_BRIDGE_EBT_IP6=m | ||
565 | CONFIG_BRIDGE_EBT_LIMIT=m | ||
566 | CONFIG_BRIDGE_EBT_MARK=m | ||
567 | CONFIG_BRIDGE_EBT_PKTTYPE=m | ||
568 | CONFIG_BRIDGE_EBT_STP=m | ||
569 | CONFIG_BRIDGE_EBT_VLAN=m | ||
570 | CONFIG_BRIDGE_EBT_ARPREPLY=m | ||
571 | CONFIG_BRIDGE_EBT_DNAT=m | ||
572 | CONFIG_BRIDGE_EBT_MARK_T=m | ||
573 | CONFIG_BRIDGE_EBT_REDIRECT=m | ||
574 | CONFIG_BRIDGE_EBT_SNAT=m | ||
575 | CONFIG_BRIDGE_EBT_LOG=m | ||
576 | CONFIG_BRIDGE_EBT_ULOG=m | ||
577 | CONFIG_BRIDGE_EBT_NFLOG=m | ||
578 | # CONFIG_IP_DCCP is not set | ||
579 | CONFIG_IP_SCTP=m | ||
580 | # CONFIG_SCTP_DBG_MSG is not set | ||
581 | # CONFIG_SCTP_DBG_OBJCNT is not set | ||
582 | # CONFIG_SCTP_HMAC_NONE is not set | ||
583 | # CONFIG_SCTP_HMAC_SHA1 is not set | ||
584 | CONFIG_SCTP_HMAC_MD5=y | ||
585 | CONFIG_RDS=m | ||
586 | CONFIG_RDS_TCP=m | ||
587 | # CONFIG_RDS_DEBUG is not set | ||
588 | # CONFIG_TIPC is not set | ||
589 | # CONFIG_ATM is not set | ||
590 | # CONFIG_L2TP is not set | ||
591 | CONFIG_STP=m | ||
592 | CONFIG_GARP=m | ||
593 | CONFIG_BRIDGE=m | ||
594 | CONFIG_BRIDGE_IGMP_SNOOPING=y | ||
595 | CONFIG_NET_DSA=y | ||
596 | CONFIG_NET_DSA_TAG_DSA=y | ||
597 | CONFIG_NET_DSA_TAG_EDSA=y | ||
598 | CONFIG_NET_DSA_TAG_TRAILER=y | ||
599 | CONFIG_NET_DSA_MV88E6XXX=y | ||
600 | CONFIG_NET_DSA_MV88E6060=y | ||
601 | CONFIG_NET_DSA_MV88E6XXX_NEED_PPU=y | ||
602 | CONFIG_NET_DSA_MV88E6131=y | ||
603 | CONFIG_NET_DSA_MV88E6123_61_65=y | ||
604 | CONFIG_VLAN_8021Q=m | ||
605 | CONFIG_VLAN_8021Q_GVRP=y | ||
606 | # CONFIG_DECNET is not set | ||
607 | CONFIG_LLC=m | ||
608 | # CONFIG_LLC2 is not set | ||
609 | # CONFIG_IPX is not set | ||
610 | # CONFIG_ATALK is not set | ||
611 | # CONFIG_X25 is not set | ||
612 | # CONFIG_LAPB is not set | ||
613 | # CONFIG_ECONET is not set | ||
614 | # CONFIG_WAN_ROUTER is not set | ||
615 | CONFIG_PHONET=m | ||
616 | # CONFIG_IEEE802154 is not set | ||
617 | CONFIG_NET_SCHED=y | ||
618 | |||
619 | # | ||
620 | # Queueing/Scheduling | ||
621 | # | ||
622 | CONFIG_NET_SCH_CBQ=m | ||
623 | CONFIG_NET_SCH_HTB=m | ||
624 | CONFIG_NET_SCH_HFSC=m | ||
625 | CONFIG_NET_SCH_PRIO=m | ||
626 | CONFIG_NET_SCH_MULTIQ=m | ||
627 | CONFIG_NET_SCH_RED=m | ||
628 | # CONFIG_NET_SCH_SFB is not set | ||
629 | CONFIG_NET_SCH_SFQ=m | ||
630 | CONFIG_NET_SCH_TEQL=m | ||
631 | CONFIG_NET_SCH_TBF=m | ||
632 | CONFIG_NET_SCH_GRED=m | ||
633 | CONFIG_NET_SCH_DSMARK=m | ||
634 | CONFIG_NET_SCH_NETEM=m | ||
635 | CONFIG_NET_SCH_DRR=m | ||
636 | # CONFIG_NET_SCH_MQPRIO is not set | ||
637 | # CONFIG_NET_SCH_CHOKE is not set | ||
638 | CONFIG_NET_SCH_INGRESS=m | ||
639 | |||
640 | # | ||
641 | # Classification | ||
642 | # | ||
643 | CONFIG_NET_CLS=y | ||
644 | CONFIG_NET_CLS_BASIC=m | ||
645 | CONFIG_NET_CLS_TCINDEX=m | ||
646 | CONFIG_NET_CLS_ROUTE4=m | ||
647 | CONFIG_NET_CLS_FW=m | ||
648 | CONFIG_NET_CLS_U32=m | ||
649 | CONFIG_CLS_U32_PERF=y | ||
650 | CONFIG_CLS_U32_MARK=y | ||
651 | CONFIG_NET_CLS_RSVP=m | ||
652 | CONFIG_NET_CLS_RSVP6=m | ||
653 | CONFIG_NET_CLS_FLOW=m | ||
654 | CONFIG_NET_CLS_CGROUP=y | ||
655 | CONFIG_NET_EMATCH=y | ||
656 | CONFIG_NET_EMATCH_STACK=32 | ||
657 | CONFIG_NET_EMATCH_CMP=m | ||
658 | CONFIG_NET_EMATCH_NBYTE=m | ||
659 | CONFIG_NET_EMATCH_U32=m | ||
660 | CONFIG_NET_EMATCH_META=m | ||
661 | CONFIG_NET_EMATCH_TEXT=m | ||
662 | CONFIG_NET_CLS_ACT=y | ||
663 | CONFIG_NET_ACT_POLICE=m | ||
664 | CONFIG_NET_ACT_GACT=m | ||
665 | CONFIG_GACT_PROB=y | ||
666 | CONFIG_NET_ACT_MIRRED=m | ||
667 | CONFIG_NET_ACT_IPT=m | ||
668 | CONFIG_NET_ACT_NAT=m | ||
669 | CONFIG_NET_ACT_PEDIT=m | ||
670 | CONFIG_NET_ACT_SIMP=m | ||
671 | CONFIG_NET_ACT_SKBEDIT=m | ||
672 | # CONFIG_NET_ACT_CSUM is not set | ||
673 | CONFIG_NET_CLS_IND=y | ||
674 | CONFIG_NET_SCH_FIFO=y | ||
675 | CONFIG_DCB=y | ||
676 | CONFIG_DNS_RESOLVER=y | ||
677 | # CONFIG_BATMAN_ADV is not set | ||
678 | CONFIG_RPS=y | ||
679 | CONFIG_RFS_ACCEL=y | ||
680 | CONFIG_XPS=y | ||
681 | |||
682 | # | ||
683 | # Network testing | ||
684 | # | ||
685 | # CONFIG_NET_PKTGEN is not set | ||
686 | # CONFIG_HAMRADIO is not set | ||
687 | # CONFIG_CAN is not set | ||
688 | # CONFIG_IRDA is not set | ||
689 | # CONFIG_BT is not set | ||
690 | # CONFIG_AF_RXRPC is not set | ||
691 | CONFIG_FIB_RULES=y | ||
692 | # CONFIG_WIRELESS is not set | ||
693 | # CONFIG_WIMAX is not set | ||
694 | # CONFIG_RFKILL is not set | ||
695 | # CONFIG_NET_9P is not set | ||
696 | # CONFIG_CAIF is not set | ||
697 | # CONFIG_CEPH_LIB is not set | ||
698 | |||
699 | # | ||
700 | # Device Drivers | ||
701 | # | ||
702 | |||
703 | # | ||
704 | # Generic Driver Options | ||
705 | # | ||
706 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
707 | CONFIG_DEVTMPFS=y | ||
708 | CONFIG_DEVTMPFS_MOUNT=y | ||
709 | CONFIG_STANDALONE=y | ||
710 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
711 | CONFIG_FW_LOADER=y | ||
712 | # CONFIG_FIRMWARE_IN_KERNEL is not set | ||
713 | CONFIG_EXTRA_FIRMWARE="" | ||
714 | # CONFIG_DEBUG_DRIVER is not set | ||
715 | # CONFIG_DEBUG_DEVRES is not set | ||
716 | # CONFIG_SYS_HYPERVISOR is not set | ||
717 | CONFIG_CONNECTOR=y | ||
718 | CONFIG_PROC_EVENTS=y | ||
719 | # CONFIG_MTD is not set | ||
720 | # CONFIG_PARPORT is not set | ||
721 | CONFIG_BLK_DEV=y | ||
722 | # CONFIG_BLK_CPQ_DA is not set | ||
723 | # CONFIG_BLK_CPQ_CISS_DA is not set | ||
724 | # CONFIG_BLK_DEV_DAC960 is not set | ||
725 | # CONFIG_BLK_DEV_UMEM is not set | ||
726 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
727 | CONFIG_BLK_DEV_LOOP=y | ||
728 | CONFIG_BLK_DEV_CRYPTOLOOP=m | ||
729 | # CONFIG_BLK_DEV_DRBD is not set | ||
730 | # CONFIG_BLK_DEV_NBD is not set | ||
731 | CONFIG_BLK_DEV_SX8=m | ||
732 | CONFIG_BLK_DEV_RAM=y | ||
733 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
734 | CONFIG_BLK_DEV_RAM_SIZE=16384 | ||
735 | # CONFIG_BLK_DEV_XIP is not set | ||
736 | # CONFIG_CDROM_PKTCDVD is not set | ||
737 | CONFIG_ATA_OVER_ETH=y | ||
738 | # CONFIG_BLK_DEV_RBD is not set | ||
739 | # CONFIG_SENSORS_LIS3LV02D is not set | ||
740 | CONFIG_MISC_DEVICES=y | ||
741 | # CONFIG_AD525X_DPOT is not set | ||
742 | # CONFIG_PHANTOM is not set | ||
743 | # CONFIG_SGI_IOC4 is not set | ||
744 | # CONFIG_TIFM_CORE is not set | ||
745 | # CONFIG_ICS932S401 is not set | ||
746 | # CONFIG_ENCLOSURE_SERVICES is not set | ||
747 | # CONFIG_HP_ILO is not set | ||
748 | # CONFIG_APDS9802ALS is not set | ||
749 | # CONFIG_ISL29003 is not set | ||
750 | # CONFIG_ISL29020 is not set | ||
751 | # CONFIG_SENSORS_TSL2550 is not set | ||
752 | # CONFIG_SENSORS_BH1780 is not set | ||
753 | # CONFIG_SENSORS_BH1770 is not set | ||
754 | # CONFIG_SENSORS_APDS990X is not set | ||
755 | # CONFIG_HMC6352 is not set | ||
756 | # CONFIG_DS1682 is not set | ||
757 | # CONFIG_BMP085 is not set | ||
758 | # CONFIG_PCH_PHUB is not set | ||
759 | # CONFIG_C2PORT is not set | ||
760 | |||
761 | # | ||
762 | # EEPROM support | ||
763 | # | ||
764 | # CONFIG_EEPROM_AT24 is not set | ||
765 | # CONFIG_EEPROM_LEGACY is not set | ||
766 | # CONFIG_EEPROM_MAX6875 is not set | ||
767 | # CONFIG_EEPROM_93CX6 is not set | ||
768 | # CONFIG_CB710_CORE is not set | ||
769 | |||
770 | # | ||
771 | # Texas Instruments shared transport line discipline | ||
772 | # | ||
773 | # CONFIG_SENSORS_LIS3_I2C is not set | ||
774 | |||
775 | # | ||
776 | # SCSI device support | ||
777 | # | ||
778 | CONFIG_SCSI_MOD=m | ||
779 | CONFIG_RAID_ATTRS=m | ||
780 | CONFIG_SCSI=m | ||
781 | CONFIG_SCSI_DMA=y | ||
782 | CONFIG_SCSI_TGT=m | ||
783 | # CONFIG_SCSI_NETLINK is not set | ||
784 | CONFIG_SCSI_PROC_FS=y | ||
785 | |||
786 | # | ||
787 | # SCSI support type (disk, tape, CD-ROM) | ||
788 | # | ||
789 | CONFIG_BLK_DEV_SD=m | ||
790 | # CONFIG_CHR_DEV_ST is not set | ||
791 | # CONFIG_CHR_DEV_OSST is not set | ||
792 | # CONFIG_BLK_DEV_SR is not set | ||
793 | # CONFIG_CHR_DEV_SG is not set | ||
794 | # CONFIG_CHR_DEV_SCH is not set | ||
795 | # CONFIG_SCSI_MULTI_LUN is not set | ||
796 | CONFIG_SCSI_CONSTANTS=y | ||
797 | CONFIG_SCSI_LOGGING=y | ||
798 | # CONFIG_SCSI_SCAN_ASYNC is not set | ||
799 | CONFIG_SCSI_WAIT_SCAN=m | ||
800 | |||
801 | # | ||
802 | # SCSI Transports | ||
803 | # | ||
804 | # CONFIG_SCSI_SPI_ATTRS is not set | ||
805 | # CONFIG_SCSI_FC_ATTRS is not set | ||
806 | # CONFIG_SCSI_ISCSI_ATTRS is not set | ||
807 | CONFIG_SCSI_SAS_ATTRS=m | ||
808 | # CONFIG_SCSI_SAS_LIBSAS is not set | ||
809 | # CONFIG_SCSI_SRP_ATTRS is not set | ||
810 | CONFIG_SCSI_LOWLEVEL=y | ||
811 | # CONFIG_ISCSI_TCP is not set | ||
812 | # CONFIG_ISCSI_BOOT_SYSFS is not set | ||
813 | # CONFIG_SCSI_CXGB3_ISCSI is not set | ||
814 | # CONFIG_SCSI_CXGB4_ISCSI is not set | ||
815 | # CONFIG_SCSI_BNX2_ISCSI is not set | ||
816 | # CONFIG_SCSI_BNX2X_FCOE is not set | ||
817 | # CONFIG_BE2ISCSI is not set | ||
818 | # CONFIG_BLK_DEV_3W_XXXX_RAID is not set | ||
819 | # CONFIG_SCSI_HPSA is not set | ||
820 | # CONFIG_SCSI_3W_9XXX is not set | ||
821 | # CONFIG_SCSI_3W_SAS is not set | ||
822 | # CONFIG_SCSI_ACARD is not set | ||
823 | # CONFIG_SCSI_AACRAID is not set | ||
824 | # CONFIG_SCSI_AIC7XXX is not set | ||
825 | # CONFIG_SCSI_AIC7XXX_OLD is not set | ||
826 | # CONFIG_SCSI_AIC79XX is not set | ||
827 | # CONFIG_SCSI_AIC94XX is not set | ||
828 | # CONFIG_SCSI_MVSAS is not set | ||
829 | # CONFIG_SCSI_DPT_I2O is not set | ||
830 | # CONFIG_SCSI_ADVANSYS is not set | ||
831 | # CONFIG_SCSI_ARCMSR is not set | ||
832 | # CONFIG_MEGARAID_NEWGEN is not set | ||
833 | # CONFIG_MEGARAID_LEGACY is not set | ||
834 | # CONFIG_MEGARAID_SAS is not set | ||
835 | # CONFIG_SCSI_MPT2SAS is not set | ||
836 | # CONFIG_SCSI_HPTIOP is not set | ||
837 | # CONFIG_LIBFC is not set | ||
838 | # CONFIG_LIBFCOE is not set | ||
839 | # CONFIG_FCOE is not set | ||
840 | # CONFIG_SCSI_DMX3191D is not set | ||
841 | # CONFIG_SCSI_FUTURE_DOMAIN is not set | ||
842 | # CONFIG_SCSI_IPS is not set | ||
843 | # CONFIG_SCSI_INITIO is not set | ||
844 | # CONFIG_SCSI_INIA100 is not set | ||
845 | # CONFIG_SCSI_STEX is not set | ||
846 | # CONFIG_SCSI_SYM53C8XX_2 is not set | ||
847 | # CONFIG_SCSI_IPR is not set | ||
848 | # CONFIG_SCSI_QLOGIC_1280 is not set | ||
849 | # CONFIG_SCSI_QLA_FC is not set | ||
850 | # CONFIG_SCSI_QLA_ISCSI is not set | ||
851 | # CONFIG_SCSI_LPFC is not set | ||
852 | # CONFIG_SCSI_DC395x is not set | ||
853 | # CONFIG_SCSI_DC390T is not set | ||
854 | # CONFIG_SCSI_DEBUG is not set | ||
855 | # CONFIG_SCSI_PMCRAID is not set | ||
856 | # CONFIG_SCSI_PM8001 is not set | ||
857 | # CONFIG_SCSI_SRP is not set | ||
858 | # CONFIG_SCSI_BFA_FC is not set | ||
859 | # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set | ||
860 | # CONFIG_SCSI_DH is not set | ||
861 | # CONFIG_SCSI_OSD_INITIATOR is not set | ||
862 | CONFIG_ATA=m | ||
863 | # CONFIG_ATA_NONSTANDARD is not set | ||
864 | CONFIG_ATA_VERBOSE_ERROR=y | ||
865 | CONFIG_SATA_PMP=y | ||
866 | |||
867 | # | ||
868 | # Controllers with non-SFF native interface | ||
869 | # | ||
870 | # CONFIG_SATA_AHCI is not set | ||
871 | # CONFIG_SATA_AHCI_PLATFORM is not set | ||
872 | # CONFIG_SATA_INIC162X is not set | ||
873 | # CONFIG_SATA_ACARD_AHCI is not set | ||
874 | CONFIG_SATA_SIL24=m | ||
875 | CONFIG_ATA_SFF=y | ||
876 | |||
877 | # | ||
878 | # SFF controllers with custom DMA interface | ||
879 | # | ||
880 | # CONFIG_PDC_ADMA is not set | ||
881 | # CONFIG_SATA_QSTOR is not set | ||
882 | # CONFIG_SATA_SX4 is not set | ||
883 | CONFIG_ATA_BMDMA=y | ||
884 | |||
885 | # | ||
886 | # SATA SFF controllers with BMDMA | ||
887 | # | ||
888 | # CONFIG_ATA_PIIX is not set | ||
889 | # CONFIG_SATA_MV is not set | ||
890 | # CONFIG_SATA_NV is not set | ||
891 | # CONFIG_SATA_PROMISE is not set | ||
892 | # CONFIG_SATA_SIL is not set | ||
893 | # CONFIG_SATA_SIS is not set | ||
894 | # CONFIG_SATA_SVW is not set | ||
895 | # CONFIG_SATA_ULI is not set | ||
896 | # CONFIG_SATA_VIA is not set | ||
897 | # CONFIG_SATA_VITESSE is not set | ||
898 | |||
899 | # | ||
900 | # PATA SFF controllers with BMDMA | ||
901 | # | ||
902 | # CONFIG_PATA_ALI is not set | ||
903 | # CONFIG_PATA_AMD is not set | ||
904 | # CONFIG_PATA_ARASAN_CF is not set | ||
905 | # CONFIG_PATA_ARTOP is not set | ||
906 | # CONFIG_PATA_ATIIXP is not set | ||
907 | # CONFIG_PATA_ATP867X is not set | ||
908 | # CONFIG_PATA_CMD64X is not set | ||
909 | # CONFIG_PATA_CS5520 is not set | ||
910 | # CONFIG_PATA_CS5530 is not set | ||
911 | # CONFIG_PATA_CS5536 is not set | ||
912 | # CONFIG_PATA_CYPRESS is not set | ||
913 | # CONFIG_PATA_EFAR is not set | ||
914 | # CONFIG_PATA_HPT366 is not set | ||
915 | # CONFIG_PATA_HPT37X is not set | ||
916 | # CONFIG_PATA_HPT3X2N is not set | ||
917 | # CONFIG_PATA_HPT3X3 is not set | ||
918 | # CONFIG_PATA_IT8213 is not set | ||
919 | # CONFIG_PATA_IT821X is not set | ||
920 | # CONFIG_PATA_JMICRON is not set | ||
921 | # CONFIG_PATA_MARVELL is not set | ||
922 | # CONFIG_PATA_NETCELL is not set | ||
923 | # CONFIG_PATA_NINJA32 is not set | ||
924 | # CONFIG_PATA_NS87415 is not set | ||
925 | # CONFIG_PATA_OLDPIIX is not set | ||
926 | # CONFIG_PATA_OPTIDMA is not set | ||
927 | # CONFIG_PATA_PDC2027X is not set | ||
928 | # CONFIG_PATA_PDC_OLD is not set | ||
929 | # CONFIG_PATA_RADISYS is not set | ||
930 | # CONFIG_PATA_RDC is not set | ||
931 | # CONFIG_PATA_SC1200 is not set | ||
932 | # CONFIG_PATA_SCH is not set | ||
933 | # CONFIG_PATA_SERVERWORKS is not set | ||
934 | # CONFIG_PATA_SIL680 is not set | ||
935 | # CONFIG_PATA_SIS is not set | ||
936 | # CONFIG_PATA_TOSHIBA is not set | ||
937 | # CONFIG_PATA_TRIFLEX is not set | ||
938 | # CONFIG_PATA_VIA is not set | ||
939 | # CONFIG_PATA_WINBOND is not set | ||
940 | |||
941 | # | ||
942 | # PIO-only SFF controllers | ||
943 | # | ||
944 | # CONFIG_PATA_CMD640_PCI is not set | ||
945 | # CONFIG_PATA_MPIIX is not set | ||
946 | # CONFIG_PATA_NS87410 is not set | ||
947 | # CONFIG_PATA_OPTI is not set | ||
948 | # CONFIG_PATA_PLATFORM is not set | ||
949 | # CONFIG_PATA_RZ1000 is not set | ||
950 | |||
951 | # | ||
952 | # Generic fallback / legacy drivers | ||
953 | # | ||
954 | # CONFIG_ATA_GENERIC is not set | ||
955 | # CONFIG_PATA_LEGACY is not set | ||
956 | CONFIG_MD=y | ||
957 | CONFIG_BLK_DEV_MD=y | ||
958 | CONFIG_MD_AUTODETECT=y | ||
959 | CONFIG_MD_LINEAR=m | ||
960 | CONFIG_MD_RAID0=m | ||
961 | CONFIG_MD_RAID1=m | ||
962 | CONFIG_MD_RAID10=m | ||
963 | CONFIG_MD_RAID456=m | ||
964 | CONFIG_MULTICORE_RAID456=y | ||
965 | # CONFIG_MD_MULTIPATH is not set | ||
966 | CONFIG_MD_FAULTY=m | ||
967 | CONFIG_BLK_DEV_DM=m | ||
968 | CONFIG_DM_DEBUG=y | ||
969 | CONFIG_DM_CRYPT=m | ||
970 | CONFIG_DM_SNAPSHOT=m | ||
971 | CONFIG_DM_MIRROR=m | ||
972 | # CONFIG_DM_RAID is not set | ||
973 | CONFIG_DM_LOG_USERSPACE=m | ||
974 | CONFIG_DM_ZERO=m | ||
975 | CONFIG_DM_MULTIPATH=m | ||
976 | CONFIG_DM_MULTIPATH_QL=m | ||
977 | CONFIG_DM_MULTIPATH_ST=m | ||
978 | CONFIG_DM_DELAY=m | ||
979 | CONFIG_DM_UEVENT=y | ||
980 | # CONFIG_DM_FLAKEY is not set | ||
981 | # CONFIG_TARGET_CORE is not set | ||
982 | # CONFIG_FUSION is not set | ||
983 | |||
984 | # | ||
985 | # IEEE 1394 (FireWire) support | ||
986 | # | ||
987 | # CONFIG_FIREWIRE is not set | ||
988 | # CONFIG_FIREWIRE_NOSY is not set | ||
989 | # CONFIG_I2O is not set | ||
990 | CONFIG_NETDEVICES=y | ||
991 | CONFIG_IFB=m | ||
992 | CONFIG_DUMMY=m | ||
993 | CONFIG_BONDING=m | ||
994 | CONFIG_MACVLAN=m | ||
995 | CONFIG_MACVTAP=m | ||
996 | # CONFIG_EQUALIZER is not set | ||
997 | CONFIG_TUN=y | ||
998 | CONFIG_VETH=m | ||
999 | # CONFIG_ARCNET is not set | ||
1000 | # CONFIG_MII is not set | ||
1001 | CONFIG_PHYLIB=y | ||
1002 | |||
1003 | # | ||
1004 | # MII PHY device drivers | ||
1005 | # | ||
1006 | # CONFIG_MARVELL_PHY is not set | ||
1007 | # CONFIG_DAVICOM_PHY is not set | ||
1008 | # CONFIG_QSEMI_PHY is not set | ||
1009 | # CONFIG_LXT_PHY is not set | ||
1010 | # CONFIG_CICADA_PHY is not set | ||
1011 | # CONFIG_VITESSE_PHY is not set | ||
1012 | # CONFIG_SMSC_PHY is not set | ||
1013 | # CONFIG_BROADCOM_PHY is not set | ||
1014 | # CONFIG_BCM63XX_PHY is not set | ||
1015 | # CONFIG_ICPLUS_PHY is not set | ||
1016 | # CONFIG_REALTEK_PHY is not set | ||
1017 | # CONFIG_NATIONAL_PHY is not set | ||
1018 | # CONFIG_STE10XP is not set | ||
1019 | # CONFIG_LSI_ET1011C_PHY is not set | ||
1020 | # CONFIG_MICREL_PHY is not set | ||
1021 | # CONFIG_FIXED_PHY is not set | ||
1022 | # CONFIG_MDIO_BITBANG is not set | ||
1023 | # CONFIG_NET_ETHERNET is not set | ||
1024 | CONFIG_NETDEV_1000=y | ||
1025 | # CONFIG_ACENIC is not set | ||
1026 | # CONFIG_DL2K is not set | ||
1027 | # CONFIG_E1000 is not set | ||
1028 | CONFIG_E1000E=m | ||
1029 | # CONFIG_IP1000 is not set | ||
1030 | # CONFIG_IGB is not set | ||
1031 | # CONFIG_IGBVF is not set | ||
1032 | # CONFIG_NS83820 is not set | ||
1033 | # CONFIG_HAMACHI is not set | ||
1034 | # CONFIG_YELLOWFIN is not set | ||
1035 | # CONFIG_R8169 is not set | ||
1036 | # CONFIG_SIS190 is not set | ||
1037 | # CONFIG_SKGE is not set | ||
1038 | # CONFIG_SKY2 is not set | ||
1039 | # CONFIG_VIA_VELOCITY is not set | ||
1040 | # CONFIG_TIGON3 is not set | ||
1041 | # CONFIG_BNX2 is not set | ||
1042 | # CONFIG_CNIC is not set | ||
1043 | # CONFIG_QLA3XXX is not set | ||
1044 | # CONFIG_ATL1 is not set | ||
1045 | # CONFIG_ATL1E is not set | ||
1046 | # CONFIG_ATL1C is not set | ||
1047 | # CONFIG_JME is not set | ||
1048 | # CONFIG_STMMAC_ETH is not set | ||
1049 | # CONFIG_PCH_GBE is not set | ||
1050 | # CONFIG_NETDEV_10000 is not set | ||
1051 | # CONFIG_TR is not set | ||
1052 | # CONFIG_WLAN is not set | ||
1053 | |||
1054 | # | ||
1055 | # Enable WiMAX (Networking options) to see the WiMAX drivers | ||
1056 | # | ||
1057 | # CONFIG_WAN is not set | ||
1058 | |||
1059 | # | ||
1060 | # CAIF transport drivers | ||
1061 | # | ||
1062 | # CONFIG_TILE_NET is not set | ||
1063 | # CONFIG_FDDI is not set | ||
1064 | # CONFIG_HIPPI is not set | ||
1065 | # CONFIG_PPP is not set | ||
1066 | # CONFIG_SLIP is not set | ||
1067 | # CONFIG_NET_FC is not set | ||
1068 | # CONFIG_NETCONSOLE is not set | ||
1069 | # CONFIG_NETPOLL is not set | ||
1070 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
1071 | # CONFIG_VMXNET3 is not set | ||
1072 | # CONFIG_ISDN is not set | ||
1073 | # CONFIG_PHONE is not set | ||
1074 | |||
1075 | # | ||
1076 | # Input device support | ||
1077 | # | ||
1078 | CONFIG_INPUT=y | ||
1079 | # CONFIG_INPUT_FF_MEMLESS is not set | ||
1080 | # CONFIG_INPUT_POLLDEV is not set | ||
1081 | # CONFIG_INPUT_SPARSEKMAP is not set | ||
1082 | |||
1083 | # | ||
1084 | # Userland interfaces | ||
1085 | # | ||
1086 | # CONFIG_INPUT_MOUSEDEV is not set | ||
1087 | # CONFIG_INPUT_JOYDEV is not set | ||
1088 | # CONFIG_INPUT_EVDEV is not set | ||
1089 | # CONFIG_INPUT_EVBUG is not set | ||
1090 | |||
1091 | # | ||
1092 | # Input Device Drivers | ||
1093 | # | ||
1094 | # CONFIG_INPUT_KEYBOARD is not set | ||
1095 | # CONFIG_INPUT_MOUSE is not set | ||
1096 | # CONFIG_INPUT_JOYSTICK is not set | ||
1097 | # CONFIG_INPUT_TABLET is not set | ||
1098 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
1099 | # CONFIG_INPUT_MISC is not set | ||
1100 | |||
1101 | # | ||
1102 | # Hardware I/O ports | ||
1103 | # | ||
1104 | # CONFIG_SERIO is not set | ||
1105 | # CONFIG_GAMEPORT is not set | ||
1106 | |||
1107 | # | ||
1108 | # Character devices | ||
1109 | # | ||
1110 | # CONFIG_VT is not set | ||
1111 | CONFIG_UNIX98_PTYS=y | ||
1112 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set | ||
1113 | # CONFIG_LEGACY_PTYS is not set | ||
1114 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
1115 | # CONFIG_NOZOMI is not set | ||
1116 | # CONFIG_N_GSM is not set | ||
1117 | CONFIG_DEVKMEM=y | ||
1118 | |||
1119 | # | ||
1120 | # Serial drivers | ||
1121 | # | ||
1122 | # CONFIG_SERIAL_8250 is not set | ||
1123 | |||
1124 | # | ||
1125 | # Non-8250 serial port support | ||
1126 | # | ||
1127 | # CONFIG_SERIAL_MFD_HSU is not set | ||
1128 | # CONFIG_SERIAL_JSM is not set | ||
1129 | # CONFIG_SERIAL_TIMBERDALE is not set | ||
1130 | # CONFIG_SERIAL_ALTERA_JTAGUART is not set | ||
1131 | # CONFIG_SERIAL_ALTERA_UART is not set | ||
1132 | # CONFIG_SERIAL_PCH_UART is not set | ||
1133 | # CONFIG_TTY_PRINTK is not set | ||
1134 | CONFIG_HVC_DRIVER=y | ||
1135 | # CONFIG_IPMI_HANDLER is not set | ||
1136 | CONFIG_HW_RANDOM=y | ||
1137 | CONFIG_HW_RANDOM_TIMERIOMEM=m | ||
1138 | # CONFIG_R3964 is not set | ||
1139 | # CONFIG_APPLICOM is not set | ||
1140 | |||
1141 | # | ||
1142 | # PCMCIA character devices | ||
1143 | # | ||
1144 | # CONFIG_RAW_DRIVER is not set | ||
1145 | # CONFIG_TCG_TPM is not set | ||
1146 | CONFIG_DEVPORT=y | ||
1147 | # CONFIG_RAMOOPS is not set | ||
1148 | CONFIG_I2C=y | ||
1149 | CONFIG_I2C_BOARDINFO=y | ||
1150 | CONFIG_I2C_COMPAT=y | ||
1151 | CONFIG_I2C_CHARDEV=y | ||
1152 | # CONFIG_I2C_MUX is not set | ||
1153 | CONFIG_I2C_HELPER_AUTO=y | ||
1154 | |||
1155 | # | ||
1156 | # I2C Hardware Bus support | ||
1157 | # | ||
1158 | |||
1159 | # | ||
1160 | # PC SMBus host controller drivers | ||
1161 | # | ||
1162 | # CONFIG_I2C_ALI1535 is not set | ||
1163 | # CONFIG_I2C_ALI1563 is not set | ||
1164 | # CONFIG_I2C_ALI15X3 is not set | ||
1165 | # CONFIG_I2C_AMD756 is not set | ||
1166 | # CONFIG_I2C_AMD8111 is not set | ||
1167 | # CONFIG_I2C_I801 is not set | ||
1168 | # CONFIG_I2C_ISCH is not set | ||
1169 | # CONFIG_I2C_PIIX4 is not set | ||
1170 | # CONFIG_I2C_NFORCE2 is not set | ||
1171 | # CONFIG_I2C_SIS5595 is not set | ||
1172 | # CONFIG_I2C_SIS630 is not set | ||
1173 | # CONFIG_I2C_SIS96X is not set | ||
1174 | # CONFIG_I2C_VIA is not set | ||
1175 | # CONFIG_I2C_VIAPRO is not set | ||
1176 | |||
1177 | # | ||
1178 | # I2C system bus drivers (mostly embedded / system-on-chip) | ||
1179 | # | ||
1180 | # CONFIG_I2C_INTEL_MID is not set | ||
1181 | # CONFIG_I2C_OCORES is not set | ||
1182 | # CONFIG_I2C_PCA_PLATFORM is not set | ||
1183 | # CONFIG_I2C_PXA_PCI is not set | ||
1184 | # CONFIG_I2C_SIMTEC is not set | ||
1185 | # CONFIG_I2C_XILINX is not set | ||
1186 | # CONFIG_I2C_EG20T is not set | ||
1187 | |||
1188 | # | ||
1189 | # External I2C/SMBus adapter drivers | ||
1190 | # | ||
1191 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
1192 | # CONFIG_I2C_TAOS_EVM is not set | ||
1193 | |||
1194 | # | ||
1195 | # Other I2C/SMBus bus drivers | ||
1196 | # | ||
1197 | # CONFIG_I2C_STUB is not set | ||
1198 | # CONFIG_I2C_DEBUG_CORE is not set | ||
1199 | # CONFIG_I2C_DEBUG_ALGO is not set | ||
1200 | # CONFIG_I2C_DEBUG_BUS is not set | ||
1201 | # CONFIG_SPI is not set | ||
1202 | |||
1203 | # | ||
1204 | # PPS support | ||
1205 | # | ||
1206 | # CONFIG_PPS is not set | ||
1207 | |||
1208 | # | ||
1209 | # PPS generators support | ||
1210 | # | ||
1211 | # CONFIG_W1 is not set | ||
1212 | # CONFIG_POWER_SUPPLY is not set | ||
1213 | # CONFIG_HWMON is not set | ||
1214 | # CONFIG_THERMAL is not set | ||
1215 | # CONFIG_WATCHDOG is not set | ||
1216 | CONFIG_SSB_POSSIBLE=y | ||
1217 | |||
1218 | # | ||
1219 | # Sonics Silicon Backplane | ||
1220 | # | ||
1221 | # CONFIG_SSB is not set | ||
1222 | CONFIG_MFD_SUPPORT=y | ||
1223 | # CONFIG_MFD_CORE is not set | ||
1224 | # CONFIG_MFD_88PM860X is not set | ||
1225 | # CONFIG_MFD_SM501 is not set | ||
1226 | # CONFIG_HTC_PASIC3 is not set | ||
1227 | # CONFIG_TPS6105X is not set | ||
1228 | # CONFIG_TPS6507X is not set | ||
1229 | # CONFIG_TWL4030_CORE is not set | ||
1230 | # CONFIG_MFD_STMPE is not set | ||
1231 | # CONFIG_MFD_TC3589X is not set | ||
1232 | # CONFIG_MFD_TMIO is not set | ||
1233 | # CONFIG_PMIC_DA903X is not set | ||
1234 | # CONFIG_PMIC_ADP5520 is not set | ||
1235 | # CONFIG_MFD_MAX8925 is not set | ||
1236 | # CONFIG_MFD_MAX8997 is not set | ||
1237 | # CONFIG_MFD_MAX8998 is not set | ||
1238 | # CONFIG_MFD_WM8400 is not set | ||
1239 | # CONFIG_MFD_WM831X_I2C is not set | ||
1240 | # CONFIG_MFD_WM8350_I2C is not set | ||
1241 | # CONFIG_MFD_WM8994 is not set | ||
1242 | # CONFIG_MFD_PCF50633 is not set | ||
1243 | # CONFIG_ABX500_CORE is not set | ||
1244 | # CONFIG_LPC_SCH is not set | ||
1245 | # CONFIG_MFD_RDC321X is not set | ||
1246 | # CONFIG_MFD_JANZ_CMODIO is not set | ||
1247 | # CONFIG_MFD_VX855 is not set | ||
1248 | # CONFIG_MFD_WL1273_CORE is not set | ||
1249 | # CONFIG_REGULATOR is not set | ||
1250 | # CONFIG_MEDIA_SUPPORT is not set | ||
1251 | |||
1252 | # | ||
1253 | # Graphics support | ||
1254 | # | ||
1255 | # CONFIG_VGA_ARB is not set | ||
1256 | # CONFIG_DRM is not set | ||
1257 | # CONFIG_STUB_POULSBO is not set | ||
1258 | # CONFIG_VGASTATE is not set | ||
1259 | # CONFIG_VIDEO_OUTPUT_CONTROL is not set | ||
1260 | # CONFIG_FB is not set | ||
1261 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set | ||
1262 | |||
1263 | # | ||
1264 | # Display device support | ||
1265 | # | ||
1266 | # CONFIG_DISPLAY_SUPPORT is not set | ||
1267 | # CONFIG_SOUND is not set | ||
1268 | # CONFIG_HID_SUPPORT is not set | ||
1269 | # CONFIG_USB_SUPPORT is not set | ||
1270 | # CONFIG_UWB is not set | ||
1271 | # CONFIG_MMC is not set | ||
1272 | # CONFIG_MEMSTICK is not set | ||
1273 | # CONFIG_NEW_LEDS is not set | ||
1274 | # CONFIG_NFC_DEVICES is not set | ||
1275 | # CONFIG_ACCESSIBILITY is not set | ||
1276 | # CONFIG_INFINIBAND is not set | ||
1277 | # CONFIG_EDAC is not set | ||
1278 | CONFIG_RTC_LIB=y | ||
1279 | CONFIG_RTC_CLASS=y | ||
1280 | CONFIG_RTC_HCTOSYS=y | ||
1281 | CONFIG_RTC_HCTOSYS_DEVICE="rtc0" | ||
1282 | # CONFIG_RTC_DEBUG is not set | ||
1283 | |||
1284 | # | ||
1285 | # RTC interfaces | ||
1286 | # | ||
1287 | CONFIG_RTC_INTF_SYSFS=y | ||
1288 | CONFIG_RTC_INTF_PROC=y | ||
1289 | CONFIG_RTC_INTF_DEV=y | ||
1290 | # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set | ||
1291 | # CONFIG_RTC_DRV_TEST is not set | ||
1292 | |||
1293 | # | ||
1294 | # I2C RTC drivers | ||
1295 | # | ||
1296 | # CONFIG_RTC_DRV_DS1307 is not set | ||
1297 | # CONFIG_RTC_DRV_DS1374 is not set | ||
1298 | # CONFIG_RTC_DRV_DS1672 is not set | ||
1299 | # CONFIG_RTC_DRV_DS3232 is not set | ||
1300 | # CONFIG_RTC_DRV_MAX6900 is not set | ||
1301 | # CONFIG_RTC_DRV_RS5C372 is not set | ||
1302 | # CONFIG_RTC_DRV_ISL1208 is not set | ||
1303 | # CONFIG_RTC_DRV_ISL12022 is not set | ||
1304 | # CONFIG_RTC_DRV_X1205 is not set | ||
1305 | # CONFIG_RTC_DRV_PCF8563 is not set | ||
1306 | # CONFIG_RTC_DRV_PCF8583 is not set | ||
1307 | # CONFIG_RTC_DRV_M41T80 is not set | ||
1308 | # CONFIG_RTC_DRV_BQ32K is not set | ||
1309 | # CONFIG_RTC_DRV_S35390A is not set | ||
1310 | # CONFIG_RTC_DRV_FM3130 is not set | ||
1311 | # CONFIG_RTC_DRV_RX8581 is not set | ||
1312 | # CONFIG_RTC_DRV_RX8025 is not set | ||
1313 | |||
1314 | # | ||
1315 | # SPI RTC drivers | ||
1316 | # | ||
1317 | |||
1318 | # | ||
1319 | # Platform RTC drivers | ||
1320 | # | ||
1321 | # CONFIG_RTC_DRV_DS1286 is not set | ||
1322 | # CONFIG_RTC_DRV_DS1511 is not set | ||
1323 | # CONFIG_RTC_DRV_DS1553 is not set | ||
1324 | # CONFIG_RTC_DRV_DS1742 is not set | ||
1325 | # CONFIG_RTC_DRV_STK17TA8 is not set | ||
1326 | # CONFIG_RTC_DRV_M48T86 is not set | ||
1327 | # CONFIG_RTC_DRV_M48T35 is not set | ||
1328 | # CONFIG_RTC_DRV_M48T59 is not set | ||
1329 | # CONFIG_RTC_DRV_MSM6242 is not set | ||
1330 | # CONFIG_RTC_DRV_BQ4802 is not set | ||
1331 | # CONFIG_RTC_DRV_RP5C01 is not set | ||
1332 | # CONFIG_RTC_DRV_V3020 is not set | ||
1333 | |||
1334 | # | ||
1335 | # on-CPU RTC drivers | ||
1336 | # | ||
1337 | CONFIG_RTC_DRV_TILE=y | ||
1338 | # CONFIG_DMADEVICES is not set | ||
1339 | # CONFIG_AUXDISPLAY is not set | ||
1340 | # CONFIG_UIO is not set | ||
1341 | # CONFIG_STAGING is not set | ||
1342 | |||
1343 | # | ||
1344 | # File systems | ||
1345 | # | ||
1346 | CONFIG_EXT2_FS=y | ||
1347 | CONFIG_EXT2_FS_XATTR=y | ||
1348 | CONFIG_EXT2_FS_POSIX_ACL=y | ||
1349 | CONFIG_EXT2_FS_SECURITY=y | ||
1350 | CONFIG_EXT2_FS_XIP=y | ||
1351 | CONFIG_EXT3_FS=y | ||
1352 | CONFIG_EXT3_DEFAULTS_TO_ORDERED=y | ||
1353 | CONFIG_EXT3_FS_XATTR=y | ||
1354 | CONFIG_EXT3_FS_POSIX_ACL=y | ||
1355 | CONFIG_EXT3_FS_SECURITY=y | ||
1356 | CONFIG_EXT4_FS=y | ||
1357 | CONFIG_EXT4_FS_XATTR=y | ||
1358 | CONFIG_EXT4_FS_POSIX_ACL=y | ||
1359 | CONFIG_EXT4_FS_SECURITY=y | ||
1360 | # CONFIG_EXT4_DEBUG is not set | ||
1361 | CONFIG_FS_XIP=y | ||
1362 | CONFIG_JBD=y | ||
1363 | # CONFIG_JBD_DEBUG is not set | ||
1364 | CONFIG_JBD2=y | ||
1365 | CONFIG_JBD2_DEBUG=y | ||
1366 | CONFIG_FS_MBCACHE=y | ||
1367 | # CONFIG_REISERFS_FS is not set | ||
1368 | # CONFIG_JFS_FS is not set | ||
1369 | CONFIG_XFS_FS=m | ||
1370 | CONFIG_XFS_QUOTA=y | ||
1371 | CONFIG_XFS_POSIX_ACL=y | ||
1372 | # CONFIG_XFS_RT is not set | ||
1373 | # CONFIG_XFS_DEBUG is not set | ||
1374 | CONFIG_GFS2_FS=m | ||
1375 | CONFIG_GFS2_FS_LOCKING_DLM=y | ||
1376 | # CONFIG_OCFS2_FS is not set | ||
1377 | CONFIG_BTRFS_FS=m | ||
1378 | CONFIG_BTRFS_FS_POSIX_ACL=y | ||
1379 | # CONFIG_NILFS2_FS is not set | ||
1380 | CONFIG_FS_POSIX_ACL=y | ||
1381 | CONFIG_EXPORTFS=y | ||
1382 | CONFIG_FILE_LOCKING=y | ||
1383 | CONFIG_FSNOTIFY=y | ||
1384 | CONFIG_DNOTIFY=y | ||
1385 | CONFIG_INOTIFY_USER=y | ||
1386 | # CONFIG_FANOTIFY is not set | ||
1387 | CONFIG_QUOTA=y | ||
1388 | CONFIG_QUOTA_NETLINK_INTERFACE=y | ||
1389 | # CONFIG_PRINT_QUOTA_WARNING is not set | ||
1390 | # CONFIG_QUOTA_DEBUG is not set | ||
1391 | CONFIG_QUOTA_TREE=y | ||
1392 | # CONFIG_QFMT_V1 is not set | ||
1393 | CONFIG_QFMT_V2=y | ||
1394 | CONFIG_QUOTACTL=y | ||
1395 | # CONFIG_AUTOFS4_FS is not set | ||
1396 | CONFIG_FUSE_FS=y | ||
1397 | CONFIG_CUSE=m | ||
1398 | CONFIG_GENERIC_ACL=y | ||
1399 | |||
1400 | # | ||
1401 | # Caches | ||
1402 | # | ||
1403 | CONFIG_FSCACHE=m | ||
1404 | CONFIG_FSCACHE_STATS=y | ||
1405 | # CONFIG_FSCACHE_HISTOGRAM is not set | ||
1406 | # CONFIG_FSCACHE_DEBUG is not set | ||
1407 | # CONFIG_FSCACHE_OBJECT_LIST is not set | ||
1408 | CONFIG_CACHEFILES=m | ||
1409 | # CONFIG_CACHEFILES_DEBUG is not set | ||
1410 | # CONFIG_CACHEFILES_HISTOGRAM is not set | ||
1411 | |||
1412 | # | ||
1413 | # CD-ROM/DVD Filesystems | ||
1414 | # | ||
1415 | CONFIG_ISO9660_FS=m | ||
1416 | CONFIG_JOLIET=y | ||
1417 | CONFIG_ZISOFS=y | ||
1418 | CONFIG_UDF_FS=m | ||
1419 | CONFIG_UDF_NLS=y | ||
1420 | |||
1421 | # | ||
1422 | # DOS/FAT/NT Filesystems | ||
1423 | # | ||
1424 | CONFIG_FAT_FS=m | ||
1425 | CONFIG_MSDOS_FS=m | ||
1426 | CONFIG_VFAT_FS=m | ||
1427 | CONFIG_FAT_DEFAULT_CODEPAGE=437 | ||
1428 | CONFIG_FAT_DEFAULT_IOCHARSET="ascii" | ||
1429 | # CONFIG_NTFS_FS is not set | ||
1430 | |||
1431 | # | ||
1432 | # Pseudo filesystems | ||
1433 | # | ||
1434 | CONFIG_PROC_FS=y | ||
1435 | CONFIG_PROC_KCORE=y | ||
1436 | CONFIG_PROC_SYSCTL=y | ||
1437 | CONFIG_PROC_PAGE_MONITOR=y | ||
1438 | CONFIG_SYSFS=y | ||
1439 | CONFIG_TMPFS=y | ||
1440 | CONFIG_TMPFS_POSIX_ACL=y | ||
1441 | CONFIG_HUGETLBFS=y | ||
1442 | CONFIG_HUGETLB_PAGE=y | ||
1443 | CONFIG_CONFIGFS_FS=m | ||
1444 | CONFIG_MISC_FILESYSTEMS=y | ||
1445 | # CONFIG_ADFS_FS is not set | ||
1446 | # CONFIG_AFFS_FS is not set | ||
1447 | CONFIG_ECRYPT_FS=m | ||
1448 | # CONFIG_HFS_FS is not set | ||
1449 | # CONFIG_HFSPLUS_FS is not set | ||
1450 | # CONFIG_BEFS_FS is not set | ||
1451 | # CONFIG_BFS_FS is not set | ||
1452 | # CONFIG_EFS_FS is not set | ||
1453 | # CONFIG_LOGFS is not set | ||
1454 | CONFIG_CRAMFS=m | ||
1455 | CONFIG_SQUASHFS=m | ||
1456 | # CONFIG_SQUASHFS_XATTR is not set | ||
1457 | # CONFIG_SQUASHFS_LZO is not set | ||
1458 | # CONFIG_SQUASHFS_XZ is not set | ||
1459 | # CONFIG_SQUASHFS_EMBEDDED is not set | ||
1460 | CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 | ||
1461 | # CONFIG_VXFS_FS is not set | ||
1462 | # CONFIG_MINIX_FS is not set | ||
1463 | # CONFIG_OMFS_FS is not set | ||
1464 | # CONFIG_HPFS_FS is not set | ||
1465 | # CONFIG_QNX4FS_FS is not set | ||
1466 | # CONFIG_ROMFS_FS is not set | ||
1467 | # CONFIG_PSTORE is not set | ||
1468 | # CONFIG_SYSV_FS is not set | ||
1469 | # CONFIG_UFS_FS is not set | ||
1470 | CONFIG_NETWORK_FILESYSTEMS=y | ||
1471 | CONFIG_NFS_FS=m | ||
1472 | CONFIG_NFS_V3=y | ||
1473 | CONFIG_NFS_V3_ACL=y | ||
1474 | CONFIG_NFS_V4=y | ||
1475 | CONFIG_NFS_V4_1=y | ||
1476 | CONFIG_PNFS_FILE_LAYOUT=m | ||
1477 | CONFIG_NFS_FSCACHE=y | ||
1478 | # CONFIG_NFS_USE_LEGACY_DNS is not set | ||
1479 | CONFIG_NFS_USE_KERNEL_DNS=y | ||
1480 | # CONFIG_NFS_USE_NEW_IDMAPPER is not set | ||
1481 | CONFIG_NFSD=m | ||
1482 | CONFIG_NFSD_DEPRECATED=y | ||
1483 | CONFIG_NFSD_V2_ACL=y | ||
1484 | CONFIG_NFSD_V3=y | ||
1485 | CONFIG_NFSD_V3_ACL=y | ||
1486 | CONFIG_NFSD_V4=y | ||
1487 | CONFIG_LOCKD=m | ||
1488 | CONFIG_LOCKD_V4=y | ||
1489 | CONFIG_NFS_ACL_SUPPORT=m | ||
1490 | CONFIG_NFS_COMMON=y | ||
1491 | CONFIG_SUNRPC=m | ||
1492 | CONFIG_SUNRPC_GSS=m | ||
1493 | CONFIG_RPCSEC_GSS_KRB5=m | ||
1494 | # CONFIG_CEPH_FS is not set | ||
1495 | CONFIG_CIFS=m | ||
1496 | CONFIG_CIFS_STATS=y | ||
1497 | # CONFIG_CIFS_STATS2 is not set | ||
1498 | CONFIG_CIFS_WEAK_PW_HASH=y | ||
1499 | CONFIG_CIFS_UPCALL=y | ||
1500 | CONFIG_CIFS_XATTR=y | ||
1501 | CONFIG_CIFS_POSIX=y | ||
1502 | # CONFIG_CIFS_DEBUG2 is not set | ||
1503 | CONFIG_CIFS_DFS_UPCALL=y | ||
1504 | CONFIG_CIFS_FSCACHE=y | ||
1505 | # CONFIG_CIFS_ACL is not set | ||
1506 | CONFIG_CIFS_EXPERIMENTAL=y | ||
1507 | # CONFIG_NCP_FS is not set | ||
1508 | # CONFIG_CODA_FS is not set | ||
1509 | # CONFIG_AFS_FS is not set | ||
1510 | |||
1511 | # | ||
1512 | # Partition Types | ||
1513 | # | ||
1514 | CONFIG_PARTITION_ADVANCED=y | ||
1515 | # CONFIG_ACORN_PARTITION is not set | ||
1516 | CONFIG_OSF_PARTITION=y | ||
1517 | CONFIG_AMIGA_PARTITION=y | ||
1518 | # CONFIG_ATARI_PARTITION is not set | ||
1519 | CONFIG_MAC_PARTITION=y | ||
1520 | CONFIG_MSDOS_PARTITION=y | ||
1521 | CONFIG_BSD_DISKLABEL=y | ||
1522 | CONFIG_MINIX_SUBPARTITION=y | ||
1523 | CONFIG_SOLARIS_X86_PARTITION=y | ||
1524 | CONFIG_UNIXWARE_DISKLABEL=y | ||
1525 | # CONFIG_LDM_PARTITION is not set | ||
1526 | CONFIG_SGI_PARTITION=y | ||
1527 | # CONFIG_ULTRIX_PARTITION is not set | ||
1528 | CONFIG_SUN_PARTITION=y | ||
1529 | CONFIG_KARMA_PARTITION=y | ||
1530 | CONFIG_EFI_PARTITION=y | ||
1531 | # CONFIG_SYSV68_PARTITION is not set | ||
1532 | CONFIG_NLS=y | ||
1533 | CONFIG_NLS_DEFAULT="utf8" | ||
1534 | CONFIG_NLS_CODEPAGE_437=y | ||
1535 | CONFIG_NLS_CODEPAGE_737=m | ||
1536 | CONFIG_NLS_CODEPAGE_775=m | ||
1537 | CONFIG_NLS_CODEPAGE_850=m | ||
1538 | CONFIG_NLS_CODEPAGE_852=m | ||
1539 | CONFIG_NLS_CODEPAGE_855=m | ||
1540 | CONFIG_NLS_CODEPAGE_857=m | ||
1541 | CONFIG_NLS_CODEPAGE_860=m | ||
1542 | CONFIG_NLS_CODEPAGE_861=m | ||
1543 | CONFIG_NLS_CODEPAGE_862=m | ||
1544 | CONFIG_NLS_CODEPAGE_863=m | ||
1545 | CONFIG_NLS_CODEPAGE_864=m | ||
1546 | CONFIG_NLS_CODEPAGE_865=m | ||
1547 | CONFIG_NLS_CODEPAGE_866=m | ||
1548 | CONFIG_NLS_CODEPAGE_869=m | ||
1549 | CONFIG_NLS_CODEPAGE_936=m | ||
1550 | CONFIG_NLS_CODEPAGE_950=m | ||
1551 | CONFIG_NLS_CODEPAGE_932=m | ||
1552 | CONFIG_NLS_CODEPAGE_949=m | ||
1553 | CONFIG_NLS_CODEPAGE_874=m | ||
1554 | CONFIG_NLS_ISO8859_8=m | ||
1555 | CONFIG_NLS_CODEPAGE_1250=m | ||
1556 | CONFIG_NLS_CODEPAGE_1251=m | ||
1557 | CONFIG_NLS_ASCII=y | ||
1558 | CONFIG_NLS_ISO8859_1=m | ||
1559 | CONFIG_NLS_ISO8859_2=m | ||
1560 | CONFIG_NLS_ISO8859_3=m | ||
1561 | CONFIG_NLS_ISO8859_4=m | ||
1562 | CONFIG_NLS_ISO8859_5=m | ||
1563 | CONFIG_NLS_ISO8859_6=m | ||
1564 | CONFIG_NLS_ISO8859_7=m | ||
1565 | CONFIG_NLS_ISO8859_9=m | ||
1566 | CONFIG_NLS_ISO8859_13=m | ||
1567 | CONFIG_NLS_ISO8859_14=m | ||
1568 | CONFIG_NLS_ISO8859_15=m | ||
1569 | CONFIG_NLS_KOI8_R=m | ||
1570 | CONFIG_NLS_KOI8_U=m | ||
1571 | CONFIG_NLS_UTF8=m | ||
1572 | CONFIG_DLM=m | ||
1573 | CONFIG_DLM_DEBUG=y | ||
1574 | |||
1575 | # | ||
1576 | # Kernel hacking | ||
1577 | # | ||
1578 | # CONFIG_PRINTK_TIME is not set | ||
1579 | CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 | ||
1580 | # CONFIG_ENABLE_WARN_DEPRECATED is not set | ||
1581 | CONFIG_ENABLE_MUST_CHECK=y | ||
1582 | CONFIG_FRAME_WARN=2048 | ||
1583 | CONFIG_MAGIC_SYSRQ=y | ||
1584 | CONFIG_STRIP_ASM_SYMS=y | ||
1585 | # CONFIG_UNUSED_SYMBOLS is not set | ||
1586 | CONFIG_DEBUG_FS=y | ||
1587 | CONFIG_HEADERS_CHECK=y | ||
1588 | # CONFIG_DEBUG_SECTION_MISMATCH is not set | ||
1589 | CONFIG_DEBUG_KERNEL=y | ||
1590 | CONFIG_DEBUG_SHIRQ=y | ||
1591 | CONFIG_LOCKUP_DETECTOR=y | ||
1592 | # CONFIG_HARDLOCKUP_DETECTOR is not set | ||
1593 | # CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set | ||
1594 | CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 | ||
1595 | # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set | ||
1596 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 | ||
1597 | CONFIG_DETECT_HUNG_TASK=y | ||
1598 | # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set | ||
1599 | CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 | ||
1600 | CONFIG_SCHED_DEBUG=y | ||
1601 | CONFIG_SCHEDSTATS=y | ||
1602 | CONFIG_TIMER_STATS=y | ||
1603 | # CONFIG_DEBUG_OBJECTS is not set | ||
1604 | # CONFIG_SLUB_DEBUG_ON is not set | ||
1605 | # CONFIG_SLUB_STATS is not set | ||
1606 | # CONFIG_DEBUG_KMEMLEAK is not set | ||
1607 | # CONFIG_DEBUG_RT_MUTEXES is not set | ||
1608 | # CONFIG_RT_MUTEX_TESTER is not set | ||
1609 | # CONFIG_DEBUG_SPINLOCK is not set | ||
1610 | # CONFIG_DEBUG_MUTEXES is not set | ||
1611 | # CONFIG_DEBUG_LOCK_ALLOC is not set | ||
1612 | # CONFIG_PROVE_LOCKING is not set | ||
1613 | # CONFIG_SPARSE_RCU_POINTER is not set | ||
1614 | # CONFIG_LOCK_STAT is not set | ||
1615 | CONFIG_DEBUG_SPINLOCK_SLEEP=y | ||
1616 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | ||
1617 | CONFIG_STACKTRACE=y | ||
1618 | # CONFIG_DEBUG_KOBJECT is not set | ||
1619 | CONFIG_DEBUG_INFO=y | ||
1620 | CONFIG_DEBUG_INFO_REDUCED=y | ||
1621 | CONFIG_DEBUG_VM=y | ||
1622 | # CONFIG_DEBUG_WRITECOUNT is not set | ||
1623 | CONFIG_DEBUG_MEMORY_INIT=y | ||
1624 | CONFIG_DEBUG_LIST=y | ||
1625 | # CONFIG_TEST_LIST_SORT is not set | ||
1626 | # CONFIG_DEBUG_SG is not set | ||
1627 | # CONFIG_DEBUG_NOTIFIERS is not set | ||
1628 | CONFIG_DEBUG_CREDENTIALS=y | ||
1629 | # CONFIG_RCU_TORTURE_TEST is not set | ||
1630 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
1631 | # CONFIG_BACKTRACE_SELF_TEST is not set | ||
1632 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set | ||
1633 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y | ||
1634 | # CONFIG_LKDTM is not set | ||
1635 | # CONFIG_FAULT_INJECTION is not set | ||
1636 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set | ||
1637 | # CONFIG_DEBUG_PAGEALLOC is not set | ||
1638 | CONFIG_TRACING_SUPPORT=y | ||
1639 | CONFIG_FTRACE=y | ||
1640 | # CONFIG_IRQSOFF_TRACER is not set | ||
1641 | # CONFIG_SCHED_TRACER is not set | ||
1642 | # CONFIG_ENABLE_DEFAULT_TRACERS is not set | ||
1643 | CONFIG_BRANCH_PROFILE_NONE=y | ||
1644 | # CONFIG_PROFILE_ANNOTATED_BRANCHES is not set | ||
1645 | # CONFIG_PROFILE_ALL_BRANCHES is not set | ||
1646 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
1647 | # CONFIG_BUILD_DOCSRC is not set | ||
1648 | CONFIG_DYNAMIC_DEBUG=y | ||
1649 | # CONFIG_ATOMIC64_SELFTEST is not set | ||
1650 | CONFIG_ASYNC_RAID6_TEST=m | ||
1651 | # CONFIG_SAMPLES is not set | ||
1652 | # CONFIG_TEST_KSTRTOX is not set | ||
1653 | CONFIG_EARLY_PRINTK=y | ||
1654 | CONFIG_DEBUG_STACKOVERFLOW=y | ||
1655 | # CONFIG_DEBUG_STACK_USAGE is not set | ||
1656 | CONFIG_DEBUG_EXTRA_FLAGS="" | ||
1657 | |||
1658 | # | ||
1659 | # Security options | ||
1660 | # | ||
1661 | CONFIG_KEYS=y | ||
1662 | CONFIG_KEYS_DEBUG_PROC_KEYS=y | ||
1663 | # CONFIG_SECURITY_DMESG_RESTRICT is not set | ||
1664 | CONFIG_SECURITY=y | ||
1665 | CONFIG_SECURITYFS=y | ||
1666 | CONFIG_SECURITY_NETWORK=y | ||
1667 | CONFIG_SECURITY_NETWORK_XFRM=y | ||
1668 | # CONFIG_SECURITY_PATH is not set | ||
1669 | CONFIG_LSM_MMAP_MIN_ADDR=65536 | ||
1670 | CONFIG_SECURITY_SELINUX=y | ||
1671 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y | ||
1672 | CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1 | ||
1673 | CONFIG_SECURITY_SELINUX_DISABLE=y | ||
1674 | CONFIG_SECURITY_SELINUX_DEVELOP=y | ||
1675 | CONFIG_SECURITY_SELINUX_AVC_STATS=y | ||
1676 | CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1 | ||
1677 | # CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX is not set | ||
1678 | # CONFIG_SECURITY_SMACK is not set | ||
1679 | # CONFIG_SECURITY_TOMOYO is not set | ||
1680 | # CONFIG_SECURITY_APPARMOR is not set | ||
1681 | # CONFIG_IMA is not set | ||
1682 | CONFIG_DEFAULT_SECURITY_SELINUX=y | ||
1683 | # CONFIG_DEFAULT_SECURITY_DAC is not set | ||
1684 | CONFIG_DEFAULT_SECURITY="selinux" | ||
1685 | CONFIG_XOR_BLOCKS=m | ||
1686 | CONFIG_ASYNC_CORE=m | ||
1687 | CONFIG_ASYNC_MEMCPY=m | ||
1688 | CONFIG_ASYNC_XOR=m | ||
1689 | CONFIG_ASYNC_PQ=m | ||
1690 | CONFIG_ASYNC_RAID6_RECOV=m | ||
1691 | CONFIG_CRYPTO=y | ||
1692 | |||
1693 | # | ||
1694 | # Crypto core or helper | ||
1695 | # | ||
1696 | CONFIG_CRYPTO_ALGAPI=y | ||
1697 | CONFIG_CRYPTO_ALGAPI2=y | ||
1698 | CONFIG_CRYPTO_AEAD=m | ||
1699 | CONFIG_CRYPTO_AEAD2=y | ||
1700 | CONFIG_CRYPTO_BLKCIPHER=m | ||
1701 | CONFIG_CRYPTO_BLKCIPHER2=y | ||
1702 | CONFIG_CRYPTO_HASH=y | ||
1703 | CONFIG_CRYPTO_HASH2=y | ||
1704 | CONFIG_CRYPTO_RNG=m | ||
1705 | CONFIG_CRYPTO_RNG2=y | ||
1706 | CONFIG_CRYPTO_PCOMP=m | ||
1707 | CONFIG_CRYPTO_PCOMP2=y | ||
1708 | CONFIG_CRYPTO_MANAGER=y | ||
1709 | CONFIG_CRYPTO_MANAGER2=y | ||
1710 | CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y | ||
1711 | CONFIG_CRYPTO_GF128MUL=m | ||
1712 | CONFIG_CRYPTO_NULL=m | ||
1713 | CONFIG_CRYPTO_PCRYPT=m | ||
1714 | CONFIG_CRYPTO_WORKQUEUE=y | ||
1715 | CONFIG_CRYPTO_CRYPTD=m | ||
1716 | CONFIG_CRYPTO_AUTHENC=m | ||
1717 | CONFIG_CRYPTO_TEST=m | ||
1718 | |||
1719 | # | ||
1720 | # Authenticated Encryption with Associated Data | ||
1721 | # | ||
1722 | CONFIG_CRYPTO_CCM=m | ||
1723 | CONFIG_CRYPTO_GCM=m | ||
1724 | CONFIG_CRYPTO_SEQIV=m | ||
1725 | |||
1726 | # | ||
1727 | # Block modes | ||
1728 | # | ||
1729 | CONFIG_CRYPTO_CBC=m | ||
1730 | CONFIG_CRYPTO_CTR=m | ||
1731 | CONFIG_CRYPTO_CTS=m | ||
1732 | CONFIG_CRYPTO_ECB=m | ||
1733 | CONFIG_CRYPTO_LRW=m | ||
1734 | CONFIG_CRYPTO_PCBC=m | ||
1735 | CONFIG_CRYPTO_XTS=m | ||
1736 | |||
1737 | # | ||
1738 | # Hash modes | ||
1739 | # | ||
1740 | CONFIG_CRYPTO_HMAC=y | ||
1741 | CONFIG_CRYPTO_XCBC=m | ||
1742 | CONFIG_CRYPTO_VMAC=m | ||
1743 | |||
1744 | # | ||
1745 | # Digest | ||
1746 | # | ||
1747 | CONFIG_CRYPTO_CRC32C=y | ||
1748 | CONFIG_CRYPTO_GHASH=m | ||
1749 | CONFIG_CRYPTO_MD4=m | ||
1750 | CONFIG_CRYPTO_MD5=y | ||
1751 | CONFIG_CRYPTO_MICHAEL_MIC=m | ||
1752 | CONFIG_CRYPTO_RMD128=m | ||
1753 | CONFIG_CRYPTO_RMD160=m | ||
1754 | CONFIG_CRYPTO_RMD256=m | ||
1755 | CONFIG_CRYPTO_RMD320=m | ||
1756 | CONFIG_CRYPTO_SHA1=y | ||
1757 | CONFIG_CRYPTO_SHA256=m | ||
1758 | CONFIG_CRYPTO_SHA512=m | ||
1759 | CONFIG_CRYPTO_TGR192=m | ||
1760 | CONFIG_CRYPTO_WP512=m | ||
1761 | |||
1762 | # | ||
1763 | # Ciphers | ||
1764 | # | ||
1765 | CONFIG_CRYPTO_AES=m | ||
1766 | CONFIG_CRYPTO_ANUBIS=m | ||
1767 | CONFIG_CRYPTO_ARC4=m | ||
1768 | CONFIG_CRYPTO_BLOWFISH=m | ||
1769 | CONFIG_CRYPTO_CAMELLIA=m | ||
1770 | CONFIG_CRYPTO_CAST5=m | ||
1771 | CONFIG_CRYPTO_CAST6=m | ||
1772 | CONFIG_CRYPTO_DES=m | ||
1773 | CONFIG_CRYPTO_FCRYPT=m | ||
1774 | CONFIG_CRYPTO_KHAZAD=m | ||
1775 | # CONFIG_CRYPTO_SALSA20 is not set | ||
1776 | CONFIG_CRYPTO_SEED=m | ||
1777 | CONFIG_CRYPTO_SERPENT=m | ||
1778 | CONFIG_CRYPTO_TEA=m | ||
1779 | CONFIG_CRYPTO_TWOFISH=m | ||
1780 | CONFIG_CRYPTO_TWOFISH_COMMON=m | ||
1781 | |||
1782 | # | ||
1783 | # Compression | ||
1784 | # | ||
1785 | CONFIG_CRYPTO_DEFLATE=m | ||
1786 | CONFIG_CRYPTO_ZLIB=m | ||
1787 | CONFIG_CRYPTO_LZO=m | ||
1788 | |||
1789 | # | ||
1790 | # Random Number Generation | ||
1791 | # | ||
1792 | CONFIG_CRYPTO_ANSI_CPRNG=m | ||
1793 | # CONFIG_CRYPTO_USER_API_HASH is not set | ||
1794 | # CONFIG_CRYPTO_USER_API_SKCIPHER is not set | ||
1795 | CONFIG_CRYPTO_HW=y | ||
1796 | CONFIG_CRYPTO_DEV_HIFN_795X=m | ||
1797 | CONFIG_CRYPTO_DEV_HIFN_795X_RNG=y | ||
1798 | # CONFIG_BINARY_PRINTF is not set | ||
1799 | |||
1800 | # | ||
1801 | # Library routines | ||
1802 | # | ||
1803 | CONFIG_RAID6_PQ=m | ||
1804 | CONFIG_BITREVERSE=y | ||
1805 | CONFIG_GENERIC_FIND_FIRST_BIT=y | ||
1806 | CONFIG_GENERIC_FIND_NEXT_BIT=y | ||
1807 | CONFIG_GENERIC_FIND_LAST_BIT=y | ||
1808 | # CONFIG_CRC_CCITT is not set | ||
1809 | CONFIG_CRC16=y | ||
1810 | CONFIG_CRC_T10DIF=y | ||
1811 | CONFIG_CRC_ITU_T=m | ||
1812 | CONFIG_CRC32=y | ||
1813 | # CONFIG_CRC7 is not set | ||
1814 | CONFIG_LIBCRC32C=m | ||
1815 | CONFIG_AUDIT_GENERIC=y | ||
1816 | CONFIG_ZLIB_INFLATE=y | ||
1817 | CONFIG_ZLIB_DEFLATE=m | ||
1818 | CONFIG_LZO_COMPRESS=m | ||
1819 | CONFIG_LZO_DECOMPRESS=m | ||
1820 | # CONFIG_XZ_DEC is not set | ||
1821 | # CONFIG_XZ_DEC_BCJ is not set | ||
1822 | CONFIG_DECOMPRESS_GZIP=y | ||
1823 | CONFIG_TEXTSEARCH=y | ||
1824 | CONFIG_TEXTSEARCH_KMP=m | ||
1825 | CONFIG_TEXTSEARCH_BM=m | ||
1826 | CONFIG_TEXTSEARCH_FSM=m | ||
1827 | CONFIG_HAS_IOMEM=y | ||
1828 | CONFIG_HAS_IOPORT=y | ||
1829 | CONFIG_HAS_DMA=y | ||
1830 | CONFIG_CPU_RMAP=y | ||
1831 | CONFIG_NLATTR=y | ||
1832 | # CONFIG_AVERAGE is not set | ||
1833 | # CONFIG_VIRTUALIZATION is not set | ||
diff --git a/arch/tile/configs/tilepro_defconfig b/arch/tile/configs/tilepro_defconfig new file mode 100644 index 000000000000..f58dc362b944 --- /dev/null +++ b/arch/tile/configs/tilepro_defconfig | |||
@@ -0,0 +1,1163 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux/tile 2.6.39-rc5 Kernel Configuration | ||
4 | # Tue May 3 09:15:02 2011 | ||
5 | # | ||
6 | CONFIG_TILE=y | ||
7 | CONFIG_MMU=y | ||
8 | CONFIG_GENERIC_CSUM=y | ||
9 | CONFIG_SEMAPHORE_SLEEPERS=y | ||
10 | CONFIG_HAVE_ARCH_ALLOC_REMAP=y | ||
11 | CONFIG_HAVE_SETUP_PER_CPU_AREA=y | ||
12 | CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y | ||
13 | CONFIG_SYS_SUPPORTS_HUGETLBFS=y | ||
14 | CONFIG_GENERIC_TIME=y | ||
15 | CONFIG_GENERIC_CLOCKEVENTS=y | ||
16 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | ||
17 | CONFIG_DEFAULT_MIGRATION_COST=10000000 | ||
18 | CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y | ||
19 | CONFIG_ARCH_PHYS_ADDR_T_64BIT=y | ||
20 | CONFIG_ARCH_DMA_ADDR_T_64BIT=y | ||
21 | CONFIG_LOCKDEP_SUPPORT=y | ||
22 | CONFIG_STACKTRACE_SUPPORT=y | ||
23 | CONFIG_ARCH_DISCONTIGMEM_ENABLE=y | ||
24 | CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y | ||
25 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | ||
26 | CONFIG_STRICT_DEVMEM=y | ||
27 | CONFIG_SMP=y | ||
28 | # CONFIG_DEBUG_COPY_FROM_USER is not set | ||
29 | CONFIG_HVC_TILE=y | ||
30 | # CONFIG_TILEGX is not set | ||
31 | CONFIG_ARCH_DEFCONFIG="arch/tile/configs/tile_defconfig" | ||
32 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
33 | CONFIG_CONSTRUCTORS=y | ||
34 | |||
35 | # | ||
36 | # General setup | ||
37 | # | ||
38 | CONFIG_EXPERIMENTAL=y | ||
39 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
40 | CONFIG_CROSS_COMPILE="" | ||
41 | CONFIG_LOCALVERSION="" | ||
42 | CONFIG_LOCALVERSION_AUTO=y | ||
43 | # CONFIG_SWAP is not set | ||
44 | CONFIG_SYSVIPC=y | ||
45 | CONFIG_SYSVIPC_SYSCTL=y | ||
46 | # CONFIG_POSIX_MQUEUE is not set | ||
47 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
48 | CONFIG_FHANDLE=y | ||
49 | # CONFIG_TASKSTATS is not set | ||
50 | # CONFIG_AUDIT is not set | ||
51 | CONFIG_HAVE_GENERIC_HARDIRQS=y | ||
52 | |||
53 | # | ||
54 | # IRQ subsystem | ||
55 | # | ||
56 | CONFIG_GENERIC_HARDIRQS=y | ||
57 | CONFIG_GENERIC_IRQ_PROBE=y | ||
58 | CONFIG_GENERIC_IRQ_SHOW=y | ||
59 | CONFIG_GENERIC_PENDING_IRQ=y | ||
60 | |||
61 | # | ||
62 | # RCU Subsystem | ||
63 | # | ||
64 | CONFIG_TREE_RCU=y | ||
65 | # CONFIG_PREEMPT_RCU is not set | ||
66 | # CONFIG_RCU_TRACE is not set | ||
67 | CONFIG_RCU_FANOUT=32 | ||
68 | # CONFIG_RCU_FANOUT_EXACT is not set | ||
69 | # CONFIG_RCU_FAST_NO_HZ is not set | ||
70 | # CONFIG_TREE_RCU_TRACE is not set | ||
71 | # CONFIG_IKCONFIG is not set | ||
72 | CONFIG_LOG_BUF_SHIFT=17 | ||
73 | # CONFIG_CGROUPS is not set | ||
74 | # CONFIG_NAMESPACES is not set | ||
75 | # CONFIG_SCHED_AUTOGROUP is not set | ||
76 | # CONFIG_SYSFS_DEPRECATED is not set | ||
77 | # CONFIG_RELAY is not set | ||
78 | CONFIG_BLK_DEV_INITRD=y | ||
79 | CONFIG_INITRAMFS_SOURCE="usr/contents.txt" | ||
80 | CONFIG_INITRAMFS_ROOT_UID=0 | ||
81 | CONFIG_INITRAMFS_ROOT_GID=0 | ||
82 | CONFIG_RD_GZIP=y | ||
83 | # CONFIG_RD_BZIP2 is not set | ||
84 | # CONFIG_RD_LZMA is not set | ||
85 | # CONFIG_RD_XZ is not set | ||
86 | # CONFIG_RD_LZO is not set | ||
87 | CONFIG_INITRAMFS_COMPRESSION_NONE=y | ||
88 | # CONFIG_INITRAMFS_COMPRESSION_GZIP is not set | ||
89 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
90 | CONFIG_SYSCTL=y | ||
91 | CONFIG_ANON_INODES=y | ||
92 | CONFIG_EXPERT=y | ||
93 | CONFIG_SYSCTL_SYSCALL=y | ||
94 | CONFIG_KALLSYMS=y | ||
95 | # CONFIG_KALLSYMS_ALL is not set | ||
96 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
97 | CONFIG_HOTPLUG=y | ||
98 | CONFIG_PRINTK=y | ||
99 | CONFIG_BUG=y | ||
100 | CONFIG_ELF_CORE=y | ||
101 | CONFIG_BASE_FULL=y | ||
102 | CONFIG_FUTEX=y | ||
103 | CONFIG_EPOLL=y | ||
104 | CONFIG_SIGNALFD=y | ||
105 | CONFIG_TIMERFD=y | ||
106 | CONFIG_EVENTFD=y | ||
107 | CONFIG_SHMEM=y | ||
108 | CONFIG_AIO=y | ||
109 | CONFIG_EMBEDDED=y | ||
110 | |||
111 | # | ||
112 | # Kernel Performance Events And Counters | ||
113 | # | ||
114 | CONFIG_VM_EVENT_COUNTERS=y | ||
115 | CONFIG_PCI_QUIRKS=y | ||
116 | CONFIG_SLUB_DEBUG=y | ||
117 | # CONFIG_COMPAT_BRK is not set | ||
118 | # CONFIG_SLAB is not set | ||
119 | CONFIG_SLUB=y | ||
120 | # CONFIG_SLOB is not set | ||
121 | CONFIG_PROFILING=y | ||
122 | CONFIG_USE_GENERIC_SMP_HELPERS=y | ||
123 | |||
124 | # | ||
125 | # GCOV-based kernel profiling | ||
126 | # | ||
127 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | ||
128 | CONFIG_SLABINFO=y | ||
129 | CONFIG_RT_MUTEXES=y | ||
130 | CONFIG_BASE_SMALL=0 | ||
131 | CONFIG_MODULES=y | ||
132 | # CONFIG_MODULE_FORCE_LOAD is not set | ||
133 | CONFIG_MODULE_UNLOAD=y | ||
134 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
135 | # CONFIG_MODVERSIONS is not set | ||
136 | # CONFIG_MODULE_SRCVERSION_ALL is not set | ||
137 | CONFIG_STOP_MACHINE=y | ||
138 | CONFIG_BLOCK=y | ||
139 | CONFIG_LBDAF=y | ||
140 | # CONFIG_BLK_DEV_BSG is not set | ||
141 | # CONFIG_BLK_DEV_INTEGRITY is not set | ||
142 | |||
143 | # | ||
144 | # IO Schedulers | ||
145 | # | ||
146 | CONFIG_IOSCHED_NOOP=y | ||
147 | # CONFIG_IOSCHED_DEADLINE is not set | ||
148 | # CONFIG_IOSCHED_CFQ is not set | ||
149 | CONFIG_DEFAULT_NOOP=y | ||
150 | CONFIG_DEFAULT_IOSCHED="noop" | ||
151 | # CONFIG_INLINE_SPIN_TRYLOCK is not set | ||
152 | # CONFIG_INLINE_SPIN_TRYLOCK_BH is not set | ||
153 | # CONFIG_INLINE_SPIN_LOCK is not set | ||
154 | # CONFIG_INLINE_SPIN_LOCK_BH is not set | ||
155 | # CONFIG_INLINE_SPIN_LOCK_IRQ is not set | ||
156 | # CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set | ||
157 | CONFIG_INLINE_SPIN_UNLOCK=y | ||
158 | # CONFIG_INLINE_SPIN_UNLOCK_BH is not set | ||
159 | CONFIG_INLINE_SPIN_UNLOCK_IRQ=y | ||
160 | # CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set | ||
161 | # CONFIG_INLINE_READ_TRYLOCK is not set | ||
162 | # CONFIG_INLINE_READ_LOCK is not set | ||
163 | # CONFIG_INLINE_READ_LOCK_BH is not set | ||
164 | # CONFIG_INLINE_READ_LOCK_IRQ is not set | ||
165 | # CONFIG_INLINE_READ_LOCK_IRQSAVE is not set | ||
166 | CONFIG_INLINE_READ_UNLOCK=y | ||
167 | # CONFIG_INLINE_READ_UNLOCK_BH is not set | ||
168 | CONFIG_INLINE_READ_UNLOCK_IRQ=y | ||
169 | # CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set | ||
170 | # CONFIG_INLINE_WRITE_TRYLOCK is not set | ||
171 | # CONFIG_INLINE_WRITE_LOCK is not set | ||
172 | # CONFIG_INLINE_WRITE_LOCK_BH is not set | ||
173 | # CONFIG_INLINE_WRITE_LOCK_IRQ is not set | ||
174 | # CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set | ||
175 | CONFIG_INLINE_WRITE_UNLOCK=y | ||
176 | # CONFIG_INLINE_WRITE_UNLOCK_BH is not set | ||
177 | CONFIG_INLINE_WRITE_UNLOCK_IRQ=y | ||
178 | # CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set | ||
179 | CONFIG_MUTEX_SPIN_ON_OWNER=y | ||
180 | |||
181 | # | ||
182 | # Tilera-specific configuration | ||
183 | # | ||
184 | CONFIG_NR_CPUS=64 | ||
185 | CONFIG_TICK_ONESHOT=y | ||
186 | CONFIG_NO_HZ=y | ||
187 | CONFIG_HIGH_RES_TIMERS=y | ||
188 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y | ||
189 | CONFIG_HZ_100=y | ||
190 | # CONFIG_HZ_250 is not set | ||
191 | # CONFIG_HZ_300 is not set | ||
192 | # CONFIG_HZ_1000 is not set | ||
193 | CONFIG_HZ=100 | ||
194 | CONFIG_SCHED_HRTICK=y | ||
195 | # CONFIG_KEXEC is not set | ||
196 | CONFIG_HIGHMEM=y | ||
197 | CONFIG_NUMA=y | ||
198 | CONFIG_NODES_SHIFT=2 | ||
199 | # CONFIG_VMSPLIT_3_75G is not set | ||
200 | # CONFIG_VMSPLIT_3_5G is not set | ||
201 | CONFIG_VMSPLIT_3G=y | ||
202 | # CONFIG_VMSPLIT_2_75G is not set | ||
203 | # CONFIG_VMSPLIT_2_5G is not set | ||
204 | # CONFIG_VMSPLIT_2_25G is not set | ||
205 | # CONFIG_VMSPLIT_2G is not set | ||
206 | # CONFIG_VMSPLIT_1G is not set | ||
207 | CONFIG_PAGE_OFFSET=0xC0000000 | ||
208 | CONFIG_SELECT_MEMORY_MODEL=y | ||
209 | CONFIG_DISCONTIGMEM_MANUAL=y | ||
210 | CONFIG_DISCONTIGMEM=y | ||
211 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
212 | CONFIG_NEED_MULTIPLE_NODES=y | ||
213 | CONFIG_PAGEFLAGS_EXTENDED=y | ||
214 | CONFIG_SPLIT_PTLOCK_CPUS=4 | ||
215 | # CONFIG_COMPACTION is not set | ||
216 | CONFIG_MIGRATION=y | ||
217 | CONFIG_PHYS_ADDR_T_64BIT=y | ||
218 | CONFIG_ZONE_DMA_FLAG=0 | ||
219 | CONFIG_BOUNCE=y | ||
220 | CONFIG_VIRT_TO_BUS=y | ||
221 | # CONFIG_KSM is not set | ||
222 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 | ||
223 | # CONFIG_CMDLINE_BOOL is not set | ||
224 | CONFIG_VMALLOC_RESERVE=0x1000000 | ||
225 | CONFIG_HARDWALL=y | ||
226 | CONFIG_KERNEL_PL=1 | ||
227 | |||
228 | # | ||
229 | # Bus options | ||
230 | # | ||
231 | CONFIG_PCI=y | ||
232 | CONFIG_PCI_DOMAINS=y | ||
233 | # CONFIG_NO_IOMEM is not set | ||
234 | # CONFIG_NO_IOPORT is not set | ||
235 | # CONFIG_ARCH_SUPPORTS_MSI is not set | ||
236 | # CONFIG_PCI_DEBUG is not set | ||
237 | # CONFIG_PCI_STUB is not set | ||
238 | # CONFIG_PCI_IOV is not set | ||
239 | # CONFIG_HOTPLUG_PCI is not set | ||
240 | |||
241 | # | ||
242 | # Executable file formats | ||
243 | # | ||
244 | CONFIG_KCORE_ELF=y | ||
245 | CONFIG_BINFMT_ELF=y | ||
246 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
247 | # CONFIG_HAVE_AOUT is not set | ||
248 | # CONFIG_BINFMT_MISC is not set | ||
249 | CONFIG_NET=y | ||
250 | |||
251 | # | ||
252 | # Networking options | ||
253 | # | ||
254 | CONFIG_PACKET=y | ||
255 | CONFIG_UNIX=y | ||
256 | CONFIG_XFRM=y | ||
257 | # CONFIG_XFRM_USER is not set | ||
258 | # CONFIG_XFRM_SUB_POLICY is not set | ||
259 | # CONFIG_XFRM_MIGRATE is not set | ||
260 | # CONFIG_XFRM_STATISTICS is not set | ||
261 | # CONFIG_NET_KEY is not set | ||
262 | CONFIG_INET=y | ||
263 | CONFIG_IP_MULTICAST=y | ||
264 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
265 | # CONFIG_IP_PNP is not set | ||
266 | # CONFIG_NET_IPIP is not set | ||
267 | # CONFIG_NET_IPGRE_DEMUX is not set | ||
268 | # CONFIG_IP_MROUTE is not set | ||
269 | # CONFIG_ARPD is not set | ||
270 | # CONFIG_SYN_COOKIES is not set | ||
271 | # CONFIG_INET_AH is not set | ||
272 | # CONFIG_INET_ESP is not set | ||
273 | # CONFIG_INET_IPCOMP is not set | ||
274 | # CONFIG_INET_XFRM_TUNNEL is not set | ||
275 | CONFIG_INET_TUNNEL=y | ||
276 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
277 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
278 | CONFIG_INET_XFRM_MODE_BEET=y | ||
279 | # CONFIG_INET_LRO is not set | ||
280 | # CONFIG_INET_DIAG is not set | ||
281 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
282 | CONFIG_TCP_CONG_CUBIC=y | ||
283 | CONFIG_DEFAULT_TCP_CONG="cubic" | ||
284 | # CONFIG_TCP_MD5SIG is not set | ||
285 | CONFIG_IPV6=y | ||
286 | # CONFIG_IPV6_PRIVACY is not set | ||
287 | # CONFIG_IPV6_ROUTER_PREF is not set | ||
288 | # CONFIG_IPV6_OPTIMISTIC_DAD is not set | ||
289 | # CONFIG_INET6_AH is not set | ||
290 | # CONFIG_INET6_ESP is not set | ||
291 | # CONFIG_INET6_IPCOMP is not set | ||
292 | # CONFIG_IPV6_MIP6 is not set | ||
293 | # CONFIG_INET6_XFRM_TUNNEL is not set | ||
294 | # CONFIG_INET6_TUNNEL is not set | ||
295 | CONFIG_INET6_XFRM_MODE_TRANSPORT=y | ||
296 | CONFIG_INET6_XFRM_MODE_TUNNEL=y | ||
297 | CONFIG_INET6_XFRM_MODE_BEET=y | ||
298 | # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set | ||
299 | CONFIG_IPV6_SIT=y | ||
300 | # CONFIG_IPV6_SIT_6RD is not set | ||
301 | CONFIG_IPV6_NDISC_NODETYPE=y | ||
302 | # CONFIG_IPV6_TUNNEL is not set | ||
303 | # CONFIG_IPV6_MULTIPLE_TABLES is not set | ||
304 | # CONFIG_IPV6_MROUTE is not set | ||
305 | # CONFIG_NETWORK_SECMARK is not set | ||
306 | # CONFIG_NETWORK_PHY_TIMESTAMPING is not set | ||
307 | # CONFIG_NETFILTER is not set | ||
308 | # CONFIG_IP_DCCP is not set | ||
309 | # CONFIG_IP_SCTP is not set | ||
310 | # CONFIG_RDS is not set | ||
311 | # CONFIG_TIPC is not set | ||
312 | # CONFIG_ATM is not set | ||
313 | # CONFIG_L2TP is not set | ||
314 | # CONFIG_BRIDGE is not set | ||
315 | # CONFIG_NET_DSA is not set | ||
316 | # CONFIG_VLAN_8021Q is not set | ||
317 | # CONFIG_DECNET is not set | ||
318 | # CONFIG_LLC2 is not set | ||
319 | # CONFIG_IPX is not set | ||
320 | # CONFIG_ATALK is not set | ||
321 | # CONFIG_X25 is not set | ||
322 | # CONFIG_LAPB is not set | ||
323 | # CONFIG_ECONET is not set | ||
324 | # CONFIG_WAN_ROUTER is not set | ||
325 | # CONFIG_PHONET is not set | ||
326 | # CONFIG_IEEE802154 is not set | ||
327 | # CONFIG_NET_SCHED is not set | ||
328 | # CONFIG_DCB is not set | ||
329 | # CONFIG_BATMAN_ADV is not set | ||
330 | CONFIG_RPS=y | ||
331 | CONFIG_RFS_ACCEL=y | ||
332 | CONFIG_XPS=y | ||
333 | |||
334 | # | ||
335 | # Network testing | ||
336 | # | ||
337 | # CONFIG_NET_PKTGEN is not set | ||
338 | # CONFIG_HAMRADIO is not set | ||
339 | # CONFIG_CAN is not set | ||
340 | # CONFIG_IRDA is not set | ||
341 | # CONFIG_BT is not set | ||
342 | # CONFIG_AF_RXRPC is not set | ||
343 | # CONFIG_WIRELESS is not set | ||
344 | # CONFIG_WIMAX is not set | ||
345 | # CONFIG_RFKILL is not set | ||
346 | # CONFIG_NET_9P is not set | ||
347 | # CONFIG_CAIF is not set | ||
348 | # CONFIG_CEPH_LIB is not set | ||
349 | |||
350 | # | ||
351 | # Device Drivers | ||
352 | # | ||
353 | |||
354 | # | ||
355 | # Generic Driver Options | ||
356 | # | ||
357 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
358 | # CONFIG_DEVTMPFS is not set | ||
359 | CONFIG_STANDALONE=y | ||
360 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
361 | CONFIG_FW_LOADER=y | ||
362 | CONFIG_FIRMWARE_IN_KERNEL=y | ||
363 | CONFIG_EXTRA_FIRMWARE="" | ||
364 | # CONFIG_DEBUG_DRIVER is not set | ||
365 | # CONFIG_DEBUG_DEVRES is not set | ||
366 | # CONFIG_SYS_HYPERVISOR is not set | ||
367 | # CONFIG_CONNECTOR is not set | ||
368 | # CONFIG_MTD is not set | ||
369 | # CONFIG_PARPORT is not set | ||
370 | CONFIG_BLK_DEV=y | ||
371 | # CONFIG_BLK_CPQ_DA is not set | ||
372 | # CONFIG_BLK_CPQ_CISS_DA is not set | ||
373 | # CONFIG_BLK_DEV_DAC960 is not set | ||
374 | # CONFIG_BLK_DEV_UMEM is not set | ||
375 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
376 | # CONFIG_BLK_DEV_LOOP is not set | ||
377 | |||
378 | # | ||
379 | # DRBD disabled because PROC_FS, INET or CONNECTOR not selected | ||
380 | # | ||
381 | # CONFIG_BLK_DEV_NBD is not set | ||
382 | # CONFIG_BLK_DEV_SX8 is not set | ||
383 | # CONFIG_BLK_DEV_RAM is not set | ||
384 | # CONFIG_CDROM_PKTCDVD is not set | ||
385 | # CONFIG_ATA_OVER_ETH is not set | ||
386 | # CONFIG_BLK_DEV_RBD is not set | ||
387 | # CONFIG_SENSORS_LIS3LV02D is not set | ||
388 | CONFIG_MISC_DEVICES=y | ||
389 | # CONFIG_PHANTOM is not set | ||
390 | # CONFIG_SGI_IOC4 is not set | ||
391 | # CONFIG_TIFM_CORE is not set | ||
392 | # CONFIG_ENCLOSURE_SERVICES is not set | ||
393 | # CONFIG_HP_ILO is not set | ||
394 | # CONFIG_PCH_PHUB is not set | ||
395 | # CONFIG_C2PORT is not set | ||
396 | |||
397 | # | ||
398 | # EEPROM support | ||
399 | # | ||
400 | # CONFIG_EEPROM_93CX6 is not set | ||
401 | # CONFIG_CB710_CORE is not set | ||
402 | |||
403 | # | ||
404 | # Texas Instruments shared transport line discipline | ||
405 | # | ||
406 | |||
407 | # | ||
408 | # SCSI device support | ||
409 | # | ||
410 | CONFIG_SCSI_MOD=y | ||
411 | # CONFIG_RAID_ATTRS is not set | ||
412 | CONFIG_SCSI=y | ||
413 | CONFIG_SCSI_DMA=y | ||
414 | # CONFIG_SCSI_TGT is not set | ||
415 | # CONFIG_SCSI_NETLINK is not set | ||
416 | CONFIG_SCSI_PROC_FS=y | ||
417 | |||
418 | # | ||
419 | # SCSI support type (disk, tape, CD-ROM) | ||
420 | # | ||
421 | CONFIG_BLK_DEV_SD=y | ||
422 | # CONFIG_CHR_DEV_ST is not set | ||
423 | # CONFIG_CHR_DEV_OSST is not set | ||
424 | # CONFIG_BLK_DEV_SR is not set | ||
425 | # CONFIG_CHR_DEV_SG is not set | ||
426 | # CONFIG_CHR_DEV_SCH is not set | ||
427 | # CONFIG_SCSI_MULTI_LUN is not set | ||
428 | CONFIG_SCSI_CONSTANTS=y | ||
429 | CONFIG_SCSI_LOGGING=y | ||
430 | # CONFIG_SCSI_SCAN_ASYNC is not set | ||
431 | CONFIG_SCSI_WAIT_SCAN=m | ||
432 | |||
433 | # | ||
434 | # SCSI Transports | ||
435 | # | ||
436 | # CONFIG_SCSI_SPI_ATTRS is not set | ||
437 | # CONFIG_SCSI_FC_ATTRS is not set | ||
438 | # CONFIG_SCSI_ISCSI_ATTRS is not set | ||
439 | # CONFIG_SCSI_SAS_ATTRS is not set | ||
440 | # CONFIG_SCSI_SAS_LIBSAS is not set | ||
441 | # CONFIG_SCSI_SRP_ATTRS is not set | ||
442 | CONFIG_SCSI_LOWLEVEL=y | ||
443 | # CONFIG_ISCSI_TCP is not set | ||
444 | # CONFIG_ISCSI_BOOT_SYSFS is not set | ||
445 | # CONFIG_SCSI_CXGB3_ISCSI is not set | ||
446 | # CONFIG_SCSI_CXGB4_ISCSI is not set | ||
447 | # CONFIG_SCSI_BNX2_ISCSI is not set | ||
448 | # CONFIG_SCSI_BNX2X_FCOE is not set | ||
449 | # CONFIG_BE2ISCSI is not set | ||
450 | # CONFIG_BLK_DEV_3W_XXXX_RAID is not set | ||
451 | # CONFIG_SCSI_HPSA is not set | ||
452 | # CONFIG_SCSI_3W_9XXX is not set | ||
453 | # CONFIG_SCSI_3W_SAS is not set | ||
454 | # CONFIG_SCSI_ACARD is not set | ||
455 | # CONFIG_SCSI_AACRAID is not set | ||
456 | # CONFIG_SCSI_AIC7XXX is not set | ||
457 | # CONFIG_SCSI_AIC7XXX_OLD is not set | ||
458 | # CONFIG_SCSI_AIC79XX is not set | ||
459 | # CONFIG_SCSI_AIC94XX is not set | ||
460 | # CONFIG_SCSI_MVSAS is not set | ||
461 | # CONFIG_SCSI_DPT_I2O is not set | ||
462 | # CONFIG_SCSI_ADVANSYS is not set | ||
463 | # CONFIG_SCSI_ARCMSR is not set | ||
464 | # CONFIG_MEGARAID_NEWGEN is not set | ||
465 | # CONFIG_MEGARAID_LEGACY is not set | ||
466 | # CONFIG_MEGARAID_SAS is not set | ||
467 | # CONFIG_SCSI_MPT2SAS is not set | ||
468 | # CONFIG_SCSI_HPTIOP is not set | ||
469 | # CONFIG_LIBFC is not set | ||
470 | # CONFIG_LIBFCOE is not set | ||
471 | # CONFIG_FCOE is not set | ||
472 | # CONFIG_SCSI_DMX3191D is not set | ||
473 | # CONFIG_SCSI_FUTURE_DOMAIN is not set | ||
474 | # CONFIG_SCSI_IPS is not set | ||
475 | # CONFIG_SCSI_INITIO is not set | ||
476 | # CONFIG_SCSI_INIA100 is not set | ||
477 | # CONFIG_SCSI_STEX is not set | ||
478 | # CONFIG_SCSI_SYM53C8XX_2 is not set | ||
479 | # CONFIG_SCSI_QLOGIC_1280 is not set | ||
480 | # CONFIG_SCSI_QLA_FC is not set | ||
481 | # CONFIG_SCSI_QLA_ISCSI is not set | ||
482 | # CONFIG_SCSI_LPFC is not set | ||
483 | # CONFIG_SCSI_DC395x is not set | ||
484 | # CONFIG_SCSI_DC390T is not set | ||
485 | # CONFIG_SCSI_NSP32 is not set | ||
486 | # CONFIG_SCSI_DEBUG is not set | ||
487 | # CONFIG_SCSI_PMCRAID is not set | ||
488 | # CONFIG_SCSI_PM8001 is not set | ||
489 | # CONFIG_SCSI_SRP is not set | ||
490 | # CONFIG_SCSI_BFA_FC is not set | ||
491 | # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set | ||
492 | # CONFIG_SCSI_DH is not set | ||
493 | # CONFIG_SCSI_OSD_INITIATOR is not set | ||
494 | # CONFIG_ATA is not set | ||
495 | # CONFIG_MD is not set | ||
496 | # CONFIG_TARGET_CORE is not set | ||
497 | # CONFIG_FUSION is not set | ||
498 | |||
499 | # | ||
500 | # IEEE 1394 (FireWire) support | ||
501 | # | ||
502 | # CONFIG_FIREWIRE is not set | ||
503 | # CONFIG_FIREWIRE_NOSY is not set | ||
504 | # CONFIG_I2O is not set | ||
505 | CONFIG_NETDEVICES=y | ||
506 | # CONFIG_DUMMY is not set | ||
507 | # CONFIG_BONDING is not set | ||
508 | # CONFIG_MACVLAN is not set | ||
509 | # CONFIG_EQUALIZER is not set | ||
510 | CONFIG_TUN=y | ||
511 | # CONFIG_VETH is not set | ||
512 | # CONFIG_ARCNET is not set | ||
513 | # CONFIG_MII is not set | ||
514 | # CONFIG_PHYLIB is not set | ||
515 | # CONFIG_NET_ETHERNET is not set | ||
516 | CONFIG_NETDEV_1000=y | ||
517 | # CONFIG_ACENIC is not set | ||
518 | # CONFIG_DL2K is not set | ||
519 | # CONFIG_E1000 is not set | ||
520 | # CONFIG_E1000E is not set | ||
521 | # CONFIG_IP1000 is not set | ||
522 | # CONFIG_IGB is not set | ||
523 | # CONFIG_IGBVF is not set | ||
524 | # CONFIG_NS83820 is not set | ||
525 | # CONFIG_HAMACHI is not set | ||
526 | # CONFIG_YELLOWFIN is not set | ||
527 | # CONFIG_R8169 is not set | ||
528 | # CONFIG_SIS190 is not set | ||
529 | # CONFIG_SKGE is not set | ||
530 | # CONFIG_SKY2 is not set | ||
531 | # CONFIG_VIA_VELOCITY is not set | ||
532 | # CONFIG_TIGON3 is not set | ||
533 | # CONFIG_BNX2 is not set | ||
534 | # CONFIG_CNIC is not set | ||
535 | # CONFIG_QLA3XXX is not set | ||
536 | # CONFIG_ATL1 is not set | ||
537 | # CONFIG_ATL1E is not set | ||
538 | # CONFIG_ATL1C is not set | ||
539 | # CONFIG_JME is not set | ||
540 | # CONFIG_STMMAC_ETH is not set | ||
541 | # CONFIG_PCH_GBE is not set | ||
542 | # CONFIG_NETDEV_10000 is not set | ||
543 | # CONFIG_TR is not set | ||
544 | # CONFIG_WLAN is not set | ||
545 | |||
546 | # | ||
547 | # Enable WiMAX (Networking options) to see the WiMAX drivers | ||
548 | # | ||
549 | # CONFIG_WAN is not set | ||
550 | |||
551 | # | ||
552 | # CAIF transport drivers | ||
553 | # | ||
554 | CONFIG_TILE_NET=y | ||
555 | # CONFIG_FDDI is not set | ||
556 | # CONFIG_HIPPI is not set | ||
557 | # CONFIG_PPP is not set | ||
558 | # CONFIG_SLIP is not set | ||
559 | # CONFIG_NET_FC is not set | ||
560 | # CONFIG_NETCONSOLE is not set | ||
561 | # CONFIG_NETPOLL is not set | ||
562 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
563 | # CONFIG_VMXNET3 is not set | ||
564 | # CONFIG_ISDN is not set | ||
565 | # CONFIG_PHONE is not set | ||
566 | |||
567 | # | ||
568 | # Input device support | ||
569 | # | ||
570 | CONFIG_INPUT=y | ||
571 | # CONFIG_INPUT_FF_MEMLESS is not set | ||
572 | # CONFIG_INPUT_POLLDEV is not set | ||
573 | # CONFIG_INPUT_SPARSEKMAP is not set | ||
574 | |||
575 | # | ||
576 | # Userland interfaces | ||
577 | # | ||
578 | # CONFIG_INPUT_MOUSEDEV is not set | ||
579 | # CONFIG_INPUT_JOYDEV is not set | ||
580 | # CONFIG_INPUT_EVDEV is not set | ||
581 | # CONFIG_INPUT_EVBUG is not set | ||
582 | |||
583 | # | ||
584 | # Input Device Drivers | ||
585 | # | ||
586 | # CONFIG_INPUT_KEYBOARD is not set | ||
587 | # CONFIG_INPUT_MOUSE is not set | ||
588 | # CONFIG_INPUT_JOYSTICK is not set | ||
589 | # CONFIG_INPUT_TABLET is not set | ||
590 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
591 | # CONFIG_INPUT_MISC is not set | ||
592 | |||
593 | # | ||
594 | # Hardware I/O ports | ||
595 | # | ||
596 | # CONFIG_SERIO is not set | ||
597 | # CONFIG_GAMEPORT is not set | ||
598 | |||
599 | # | ||
600 | # Character devices | ||
601 | # | ||
602 | # CONFIG_VT is not set | ||
603 | CONFIG_UNIX98_PTYS=y | ||
604 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set | ||
605 | # CONFIG_LEGACY_PTYS is not set | ||
606 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
607 | # CONFIG_NOZOMI is not set | ||
608 | # CONFIG_N_GSM is not set | ||
609 | CONFIG_DEVKMEM=y | ||
610 | |||
611 | # | ||
612 | # Serial drivers | ||
613 | # | ||
614 | # CONFIG_SERIAL_8250 is not set | ||
615 | |||
616 | # | ||
617 | # Non-8250 serial port support | ||
618 | # | ||
619 | # CONFIG_SERIAL_MFD_HSU is not set | ||
620 | # CONFIG_SERIAL_JSM is not set | ||
621 | # CONFIG_SERIAL_TIMBERDALE is not set | ||
622 | # CONFIG_SERIAL_ALTERA_JTAGUART is not set | ||
623 | # CONFIG_SERIAL_ALTERA_UART is not set | ||
624 | # CONFIG_SERIAL_PCH_UART is not set | ||
625 | # CONFIG_TTY_PRINTK is not set | ||
626 | CONFIG_HVC_DRIVER=y | ||
627 | # CONFIG_IPMI_HANDLER is not set | ||
628 | # CONFIG_HW_RANDOM is not set | ||
629 | # CONFIG_R3964 is not set | ||
630 | # CONFIG_APPLICOM is not set | ||
631 | |||
632 | # | ||
633 | # PCMCIA character devices | ||
634 | # | ||
635 | # CONFIG_RAW_DRIVER is not set | ||
636 | # CONFIG_TCG_TPM is not set | ||
637 | CONFIG_DEVPORT=y | ||
638 | # CONFIG_RAMOOPS is not set | ||
639 | # CONFIG_I2C is not set | ||
640 | # CONFIG_SPI is not set | ||
641 | |||
642 | # | ||
643 | # PPS support | ||
644 | # | ||
645 | # CONFIG_PPS is not set | ||
646 | |||
647 | # | ||
648 | # PPS generators support | ||
649 | # | ||
650 | # CONFIG_W1 is not set | ||
651 | # CONFIG_POWER_SUPPLY is not set | ||
652 | CONFIG_HWMON=y | ||
653 | # CONFIG_HWMON_VID is not set | ||
654 | # CONFIG_HWMON_DEBUG_CHIP is not set | ||
655 | |||
656 | # | ||
657 | # Native drivers | ||
658 | # | ||
659 | # CONFIG_SENSORS_I5K_AMB is not set | ||
660 | # CONFIG_SENSORS_F71805F is not set | ||
661 | # CONFIG_SENSORS_F71882FG is not set | ||
662 | # CONFIG_SENSORS_IT87 is not set | ||
663 | # CONFIG_SENSORS_PC87360 is not set | ||
664 | # CONFIG_SENSORS_PC87427 is not set | ||
665 | # CONFIG_SENSORS_SIS5595 is not set | ||
666 | # CONFIG_SENSORS_SMSC47M1 is not set | ||
667 | # CONFIG_SENSORS_SMSC47B397 is not set | ||
668 | # CONFIG_SENSORS_SCH5627 is not set | ||
669 | # CONFIG_SENSORS_VIA686A is not set | ||
670 | # CONFIG_SENSORS_VT1211 is not set | ||
671 | # CONFIG_SENSORS_VT8231 is not set | ||
672 | # CONFIG_SENSORS_W83627HF is not set | ||
673 | # CONFIG_SENSORS_W83627EHF is not set | ||
674 | # CONFIG_THERMAL is not set | ||
675 | CONFIG_WATCHDOG=y | ||
676 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
677 | |||
678 | # | ||
679 | # Watchdog Device Drivers | ||
680 | # | ||
681 | # CONFIG_SOFT_WATCHDOG is not set | ||
682 | # CONFIG_ALIM7101_WDT is not set | ||
683 | |||
684 | # | ||
685 | # PCI-based Watchdog Cards | ||
686 | # | ||
687 | # CONFIG_PCIPCWATCHDOG is not set | ||
688 | # CONFIG_WDTPCI is not set | ||
689 | CONFIG_SSB_POSSIBLE=y | ||
690 | |||
691 | # | ||
692 | # Sonics Silicon Backplane | ||
693 | # | ||
694 | # CONFIG_SSB is not set | ||
695 | CONFIG_MFD_SUPPORT=y | ||
696 | # CONFIG_MFD_CORE is not set | ||
697 | # CONFIG_MFD_SM501 is not set | ||
698 | # CONFIG_HTC_PASIC3 is not set | ||
699 | # CONFIG_MFD_TMIO is not set | ||
700 | # CONFIG_ABX500_CORE is not set | ||
701 | # CONFIG_LPC_SCH is not set | ||
702 | # CONFIG_MFD_RDC321X is not set | ||
703 | # CONFIG_MFD_JANZ_CMODIO is not set | ||
704 | # CONFIG_MFD_VX855 is not set | ||
705 | # CONFIG_REGULATOR is not set | ||
706 | # CONFIG_MEDIA_SUPPORT is not set | ||
707 | |||
708 | # | ||
709 | # Graphics support | ||
710 | # | ||
711 | CONFIG_VGA_ARB=y | ||
712 | CONFIG_VGA_ARB_MAX_GPUS=16 | ||
713 | # CONFIG_DRM is not set | ||
714 | # CONFIG_STUB_POULSBO is not set | ||
715 | # CONFIG_VGASTATE is not set | ||
716 | # CONFIG_VIDEO_OUTPUT_CONTROL is not set | ||
717 | # CONFIG_FB is not set | ||
718 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set | ||
719 | |||
720 | # | ||
721 | # Display device support | ||
722 | # | ||
723 | # CONFIG_DISPLAY_SUPPORT is not set | ||
724 | # CONFIG_SOUND is not set | ||
725 | # CONFIG_HID_SUPPORT is not set | ||
726 | CONFIG_USB_SUPPORT=y | ||
727 | CONFIG_USB_ARCH_HAS_HCD=y | ||
728 | CONFIG_USB_ARCH_HAS_OHCI=y | ||
729 | CONFIG_USB_ARCH_HAS_EHCI=y | ||
730 | # CONFIG_USB is not set | ||
731 | # CONFIG_USB_OTG_WHITELIST is not set | ||
732 | # CONFIG_USB_OTG_BLACKLIST_HUB is not set | ||
733 | |||
734 | # | ||
735 | # Enable Host or Gadget support to see Inventra options | ||
736 | # | ||
737 | |||
738 | # | ||
739 | # NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may | ||
740 | # | ||
741 | # CONFIG_USB_GADGET is not set | ||
742 | |||
743 | # | ||
744 | # OTG and related infrastructure | ||
745 | # | ||
746 | # CONFIG_UWB is not set | ||
747 | # CONFIG_MMC is not set | ||
748 | # CONFIG_MEMSTICK is not set | ||
749 | # CONFIG_NEW_LEDS is not set | ||
750 | # CONFIG_NFC_DEVICES is not set | ||
751 | # CONFIG_ACCESSIBILITY is not set | ||
752 | # CONFIG_INFINIBAND is not set | ||
753 | CONFIG_EDAC=y | ||
754 | |||
755 | # | ||
756 | # Reporting subsystems | ||
757 | # | ||
758 | # CONFIG_EDAC_DEBUG is not set | ||
759 | CONFIG_EDAC_MM_EDAC=y | ||
760 | CONFIG_EDAC_TILE=y | ||
761 | CONFIG_RTC_LIB=y | ||
762 | CONFIG_RTC_CLASS=y | ||
763 | CONFIG_RTC_HCTOSYS=y | ||
764 | CONFIG_RTC_HCTOSYS_DEVICE="rtc0" | ||
765 | # CONFIG_RTC_DEBUG is not set | ||
766 | |||
767 | # | ||
768 | # RTC interfaces | ||
769 | # | ||
770 | # CONFIG_RTC_INTF_SYSFS is not set | ||
771 | # CONFIG_RTC_INTF_PROC is not set | ||
772 | CONFIG_RTC_INTF_DEV=y | ||
773 | # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set | ||
774 | # CONFIG_RTC_DRV_TEST is not set | ||
775 | |||
776 | # | ||
777 | # SPI RTC drivers | ||
778 | # | ||
779 | |||
780 | # | ||
781 | # Platform RTC drivers | ||
782 | # | ||
783 | # CONFIG_RTC_DRV_DS1286 is not set | ||
784 | # CONFIG_RTC_DRV_DS1511 is not set | ||
785 | # CONFIG_RTC_DRV_DS1553 is not set | ||
786 | # CONFIG_RTC_DRV_DS1742 is not set | ||
787 | # CONFIG_RTC_DRV_STK17TA8 is not set | ||
788 | # CONFIG_RTC_DRV_M48T86 is not set | ||
789 | # CONFIG_RTC_DRV_M48T35 is not set | ||
790 | # CONFIG_RTC_DRV_M48T59 is not set | ||
791 | # CONFIG_RTC_DRV_MSM6242 is not set | ||
792 | # CONFIG_RTC_DRV_BQ4802 is not set | ||
793 | # CONFIG_RTC_DRV_RP5C01 is not set | ||
794 | # CONFIG_RTC_DRV_V3020 is not set | ||
795 | |||
796 | # | ||
797 | # on-CPU RTC drivers | ||
798 | # | ||
799 | CONFIG_RTC_DRV_TILE=y | ||
800 | # CONFIG_DMADEVICES is not set | ||
801 | # CONFIG_AUXDISPLAY is not set | ||
802 | # CONFIG_UIO is not set | ||
803 | # CONFIG_STAGING is not set | ||
804 | |||
805 | # | ||
806 | # File systems | ||
807 | # | ||
808 | CONFIG_EXT2_FS=y | ||
809 | # CONFIG_EXT2_FS_XATTR is not set | ||
810 | # CONFIG_EXT2_FS_XIP is not set | ||
811 | CONFIG_EXT3_FS=y | ||
812 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | ||
813 | CONFIG_EXT3_FS_XATTR=y | ||
814 | # CONFIG_EXT3_FS_POSIX_ACL is not set | ||
815 | # CONFIG_EXT3_FS_SECURITY is not set | ||
816 | # CONFIG_EXT4_FS is not set | ||
817 | CONFIG_JBD=y | ||
818 | CONFIG_FS_MBCACHE=y | ||
819 | # CONFIG_REISERFS_FS is not set | ||
820 | # CONFIG_JFS_FS is not set | ||
821 | # CONFIG_XFS_FS is not set | ||
822 | # CONFIG_GFS2_FS is not set | ||
823 | # CONFIG_BTRFS_FS is not set | ||
824 | # CONFIG_NILFS2_FS is not set | ||
825 | # CONFIG_FS_POSIX_ACL is not set | ||
826 | CONFIG_EXPORTFS=y | ||
827 | CONFIG_FILE_LOCKING=y | ||
828 | CONFIG_FSNOTIFY=y | ||
829 | CONFIG_DNOTIFY=y | ||
830 | CONFIG_INOTIFY_USER=y | ||
831 | # CONFIG_FANOTIFY is not set | ||
832 | # CONFIG_QUOTA is not set | ||
833 | # CONFIG_QUOTACTL is not set | ||
834 | # CONFIG_AUTOFS4_FS is not set | ||
835 | CONFIG_FUSE_FS=y | ||
836 | # CONFIG_CUSE is not set | ||
837 | |||
838 | # | ||
839 | # Caches | ||
840 | # | ||
841 | # CONFIG_FSCACHE is not set | ||
842 | |||
843 | # | ||
844 | # CD-ROM/DVD Filesystems | ||
845 | # | ||
846 | # CONFIG_ISO9660_FS is not set | ||
847 | # CONFIG_UDF_FS is not set | ||
848 | |||
849 | # | ||
850 | # DOS/FAT/NT Filesystems | ||
851 | # | ||
852 | CONFIG_FAT_FS=y | ||
853 | CONFIG_MSDOS_FS=y | ||
854 | CONFIG_VFAT_FS=m | ||
855 | CONFIG_FAT_DEFAULT_CODEPAGE=437 | ||
856 | CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" | ||
857 | # CONFIG_NTFS_FS is not set | ||
858 | |||
859 | # | ||
860 | # Pseudo filesystems | ||
861 | # | ||
862 | CONFIG_PROC_FS=y | ||
863 | # CONFIG_PROC_KCORE is not set | ||
864 | CONFIG_PROC_SYSCTL=y | ||
865 | CONFIG_PROC_PAGE_MONITOR=y | ||
866 | CONFIG_SYSFS=y | ||
867 | CONFIG_TMPFS=y | ||
868 | # CONFIG_TMPFS_POSIX_ACL is not set | ||
869 | CONFIG_HUGETLBFS=y | ||
870 | CONFIG_HUGETLB_PAGE=y | ||
871 | # CONFIG_CONFIGFS_FS is not set | ||
872 | CONFIG_MISC_FILESYSTEMS=y | ||
873 | # CONFIG_ADFS_FS is not set | ||
874 | # CONFIG_AFFS_FS is not set | ||
875 | # CONFIG_HFS_FS is not set | ||
876 | # CONFIG_HFSPLUS_FS is not set | ||
877 | # CONFIG_BEFS_FS is not set | ||
878 | # CONFIG_BFS_FS is not set | ||
879 | # CONFIG_EFS_FS is not set | ||
880 | # CONFIG_LOGFS is not set | ||
881 | # CONFIG_CRAMFS is not set | ||
882 | # CONFIG_SQUASHFS is not set | ||
883 | # CONFIG_VXFS_FS is not set | ||
884 | # CONFIG_MINIX_FS is not set | ||
885 | # CONFIG_OMFS_FS is not set | ||
886 | # CONFIG_HPFS_FS is not set | ||
887 | # CONFIG_QNX4FS_FS is not set | ||
888 | # CONFIG_ROMFS_FS is not set | ||
889 | # CONFIG_PSTORE is not set | ||
890 | # CONFIG_SYSV_FS is not set | ||
891 | # CONFIG_UFS_FS is not set | ||
892 | CONFIG_NETWORK_FILESYSTEMS=y | ||
893 | CONFIG_NFS_FS=m | ||
894 | CONFIG_NFS_V3=y | ||
895 | # CONFIG_NFS_V3_ACL is not set | ||
896 | # CONFIG_NFS_V4 is not set | ||
897 | # CONFIG_NFSD is not set | ||
898 | CONFIG_LOCKD=m | ||
899 | CONFIG_LOCKD_V4=y | ||
900 | CONFIG_NFS_COMMON=y | ||
901 | CONFIG_SUNRPC=m | ||
902 | # CONFIG_RPCSEC_GSS_KRB5 is not set | ||
903 | # CONFIG_CEPH_FS is not set | ||
904 | # CONFIG_CIFS is not set | ||
905 | # CONFIG_NCP_FS is not set | ||
906 | # CONFIG_CODA_FS is not set | ||
907 | # CONFIG_AFS_FS is not set | ||
908 | |||
909 | # | ||
910 | # Partition Types | ||
911 | # | ||
912 | # CONFIG_PARTITION_ADVANCED is not set | ||
913 | CONFIG_MSDOS_PARTITION=y | ||
914 | CONFIG_NLS=y | ||
915 | CONFIG_NLS_DEFAULT="iso8859-1" | ||
916 | CONFIG_NLS_CODEPAGE_437=y | ||
917 | # CONFIG_NLS_CODEPAGE_737 is not set | ||
918 | # CONFIG_NLS_CODEPAGE_775 is not set | ||
919 | # CONFIG_NLS_CODEPAGE_850 is not set | ||
920 | # CONFIG_NLS_CODEPAGE_852 is not set | ||
921 | # CONFIG_NLS_CODEPAGE_855 is not set | ||
922 | # CONFIG_NLS_CODEPAGE_857 is not set | ||
923 | # CONFIG_NLS_CODEPAGE_860 is not set | ||
924 | # CONFIG_NLS_CODEPAGE_861 is not set | ||
925 | # CONFIG_NLS_CODEPAGE_862 is not set | ||
926 | # CONFIG_NLS_CODEPAGE_863 is not set | ||
927 | # CONFIG_NLS_CODEPAGE_864 is not set | ||
928 | # CONFIG_NLS_CODEPAGE_865 is not set | ||
929 | # CONFIG_NLS_CODEPAGE_866 is not set | ||
930 | # CONFIG_NLS_CODEPAGE_869 is not set | ||
931 | # CONFIG_NLS_CODEPAGE_936 is not set | ||
932 | # CONFIG_NLS_CODEPAGE_950 is not set | ||
933 | # CONFIG_NLS_CODEPAGE_932 is not set | ||
934 | # CONFIG_NLS_CODEPAGE_949 is not set | ||
935 | # CONFIG_NLS_CODEPAGE_874 is not set | ||
936 | # CONFIG_NLS_ISO8859_8 is not set | ||
937 | # CONFIG_NLS_CODEPAGE_1250 is not set | ||
938 | # CONFIG_NLS_CODEPAGE_1251 is not set | ||
939 | # CONFIG_NLS_ASCII is not set | ||
940 | CONFIG_NLS_ISO8859_1=y | ||
941 | # CONFIG_NLS_ISO8859_2 is not set | ||
942 | # CONFIG_NLS_ISO8859_3 is not set | ||
943 | # CONFIG_NLS_ISO8859_4 is not set | ||
944 | # CONFIG_NLS_ISO8859_5 is not set | ||
945 | # CONFIG_NLS_ISO8859_6 is not set | ||
946 | # CONFIG_NLS_ISO8859_7 is not set | ||
947 | # CONFIG_NLS_ISO8859_9 is not set | ||
948 | # CONFIG_NLS_ISO8859_13 is not set | ||
949 | # CONFIG_NLS_ISO8859_14 is not set | ||
950 | # CONFIG_NLS_ISO8859_15 is not set | ||
951 | # CONFIG_NLS_KOI8_R is not set | ||
952 | # CONFIG_NLS_KOI8_U is not set | ||
953 | # CONFIG_NLS_UTF8 is not set | ||
954 | |||
955 | # | ||
956 | # Kernel hacking | ||
957 | # | ||
958 | # CONFIG_PRINTK_TIME is not set | ||
959 | CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 | ||
960 | CONFIG_ENABLE_WARN_DEPRECATED=y | ||
961 | CONFIG_ENABLE_MUST_CHECK=y | ||
962 | CONFIG_FRAME_WARN=2048 | ||
963 | CONFIG_MAGIC_SYSRQ=y | ||
964 | # CONFIG_STRIP_ASM_SYMS is not set | ||
965 | # CONFIG_UNUSED_SYMBOLS is not set | ||
966 | # CONFIG_DEBUG_FS is not set | ||
967 | # CONFIG_HEADERS_CHECK is not set | ||
968 | # CONFIG_DEBUG_SECTION_MISMATCH is not set | ||
969 | CONFIG_DEBUG_KERNEL=y | ||
970 | # CONFIG_DEBUG_SHIRQ is not set | ||
971 | # CONFIG_LOCKUP_DETECTOR is not set | ||
972 | # CONFIG_HARDLOCKUP_DETECTOR is not set | ||
973 | CONFIG_DETECT_HUNG_TASK=y | ||
974 | # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set | ||
975 | CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 | ||
976 | CONFIG_SCHED_DEBUG=y | ||
977 | # CONFIG_SCHEDSTATS is not set | ||
978 | # CONFIG_TIMER_STATS is not set | ||
979 | # CONFIG_DEBUG_OBJECTS is not set | ||
980 | # CONFIG_SLUB_DEBUG_ON is not set | ||
981 | # CONFIG_SLUB_STATS is not set | ||
982 | # CONFIG_DEBUG_KMEMLEAK is not set | ||
983 | # CONFIG_DEBUG_RT_MUTEXES is not set | ||
984 | # CONFIG_RT_MUTEX_TESTER is not set | ||
985 | # CONFIG_DEBUG_SPINLOCK is not set | ||
986 | # CONFIG_DEBUG_MUTEXES is not set | ||
987 | # CONFIG_DEBUG_LOCK_ALLOC is not set | ||
988 | # CONFIG_PROVE_LOCKING is not set | ||
989 | # CONFIG_SPARSE_RCU_POINTER is not set | ||
990 | # CONFIG_LOCK_STAT is not set | ||
991 | CONFIG_DEBUG_SPINLOCK_SLEEP=y | ||
992 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | ||
993 | CONFIG_STACKTRACE=y | ||
994 | # CONFIG_DEBUG_KOBJECT is not set | ||
995 | # CONFIG_DEBUG_HIGHMEM is not set | ||
996 | CONFIG_DEBUG_INFO=y | ||
997 | # CONFIG_DEBUG_INFO_REDUCED is not set | ||
998 | CONFIG_DEBUG_VM=y | ||
999 | # CONFIG_DEBUG_WRITECOUNT is not set | ||
1000 | # CONFIG_DEBUG_MEMORY_INIT is not set | ||
1001 | # CONFIG_DEBUG_LIST is not set | ||
1002 | # CONFIG_TEST_LIST_SORT is not set | ||
1003 | # CONFIG_DEBUG_SG is not set | ||
1004 | # CONFIG_DEBUG_NOTIFIERS is not set | ||
1005 | # CONFIG_DEBUG_CREDENTIALS is not set | ||
1006 | # CONFIG_RCU_TORTURE_TEST is not set | ||
1007 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
1008 | # CONFIG_BACKTRACE_SELF_TEST is not set | ||
1009 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set | ||
1010 | # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set | ||
1011 | # CONFIG_FAULT_INJECTION is not set | ||
1012 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set | ||
1013 | # CONFIG_DEBUG_PAGEALLOC is not set | ||
1014 | CONFIG_TRACING_SUPPORT=y | ||
1015 | CONFIG_FTRACE=y | ||
1016 | # CONFIG_IRQSOFF_TRACER is not set | ||
1017 | # CONFIG_SCHED_TRACER is not set | ||
1018 | # CONFIG_ENABLE_DEFAULT_TRACERS is not set | ||
1019 | CONFIG_BRANCH_PROFILE_NONE=y | ||
1020 | # CONFIG_PROFILE_ANNOTATED_BRANCHES is not set | ||
1021 | # CONFIG_PROFILE_ALL_BRANCHES is not set | ||
1022 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
1023 | # CONFIG_ATOMIC64_SELFTEST is not set | ||
1024 | # CONFIG_SAMPLES is not set | ||
1025 | # CONFIG_TEST_KSTRTOX is not set | ||
1026 | CONFIG_EARLY_PRINTK=y | ||
1027 | CONFIG_DEBUG_STACKOVERFLOW=y | ||
1028 | # CONFIG_DEBUG_STACK_USAGE is not set | ||
1029 | CONFIG_DEBUG_EXTRA_FLAGS="-femit-struct-debug-baseonly" | ||
1030 | |||
1031 | # | ||
1032 | # Security options | ||
1033 | # | ||
1034 | # CONFIG_KEYS is not set | ||
1035 | # CONFIG_SECURITY_DMESG_RESTRICT is not set | ||
1036 | # CONFIG_SECURITY is not set | ||
1037 | # CONFIG_SECURITYFS is not set | ||
1038 | CONFIG_DEFAULT_SECURITY_DAC=y | ||
1039 | CONFIG_DEFAULT_SECURITY="" | ||
1040 | CONFIG_CRYPTO=y | ||
1041 | |||
1042 | # | ||
1043 | # Crypto core or helper | ||
1044 | # | ||
1045 | # CONFIG_CRYPTO_FIPS is not set | ||
1046 | CONFIG_CRYPTO_ALGAPI=m | ||
1047 | CONFIG_CRYPTO_ALGAPI2=m | ||
1048 | CONFIG_CRYPTO_RNG=m | ||
1049 | CONFIG_CRYPTO_RNG2=m | ||
1050 | # CONFIG_CRYPTO_MANAGER is not set | ||
1051 | # CONFIG_CRYPTO_MANAGER2 is not set | ||
1052 | # CONFIG_CRYPTO_GF128MUL is not set | ||
1053 | # CONFIG_CRYPTO_NULL is not set | ||
1054 | # CONFIG_CRYPTO_PCRYPT is not set | ||
1055 | # CONFIG_CRYPTO_CRYPTD is not set | ||
1056 | # CONFIG_CRYPTO_AUTHENC is not set | ||
1057 | # CONFIG_CRYPTO_TEST is not set | ||
1058 | |||
1059 | # | ||
1060 | # Authenticated Encryption with Associated Data | ||
1061 | # | ||
1062 | # CONFIG_CRYPTO_CCM is not set | ||
1063 | # CONFIG_CRYPTO_GCM is not set | ||
1064 | # CONFIG_CRYPTO_SEQIV is not set | ||
1065 | |||
1066 | # | ||
1067 | # Block modes | ||
1068 | # | ||
1069 | # CONFIG_CRYPTO_CBC is not set | ||
1070 | # CONFIG_CRYPTO_CTR is not set | ||
1071 | # CONFIG_CRYPTO_CTS is not set | ||
1072 | # CONFIG_CRYPTO_ECB is not set | ||
1073 | # CONFIG_CRYPTO_LRW is not set | ||
1074 | # CONFIG_CRYPTO_PCBC is not set | ||
1075 | # CONFIG_CRYPTO_XTS is not set | ||
1076 | |||
1077 | # | ||
1078 | # Hash modes | ||
1079 | # | ||
1080 | # CONFIG_CRYPTO_HMAC is not set | ||
1081 | # CONFIG_CRYPTO_XCBC is not set | ||
1082 | # CONFIG_CRYPTO_VMAC is not set | ||
1083 | |||
1084 | # | ||
1085 | # Digest | ||
1086 | # | ||
1087 | # CONFIG_CRYPTO_CRC32C is not set | ||
1088 | # CONFIG_CRYPTO_GHASH is not set | ||
1089 | # CONFIG_CRYPTO_MD4 is not set | ||
1090 | # CONFIG_CRYPTO_MD5 is not set | ||
1091 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | ||
1092 | # CONFIG_CRYPTO_RMD128 is not set | ||
1093 | # CONFIG_CRYPTO_RMD160 is not set | ||
1094 | # CONFIG_CRYPTO_RMD256 is not set | ||
1095 | # CONFIG_CRYPTO_RMD320 is not set | ||
1096 | # CONFIG_CRYPTO_SHA1 is not set | ||
1097 | # CONFIG_CRYPTO_SHA256 is not set | ||
1098 | # CONFIG_CRYPTO_SHA512 is not set | ||
1099 | # CONFIG_CRYPTO_TGR192 is not set | ||
1100 | # CONFIG_CRYPTO_WP512 is not set | ||
1101 | |||
1102 | # | ||
1103 | # Ciphers | ||
1104 | # | ||
1105 | CONFIG_CRYPTO_AES=m | ||
1106 | # CONFIG_CRYPTO_ANUBIS is not set | ||
1107 | # CONFIG_CRYPTO_ARC4 is not set | ||
1108 | # CONFIG_CRYPTO_BLOWFISH is not set | ||
1109 | # CONFIG_CRYPTO_CAMELLIA is not set | ||
1110 | # CONFIG_CRYPTO_CAST5 is not set | ||
1111 | # CONFIG_CRYPTO_CAST6 is not set | ||
1112 | # CONFIG_CRYPTO_DES is not set | ||
1113 | # CONFIG_CRYPTO_FCRYPT is not set | ||
1114 | # CONFIG_CRYPTO_KHAZAD is not set | ||
1115 | # CONFIG_CRYPTO_SALSA20 is not set | ||
1116 | # CONFIG_CRYPTO_SEED is not set | ||
1117 | # CONFIG_CRYPTO_SERPENT is not set | ||
1118 | # CONFIG_CRYPTO_TEA is not set | ||
1119 | # CONFIG_CRYPTO_TWOFISH is not set | ||
1120 | |||
1121 | # | ||
1122 | # Compression | ||
1123 | # | ||
1124 | # CONFIG_CRYPTO_DEFLATE is not set | ||
1125 | # CONFIG_CRYPTO_ZLIB is not set | ||
1126 | # CONFIG_CRYPTO_LZO is not set | ||
1127 | |||
1128 | # | ||
1129 | # Random Number Generation | ||
1130 | # | ||
1131 | CONFIG_CRYPTO_ANSI_CPRNG=m | ||
1132 | # CONFIG_CRYPTO_USER_API_HASH is not set | ||
1133 | # CONFIG_CRYPTO_USER_API_SKCIPHER is not set | ||
1134 | CONFIG_CRYPTO_HW=y | ||
1135 | # CONFIG_CRYPTO_DEV_HIFN_795X is not set | ||
1136 | # CONFIG_BINARY_PRINTF is not set | ||
1137 | |||
1138 | # | ||
1139 | # Library routines | ||
1140 | # | ||
1141 | CONFIG_BITREVERSE=y | ||
1142 | CONFIG_GENERIC_FIND_FIRST_BIT=y | ||
1143 | CONFIG_GENERIC_FIND_NEXT_BIT=y | ||
1144 | CONFIG_GENERIC_FIND_LAST_BIT=y | ||
1145 | # CONFIG_CRC_CCITT is not set | ||
1146 | # CONFIG_CRC16 is not set | ||
1147 | # CONFIG_CRC_T10DIF is not set | ||
1148 | # CONFIG_CRC_ITU_T is not set | ||
1149 | CONFIG_CRC32=y | ||
1150 | # CONFIG_CRC7 is not set | ||
1151 | # CONFIG_LIBCRC32C is not set | ||
1152 | CONFIG_ZLIB_INFLATE=y | ||
1153 | # CONFIG_XZ_DEC is not set | ||
1154 | # CONFIG_XZ_DEC_BCJ is not set | ||
1155 | CONFIG_DECOMPRESS_GZIP=y | ||
1156 | CONFIG_HAS_IOMEM=y | ||
1157 | CONFIG_HAS_IOPORT=y | ||
1158 | CONFIG_HAS_DMA=y | ||
1159 | CONFIG_CPU_RMAP=y | ||
1160 | CONFIG_NLATTR=y | ||
1161 | # CONFIG_AVERAGE is not set | ||
1162 | CONFIG_HAVE_KVM=y | ||
1163 | # CONFIG_VIRTUALIZATION is not set | ||
diff --git a/arch/tile/include/arch/chip_tilegx.h b/arch/tile/include/arch/chip_tilegx.h new file mode 100644 index 000000000000..ea8e4f2c9483 --- /dev/null +++ b/arch/tile/include/arch/chip_tilegx.h | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | /* | ||
16 | * @file | ||
17 | * Global header file. | ||
18 | * This header file specifies defines for TILE-Gx. | ||
19 | */ | ||
20 | |||
21 | #ifndef __ARCH_CHIP_H__ | ||
22 | #define __ARCH_CHIP_H__ | ||
23 | |||
24 | /** Specify chip version. | ||
25 | * When possible, prefer the CHIP_xxx symbols below for future-proofing. | ||
26 | * This is intended for cross-compiling; native compilation should | ||
27 | * use the predefined __tile_chip__ symbol. | ||
28 | */ | ||
29 | #define TILE_CHIP 10 | ||
30 | |||
31 | /** Specify chip revision. | ||
32 | * This provides for the case of a respin of a particular chip type; | ||
33 | * the normal value for this symbol is "0". | ||
34 | * This is intended for cross-compiling; native compilation should | ||
35 | * use the predefined __tile_chip_rev__ symbol. | ||
36 | */ | ||
37 | #define TILE_CHIP_REV 0 | ||
38 | |||
39 | /** The name of this architecture. */ | ||
40 | #define CHIP_ARCH_NAME "tilegx" | ||
41 | |||
42 | /** The ELF e_machine type for binaries for this chip. */ | ||
43 | #define CHIP_ELF_TYPE() EM_TILEGX | ||
44 | |||
45 | /** The alternate ELF e_machine type for binaries for this chip. */ | ||
46 | #define CHIP_COMPAT_ELF_TYPE() 0x2597 | ||
47 | |||
48 | /** What is the native word size of the machine? */ | ||
49 | #define CHIP_WORD_SIZE() 64 | ||
50 | |||
51 | /** How many bits of a virtual address are used. Extra bits must be | ||
52 | * the sign extension of the low bits. | ||
53 | */ | ||
54 | #define CHIP_VA_WIDTH() 42 | ||
55 | |||
56 | /** How many bits are in a physical address? */ | ||
57 | #define CHIP_PA_WIDTH() 40 | ||
58 | |||
59 | /** Size of the L2 cache, in bytes. */ | ||
60 | #define CHIP_L2_CACHE_SIZE() 262144 | ||
61 | |||
62 | /** Log size of an L2 cache line in bytes. */ | ||
63 | #define CHIP_L2_LOG_LINE_SIZE() 6 | ||
64 | |||
65 | /** Size of an L2 cache line, in bytes. */ | ||
66 | #define CHIP_L2_LINE_SIZE() (1 << CHIP_L2_LOG_LINE_SIZE()) | ||
67 | |||
68 | /** Associativity of the L2 cache. */ | ||
69 | #define CHIP_L2_ASSOC() 8 | ||
70 | |||
71 | /** Size of the L1 data cache, in bytes. */ | ||
72 | #define CHIP_L1D_CACHE_SIZE() 32768 | ||
73 | |||
74 | /** Log size of an L1 data cache line in bytes. */ | ||
75 | #define CHIP_L1D_LOG_LINE_SIZE() 6 | ||
76 | |||
77 | /** Size of an L1 data cache line, in bytes. */ | ||
78 | #define CHIP_L1D_LINE_SIZE() (1 << CHIP_L1D_LOG_LINE_SIZE()) | ||
79 | |||
80 | /** Associativity of the L1 data cache. */ | ||
81 | #define CHIP_L1D_ASSOC() 2 | ||
82 | |||
83 | /** Size of the L1 instruction cache, in bytes. */ | ||
84 | #define CHIP_L1I_CACHE_SIZE() 32768 | ||
85 | |||
86 | /** Log size of an L1 instruction cache line in bytes. */ | ||
87 | #define CHIP_L1I_LOG_LINE_SIZE() 6 | ||
88 | |||
89 | /** Size of an L1 instruction cache line, in bytes. */ | ||
90 | #define CHIP_L1I_LINE_SIZE() (1 << CHIP_L1I_LOG_LINE_SIZE()) | ||
91 | |||
92 | /** Associativity of the L1 instruction cache. */ | ||
93 | #define CHIP_L1I_ASSOC() 2 | ||
94 | |||
95 | /** Stride with which flush instructions must be issued. */ | ||
96 | #define CHIP_FLUSH_STRIDE() CHIP_L2_LINE_SIZE() | ||
97 | |||
98 | /** Stride with which inv instructions must be issued. */ | ||
99 | #define CHIP_INV_STRIDE() CHIP_L2_LINE_SIZE() | ||
100 | |||
101 | /** Stride with which finv instructions must be issued. */ | ||
102 | #define CHIP_FINV_STRIDE() CHIP_L2_LINE_SIZE() | ||
103 | |||
104 | /** Can the local cache coherently cache data that is homed elsewhere? */ | ||
105 | #define CHIP_HAS_COHERENT_LOCAL_CACHE() 1 | ||
106 | |||
107 | /** How many simultaneous outstanding victims can the L2 cache have? */ | ||
108 | #define CHIP_MAX_OUTSTANDING_VICTIMS() 128 | ||
109 | |||
110 | /** Does the TLB support the NC and NOALLOC bits? */ | ||
111 | #define CHIP_HAS_NC_AND_NOALLOC_BITS() 1 | ||
112 | |||
113 | /** Does the chip support hash-for-home caching? */ | ||
114 | #define CHIP_HAS_CBOX_HOME_MAP() 1 | ||
115 | |||
116 | /** Number of entries in the chip's home map tables. */ | ||
117 | #define CHIP_CBOX_HOME_MAP_SIZE() 128 | ||
118 | |||
119 | /** Do uncacheable requests miss in the cache regardless of whether | ||
120 | * there is matching data? */ | ||
121 | #define CHIP_HAS_ENFORCED_UNCACHEABLE_REQUESTS() 1 | ||
122 | |||
123 | /** Does the mf instruction wait for victims? */ | ||
124 | #define CHIP_HAS_MF_WAITS_FOR_VICTIMS() 0 | ||
125 | |||
126 | /** Does the chip have an "inv" instruction that doesn't also flush? */ | ||
127 | #define CHIP_HAS_INV() 1 | ||
128 | |||
129 | /** Does the chip have a "wh64" instruction? */ | ||
130 | #define CHIP_HAS_WH64() 1 | ||
131 | |||
132 | /** Does this chip have a 'dword_align' instruction? */ | ||
133 | #define CHIP_HAS_DWORD_ALIGN() 0 | ||
134 | |||
135 | /** Number of performance counters. */ | ||
136 | #define CHIP_PERFORMANCE_COUNTERS() 4 | ||
137 | |||
138 | /** Does this chip have auxiliary performance counters? */ | ||
139 | #define CHIP_HAS_AUX_PERF_COUNTERS() 1 | ||
140 | |||
141 | /** Is the CBOX_MSR1 SPR supported? */ | ||
142 | #define CHIP_HAS_CBOX_MSR1() 0 | ||
143 | |||
144 | /** Is the TILE_RTF_HWM SPR supported? */ | ||
145 | #define CHIP_HAS_TILE_RTF_HWM() 1 | ||
146 | |||
147 | /** Is the TILE_WRITE_PENDING SPR supported? */ | ||
148 | #define CHIP_HAS_TILE_WRITE_PENDING() 0 | ||
149 | |||
150 | /** Is the PROC_STATUS SPR supported? */ | ||
151 | #define CHIP_HAS_PROC_STATUS_SPR() 1 | ||
152 | |||
153 | /** Is the DSTREAM_PF SPR supported? */ | ||
154 | #define CHIP_HAS_DSTREAM_PF() 1 | ||
155 | |||
156 | /** Log of the number of mshims we have. */ | ||
157 | #define CHIP_LOG_NUM_MSHIMS() 2 | ||
158 | |||
159 | /** Are the bases of the interrupt vector areas fixed? */ | ||
160 | #define CHIP_HAS_FIXED_INTVEC_BASE() 0 | ||
161 | |||
162 | /** Are the interrupt masks split up into 2 SPRs? */ | ||
163 | #define CHIP_HAS_SPLIT_INTR_MASK() 0 | ||
164 | |||
165 | /** Is the cycle count split up into 2 SPRs? */ | ||
166 | #define CHIP_HAS_SPLIT_CYCLE() 0 | ||
167 | |||
168 | /** Does the chip have a static network? */ | ||
169 | #define CHIP_HAS_SN() 0 | ||
170 | |||
171 | /** Does the chip have a static network processor? */ | ||
172 | #define CHIP_HAS_SN_PROC() 0 | ||
173 | |||
174 | /** Size of the L1 static network processor instruction cache, in bytes. */ | ||
175 | /* #define CHIP_L1SNI_CACHE_SIZE() -- does not apply to chip 10 */ | ||
176 | |||
177 | /** Does the chip have DMA support in each tile? */ | ||
178 | #define CHIP_HAS_TILE_DMA() 0 | ||
179 | |||
180 | /** Does the chip have the second revision of the directly accessible | ||
181 | * dynamic networks? This encapsulates a number of characteristics, | ||
182 | * including the absence of the catch-all, the absence of inline message | ||
183 | * tags, the absence of support for network context-switching, and so on. | ||
184 | */ | ||
185 | #define CHIP_HAS_REV1_XDN() 1 | ||
186 | |||
187 | /** Does the chip have cmpexch and similar (fetchadd, exch, etc.)? */ | ||
188 | #define CHIP_HAS_CMPEXCH() 1 | ||
189 | |||
190 | /** Does the chip have memory-mapped I/O support? */ | ||
191 | #define CHIP_HAS_MMIO() 1 | ||
192 | |||
193 | /** Does the chip have post-completion interrupts? */ | ||
194 | #define CHIP_HAS_POST_COMPLETION_INTERRUPTS() 1 | ||
195 | |||
196 | /** Does the chip have native single step support? */ | ||
197 | #define CHIP_HAS_SINGLE_STEP() 1 | ||
198 | |||
199 | #ifndef __OPEN_SOURCE__ /* features only relevant to hypervisor-level code */ | ||
200 | |||
201 | /** How many entries are present in the instruction TLB? */ | ||
202 | #define CHIP_ITLB_ENTRIES() 16 | ||
203 | |||
204 | /** How many entries are present in the data TLB? */ | ||
205 | #define CHIP_DTLB_ENTRIES() 32 | ||
206 | |||
207 | /** How many MAF entries does the XAUI shim have? */ | ||
208 | #define CHIP_XAUI_MAF_ENTRIES() 32 | ||
209 | |||
210 | /** Does the memory shim have a source-id table? */ | ||
211 | #define CHIP_HAS_MSHIM_SRCID_TABLE() 0 | ||
212 | |||
213 | /** Does the L1 instruction cache clear on reset? */ | ||
214 | #define CHIP_HAS_L1I_CLEAR_ON_RESET() 1 | ||
215 | |||
216 | /** Does the chip come out of reset with valid coordinates on all tiles? | ||
217 | * Note that if defined, this also implies that the upper left is 1,1. | ||
218 | */ | ||
219 | #define CHIP_HAS_VALID_TILE_COORD_RESET() 1 | ||
220 | |||
221 | /** Does the chip have unified packet formats? */ | ||
222 | #define CHIP_HAS_UNIFIED_PACKET_FORMATS() 1 | ||
223 | |||
224 | /** Does the chip support write reordering? */ | ||
225 | #define CHIP_HAS_WRITE_REORDERING() 1 | ||
226 | |||
227 | /** Does the chip support Y-X routing as well as X-Y? */ | ||
228 | #define CHIP_HAS_Y_X_ROUTING() 1 | ||
229 | |||
230 | /** Is INTCTRL_3 managed with the correct MPL? */ | ||
231 | #define CHIP_HAS_INTCTRL_3_STATUS_FIX() 1 | ||
232 | |||
233 | /** Is it possible to configure the chip to be big-endian? */ | ||
234 | #define CHIP_HAS_BIG_ENDIAN_CONFIG() 1 | ||
235 | |||
236 | /** Is the CACHE_RED_WAY_OVERRIDDEN SPR supported? */ | ||
237 | #define CHIP_HAS_CACHE_RED_WAY_OVERRIDDEN() 0 | ||
238 | |||
239 | /** Is the DIAG_TRACE_WAY SPR supported? */ | ||
240 | #define CHIP_HAS_DIAG_TRACE_WAY() 0 | ||
241 | |||
242 | /** Is the MEM_STRIPE_CONFIG SPR supported? */ | ||
243 | #define CHIP_HAS_MEM_STRIPE_CONFIG() 1 | ||
244 | |||
245 | /** Are the TLB_PERF SPRs supported? */ | ||
246 | #define CHIP_HAS_TLB_PERF() 1 | ||
247 | |||
248 | /** Is the VDN_SNOOP_SHIM_CTL SPR supported? */ | ||
249 | #define CHIP_HAS_VDN_SNOOP_SHIM_CTL() 0 | ||
250 | |||
251 | /** Does the chip support rev1 DMA packets? */ | ||
252 | #define CHIP_HAS_REV1_DMA_PACKETS() 1 | ||
253 | |||
254 | /** Does the chip have an IPI shim? */ | ||
255 | #define CHIP_HAS_IPI() 1 | ||
256 | |||
257 | #endif /* !__OPEN_SOURCE__ */ | ||
258 | #endif /* __ARCH_CHIP_H__ */ | ||
diff --git a/arch/tile/include/arch/icache.h b/arch/tile/include/arch/icache.h index 5c87c9016338..762eafa8a11e 100644 --- a/arch/tile/include/arch/icache.h +++ b/arch/tile/include/arch/icache.h | |||
@@ -16,7 +16,7 @@ | |||
16 | /** | 16 | /** |
17 | * @file | 17 | * @file |
18 | * | 18 | * |
19 | * Support for invalidating bytes in the instruction | 19 | * Support for invalidating bytes in the instruction cache. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef __ARCH_ICACHE_H__ | 22 | #ifndef __ARCH_ICACHE_H__ |
@@ -30,11 +30,10 @@ | |||
30 | * | 30 | * |
31 | * @param addr The start of memory to be invalidated. | 31 | * @param addr The start of memory to be invalidated. |
32 | * @param size The number of bytes to be invalidated. | 32 | * @param size The number of bytes to be invalidated. |
33 | * @param page_size The system's page size, typically the PAGE_SIZE constant | 33 | * @param page_size The system's page size, e.g. getpagesize() in userspace. |
34 | * in sys/page.h. This value must be a power of two no larger | 34 | * This value must be a power of two no larger than the page containing |
35 | * than the page containing the code to be invalidated. If the value | 35 | * the code to be invalidated. If the value is smaller than the actual page |
36 | * is smaller than the actual page size, this function will still | 36 | * size, this function will still work, but may run slower than necessary. |
37 | * work, but may run slower than necessary. | ||
38 | */ | 37 | */ |
39 | static __inline void | 38 | static __inline void |
40 | invalidate_icache(const void* addr, unsigned long size, | 39 | invalidate_icache(const void* addr, unsigned long size, |
diff --git a/arch/tile/include/arch/interrupts_64.h b/arch/tile/include/arch/interrupts_64.h new file mode 100644 index 000000000000..5bb58b2e4e6f --- /dev/null +++ b/arch/tile/include/arch/interrupts_64.h | |||
@@ -0,0 +1,276 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef __ARCH_INTERRUPTS_H__ | ||
16 | #define __ARCH_INTERRUPTS_H__ | ||
17 | |||
18 | /** Mask for an interrupt. */ | ||
19 | #ifdef __ASSEMBLER__ | ||
20 | /* Note: must handle breaking interrupts into high and low words manually. */ | ||
21 | #define INT_MASK(intno) (1 << (intno)) | ||
22 | #else | ||
23 | #define INT_MASK(intno) (1ULL << (intno)) | ||
24 | #endif | ||
25 | |||
26 | |||
27 | /** Where a given interrupt executes */ | ||
28 | #define INTERRUPT_VECTOR(i, pl) (0xFC000000 + ((pl) << 24) + ((i) << 8)) | ||
29 | |||
30 | /** Where to store a vector for a given interrupt. */ | ||
31 | #define USER_INTERRUPT_VECTOR(i) INTERRUPT_VECTOR(i, 0) | ||
32 | |||
33 | /** The base address of user-level interrupts. */ | ||
34 | #define USER_INTERRUPT_VECTOR_BASE INTERRUPT_VECTOR(0, 0) | ||
35 | |||
36 | |||
37 | /** Additional synthetic interrupt. */ | ||
38 | #define INT_BREAKPOINT (63) | ||
39 | |||
40 | #define INT_MEM_ERROR 0 | ||
41 | #define INT_SINGLE_STEP_3 1 | ||
42 | #define INT_SINGLE_STEP_2 2 | ||
43 | #define INT_SINGLE_STEP_1 3 | ||
44 | #define INT_SINGLE_STEP_0 4 | ||
45 | #define INT_IDN_COMPLETE 5 | ||
46 | #define INT_UDN_COMPLETE 6 | ||
47 | #define INT_ITLB_MISS 7 | ||
48 | #define INT_ILL 8 | ||
49 | #define INT_GPV 9 | ||
50 | #define INT_IDN_ACCESS 10 | ||
51 | #define INT_UDN_ACCESS 11 | ||
52 | #define INT_SWINT_3 12 | ||
53 | #define INT_SWINT_2 13 | ||
54 | #define INT_SWINT_1 14 | ||
55 | #define INT_SWINT_0 15 | ||
56 | #define INT_ILL_TRANS 16 | ||
57 | #define INT_UNALIGN_DATA 17 | ||
58 | #define INT_DTLB_MISS 18 | ||
59 | #define INT_DTLB_ACCESS 19 | ||
60 | #define INT_IDN_FIREWALL 20 | ||
61 | #define INT_UDN_FIREWALL 21 | ||
62 | #define INT_TILE_TIMER 22 | ||
63 | #define INT_AUX_TILE_TIMER 23 | ||
64 | #define INT_IDN_TIMER 24 | ||
65 | #define INT_UDN_TIMER 25 | ||
66 | #define INT_IDN_AVAIL 26 | ||
67 | #define INT_UDN_AVAIL 27 | ||
68 | #define INT_IPI_3 28 | ||
69 | #define INT_IPI_2 29 | ||
70 | #define INT_IPI_1 30 | ||
71 | #define INT_IPI_0 31 | ||
72 | #define INT_PERF_COUNT 32 | ||
73 | #define INT_AUX_PERF_COUNT 33 | ||
74 | #define INT_INTCTRL_3 34 | ||
75 | #define INT_INTCTRL_2 35 | ||
76 | #define INT_INTCTRL_1 36 | ||
77 | #define INT_INTCTRL_0 37 | ||
78 | #define INT_BOOT_ACCESS 38 | ||
79 | #define INT_WORLD_ACCESS 39 | ||
80 | #define INT_I_ASID 40 | ||
81 | #define INT_D_ASID 41 | ||
82 | #define INT_DOUBLE_FAULT 42 | ||
83 | |||
84 | #define NUM_INTERRUPTS 43 | ||
85 | |||
86 | #ifndef __ASSEMBLER__ | ||
87 | #define QUEUED_INTERRUPTS ( \ | ||
88 | INT_MASK(INT_MEM_ERROR) | \ | ||
89 | INT_MASK(INT_IDN_COMPLETE) | \ | ||
90 | INT_MASK(INT_UDN_COMPLETE) | \ | ||
91 | INT_MASK(INT_IDN_FIREWALL) | \ | ||
92 | INT_MASK(INT_UDN_FIREWALL) | \ | ||
93 | INT_MASK(INT_TILE_TIMER) | \ | ||
94 | INT_MASK(INT_AUX_TILE_TIMER) | \ | ||
95 | INT_MASK(INT_IDN_TIMER) | \ | ||
96 | INT_MASK(INT_UDN_TIMER) | \ | ||
97 | INT_MASK(INT_IDN_AVAIL) | \ | ||
98 | INT_MASK(INT_UDN_AVAIL) | \ | ||
99 | INT_MASK(INT_IPI_3) | \ | ||
100 | INT_MASK(INT_IPI_2) | \ | ||
101 | INT_MASK(INT_IPI_1) | \ | ||
102 | INT_MASK(INT_IPI_0) | \ | ||
103 | INT_MASK(INT_PERF_COUNT) | \ | ||
104 | INT_MASK(INT_AUX_PERF_COUNT) | \ | ||
105 | INT_MASK(INT_INTCTRL_3) | \ | ||
106 | INT_MASK(INT_INTCTRL_2) | \ | ||
107 | INT_MASK(INT_INTCTRL_1) | \ | ||
108 | INT_MASK(INT_INTCTRL_0) | \ | ||
109 | INT_MASK(INT_BOOT_ACCESS) | \ | ||
110 | INT_MASK(INT_WORLD_ACCESS) | \ | ||
111 | INT_MASK(INT_I_ASID) | \ | ||
112 | INT_MASK(INT_D_ASID) | \ | ||
113 | INT_MASK(INT_DOUBLE_FAULT) | \ | ||
114 | 0) | ||
115 | #define NONQUEUED_INTERRUPTS ( \ | ||
116 | INT_MASK(INT_SINGLE_STEP_3) | \ | ||
117 | INT_MASK(INT_SINGLE_STEP_2) | \ | ||
118 | INT_MASK(INT_SINGLE_STEP_1) | \ | ||
119 | INT_MASK(INT_SINGLE_STEP_0) | \ | ||
120 | INT_MASK(INT_ITLB_MISS) | \ | ||
121 | INT_MASK(INT_ILL) | \ | ||
122 | INT_MASK(INT_GPV) | \ | ||
123 | INT_MASK(INT_IDN_ACCESS) | \ | ||
124 | INT_MASK(INT_UDN_ACCESS) | \ | ||
125 | INT_MASK(INT_SWINT_3) | \ | ||
126 | INT_MASK(INT_SWINT_2) | \ | ||
127 | INT_MASK(INT_SWINT_1) | \ | ||
128 | INT_MASK(INT_SWINT_0) | \ | ||
129 | INT_MASK(INT_ILL_TRANS) | \ | ||
130 | INT_MASK(INT_UNALIGN_DATA) | \ | ||
131 | INT_MASK(INT_DTLB_MISS) | \ | ||
132 | INT_MASK(INT_DTLB_ACCESS) | \ | ||
133 | 0) | ||
134 | #define CRITICAL_MASKED_INTERRUPTS ( \ | ||
135 | INT_MASK(INT_MEM_ERROR) | \ | ||
136 | INT_MASK(INT_SINGLE_STEP_3) | \ | ||
137 | INT_MASK(INT_SINGLE_STEP_2) | \ | ||
138 | INT_MASK(INT_SINGLE_STEP_1) | \ | ||
139 | INT_MASK(INT_SINGLE_STEP_0) | \ | ||
140 | INT_MASK(INT_IDN_COMPLETE) | \ | ||
141 | INT_MASK(INT_UDN_COMPLETE) | \ | ||
142 | INT_MASK(INT_IDN_FIREWALL) | \ | ||
143 | INT_MASK(INT_UDN_FIREWALL) | \ | ||
144 | INT_MASK(INT_TILE_TIMER) | \ | ||
145 | INT_MASK(INT_AUX_TILE_TIMER) | \ | ||
146 | INT_MASK(INT_IDN_TIMER) | \ | ||
147 | INT_MASK(INT_UDN_TIMER) | \ | ||
148 | INT_MASK(INT_IDN_AVAIL) | \ | ||
149 | INT_MASK(INT_UDN_AVAIL) | \ | ||
150 | INT_MASK(INT_IPI_3) | \ | ||
151 | INT_MASK(INT_IPI_2) | \ | ||
152 | INT_MASK(INT_IPI_1) | \ | ||
153 | INT_MASK(INT_IPI_0) | \ | ||
154 | INT_MASK(INT_PERF_COUNT) | \ | ||
155 | INT_MASK(INT_AUX_PERF_COUNT) | \ | ||
156 | INT_MASK(INT_INTCTRL_3) | \ | ||
157 | INT_MASK(INT_INTCTRL_2) | \ | ||
158 | INT_MASK(INT_INTCTRL_1) | \ | ||
159 | INT_MASK(INT_INTCTRL_0) | \ | ||
160 | 0) | ||
161 | #define CRITICAL_UNMASKED_INTERRUPTS ( \ | ||
162 | INT_MASK(INT_ITLB_MISS) | \ | ||
163 | INT_MASK(INT_ILL) | \ | ||
164 | INT_MASK(INT_GPV) | \ | ||
165 | INT_MASK(INT_IDN_ACCESS) | \ | ||
166 | INT_MASK(INT_UDN_ACCESS) | \ | ||
167 | INT_MASK(INT_SWINT_3) | \ | ||
168 | INT_MASK(INT_SWINT_2) | \ | ||
169 | INT_MASK(INT_SWINT_1) | \ | ||
170 | INT_MASK(INT_SWINT_0) | \ | ||
171 | INT_MASK(INT_ILL_TRANS) | \ | ||
172 | INT_MASK(INT_UNALIGN_DATA) | \ | ||
173 | INT_MASK(INT_DTLB_MISS) | \ | ||
174 | INT_MASK(INT_DTLB_ACCESS) | \ | ||
175 | INT_MASK(INT_BOOT_ACCESS) | \ | ||
176 | INT_MASK(INT_WORLD_ACCESS) | \ | ||
177 | INT_MASK(INT_I_ASID) | \ | ||
178 | INT_MASK(INT_D_ASID) | \ | ||
179 | INT_MASK(INT_DOUBLE_FAULT) | \ | ||
180 | 0) | ||
181 | #define MASKABLE_INTERRUPTS ( \ | ||
182 | INT_MASK(INT_MEM_ERROR) | \ | ||
183 | INT_MASK(INT_SINGLE_STEP_3) | \ | ||
184 | INT_MASK(INT_SINGLE_STEP_2) | \ | ||
185 | INT_MASK(INT_SINGLE_STEP_1) | \ | ||
186 | INT_MASK(INT_SINGLE_STEP_0) | \ | ||
187 | INT_MASK(INT_IDN_COMPLETE) | \ | ||
188 | INT_MASK(INT_UDN_COMPLETE) | \ | ||
189 | INT_MASK(INT_IDN_FIREWALL) | \ | ||
190 | INT_MASK(INT_UDN_FIREWALL) | \ | ||
191 | INT_MASK(INT_TILE_TIMER) | \ | ||
192 | INT_MASK(INT_AUX_TILE_TIMER) | \ | ||
193 | INT_MASK(INT_IDN_TIMER) | \ | ||
194 | INT_MASK(INT_UDN_TIMER) | \ | ||
195 | INT_MASK(INT_IDN_AVAIL) | \ | ||
196 | INT_MASK(INT_UDN_AVAIL) | \ | ||
197 | INT_MASK(INT_IPI_3) | \ | ||
198 | INT_MASK(INT_IPI_2) | \ | ||
199 | INT_MASK(INT_IPI_1) | \ | ||
200 | INT_MASK(INT_IPI_0) | \ | ||
201 | INT_MASK(INT_PERF_COUNT) | \ | ||
202 | INT_MASK(INT_AUX_PERF_COUNT) | \ | ||
203 | INT_MASK(INT_INTCTRL_3) | \ | ||
204 | INT_MASK(INT_INTCTRL_2) | \ | ||
205 | INT_MASK(INT_INTCTRL_1) | \ | ||
206 | INT_MASK(INT_INTCTRL_0) | \ | ||
207 | 0) | ||
208 | #define UNMASKABLE_INTERRUPTS ( \ | ||
209 | INT_MASK(INT_ITLB_MISS) | \ | ||
210 | INT_MASK(INT_ILL) | \ | ||
211 | INT_MASK(INT_GPV) | \ | ||
212 | INT_MASK(INT_IDN_ACCESS) | \ | ||
213 | INT_MASK(INT_UDN_ACCESS) | \ | ||
214 | INT_MASK(INT_SWINT_3) | \ | ||
215 | INT_MASK(INT_SWINT_2) | \ | ||
216 | INT_MASK(INT_SWINT_1) | \ | ||
217 | INT_MASK(INT_SWINT_0) | \ | ||
218 | INT_MASK(INT_ILL_TRANS) | \ | ||
219 | INT_MASK(INT_UNALIGN_DATA) | \ | ||
220 | INT_MASK(INT_DTLB_MISS) | \ | ||
221 | INT_MASK(INT_DTLB_ACCESS) | \ | ||
222 | INT_MASK(INT_BOOT_ACCESS) | \ | ||
223 | INT_MASK(INT_WORLD_ACCESS) | \ | ||
224 | INT_MASK(INT_I_ASID) | \ | ||
225 | INT_MASK(INT_D_ASID) | \ | ||
226 | INT_MASK(INT_DOUBLE_FAULT) | \ | ||
227 | 0) | ||
228 | #define SYNC_INTERRUPTS ( \ | ||
229 | INT_MASK(INT_SINGLE_STEP_3) | \ | ||
230 | INT_MASK(INT_SINGLE_STEP_2) | \ | ||
231 | INT_MASK(INT_SINGLE_STEP_1) | \ | ||
232 | INT_MASK(INT_SINGLE_STEP_0) | \ | ||
233 | INT_MASK(INT_IDN_COMPLETE) | \ | ||
234 | INT_MASK(INT_UDN_COMPLETE) | \ | ||
235 | INT_MASK(INT_ITLB_MISS) | \ | ||
236 | INT_MASK(INT_ILL) | \ | ||
237 | INT_MASK(INT_GPV) | \ | ||
238 | INT_MASK(INT_IDN_ACCESS) | \ | ||
239 | INT_MASK(INT_UDN_ACCESS) | \ | ||
240 | INT_MASK(INT_SWINT_3) | \ | ||
241 | INT_MASK(INT_SWINT_2) | \ | ||
242 | INT_MASK(INT_SWINT_1) | \ | ||
243 | INT_MASK(INT_SWINT_0) | \ | ||
244 | INT_MASK(INT_ILL_TRANS) | \ | ||
245 | INT_MASK(INT_UNALIGN_DATA) | \ | ||
246 | INT_MASK(INT_DTLB_MISS) | \ | ||
247 | INT_MASK(INT_DTLB_ACCESS) | \ | ||
248 | 0) | ||
249 | #define NON_SYNC_INTERRUPTS ( \ | ||
250 | INT_MASK(INT_MEM_ERROR) | \ | ||
251 | INT_MASK(INT_IDN_FIREWALL) | \ | ||
252 | INT_MASK(INT_UDN_FIREWALL) | \ | ||
253 | INT_MASK(INT_TILE_TIMER) | \ | ||
254 | INT_MASK(INT_AUX_TILE_TIMER) | \ | ||
255 | INT_MASK(INT_IDN_TIMER) | \ | ||
256 | INT_MASK(INT_UDN_TIMER) | \ | ||
257 | INT_MASK(INT_IDN_AVAIL) | \ | ||
258 | INT_MASK(INT_UDN_AVAIL) | \ | ||
259 | INT_MASK(INT_IPI_3) | \ | ||
260 | INT_MASK(INT_IPI_2) | \ | ||
261 | INT_MASK(INT_IPI_1) | \ | ||
262 | INT_MASK(INT_IPI_0) | \ | ||
263 | INT_MASK(INT_PERF_COUNT) | \ | ||
264 | INT_MASK(INT_AUX_PERF_COUNT) | \ | ||
265 | INT_MASK(INT_INTCTRL_3) | \ | ||
266 | INT_MASK(INT_INTCTRL_2) | \ | ||
267 | INT_MASK(INT_INTCTRL_1) | \ | ||
268 | INT_MASK(INT_INTCTRL_0) | \ | ||
269 | INT_MASK(INT_BOOT_ACCESS) | \ | ||
270 | INT_MASK(INT_WORLD_ACCESS) | \ | ||
271 | INT_MASK(INT_I_ASID) | \ | ||
272 | INT_MASK(INT_D_ASID) | \ | ||
273 | INT_MASK(INT_DOUBLE_FAULT) | \ | ||
274 | 0) | ||
275 | #endif /* !__ASSEMBLER__ */ | ||
276 | #endif /* !__ARCH_INTERRUPTS_H__ */ | ||
diff --git a/arch/tile/include/arch/spr_def.h b/arch/tile/include/arch/spr_def.h index 442fcba0d122..f548efeb2de3 100644 --- a/arch/tile/include/arch/spr_def.h +++ b/arch/tile/include/arch/spr_def.h | |||
@@ -12,6 +12,15 @@ | |||
12 | * more details. | 12 | * more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /* Include the proper base SPR definition file. */ | ||
16 | #ifdef __tilegx__ | ||
17 | #include <arch/spr_def_64.h> | ||
18 | #else | ||
19 | #include <arch/spr_def_32.h> | ||
20 | #endif | ||
21 | |||
22 | #ifdef __KERNEL__ | ||
23 | |||
15 | /* | 24 | /* |
16 | * In addition to including the proper base SPR definition file, depending | 25 | * In addition to including the proper base SPR definition file, depending |
17 | * on machine architecture, this file defines several macros which allow | 26 | * on machine architecture, this file defines several macros which allow |
@@ -29,7 +38,6 @@ | |||
29 | #define _concat4(a, b, c, d) __concat4(a, b, c, d) | 38 | #define _concat4(a, b, c, d) __concat4(a, b, c, d) |
30 | 39 | ||
31 | #ifdef __tilegx__ | 40 | #ifdef __tilegx__ |
32 | #include <arch/spr_def_64.h> | ||
33 | 41 | ||
34 | /* TILE-Gx dependent, protection-level dependent SPRs. */ | 42 | /* TILE-Gx dependent, protection-level dependent SPRs. */ |
35 | 43 | ||
@@ -65,7 +73,6 @@ | |||
65 | _concat4(INT_SINGLE_STEP_, CONFIG_KERNEL_PL,,) | 73 | _concat4(INT_SINGLE_STEP_, CONFIG_KERNEL_PL,,) |
66 | 74 | ||
67 | #else | 75 | #else |
68 | #include <arch/spr_def_32.h> | ||
69 | 76 | ||
70 | /* TILEPro dependent, protection-level dependent SPRs. */ | 77 | /* TILEPro dependent, protection-level dependent SPRs. */ |
71 | 78 | ||
@@ -102,3 +109,5 @@ | |||
102 | _concat4(SPR_INTCTRL_, CONFIG_KERNEL_PL, _STATUS,) | 109 | _concat4(SPR_INTCTRL_, CONFIG_KERNEL_PL, _STATUS,) |
103 | #define INT_INTCTRL_K \ | 110 | #define INT_INTCTRL_K \ |
104 | _concat4(INT_INTCTRL_, CONFIG_KERNEL_PL,,) | 111 | _concat4(INT_INTCTRL_, CONFIG_KERNEL_PL,,) |
112 | |||
113 | #endif /* __KERNEL__ */ | ||
diff --git a/arch/tile/include/arch/spr_def_64.h b/arch/tile/include/arch/spr_def_64.h new file mode 100644 index 000000000000..cd3e5f95d5fd --- /dev/null +++ b/arch/tile/include/arch/spr_def_64.h | |||
@@ -0,0 +1,173 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef __DOXYGEN__ | ||
16 | |||
17 | #ifndef __ARCH_SPR_DEF_H__ | ||
18 | #define __ARCH_SPR_DEF_H__ | ||
19 | |||
20 | #define SPR_AUX_PERF_COUNT_0 0x2105 | ||
21 | #define SPR_AUX_PERF_COUNT_1 0x2106 | ||
22 | #define SPR_AUX_PERF_COUNT_CTL 0x2107 | ||
23 | #define SPR_AUX_PERF_COUNT_STS 0x2108 | ||
24 | #define SPR_CMPEXCH_VALUE 0x2780 | ||
25 | #define SPR_CYCLE 0x2781 | ||
26 | #define SPR_DONE 0x2705 | ||
27 | #define SPR_DSTREAM_PF 0x2706 | ||
28 | #define SPR_EVENT_BEGIN 0x2782 | ||
29 | #define SPR_EVENT_END 0x2783 | ||
30 | #define SPR_EX_CONTEXT_0_0 0x2580 | ||
31 | #define SPR_EX_CONTEXT_0_1 0x2581 | ||
32 | #define SPR_EX_CONTEXT_0_1__PL_SHIFT 0 | ||
33 | #define SPR_EX_CONTEXT_0_1__PL_RMASK 0x3 | ||
34 | #define SPR_EX_CONTEXT_0_1__PL_MASK 0x3 | ||
35 | #define SPR_EX_CONTEXT_0_1__ICS_SHIFT 2 | ||
36 | #define SPR_EX_CONTEXT_0_1__ICS_RMASK 0x1 | ||
37 | #define SPR_EX_CONTEXT_0_1__ICS_MASK 0x4 | ||
38 | #define SPR_EX_CONTEXT_1_0 0x2480 | ||
39 | #define SPR_EX_CONTEXT_1_1 0x2481 | ||
40 | #define SPR_EX_CONTEXT_1_1__PL_SHIFT 0 | ||
41 | #define SPR_EX_CONTEXT_1_1__PL_RMASK 0x3 | ||
42 | #define SPR_EX_CONTEXT_1_1__PL_MASK 0x3 | ||
43 | #define SPR_EX_CONTEXT_1_1__ICS_SHIFT 2 | ||
44 | #define SPR_EX_CONTEXT_1_1__ICS_RMASK 0x1 | ||
45 | #define SPR_EX_CONTEXT_1_1__ICS_MASK 0x4 | ||
46 | #define SPR_EX_CONTEXT_2_0 0x2380 | ||
47 | #define SPR_EX_CONTEXT_2_1 0x2381 | ||
48 | #define SPR_EX_CONTEXT_2_1__PL_SHIFT 0 | ||
49 | #define SPR_EX_CONTEXT_2_1__PL_RMASK 0x3 | ||
50 | #define SPR_EX_CONTEXT_2_1__PL_MASK 0x3 | ||
51 | #define SPR_EX_CONTEXT_2_1__ICS_SHIFT 2 | ||
52 | #define SPR_EX_CONTEXT_2_1__ICS_RMASK 0x1 | ||
53 | #define SPR_EX_CONTEXT_2_1__ICS_MASK 0x4 | ||
54 | #define SPR_FAIL 0x2707 | ||
55 | #define SPR_ILL_TRANS_REASON__I_STREAM_VA_RMASK 0x1 | ||
56 | #define SPR_INTCTRL_0_STATUS 0x2505 | ||
57 | #define SPR_INTCTRL_1_STATUS 0x2405 | ||
58 | #define SPR_INTCTRL_2_STATUS 0x2305 | ||
59 | #define SPR_INTERRUPT_CRITICAL_SECTION 0x2708 | ||
60 | #define SPR_INTERRUPT_MASK_0 0x2506 | ||
61 | #define SPR_INTERRUPT_MASK_1 0x2406 | ||
62 | #define SPR_INTERRUPT_MASK_2 0x2306 | ||
63 | #define SPR_INTERRUPT_MASK_RESET_0 0x2507 | ||
64 | #define SPR_INTERRUPT_MASK_RESET_1 0x2407 | ||
65 | #define SPR_INTERRUPT_MASK_RESET_2 0x2307 | ||
66 | #define SPR_INTERRUPT_MASK_SET_0 0x2508 | ||
67 | #define SPR_INTERRUPT_MASK_SET_1 0x2408 | ||
68 | #define SPR_INTERRUPT_MASK_SET_2 0x2308 | ||
69 | #define SPR_INTERRUPT_VECTOR_BASE_0 0x2509 | ||
70 | #define SPR_INTERRUPT_VECTOR_BASE_1 0x2409 | ||
71 | #define SPR_INTERRUPT_VECTOR_BASE_2 0x2309 | ||
72 | #define SPR_INTERRUPT_VECTOR_BASE_3 0x2209 | ||
73 | #define SPR_IPI_EVENT_0 0x1f05 | ||
74 | #define SPR_IPI_EVENT_1 0x1e05 | ||
75 | #define SPR_IPI_EVENT_2 0x1d05 | ||
76 | #define SPR_IPI_EVENT_RESET_0 0x1f06 | ||
77 | #define SPR_IPI_EVENT_RESET_1 0x1e06 | ||
78 | #define SPR_IPI_EVENT_RESET_2 0x1d06 | ||
79 | #define SPR_IPI_EVENT_SET_0 0x1f07 | ||
80 | #define SPR_IPI_EVENT_SET_1 0x1e07 | ||
81 | #define SPR_IPI_EVENT_SET_2 0x1d07 | ||
82 | #define SPR_IPI_MASK_0 0x1f08 | ||
83 | #define SPR_IPI_MASK_1 0x1e08 | ||
84 | #define SPR_IPI_MASK_2 0x1d08 | ||
85 | #define SPR_IPI_MASK_RESET_0 0x1f09 | ||
86 | #define SPR_IPI_MASK_RESET_1 0x1e09 | ||
87 | #define SPR_IPI_MASK_RESET_2 0x1d09 | ||
88 | #define SPR_IPI_MASK_SET_0 0x1f0a | ||
89 | #define SPR_IPI_MASK_SET_1 0x1e0a | ||
90 | #define SPR_IPI_MASK_SET_2 0x1d0a | ||
91 | #define SPR_MPL_AUX_TILE_TIMER_SET_0 0x1700 | ||
92 | #define SPR_MPL_AUX_TILE_TIMER_SET_1 0x1701 | ||
93 | #define SPR_MPL_AUX_TILE_TIMER_SET_2 0x1702 | ||
94 | #define SPR_MPL_INTCTRL_0_SET_0 0x2500 | ||
95 | #define SPR_MPL_INTCTRL_0_SET_1 0x2501 | ||
96 | #define SPR_MPL_INTCTRL_0_SET_2 0x2502 | ||
97 | #define SPR_MPL_INTCTRL_1_SET_0 0x2400 | ||
98 | #define SPR_MPL_INTCTRL_1_SET_1 0x2401 | ||
99 | #define SPR_MPL_INTCTRL_1_SET_2 0x2402 | ||
100 | #define SPR_MPL_INTCTRL_2_SET_0 0x2300 | ||
101 | #define SPR_MPL_INTCTRL_2_SET_1 0x2301 | ||
102 | #define SPR_MPL_INTCTRL_2_SET_2 0x2302 | ||
103 | #define SPR_MPL_UDN_ACCESS_SET_0 0x0b00 | ||
104 | #define SPR_MPL_UDN_ACCESS_SET_1 0x0b01 | ||
105 | #define SPR_MPL_UDN_ACCESS_SET_2 0x0b02 | ||
106 | #define SPR_MPL_UDN_AVAIL_SET_0 0x1b00 | ||
107 | #define SPR_MPL_UDN_AVAIL_SET_1 0x1b01 | ||
108 | #define SPR_MPL_UDN_AVAIL_SET_2 0x1b02 | ||
109 | #define SPR_MPL_UDN_COMPLETE_SET_0 0x0600 | ||
110 | #define SPR_MPL_UDN_COMPLETE_SET_1 0x0601 | ||
111 | #define SPR_MPL_UDN_COMPLETE_SET_2 0x0602 | ||
112 | #define SPR_MPL_UDN_FIREWALL_SET_0 0x1500 | ||
113 | #define SPR_MPL_UDN_FIREWALL_SET_1 0x1501 | ||
114 | #define SPR_MPL_UDN_FIREWALL_SET_2 0x1502 | ||
115 | #define SPR_MPL_UDN_TIMER_SET_0 0x1900 | ||
116 | #define SPR_MPL_UDN_TIMER_SET_1 0x1901 | ||
117 | #define SPR_MPL_UDN_TIMER_SET_2 0x1902 | ||
118 | #define SPR_MPL_WORLD_ACCESS_SET_0 0x2700 | ||
119 | #define SPR_MPL_WORLD_ACCESS_SET_1 0x2701 | ||
120 | #define SPR_MPL_WORLD_ACCESS_SET_2 0x2702 | ||
121 | #define SPR_PASS 0x2709 | ||
122 | #define SPR_PERF_COUNT_0 0x2005 | ||
123 | #define SPR_PERF_COUNT_1 0x2006 | ||
124 | #define SPR_PERF_COUNT_CTL 0x2007 | ||
125 | #define SPR_PERF_COUNT_DN_CTL 0x2008 | ||
126 | #define SPR_PERF_COUNT_STS 0x2009 | ||
127 | #define SPR_PROC_STATUS 0x2784 | ||
128 | #define SPR_SIM_CONTROL 0x2785 | ||
129 | #define SPR_SINGLE_STEP_CONTROL_0 0x0405 | ||
130 | #define SPR_SINGLE_STEP_CONTROL_0__CANCELED_MASK 0x1 | ||
131 | #define SPR_SINGLE_STEP_CONTROL_0__INHIBIT_MASK 0x2 | ||
132 | #define SPR_SINGLE_STEP_CONTROL_1 0x0305 | ||
133 | #define SPR_SINGLE_STEP_CONTROL_1__CANCELED_MASK 0x1 | ||
134 | #define SPR_SINGLE_STEP_CONTROL_1__INHIBIT_MASK 0x2 | ||
135 | #define SPR_SINGLE_STEP_CONTROL_2 0x0205 | ||
136 | #define SPR_SINGLE_STEP_CONTROL_2__CANCELED_MASK 0x1 | ||
137 | #define SPR_SINGLE_STEP_CONTROL_2__INHIBIT_MASK 0x2 | ||
138 | #define SPR_SINGLE_STEP_EN_0_0 0x250a | ||
139 | #define SPR_SINGLE_STEP_EN_0_1 0x240a | ||
140 | #define SPR_SINGLE_STEP_EN_0_2 0x230a | ||
141 | #define SPR_SINGLE_STEP_EN_1_0 0x250b | ||
142 | #define SPR_SINGLE_STEP_EN_1_1 0x240b | ||
143 | #define SPR_SINGLE_STEP_EN_1_2 0x230b | ||
144 | #define SPR_SINGLE_STEP_EN_2_0 0x250c | ||
145 | #define SPR_SINGLE_STEP_EN_2_1 0x240c | ||
146 | #define SPR_SINGLE_STEP_EN_2_2 0x230c | ||
147 | #define SPR_SYSTEM_SAVE_0_0 0x2582 | ||
148 | #define SPR_SYSTEM_SAVE_0_1 0x2583 | ||
149 | #define SPR_SYSTEM_SAVE_0_2 0x2584 | ||
150 | #define SPR_SYSTEM_SAVE_0_3 0x2585 | ||
151 | #define SPR_SYSTEM_SAVE_1_0 0x2482 | ||
152 | #define SPR_SYSTEM_SAVE_1_1 0x2483 | ||
153 | #define SPR_SYSTEM_SAVE_1_2 0x2484 | ||
154 | #define SPR_SYSTEM_SAVE_1_3 0x2485 | ||
155 | #define SPR_SYSTEM_SAVE_2_0 0x2382 | ||
156 | #define SPR_SYSTEM_SAVE_2_1 0x2383 | ||
157 | #define SPR_SYSTEM_SAVE_2_2 0x2384 | ||
158 | #define SPR_SYSTEM_SAVE_2_3 0x2385 | ||
159 | #define SPR_TILE_COORD 0x270b | ||
160 | #define SPR_TILE_RTF_HWM 0x270c | ||
161 | #define SPR_TILE_TIMER_CONTROL 0x1605 | ||
162 | #define SPR_UDN_AVAIL_EN 0x1b05 | ||
163 | #define SPR_UDN_DATA_AVAIL 0x0b80 | ||
164 | #define SPR_UDN_DEADLOCK_TIMEOUT 0x1906 | ||
165 | #define SPR_UDN_DEMUX_COUNT_0 0x0b05 | ||
166 | #define SPR_UDN_DEMUX_COUNT_1 0x0b06 | ||
167 | #define SPR_UDN_DEMUX_COUNT_2 0x0b07 | ||
168 | #define SPR_UDN_DEMUX_COUNT_3 0x0b08 | ||
169 | #define SPR_UDN_DIRECTION_PROTECT 0x1505 | ||
170 | |||
171 | #endif /* !defined(__ARCH_SPR_DEF_H__) */ | ||
172 | |||
173 | #endif /* !defined(__DOXYGEN__) */ | ||
diff --git a/arch/tile/include/asm/atomic.h b/arch/tile/include/asm/atomic.h index 75a16028a952..739cfe0499d1 100644 --- a/arch/tile/include/asm/atomic.h +++ b/arch/tile/include/asm/atomic.h | |||
@@ -130,17 +130,52 @@ static inline int atomic_read(const atomic_t *v) | |||
130 | */ | 130 | */ |
131 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 131 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
132 | 132 | ||
133 | |||
134 | /* | ||
135 | * We define xchg() and cmpxchg() in the included headers. | ||
136 | * Note that we do not define __HAVE_ARCH_CMPXCHG, since that would imply | ||
137 | * that cmpxchg() is an efficient operation, which is not particularly true. | ||
138 | */ | ||
139 | |||
140 | /* Nonexistent functions intended to cause link errors. */ | 133 | /* Nonexistent functions intended to cause link errors. */ |
141 | extern unsigned long __xchg_called_with_bad_pointer(void); | 134 | extern unsigned long __xchg_called_with_bad_pointer(void); |
142 | extern unsigned long __cmpxchg_called_with_bad_pointer(void); | 135 | extern unsigned long __cmpxchg_called_with_bad_pointer(void); |
143 | 136 | ||
137 | #define xchg(ptr, x) \ | ||
138 | ({ \ | ||
139 | typeof(*(ptr)) __x; \ | ||
140 | switch (sizeof(*(ptr))) { \ | ||
141 | case 4: \ | ||
142 | __x = (typeof(__x))(typeof(__x-__x))atomic_xchg( \ | ||
143 | (atomic_t *)(ptr), \ | ||
144 | (u32)(typeof((x)-(x)))(x)); \ | ||
145 | break; \ | ||
146 | case 8: \ | ||
147 | __x = (typeof(__x))(typeof(__x-__x))atomic64_xchg( \ | ||
148 | (atomic64_t *)(ptr), \ | ||
149 | (u64)(typeof((x)-(x)))(x)); \ | ||
150 | break; \ | ||
151 | default: \ | ||
152 | __xchg_called_with_bad_pointer(); \ | ||
153 | } \ | ||
154 | __x; \ | ||
155 | }) | ||
156 | |||
157 | #define cmpxchg(ptr, o, n) \ | ||
158 | ({ \ | ||
159 | typeof(*(ptr)) __x; \ | ||
160 | switch (sizeof(*(ptr))) { \ | ||
161 | case 4: \ | ||
162 | __x = (typeof(__x))(typeof(__x-__x))atomic_cmpxchg( \ | ||
163 | (atomic_t *)(ptr), \ | ||
164 | (u32)(typeof((o)-(o)))(o), \ | ||
165 | (u32)(typeof((n)-(n)))(n)); \ | ||
166 | break; \ | ||
167 | case 8: \ | ||
168 | __x = (typeof(__x))(typeof(__x-__x))atomic64_cmpxchg( \ | ||
169 | (atomic64_t *)(ptr), \ | ||
170 | (u64)(typeof((o)-(o)))(o), \ | ||
171 | (u64)(typeof((n)-(n)))(n)); \ | ||
172 | break; \ | ||
173 | default: \ | ||
174 | __cmpxchg_called_with_bad_pointer(); \ | ||
175 | } \ | ||
176 | __x; \ | ||
177 | }) | ||
178 | |||
144 | #define tas(ptr) (xchg((ptr), 1)) | 179 | #define tas(ptr) (xchg((ptr), 1)) |
145 | 180 | ||
146 | #endif /* __ASSEMBLY__ */ | 181 | #endif /* __ASSEMBLY__ */ |
diff --git a/arch/tile/include/asm/atomic_32.h b/arch/tile/include/asm/atomic_32.h index ed359aee8837..92a8bee32311 100644 --- a/arch/tile/include/asm/atomic_32.h +++ b/arch/tile/include/asm/atomic_32.h | |||
@@ -110,16 +110,6 @@ static inline void atomic_set(atomic_t *v, int n) | |||
110 | _atomic_xchg(v, n); | 110 | _atomic_xchg(v, n); |
111 | } | 111 | } |
112 | 112 | ||
113 | #define xchg(ptr, x) ((typeof(*(ptr))) \ | ||
114 | ((sizeof(*(ptr)) == sizeof(atomic_t)) ? \ | ||
115 | atomic_xchg((atomic_t *)(ptr), (long)(x)) : \ | ||
116 | __xchg_called_with_bad_pointer())) | ||
117 | |||
118 | #define cmpxchg(ptr, o, n) ((typeof(*(ptr))) \ | ||
119 | ((sizeof(*(ptr)) == sizeof(atomic_t)) ? \ | ||
120 | atomic_cmpxchg((atomic_t *)(ptr), (long)(o), (long)(n)) : \ | ||
121 | __cmpxchg_called_with_bad_pointer())) | ||
122 | |||
123 | /* A 64bit atomic type */ | 113 | /* A 64bit atomic type */ |
124 | 114 | ||
125 | typedef struct { | 115 | typedef struct { |
diff --git a/arch/tile/include/asm/atomic_64.h b/arch/tile/include/asm/atomic_64.h new file mode 100644 index 000000000000..1c1e60d8ccb6 --- /dev/null +++ b/arch/tile/include/asm/atomic_64.h | |||
@@ -0,0 +1,156 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * Do not include directly; use <asm/atomic.h>. | ||
15 | */ | ||
16 | |||
17 | #ifndef _ASM_TILE_ATOMIC_64_H | ||
18 | #define _ASM_TILE_ATOMIC_64_H | ||
19 | |||
20 | #ifndef __ASSEMBLY__ | ||
21 | |||
22 | #include <arch/spr_def.h> | ||
23 | |||
24 | /* First, the 32-bit atomic ops that are "real" on our 64-bit platform. */ | ||
25 | |||
26 | #define atomic_set(v, i) ((v)->counter = (i)) | ||
27 | |||
28 | /* | ||
29 | * The smp_mb() operations throughout are to support the fact that | ||
30 | * Linux requires memory barriers before and after the operation, | ||
31 | * on any routine which updates memory and returns a value. | ||
32 | */ | ||
33 | |||
34 | static inline int atomic_cmpxchg(atomic_t *v, int o, int n) | ||
35 | { | ||
36 | int val; | ||
37 | __insn_mtspr(SPR_CMPEXCH_VALUE, o); | ||
38 | smp_mb(); /* barrier for proper semantics */ | ||
39 | val = __insn_cmpexch4((void *)&v->counter, n); | ||
40 | smp_mb(); /* barrier for proper semantics */ | ||
41 | return val; | ||
42 | } | ||
43 | |||
44 | static inline int atomic_xchg(atomic_t *v, int n) | ||
45 | { | ||
46 | int val; | ||
47 | smp_mb(); /* barrier for proper semantics */ | ||
48 | val = __insn_exch4((void *)&v->counter, n); | ||
49 | smp_mb(); /* barrier for proper semantics */ | ||
50 | return val; | ||
51 | } | ||
52 | |||
53 | static inline void atomic_add(int i, atomic_t *v) | ||
54 | { | ||
55 | __insn_fetchadd4((void *)&v->counter, i); | ||
56 | } | ||
57 | |||
58 | static inline int atomic_add_return(int i, atomic_t *v) | ||
59 | { | ||
60 | int val; | ||
61 | smp_mb(); /* barrier for proper semantics */ | ||
62 | val = __insn_fetchadd4((void *)&v->counter, i) + i; | ||
63 | barrier(); /* the "+ i" above will wait on memory */ | ||
64 | return val; | ||
65 | } | ||
66 | |||
67 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | ||
68 | { | ||
69 | int guess, oldval = v->counter; | ||
70 | do { | ||
71 | if (oldval == u) | ||
72 | break; | ||
73 | guess = oldval; | ||
74 | oldval = atomic_cmpxchg(v, guess, guess + a); | ||
75 | } while (guess != oldval); | ||
76 | return oldval != u; | ||
77 | } | ||
78 | |||
79 | /* Now the true 64-bit operations. */ | ||
80 | |||
81 | #define ATOMIC64_INIT(i) { (i) } | ||
82 | |||
83 | #define atomic64_read(v) ((v)->counter) | ||
84 | #define atomic64_set(v, i) ((v)->counter = (i)) | ||
85 | |||
86 | static inline long atomic64_cmpxchg(atomic64_t *v, long o, long n) | ||
87 | { | ||
88 | long val; | ||
89 | smp_mb(); /* barrier for proper semantics */ | ||
90 | __insn_mtspr(SPR_CMPEXCH_VALUE, o); | ||
91 | val = __insn_cmpexch((void *)&v->counter, n); | ||
92 | smp_mb(); /* barrier for proper semantics */ | ||
93 | return val; | ||
94 | } | ||
95 | |||
96 | static inline long atomic64_xchg(atomic64_t *v, long n) | ||
97 | { | ||
98 | long val; | ||
99 | smp_mb(); /* barrier for proper semantics */ | ||
100 | val = __insn_exch((void *)&v->counter, n); | ||
101 | smp_mb(); /* barrier for proper semantics */ | ||
102 | return val; | ||
103 | } | ||
104 | |||
105 | static inline void atomic64_add(long i, atomic64_t *v) | ||
106 | { | ||
107 | __insn_fetchadd((void *)&v->counter, i); | ||
108 | } | ||
109 | |||
110 | static inline long atomic64_add_return(long i, atomic64_t *v) | ||
111 | { | ||
112 | int val; | ||
113 | smp_mb(); /* barrier for proper semantics */ | ||
114 | val = __insn_fetchadd((void *)&v->counter, i) + i; | ||
115 | barrier(); /* the "+ i" above will wait on memory */ | ||
116 | return val; | ||
117 | } | ||
118 | |||
119 | static inline long atomic64_add_unless(atomic64_t *v, long a, long u) | ||
120 | { | ||
121 | long guess, oldval = v->counter; | ||
122 | do { | ||
123 | if (oldval == u) | ||
124 | break; | ||
125 | guess = oldval; | ||
126 | oldval = atomic64_cmpxchg(v, guess, guess + a); | ||
127 | } while (guess != oldval); | ||
128 | return oldval != u; | ||
129 | } | ||
130 | |||
131 | #define atomic64_sub_return(i, v) atomic64_add_return(-(i), (v)) | ||
132 | #define atomic64_sub(i, v) atomic64_add(-(i), (v)) | ||
133 | #define atomic64_inc_return(v) atomic64_add_return(1, (v)) | ||
134 | #define atomic64_dec_return(v) atomic64_sub_return(1, (v)) | ||
135 | #define atomic64_inc(v) atomic64_add(1, (v)) | ||
136 | #define atomic64_dec(v) atomic64_sub(1, (v)) | ||
137 | |||
138 | #define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0) | ||
139 | #define atomic64_dec_and_test(v) (atomic64_dec_return(v) == 0) | ||
140 | #define atomic64_sub_and_test(i, v) (atomic64_sub_return((i), (v)) == 0) | ||
141 | #define atomic64_add_negative(i, v) (atomic64_add_return((i), (v)) < 0) | ||
142 | |||
143 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) | ||
144 | |||
145 | /* Atomic dec and inc don't implement barrier, so provide them if needed. */ | ||
146 | #define smp_mb__before_atomic_dec() smp_mb() | ||
147 | #define smp_mb__after_atomic_dec() smp_mb() | ||
148 | #define smp_mb__before_atomic_inc() smp_mb() | ||
149 | #define smp_mb__after_atomic_inc() smp_mb() | ||
150 | |||
151 | /* Define this to indicate that cmpxchg is an efficient operation. */ | ||
152 | #define __HAVE_ARCH_CMPXCHG | ||
153 | |||
154 | #endif /* !__ASSEMBLY__ */ | ||
155 | |||
156 | #endif /* _ASM_TILE_ATOMIC_64_H */ | ||
diff --git a/arch/tile/include/asm/backtrace.h b/arch/tile/include/asm/backtrace.h index f18887d82399..bd5399a69edf 100644 --- a/arch/tile/include/asm/backtrace.h +++ b/arch/tile/include/asm/backtrace.h | |||
@@ -12,80 +12,41 @@ | |||
12 | * more details. | 12 | * more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef _TILE_BACKTRACE_H | 15 | #ifndef _ASM_TILE_BACKTRACE_H |
16 | #define _TILE_BACKTRACE_H | 16 | #define _ASM_TILE_BACKTRACE_H |
17 | |||
18 | |||
19 | 17 | ||
20 | #include <linux/types.h> | 18 | #include <linux/types.h> |
21 | 19 | ||
22 | #include <arch/chip.h> | 20 | /* Reads 'size' bytes from 'address' and writes the data to 'result'. |
23 | |||
24 | #if defined(__tile__) | ||
25 | typedef unsigned long VirtualAddress; | ||
26 | #elif CHIP_VA_WIDTH() > 32 | ||
27 | typedef unsigned long long VirtualAddress; | ||
28 | #else | ||
29 | typedef unsigned int VirtualAddress; | ||
30 | #endif | ||
31 | |||
32 | |||
33 | /** Reads 'size' bytes from 'address' and writes the data to 'result'. | ||
34 | * Returns true if successful, else false (e.g. memory not readable). | 21 | * Returns true if successful, else false (e.g. memory not readable). |
35 | */ | 22 | */ |
36 | typedef bool (*BacktraceMemoryReader)(void *result, | 23 | typedef bool (*BacktraceMemoryReader)(void *result, |
37 | VirtualAddress address, | 24 | unsigned long address, |
38 | unsigned int size, | 25 | unsigned int size, |
39 | void *extra); | 26 | void *extra); |
40 | 27 | ||
41 | typedef struct { | 28 | typedef struct { |
42 | /** Current PC. */ | 29 | /* Current PC. */ |
43 | VirtualAddress pc; | 30 | unsigned long pc; |
44 | 31 | ||
45 | /** Current stack pointer value. */ | 32 | /* Current stack pointer value. */ |
46 | VirtualAddress sp; | 33 | unsigned long sp; |
47 | 34 | ||
48 | /** Current frame pointer value (i.e. caller's stack pointer) */ | 35 | /* Current frame pointer value (i.e. caller's stack pointer) */ |
49 | VirtualAddress fp; | 36 | unsigned long fp; |
50 | 37 | ||
51 | /** Internal use only: caller's PC for first frame. */ | 38 | /* Internal use only: caller's PC for first frame. */ |
52 | VirtualAddress initial_frame_caller_pc; | 39 | unsigned long initial_frame_caller_pc; |
53 | 40 | ||
54 | /** Internal use only: callback to read memory. */ | 41 | /* Internal use only: callback to read memory. */ |
55 | BacktraceMemoryReader read_memory_func; | 42 | BacktraceMemoryReader read_memory_func; |
56 | 43 | ||
57 | /** Internal use only: arbitrary argument to read_memory_func. */ | 44 | /* Internal use only: arbitrary argument to read_memory_func. */ |
58 | void *read_memory_func_extra; | 45 | void *read_memory_func_extra; |
59 | 46 | ||
60 | } BacktraceIterator; | 47 | } BacktraceIterator; |
61 | 48 | ||
62 | 49 | ||
63 | /** Initializes a backtracer to start from the given location. | ||
64 | * | ||
65 | * If the frame pointer cannot be determined it is set to -1. | ||
66 | * | ||
67 | * @param state The state to be filled in. | ||
68 | * @param read_memory_func A callback that reads memory. If NULL, a default | ||
69 | * value is provided. | ||
70 | * @param read_memory_func_extra An arbitrary argument to read_memory_func. | ||
71 | * @param pc The current PC. | ||
72 | * @param lr The current value of the 'lr' register. | ||
73 | * @param sp The current value of the 'sp' register. | ||
74 | * @param r52 The current value of the 'r52' register. | ||
75 | */ | ||
76 | extern void backtrace_init(BacktraceIterator *state, | ||
77 | BacktraceMemoryReader read_memory_func, | ||
78 | void *read_memory_func_extra, | ||
79 | VirtualAddress pc, VirtualAddress lr, | ||
80 | VirtualAddress sp, VirtualAddress r52); | ||
81 | |||
82 | |||
83 | /** Advances the backtracing state to the calling frame, returning | ||
84 | * true iff successful. | ||
85 | */ | ||
86 | extern bool backtrace_next(BacktraceIterator *state); | ||
87 | |||
88 | |||
89 | typedef enum { | 50 | typedef enum { |
90 | 51 | ||
91 | /* We have no idea what the caller's pc is. */ | 52 | /* We have no idea what the caller's pc is. */ |
@@ -138,7 +99,7 @@ enum { | |||
138 | }; | 99 | }; |
139 | 100 | ||
140 | 101 | ||
141 | /** Internal constants used to define 'info' operands. */ | 102 | /* Internal constants used to define 'info' operands. */ |
142 | enum { | 103 | enum { |
143 | /* 0 and 1 are reserved, as are all negative numbers. */ | 104 | /* 0 and 1 are reserved, as are all negative numbers. */ |
144 | 105 | ||
@@ -147,13 +108,10 @@ enum { | |||
147 | CALLER_SP_IN_R52_BASE = 4, | 108 | CALLER_SP_IN_R52_BASE = 4, |
148 | 109 | ||
149 | CALLER_SP_OFFSET_BASE = 8, | 110 | CALLER_SP_OFFSET_BASE = 8, |
150 | |||
151 | /* Marks the entry point of certain functions. */ | ||
152 | ENTRY_POINT_INFO_OP = 16 | ||
153 | }; | 111 | }; |
154 | 112 | ||
155 | 113 | ||
156 | /** Current backtracer state describing where it thinks the caller is. */ | 114 | /* Current backtracer state describing where it thinks the caller is. */ |
157 | typedef struct { | 115 | typedef struct { |
158 | /* | 116 | /* |
159 | * Public fields | 117 | * Public fields |
@@ -192,7 +150,13 @@ typedef struct { | |||
192 | 150 | ||
193 | } CallerLocation; | 151 | } CallerLocation; |
194 | 152 | ||
153 | extern void backtrace_init(BacktraceIterator *state, | ||
154 | BacktraceMemoryReader read_memory_func, | ||
155 | void *read_memory_func_extra, | ||
156 | unsigned long pc, unsigned long lr, | ||
157 | unsigned long sp, unsigned long r52); | ||
195 | 158 | ||
196 | 159 | ||
160 | extern bool backtrace_next(BacktraceIterator *state); | ||
197 | 161 | ||
198 | #endif /* _TILE_BACKTRACE_H */ | 162 | #endif /* _ASM_TILE_BACKTRACE_H */ |
diff --git a/arch/tile/include/asm/bitops.h b/arch/tile/include/asm/bitops.h index 132e6bbd07e9..16f1fa51fea1 100644 --- a/arch/tile/include/asm/bitops.h +++ b/arch/tile/include/asm/bitops.h | |||
@@ -122,6 +122,7 @@ static inline unsigned long __arch_hweight64(__u64 w) | |||
122 | #include <asm-generic/bitops/lock.h> | 122 | #include <asm-generic/bitops/lock.h> |
123 | #include <asm-generic/bitops/find.h> | 123 | #include <asm-generic/bitops/find.h> |
124 | #include <asm-generic/bitops/sched.h> | 124 | #include <asm-generic/bitops/sched.h> |
125 | #include <asm-generic/bitops/non-atomic.h> | ||
125 | #include <asm-generic/bitops/le.h> | 126 | #include <asm-generic/bitops/le.h> |
126 | 127 | ||
127 | #endif /* _ASM_TILE_BITOPS_H */ | 128 | #endif /* _ASM_TILE_BITOPS_H */ |
diff --git a/arch/tile/include/asm/bitops_32.h b/arch/tile/include/asm/bitops_32.h index 2638be51a164..d31ab905cfa7 100644 --- a/arch/tile/include/asm/bitops_32.h +++ b/arch/tile/include/asm/bitops_32.h | |||
@@ -126,7 +126,6 @@ static inline int test_and_change_bit(unsigned nr, | |||
126 | #define smp_mb__before_clear_bit() smp_mb() | 126 | #define smp_mb__before_clear_bit() smp_mb() |
127 | #define smp_mb__after_clear_bit() do {} while (0) | 127 | #define smp_mb__after_clear_bit() do {} while (0) |
128 | 128 | ||
129 | #include <asm-generic/bitops/non-atomic.h> | ||
130 | #include <asm-generic/bitops/ext2-atomic.h> | 129 | #include <asm-generic/bitops/ext2-atomic.h> |
131 | 130 | ||
132 | #endif /* _ASM_TILE_BITOPS_32_H */ | 131 | #endif /* _ASM_TILE_BITOPS_32_H */ |
diff --git a/arch/tile/include/asm/bitops_64.h b/arch/tile/include/asm/bitops_64.h new file mode 100644 index 000000000000..99615e8d2d8b --- /dev/null +++ b/arch/tile/include/asm/bitops_64.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef _ASM_TILE_BITOPS_64_H | ||
16 | #define _ASM_TILE_BITOPS_64_H | ||
17 | |||
18 | #include <linux/compiler.h> | ||
19 | #include <asm/atomic.h> | ||
20 | #include <asm/system.h> | ||
21 | |||
22 | /* See <asm/bitops.h> for API comments. */ | ||
23 | |||
24 | static inline void set_bit(unsigned nr, volatile unsigned long *addr) | ||
25 | { | ||
26 | unsigned long mask = (1UL << (nr % BITS_PER_LONG)); | ||
27 | __insn_fetchor((void *)(addr + nr / BITS_PER_LONG), mask); | ||
28 | } | ||
29 | |||
30 | static inline void clear_bit(unsigned nr, volatile unsigned long *addr) | ||
31 | { | ||
32 | unsigned long mask = (1UL << (nr % BITS_PER_LONG)); | ||
33 | __insn_fetchand((void *)(addr + nr / BITS_PER_LONG), ~mask); | ||
34 | } | ||
35 | |||
36 | #define smp_mb__before_clear_bit() smp_mb() | ||
37 | #define smp_mb__after_clear_bit() smp_mb() | ||
38 | |||
39 | |||
40 | static inline void change_bit(unsigned nr, volatile unsigned long *addr) | ||
41 | { | ||
42 | unsigned long old, mask = (1UL << (nr % BITS_PER_LONG)); | ||
43 | long guess, oldval; | ||
44 | addr += nr / BITS_PER_LONG; | ||
45 | old = *addr; | ||
46 | do { | ||
47 | guess = oldval; | ||
48 | oldval = atomic64_cmpxchg((atomic64_t *)addr, | ||
49 | guess, guess ^ mask); | ||
50 | } while (guess != oldval); | ||
51 | } | ||
52 | |||
53 | |||
54 | /* | ||
55 | * The test_and_xxx_bit() routines require a memory fence before we | ||
56 | * start the operation, and after the operation completes. We use | ||
57 | * smp_mb() before, and rely on the "!= 0" comparison, plus a compiler | ||
58 | * barrier(), to block until the atomic op is complete. | ||
59 | */ | ||
60 | |||
61 | static inline int test_and_set_bit(unsigned nr, volatile unsigned long *addr) | ||
62 | { | ||
63 | int val; | ||
64 | unsigned long mask = (1UL << (nr % BITS_PER_LONG)); | ||
65 | smp_mb(); /* barrier for proper semantics */ | ||
66 | val = (__insn_fetchor((void *)(addr + nr / BITS_PER_LONG), mask) | ||
67 | & mask) != 0; | ||
68 | barrier(); | ||
69 | return val; | ||
70 | } | ||
71 | |||
72 | |||
73 | static inline int test_and_clear_bit(unsigned nr, volatile unsigned long *addr) | ||
74 | { | ||
75 | int val; | ||
76 | unsigned long mask = (1UL << (nr % BITS_PER_LONG)); | ||
77 | smp_mb(); /* barrier for proper semantics */ | ||
78 | val = (__insn_fetchand((void *)(addr + nr / BITS_PER_LONG), ~mask) | ||
79 | & mask) != 0; | ||
80 | barrier(); | ||
81 | return val; | ||
82 | } | ||
83 | |||
84 | |||
85 | static inline int test_and_change_bit(unsigned nr, | ||
86 | volatile unsigned long *addr) | ||
87 | { | ||
88 | unsigned long mask = (1UL << (nr % BITS_PER_LONG)); | ||
89 | long guess, oldval = *addr; | ||
90 | addr += nr / BITS_PER_LONG; | ||
91 | oldval = *addr; | ||
92 | do { | ||
93 | guess = oldval; | ||
94 | oldval = atomic64_cmpxchg((atomic64_t *)addr, | ||
95 | guess, guess ^ mask); | ||
96 | } while (guess != oldval); | ||
97 | return (oldval & mask) != 0; | ||
98 | } | ||
99 | |||
100 | #define ext2_set_bit_atomic(lock, nr, addr) \ | ||
101 | test_and_set_bit((nr), (unsigned long *)(addr)) | ||
102 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | ||
103 | test_and_clear_bit((nr), (unsigned long *)(addr)) | ||
104 | |||
105 | #endif /* _ASM_TILE_BITOPS_64_H */ | ||
diff --git a/arch/tile/include/asm/cacheflush.h b/arch/tile/include/asm/cacheflush.h index 12fb0fb330ee..e925f4bb498f 100644 --- a/arch/tile/include/asm/cacheflush.h +++ b/arch/tile/include/asm/cacheflush.h | |||
@@ -116,22 +116,28 @@ static inline void __finv_buffer(void *buffer, size_t size) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | /* Invalidate a VA range, then memory fence. */ | 119 | /* Invalidate a VA range and wait for it to be complete. */ |
120 | static inline void inv_buffer(void *buffer, size_t size) | 120 | static inline void inv_buffer(void *buffer, size_t size) |
121 | { | 121 | { |
122 | __inv_buffer(buffer, size); | 122 | __inv_buffer(buffer, size); |
123 | mb_incoherent(); | 123 | mb(); |
124 | } | 124 | } |
125 | 125 | ||
126 | /* Flush a VA range, then memory fence. */ | 126 | /* |
127 | static inline void flush_buffer(void *buffer, size_t size) | 127 | * Flush a locally-homecached VA range and wait for the evicted |
128 | * cachelines to hit memory. | ||
129 | */ | ||
130 | static inline void flush_buffer_local(void *buffer, size_t size) | ||
128 | { | 131 | { |
129 | __flush_buffer(buffer, size); | 132 | __flush_buffer(buffer, size); |
130 | mb_incoherent(); | 133 | mb_incoherent(); |
131 | } | 134 | } |
132 | 135 | ||
133 | /* Flush & invalidate a VA range, then memory fence. */ | 136 | /* |
134 | static inline void finv_buffer(void *buffer, size_t size) | 137 | * Flush and invalidate a locally-homecached VA range and wait for the |
138 | * evicted cachelines to hit memory. | ||
139 | */ | ||
140 | static inline void finv_buffer_local(void *buffer, size_t size) | ||
135 | { | 141 | { |
136 | __finv_buffer(buffer, size); | 142 | __finv_buffer(buffer, size); |
137 | mb_incoherent(); | 143 | mb_incoherent(); |
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index c3ae570c0a5d..bf95f55b82b0 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h | |||
@@ -215,8 +215,8 @@ struct compat_sigaction; | |||
215 | struct compat_siginfo; | 215 | struct compat_siginfo; |
216 | struct compat_sigaltstack; | 216 | struct compat_sigaltstack; |
217 | long compat_sys_execve(const char __user *path, | 217 | long compat_sys_execve(const char __user *path, |
218 | const compat_uptr_t __user *argv, | 218 | compat_uptr_t __user *argv, |
219 | const compat_uptr_t __user *envp, struct pt_regs *); | 219 | compat_uptr_t __user *envp, struct pt_regs *); |
220 | long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, | 220 | long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, |
221 | struct compat_sigaction __user *oact, | 221 | struct compat_sigaction __user *oact, |
222 | size_t sigsetsize); | 222 | size_t sigsetsize); |
diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h index 15e1dceecc64..eaa06d175b39 100644 --- a/arch/tile/include/asm/dma-mapping.h +++ b/arch/tile/include/asm/dma-mapping.h | |||
@@ -65,7 +65,8 @@ extern void dma_sync_single_range_for_cpu(struct device *, dma_addr_t, | |||
65 | extern void dma_sync_single_range_for_device(struct device *, dma_addr_t, | 65 | extern void dma_sync_single_range_for_device(struct device *, dma_addr_t, |
66 | unsigned long offset, size_t, | 66 | unsigned long offset, size_t, |
67 | enum dma_data_direction); | 67 | enum dma_data_direction); |
68 | extern void dma_cache_sync(void *vaddr, size_t, enum dma_data_direction); | 68 | extern void dma_cache_sync(struct device *dev, void *vaddr, size_t, |
69 | enum dma_data_direction); | ||
69 | 70 | ||
70 | static inline int | 71 | static inline int |
71 | dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 72 | dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
diff --git a/arch/tile/include/asm/fb.h b/arch/tile/include/asm/fb.h new file mode 100644 index 000000000000..3a4988e8df45 --- /dev/null +++ b/arch/tile/include/asm/fb.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/fb.h> | |||
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h index d3cbb9b14cbe..c9ea1652af03 100644 --- a/arch/tile/include/asm/io.h +++ b/arch/tile/include/asm/io.h | |||
@@ -52,6 +52,7 @@ extern void iounmap(volatile void __iomem *addr); | |||
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #define ioremap_nocache(physaddr, size) ioremap(physaddr, size) | 54 | #define ioremap_nocache(physaddr, size) ioremap(physaddr, size) |
55 | #define ioremap_wc(physaddr, size) ioremap(physaddr, size) | ||
55 | #define ioremap_writethrough(physaddr, size) ioremap(physaddr, size) | 56 | #define ioremap_writethrough(physaddr, size) ioremap(physaddr, size) |
56 | #define ioremap_fullcache(physaddr, size) ioremap(physaddr, size) | 57 | #define ioremap_fullcache(physaddr, size) ioremap(physaddr, size) |
57 | 58 | ||
@@ -161,6 +162,15 @@ static inline void _tile_writeq(u64 val, unsigned long addr) | |||
161 | #define iowrite32 writel | 162 | #define iowrite32 writel |
162 | #define iowrite64 writeq | 163 | #define iowrite64 writeq |
163 | 164 | ||
165 | static inline void memset_io(void *dst, int val, size_t len) | ||
166 | { | ||
167 | int x; | ||
168 | BUG_ON((unsigned long)dst & 0x3); | ||
169 | val = (val & 0xff) * 0x01010101; | ||
170 | for (x = 0; x < len; x += 4) | ||
171 | writel(val, dst + x); | ||
172 | } | ||
173 | |||
164 | static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, | 174 | static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, |
165 | size_t len) | 175 | size_t len) |
166 | { | 176 | { |
@@ -269,6 +279,11 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) | |||
269 | ioport_panic(); | 279 | ioport_panic(); |
270 | } | 280 | } |
271 | 281 | ||
282 | #define ioread16be(addr) be16_to_cpu(ioread16(addr)) | ||
283 | #define ioread32be(addr) be32_to_cpu(ioread32(addr)) | ||
284 | #define iowrite16be(v, addr) iowrite16(be16_to_cpu(v), (addr)) | ||
285 | #define iowrite32be(v, addr) iowrite32(be32_to_cpu(v), (addr)) | ||
286 | |||
272 | #define ioread8_rep(p, dst, count) \ | 287 | #define ioread8_rep(p, dst, count) \ |
273 | insb((unsigned long) (p), (dst), (count)) | 288 | insb((unsigned long) (p), (dst), (count)) |
274 | #define ioread16_rep(p, dst, count) \ | 289 | #define ioread16_rep(p, dst, count) \ |
@@ -283,4 +298,7 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) | |||
283 | #define iowrite32_rep(p, src, count) \ | 298 | #define iowrite32_rep(p, src, count) \ |
284 | outsl((unsigned long) (p), (src), (count)) | 299 | outsl((unsigned long) (p), (src), (count)) |
285 | 300 | ||
301 | #define virt_to_bus virt_to_phys | ||
302 | #define bus_to_virt phys_to_virt | ||
303 | |||
286 | #endif /* _ASM_TILE_IO_H */ | 304 | #endif /* _ASM_TILE_IO_H */ |
diff --git a/arch/tile/include/asm/irq.h b/arch/tile/include/asm/irq.h index 572fd3ef1d73..94e9a511de84 100644 --- a/arch/tile/include/asm/irq.h +++ b/arch/tile/include/asm/irq.h | |||
@@ -23,6 +23,8 @@ | |||
23 | /* IRQ numbers used for linux IPIs. */ | 23 | /* IRQ numbers used for linux IPIs. */ |
24 | #define IRQ_RESCHEDULE 1 | 24 | #define IRQ_RESCHEDULE 1 |
25 | 25 | ||
26 | #define irq_canonicalize(irq) (irq) | ||
27 | |||
26 | void ack_bad_irq(unsigned int irq); | 28 | void ack_bad_irq(unsigned int irq); |
27 | 29 | ||
28 | /* | 30 | /* |
diff --git a/arch/tile/include/asm/mmu_context.h b/arch/tile/include/asm/mmu_context.h index 9bc0d0725c28..15fb24641120 100644 --- a/arch/tile/include/asm/mmu_context.h +++ b/arch/tile/include/asm/mmu_context.h | |||
@@ -100,8 +100,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
100 | __get_cpu_var(current_asid) = asid; | 100 | __get_cpu_var(current_asid) = asid; |
101 | 101 | ||
102 | /* Clear cpu from the old mm, and set it in the new one. */ | 102 | /* Clear cpu from the old mm, and set it in the new one. */ |
103 | cpumask_clear_cpu(cpu, &prev->cpu_vm_mask); | 103 | cpumask_clear_cpu(cpu, mm_cpumask(prev)); |
104 | cpumask_set_cpu(cpu, &next->cpu_vm_mask); | 104 | cpumask_set_cpu(cpu, mm_cpumask(next)); |
105 | 105 | ||
106 | /* Re-load page tables */ | 106 | /* Re-load page tables */ |
107 | install_page_table(next->pgd, asid); | 107 | install_page_table(next->pgd, asid); |
diff --git a/arch/tile/include/asm/opcode-tile_32.h b/arch/tile/include/asm/opcode-tile_32.h index eda60ecbae3d..03df7b1e77bf 100644 --- a/arch/tile/include/asm/opcode-tile_32.h +++ b/arch/tile/include/asm/opcode-tile_32.h | |||
@@ -1502,5 +1502,12 @@ extern int parse_insn_tile(tile_bundle_bits bits, | |||
1502 | decoded[TILE_MAX_INSTRUCTIONS_PER_BUNDLE]); | 1502 | decoded[TILE_MAX_INSTRUCTIONS_PER_BUNDLE]); |
1503 | 1503 | ||
1504 | 1504 | ||
1505 | /* Given a set of bundle bits and a specific pipe, returns which | ||
1506 | * instruction the bundle contains in that pipe. | ||
1507 | */ | ||
1508 | extern const struct tile_opcode * | ||
1509 | find_opcode(tile_bundle_bits bits, tile_pipeline pipe); | ||
1510 | |||
1511 | |||
1505 | 1512 | ||
1506 | #endif /* opcode_tile_h */ | 1513 | #endif /* opcode_tile_h */ |
diff --git a/arch/tile/include/asm/opcode-tile_64.h b/arch/tile/include/asm/opcode-tile_64.h index eda60ecbae3d..c0633466cd5c 100644 --- a/arch/tile/include/asm/opcode-tile_64.h +++ b/arch/tile/include/asm/opcode-tile_64.h | |||
@@ -5,863 +5,711 @@ | |||
5 | #ifndef opcode_tile_h | 5 | #ifndef opcode_tile_h |
6 | #define opcode_tile_h | 6 | #define opcode_tile_h |
7 | 7 | ||
8 | typedef unsigned long long tile_bundle_bits; | 8 | typedef unsigned long long tilegx_bundle_bits; |
9 | 9 | ||
10 | 10 | ||
11 | enum | 11 | enum |
12 | { | 12 | { |
13 | TILE_MAX_OPERANDS = 5 /* mm */ | 13 | TILEGX_MAX_OPERANDS = 4 /* bfexts */ |
14 | }; | 14 | }; |
15 | 15 | ||
16 | typedef enum | 16 | typedef enum |
17 | { | 17 | { |
18 | TILE_OPC_BPT, | 18 | TILEGX_OPC_BPT, |
19 | TILE_OPC_INFO, | 19 | TILEGX_OPC_INFO, |
20 | TILE_OPC_INFOL, | 20 | TILEGX_OPC_INFOL, |
21 | TILE_OPC_J, | 21 | TILEGX_OPC_MOVE, |
22 | TILE_OPC_JAL, | 22 | TILEGX_OPC_MOVEI, |
23 | TILE_OPC_MOVE, | 23 | TILEGX_OPC_MOVELI, |
24 | TILE_OPC_MOVE_SN, | 24 | TILEGX_OPC_PREFETCH, |
25 | TILE_OPC_MOVEI, | 25 | TILEGX_OPC_PREFETCH_ADD_L1, |
26 | TILE_OPC_MOVEI_SN, | 26 | TILEGX_OPC_PREFETCH_ADD_L1_FAULT, |
27 | TILE_OPC_MOVELI, | 27 | TILEGX_OPC_PREFETCH_ADD_L2, |
28 | TILE_OPC_MOVELI_SN, | 28 | TILEGX_OPC_PREFETCH_ADD_L2_FAULT, |
29 | TILE_OPC_MOVELIS, | 29 | TILEGX_OPC_PREFETCH_ADD_L3, |
30 | TILE_OPC_PREFETCH, | 30 | TILEGX_OPC_PREFETCH_ADD_L3_FAULT, |
31 | TILE_OPC_RAISE, | 31 | TILEGX_OPC_PREFETCH_L1, |
32 | TILE_OPC_ADD, | 32 | TILEGX_OPC_PREFETCH_L1_FAULT, |
33 | TILE_OPC_ADD_SN, | 33 | TILEGX_OPC_PREFETCH_L2, |
34 | TILE_OPC_ADDB, | 34 | TILEGX_OPC_PREFETCH_L2_FAULT, |
35 | TILE_OPC_ADDB_SN, | 35 | TILEGX_OPC_PREFETCH_L3, |
36 | TILE_OPC_ADDBS_U, | 36 | TILEGX_OPC_PREFETCH_L3_FAULT, |
37 | TILE_OPC_ADDBS_U_SN, | 37 | TILEGX_OPC_RAISE, |
38 | TILE_OPC_ADDH, | 38 | TILEGX_OPC_ADD, |
39 | TILE_OPC_ADDH_SN, | 39 | TILEGX_OPC_ADDI, |
40 | TILE_OPC_ADDHS, | 40 | TILEGX_OPC_ADDLI, |
41 | TILE_OPC_ADDHS_SN, | 41 | TILEGX_OPC_ADDX, |
42 | TILE_OPC_ADDI, | 42 | TILEGX_OPC_ADDXI, |
43 | TILE_OPC_ADDI_SN, | 43 | TILEGX_OPC_ADDXLI, |
44 | TILE_OPC_ADDIB, | 44 | TILEGX_OPC_ADDXSC, |
45 | TILE_OPC_ADDIB_SN, | 45 | TILEGX_OPC_AND, |
46 | TILE_OPC_ADDIH, | 46 | TILEGX_OPC_ANDI, |
47 | TILE_OPC_ADDIH_SN, | 47 | TILEGX_OPC_BEQZ, |
48 | TILE_OPC_ADDLI, | 48 | TILEGX_OPC_BEQZT, |
49 | TILE_OPC_ADDLI_SN, | 49 | TILEGX_OPC_BFEXTS, |
50 | TILE_OPC_ADDLIS, | 50 | TILEGX_OPC_BFEXTU, |
51 | TILE_OPC_ADDS, | 51 | TILEGX_OPC_BFINS, |
52 | TILE_OPC_ADDS_SN, | 52 | TILEGX_OPC_BGEZ, |
53 | TILE_OPC_ADIFFB_U, | 53 | TILEGX_OPC_BGEZT, |
54 | TILE_OPC_ADIFFB_U_SN, | 54 | TILEGX_OPC_BGTZ, |
55 | TILE_OPC_ADIFFH, | 55 | TILEGX_OPC_BGTZT, |
56 | TILE_OPC_ADIFFH_SN, | 56 | TILEGX_OPC_BLBC, |
57 | TILE_OPC_AND, | 57 | TILEGX_OPC_BLBCT, |
58 | TILE_OPC_AND_SN, | 58 | TILEGX_OPC_BLBS, |
59 | TILE_OPC_ANDI, | 59 | TILEGX_OPC_BLBST, |
60 | TILE_OPC_ANDI_SN, | 60 | TILEGX_OPC_BLEZ, |
61 | TILE_OPC_AULI, | 61 | TILEGX_OPC_BLEZT, |
62 | TILE_OPC_AVGB_U, | 62 | TILEGX_OPC_BLTZ, |
63 | TILE_OPC_AVGB_U_SN, | 63 | TILEGX_OPC_BLTZT, |
64 | TILE_OPC_AVGH, | 64 | TILEGX_OPC_BNEZ, |
65 | TILE_OPC_AVGH_SN, | 65 | TILEGX_OPC_BNEZT, |
66 | TILE_OPC_BBNS, | 66 | TILEGX_OPC_CLZ, |
67 | TILE_OPC_BBNS_SN, | 67 | TILEGX_OPC_CMOVEQZ, |
68 | TILE_OPC_BBNST, | 68 | TILEGX_OPC_CMOVNEZ, |
69 | TILE_OPC_BBNST_SN, | 69 | TILEGX_OPC_CMPEQ, |
70 | TILE_OPC_BBS, | 70 | TILEGX_OPC_CMPEQI, |
71 | TILE_OPC_BBS_SN, | 71 | TILEGX_OPC_CMPEXCH, |
72 | TILE_OPC_BBST, | 72 | TILEGX_OPC_CMPEXCH4, |
73 | TILE_OPC_BBST_SN, | 73 | TILEGX_OPC_CMPLES, |
74 | TILE_OPC_BGEZ, | 74 | TILEGX_OPC_CMPLEU, |
75 | TILE_OPC_BGEZ_SN, | 75 | TILEGX_OPC_CMPLTS, |
76 | TILE_OPC_BGEZT, | 76 | TILEGX_OPC_CMPLTSI, |
77 | TILE_OPC_BGEZT_SN, | 77 | TILEGX_OPC_CMPLTU, |
78 | TILE_OPC_BGZ, | 78 | TILEGX_OPC_CMPLTUI, |
79 | TILE_OPC_BGZ_SN, | 79 | TILEGX_OPC_CMPNE, |
80 | TILE_OPC_BGZT, | 80 | TILEGX_OPC_CMUL, |
81 | TILE_OPC_BGZT_SN, | 81 | TILEGX_OPC_CMULA, |
82 | TILE_OPC_BITX, | 82 | TILEGX_OPC_CMULAF, |
83 | TILE_OPC_BITX_SN, | 83 | TILEGX_OPC_CMULF, |
84 | TILE_OPC_BLEZ, | 84 | TILEGX_OPC_CMULFR, |
85 | TILE_OPC_BLEZ_SN, | 85 | TILEGX_OPC_CMULH, |
86 | TILE_OPC_BLEZT, | 86 | TILEGX_OPC_CMULHR, |
87 | TILE_OPC_BLEZT_SN, | 87 | TILEGX_OPC_CRC32_32, |
88 | TILE_OPC_BLZ, | 88 | TILEGX_OPC_CRC32_8, |
89 | TILE_OPC_BLZ_SN, | 89 | TILEGX_OPC_CTZ, |
90 | TILE_OPC_BLZT, | 90 | TILEGX_OPC_DBLALIGN, |
91 | TILE_OPC_BLZT_SN, | 91 | TILEGX_OPC_DBLALIGN2, |
92 | TILE_OPC_BNZ, | 92 | TILEGX_OPC_DBLALIGN4, |
93 | TILE_OPC_BNZ_SN, | 93 | TILEGX_OPC_DBLALIGN6, |
94 | TILE_OPC_BNZT, | 94 | TILEGX_OPC_DRAIN, |
95 | TILE_OPC_BNZT_SN, | 95 | TILEGX_OPC_DTLBPR, |
96 | TILE_OPC_BYTEX, | 96 | TILEGX_OPC_EXCH, |
97 | TILE_OPC_BYTEX_SN, | 97 | TILEGX_OPC_EXCH4, |
98 | TILE_OPC_BZ, | 98 | TILEGX_OPC_FDOUBLE_ADD_FLAGS, |
99 | TILE_OPC_BZ_SN, | 99 | TILEGX_OPC_FDOUBLE_ADDSUB, |
100 | TILE_OPC_BZT, | 100 | TILEGX_OPC_FDOUBLE_MUL_FLAGS, |
101 | TILE_OPC_BZT_SN, | 101 | TILEGX_OPC_FDOUBLE_PACK1, |
102 | TILE_OPC_CLZ, | 102 | TILEGX_OPC_FDOUBLE_PACK2, |
103 | TILE_OPC_CLZ_SN, | 103 | TILEGX_OPC_FDOUBLE_SUB_FLAGS, |
104 | TILE_OPC_CRC32_32, | 104 | TILEGX_OPC_FDOUBLE_UNPACK_MAX, |
105 | TILE_OPC_CRC32_32_SN, | 105 | TILEGX_OPC_FDOUBLE_UNPACK_MIN, |
106 | TILE_OPC_CRC32_8, | 106 | TILEGX_OPC_FETCHADD, |
107 | TILE_OPC_CRC32_8_SN, | 107 | TILEGX_OPC_FETCHADD4, |
108 | TILE_OPC_CTZ, | 108 | TILEGX_OPC_FETCHADDGEZ, |
109 | TILE_OPC_CTZ_SN, | 109 | TILEGX_OPC_FETCHADDGEZ4, |
110 | TILE_OPC_DRAIN, | 110 | TILEGX_OPC_FETCHAND, |
111 | TILE_OPC_DTLBPR, | 111 | TILEGX_OPC_FETCHAND4, |
112 | TILE_OPC_DWORD_ALIGN, | 112 | TILEGX_OPC_FETCHOR, |
113 | TILE_OPC_DWORD_ALIGN_SN, | 113 | TILEGX_OPC_FETCHOR4, |
114 | TILE_OPC_FINV, | 114 | TILEGX_OPC_FINV, |
115 | TILE_OPC_FLUSH, | 115 | TILEGX_OPC_FLUSH, |
116 | TILE_OPC_FNOP, | 116 | TILEGX_OPC_FLUSHWB, |
117 | TILE_OPC_ICOH, | 117 | TILEGX_OPC_FNOP, |
118 | TILE_OPC_ILL, | 118 | TILEGX_OPC_FSINGLE_ADD1, |
119 | TILE_OPC_INTHB, | 119 | TILEGX_OPC_FSINGLE_ADDSUB2, |
120 | TILE_OPC_INTHB_SN, | 120 | TILEGX_OPC_FSINGLE_MUL1, |
121 | TILE_OPC_INTHH, | 121 | TILEGX_OPC_FSINGLE_MUL2, |
122 | TILE_OPC_INTHH_SN, | 122 | TILEGX_OPC_FSINGLE_PACK1, |
123 | TILE_OPC_INTLB, | 123 | TILEGX_OPC_FSINGLE_PACK2, |
124 | TILE_OPC_INTLB_SN, | 124 | TILEGX_OPC_FSINGLE_SUB1, |
125 | TILE_OPC_INTLH, | 125 | TILEGX_OPC_ICOH, |
126 | TILE_OPC_INTLH_SN, | 126 | TILEGX_OPC_ILL, |
127 | TILE_OPC_INV, | 127 | TILEGX_OPC_INV, |
128 | TILE_OPC_IRET, | 128 | TILEGX_OPC_IRET, |
129 | TILE_OPC_JALB, | 129 | TILEGX_OPC_J, |
130 | TILE_OPC_JALF, | 130 | TILEGX_OPC_JAL, |
131 | TILE_OPC_JALR, | 131 | TILEGX_OPC_JALR, |
132 | TILE_OPC_JALRP, | 132 | TILEGX_OPC_JALRP, |
133 | TILE_OPC_JB, | 133 | TILEGX_OPC_JR, |
134 | TILE_OPC_JF, | 134 | TILEGX_OPC_JRP, |
135 | TILE_OPC_JR, | 135 | TILEGX_OPC_LD, |
136 | TILE_OPC_JRP, | 136 | TILEGX_OPC_LD1S, |
137 | TILE_OPC_LB, | 137 | TILEGX_OPC_LD1S_ADD, |
138 | TILE_OPC_LB_SN, | 138 | TILEGX_OPC_LD1U, |
139 | TILE_OPC_LB_U, | 139 | TILEGX_OPC_LD1U_ADD, |
140 | TILE_OPC_LB_U_SN, | 140 | TILEGX_OPC_LD2S, |
141 | TILE_OPC_LBADD, | 141 | TILEGX_OPC_LD2S_ADD, |
142 | TILE_OPC_LBADD_SN, | 142 | TILEGX_OPC_LD2U, |
143 | TILE_OPC_LBADD_U, | 143 | TILEGX_OPC_LD2U_ADD, |
144 | TILE_OPC_LBADD_U_SN, | 144 | TILEGX_OPC_LD4S, |
145 | TILE_OPC_LH, | 145 | TILEGX_OPC_LD4S_ADD, |
146 | TILE_OPC_LH_SN, | 146 | TILEGX_OPC_LD4U, |
147 | TILE_OPC_LH_U, | 147 | TILEGX_OPC_LD4U_ADD, |
148 | TILE_OPC_LH_U_SN, | 148 | TILEGX_OPC_LD_ADD, |
149 | TILE_OPC_LHADD, | 149 | TILEGX_OPC_LDNA, |
150 | TILE_OPC_LHADD_SN, | 150 | TILEGX_OPC_LDNA_ADD, |
151 | TILE_OPC_LHADD_U, | 151 | TILEGX_OPC_LDNT, |
152 | TILE_OPC_LHADD_U_SN, | 152 | TILEGX_OPC_LDNT1S, |
153 | TILE_OPC_LNK, | 153 | TILEGX_OPC_LDNT1S_ADD, |
154 | TILE_OPC_LNK_SN, | 154 | TILEGX_OPC_LDNT1U, |
155 | TILE_OPC_LW, | 155 | TILEGX_OPC_LDNT1U_ADD, |
156 | TILE_OPC_LW_SN, | 156 | TILEGX_OPC_LDNT2S, |
157 | TILE_OPC_LW_NA, | 157 | TILEGX_OPC_LDNT2S_ADD, |
158 | TILE_OPC_LW_NA_SN, | 158 | TILEGX_OPC_LDNT2U, |
159 | TILE_OPC_LWADD, | 159 | TILEGX_OPC_LDNT2U_ADD, |
160 | TILE_OPC_LWADD_SN, | 160 | TILEGX_OPC_LDNT4S, |
161 | TILE_OPC_LWADD_NA, | 161 | TILEGX_OPC_LDNT4S_ADD, |
162 | TILE_OPC_LWADD_NA_SN, | 162 | TILEGX_OPC_LDNT4U, |
163 | TILE_OPC_MAXB_U, | 163 | TILEGX_OPC_LDNT4U_ADD, |
164 | TILE_OPC_MAXB_U_SN, | 164 | TILEGX_OPC_LDNT_ADD, |
165 | TILE_OPC_MAXH, | 165 | TILEGX_OPC_LNK, |
166 | TILE_OPC_MAXH_SN, | 166 | TILEGX_OPC_MF, |
167 | TILE_OPC_MAXIB_U, | 167 | TILEGX_OPC_MFSPR, |
168 | TILE_OPC_MAXIB_U_SN, | 168 | TILEGX_OPC_MM, |
169 | TILE_OPC_MAXIH, | 169 | TILEGX_OPC_MNZ, |
170 | TILE_OPC_MAXIH_SN, | 170 | TILEGX_OPC_MTSPR, |
171 | TILE_OPC_MF, | 171 | TILEGX_OPC_MUL_HS_HS, |
172 | TILE_OPC_MFSPR, | 172 | TILEGX_OPC_MUL_HS_HU, |
173 | TILE_OPC_MINB_U, | 173 | TILEGX_OPC_MUL_HS_LS, |
174 | TILE_OPC_MINB_U_SN, | 174 | TILEGX_OPC_MUL_HS_LU, |
175 | TILE_OPC_MINH, | 175 | TILEGX_OPC_MUL_HU_HU, |
176 | TILE_OPC_MINH_SN, | 176 | TILEGX_OPC_MUL_HU_LS, |
177 | TILE_OPC_MINIB_U, | 177 | TILEGX_OPC_MUL_HU_LU, |
178 | TILE_OPC_MINIB_U_SN, | 178 | TILEGX_OPC_MUL_LS_LS, |
179 | TILE_OPC_MINIH, | 179 | TILEGX_OPC_MUL_LS_LU, |
180 | TILE_OPC_MINIH_SN, | 180 | TILEGX_OPC_MUL_LU_LU, |
181 | TILE_OPC_MM, | 181 | TILEGX_OPC_MULA_HS_HS, |
182 | TILE_OPC_MNZ, | 182 | TILEGX_OPC_MULA_HS_HU, |
183 | TILE_OPC_MNZ_SN, | 183 | TILEGX_OPC_MULA_HS_LS, |
184 | TILE_OPC_MNZB, | 184 | TILEGX_OPC_MULA_HS_LU, |
185 | TILE_OPC_MNZB_SN, | 185 | TILEGX_OPC_MULA_HU_HU, |
186 | TILE_OPC_MNZH, | 186 | TILEGX_OPC_MULA_HU_LS, |
187 | TILE_OPC_MNZH_SN, | 187 | TILEGX_OPC_MULA_HU_LU, |
188 | TILE_OPC_MTSPR, | 188 | TILEGX_OPC_MULA_LS_LS, |
189 | TILE_OPC_MULHH_SS, | 189 | TILEGX_OPC_MULA_LS_LU, |
190 | TILE_OPC_MULHH_SS_SN, | 190 | TILEGX_OPC_MULA_LU_LU, |
191 | TILE_OPC_MULHH_SU, | 191 | TILEGX_OPC_MULAX, |
192 | TILE_OPC_MULHH_SU_SN, | 192 | TILEGX_OPC_MULX, |
193 | TILE_OPC_MULHH_UU, | 193 | TILEGX_OPC_MZ, |
194 | TILE_OPC_MULHH_UU_SN, | 194 | TILEGX_OPC_NAP, |
195 | TILE_OPC_MULHHA_SS, | 195 | TILEGX_OPC_NOP, |
196 | TILE_OPC_MULHHA_SS_SN, | 196 | TILEGX_OPC_NOR, |
197 | TILE_OPC_MULHHA_SU, | 197 | TILEGX_OPC_OR, |
198 | TILE_OPC_MULHHA_SU_SN, | 198 | TILEGX_OPC_ORI, |
199 | TILE_OPC_MULHHA_UU, | 199 | TILEGX_OPC_PCNT, |
200 | TILE_OPC_MULHHA_UU_SN, | 200 | TILEGX_OPC_REVBITS, |
201 | TILE_OPC_MULHHSA_UU, | 201 | TILEGX_OPC_REVBYTES, |
202 | TILE_OPC_MULHHSA_UU_SN, | 202 | TILEGX_OPC_ROTL, |
203 | TILE_OPC_MULHL_SS, | 203 | TILEGX_OPC_ROTLI, |
204 | TILE_OPC_MULHL_SS_SN, | 204 | TILEGX_OPC_SHL, |
205 | TILE_OPC_MULHL_SU, | 205 | TILEGX_OPC_SHL16INSLI, |
206 | TILE_OPC_MULHL_SU_SN, | 206 | TILEGX_OPC_SHL1ADD, |
207 | TILE_OPC_MULHL_US, | 207 | TILEGX_OPC_SHL1ADDX, |
208 | TILE_OPC_MULHL_US_SN, | 208 | TILEGX_OPC_SHL2ADD, |
209 | TILE_OPC_MULHL_UU, | 209 | TILEGX_OPC_SHL2ADDX, |
210 | TILE_OPC_MULHL_UU_SN, | 210 | TILEGX_OPC_SHL3ADD, |
211 | TILE_OPC_MULHLA_SS, | 211 | TILEGX_OPC_SHL3ADDX, |
212 | TILE_OPC_MULHLA_SS_SN, | 212 | TILEGX_OPC_SHLI, |
213 | TILE_OPC_MULHLA_SU, | 213 | TILEGX_OPC_SHLX, |
214 | TILE_OPC_MULHLA_SU_SN, | 214 | TILEGX_OPC_SHLXI, |
215 | TILE_OPC_MULHLA_US, | 215 | TILEGX_OPC_SHRS, |
216 | TILE_OPC_MULHLA_US_SN, | 216 | TILEGX_OPC_SHRSI, |
217 | TILE_OPC_MULHLA_UU, | 217 | TILEGX_OPC_SHRU, |
218 | TILE_OPC_MULHLA_UU_SN, | 218 | TILEGX_OPC_SHRUI, |
219 | TILE_OPC_MULHLSA_UU, | 219 | TILEGX_OPC_SHRUX, |
220 | TILE_OPC_MULHLSA_UU_SN, | 220 | TILEGX_OPC_SHRUXI, |
221 | TILE_OPC_MULLL_SS, | 221 | TILEGX_OPC_SHUFFLEBYTES, |
222 | TILE_OPC_MULLL_SS_SN, | 222 | TILEGX_OPC_ST, |
223 | TILE_OPC_MULLL_SU, | 223 | TILEGX_OPC_ST1, |
224 | TILE_OPC_MULLL_SU_SN, | 224 | TILEGX_OPC_ST1_ADD, |
225 | TILE_OPC_MULLL_UU, | 225 | TILEGX_OPC_ST2, |
226 | TILE_OPC_MULLL_UU_SN, | 226 | TILEGX_OPC_ST2_ADD, |
227 | TILE_OPC_MULLLA_SS, | 227 | TILEGX_OPC_ST4, |
228 | TILE_OPC_MULLLA_SS_SN, | 228 | TILEGX_OPC_ST4_ADD, |
229 | TILE_OPC_MULLLA_SU, | 229 | TILEGX_OPC_ST_ADD, |
230 | TILE_OPC_MULLLA_SU_SN, | 230 | TILEGX_OPC_STNT, |
231 | TILE_OPC_MULLLA_UU, | 231 | TILEGX_OPC_STNT1, |
232 | TILE_OPC_MULLLA_UU_SN, | 232 | TILEGX_OPC_STNT1_ADD, |
233 | TILE_OPC_MULLLSA_UU, | 233 | TILEGX_OPC_STNT2, |
234 | TILE_OPC_MULLLSA_UU_SN, | 234 | TILEGX_OPC_STNT2_ADD, |
235 | TILE_OPC_MVNZ, | 235 | TILEGX_OPC_STNT4, |
236 | TILE_OPC_MVNZ_SN, | 236 | TILEGX_OPC_STNT4_ADD, |
237 | TILE_OPC_MVZ, | 237 | TILEGX_OPC_STNT_ADD, |
238 | TILE_OPC_MVZ_SN, | 238 | TILEGX_OPC_SUB, |
239 | TILE_OPC_MZ, | 239 | TILEGX_OPC_SUBX, |
240 | TILE_OPC_MZ_SN, | 240 | TILEGX_OPC_SUBXSC, |
241 | TILE_OPC_MZB, | 241 | TILEGX_OPC_SWINT0, |
242 | TILE_OPC_MZB_SN, | 242 | TILEGX_OPC_SWINT1, |
243 | TILE_OPC_MZH, | 243 | TILEGX_OPC_SWINT2, |
244 | TILE_OPC_MZH_SN, | 244 | TILEGX_OPC_SWINT3, |
245 | TILE_OPC_NAP, | 245 | TILEGX_OPC_TBLIDXB0, |
246 | TILE_OPC_NOP, | 246 | TILEGX_OPC_TBLIDXB1, |
247 | TILE_OPC_NOR, | 247 | TILEGX_OPC_TBLIDXB2, |
248 | TILE_OPC_NOR_SN, | 248 | TILEGX_OPC_TBLIDXB3, |
249 | TILE_OPC_OR, | 249 | TILEGX_OPC_V1ADD, |
250 | TILE_OPC_OR_SN, | 250 | TILEGX_OPC_V1ADDI, |
251 | TILE_OPC_ORI, | 251 | TILEGX_OPC_V1ADDUC, |
252 | TILE_OPC_ORI_SN, | 252 | TILEGX_OPC_V1ADIFFU, |
253 | TILE_OPC_PACKBS_U, | 253 | TILEGX_OPC_V1AVGU, |
254 | TILE_OPC_PACKBS_U_SN, | 254 | TILEGX_OPC_V1CMPEQ, |
255 | TILE_OPC_PACKHB, | 255 | TILEGX_OPC_V1CMPEQI, |
256 | TILE_OPC_PACKHB_SN, | 256 | TILEGX_OPC_V1CMPLES, |
257 | TILE_OPC_PACKHS, | 257 | TILEGX_OPC_V1CMPLEU, |
258 | TILE_OPC_PACKHS_SN, | 258 | TILEGX_OPC_V1CMPLTS, |
259 | TILE_OPC_PACKLB, | 259 | TILEGX_OPC_V1CMPLTSI, |
260 | TILE_OPC_PACKLB_SN, | 260 | TILEGX_OPC_V1CMPLTU, |
261 | TILE_OPC_PCNT, | 261 | TILEGX_OPC_V1CMPLTUI, |
262 | TILE_OPC_PCNT_SN, | 262 | TILEGX_OPC_V1CMPNE, |
263 | TILE_OPC_RL, | 263 | TILEGX_OPC_V1DDOTPU, |
264 | TILE_OPC_RL_SN, | 264 | TILEGX_OPC_V1DDOTPUA, |
265 | TILE_OPC_RLI, | 265 | TILEGX_OPC_V1DDOTPUS, |
266 | TILE_OPC_RLI_SN, | 266 | TILEGX_OPC_V1DDOTPUSA, |
267 | TILE_OPC_S1A, | 267 | TILEGX_OPC_V1DOTP, |
268 | TILE_OPC_S1A_SN, | 268 | TILEGX_OPC_V1DOTPA, |
269 | TILE_OPC_S2A, | 269 | TILEGX_OPC_V1DOTPU, |
270 | TILE_OPC_S2A_SN, | 270 | TILEGX_OPC_V1DOTPUA, |
271 | TILE_OPC_S3A, | 271 | TILEGX_OPC_V1DOTPUS, |
272 | TILE_OPC_S3A_SN, | 272 | TILEGX_OPC_V1DOTPUSA, |
273 | TILE_OPC_SADAB_U, | 273 | TILEGX_OPC_V1INT_H, |
274 | TILE_OPC_SADAB_U_SN, | 274 | TILEGX_OPC_V1INT_L, |
275 | TILE_OPC_SADAH, | 275 | TILEGX_OPC_V1MAXU, |
276 | TILE_OPC_SADAH_SN, | 276 | TILEGX_OPC_V1MAXUI, |
277 | TILE_OPC_SADAH_U, | 277 | TILEGX_OPC_V1MINU, |
278 | TILE_OPC_SADAH_U_SN, | 278 | TILEGX_OPC_V1MINUI, |
279 | TILE_OPC_SADB_U, | 279 | TILEGX_OPC_V1MNZ, |
280 | TILE_OPC_SADB_U_SN, | 280 | TILEGX_OPC_V1MULTU, |
281 | TILE_OPC_SADH, | 281 | TILEGX_OPC_V1MULU, |
282 | TILE_OPC_SADH_SN, | 282 | TILEGX_OPC_V1MULUS, |
283 | TILE_OPC_SADH_U, | 283 | TILEGX_OPC_V1MZ, |
284 | TILE_OPC_SADH_U_SN, | 284 | TILEGX_OPC_V1SADAU, |
285 | TILE_OPC_SB, | 285 | TILEGX_OPC_V1SADU, |
286 | TILE_OPC_SBADD, | 286 | TILEGX_OPC_V1SHL, |
287 | TILE_OPC_SEQ, | 287 | TILEGX_OPC_V1SHLI, |
288 | TILE_OPC_SEQ_SN, | 288 | TILEGX_OPC_V1SHRS, |
289 | TILE_OPC_SEQB, | 289 | TILEGX_OPC_V1SHRSI, |
290 | TILE_OPC_SEQB_SN, | 290 | TILEGX_OPC_V1SHRU, |
291 | TILE_OPC_SEQH, | 291 | TILEGX_OPC_V1SHRUI, |
292 | TILE_OPC_SEQH_SN, | 292 | TILEGX_OPC_V1SUB, |
293 | TILE_OPC_SEQI, | 293 | TILEGX_OPC_V1SUBUC, |
294 | TILE_OPC_SEQI_SN, | 294 | TILEGX_OPC_V2ADD, |
295 | TILE_OPC_SEQIB, | 295 | TILEGX_OPC_V2ADDI, |
296 | TILE_OPC_SEQIB_SN, | 296 | TILEGX_OPC_V2ADDSC, |
297 | TILE_OPC_SEQIH, | 297 | TILEGX_OPC_V2ADIFFS, |
298 | TILE_OPC_SEQIH_SN, | 298 | TILEGX_OPC_V2AVGS, |
299 | TILE_OPC_SH, | 299 | TILEGX_OPC_V2CMPEQ, |
300 | TILE_OPC_SHADD, | 300 | TILEGX_OPC_V2CMPEQI, |
301 | TILE_OPC_SHL, | 301 | TILEGX_OPC_V2CMPLES, |
302 | TILE_OPC_SHL_SN, | 302 | TILEGX_OPC_V2CMPLEU, |
303 | TILE_OPC_SHLB, | 303 | TILEGX_OPC_V2CMPLTS, |
304 | TILE_OPC_SHLB_SN, | 304 | TILEGX_OPC_V2CMPLTSI, |
305 | TILE_OPC_SHLH, | 305 | TILEGX_OPC_V2CMPLTU, |
306 | TILE_OPC_SHLH_SN, | 306 | TILEGX_OPC_V2CMPLTUI, |
307 | TILE_OPC_SHLI, | 307 | TILEGX_OPC_V2CMPNE, |
308 | TILE_OPC_SHLI_SN, | 308 | TILEGX_OPC_V2DOTP, |
309 | TILE_OPC_SHLIB, | 309 | TILEGX_OPC_V2DOTPA, |
310 | TILE_OPC_SHLIB_SN, | 310 | TILEGX_OPC_V2INT_H, |
311 | TILE_OPC_SHLIH, | 311 | TILEGX_OPC_V2INT_L, |
312 | TILE_OPC_SHLIH_SN, | 312 | TILEGX_OPC_V2MAXS, |
313 | TILE_OPC_SHR, | 313 | TILEGX_OPC_V2MAXSI, |
314 | TILE_OPC_SHR_SN, | 314 | TILEGX_OPC_V2MINS, |
315 | TILE_OPC_SHRB, | 315 | TILEGX_OPC_V2MINSI, |
316 | TILE_OPC_SHRB_SN, | 316 | TILEGX_OPC_V2MNZ, |
317 | TILE_OPC_SHRH, | 317 | TILEGX_OPC_V2MULFSC, |
318 | TILE_OPC_SHRH_SN, | 318 | TILEGX_OPC_V2MULS, |
319 | TILE_OPC_SHRI, | 319 | TILEGX_OPC_V2MULTS, |
320 | TILE_OPC_SHRI_SN, | 320 | TILEGX_OPC_V2MZ, |
321 | TILE_OPC_SHRIB, | 321 | TILEGX_OPC_V2PACKH, |
322 | TILE_OPC_SHRIB_SN, | 322 | TILEGX_OPC_V2PACKL, |
323 | TILE_OPC_SHRIH, | 323 | TILEGX_OPC_V2PACKUC, |
324 | TILE_OPC_SHRIH_SN, | 324 | TILEGX_OPC_V2SADAS, |
325 | TILE_OPC_SLT, | 325 | TILEGX_OPC_V2SADAU, |
326 | TILE_OPC_SLT_SN, | 326 | TILEGX_OPC_V2SADS, |
327 | TILE_OPC_SLT_U, | 327 | TILEGX_OPC_V2SADU, |
328 | TILE_OPC_SLT_U_SN, | 328 | TILEGX_OPC_V2SHL, |
329 | TILE_OPC_SLTB, | 329 | TILEGX_OPC_V2SHLI, |
330 | TILE_OPC_SLTB_SN, | 330 | TILEGX_OPC_V2SHLSC, |
331 | TILE_OPC_SLTB_U, | 331 | TILEGX_OPC_V2SHRS, |
332 | TILE_OPC_SLTB_U_SN, | 332 | TILEGX_OPC_V2SHRSI, |
333 | TILE_OPC_SLTE, | 333 | TILEGX_OPC_V2SHRU, |
334 | TILE_OPC_SLTE_SN, | 334 | TILEGX_OPC_V2SHRUI, |
335 | TILE_OPC_SLTE_U, | 335 | TILEGX_OPC_V2SUB, |
336 | TILE_OPC_SLTE_U_SN, | 336 | TILEGX_OPC_V2SUBSC, |
337 | TILE_OPC_SLTEB, | 337 | TILEGX_OPC_V4ADD, |
338 | TILE_OPC_SLTEB_SN, | 338 | TILEGX_OPC_V4ADDSC, |
339 | TILE_OPC_SLTEB_U, | 339 | TILEGX_OPC_V4INT_H, |
340 | TILE_OPC_SLTEB_U_SN, | 340 | TILEGX_OPC_V4INT_L, |
341 | TILE_OPC_SLTEH, | 341 | TILEGX_OPC_V4PACKSC, |
342 | TILE_OPC_SLTEH_SN, | 342 | TILEGX_OPC_V4SHL, |
343 | TILE_OPC_SLTEH_U, | 343 | TILEGX_OPC_V4SHLSC, |
344 | TILE_OPC_SLTEH_U_SN, | 344 | TILEGX_OPC_V4SHRS, |
345 | TILE_OPC_SLTH, | 345 | TILEGX_OPC_V4SHRU, |
346 | TILE_OPC_SLTH_SN, | 346 | TILEGX_OPC_V4SUB, |
347 | TILE_OPC_SLTH_U, | 347 | TILEGX_OPC_V4SUBSC, |
348 | TILE_OPC_SLTH_U_SN, | 348 | TILEGX_OPC_WH64, |
349 | TILE_OPC_SLTI, | 349 | TILEGX_OPC_XOR, |
350 | TILE_OPC_SLTI_SN, | 350 | TILEGX_OPC_XORI, |
351 | TILE_OPC_SLTI_U, | 351 | TILEGX_OPC_NONE |
352 | TILE_OPC_SLTI_U_SN, | 352 | } tilegx_mnemonic; |
353 | TILE_OPC_SLTIB, | ||
354 | TILE_OPC_SLTIB_SN, | ||
355 | TILE_OPC_SLTIB_U, | ||
356 | TILE_OPC_SLTIB_U_SN, | ||
357 | TILE_OPC_SLTIH, | ||
358 | TILE_OPC_SLTIH_SN, | ||
359 | TILE_OPC_SLTIH_U, | ||
360 | TILE_OPC_SLTIH_U_SN, | ||
361 | TILE_OPC_SNE, | ||
362 | TILE_OPC_SNE_SN, | ||
363 | TILE_OPC_SNEB, | ||
364 | TILE_OPC_SNEB_SN, | ||
365 | TILE_OPC_SNEH, | ||
366 | TILE_OPC_SNEH_SN, | ||
367 | TILE_OPC_SRA, | ||
368 | TILE_OPC_SRA_SN, | ||
369 | TILE_OPC_SRAB, | ||
370 | TILE_OPC_SRAB_SN, | ||
371 | TILE_OPC_SRAH, | ||
372 | TILE_OPC_SRAH_SN, | ||
373 | TILE_OPC_SRAI, | ||
374 | TILE_OPC_SRAI_SN, | ||
375 | TILE_OPC_SRAIB, | ||
376 | TILE_OPC_SRAIB_SN, | ||
377 | TILE_OPC_SRAIH, | ||
378 | TILE_OPC_SRAIH_SN, | ||
379 | TILE_OPC_SUB, | ||
380 | TILE_OPC_SUB_SN, | ||
381 | TILE_OPC_SUBB, | ||
382 | TILE_OPC_SUBB_SN, | ||
383 | TILE_OPC_SUBBS_U, | ||
384 | TILE_OPC_SUBBS_U_SN, | ||
385 | TILE_OPC_SUBH, | ||
386 | TILE_OPC_SUBH_SN, | ||
387 | TILE_OPC_SUBHS, | ||
388 | TILE_OPC_SUBHS_SN, | ||
389 | TILE_OPC_SUBS, | ||
390 | TILE_OPC_SUBS_SN, | ||
391 | TILE_OPC_SW, | ||
392 | TILE_OPC_SWADD, | ||
393 | TILE_OPC_SWINT0, | ||
394 | TILE_OPC_SWINT1, | ||
395 | TILE_OPC_SWINT2, | ||
396 | TILE_OPC_SWINT3, | ||
397 | TILE_OPC_TBLIDXB0, | ||
398 | TILE_OPC_TBLIDXB0_SN, | ||
399 | TILE_OPC_TBLIDXB1, | ||
400 | TILE_OPC_TBLIDXB1_SN, | ||
401 | TILE_OPC_TBLIDXB2, | ||
402 | TILE_OPC_TBLIDXB2_SN, | ||
403 | TILE_OPC_TBLIDXB3, | ||
404 | TILE_OPC_TBLIDXB3_SN, | ||
405 | TILE_OPC_TNS, | ||
406 | TILE_OPC_TNS_SN, | ||
407 | TILE_OPC_WH64, | ||
408 | TILE_OPC_XOR, | ||
409 | TILE_OPC_XOR_SN, | ||
410 | TILE_OPC_XORI, | ||
411 | TILE_OPC_XORI_SN, | ||
412 | TILE_OPC_NONE | ||
413 | } tile_mnemonic; | ||
414 | 353 | ||
415 | /* 64-bit pattern for a { bpt ; nop } bundle. */ | 354 | /* 64-bit pattern for a { bpt ; nop } bundle. */ |
416 | #define TILE_BPT_BUNDLE 0x400b3cae70166000ULL | 355 | #define TILEGX_BPT_BUNDLE 0x286a44ae51485000ULL |
417 | 356 | ||
418 | 357 | ||
419 | #define TILE_ELF_MACHINE_CODE EM_TILEPRO | 358 | #define TILE_ELF_MACHINE_CODE EM_TILE64 |
420 | 359 | ||
421 | #define TILE_ELF_NAME "elf32-tilepro" | 360 | #define TILE_ELF_NAME "elf32-tile64" |
422 | 361 | ||
423 | 362 | ||
424 | static __inline unsigned int | 363 | static __inline unsigned int |
425 | get_BrOff_SN(tile_bundle_bits num) | 364 | get_BFEnd_X0(tilegx_bundle_bits num) |
426 | { | 365 | { |
427 | const unsigned int n = (unsigned int)num; | 366 | const unsigned int n = (unsigned int)num; |
428 | return (((n >> 0)) & 0x3ff); | 367 | return (((n >> 12)) & 0x3f); |
429 | } | 368 | } |
430 | 369 | ||
431 | static __inline unsigned int | 370 | static __inline unsigned int |
432 | get_BrOff_X1(tile_bundle_bits n) | 371 | get_BFOpcodeExtension_X0(tilegx_bundle_bits num) |
433 | { | 372 | { |
434 | return (((unsigned int)(n >> 43)) & 0x00007fff) | | 373 | const unsigned int n = (unsigned int)num; |
435 | (((unsigned int)(n >> 20)) & 0x00018000); | 374 | return (((n >> 24)) & 0xf); |
436 | } | 375 | } |
437 | 376 | ||
438 | static __inline unsigned int | 377 | static __inline unsigned int |
439 | get_BrType_X1(tile_bundle_bits n) | 378 | get_BFStart_X0(tilegx_bundle_bits num) |
440 | { | 379 | { |
441 | return (((unsigned int)(n >> 31)) & 0xf); | 380 | const unsigned int n = (unsigned int)num; |
381 | return (((n >> 18)) & 0x3f); | ||
442 | } | 382 | } |
443 | 383 | ||
444 | static __inline unsigned int | 384 | static __inline unsigned int |
445 | get_Dest_Imm8_X1(tile_bundle_bits n) | 385 | get_BrOff_X1(tilegx_bundle_bits n) |
446 | { | 386 | { |
447 | return (((unsigned int)(n >> 31)) & 0x0000003f) | | 387 | return (((unsigned int)(n >> 31)) & 0x0000003f) | |
448 | (((unsigned int)(n >> 43)) & 0x000000c0); | 388 | (((unsigned int)(n >> 37)) & 0x0001ffc0); |
449 | } | 389 | } |
450 | 390 | ||
451 | static __inline unsigned int | 391 | static __inline unsigned int |
452 | get_Dest_SN(tile_bundle_bits num) | 392 | get_BrType_X1(tilegx_bundle_bits n) |
453 | { | 393 | { |
454 | const unsigned int n = (unsigned int)num; | 394 | return (((unsigned int)(n >> 54)) & 0x1f); |
455 | return (((n >> 2)) & 0x3); | ||
456 | } | 395 | } |
457 | 396 | ||
458 | static __inline unsigned int | 397 | static __inline unsigned int |
459 | get_Dest_X0(tile_bundle_bits num) | 398 | get_Dest_Imm8_X1(tilegx_bundle_bits n) |
399 | { | ||
400 | return (((unsigned int)(n >> 31)) & 0x0000003f) | | ||
401 | (((unsigned int)(n >> 43)) & 0x000000c0); | ||
402 | } | ||
403 | |||
404 | static __inline unsigned int | ||
405 | get_Dest_X0(tilegx_bundle_bits num) | ||
460 | { | 406 | { |
461 | const unsigned int n = (unsigned int)num; | 407 | const unsigned int n = (unsigned int)num; |
462 | return (((n >> 0)) & 0x3f); | 408 | return (((n >> 0)) & 0x3f); |
463 | } | 409 | } |
464 | 410 | ||
465 | static __inline unsigned int | 411 | static __inline unsigned int |
466 | get_Dest_X1(tile_bundle_bits n) | 412 | get_Dest_X1(tilegx_bundle_bits n) |
467 | { | 413 | { |
468 | return (((unsigned int)(n >> 31)) & 0x3f); | 414 | return (((unsigned int)(n >> 31)) & 0x3f); |
469 | } | 415 | } |
470 | 416 | ||
471 | static __inline unsigned int | 417 | static __inline unsigned int |
472 | get_Dest_Y0(tile_bundle_bits num) | 418 | get_Dest_Y0(tilegx_bundle_bits num) |
473 | { | 419 | { |
474 | const unsigned int n = (unsigned int)num; | 420 | const unsigned int n = (unsigned int)num; |
475 | return (((n >> 0)) & 0x3f); | 421 | return (((n >> 0)) & 0x3f); |
476 | } | 422 | } |
477 | 423 | ||
478 | static __inline unsigned int | 424 | static __inline unsigned int |
479 | get_Dest_Y1(tile_bundle_bits n) | 425 | get_Dest_Y1(tilegx_bundle_bits n) |
480 | { | 426 | { |
481 | return (((unsigned int)(n >> 31)) & 0x3f); | 427 | return (((unsigned int)(n >> 31)) & 0x3f); |
482 | } | 428 | } |
483 | 429 | ||
484 | static __inline unsigned int | 430 | static __inline unsigned int |
485 | get_Imm16_X0(tile_bundle_bits num) | 431 | get_Imm16_X0(tilegx_bundle_bits num) |
486 | { | 432 | { |
487 | const unsigned int n = (unsigned int)num; | 433 | const unsigned int n = (unsigned int)num; |
488 | return (((n >> 12)) & 0xffff); | 434 | return (((n >> 12)) & 0xffff); |
489 | } | 435 | } |
490 | 436 | ||
491 | static __inline unsigned int | 437 | static __inline unsigned int |
492 | get_Imm16_X1(tile_bundle_bits n) | 438 | get_Imm16_X1(tilegx_bundle_bits n) |
493 | { | 439 | { |
494 | return (((unsigned int)(n >> 43)) & 0xffff); | 440 | return (((unsigned int)(n >> 43)) & 0xffff); |
495 | } | 441 | } |
496 | 442 | ||
497 | static __inline unsigned int | 443 | static __inline unsigned int |
498 | get_Imm8_SN(tile_bundle_bits num) | 444 | get_Imm8OpcodeExtension_X0(tilegx_bundle_bits num) |
499 | { | ||
500 | const unsigned int n = (unsigned int)num; | ||
501 | return (((n >> 0)) & 0xff); | ||
502 | } | ||
503 | |||
504 | static __inline unsigned int | ||
505 | get_Imm8_X0(tile_bundle_bits num) | ||
506 | { | 445 | { |
507 | const unsigned int n = (unsigned int)num; | 446 | const unsigned int n = (unsigned int)num; |
508 | return (((n >> 12)) & 0xff); | 447 | return (((n >> 20)) & 0xff); |
509 | } | 448 | } |
510 | 449 | ||
511 | static __inline unsigned int | 450 | static __inline unsigned int |
512 | get_Imm8_X1(tile_bundle_bits n) | 451 | get_Imm8OpcodeExtension_X1(tilegx_bundle_bits n) |
513 | { | 452 | { |
514 | return (((unsigned int)(n >> 43)) & 0xff); | 453 | return (((unsigned int)(n >> 51)) & 0xff); |
515 | } | 454 | } |
516 | 455 | ||
517 | static __inline unsigned int | 456 | static __inline unsigned int |
518 | get_Imm8_Y0(tile_bundle_bits num) | 457 | get_Imm8_X0(tilegx_bundle_bits num) |
519 | { | 458 | { |
520 | const unsigned int n = (unsigned int)num; | 459 | const unsigned int n = (unsigned int)num; |
521 | return (((n >> 12)) & 0xff); | 460 | return (((n >> 12)) & 0xff); |
522 | } | 461 | } |
523 | 462 | ||
524 | static __inline unsigned int | 463 | static __inline unsigned int |
525 | get_Imm8_Y1(tile_bundle_bits n) | 464 | get_Imm8_X1(tilegx_bundle_bits n) |
526 | { | 465 | { |
527 | return (((unsigned int)(n >> 43)) & 0xff); | 466 | return (((unsigned int)(n >> 43)) & 0xff); |
528 | } | 467 | } |
529 | 468 | ||
530 | static __inline unsigned int | 469 | static __inline unsigned int |
531 | get_ImmOpcodeExtension_X0(tile_bundle_bits num) | 470 | get_Imm8_Y0(tilegx_bundle_bits num) |
532 | { | ||
533 | const unsigned int n = (unsigned int)num; | ||
534 | return (((n >> 20)) & 0x7f); | ||
535 | } | ||
536 | |||
537 | static __inline unsigned int | ||
538 | get_ImmOpcodeExtension_X1(tile_bundle_bits n) | ||
539 | { | ||
540 | return (((unsigned int)(n >> 51)) & 0x7f); | ||
541 | } | ||
542 | |||
543 | static __inline unsigned int | ||
544 | get_ImmRROpcodeExtension_SN(tile_bundle_bits num) | ||
545 | { | 471 | { |
546 | const unsigned int n = (unsigned int)num; | 472 | const unsigned int n = (unsigned int)num; |
547 | return (((n >> 8)) & 0x3); | 473 | return (((n >> 12)) & 0xff); |
548 | } | ||
549 | |||
550 | static __inline unsigned int | ||
551 | get_JOffLong_X1(tile_bundle_bits n) | ||
552 | { | ||
553 | return (((unsigned int)(n >> 43)) & 0x00007fff) | | ||
554 | (((unsigned int)(n >> 20)) & 0x00018000) | | ||
555 | (((unsigned int)(n >> 14)) & 0x001e0000) | | ||
556 | (((unsigned int)(n >> 16)) & 0x07e00000) | | ||
557 | (((unsigned int)(n >> 31)) & 0x18000000); | ||
558 | } | ||
559 | |||
560 | static __inline unsigned int | ||
561 | get_JOff_X1(tile_bundle_bits n) | ||
562 | { | ||
563 | return (((unsigned int)(n >> 43)) & 0x00007fff) | | ||
564 | (((unsigned int)(n >> 20)) & 0x00018000) | | ||
565 | (((unsigned int)(n >> 14)) & 0x001e0000) | | ||
566 | (((unsigned int)(n >> 16)) & 0x07e00000) | | ||
567 | (((unsigned int)(n >> 31)) & 0x08000000); | ||
568 | } | ||
569 | |||
570 | static __inline unsigned int | ||
571 | get_MF_Imm15_X1(tile_bundle_bits n) | ||
572 | { | ||
573 | return (((unsigned int)(n >> 37)) & 0x00003fff) | | ||
574 | (((unsigned int)(n >> 44)) & 0x00004000); | ||
575 | } | 474 | } |
576 | 475 | ||
577 | static __inline unsigned int | 476 | static __inline unsigned int |
578 | get_MMEnd_X0(tile_bundle_bits num) | 477 | get_Imm8_Y1(tilegx_bundle_bits n) |
579 | { | 478 | { |
580 | const unsigned int n = (unsigned int)num; | 479 | return (((unsigned int)(n >> 43)) & 0xff); |
581 | return (((n >> 18)) & 0x1f); | ||
582 | } | 480 | } |
583 | 481 | ||
584 | static __inline unsigned int | 482 | static __inline unsigned int |
585 | get_MMEnd_X1(tile_bundle_bits n) | 483 | get_JumpOff_X1(tilegx_bundle_bits n) |
586 | { | 484 | { |
587 | return (((unsigned int)(n >> 49)) & 0x1f); | 485 | return (((unsigned int)(n >> 31)) & 0x7ffffff); |
588 | } | 486 | } |
589 | 487 | ||
590 | static __inline unsigned int | 488 | static __inline unsigned int |
591 | get_MMStart_X0(tile_bundle_bits num) | 489 | get_JumpOpcodeExtension_X1(tilegx_bundle_bits n) |
592 | { | 490 | { |
593 | const unsigned int n = (unsigned int)num; | 491 | return (((unsigned int)(n >> 58)) & 0x1); |
594 | return (((n >> 23)) & 0x1f); | ||
595 | } | 492 | } |
596 | 493 | ||
597 | static __inline unsigned int | 494 | static __inline unsigned int |
598 | get_MMStart_X1(tile_bundle_bits n) | 495 | get_MF_Imm14_X1(tilegx_bundle_bits n) |
599 | { | 496 | { |
600 | return (((unsigned int)(n >> 54)) & 0x1f); | 497 | return (((unsigned int)(n >> 37)) & 0x3fff); |
601 | } | 498 | } |
602 | 499 | ||
603 | static __inline unsigned int | 500 | static __inline unsigned int |
604 | get_MT_Imm15_X1(tile_bundle_bits n) | 501 | get_MT_Imm14_X1(tilegx_bundle_bits n) |
605 | { | 502 | { |
606 | return (((unsigned int)(n >> 31)) & 0x0000003f) | | 503 | return (((unsigned int)(n >> 31)) & 0x0000003f) | |
607 | (((unsigned int)(n >> 37)) & 0x00003fc0) | | 504 | (((unsigned int)(n >> 37)) & 0x00003fc0); |
608 | (((unsigned int)(n >> 44)) & 0x00004000); | ||
609 | } | 505 | } |
610 | 506 | ||
611 | static __inline unsigned int | 507 | static __inline unsigned int |
612 | get_Mode(tile_bundle_bits n) | 508 | get_Mode(tilegx_bundle_bits n) |
613 | { | 509 | { |
614 | return (((unsigned int)(n >> 63)) & 0x1); | 510 | return (((unsigned int)(n >> 62)) & 0x3); |
615 | } | 511 | } |
616 | 512 | ||
617 | static __inline unsigned int | 513 | static __inline unsigned int |
618 | get_NoRegOpcodeExtension_SN(tile_bundle_bits num) | 514 | get_Opcode_X0(tilegx_bundle_bits num) |
619 | { | ||
620 | const unsigned int n = (unsigned int)num; | ||
621 | return (((n >> 0)) & 0xf); | ||
622 | } | ||
623 | |||
624 | static __inline unsigned int | ||
625 | get_Opcode_SN(tile_bundle_bits num) | ||
626 | { | ||
627 | const unsigned int n = (unsigned int)num; | ||
628 | return (((n >> 10)) & 0x3f); | ||
629 | } | ||
630 | |||
631 | static __inline unsigned int | ||
632 | get_Opcode_X0(tile_bundle_bits num) | ||
633 | { | 515 | { |
634 | const unsigned int n = (unsigned int)num; | 516 | const unsigned int n = (unsigned int)num; |
635 | return (((n >> 28)) & 0x7); | 517 | return (((n >> 28)) & 0x7); |
636 | } | 518 | } |
637 | 519 | ||
638 | static __inline unsigned int | 520 | static __inline unsigned int |
639 | get_Opcode_X1(tile_bundle_bits n) | 521 | get_Opcode_X1(tilegx_bundle_bits n) |
640 | { | 522 | { |
641 | return (((unsigned int)(n >> 59)) & 0xf); | 523 | return (((unsigned int)(n >> 59)) & 0x7); |
642 | } | 524 | } |
643 | 525 | ||
644 | static __inline unsigned int | 526 | static __inline unsigned int |
645 | get_Opcode_Y0(tile_bundle_bits num) | 527 | get_Opcode_Y0(tilegx_bundle_bits num) |
646 | { | 528 | { |
647 | const unsigned int n = (unsigned int)num; | 529 | const unsigned int n = (unsigned int)num; |
648 | return (((n >> 27)) & 0xf); | 530 | return (((n >> 27)) & 0xf); |
649 | } | 531 | } |
650 | 532 | ||
651 | static __inline unsigned int | 533 | static __inline unsigned int |
652 | get_Opcode_Y1(tile_bundle_bits n) | 534 | get_Opcode_Y1(tilegx_bundle_bits n) |
653 | { | 535 | { |
654 | return (((unsigned int)(n >> 59)) & 0xf); | 536 | return (((unsigned int)(n >> 58)) & 0xf); |
655 | } | 537 | } |
656 | 538 | ||
657 | static __inline unsigned int | 539 | static __inline unsigned int |
658 | get_Opcode_Y2(tile_bundle_bits n) | 540 | get_Opcode_Y2(tilegx_bundle_bits n) |
659 | { | 541 | { |
660 | return (((unsigned int)(n >> 56)) & 0x7); | 542 | return (((n >> 26)) & 0x00000001) | |
661 | } | 543 | (((unsigned int)(n >> 56)) & 0x00000002); |
662 | |||
663 | static __inline unsigned int | ||
664 | get_RROpcodeExtension_SN(tile_bundle_bits num) | ||
665 | { | ||
666 | const unsigned int n = (unsigned int)num; | ||
667 | return (((n >> 4)) & 0xf); | ||
668 | } | 544 | } |
669 | 545 | ||
670 | static __inline unsigned int | 546 | static __inline unsigned int |
671 | get_RRROpcodeExtension_X0(tile_bundle_bits num) | 547 | get_RRROpcodeExtension_X0(tilegx_bundle_bits num) |
672 | { | 548 | { |
673 | const unsigned int n = (unsigned int)num; | 549 | const unsigned int n = (unsigned int)num; |
674 | return (((n >> 18)) & 0x1ff); | 550 | return (((n >> 18)) & 0x3ff); |
675 | } | 551 | } |
676 | 552 | ||
677 | static __inline unsigned int | 553 | static __inline unsigned int |
678 | get_RRROpcodeExtension_X1(tile_bundle_bits n) | 554 | get_RRROpcodeExtension_X1(tilegx_bundle_bits n) |
679 | { | 555 | { |
680 | return (((unsigned int)(n >> 49)) & 0x1ff); | 556 | return (((unsigned int)(n >> 49)) & 0x3ff); |
681 | } | 557 | } |
682 | 558 | ||
683 | static __inline unsigned int | 559 | static __inline unsigned int |
684 | get_RRROpcodeExtension_Y0(tile_bundle_bits num) | 560 | get_RRROpcodeExtension_Y0(tilegx_bundle_bits num) |
685 | { | 561 | { |
686 | const unsigned int n = (unsigned int)num; | 562 | const unsigned int n = (unsigned int)num; |
687 | return (((n >> 18)) & 0x3); | 563 | return (((n >> 18)) & 0x3); |
688 | } | 564 | } |
689 | 565 | ||
690 | static __inline unsigned int | 566 | static __inline unsigned int |
691 | get_RRROpcodeExtension_Y1(tile_bundle_bits n) | 567 | get_RRROpcodeExtension_Y1(tilegx_bundle_bits n) |
692 | { | 568 | { |
693 | return (((unsigned int)(n >> 49)) & 0x3); | 569 | return (((unsigned int)(n >> 49)) & 0x3); |
694 | } | 570 | } |
695 | 571 | ||
696 | static __inline unsigned int | 572 | static __inline unsigned int |
697 | get_RouteOpcodeExtension_SN(tile_bundle_bits num) | 573 | get_ShAmt_X0(tilegx_bundle_bits num) |
698 | { | ||
699 | const unsigned int n = (unsigned int)num; | ||
700 | return (((n >> 0)) & 0x3ff); | ||
701 | } | ||
702 | |||
703 | static __inline unsigned int | ||
704 | get_S_X0(tile_bundle_bits num) | ||
705 | { | 574 | { |
706 | const unsigned int n = (unsigned int)num; | 575 | const unsigned int n = (unsigned int)num; |
707 | return (((n >> 27)) & 0x1); | 576 | return (((n >> 12)) & 0x3f); |
708 | } | 577 | } |
709 | 578 | ||
710 | static __inline unsigned int | 579 | static __inline unsigned int |
711 | get_S_X1(tile_bundle_bits n) | 580 | get_ShAmt_X1(tilegx_bundle_bits n) |
712 | { | 581 | { |
713 | return (((unsigned int)(n >> 58)) & 0x1); | 582 | return (((unsigned int)(n >> 43)) & 0x3f); |
714 | } | 583 | } |
715 | 584 | ||
716 | static __inline unsigned int | 585 | static __inline unsigned int |
717 | get_ShAmt_X0(tile_bundle_bits num) | 586 | get_ShAmt_Y0(tilegx_bundle_bits num) |
718 | { | 587 | { |
719 | const unsigned int n = (unsigned int)num; | 588 | const unsigned int n = (unsigned int)num; |
720 | return (((n >> 12)) & 0x1f); | 589 | return (((n >> 12)) & 0x3f); |
721 | } | 590 | } |
722 | 591 | ||
723 | static __inline unsigned int | 592 | static __inline unsigned int |
724 | get_ShAmt_X1(tile_bundle_bits n) | 593 | get_ShAmt_Y1(tilegx_bundle_bits n) |
725 | { | 594 | { |
726 | return (((unsigned int)(n >> 43)) & 0x1f); | 595 | return (((unsigned int)(n >> 43)) & 0x3f); |
727 | } | 596 | } |
728 | 597 | ||
729 | static __inline unsigned int | 598 | static __inline unsigned int |
730 | get_ShAmt_Y0(tile_bundle_bits num) | 599 | get_ShiftOpcodeExtension_X0(tilegx_bundle_bits num) |
731 | { | 600 | { |
732 | const unsigned int n = (unsigned int)num; | 601 | const unsigned int n = (unsigned int)num; |
733 | return (((n >> 12)) & 0x1f); | 602 | return (((n >> 18)) & 0x3ff); |
734 | } | 603 | } |
735 | 604 | ||
736 | static __inline unsigned int | 605 | static __inline unsigned int |
737 | get_ShAmt_Y1(tile_bundle_bits n) | 606 | get_ShiftOpcodeExtension_X1(tilegx_bundle_bits n) |
738 | { | 607 | { |
739 | return (((unsigned int)(n >> 43)) & 0x1f); | 608 | return (((unsigned int)(n >> 49)) & 0x3ff); |
740 | } | 609 | } |
741 | 610 | ||
742 | static __inline unsigned int | 611 | static __inline unsigned int |
743 | get_SrcA_X0(tile_bundle_bits num) | 612 | get_ShiftOpcodeExtension_Y0(tilegx_bundle_bits num) |
744 | { | 613 | { |
745 | const unsigned int n = (unsigned int)num; | 614 | const unsigned int n = (unsigned int)num; |
746 | return (((n >> 6)) & 0x3f); | 615 | return (((n >> 18)) & 0x3); |
747 | } | 616 | } |
748 | 617 | ||
749 | static __inline unsigned int | 618 | static __inline unsigned int |
750 | get_SrcA_X1(tile_bundle_bits n) | 619 | get_ShiftOpcodeExtension_Y1(tilegx_bundle_bits n) |
751 | { | 620 | { |
752 | return (((unsigned int)(n >> 37)) & 0x3f); | 621 | return (((unsigned int)(n >> 49)) & 0x3); |
753 | } | 622 | } |
754 | 623 | ||
755 | static __inline unsigned int | 624 | static __inline unsigned int |
756 | get_SrcA_Y0(tile_bundle_bits num) | 625 | get_SrcA_X0(tilegx_bundle_bits num) |
757 | { | 626 | { |
758 | const unsigned int n = (unsigned int)num; | 627 | const unsigned int n = (unsigned int)num; |
759 | return (((n >> 6)) & 0x3f); | 628 | return (((n >> 6)) & 0x3f); |
760 | } | 629 | } |
761 | 630 | ||
762 | static __inline unsigned int | 631 | static __inline unsigned int |
763 | get_SrcA_Y1(tile_bundle_bits n) | 632 | get_SrcA_X1(tilegx_bundle_bits n) |
764 | { | 633 | { |
765 | return (((unsigned int)(n >> 37)) & 0x3f); | 634 | return (((unsigned int)(n >> 37)) & 0x3f); |
766 | } | 635 | } |
767 | 636 | ||
768 | static __inline unsigned int | 637 | static __inline unsigned int |
769 | get_SrcA_Y2(tile_bundle_bits n) | 638 | get_SrcA_Y0(tilegx_bundle_bits num) |
770 | { | 639 | { |
771 | return (((n >> 26)) & 0x00000001) | | 640 | const unsigned int n = (unsigned int)num; |
772 | (((unsigned int)(n >> 50)) & 0x0000003e); | 641 | return (((n >> 6)) & 0x3f); |
773 | } | 642 | } |
774 | 643 | ||
775 | static __inline unsigned int | 644 | static __inline unsigned int |
776 | get_SrcBDest_Y2(tile_bundle_bits num) | 645 | get_SrcA_Y1(tilegx_bundle_bits n) |
777 | { | 646 | { |
778 | const unsigned int n = (unsigned int)num; | 647 | return (((unsigned int)(n >> 37)) & 0x3f); |
779 | return (((n >> 20)) & 0x3f); | ||
780 | } | 648 | } |
781 | 649 | ||
782 | static __inline unsigned int | 650 | static __inline unsigned int |
783 | get_SrcB_X0(tile_bundle_bits num) | 651 | get_SrcA_Y2(tilegx_bundle_bits num) |
784 | { | 652 | { |
785 | const unsigned int n = (unsigned int)num; | 653 | const unsigned int n = (unsigned int)num; |
786 | return (((n >> 12)) & 0x3f); | 654 | return (((n >> 20)) & 0x3f); |
787 | } | 655 | } |
788 | 656 | ||
789 | static __inline unsigned int | 657 | static __inline unsigned int |
790 | get_SrcB_X1(tile_bundle_bits n) | 658 | get_SrcBDest_Y2(tilegx_bundle_bits n) |
791 | { | 659 | { |
792 | return (((unsigned int)(n >> 43)) & 0x3f); | 660 | return (((unsigned int)(n >> 51)) & 0x3f); |
793 | } | 661 | } |
794 | 662 | ||
795 | static __inline unsigned int | 663 | static __inline unsigned int |
796 | get_SrcB_Y0(tile_bundle_bits num) | 664 | get_SrcB_X0(tilegx_bundle_bits num) |
797 | { | 665 | { |
798 | const unsigned int n = (unsigned int)num; | 666 | const unsigned int n = (unsigned int)num; |
799 | return (((n >> 12)) & 0x3f); | 667 | return (((n >> 12)) & 0x3f); |
800 | } | 668 | } |
801 | 669 | ||
802 | static __inline unsigned int | 670 | static __inline unsigned int |
803 | get_SrcB_Y1(tile_bundle_bits n) | 671 | get_SrcB_X1(tilegx_bundle_bits n) |
804 | { | 672 | { |
805 | return (((unsigned int)(n >> 43)) & 0x3f); | 673 | return (((unsigned int)(n >> 43)) & 0x3f); |
806 | } | 674 | } |
807 | 675 | ||
808 | static __inline unsigned int | 676 | static __inline unsigned int |
809 | get_Src_SN(tile_bundle_bits num) | 677 | get_SrcB_Y0(tilegx_bundle_bits num) |
810 | { | 678 | { |
811 | const unsigned int n = (unsigned int)num; | 679 | const unsigned int n = (unsigned int)num; |
812 | return (((n >> 0)) & 0x3); | 680 | return (((n >> 12)) & 0x3f); |
813 | } | ||
814 | |||
815 | static __inline unsigned int | ||
816 | get_UnOpcodeExtension_X0(tile_bundle_bits num) | ||
817 | { | ||
818 | const unsigned int n = (unsigned int)num; | ||
819 | return (((n >> 12)) & 0x1f); | ||
820 | } | ||
821 | |||
822 | static __inline unsigned int | ||
823 | get_UnOpcodeExtension_X1(tile_bundle_bits n) | ||
824 | { | ||
825 | return (((unsigned int)(n >> 43)) & 0x1f); | ||
826 | } | ||
827 | |||
828 | static __inline unsigned int | ||
829 | get_UnOpcodeExtension_Y0(tile_bundle_bits num) | ||
830 | { | ||
831 | const unsigned int n = (unsigned int)num; | ||
832 | return (((n >> 12)) & 0x1f); | ||
833 | } | 681 | } |
834 | 682 | ||
835 | static __inline unsigned int | 683 | static __inline unsigned int |
836 | get_UnOpcodeExtension_Y1(tile_bundle_bits n) | 684 | get_SrcB_Y1(tilegx_bundle_bits n) |
837 | { | 685 | { |
838 | return (((unsigned int)(n >> 43)) & 0x1f); | 686 | return (((unsigned int)(n >> 43)) & 0x3f); |
839 | } | 687 | } |
840 | 688 | ||
841 | static __inline unsigned int | 689 | static __inline unsigned int |
842 | get_UnShOpcodeExtension_X0(tile_bundle_bits num) | 690 | get_UnaryOpcodeExtension_X0(tilegx_bundle_bits num) |
843 | { | 691 | { |
844 | const unsigned int n = (unsigned int)num; | 692 | const unsigned int n = (unsigned int)num; |
845 | return (((n >> 17)) & 0x3ff); | 693 | return (((n >> 12)) & 0x3f); |
846 | } | 694 | } |
847 | 695 | ||
848 | static __inline unsigned int | 696 | static __inline unsigned int |
849 | get_UnShOpcodeExtension_X1(tile_bundle_bits n) | 697 | get_UnaryOpcodeExtension_X1(tilegx_bundle_bits n) |
850 | { | 698 | { |
851 | return (((unsigned int)(n >> 48)) & 0x3ff); | 699 | return (((unsigned int)(n >> 43)) & 0x3f); |
852 | } | 700 | } |
853 | 701 | ||
854 | static __inline unsigned int | 702 | static __inline unsigned int |
855 | get_UnShOpcodeExtension_Y0(tile_bundle_bits num) | 703 | get_UnaryOpcodeExtension_Y0(tilegx_bundle_bits num) |
856 | { | 704 | { |
857 | const unsigned int n = (unsigned int)num; | 705 | const unsigned int n = (unsigned int)num; |
858 | return (((n >> 17)) & 0x7); | 706 | return (((n >> 12)) & 0x3f); |
859 | } | 707 | } |
860 | 708 | ||
861 | static __inline unsigned int | 709 | static __inline unsigned int |
862 | get_UnShOpcodeExtension_Y1(tile_bundle_bits n) | 710 | get_UnaryOpcodeExtension_Y1(tilegx_bundle_bits n) |
863 | { | 711 | { |
864 | return (((unsigned int)(n >> 48)) & 0x7); | 712 | return (((unsigned int)(n >> 43)) & 0x3f); |
865 | } | 713 | } |
866 | 714 | ||
867 | 715 | ||
@@ -874,546 +722,441 @@ sign_extend(int n, int num_bits) | |||
874 | 722 | ||
875 | 723 | ||
876 | 724 | ||
877 | static __inline tile_bundle_bits | 725 | static __inline tilegx_bundle_bits |
878 | create_BrOff_SN(int num) | 726 | create_BFEnd_X0(int num) |
879 | { | 727 | { |
880 | const unsigned int n = (unsigned int)num; | 728 | const unsigned int n = (unsigned int)num; |
881 | return ((n & 0x3ff) << 0); | 729 | return ((n & 0x3f) << 12); |
882 | } | 730 | } |
883 | 731 | ||
884 | static __inline tile_bundle_bits | 732 | static __inline tilegx_bundle_bits |
885 | create_BrOff_X1(int num) | 733 | create_BFOpcodeExtension_X0(int num) |
886 | { | 734 | { |
887 | const unsigned int n = (unsigned int)num; | 735 | const unsigned int n = (unsigned int)num; |
888 | return (((tile_bundle_bits)(n & 0x00007fff)) << 43) | | 736 | return ((n & 0xf) << 24); |
889 | (((tile_bundle_bits)(n & 0x00018000)) << 20); | ||
890 | } | 737 | } |
891 | 738 | ||
892 | static __inline tile_bundle_bits | 739 | static __inline tilegx_bundle_bits |
893 | create_BrType_X1(int num) | 740 | create_BFStart_X0(int num) |
894 | { | 741 | { |
895 | const unsigned int n = (unsigned int)num; | 742 | const unsigned int n = (unsigned int)num; |
896 | return (((tile_bundle_bits)(n & 0xf)) << 31); | 743 | return ((n & 0x3f) << 18); |
897 | } | 744 | } |
898 | 745 | ||
899 | static __inline tile_bundle_bits | 746 | static __inline tilegx_bundle_bits |
900 | create_Dest_Imm8_X1(int num) | 747 | create_BrOff_X1(int num) |
901 | { | 748 | { |
902 | const unsigned int n = (unsigned int)num; | 749 | const unsigned int n = (unsigned int)num; |
903 | return (((tile_bundle_bits)(n & 0x0000003f)) << 31) | | 750 | return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) | |
904 | (((tile_bundle_bits)(n & 0x000000c0)) << 43); | 751 | (((tilegx_bundle_bits)(n & 0x0001ffc0)) << 37); |
905 | } | 752 | } |
906 | 753 | ||
907 | static __inline tile_bundle_bits | 754 | static __inline tilegx_bundle_bits |
908 | create_Dest_SN(int num) | 755 | create_BrType_X1(int num) |
756 | { | ||
757 | const unsigned int n = (unsigned int)num; | ||
758 | return (((tilegx_bundle_bits)(n & 0x1f)) << 54); | ||
759 | } | ||
760 | |||
761 | static __inline tilegx_bundle_bits | ||
762 | create_Dest_Imm8_X1(int num) | ||
909 | { | 763 | { |
910 | const unsigned int n = (unsigned int)num; | 764 | const unsigned int n = (unsigned int)num; |
911 | return ((n & 0x3) << 2); | 765 | return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) | |
766 | (((tilegx_bundle_bits)(n & 0x000000c0)) << 43); | ||
912 | } | 767 | } |
913 | 768 | ||
914 | static __inline tile_bundle_bits | 769 | static __inline tilegx_bundle_bits |
915 | create_Dest_X0(int num) | 770 | create_Dest_X0(int num) |
916 | { | 771 | { |
917 | const unsigned int n = (unsigned int)num; | 772 | const unsigned int n = (unsigned int)num; |
918 | return ((n & 0x3f) << 0); | 773 | return ((n & 0x3f) << 0); |
919 | } | 774 | } |
920 | 775 | ||
921 | static __inline tile_bundle_bits | 776 | static __inline tilegx_bundle_bits |
922 | create_Dest_X1(int num) | 777 | create_Dest_X1(int num) |
923 | { | 778 | { |
924 | const unsigned int n = (unsigned int)num; | 779 | const unsigned int n = (unsigned int)num; |
925 | return (((tile_bundle_bits)(n & 0x3f)) << 31); | 780 | return (((tilegx_bundle_bits)(n & 0x3f)) << 31); |
926 | } | 781 | } |
927 | 782 | ||
928 | static __inline tile_bundle_bits | 783 | static __inline tilegx_bundle_bits |
929 | create_Dest_Y0(int num) | 784 | create_Dest_Y0(int num) |
930 | { | 785 | { |
931 | const unsigned int n = (unsigned int)num; | 786 | const unsigned int n = (unsigned int)num; |
932 | return ((n & 0x3f) << 0); | 787 | return ((n & 0x3f) << 0); |
933 | } | 788 | } |
934 | 789 | ||
935 | static __inline tile_bundle_bits | 790 | static __inline tilegx_bundle_bits |
936 | create_Dest_Y1(int num) | 791 | create_Dest_Y1(int num) |
937 | { | 792 | { |
938 | const unsigned int n = (unsigned int)num; | 793 | const unsigned int n = (unsigned int)num; |
939 | return (((tile_bundle_bits)(n & 0x3f)) << 31); | 794 | return (((tilegx_bundle_bits)(n & 0x3f)) << 31); |
940 | } | 795 | } |
941 | 796 | ||
942 | static __inline tile_bundle_bits | 797 | static __inline tilegx_bundle_bits |
943 | create_Imm16_X0(int num) | 798 | create_Imm16_X0(int num) |
944 | { | 799 | { |
945 | const unsigned int n = (unsigned int)num; | 800 | const unsigned int n = (unsigned int)num; |
946 | return ((n & 0xffff) << 12); | 801 | return ((n & 0xffff) << 12); |
947 | } | 802 | } |
948 | 803 | ||
949 | static __inline tile_bundle_bits | 804 | static __inline tilegx_bundle_bits |
950 | create_Imm16_X1(int num) | 805 | create_Imm16_X1(int num) |
951 | { | 806 | { |
952 | const unsigned int n = (unsigned int)num; | 807 | const unsigned int n = (unsigned int)num; |
953 | return (((tile_bundle_bits)(n & 0xffff)) << 43); | 808 | return (((tilegx_bundle_bits)(n & 0xffff)) << 43); |
954 | } | 809 | } |
955 | 810 | ||
956 | static __inline tile_bundle_bits | 811 | static __inline tilegx_bundle_bits |
957 | create_Imm8_SN(int num) | 812 | create_Imm8OpcodeExtension_X0(int num) |
958 | { | 813 | { |
959 | const unsigned int n = (unsigned int)num; | 814 | const unsigned int n = (unsigned int)num; |
960 | return ((n & 0xff) << 0); | 815 | return ((n & 0xff) << 20); |
961 | } | 816 | } |
962 | 817 | ||
963 | static __inline tile_bundle_bits | 818 | static __inline tilegx_bundle_bits |
819 | create_Imm8OpcodeExtension_X1(int num) | ||
820 | { | ||
821 | const unsigned int n = (unsigned int)num; | ||
822 | return (((tilegx_bundle_bits)(n & 0xff)) << 51); | ||
823 | } | ||
824 | |||
825 | static __inline tilegx_bundle_bits | ||
964 | create_Imm8_X0(int num) | 826 | create_Imm8_X0(int num) |
965 | { | 827 | { |
966 | const unsigned int n = (unsigned int)num; | 828 | const unsigned int n = (unsigned int)num; |
967 | return ((n & 0xff) << 12); | 829 | return ((n & 0xff) << 12); |
968 | } | 830 | } |
969 | 831 | ||
970 | static __inline tile_bundle_bits | 832 | static __inline tilegx_bundle_bits |
971 | create_Imm8_X1(int num) | 833 | create_Imm8_X1(int num) |
972 | { | 834 | { |
973 | const unsigned int n = (unsigned int)num; | 835 | const unsigned int n = (unsigned int)num; |
974 | return (((tile_bundle_bits)(n & 0xff)) << 43); | 836 | return (((tilegx_bundle_bits)(n & 0xff)) << 43); |
975 | } | 837 | } |
976 | 838 | ||
977 | static __inline tile_bundle_bits | 839 | static __inline tilegx_bundle_bits |
978 | create_Imm8_Y0(int num) | 840 | create_Imm8_Y0(int num) |
979 | { | 841 | { |
980 | const unsigned int n = (unsigned int)num; | 842 | const unsigned int n = (unsigned int)num; |
981 | return ((n & 0xff) << 12); | 843 | return ((n & 0xff) << 12); |
982 | } | 844 | } |
983 | 845 | ||
984 | static __inline tile_bundle_bits | 846 | static __inline tilegx_bundle_bits |
985 | create_Imm8_Y1(int num) | 847 | create_Imm8_Y1(int num) |
986 | { | 848 | { |
987 | const unsigned int n = (unsigned int)num; | 849 | const unsigned int n = (unsigned int)num; |
988 | return (((tile_bundle_bits)(n & 0xff)) << 43); | 850 | return (((tilegx_bundle_bits)(n & 0xff)) << 43); |
989 | } | ||
990 | |||
991 | static __inline tile_bundle_bits | ||
992 | create_ImmOpcodeExtension_X0(int num) | ||
993 | { | ||
994 | const unsigned int n = (unsigned int)num; | ||
995 | return ((n & 0x7f) << 20); | ||
996 | } | ||
997 | |||
998 | static __inline tile_bundle_bits | ||
999 | create_ImmOpcodeExtension_X1(int num) | ||
1000 | { | ||
1001 | const unsigned int n = (unsigned int)num; | ||
1002 | return (((tile_bundle_bits)(n & 0x7f)) << 51); | ||
1003 | } | ||
1004 | |||
1005 | static __inline tile_bundle_bits | ||
1006 | create_ImmRROpcodeExtension_SN(int num) | ||
1007 | { | ||
1008 | const unsigned int n = (unsigned int)num; | ||
1009 | return ((n & 0x3) << 8); | ||
1010 | } | ||
1011 | |||
1012 | static __inline tile_bundle_bits | ||
1013 | create_JOffLong_X1(int num) | ||
1014 | { | ||
1015 | const unsigned int n = (unsigned int)num; | ||
1016 | return (((tile_bundle_bits)(n & 0x00007fff)) << 43) | | ||
1017 | (((tile_bundle_bits)(n & 0x00018000)) << 20) | | ||
1018 | (((tile_bundle_bits)(n & 0x001e0000)) << 14) | | ||
1019 | (((tile_bundle_bits)(n & 0x07e00000)) << 16) | | ||
1020 | (((tile_bundle_bits)(n & 0x18000000)) << 31); | ||
1021 | } | ||
1022 | |||
1023 | static __inline tile_bundle_bits | ||
1024 | create_JOff_X1(int num) | ||
1025 | { | ||
1026 | const unsigned int n = (unsigned int)num; | ||
1027 | return (((tile_bundle_bits)(n & 0x00007fff)) << 43) | | ||
1028 | (((tile_bundle_bits)(n & 0x00018000)) << 20) | | ||
1029 | (((tile_bundle_bits)(n & 0x001e0000)) << 14) | | ||
1030 | (((tile_bundle_bits)(n & 0x07e00000)) << 16) | | ||
1031 | (((tile_bundle_bits)(n & 0x08000000)) << 31); | ||
1032 | } | ||
1033 | |||
1034 | static __inline tile_bundle_bits | ||
1035 | create_MF_Imm15_X1(int num) | ||
1036 | { | ||
1037 | const unsigned int n = (unsigned int)num; | ||
1038 | return (((tile_bundle_bits)(n & 0x00003fff)) << 37) | | ||
1039 | (((tile_bundle_bits)(n & 0x00004000)) << 44); | ||
1040 | } | 851 | } |
1041 | 852 | ||
1042 | static __inline tile_bundle_bits | 853 | static __inline tilegx_bundle_bits |
1043 | create_MMEnd_X0(int num) | 854 | create_JumpOff_X1(int num) |
1044 | { | 855 | { |
1045 | const unsigned int n = (unsigned int)num; | 856 | const unsigned int n = (unsigned int)num; |
1046 | return ((n & 0x1f) << 18); | 857 | return (((tilegx_bundle_bits)(n & 0x7ffffff)) << 31); |
1047 | } | 858 | } |
1048 | 859 | ||
1049 | static __inline tile_bundle_bits | 860 | static __inline tilegx_bundle_bits |
1050 | create_MMEnd_X1(int num) | 861 | create_JumpOpcodeExtension_X1(int num) |
1051 | { | 862 | { |
1052 | const unsigned int n = (unsigned int)num; | 863 | const unsigned int n = (unsigned int)num; |
1053 | return (((tile_bundle_bits)(n & 0x1f)) << 49); | 864 | return (((tilegx_bundle_bits)(n & 0x1)) << 58); |
1054 | } | 865 | } |
1055 | 866 | ||
1056 | static __inline tile_bundle_bits | 867 | static __inline tilegx_bundle_bits |
1057 | create_MMStart_X0(int num) | 868 | create_MF_Imm14_X1(int num) |
1058 | { | 869 | { |
1059 | const unsigned int n = (unsigned int)num; | 870 | const unsigned int n = (unsigned int)num; |
1060 | return ((n & 0x1f) << 23); | 871 | return (((tilegx_bundle_bits)(n & 0x3fff)) << 37); |
1061 | } | 872 | } |
1062 | 873 | ||
1063 | static __inline tile_bundle_bits | 874 | static __inline tilegx_bundle_bits |
1064 | create_MMStart_X1(int num) | 875 | create_MT_Imm14_X1(int num) |
1065 | { | 876 | { |
1066 | const unsigned int n = (unsigned int)num; | 877 | const unsigned int n = (unsigned int)num; |
1067 | return (((tile_bundle_bits)(n & 0x1f)) << 54); | 878 | return (((tilegx_bundle_bits)(n & 0x0000003f)) << 31) | |
879 | (((tilegx_bundle_bits)(n & 0x00003fc0)) << 37); | ||
1068 | } | 880 | } |
1069 | 881 | ||
1070 | static __inline tile_bundle_bits | 882 | static __inline tilegx_bundle_bits |
1071 | create_MT_Imm15_X1(int num) | ||
1072 | { | ||
1073 | const unsigned int n = (unsigned int)num; | ||
1074 | return (((tile_bundle_bits)(n & 0x0000003f)) << 31) | | ||
1075 | (((tile_bundle_bits)(n & 0x00003fc0)) << 37) | | ||
1076 | (((tile_bundle_bits)(n & 0x00004000)) << 44); | ||
1077 | } | ||
1078 | |||
1079 | static __inline tile_bundle_bits | ||
1080 | create_Mode(int num) | 883 | create_Mode(int num) |
1081 | { | 884 | { |
1082 | const unsigned int n = (unsigned int)num; | 885 | const unsigned int n = (unsigned int)num; |
1083 | return (((tile_bundle_bits)(n & 0x1)) << 63); | 886 | return (((tilegx_bundle_bits)(n & 0x3)) << 62); |
1084 | } | 887 | } |
1085 | 888 | ||
1086 | static __inline tile_bundle_bits | 889 | static __inline tilegx_bundle_bits |
1087 | create_NoRegOpcodeExtension_SN(int num) | ||
1088 | { | ||
1089 | const unsigned int n = (unsigned int)num; | ||
1090 | return ((n & 0xf) << 0); | ||
1091 | } | ||
1092 | |||
1093 | static __inline tile_bundle_bits | ||
1094 | create_Opcode_SN(int num) | ||
1095 | { | ||
1096 | const unsigned int n = (unsigned int)num; | ||
1097 | return ((n & 0x3f) << 10); | ||
1098 | } | ||
1099 | |||
1100 | static __inline tile_bundle_bits | ||
1101 | create_Opcode_X0(int num) | 890 | create_Opcode_X0(int num) |
1102 | { | 891 | { |
1103 | const unsigned int n = (unsigned int)num; | 892 | const unsigned int n = (unsigned int)num; |
1104 | return ((n & 0x7) << 28); | 893 | return ((n & 0x7) << 28); |
1105 | } | 894 | } |
1106 | 895 | ||
1107 | static __inline tile_bundle_bits | 896 | static __inline tilegx_bundle_bits |
1108 | create_Opcode_X1(int num) | 897 | create_Opcode_X1(int num) |
1109 | { | 898 | { |
1110 | const unsigned int n = (unsigned int)num; | 899 | const unsigned int n = (unsigned int)num; |
1111 | return (((tile_bundle_bits)(n & 0xf)) << 59); | 900 | return (((tilegx_bundle_bits)(n & 0x7)) << 59); |
1112 | } | 901 | } |
1113 | 902 | ||
1114 | static __inline tile_bundle_bits | 903 | static __inline tilegx_bundle_bits |
1115 | create_Opcode_Y0(int num) | 904 | create_Opcode_Y0(int num) |
1116 | { | 905 | { |
1117 | const unsigned int n = (unsigned int)num; | 906 | const unsigned int n = (unsigned int)num; |
1118 | return ((n & 0xf) << 27); | 907 | return ((n & 0xf) << 27); |
1119 | } | 908 | } |
1120 | 909 | ||
1121 | static __inline tile_bundle_bits | 910 | static __inline tilegx_bundle_bits |
1122 | create_Opcode_Y1(int num) | 911 | create_Opcode_Y1(int num) |
1123 | { | 912 | { |
1124 | const unsigned int n = (unsigned int)num; | 913 | const unsigned int n = (unsigned int)num; |
1125 | return (((tile_bundle_bits)(n & 0xf)) << 59); | 914 | return (((tilegx_bundle_bits)(n & 0xf)) << 58); |
1126 | } | 915 | } |
1127 | 916 | ||
1128 | static __inline tile_bundle_bits | 917 | static __inline tilegx_bundle_bits |
1129 | create_Opcode_Y2(int num) | 918 | create_Opcode_Y2(int num) |
1130 | { | 919 | { |
1131 | const unsigned int n = (unsigned int)num; | 920 | const unsigned int n = (unsigned int)num; |
1132 | return (((tile_bundle_bits)(n & 0x7)) << 56); | 921 | return ((n & 0x00000001) << 26) | |
1133 | } | 922 | (((tilegx_bundle_bits)(n & 0x00000002)) << 56); |
1134 | |||
1135 | static __inline tile_bundle_bits | ||
1136 | create_RROpcodeExtension_SN(int num) | ||
1137 | { | ||
1138 | const unsigned int n = (unsigned int)num; | ||
1139 | return ((n & 0xf) << 4); | ||
1140 | } | 923 | } |
1141 | 924 | ||
1142 | static __inline tile_bundle_bits | 925 | static __inline tilegx_bundle_bits |
1143 | create_RRROpcodeExtension_X0(int num) | 926 | create_RRROpcodeExtension_X0(int num) |
1144 | { | 927 | { |
1145 | const unsigned int n = (unsigned int)num; | 928 | const unsigned int n = (unsigned int)num; |
1146 | return ((n & 0x1ff) << 18); | 929 | return ((n & 0x3ff) << 18); |
1147 | } | 930 | } |
1148 | 931 | ||
1149 | static __inline tile_bundle_bits | 932 | static __inline tilegx_bundle_bits |
1150 | create_RRROpcodeExtension_X1(int num) | 933 | create_RRROpcodeExtension_X1(int num) |
1151 | { | 934 | { |
1152 | const unsigned int n = (unsigned int)num; | 935 | const unsigned int n = (unsigned int)num; |
1153 | return (((tile_bundle_bits)(n & 0x1ff)) << 49); | 936 | return (((tilegx_bundle_bits)(n & 0x3ff)) << 49); |
1154 | } | 937 | } |
1155 | 938 | ||
1156 | static __inline tile_bundle_bits | 939 | static __inline tilegx_bundle_bits |
1157 | create_RRROpcodeExtension_Y0(int num) | 940 | create_RRROpcodeExtension_Y0(int num) |
1158 | { | 941 | { |
1159 | const unsigned int n = (unsigned int)num; | 942 | const unsigned int n = (unsigned int)num; |
1160 | return ((n & 0x3) << 18); | 943 | return ((n & 0x3) << 18); |
1161 | } | 944 | } |
1162 | 945 | ||
1163 | static __inline tile_bundle_bits | 946 | static __inline tilegx_bundle_bits |
1164 | create_RRROpcodeExtension_Y1(int num) | 947 | create_RRROpcodeExtension_Y1(int num) |
1165 | { | 948 | { |
1166 | const unsigned int n = (unsigned int)num; | 949 | const unsigned int n = (unsigned int)num; |
1167 | return (((tile_bundle_bits)(n & 0x3)) << 49); | 950 | return (((tilegx_bundle_bits)(n & 0x3)) << 49); |
1168 | } | 951 | } |
1169 | 952 | ||
1170 | static __inline tile_bundle_bits | 953 | static __inline tilegx_bundle_bits |
1171 | create_RouteOpcodeExtension_SN(int num) | 954 | create_ShAmt_X0(int num) |
1172 | { | 955 | { |
1173 | const unsigned int n = (unsigned int)num; | 956 | const unsigned int n = (unsigned int)num; |
1174 | return ((n & 0x3ff) << 0); | 957 | return ((n & 0x3f) << 12); |
1175 | } | 958 | } |
1176 | 959 | ||
1177 | static __inline tile_bundle_bits | 960 | static __inline tilegx_bundle_bits |
1178 | create_S_X0(int num) | 961 | create_ShAmt_X1(int num) |
1179 | { | 962 | { |
1180 | const unsigned int n = (unsigned int)num; | 963 | const unsigned int n = (unsigned int)num; |
1181 | return ((n & 0x1) << 27); | 964 | return (((tilegx_bundle_bits)(n & 0x3f)) << 43); |
1182 | } | 965 | } |
1183 | 966 | ||
1184 | static __inline tile_bundle_bits | 967 | static __inline tilegx_bundle_bits |
1185 | create_S_X1(int num) | 968 | create_ShAmt_Y0(int num) |
1186 | { | 969 | { |
1187 | const unsigned int n = (unsigned int)num; | 970 | const unsigned int n = (unsigned int)num; |
1188 | return (((tile_bundle_bits)(n & 0x1)) << 58); | 971 | return ((n & 0x3f) << 12); |
1189 | } | 972 | } |
1190 | 973 | ||
1191 | static __inline tile_bundle_bits | 974 | static __inline tilegx_bundle_bits |
1192 | create_ShAmt_X0(int num) | 975 | create_ShAmt_Y1(int num) |
1193 | { | 976 | { |
1194 | const unsigned int n = (unsigned int)num; | 977 | const unsigned int n = (unsigned int)num; |
1195 | return ((n & 0x1f) << 12); | 978 | return (((tilegx_bundle_bits)(n & 0x3f)) << 43); |
1196 | } | 979 | } |
1197 | 980 | ||
1198 | static __inline tile_bundle_bits | 981 | static __inline tilegx_bundle_bits |
1199 | create_ShAmt_X1(int num) | 982 | create_ShiftOpcodeExtension_X0(int num) |
1200 | { | 983 | { |
1201 | const unsigned int n = (unsigned int)num; | 984 | const unsigned int n = (unsigned int)num; |
1202 | return (((tile_bundle_bits)(n & 0x1f)) << 43); | 985 | return ((n & 0x3ff) << 18); |
1203 | } | 986 | } |
1204 | 987 | ||
1205 | static __inline tile_bundle_bits | 988 | static __inline tilegx_bundle_bits |
1206 | create_ShAmt_Y0(int num) | 989 | create_ShiftOpcodeExtension_X1(int num) |
1207 | { | 990 | { |
1208 | const unsigned int n = (unsigned int)num; | 991 | const unsigned int n = (unsigned int)num; |
1209 | return ((n & 0x1f) << 12); | 992 | return (((tilegx_bundle_bits)(n & 0x3ff)) << 49); |
1210 | } | 993 | } |
1211 | 994 | ||
1212 | static __inline tile_bundle_bits | 995 | static __inline tilegx_bundle_bits |
1213 | create_ShAmt_Y1(int num) | 996 | create_ShiftOpcodeExtension_Y0(int num) |
1214 | { | 997 | { |
1215 | const unsigned int n = (unsigned int)num; | 998 | const unsigned int n = (unsigned int)num; |
1216 | return (((tile_bundle_bits)(n & 0x1f)) << 43); | 999 | return ((n & 0x3) << 18); |
1217 | } | 1000 | } |
1218 | 1001 | ||
1219 | static __inline tile_bundle_bits | 1002 | static __inline tilegx_bundle_bits |
1003 | create_ShiftOpcodeExtension_Y1(int num) | ||
1004 | { | ||
1005 | const unsigned int n = (unsigned int)num; | ||
1006 | return (((tilegx_bundle_bits)(n & 0x3)) << 49); | ||
1007 | } | ||
1008 | |||
1009 | static __inline tilegx_bundle_bits | ||
1220 | create_SrcA_X0(int num) | 1010 | create_SrcA_X0(int num) |
1221 | { | 1011 | { |
1222 | const unsigned int n = (unsigned int)num; | 1012 | const unsigned int n = (unsigned int)num; |
1223 | return ((n & 0x3f) << 6); | 1013 | return ((n & 0x3f) << 6); |
1224 | } | 1014 | } |
1225 | 1015 | ||
1226 | static __inline tile_bundle_bits | 1016 | static __inline tilegx_bundle_bits |
1227 | create_SrcA_X1(int num) | 1017 | create_SrcA_X1(int num) |
1228 | { | 1018 | { |
1229 | const unsigned int n = (unsigned int)num; | 1019 | const unsigned int n = (unsigned int)num; |
1230 | return (((tile_bundle_bits)(n & 0x3f)) << 37); | 1020 | return (((tilegx_bundle_bits)(n & 0x3f)) << 37); |
1231 | } | 1021 | } |
1232 | 1022 | ||
1233 | static __inline tile_bundle_bits | 1023 | static __inline tilegx_bundle_bits |
1234 | create_SrcA_Y0(int num) | 1024 | create_SrcA_Y0(int num) |
1235 | { | 1025 | { |
1236 | const unsigned int n = (unsigned int)num; | 1026 | const unsigned int n = (unsigned int)num; |
1237 | return ((n & 0x3f) << 6); | 1027 | return ((n & 0x3f) << 6); |
1238 | } | 1028 | } |
1239 | 1029 | ||
1240 | static __inline tile_bundle_bits | 1030 | static __inline tilegx_bundle_bits |
1241 | create_SrcA_Y1(int num) | 1031 | create_SrcA_Y1(int num) |
1242 | { | 1032 | { |
1243 | const unsigned int n = (unsigned int)num; | 1033 | const unsigned int n = (unsigned int)num; |
1244 | return (((tile_bundle_bits)(n & 0x3f)) << 37); | 1034 | return (((tilegx_bundle_bits)(n & 0x3f)) << 37); |
1245 | } | 1035 | } |
1246 | 1036 | ||
1247 | static __inline tile_bundle_bits | 1037 | static __inline tilegx_bundle_bits |
1248 | create_SrcA_Y2(int num) | 1038 | create_SrcA_Y2(int num) |
1249 | { | 1039 | { |
1250 | const unsigned int n = (unsigned int)num; | 1040 | const unsigned int n = (unsigned int)num; |
1251 | return ((n & 0x00000001) << 26) | | 1041 | return ((n & 0x3f) << 20); |
1252 | (((tile_bundle_bits)(n & 0x0000003e)) << 50); | ||
1253 | } | 1042 | } |
1254 | 1043 | ||
1255 | static __inline tile_bundle_bits | 1044 | static __inline tilegx_bundle_bits |
1256 | create_SrcBDest_Y2(int num) | 1045 | create_SrcBDest_Y2(int num) |
1257 | { | 1046 | { |
1258 | const unsigned int n = (unsigned int)num; | 1047 | const unsigned int n = (unsigned int)num; |
1259 | return ((n & 0x3f) << 20); | 1048 | return (((tilegx_bundle_bits)(n & 0x3f)) << 51); |
1260 | } | 1049 | } |
1261 | 1050 | ||
1262 | static __inline tile_bundle_bits | 1051 | static __inline tilegx_bundle_bits |
1263 | create_SrcB_X0(int num) | 1052 | create_SrcB_X0(int num) |
1264 | { | 1053 | { |
1265 | const unsigned int n = (unsigned int)num; | 1054 | const unsigned int n = (unsigned int)num; |
1266 | return ((n & 0x3f) << 12); | 1055 | return ((n & 0x3f) << 12); |
1267 | } | 1056 | } |
1268 | 1057 | ||
1269 | static __inline tile_bundle_bits | 1058 | static __inline tilegx_bundle_bits |
1270 | create_SrcB_X1(int num) | 1059 | create_SrcB_X1(int num) |
1271 | { | 1060 | { |
1272 | const unsigned int n = (unsigned int)num; | 1061 | const unsigned int n = (unsigned int)num; |
1273 | return (((tile_bundle_bits)(n & 0x3f)) << 43); | 1062 | return (((tilegx_bundle_bits)(n & 0x3f)) << 43); |
1274 | } | 1063 | } |
1275 | 1064 | ||
1276 | static __inline tile_bundle_bits | 1065 | static __inline tilegx_bundle_bits |
1277 | create_SrcB_Y0(int num) | 1066 | create_SrcB_Y0(int num) |
1278 | { | 1067 | { |
1279 | const unsigned int n = (unsigned int)num; | 1068 | const unsigned int n = (unsigned int)num; |
1280 | return ((n & 0x3f) << 12); | 1069 | return ((n & 0x3f) << 12); |
1281 | } | 1070 | } |
1282 | 1071 | ||
1283 | static __inline tile_bundle_bits | 1072 | static __inline tilegx_bundle_bits |
1284 | create_SrcB_Y1(int num) | 1073 | create_SrcB_Y1(int num) |
1285 | { | 1074 | { |
1286 | const unsigned int n = (unsigned int)num; | 1075 | const unsigned int n = (unsigned int)num; |
1287 | return (((tile_bundle_bits)(n & 0x3f)) << 43); | 1076 | return (((tilegx_bundle_bits)(n & 0x3f)) << 43); |
1288 | } | 1077 | } |
1289 | 1078 | ||
1290 | static __inline tile_bundle_bits | 1079 | static __inline tilegx_bundle_bits |
1291 | create_Src_SN(int num) | 1080 | create_UnaryOpcodeExtension_X0(int num) |
1292 | { | 1081 | { |
1293 | const unsigned int n = (unsigned int)num; | 1082 | const unsigned int n = (unsigned int)num; |
1294 | return ((n & 0x3) << 0); | 1083 | return ((n & 0x3f) << 12); |
1295 | } | ||
1296 | |||
1297 | static __inline tile_bundle_bits | ||
1298 | create_UnOpcodeExtension_X0(int num) | ||
1299 | { | ||
1300 | const unsigned int n = (unsigned int)num; | ||
1301 | return ((n & 0x1f) << 12); | ||
1302 | } | ||
1303 | |||
1304 | static __inline tile_bundle_bits | ||
1305 | create_UnOpcodeExtension_X1(int num) | ||
1306 | { | ||
1307 | const unsigned int n = (unsigned int)num; | ||
1308 | return (((tile_bundle_bits)(n & 0x1f)) << 43); | ||
1309 | } | ||
1310 | |||
1311 | static __inline tile_bundle_bits | ||
1312 | create_UnOpcodeExtension_Y0(int num) | ||
1313 | { | ||
1314 | const unsigned int n = (unsigned int)num; | ||
1315 | return ((n & 0x1f) << 12); | ||
1316 | } | ||
1317 | |||
1318 | static __inline tile_bundle_bits | ||
1319 | create_UnOpcodeExtension_Y1(int num) | ||
1320 | { | ||
1321 | const unsigned int n = (unsigned int)num; | ||
1322 | return (((tile_bundle_bits)(n & 0x1f)) << 43); | ||
1323 | } | ||
1324 | |||
1325 | static __inline tile_bundle_bits | ||
1326 | create_UnShOpcodeExtension_X0(int num) | ||
1327 | { | ||
1328 | const unsigned int n = (unsigned int)num; | ||
1329 | return ((n & 0x3ff) << 17); | ||
1330 | } | 1084 | } |
1331 | 1085 | ||
1332 | static __inline tile_bundle_bits | 1086 | static __inline tilegx_bundle_bits |
1333 | create_UnShOpcodeExtension_X1(int num) | 1087 | create_UnaryOpcodeExtension_X1(int num) |
1334 | { | 1088 | { |
1335 | const unsigned int n = (unsigned int)num; | 1089 | const unsigned int n = (unsigned int)num; |
1336 | return (((tile_bundle_bits)(n & 0x3ff)) << 48); | 1090 | return (((tilegx_bundle_bits)(n & 0x3f)) << 43); |
1337 | } | 1091 | } |
1338 | 1092 | ||
1339 | static __inline tile_bundle_bits | 1093 | static __inline tilegx_bundle_bits |
1340 | create_UnShOpcodeExtension_Y0(int num) | 1094 | create_UnaryOpcodeExtension_Y0(int num) |
1341 | { | 1095 | { |
1342 | const unsigned int n = (unsigned int)num; | 1096 | const unsigned int n = (unsigned int)num; |
1343 | return ((n & 0x7) << 17); | 1097 | return ((n & 0x3f) << 12); |
1344 | } | 1098 | } |
1345 | 1099 | ||
1346 | static __inline tile_bundle_bits | 1100 | static __inline tilegx_bundle_bits |
1347 | create_UnShOpcodeExtension_Y1(int num) | 1101 | create_UnaryOpcodeExtension_Y1(int num) |
1348 | { | 1102 | { |
1349 | const unsigned int n = (unsigned int)num; | 1103 | const unsigned int n = (unsigned int)num; |
1350 | return (((tile_bundle_bits)(n & 0x7)) << 48); | 1104 | return (((tilegx_bundle_bits)(n & 0x3f)) << 43); |
1351 | } | 1105 | } |
1352 | 1106 | ||
1353 | 1107 | ||
1354 | |||
1355 | typedef enum | 1108 | typedef enum |
1356 | { | 1109 | { |
1357 | TILE_PIPELINE_X0, | 1110 | TILEGX_PIPELINE_X0, |
1358 | TILE_PIPELINE_X1, | 1111 | TILEGX_PIPELINE_X1, |
1359 | TILE_PIPELINE_Y0, | 1112 | TILEGX_PIPELINE_Y0, |
1360 | TILE_PIPELINE_Y1, | 1113 | TILEGX_PIPELINE_Y1, |
1361 | TILE_PIPELINE_Y2, | 1114 | TILEGX_PIPELINE_Y2, |
1362 | } tile_pipeline; | 1115 | } tilegx_pipeline; |
1363 | 1116 | ||
1364 | #define tile_is_x_pipeline(p) ((int)(p) <= (int)TILE_PIPELINE_X1) | 1117 | #define tilegx_is_x_pipeline(p) ((int)(p) <= (int)TILEGX_PIPELINE_X1) |
1365 | 1118 | ||
1366 | typedef enum | 1119 | typedef enum |
1367 | { | 1120 | { |
1368 | TILE_OP_TYPE_REGISTER, | 1121 | TILEGX_OP_TYPE_REGISTER, |
1369 | TILE_OP_TYPE_IMMEDIATE, | 1122 | TILEGX_OP_TYPE_IMMEDIATE, |
1370 | TILE_OP_TYPE_ADDRESS, | 1123 | TILEGX_OP_TYPE_ADDRESS, |
1371 | TILE_OP_TYPE_SPR | 1124 | TILEGX_OP_TYPE_SPR |
1372 | } tile_operand_type; | 1125 | } tilegx_operand_type; |
1373 | 1126 | ||
1374 | /* This is the bit that determines if a bundle is in the Y encoding. */ | 1127 | /* These are the bits that determine if a bundle is in the X encoding. */ |
1375 | #define TILE_BUNDLE_Y_ENCODING_MASK ((tile_bundle_bits)1 << 63) | 1128 | #define TILEGX_BUNDLE_MODE_MASK ((tilegx_bundle_bits)3 << 62) |
1376 | 1129 | ||
1377 | enum | 1130 | enum |
1378 | { | 1131 | { |
1379 | /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */ | 1132 | /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */ |
1380 | TILE_MAX_INSTRUCTIONS_PER_BUNDLE = 3, | 1133 | TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE = 3, |
1381 | 1134 | ||
1382 | /* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */ | 1135 | /* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */ |
1383 | TILE_NUM_PIPELINE_ENCODINGS = 5, | 1136 | TILEGX_NUM_PIPELINE_ENCODINGS = 5, |
1384 | 1137 | ||
1385 | /* Log base 2 of TILE_BUNDLE_SIZE_IN_BYTES. */ | 1138 | /* Log base 2 of TILEGX_BUNDLE_SIZE_IN_BYTES. */ |
1386 | TILE_LOG2_BUNDLE_SIZE_IN_BYTES = 3, | 1139 | TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES = 3, |
1387 | 1140 | ||
1388 | /* Instructions take this many bytes. */ | 1141 | /* Instructions take this many bytes. */ |
1389 | TILE_BUNDLE_SIZE_IN_BYTES = 1 << TILE_LOG2_BUNDLE_SIZE_IN_BYTES, | 1142 | TILEGX_BUNDLE_SIZE_IN_BYTES = 1 << TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES, |
1390 | 1143 | ||
1391 | /* Log base 2 of TILE_BUNDLE_ALIGNMENT_IN_BYTES. */ | 1144 | /* Log base 2 of TILEGX_BUNDLE_ALIGNMENT_IN_BYTES. */ |
1392 | TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3, | 1145 | TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3, |
1393 | 1146 | ||
1394 | /* Bundles should be aligned modulo this number of bytes. */ | 1147 | /* Bundles should be aligned modulo this number of bytes. */ |
1395 | TILE_BUNDLE_ALIGNMENT_IN_BYTES = | 1148 | TILEGX_BUNDLE_ALIGNMENT_IN_BYTES = |
1396 | (1 << TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES), | 1149 | (1 << TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES), |
1397 | |||
1398 | /* Log base 2 of TILE_SN_INSTRUCTION_SIZE_IN_BYTES. */ | ||
1399 | TILE_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES = 1, | ||
1400 | |||
1401 | /* Static network instructions take this many bytes. */ | ||
1402 | TILE_SN_INSTRUCTION_SIZE_IN_BYTES = | ||
1403 | (1 << TILE_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES), | ||
1404 | 1150 | ||
1405 | /* Number of registers (some are magic, such as network I/O). */ | 1151 | /* Number of registers (some are magic, such as network I/O). */ |
1406 | TILE_NUM_REGISTERS = 64, | 1152 | TILEGX_NUM_REGISTERS = 64, |
1407 | |||
1408 | /* Number of static network registers. */ | ||
1409 | TILE_NUM_SN_REGISTERS = 4 | ||
1410 | }; | 1153 | }; |
1411 | 1154 | ||
1412 | 1155 | ||
1413 | struct tile_operand | 1156 | struct tilegx_operand |
1414 | { | 1157 | { |
1415 | /* Is this operand a register, immediate or address? */ | 1158 | /* Is this operand a register, immediate or address? */ |
1416 | tile_operand_type type; | 1159 | tilegx_operand_type type; |
1417 | 1160 | ||
1418 | /* The default relocation type for this operand. */ | 1161 | /* The default relocation type for this operand. */ |
1419 | signed int default_reloc : 16; | 1162 | signed int default_reloc : 16; |
@@ -1437,27 +1180,27 @@ struct tile_operand | |||
1437 | unsigned int rightshift : 2; | 1180 | unsigned int rightshift : 2; |
1438 | 1181 | ||
1439 | /* Return the bits for this operand to be ORed into an existing bundle. */ | 1182 | /* Return the bits for this operand to be ORed into an existing bundle. */ |
1440 | tile_bundle_bits (*insert) (int op); | 1183 | tilegx_bundle_bits (*insert) (int op); |
1441 | 1184 | ||
1442 | /* Extract this operand and return it. */ | 1185 | /* Extract this operand and return it. */ |
1443 | unsigned int (*extract) (tile_bundle_bits bundle); | 1186 | unsigned int (*extract) (tilegx_bundle_bits bundle); |
1444 | }; | 1187 | }; |
1445 | 1188 | ||
1446 | 1189 | ||
1447 | extern const struct tile_operand tile_operands[]; | 1190 | extern const struct tilegx_operand tilegx_operands[]; |
1448 | 1191 | ||
1449 | /* One finite-state machine per pipe for rapid instruction decoding. */ | 1192 | /* One finite-state machine per pipe for rapid instruction decoding. */ |
1450 | extern const unsigned short * const | 1193 | extern const unsigned short * const |
1451 | tile_bundle_decoder_fsms[TILE_NUM_PIPELINE_ENCODINGS]; | 1194 | tilegx_bundle_decoder_fsms[TILEGX_NUM_PIPELINE_ENCODINGS]; |
1452 | 1195 | ||
1453 | 1196 | ||
1454 | struct tile_opcode | 1197 | struct tilegx_opcode |
1455 | { | 1198 | { |
1456 | /* The opcode mnemonic, e.g. "add" */ | 1199 | /* The opcode mnemonic, e.g. "add" */ |
1457 | const char *name; | 1200 | const char *name; |
1458 | 1201 | ||
1459 | /* The enum value for this mnemonic. */ | 1202 | /* The enum value for this mnemonic. */ |
1460 | tile_mnemonic mnemonic; | 1203 | tilegx_mnemonic mnemonic; |
1461 | 1204 | ||
1462 | /* A bit mask of which of the five pipes this instruction | 1205 | /* A bit mask of which of the five pipes this instruction |
1463 | is compatible with: | 1206 | is compatible with: |
@@ -1478,29 +1221,28 @@ struct tile_opcode | |||
1478 | unsigned char can_bundle; | 1221 | unsigned char can_bundle; |
1479 | 1222 | ||
1480 | /* The description of the operands. Each of these is an | 1223 | /* The description of the operands. Each of these is an |
1481 | * index into the tile_operands[] table. */ | 1224 | * index into the tilegx_operands[] table. */ |
1482 | unsigned char operands[TILE_NUM_PIPELINE_ENCODINGS][TILE_MAX_OPERANDS]; | 1225 | unsigned char operands[TILEGX_NUM_PIPELINE_ENCODINGS][TILEGX_MAX_OPERANDS]; |
1483 | 1226 | ||
1484 | }; | 1227 | }; |
1485 | 1228 | ||
1486 | extern const struct tile_opcode tile_opcodes[]; | 1229 | extern const struct tilegx_opcode tilegx_opcodes[]; |
1487 | |||
1488 | 1230 | ||
1489 | /* Used for non-textual disassembly into structs. */ | 1231 | /* Used for non-textual disassembly into structs. */ |
1490 | struct tile_decoded_instruction | 1232 | struct tilegx_decoded_instruction |
1491 | { | 1233 | { |
1492 | const struct tile_opcode *opcode; | 1234 | const struct tilegx_opcode *opcode; |
1493 | const struct tile_operand *operands[TILE_MAX_OPERANDS]; | 1235 | const struct tilegx_operand *operands[TILEGX_MAX_OPERANDS]; |
1494 | int operand_values[TILE_MAX_OPERANDS]; | 1236 | long long operand_values[TILEGX_MAX_OPERANDS]; |
1495 | }; | 1237 | }; |
1496 | 1238 | ||
1497 | 1239 | ||
1498 | /* Disassemble a bundle into a struct for machine processing. */ | 1240 | /* Disassemble a bundle into a struct for machine processing. */ |
1499 | extern int parse_insn_tile(tile_bundle_bits bits, | 1241 | extern int parse_insn_tilegx(tilegx_bundle_bits bits, |
1500 | unsigned int pc, | 1242 | unsigned long long pc, |
1501 | struct tile_decoded_instruction | 1243 | struct tilegx_decoded_instruction |
1502 | decoded[TILE_MAX_INSTRUCTIONS_PER_BUNDLE]); | 1244 | decoded[TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE]); |
1503 | 1245 | ||
1504 | 1246 | ||
1505 | 1247 | ||
1506 | #endif /* opcode_tile_h */ | 1248 | #endif /* opcode_tilegx_h */ |
diff --git a/arch/tile/include/asm/opcode_constants_64.h b/arch/tile/include/asm/opcode_constants_64.h index 227d033b180c..710192869476 100644 --- a/arch/tile/include/asm/opcode_constants_64.h +++ b/arch/tile/include/asm/opcode_constants_64.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2010 Tilera Corporation. All Rights Reserved. | 2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
@@ -19,462 +19,591 @@ | |||
19 | #define _TILE_OPCODE_CONSTANTS_H | 19 | #define _TILE_OPCODE_CONSTANTS_H |
20 | enum | 20 | enum |
21 | { | 21 | { |
22 | ADDBS_U_SPECIAL_0_OPCODE_X0 = 98, | 22 | ADDI_IMM8_OPCODE_X0 = 1, |
23 | ADDBS_U_SPECIAL_0_OPCODE_X1 = 68, | 23 | ADDI_IMM8_OPCODE_X1 = 1, |
24 | ADDB_SPECIAL_0_OPCODE_X0 = 1, | 24 | ADDI_OPCODE_Y0 = 0, |
25 | ADDB_SPECIAL_0_OPCODE_X1 = 1, | 25 | ADDI_OPCODE_Y1 = 1, |
26 | ADDHS_SPECIAL_0_OPCODE_X0 = 99, | 26 | ADDLI_OPCODE_X0 = 1, |
27 | ADDHS_SPECIAL_0_OPCODE_X1 = 69, | 27 | ADDLI_OPCODE_X1 = 0, |
28 | ADDH_SPECIAL_0_OPCODE_X0 = 2, | 28 | ADDXI_IMM8_OPCODE_X0 = 2, |
29 | ADDH_SPECIAL_0_OPCODE_X1 = 2, | 29 | ADDXI_IMM8_OPCODE_X1 = 2, |
30 | ADDIB_IMM_0_OPCODE_X0 = 1, | 30 | ADDXI_OPCODE_Y0 = 1, |
31 | ADDIB_IMM_0_OPCODE_X1 = 1, | 31 | ADDXI_OPCODE_Y1 = 2, |
32 | ADDIH_IMM_0_OPCODE_X0 = 2, | 32 | ADDXLI_OPCODE_X0 = 2, |
33 | ADDIH_IMM_0_OPCODE_X1 = 2, | 33 | ADDXLI_OPCODE_X1 = 1, |
34 | ADDI_IMM_0_OPCODE_X0 = 3, | 34 | ADDXSC_RRR_0_OPCODE_X0 = 1, |
35 | ADDI_IMM_0_OPCODE_X1 = 3, | 35 | ADDXSC_RRR_0_OPCODE_X1 = 1, |
36 | ADDI_IMM_1_OPCODE_SN = 1, | 36 | ADDX_RRR_0_OPCODE_X0 = 2, |
37 | ADDI_OPCODE_Y0 = 9, | 37 | ADDX_RRR_0_OPCODE_X1 = 2, |
38 | ADDI_OPCODE_Y1 = 7, | 38 | ADDX_RRR_0_OPCODE_Y0 = 0, |
39 | ADDLIS_OPCODE_X0 = 1, | 39 | ADDX_SPECIAL_0_OPCODE_Y1 = 0, |
40 | ADDLIS_OPCODE_X1 = 2, | 40 | ADD_RRR_0_OPCODE_X0 = 3, |
41 | ADDLI_OPCODE_X0 = 2, | 41 | ADD_RRR_0_OPCODE_X1 = 3, |
42 | ADDLI_OPCODE_X1 = 3, | 42 | ADD_RRR_0_OPCODE_Y0 = 1, |
43 | ADDS_SPECIAL_0_OPCODE_X0 = 96, | 43 | ADD_SPECIAL_0_OPCODE_Y1 = 1, |
44 | ADDS_SPECIAL_0_OPCODE_X1 = 66, | 44 | ANDI_IMM8_OPCODE_X0 = 3, |
45 | ADD_SPECIAL_0_OPCODE_X0 = 3, | 45 | ANDI_IMM8_OPCODE_X1 = 3, |
46 | ADD_SPECIAL_0_OPCODE_X1 = 3, | 46 | ANDI_OPCODE_Y0 = 2, |
47 | ADD_SPECIAL_0_OPCODE_Y0 = 0, | 47 | ANDI_OPCODE_Y1 = 3, |
48 | ADD_SPECIAL_0_OPCODE_Y1 = 0, | 48 | AND_RRR_0_OPCODE_X0 = 4, |
49 | ADIFFB_U_SPECIAL_0_OPCODE_X0 = 4, | 49 | AND_RRR_0_OPCODE_X1 = 4, |
50 | ADIFFH_SPECIAL_0_OPCODE_X0 = 5, | 50 | AND_RRR_5_OPCODE_Y0 = 0, |
51 | ANDI_IMM_0_OPCODE_X0 = 1, | 51 | AND_RRR_5_OPCODE_Y1 = 0, |
52 | ANDI_IMM_0_OPCODE_X1 = 4, | 52 | BEQZT_BRANCH_OPCODE_X1 = 16, |
53 | ANDI_OPCODE_Y0 = 10, | 53 | BEQZ_BRANCH_OPCODE_X1 = 17, |
54 | ANDI_OPCODE_Y1 = 8, | 54 | BFEXTS_BF_OPCODE_X0 = 4, |
55 | AND_SPECIAL_0_OPCODE_X0 = 6, | 55 | BFEXTU_BF_OPCODE_X0 = 5, |
56 | AND_SPECIAL_0_OPCODE_X1 = 4, | 56 | BFINS_BF_OPCODE_X0 = 6, |
57 | AND_SPECIAL_2_OPCODE_Y0 = 0, | 57 | BF_OPCODE_X0 = 3, |
58 | AND_SPECIAL_2_OPCODE_Y1 = 0, | 58 | BGEZT_BRANCH_OPCODE_X1 = 18, |
59 | AULI_OPCODE_X0 = 3, | 59 | BGEZ_BRANCH_OPCODE_X1 = 19, |
60 | AULI_OPCODE_X1 = 4, | 60 | BGTZT_BRANCH_OPCODE_X1 = 20, |
61 | AVGB_U_SPECIAL_0_OPCODE_X0 = 7, | 61 | BGTZ_BRANCH_OPCODE_X1 = 21, |
62 | AVGH_SPECIAL_0_OPCODE_X0 = 8, | 62 | BLBCT_BRANCH_OPCODE_X1 = 22, |
63 | BBNST_BRANCH_OPCODE_X1 = 15, | 63 | BLBC_BRANCH_OPCODE_X1 = 23, |
64 | BBNS_BRANCH_OPCODE_X1 = 14, | 64 | BLBST_BRANCH_OPCODE_X1 = 24, |
65 | BBNS_OPCODE_SN = 63, | 65 | BLBS_BRANCH_OPCODE_X1 = 25, |
66 | BBST_BRANCH_OPCODE_X1 = 13, | 66 | BLEZT_BRANCH_OPCODE_X1 = 26, |
67 | BBS_BRANCH_OPCODE_X1 = 12, | 67 | BLEZ_BRANCH_OPCODE_X1 = 27, |
68 | BBS_OPCODE_SN = 62, | 68 | BLTZT_BRANCH_OPCODE_X1 = 28, |
69 | BGEZT_BRANCH_OPCODE_X1 = 7, | 69 | BLTZ_BRANCH_OPCODE_X1 = 29, |
70 | BGEZ_BRANCH_OPCODE_X1 = 6, | 70 | BNEZT_BRANCH_OPCODE_X1 = 30, |
71 | BGEZ_OPCODE_SN = 61, | 71 | BNEZ_BRANCH_OPCODE_X1 = 31, |
72 | BGZT_BRANCH_OPCODE_X1 = 5, | 72 | BRANCH_OPCODE_X1 = 2, |
73 | BGZ_BRANCH_OPCODE_X1 = 4, | 73 | CMOVEQZ_RRR_0_OPCODE_X0 = 5, |
74 | BGZ_OPCODE_SN = 58, | 74 | CMOVEQZ_RRR_4_OPCODE_Y0 = 0, |
75 | BITX_UN_0_SHUN_0_OPCODE_X0 = 1, | 75 | CMOVNEZ_RRR_0_OPCODE_X0 = 6, |
76 | BITX_UN_0_SHUN_0_OPCODE_Y0 = 1, | 76 | CMOVNEZ_RRR_4_OPCODE_Y0 = 1, |
77 | BLEZT_BRANCH_OPCODE_X1 = 11, | 77 | CMPEQI_IMM8_OPCODE_X0 = 4, |
78 | BLEZ_BRANCH_OPCODE_X1 = 10, | 78 | CMPEQI_IMM8_OPCODE_X1 = 4, |
79 | BLEZ_OPCODE_SN = 59, | 79 | CMPEQI_OPCODE_Y0 = 3, |
80 | BLZT_BRANCH_OPCODE_X1 = 9, | 80 | CMPEQI_OPCODE_Y1 = 4, |
81 | BLZ_BRANCH_OPCODE_X1 = 8, | 81 | CMPEQ_RRR_0_OPCODE_X0 = 7, |
82 | BLZ_OPCODE_SN = 60, | 82 | CMPEQ_RRR_0_OPCODE_X1 = 5, |
83 | BNZT_BRANCH_OPCODE_X1 = 3, | 83 | CMPEQ_RRR_3_OPCODE_Y0 = 0, |
84 | BNZ_BRANCH_OPCODE_X1 = 2, | 84 | CMPEQ_RRR_3_OPCODE_Y1 = 2, |
85 | BNZ_OPCODE_SN = 57, | 85 | CMPEXCH4_RRR_0_OPCODE_X1 = 6, |
86 | BPT_NOREG_RR_IMM_0_OPCODE_SN = 1, | 86 | CMPEXCH_RRR_0_OPCODE_X1 = 7, |
87 | BRANCH_OPCODE_X1 = 5, | 87 | CMPLES_RRR_0_OPCODE_X0 = 8, |
88 | BYTEX_UN_0_SHUN_0_OPCODE_X0 = 2, | 88 | CMPLES_RRR_0_OPCODE_X1 = 8, |
89 | BYTEX_UN_0_SHUN_0_OPCODE_Y0 = 2, | 89 | CMPLES_RRR_2_OPCODE_Y0 = 0, |
90 | BZT_BRANCH_OPCODE_X1 = 1, | 90 | CMPLES_RRR_2_OPCODE_Y1 = 0, |
91 | BZ_BRANCH_OPCODE_X1 = 0, | 91 | CMPLEU_RRR_0_OPCODE_X0 = 9, |
92 | BZ_OPCODE_SN = 56, | 92 | CMPLEU_RRR_0_OPCODE_X1 = 9, |
93 | CLZ_UN_0_SHUN_0_OPCODE_X0 = 3, | 93 | CMPLEU_RRR_2_OPCODE_Y0 = 1, |
94 | CLZ_UN_0_SHUN_0_OPCODE_Y0 = 3, | 94 | CMPLEU_RRR_2_OPCODE_Y1 = 1, |
95 | CRC32_32_SPECIAL_0_OPCODE_X0 = 9, | 95 | CMPLTSI_IMM8_OPCODE_X0 = 5, |
96 | CRC32_8_SPECIAL_0_OPCODE_X0 = 10, | 96 | CMPLTSI_IMM8_OPCODE_X1 = 5, |
97 | CTZ_UN_0_SHUN_0_OPCODE_X0 = 4, | 97 | CMPLTSI_OPCODE_Y0 = 4, |
98 | CTZ_UN_0_SHUN_0_OPCODE_Y0 = 4, | 98 | CMPLTSI_OPCODE_Y1 = 5, |
99 | DRAIN_UN_0_SHUN_0_OPCODE_X1 = 1, | 99 | CMPLTS_RRR_0_OPCODE_X0 = 10, |
100 | DTLBPR_UN_0_SHUN_0_OPCODE_X1 = 2, | 100 | CMPLTS_RRR_0_OPCODE_X1 = 10, |
101 | DWORD_ALIGN_SPECIAL_0_OPCODE_X0 = 95, | 101 | CMPLTS_RRR_2_OPCODE_Y0 = 2, |
102 | FINV_UN_0_SHUN_0_OPCODE_X1 = 3, | 102 | CMPLTS_RRR_2_OPCODE_Y1 = 2, |
103 | FLUSH_UN_0_SHUN_0_OPCODE_X1 = 4, | 103 | CMPLTUI_IMM8_OPCODE_X0 = 6, |
104 | FNOP_NOREG_RR_IMM_0_OPCODE_SN = 3, | 104 | CMPLTUI_IMM8_OPCODE_X1 = 6, |
105 | FNOP_UN_0_SHUN_0_OPCODE_X0 = 5, | 105 | CMPLTU_RRR_0_OPCODE_X0 = 11, |
106 | FNOP_UN_0_SHUN_0_OPCODE_X1 = 5, | 106 | CMPLTU_RRR_0_OPCODE_X1 = 11, |
107 | FNOP_UN_0_SHUN_0_OPCODE_Y0 = 5, | 107 | CMPLTU_RRR_2_OPCODE_Y0 = 3, |
108 | FNOP_UN_0_SHUN_0_OPCODE_Y1 = 1, | 108 | CMPLTU_RRR_2_OPCODE_Y1 = 3, |
109 | HALT_NOREG_RR_IMM_0_OPCODE_SN = 0, | 109 | CMPNE_RRR_0_OPCODE_X0 = 12, |
110 | ICOH_UN_0_SHUN_0_OPCODE_X1 = 6, | 110 | CMPNE_RRR_0_OPCODE_X1 = 12, |
111 | ILL_UN_0_SHUN_0_OPCODE_X1 = 7, | 111 | CMPNE_RRR_3_OPCODE_Y0 = 1, |
112 | ILL_UN_0_SHUN_0_OPCODE_Y1 = 2, | 112 | CMPNE_RRR_3_OPCODE_Y1 = 3, |
113 | IMM_0_OPCODE_SN = 0, | 113 | CMULAF_RRR_0_OPCODE_X0 = 13, |
114 | IMM_0_OPCODE_X0 = 4, | 114 | CMULA_RRR_0_OPCODE_X0 = 14, |
115 | IMM_0_OPCODE_X1 = 6, | 115 | CMULFR_RRR_0_OPCODE_X0 = 15, |
116 | IMM_1_OPCODE_SN = 1, | 116 | CMULF_RRR_0_OPCODE_X0 = 16, |
117 | IMM_OPCODE_0_X0 = 5, | 117 | CMULHR_RRR_0_OPCODE_X0 = 17, |
118 | INTHB_SPECIAL_0_OPCODE_X0 = 11, | 118 | CMULH_RRR_0_OPCODE_X0 = 18, |
119 | INTHB_SPECIAL_0_OPCODE_X1 = 5, | 119 | CMUL_RRR_0_OPCODE_X0 = 19, |
120 | INTHH_SPECIAL_0_OPCODE_X0 = 12, | 120 | CNTLZ_UNARY_OPCODE_X0 = 1, |
121 | INTHH_SPECIAL_0_OPCODE_X1 = 6, | 121 | CNTLZ_UNARY_OPCODE_Y0 = 1, |
122 | INTLB_SPECIAL_0_OPCODE_X0 = 13, | 122 | CNTTZ_UNARY_OPCODE_X0 = 2, |
123 | INTLB_SPECIAL_0_OPCODE_X1 = 7, | 123 | CNTTZ_UNARY_OPCODE_Y0 = 2, |
124 | INTLH_SPECIAL_0_OPCODE_X0 = 14, | 124 | CRC32_32_RRR_0_OPCODE_X0 = 20, |
125 | INTLH_SPECIAL_0_OPCODE_X1 = 8, | 125 | CRC32_8_RRR_0_OPCODE_X0 = 21, |
126 | INV_UN_0_SHUN_0_OPCODE_X1 = 8, | 126 | DBLALIGN2_RRR_0_OPCODE_X0 = 22, |
127 | IRET_UN_0_SHUN_0_OPCODE_X1 = 9, | 127 | DBLALIGN2_RRR_0_OPCODE_X1 = 13, |
128 | JALB_OPCODE_X1 = 13, | 128 | DBLALIGN4_RRR_0_OPCODE_X0 = 23, |
129 | JALF_OPCODE_X1 = 12, | 129 | DBLALIGN4_RRR_0_OPCODE_X1 = 14, |
130 | JALRP_SPECIAL_0_OPCODE_X1 = 9, | 130 | DBLALIGN6_RRR_0_OPCODE_X0 = 24, |
131 | JALRR_IMM_1_OPCODE_SN = 3, | 131 | DBLALIGN6_RRR_0_OPCODE_X1 = 15, |
132 | JALR_RR_IMM_0_OPCODE_SN = 5, | 132 | DBLALIGN_RRR_0_OPCODE_X0 = 25, |
133 | JALR_SPECIAL_0_OPCODE_X1 = 10, | 133 | DRAIN_UNARY_OPCODE_X1 = 1, |
134 | JB_OPCODE_X1 = 11, | 134 | DTLBPR_UNARY_OPCODE_X1 = 2, |
135 | JF_OPCODE_X1 = 10, | 135 | EXCH4_RRR_0_OPCODE_X1 = 16, |
136 | JRP_SPECIAL_0_OPCODE_X1 = 11, | 136 | EXCH_RRR_0_OPCODE_X1 = 17, |
137 | JRR_IMM_1_OPCODE_SN = 2, | 137 | FDOUBLE_ADDSUB_RRR_0_OPCODE_X0 = 26, |
138 | JR_RR_IMM_0_OPCODE_SN = 4, | 138 | FDOUBLE_ADD_FLAGS_RRR_0_OPCODE_X0 = 27, |
139 | JR_SPECIAL_0_OPCODE_X1 = 12, | 139 | FDOUBLE_MUL_FLAGS_RRR_0_OPCODE_X0 = 28, |
140 | LBADD_IMM_0_OPCODE_X1 = 22, | 140 | FDOUBLE_PACK1_RRR_0_OPCODE_X0 = 29, |
141 | LBADD_U_IMM_0_OPCODE_X1 = 23, | 141 | FDOUBLE_PACK2_RRR_0_OPCODE_X0 = 30, |
142 | LB_OPCODE_Y2 = 0, | 142 | FDOUBLE_SUB_FLAGS_RRR_0_OPCODE_X0 = 31, |
143 | LB_UN_0_SHUN_0_OPCODE_X1 = 10, | 143 | FDOUBLE_UNPACK_MAX_RRR_0_OPCODE_X0 = 32, |
144 | LB_U_OPCODE_Y2 = 1, | 144 | FDOUBLE_UNPACK_MIN_RRR_0_OPCODE_X0 = 33, |
145 | LB_U_UN_0_SHUN_0_OPCODE_X1 = 11, | 145 | FETCHADD4_RRR_0_OPCODE_X1 = 18, |
146 | LHADD_IMM_0_OPCODE_X1 = 24, | 146 | FETCHADDGEZ4_RRR_0_OPCODE_X1 = 19, |
147 | LHADD_U_IMM_0_OPCODE_X1 = 25, | 147 | FETCHADDGEZ_RRR_0_OPCODE_X1 = 20, |
148 | LH_OPCODE_Y2 = 2, | 148 | FETCHADD_RRR_0_OPCODE_X1 = 21, |
149 | LH_UN_0_SHUN_0_OPCODE_X1 = 12, | 149 | FETCHAND4_RRR_0_OPCODE_X1 = 22, |
150 | LH_U_OPCODE_Y2 = 3, | 150 | FETCHAND_RRR_0_OPCODE_X1 = 23, |
151 | LH_U_UN_0_SHUN_0_OPCODE_X1 = 13, | 151 | FETCHOR4_RRR_0_OPCODE_X1 = 24, |
152 | LNK_SPECIAL_0_OPCODE_X1 = 13, | 152 | FETCHOR_RRR_0_OPCODE_X1 = 25, |
153 | LWADD_IMM_0_OPCODE_X1 = 26, | 153 | FINV_UNARY_OPCODE_X1 = 3, |
154 | LWADD_NA_IMM_0_OPCODE_X1 = 27, | 154 | FLUSHWB_UNARY_OPCODE_X1 = 4, |
155 | LW_NA_UN_0_SHUN_0_OPCODE_X1 = 24, | 155 | FLUSH_UNARY_OPCODE_X1 = 5, |
156 | LW_OPCODE_Y2 = 4, | 156 | FNOP_UNARY_OPCODE_X0 = 3, |
157 | LW_UN_0_SHUN_0_OPCODE_X1 = 14, | 157 | FNOP_UNARY_OPCODE_X1 = 6, |
158 | MAXB_U_SPECIAL_0_OPCODE_X0 = 15, | 158 | FNOP_UNARY_OPCODE_Y0 = 3, |
159 | MAXB_U_SPECIAL_0_OPCODE_X1 = 14, | 159 | FNOP_UNARY_OPCODE_Y1 = 8, |
160 | MAXH_SPECIAL_0_OPCODE_X0 = 16, | 160 | FSINGLE_ADD1_RRR_0_OPCODE_X0 = 34, |
161 | MAXH_SPECIAL_0_OPCODE_X1 = 15, | 161 | FSINGLE_ADDSUB2_RRR_0_OPCODE_X0 = 35, |
162 | MAXIB_U_IMM_0_OPCODE_X0 = 4, | 162 | FSINGLE_MUL1_RRR_0_OPCODE_X0 = 36, |
163 | MAXIB_U_IMM_0_OPCODE_X1 = 5, | 163 | FSINGLE_MUL2_RRR_0_OPCODE_X0 = 37, |
164 | MAXIH_IMM_0_OPCODE_X0 = 5, | 164 | FSINGLE_PACK1_UNARY_OPCODE_X0 = 4, |
165 | MAXIH_IMM_0_OPCODE_X1 = 6, | 165 | FSINGLE_PACK1_UNARY_OPCODE_Y0 = 4, |
166 | MFSPR_IMM_0_OPCODE_X1 = 7, | 166 | FSINGLE_PACK2_RRR_0_OPCODE_X0 = 38, |
167 | MF_UN_0_SHUN_0_OPCODE_X1 = 15, | 167 | FSINGLE_SUB1_RRR_0_OPCODE_X0 = 39, |
168 | MINB_U_SPECIAL_0_OPCODE_X0 = 17, | 168 | ICOH_UNARY_OPCODE_X1 = 7, |
169 | MINB_U_SPECIAL_0_OPCODE_X1 = 16, | 169 | ILL_UNARY_OPCODE_X1 = 8, |
170 | MINH_SPECIAL_0_OPCODE_X0 = 18, | 170 | ILL_UNARY_OPCODE_Y1 = 9, |
171 | MINH_SPECIAL_0_OPCODE_X1 = 17, | 171 | IMM8_OPCODE_X0 = 4, |
172 | MINIB_U_IMM_0_OPCODE_X0 = 6, | 172 | IMM8_OPCODE_X1 = 3, |
173 | MINIB_U_IMM_0_OPCODE_X1 = 8, | 173 | INV_UNARY_OPCODE_X1 = 9, |
174 | MINIH_IMM_0_OPCODE_X0 = 7, | 174 | IRET_UNARY_OPCODE_X1 = 10, |
175 | MINIH_IMM_0_OPCODE_X1 = 9, | 175 | JALRP_UNARY_OPCODE_X1 = 11, |
176 | MM_OPCODE_X0 = 6, | 176 | JALRP_UNARY_OPCODE_Y1 = 10, |
177 | MM_OPCODE_X1 = 7, | 177 | JALR_UNARY_OPCODE_X1 = 12, |
178 | MNZB_SPECIAL_0_OPCODE_X0 = 19, | 178 | JALR_UNARY_OPCODE_Y1 = 11, |
179 | MNZB_SPECIAL_0_OPCODE_X1 = 18, | 179 | JAL_JUMP_OPCODE_X1 = 0, |
180 | MNZH_SPECIAL_0_OPCODE_X0 = 20, | 180 | JRP_UNARY_OPCODE_X1 = 13, |
181 | MNZH_SPECIAL_0_OPCODE_X1 = 19, | 181 | JRP_UNARY_OPCODE_Y1 = 12, |
182 | MNZ_SPECIAL_0_OPCODE_X0 = 21, | 182 | JR_UNARY_OPCODE_X1 = 14, |
183 | MNZ_SPECIAL_0_OPCODE_X1 = 20, | 183 | JR_UNARY_OPCODE_Y1 = 13, |
184 | MNZ_SPECIAL_1_OPCODE_Y0 = 0, | 184 | JUMP_OPCODE_X1 = 4, |
185 | MNZ_SPECIAL_1_OPCODE_Y1 = 1, | 185 | J_JUMP_OPCODE_X1 = 1, |
186 | MOVEI_IMM_1_OPCODE_SN = 0, | 186 | LD1S_ADD_IMM8_OPCODE_X1 = 7, |
187 | MOVE_RR_IMM_0_OPCODE_SN = 8, | 187 | LD1S_OPCODE_Y2 = 0, |
188 | MTSPR_IMM_0_OPCODE_X1 = 10, | 188 | LD1S_UNARY_OPCODE_X1 = 15, |
189 | MULHHA_SS_SPECIAL_0_OPCODE_X0 = 22, | 189 | LD1U_ADD_IMM8_OPCODE_X1 = 8, |
190 | MULHHA_SS_SPECIAL_7_OPCODE_Y0 = 0, | 190 | LD1U_OPCODE_Y2 = 1, |
191 | MULHHA_SU_SPECIAL_0_OPCODE_X0 = 23, | 191 | LD1U_UNARY_OPCODE_X1 = 16, |
192 | MULHHA_UU_SPECIAL_0_OPCODE_X0 = 24, | 192 | LD2S_ADD_IMM8_OPCODE_X1 = 9, |
193 | MULHHA_UU_SPECIAL_7_OPCODE_Y0 = 1, | 193 | LD2S_OPCODE_Y2 = 2, |
194 | MULHHSA_UU_SPECIAL_0_OPCODE_X0 = 25, | 194 | LD2S_UNARY_OPCODE_X1 = 17, |
195 | MULHH_SS_SPECIAL_0_OPCODE_X0 = 26, | 195 | LD2U_ADD_IMM8_OPCODE_X1 = 10, |
196 | MULHH_SS_SPECIAL_6_OPCODE_Y0 = 0, | 196 | LD2U_OPCODE_Y2 = 3, |
197 | MULHH_SU_SPECIAL_0_OPCODE_X0 = 27, | 197 | LD2U_UNARY_OPCODE_X1 = 18, |
198 | MULHH_UU_SPECIAL_0_OPCODE_X0 = 28, | 198 | LD4S_ADD_IMM8_OPCODE_X1 = 11, |
199 | MULHH_UU_SPECIAL_6_OPCODE_Y0 = 1, | 199 | LD4S_OPCODE_Y2 = 1, |
200 | MULHLA_SS_SPECIAL_0_OPCODE_X0 = 29, | 200 | LD4S_UNARY_OPCODE_X1 = 19, |
201 | MULHLA_SU_SPECIAL_0_OPCODE_X0 = 30, | 201 | LD4U_ADD_IMM8_OPCODE_X1 = 12, |
202 | MULHLA_US_SPECIAL_0_OPCODE_X0 = 31, | 202 | LD4U_OPCODE_Y2 = 2, |
203 | MULHLA_UU_SPECIAL_0_OPCODE_X0 = 32, | 203 | LD4U_UNARY_OPCODE_X1 = 20, |
204 | MULHLSA_UU_SPECIAL_0_OPCODE_X0 = 33, | 204 | LDNA_UNARY_OPCODE_X1 = 21, |
205 | MULHLSA_UU_SPECIAL_5_OPCODE_Y0 = 0, | 205 | LDNT1S_ADD_IMM8_OPCODE_X1 = 13, |
206 | MULHL_SS_SPECIAL_0_OPCODE_X0 = 34, | 206 | LDNT1S_UNARY_OPCODE_X1 = 22, |
207 | MULHL_SU_SPECIAL_0_OPCODE_X0 = 35, | 207 | LDNT1U_ADD_IMM8_OPCODE_X1 = 14, |
208 | MULHL_US_SPECIAL_0_OPCODE_X0 = 36, | 208 | LDNT1U_UNARY_OPCODE_X1 = 23, |
209 | MULHL_UU_SPECIAL_0_OPCODE_X0 = 37, | 209 | LDNT2S_ADD_IMM8_OPCODE_X1 = 15, |
210 | MULLLA_SS_SPECIAL_0_OPCODE_X0 = 38, | 210 | LDNT2S_UNARY_OPCODE_X1 = 24, |
211 | MULLLA_SS_SPECIAL_7_OPCODE_Y0 = 2, | 211 | LDNT2U_ADD_IMM8_OPCODE_X1 = 16, |
212 | MULLLA_SU_SPECIAL_0_OPCODE_X0 = 39, | 212 | LDNT2U_UNARY_OPCODE_X1 = 25, |
213 | MULLLA_UU_SPECIAL_0_OPCODE_X0 = 40, | 213 | LDNT4S_ADD_IMM8_OPCODE_X1 = 17, |
214 | MULLLA_UU_SPECIAL_7_OPCODE_Y0 = 3, | 214 | LDNT4S_UNARY_OPCODE_X1 = 26, |
215 | MULLLSA_UU_SPECIAL_0_OPCODE_X0 = 41, | 215 | LDNT4U_ADD_IMM8_OPCODE_X1 = 18, |
216 | MULLL_SS_SPECIAL_0_OPCODE_X0 = 42, | 216 | LDNT4U_UNARY_OPCODE_X1 = 27, |
217 | MULLL_SS_SPECIAL_6_OPCODE_Y0 = 2, | 217 | LDNT_ADD_IMM8_OPCODE_X1 = 19, |
218 | MULLL_SU_SPECIAL_0_OPCODE_X0 = 43, | 218 | LDNT_UNARY_OPCODE_X1 = 28, |
219 | MULLL_UU_SPECIAL_0_OPCODE_X0 = 44, | 219 | LD_ADD_IMM8_OPCODE_X1 = 20, |
220 | MULLL_UU_SPECIAL_6_OPCODE_Y0 = 3, | 220 | LD_OPCODE_Y2 = 3, |
221 | MVNZ_SPECIAL_0_OPCODE_X0 = 45, | 221 | LD_UNARY_OPCODE_X1 = 29, |
222 | MVNZ_SPECIAL_1_OPCODE_Y0 = 1, | 222 | LNK_UNARY_OPCODE_X1 = 30, |
223 | MVZ_SPECIAL_0_OPCODE_X0 = 46, | 223 | LNK_UNARY_OPCODE_Y1 = 14, |
224 | MVZ_SPECIAL_1_OPCODE_Y0 = 2, | 224 | LWNA_ADD_IMM8_OPCODE_X1 = 21, |
225 | MZB_SPECIAL_0_OPCODE_X0 = 47, | 225 | MFSPR_IMM8_OPCODE_X1 = 22, |
226 | MZB_SPECIAL_0_OPCODE_X1 = 21, | 226 | MF_UNARY_OPCODE_X1 = 31, |
227 | MZH_SPECIAL_0_OPCODE_X0 = 48, | 227 | MM_BF_OPCODE_X0 = 7, |
228 | MZH_SPECIAL_0_OPCODE_X1 = 22, | 228 | MNZ_RRR_0_OPCODE_X0 = 40, |
229 | MZ_SPECIAL_0_OPCODE_X0 = 49, | 229 | MNZ_RRR_0_OPCODE_X1 = 26, |
230 | MZ_SPECIAL_0_OPCODE_X1 = 23, | 230 | MNZ_RRR_4_OPCODE_Y0 = 2, |
231 | MZ_SPECIAL_1_OPCODE_Y0 = 3, | 231 | MNZ_RRR_4_OPCODE_Y1 = 2, |
232 | MZ_SPECIAL_1_OPCODE_Y1 = 2, | 232 | MODE_OPCODE_YA2 = 1, |
233 | NAP_UN_0_SHUN_0_OPCODE_X1 = 16, | 233 | MODE_OPCODE_YB2 = 2, |
234 | NOP_NOREG_RR_IMM_0_OPCODE_SN = 2, | 234 | MODE_OPCODE_YC2 = 3, |
235 | NOP_UN_0_SHUN_0_OPCODE_X0 = 6, | 235 | MTSPR_IMM8_OPCODE_X1 = 23, |
236 | NOP_UN_0_SHUN_0_OPCODE_X1 = 17, | 236 | MULAX_RRR_0_OPCODE_X0 = 41, |
237 | NOP_UN_0_SHUN_0_OPCODE_Y0 = 6, | 237 | MULAX_RRR_3_OPCODE_Y0 = 2, |
238 | NOP_UN_0_SHUN_0_OPCODE_Y1 = 3, | 238 | MULA_HS_HS_RRR_0_OPCODE_X0 = 42, |
239 | NOREG_RR_IMM_0_OPCODE_SN = 0, | 239 | MULA_HS_HS_RRR_9_OPCODE_Y0 = 0, |
240 | NOR_SPECIAL_0_OPCODE_X0 = 50, | 240 | MULA_HS_HU_RRR_0_OPCODE_X0 = 43, |
241 | NOR_SPECIAL_0_OPCODE_X1 = 24, | 241 | MULA_HS_LS_RRR_0_OPCODE_X0 = 44, |
242 | NOR_SPECIAL_2_OPCODE_Y0 = 1, | 242 | MULA_HS_LU_RRR_0_OPCODE_X0 = 45, |
243 | NOR_SPECIAL_2_OPCODE_Y1 = 1, | 243 | MULA_HU_HU_RRR_0_OPCODE_X0 = 46, |
244 | ORI_IMM_0_OPCODE_X0 = 8, | 244 | MULA_HU_HU_RRR_9_OPCODE_Y0 = 1, |
245 | ORI_IMM_0_OPCODE_X1 = 11, | 245 | MULA_HU_LS_RRR_0_OPCODE_X0 = 47, |
246 | ORI_OPCODE_Y0 = 11, | 246 | MULA_HU_LU_RRR_0_OPCODE_X0 = 48, |
247 | ORI_OPCODE_Y1 = 9, | 247 | MULA_LS_LS_RRR_0_OPCODE_X0 = 49, |
248 | OR_SPECIAL_0_OPCODE_X0 = 51, | 248 | MULA_LS_LS_RRR_9_OPCODE_Y0 = 2, |
249 | OR_SPECIAL_0_OPCODE_X1 = 25, | 249 | MULA_LS_LU_RRR_0_OPCODE_X0 = 50, |
250 | OR_SPECIAL_2_OPCODE_Y0 = 2, | 250 | MULA_LU_LU_RRR_0_OPCODE_X0 = 51, |
251 | OR_SPECIAL_2_OPCODE_Y1 = 2, | 251 | MULA_LU_LU_RRR_9_OPCODE_Y0 = 3, |
252 | PACKBS_U_SPECIAL_0_OPCODE_X0 = 103, | 252 | MULX_RRR_0_OPCODE_X0 = 52, |
253 | PACKBS_U_SPECIAL_0_OPCODE_X1 = 73, | 253 | MULX_RRR_3_OPCODE_Y0 = 3, |
254 | PACKHB_SPECIAL_0_OPCODE_X0 = 52, | 254 | MUL_HS_HS_RRR_0_OPCODE_X0 = 53, |
255 | PACKHB_SPECIAL_0_OPCODE_X1 = 26, | 255 | MUL_HS_HS_RRR_8_OPCODE_Y0 = 0, |
256 | PACKHS_SPECIAL_0_OPCODE_X0 = 102, | 256 | MUL_HS_HU_RRR_0_OPCODE_X0 = 54, |
257 | PACKHS_SPECIAL_0_OPCODE_X1 = 72, | 257 | MUL_HS_LS_RRR_0_OPCODE_X0 = 55, |
258 | PACKLB_SPECIAL_0_OPCODE_X0 = 53, | 258 | MUL_HS_LU_RRR_0_OPCODE_X0 = 56, |
259 | PACKLB_SPECIAL_0_OPCODE_X1 = 27, | 259 | MUL_HU_HU_RRR_0_OPCODE_X0 = 57, |
260 | PCNT_UN_0_SHUN_0_OPCODE_X0 = 7, | 260 | MUL_HU_HU_RRR_8_OPCODE_Y0 = 1, |
261 | PCNT_UN_0_SHUN_0_OPCODE_Y0 = 7, | 261 | MUL_HU_LS_RRR_0_OPCODE_X0 = 58, |
262 | RLI_SHUN_0_OPCODE_X0 = 1, | 262 | MUL_HU_LU_RRR_0_OPCODE_X0 = 59, |
263 | RLI_SHUN_0_OPCODE_X1 = 1, | 263 | MUL_LS_LS_RRR_0_OPCODE_X0 = 60, |
264 | RLI_SHUN_0_OPCODE_Y0 = 1, | 264 | MUL_LS_LS_RRR_8_OPCODE_Y0 = 2, |
265 | RLI_SHUN_0_OPCODE_Y1 = 1, | 265 | MUL_LS_LU_RRR_0_OPCODE_X0 = 61, |
266 | RL_SPECIAL_0_OPCODE_X0 = 54, | 266 | MUL_LU_LU_RRR_0_OPCODE_X0 = 62, |
267 | RL_SPECIAL_0_OPCODE_X1 = 28, | 267 | MUL_LU_LU_RRR_8_OPCODE_Y0 = 3, |
268 | RL_SPECIAL_3_OPCODE_Y0 = 0, | 268 | MZ_RRR_0_OPCODE_X0 = 63, |
269 | RL_SPECIAL_3_OPCODE_Y1 = 0, | 269 | MZ_RRR_0_OPCODE_X1 = 27, |
270 | RR_IMM_0_OPCODE_SN = 0, | 270 | MZ_RRR_4_OPCODE_Y0 = 3, |
271 | S1A_SPECIAL_0_OPCODE_X0 = 55, | 271 | MZ_RRR_4_OPCODE_Y1 = 3, |
272 | S1A_SPECIAL_0_OPCODE_X1 = 29, | 272 | NAP_UNARY_OPCODE_X1 = 32, |
273 | S1A_SPECIAL_0_OPCODE_Y0 = 1, | 273 | NOP_UNARY_OPCODE_X0 = 5, |
274 | S1A_SPECIAL_0_OPCODE_Y1 = 1, | 274 | NOP_UNARY_OPCODE_X1 = 33, |
275 | S2A_SPECIAL_0_OPCODE_X0 = 56, | 275 | NOP_UNARY_OPCODE_Y0 = 5, |
276 | S2A_SPECIAL_0_OPCODE_X1 = 30, | 276 | NOP_UNARY_OPCODE_Y1 = 15, |
277 | S2A_SPECIAL_0_OPCODE_Y0 = 2, | 277 | NOR_RRR_0_OPCODE_X0 = 64, |
278 | S2A_SPECIAL_0_OPCODE_Y1 = 2, | 278 | NOR_RRR_0_OPCODE_X1 = 28, |
279 | S3A_SPECIAL_0_OPCODE_X0 = 57, | 279 | NOR_RRR_5_OPCODE_Y0 = 1, |
280 | S3A_SPECIAL_0_OPCODE_X1 = 31, | 280 | NOR_RRR_5_OPCODE_Y1 = 1, |
281 | S3A_SPECIAL_5_OPCODE_Y0 = 1, | 281 | ORI_IMM8_OPCODE_X0 = 7, |
282 | S3A_SPECIAL_5_OPCODE_Y1 = 1, | 282 | ORI_IMM8_OPCODE_X1 = 24, |
283 | SADAB_U_SPECIAL_0_OPCODE_X0 = 58, | 283 | OR_RRR_0_OPCODE_X0 = 65, |
284 | SADAH_SPECIAL_0_OPCODE_X0 = 59, | 284 | OR_RRR_0_OPCODE_X1 = 29, |
285 | SADAH_U_SPECIAL_0_OPCODE_X0 = 60, | 285 | OR_RRR_5_OPCODE_Y0 = 2, |
286 | SADB_U_SPECIAL_0_OPCODE_X0 = 61, | 286 | OR_RRR_5_OPCODE_Y1 = 2, |
287 | SADH_SPECIAL_0_OPCODE_X0 = 62, | 287 | PCNT_UNARY_OPCODE_X0 = 6, |
288 | SADH_U_SPECIAL_0_OPCODE_X0 = 63, | 288 | PCNT_UNARY_OPCODE_Y0 = 6, |
289 | SBADD_IMM_0_OPCODE_X1 = 28, | 289 | REVBITS_UNARY_OPCODE_X0 = 7, |
290 | SB_OPCODE_Y2 = 5, | 290 | REVBITS_UNARY_OPCODE_Y0 = 7, |
291 | SB_SPECIAL_0_OPCODE_X1 = 32, | 291 | REVBYTES_UNARY_OPCODE_X0 = 8, |
292 | SEQB_SPECIAL_0_OPCODE_X0 = 64, | 292 | REVBYTES_UNARY_OPCODE_Y0 = 8, |
293 | SEQB_SPECIAL_0_OPCODE_X1 = 33, | 293 | ROTLI_SHIFT_OPCODE_X0 = 1, |
294 | SEQH_SPECIAL_0_OPCODE_X0 = 65, | 294 | ROTLI_SHIFT_OPCODE_X1 = 1, |
295 | SEQH_SPECIAL_0_OPCODE_X1 = 34, | 295 | ROTLI_SHIFT_OPCODE_Y0 = 0, |
296 | SEQIB_IMM_0_OPCODE_X0 = 9, | 296 | ROTLI_SHIFT_OPCODE_Y1 = 0, |
297 | SEQIB_IMM_0_OPCODE_X1 = 12, | 297 | ROTL_RRR_0_OPCODE_X0 = 66, |
298 | SEQIH_IMM_0_OPCODE_X0 = 10, | 298 | ROTL_RRR_0_OPCODE_X1 = 30, |
299 | SEQIH_IMM_0_OPCODE_X1 = 13, | 299 | ROTL_RRR_6_OPCODE_Y0 = 0, |
300 | SEQI_IMM_0_OPCODE_X0 = 11, | 300 | ROTL_RRR_6_OPCODE_Y1 = 0, |
301 | SEQI_IMM_0_OPCODE_X1 = 14, | 301 | RRR_0_OPCODE_X0 = 5, |
302 | SEQI_OPCODE_Y0 = 12, | 302 | RRR_0_OPCODE_X1 = 5, |
303 | SEQI_OPCODE_Y1 = 10, | 303 | RRR_0_OPCODE_Y0 = 5, |
304 | SEQ_SPECIAL_0_OPCODE_X0 = 66, | 304 | RRR_0_OPCODE_Y1 = 6, |
305 | SEQ_SPECIAL_0_OPCODE_X1 = 35, | 305 | RRR_1_OPCODE_Y0 = 6, |
306 | SEQ_SPECIAL_5_OPCODE_Y0 = 2, | 306 | RRR_1_OPCODE_Y1 = 7, |
307 | SEQ_SPECIAL_5_OPCODE_Y1 = 2, | 307 | RRR_2_OPCODE_Y0 = 7, |
308 | SHADD_IMM_0_OPCODE_X1 = 29, | 308 | RRR_2_OPCODE_Y1 = 8, |
309 | SHL8II_IMM_0_OPCODE_SN = 3, | 309 | RRR_3_OPCODE_Y0 = 8, |
310 | SHLB_SPECIAL_0_OPCODE_X0 = 67, | 310 | RRR_3_OPCODE_Y1 = 9, |
311 | SHLB_SPECIAL_0_OPCODE_X1 = 36, | 311 | RRR_4_OPCODE_Y0 = 9, |
312 | SHLH_SPECIAL_0_OPCODE_X0 = 68, | 312 | RRR_4_OPCODE_Y1 = 10, |
313 | SHLH_SPECIAL_0_OPCODE_X1 = 37, | 313 | RRR_5_OPCODE_Y0 = 10, |
314 | SHLIB_SHUN_0_OPCODE_X0 = 2, | 314 | RRR_5_OPCODE_Y1 = 11, |
315 | SHLIB_SHUN_0_OPCODE_X1 = 2, | 315 | RRR_6_OPCODE_Y0 = 11, |
316 | SHLIH_SHUN_0_OPCODE_X0 = 3, | 316 | RRR_6_OPCODE_Y1 = 12, |
317 | SHLIH_SHUN_0_OPCODE_X1 = 3, | 317 | RRR_7_OPCODE_Y0 = 12, |
318 | SHLI_SHUN_0_OPCODE_X0 = 4, | 318 | RRR_7_OPCODE_Y1 = 13, |
319 | SHLI_SHUN_0_OPCODE_X1 = 4, | 319 | RRR_8_OPCODE_Y0 = 13, |
320 | SHLI_SHUN_0_OPCODE_Y0 = 2, | 320 | RRR_9_OPCODE_Y0 = 14, |
321 | SHLI_SHUN_0_OPCODE_Y1 = 2, | 321 | SHIFT_OPCODE_X0 = 6, |
322 | SHL_SPECIAL_0_OPCODE_X0 = 69, | 322 | SHIFT_OPCODE_X1 = 6, |
323 | SHL_SPECIAL_0_OPCODE_X1 = 38, | 323 | SHIFT_OPCODE_Y0 = 15, |
324 | SHL_SPECIAL_3_OPCODE_Y0 = 1, | 324 | SHIFT_OPCODE_Y1 = 14, |
325 | SHL_SPECIAL_3_OPCODE_Y1 = 1, | 325 | SHL16INSLI_OPCODE_X0 = 7, |
326 | SHR1_RR_IMM_0_OPCODE_SN = 9, | 326 | SHL16INSLI_OPCODE_X1 = 7, |
327 | SHRB_SPECIAL_0_OPCODE_X0 = 70, | 327 | SHL1ADDX_RRR_0_OPCODE_X0 = 67, |
328 | SHRB_SPECIAL_0_OPCODE_X1 = 39, | 328 | SHL1ADDX_RRR_0_OPCODE_X1 = 31, |
329 | SHRH_SPECIAL_0_OPCODE_X0 = 71, | 329 | SHL1ADDX_RRR_7_OPCODE_Y0 = 1, |
330 | SHRH_SPECIAL_0_OPCODE_X1 = 40, | 330 | SHL1ADDX_RRR_7_OPCODE_Y1 = 1, |
331 | SHRIB_SHUN_0_OPCODE_X0 = 5, | 331 | SHL1ADD_RRR_0_OPCODE_X0 = 68, |
332 | SHRIB_SHUN_0_OPCODE_X1 = 5, | 332 | SHL1ADD_RRR_0_OPCODE_X1 = 32, |
333 | SHRIH_SHUN_0_OPCODE_X0 = 6, | 333 | SHL1ADD_RRR_1_OPCODE_Y0 = 0, |
334 | SHRIH_SHUN_0_OPCODE_X1 = 6, | 334 | SHL1ADD_RRR_1_OPCODE_Y1 = 0, |
335 | SHRI_SHUN_0_OPCODE_X0 = 7, | 335 | SHL2ADDX_RRR_0_OPCODE_X0 = 69, |
336 | SHRI_SHUN_0_OPCODE_X1 = 7, | 336 | SHL2ADDX_RRR_0_OPCODE_X1 = 33, |
337 | SHRI_SHUN_0_OPCODE_Y0 = 3, | 337 | SHL2ADDX_RRR_7_OPCODE_Y0 = 2, |
338 | SHRI_SHUN_0_OPCODE_Y1 = 3, | 338 | SHL2ADDX_RRR_7_OPCODE_Y1 = 2, |
339 | SHR_SPECIAL_0_OPCODE_X0 = 72, | 339 | SHL2ADD_RRR_0_OPCODE_X0 = 70, |
340 | SHR_SPECIAL_0_OPCODE_X1 = 41, | 340 | SHL2ADD_RRR_0_OPCODE_X1 = 34, |
341 | SHR_SPECIAL_3_OPCODE_Y0 = 2, | 341 | SHL2ADD_RRR_1_OPCODE_Y0 = 1, |
342 | SHR_SPECIAL_3_OPCODE_Y1 = 2, | 342 | SHL2ADD_RRR_1_OPCODE_Y1 = 1, |
343 | SHUN_0_OPCODE_X0 = 7, | 343 | SHL3ADDX_RRR_0_OPCODE_X0 = 71, |
344 | SHUN_0_OPCODE_X1 = 8, | 344 | SHL3ADDX_RRR_0_OPCODE_X1 = 35, |
345 | SHUN_0_OPCODE_Y0 = 13, | 345 | SHL3ADDX_RRR_7_OPCODE_Y0 = 3, |
346 | SHUN_0_OPCODE_Y1 = 11, | 346 | SHL3ADDX_RRR_7_OPCODE_Y1 = 3, |
347 | SH_OPCODE_Y2 = 6, | 347 | SHL3ADD_RRR_0_OPCODE_X0 = 72, |
348 | SH_SPECIAL_0_OPCODE_X1 = 42, | 348 | SHL3ADD_RRR_0_OPCODE_X1 = 36, |
349 | SLTB_SPECIAL_0_OPCODE_X0 = 73, | 349 | SHL3ADD_RRR_1_OPCODE_Y0 = 2, |
350 | SLTB_SPECIAL_0_OPCODE_X1 = 43, | 350 | SHL3ADD_RRR_1_OPCODE_Y1 = 2, |
351 | SLTB_U_SPECIAL_0_OPCODE_X0 = 74, | 351 | SHLI_SHIFT_OPCODE_X0 = 2, |
352 | SLTB_U_SPECIAL_0_OPCODE_X1 = 44, | 352 | SHLI_SHIFT_OPCODE_X1 = 2, |
353 | SLTEB_SPECIAL_0_OPCODE_X0 = 75, | 353 | SHLI_SHIFT_OPCODE_Y0 = 1, |
354 | SLTEB_SPECIAL_0_OPCODE_X1 = 45, | 354 | SHLI_SHIFT_OPCODE_Y1 = 1, |
355 | SLTEB_U_SPECIAL_0_OPCODE_X0 = 76, | 355 | SHLXI_SHIFT_OPCODE_X0 = 3, |
356 | SLTEB_U_SPECIAL_0_OPCODE_X1 = 46, | 356 | SHLXI_SHIFT_OPCODE_X1 = 3, |
357 | SLTEH_SPECIAL_0_OPCODE_X0 = 77, | 357 | SHLX_RRR_0_OPCODE_X0 = 73, |
358 | SLTEH_SPECIAL_0_OPCODE_X1 = 47, | 358 | SHLX_RRR_0_OPCODE_X1 = 37, |
359 | SLTEH_U_SPECIAL_0_OPCODE_X0 = 78, | 359 | SHL_RRR_0_OPCODE_X0 = 74, |
360 | SLTEH_U_SPECIAL_0_OPCODE_X1 = 48, | 360 | SHL_RRR_0_OPCODE_X1 = 38, |
361 | SLTE_SPECIAL_0_OPCODE_X0 = 79, | 361 | SHL_RRR_6_OPCODE_Y0 = 1, |
362 | SLTE_SPECIAL_0_OPCODE_X1 = 49, | 362 | SHL_RRR_6_OPCODE_Y1 = 1, |
363 | SLTE_SPECIAL_4_OPCODE_Y0 = 0, | 363 | SHRSI_SHIFT_OPCODE_X0 = 4, |
364 | SLTE_SPECIAL_4_OPCODE_Y1 = 0, | 364 | SHRSI_SHIFT_OPCODE_X1 = 4, |
365 | SLTE_U_SPECIAL_0_OPCODE_X0 = 80, | 365 | SHRSI_SHIFT_OPCODE_Y0 = 2, |
366 | SLTE_U_SPECIAL_0_OPCODE_X1 = 50, | 366 | SHRSI_SHIFT_OPCODE_Y1 = 2, |
367 | SLTE_U_SPECIAL_4_OPCODE_Y0 = 1, | 367 | SHRS_RRR_0_OPCODE_X0 = 75, |
368 | SLTE_U_SPECIAL_4_OPCODE_Y1 = 1, | 368 | SHRS_RRR_0_OPCODE_X1 = 39, |
369 | SLTH_SPECIAL_0_OPCODE_X0 = 81, | 369 | SHRS_RRR_6_OPCODE_Y0 = 2, |
370 | SLTH_SPECIAL_0_OPCODE_X1 = 51, | 370 | SHRS_RRR_6_OPCODE_Y1 = 2, |
371 | SLTH_U_SPECIAL_0_OPCODE_X0 = 82, | 371 | SHRUI_SHIFT_OPCODE_X0 = 5, |
372 | SLTH_U_SPECIAL_0_OPCODE_X1 = 52, | 372 | SHRUI_SHIFT_OPCODE_X1 = 5, |
373 | SLTIB_IMM_0_OPCODE_X0 = 12, | 373 | SHRUI_SHIFT_OPCODE_Y0 = 3, |
374 | SLTIB_IMM_0_OPCODE_X1 = 15, | 374 | SHRUI_SHIFT_OPCODE_Y1 = 3, |
375 | SLTIB_U_IMM_0_OPCODE_X0 = 13, | 375 | SHRUXI_SHIFT_OPCODE_X0 = 6, |
376 | SLTIB_U_IMM_0_OPCODE_X1 = 16, | 376 | SHRUXI_SHIFT_OPCODE_X1 = 6, |
377 | SLTIH_IMM_0_OPCODE_X0 = 14, | 377 | SHRUX_RRR_0_OPCODE_X0 = 76, |
378 | SLTIH_IMM_0_OPCODE_X1 = 17, | 378 | SHRUX_RRR_0_OPCODE_X1 = 40, |
379 | SLTIH_U_IMM_0_OPCODE_X0 = 15, | 379 | SHRU_RRR_0_OPCODE_X0 = 77, |
380 | SLTIH_U_IMM_0_OPCODE_X1 = 18, | 380 | SHRU_RRR_0_OPCODE_X1 = 41, |
381 | SLTI_IMM_0_OPCODE_X0 = 16, | 381 | SHRU_RRR_6_OPCODE_Y0 = 3, |
382 | SLTI_IMM_0_OPCODE_X1 = 19, | 382 | SHRU_RRR_6_OPCODE_Y1 = 3, |
383 | SLTI_OPCODE_Y0 = 14, | 383 | SHUFFLEBYTES_RRR_0_OPCODE_X0 = 78, |
384 | SLTI_OPCODE_Y1 = 12, | 384 | ST1_ADD_IMM8_OPCODE_X1 = 25, |
385 | SLTI_U_IMM_0_OPCODE_X0 = 17, | 385 | ST1_OPCODE_Y2 = 0, |
386 | SLTI_U_IMM_0_OPCODE_X1 = 20, | 386 | ST1_RRR_0_OPCODE_X1 = 42, |
387 | SLTI_U_OPCODE_Y0 = 15, | 387 | ST2_ADD_IMM8_OPCODE_X1 = 26, |
388 | SLTI_U_OPCODE_Y1 = 13, | 388 | ST2_OPCODE_Y2 = 1, |
389 | SLT_SPECIAL_0_OPCODE_X0 = 83, | 389 | ST2_RRR_0_OPCODE_X1 = 43, |
390 | SLT_SPECIAL_0_OPCODE_X1 = 53, | 390 | ST4_ADD_IMM8_OPCODE_X1 = 27, |
391 | SLT_SPECIAL_4_OPCODE_Y0 = 2, | 391 | ST4_OPCODE_Y2 = 2, |
392 | SLT_SPECIAL_4_OPCODE_Y1 = 2, | 392 | ST4_RRR_0_OPCODE_X1 = 44, |
393 | SLT_U_SPECIAL_0_OPCODE_X0 = 84, | 393 | STNT1_ADD_IMM8_OPCODE_X1 = 28, |
394 | SLT_U_SPECIAL_0_OPCODE_X1 = 54, | 394 | STNT1_RRR_0_OPCODE_X1 = 45, |
395 | SLT_U_SPECIAL_4_OPCODE_Y0 = 3, | 395 | STNT2_ADD_IMM8_OPCODE_X1 = 29, |
396 | SLT_U_SPECIAL_4_OPCODE_Y1 = 3, | 396 | STNT2_RRR_0_OPCODE_X1 = 46, |
397 | SNEB_SPECIAL_0_OPCODE_X0 = 85, | 397 | STNT4_ADD_IMM8_OPCODE_X1 = 30, |
398 | SNEB_SPECIAL_0_OPCODE_X1 = 55, | 398 | STNT4_RRR_0_OPCODE_X1 = 47, |
399 | SNEH_SPECIAL_0_OPCODE_X0 = 86, | 399 | STNT_ADD_IMM8_OPCODE_X1 = 31, |
400 | SNEH_SPECIAL_0_OPCODE_X1 = 56, | 400 | STNT_RRR_0_OPCODE_X1 = 48, |
401 | SNE_SPECIAL_0_OPCODE_X0 = 87, | 401 | ST_ADD_IMM8_OPCODE_X1 = 32, |
402 | SNE_SPECIAL_0_OPCODE_X1 = 57, | 402 | ST_OPCODE_Y2 = 3, |
403 | SNE_SPECIAL_5_OPCODE_Y0 = 3, | 403 | ST_RRR_0_OPCODE_X1 = 49, |
404 | SNE_SPECIAL_5_OPCODE_Y1 = 3, | 404 | SUBXSC_RRR_0_OPCODE_X0 = 79, |
405 | SPECIAL_0_OPCODE_X0 = 0, | 405 | SUBXSC_RRR_0_OPCODE_X1 = 50, |
406 | SPECIAL_0_OPCODE_X1 = 1, | 406 | SUBX_RRR_0_OPCODE_X0 = 80, |
407 | SPECIAL_0_OPCODE_Y0 = 1, | 407 | SUBX_RRR_0_OPCODE_X1 = 51, |
408 | SPECIAL_0_OPCODE_Y1 = 1, | 408 | SUBX_RRR_0_OPCODE_Y0 = 2, |
409 | SPECIAL_1_OPCODE_Y0 = 2, | 409 | SUBX_RRR_0_OPCODE_Y1 = 2, |
410 | SPECIAL_1_OPCODE_Y1 = 2, | 410 | SUB_RRR_0_OPCODE_X0 = 81, |
411 | SPECIAL_2_OPCODE_Y0 = 3, | 411 | SUB_RRR_0_OPCODE_X1 = 52, |
412 | SPECIAL_2_OPCODE_Y1 = 3, | 412 | SUB_RRR_0_OPCODE_Y0 = 3, |
413 | SPECIAL_3_OPCODE_Y0 = 4, | 413 | SUB_RRR_0_OPCODE_Y1 = 3, |
414 | SPECIAL_3_OPCODE_Y1 = 4, | 414 | SWINT0_UNARY_OPCODE_X1 = 34, |
415 | SPECIAL_4_OPCODE_Y0 = 5, | 415 | SWINT1_UNARY_OPCODE_X1 = 35, |
416 | SPECIAL_4_OPCODE_Y1 = 5, | 416 | SWINT2_UNARY_OPCODE_X1 = 36, |
417 | SPECIAL_5_OPCODE_Y0 = 6, | 417 | SWINT3_UNARY_OPCODE_X1 = 37, |
418 | SPECIAL_5_OPCODE_Y1 = 6, | 418 | TBLIDXB0_UNARY_OPCODE_X0 = 9, |
419 | SPECIAL_6_OPCODE_Y0 = 7, | 419 | TBLIDXB0_UNARY_OPCODE_Y0 = 9, |
420 | SPECIAL_7_OPCODE_Y0 = 8, | 420 | TBLIDXB1_UNARY_OPCODE_X0 = 10, |
421 | SRAB_SPECIAL_0_OPCODE_X0 = 88, | 421 | TBLIDXB1_UNARY_OPCODE_Y0 = 10, |
422 | SRAB_SPECIAL_0_OPCODE_X1 = 58, | 422 | TBLIDXB2_UNARY_OPCODE_X0 = 11, |
423 | SRAH_SPECIAL_0_OPCODE_X0 = 89, | 423 | TBLIDXB2_UNARY_OPCODE_Y0 = 11, |
424 | SRAH_SPECIAL_0_OPCODE_X1 = 59, | 424 | TBLIDXB3_UNARY_OPCODE_X0 = 12, |
425 | SRAIB_SHUN_0_OPCODE_X0 = 8, | 425 | TBLIDXB3_UNARY_OPCODE_Y0 = 12, |
426 | SRAIB_SHUN_0_OPCODE_X1 = 8, | 426 | UNARY_RRR_0_OPCODE_X0 = 82, |
427 | SRAIH_SHUN_0_OPCODE_X0 = 9, | 427 | UNARY_RRR_0_OPCODE_X1 = 53, |
428 | SRAIH_SHUN_0_OPCODE_X1 = 9, | 428 | UNARY_RRR_1_OPCODE_Y0 = 3, |
429 | SRAI_SHUN_0_OPCODE_X0 = 10, | 429 | UNARY_RRR_1_OPCODE_Y1 = 3, |
430 | SRAI_SHUN_0_OPCODE_X1 = 10, | 430 | V1ADDI_IMM8_OPCODE_X0 = 8, |
431 | SRAI_SHUN_0_OPCODE_Y0 = 4, | 431 | V1ADDI_IMM8_OPCODE_X1 = 33, |
432 | SRAI_SHUN_0_OPCODE_Y1 = 4, | 432 | V1ADDUC_RRR_0_OPCODE_X0 = 83, |
433 | SRA_SPECIAL_0_OPCODE_X0 = 90, | 433 | V1ADDUC_RRR_0_OPCODE_X1 = 54, |
434 | SRA_SPECIAL_0_OPCODE_X1 = 60, | 434 | V1ADD_RRR_0_OPCODE_X0 = 84, |
435 | SRA_SPECIAL_3_OPCODE_Y0 = 3, | 435 | V1ADD_RRR_0_OPCODE_X1 = 55, |
436 | SRA_SPECIAL_3_OPCODE_Y1 = 3, | 436 | V1ADIFFU_RRR_0_OPCODE_X0 = 85, |
437 | SUBBS_U_SPECIAL_0_OPCODE_X0 = 100, | 437 | V1AVGU_RRR_0_OPCODE_X0 = 86, |
438 | SUBBS_U_SPECIAL_0_OPCODE_X1 = 70, | 438 | V1CMPEQI_IMM8_OPCODE_X0 = 9, |
439 | SUBB_SPECIAL_0_OPCODE_X0 = 91, | 439 | V1CMPEQI_IMM8_OPCODE_X1 = 34, |
440 | SUBB_SPECIAL_0_OPCODE_X1 = 61, | 440 | V1CMPEQ_RRR_0_OPCODE_X0 = 87, |
441 | SUBHS_SPECIAL_0_OPCODE_X0 = 101, | 441 | V1CMPEQ_RRR_0_OPCODE_X1 = 56, |
442 | SUBHS_SPECIAL_0_OPCODE_X1 = 71, | 442 | V1CMPLES_RRR_0_OPCODE_X0 = 88, |
443 | SUBH_SPECIAL_0_OPCODE_X0 = 92, | 443 | V1CMPLES_RRR_0_OPCODE_X1 = 57, |
444 | SUBH_SPECIAL_0_OPCODE_X1 = 62, | 444 | V1CMPLEU_RRR_0_OPCODE_X0 = 89, |
445 | SUBS_SPECIAL_0_OPCODE_X0 = 97, | 445 | V1CMPLEU_RRR_0_OPCODE_X1 = 58, |
446 | SUBS_SPECIAL_0_OPCODE_X1 = 67, | 446 | V1CMPLTSI_IMM8_OPCODE_X0 = 10, |
447 | SUB_SPECIAL_0_OPCODE_X0 = 93, | 447 | V1CMPLTSI_IMM8_OPCODE_X1 = 35, |
448 | SUB_SPECIAL_0_OPCODE_X1 = 63, | 448 | V1CMPLTS_RRR_0_OPCODE_X0 = 90, |
449 | SUB_SPECIAL_0_OPCODE_Y0 = 3, | 449 | V1CMPLTS_RRR_0_OPCODE_X1 = 59, |
450 | SUB_SPECIAL_0_OPCODE_Y1 = 3, | 450 | V1CMPLTUI_IMM8_OPCODE_X0 = 11, |
451 | SWADD_IMM_0_OPCODE_X1 = 30, | 451 | V1CMPLTUI_IMM8_OPCODE_X1 = 36, |
452 | SWINT0_UN_0_SHUN_0_OPCODE_X1 = 18, | 452 | V1CMPLTU_RRR_0_OPCODE_X0 = 91, |
453 | SWINT1_UN_0_SHUN_0_OPCODE_X1 = 19, | 453 | V1CMPLTU_RRR_0_OPCODE_X1 = 60, |
454 | SWINT2_UN_0_SHUN_0_OPCODE_X1 = 20, | 454 | V1CMPNE_RRR_0_OPCODE_X0 = 92, |
455 | SWINT3_UN_0_SHUN_0_OPCODE_X1 = 21, | 455 | V1CMPNE_RRR_0_OPCODE_X1 = 61, |
456 | SW_OPCODE_Y2 = 7, | 456 | V1DDOTPUA_RRR_0_OPCODE_X0 = 161, |
457 | SW_SPECIAL_0_OPCODE_X1 = 64, | 457 | V1DDOTPUSA_RRR_0_OPCODE_X0 = 93, |
458 | TBLIDXB0_UN_0_SHUN_0_OPCODE_X0 = 8, | 458 | V1DDOTPUS_RRR_0_OPCODE_X0 = 94, |
459 | TBLIDXB0_UN_0_SHUN_0_OPCODE_Y0 = 8, | 459 | V1DDOTPU_RRR_0_OPCODE_X0 = 162, |
460 | TBLIDXB1_UN_0_SHUN_0_OPCODE_X0 = 9, | 460 | V1DOTPA_RRR_0_OPCODE_X0 = 95, |
461 | TBLIDXB1_UN_0_SHUN_0_OPCODE_Y0 = 9, | 461 | V1DOTPUA_RRR_0_OPCODE_X0 = 163, |
462 | TBLIDXB2_UN_0_SHUN_0_OPCODE_X0 = 10, | 462 | V1DOTPUSA_RRR_0_OPCODE_X0 = 96, |
463 | TBLIDXB2_UN_0_SHUN_0_OPCODE_Y0 = 10, | 463 | V1DOTPUS_RRR_0_OPCODE_X0 = 97, |
464 | TBLIDXB3_UN_0_SHUN_0_OPCODE_X0 = 11, | 464 | V1DOTPU_RRR_0_OPCODE_X0 = 164, |
465 | TBLIDXB3_UN_0_SHUN_0_OPCODE_Y0 = 11, | 465 | V1DOTP_RRR_0_OPCODE_X0 = 98, |
466 | TNS_UN_0_SHUN_0_OPCODE_X1 = 22, | 466 | V1INT_H_RRR_0_OPCODE_X0 = 99, |
467 | UN_0_SHUN_0_OPCODE_X0 = 11, | 467 | V1INT_H_RRR_0_OPCODE_X1 = 62, |
468 | UN_0_SHUN_0_OPCODE_X1 = 11, | 468 | V1INT_L_RRR_0_OPCODE_X0 = 100, |
469 | UN_0_SHUN_0_OPCODE_Y0 = 5, | 469 | V1INT_L_RRR_0_OPCODE_X1 = 63, |
470 | UN_0_SHUN_0_OPCODE_Y1 = 5, | 470 | V1MAXUI_IMM8_OPCODE_X0 = 12, |
471 | WH64_UN_0_SHUN_0_OPCODE_X1 = 23, | 471 | V1MAXUI_IMM8_OPCODE_X1 = 37, |
472 | XORI_IMM_0_OPCODE_X0 = 2, | 472 | V1MAXU_RRR_0_OPCODE_X0 = 101, |
473 | XORI_IMM_0_OPCODE_X1 = 21, | 473 | V1MAXU_RRR_0_OPCODE_X1 = 64, |
474 | XOR_SPECIAL_0_OPCODE_X0 = 94, | 474 | V1MINUI_IMM8_OPCODE_X0 = 13, |
475 | XOR_SPECIAL_0_OPCODE_X1 = 65, | 475 | V1MINUI_IMM8_OPCODE_X1 = 38, |
476 | XOR_SPECIAL_2_OPCODE_Y0 = 3, | 476 | V1MINU_RRR_0_OPCODE_X0 = 102, |
477 | XOR_SPECIAL_2_OPCODE_Y1 = 3 | 477 | V1MINU_RRR_0_OPCODE_X1 = 65, |
478 | V1MNZ_RRR_0_OPCODE_X0 = 103, | ||
479 | V1MNZ_RRR_0_OPCODE_X1 = 66, | ||
480 | V1MULTU_RRR_0_OPCODE_X0 = 104, | ||
481 | V1MULUS_RRR_0_OPCODE_X0 = 105, | ||
482 | V1MULU_RRR_0_OPCODE_X0 = 106, | ||
483 | V1MZ_RRR_0_OPCODE_X0 = 107, | ||
484 | V1MZ_RRR_0_OPCODE_X1 = 67, | ||
485 | V1SADAU_RRR_0_OPCODE_X0 = 108, | ||
486 | V1SADU_RRR_0_OPCODE_X0 = 109, | ||
487 | V1SHLI_SHIFT_OPCODE_X0 = 7, | ||
488 | V1SHLI_SHIFT_OPCODE_X1 = 7, | ||
489 | V1SHL_RRR_0_OPCODE_X0 = 110, | ||
490 | V1SHL_RRR_0_OPCODE_X1 = 68, | ||
491 | V1SHRSI_SHIFT_OPCODE_X0 = 8, | ||
492 | V1SHRSI_SHIFT_OPCODE_X1 = 8, | ||
493 | V1SHRS_RRR_0_OPCODE_X0 = 111, | ||
494 | V1SHRS_RRR_0_OPCODE_X1 = 69, | ||
495 | V1SHRUI_SHIFT_OPCODE_X0 = 9, | ||
496 | V1SHRUI_SHIFT_OPCODE_X1 = 9, | ||
497 | V1SHRU_RRR_0_OPCODE_X0 = 112, | ||
498 | V1SHRU_RRR_0_OPCODE_X1 = 70, | ||
499 | V1SUBUC_RRR_0_OPCODE_X0 = 113, | ||
500 | V1SUBUC_RRR_0_OPCODE_X1 = 71, | ||
501 | V1SUB_RRR_0_OPCODE_X0 = 114, | ||
502 | V1SUB_RRR_0_OPCODE_X1 = 72, | ||
503 | V2ADDI_IMM8_OPCODE_X0 = 14, | ||
504 | V2ADDI_IMM8_OPCODE_X1 = 39, | ||
505 | V2ADDSC_RRR_0_OPCODE_X0 = 115, | ||
506 | V2ADDSC_RRR_0_OPCODE_X1 = 73, | ||
507 | V2ADD_RRR_0_OPCODE_X0 = 116, | ||
508 | V2ADD_RRR_0_OPCODE_X1 = 74, | ||
509 | V2ADIFFS_RRR_0_OPCODE_X0 = 117, | ||
510 | V2AVGS_RRR_0_OPCODE_X0 = 118, | ||
511 | V2CMPEQI_IMM8_OPCODE_X0 = 15, | ||
512 | V2CMPEQI_IMM8_OPCODE_X1 = 40, | ||
513 | V2CMPEQ_RRR_0_OPCODE_X0 = 119, | ||
514 | V2CMPEQ_RRR_0_OPCODE_X1 = 75, | ||
515 | V2CMPLES_RRR_0_OPCODE_X0 = 120, | ||
516 | V2CMPLES_RRR_0_OPCODE_X1 = 76, | ||
517 | V2CMPLEU_RRR_0_OPCODE_X0 = 121, | ||
518 | V2CMPLEU_RRR_0_OPCODE_X1 = 77, | ||
519 | V2CMPLTSI_IMM8_OPCODE_X0 = 16, | ||
520 | V2CMPLTSI_IMM8_OPCODE_X1 = 41, | ||
521 | V2CMPLTS_RRR_0_OPCODE_X0 = 122, | ||
522 | V2CMPLTS_RRR_0_OPCODE_X1 = 78, | ||
523 | V2CMPLTUI_IMM8_OPCODE_X0 = 17, | ||
524 | V2CMPLTUI_IMM8_OPCODE_X1 = 42, | ||
525 | V2CMPLTU_RRR_0_OPCODE_X0 = 123, | ||
526 | V2CMPLTU_RRR_0_OPCODE_X1 = 79, | ||
527 | V2CMPNE_RRR_0_OPCODE_X0 = 124, | ||
528 | V2CMPNE_RRR_0_OPCODE_X1 = 80, | ||
529 | V2DOTPA_RRR_0_OPCODE_X0 = 125, | ||
530 | V2DOTP_RRR_0_OPCODE_X0 = 126, | ||
531 | V2INT_H_RRR_0_OPCODE_X0 = 127, | ||
532 | V2INT_H_RRR_0_OPCODE_X1 = 81, | ||
533 | V2INT_L_RRR_0_OPCODE_X0 = 128, | ||
534 | V2INT_L_RRR_0_OPCODE_X1 = 82, | ||
535 | V2MAXSI_IMM8_OPCODE_X0 = 18, | ||
536 | V2MAXSI_IMM8_OPCODE_X1 = 43, | ||
537 | V2MAXS_RRR_0_OPCODE_X0 = 129, | ||
538 | V2MAXS_RRR_0_OPCODE_X1 = 83, | ||
539 | V2MINSI_IMM8_OPCODE_X0 = 19, | ||
540 | V2MINSI_IMM8_OPCODE_X1 = 44, | ||
541 | V2MINS_RRR_0_OPCODE_X0 = 130, | ||
542 | V2MINS_RRR_0_OPCODE_X1 = 84, | ||
543 | V2MNZ_RRR_0_OPCODE_X0 = 131, | ||
544 | V2MNZ_RRR_0_OPCODE_X1 = 85, | ||
545 | V2MULFSC_RRR_0_OPCODE_X0 = 132, | ||
546 | V2MULS_RRR_0_OPCODE_X0 = 133, | ||
547 | V2MULTS_RRR_0_OPCODE_X0 = 134, | ||
548 | V2MZ_RRR_0_OPCODE_X0 = 135, | ||
549 | V2MZ_RRR_0_OPCODE_X1 = 86, | ||
550 | V2PACKH_RRR_0_OPCODE_X0 = 136, | ||
551 | V2PACKH_RRR_0_OPCODE_X1 = 87, | ||
552 | V2PACKL_RRR_0_OPCODE_X0 = 137, | ||
553 | V2PACKL_RRR_0_OPCODE_X1 = 88, | ||
554 | V2PACKUC_RRR_0_OPCODE_X0 = 138, | ||
555 | V2PACKUC_RRR_0_OPCODE_X1 = 89, | ||
556 | V2SADAS_RRR_0_OPCODE_X0 = 139, | ||
557 | V2SADAU_RRR_0_OPCODE_X0 = 140, | ||
558 | V2SADS_RRR_0_OPCODE_X0 = 141, | ||
559 | V2SADU_RRR_0_OPCODE_X0 = 142, | ||
560 | V2SHLI_SHIFT_OPCODE_X0 = 10, | ||
561 | V2SHLI_SHIFT_OPCODE_X1 = 10, | ||
562 | V2SHLSC_RRR_0_OPCODE_X0 = 143, | ||
563 | V2SHLSC_RRR_0_OPCODE_X1 = 90, | ||
564 | V2SHL_RRR_0_OPCODE_X0 = 144, | ||
565 | V2SHL_RRR_0_OPCODE_X1 = 91, | ||
566 | V2SHRSI_SHIFT_OPCODE_X0 = 11, | ||
567 | V2SHRSI_SHIFT_OPCODE_X1 = 11, | ||
568 | V2SHRS_RRR_0_OPCODE_X0 = 145, | ||
569 | V2SHRS_RRR_0_OPCODE_X1 = 92, | ||
570 | V2SHRUI_SHIFT_OPCODE_X0 = 12, | ||
571 | V2SHRUI_SHIFT_OPCODE_X1 = 12, | ||
572 | V2SHRU_RRR_0_OPCODE_X0 = 146, | ||
573 | V2SHRU_RRR_0_OPCODE_X1 = 93, | ||
574 | V2SUBSC_RRR_0_OPCODE_X0 = 147, | ||
575 | V2SUBSC_RRR_0_OPCODE_X1 = 94, | ||
576 | V2SUB_RRR_0_OPCODE_X0 = 148, | ||
577 | V2SUB_RRR_0_OPCODE_X1 = 95, | ||
578 | V4ADDSC_RRR_0_OPCODE_X0 = 149, | ||
579 | V4ADDSC_RRR_0_OPCODE_X1 = 96, | ||
580 | V4ADD_RRR_0_OPCODE_X0 = 150, | ||
581 | V4ADD_RRR_0_OPCODE_X1 = 97, | ||
582 | V4INT_H_RRR_0_OPCODE_X0 = 151, | ||
583 | V4INT_H_RRR_0_OPCODE_X1 = 98, | ||
584 | V4INT_L_RRR_0_OPCODE_X0 = 152, | ||
585 | V4INT_L_RRR_0_OPCODE_X1 = 99, | ||
586 | V4PACKSC_RRR_0_OPCODE_X0 = 153, | ||
587 | V4PACKSC_RRR_0_OPCODE_X1 = 100, | ||
588 | V4SHLSC_RRR_0_OPCODE_X0 = 154, | ||
589 | V4SHLSC_RRR_0_OPCODE_X1 = 101, | ||
590 | V4SHL_RRR_0_OPCODE_X0 = 155, | ||
591 | V4SHL_RRR_0_OPCODE_X1 = 102, | ||
592 | V4SHRS_RRR_0_OPCODE_X0 = 156, | ||
593 | V4SHRS_RRR_0_OPCODE_X1 = 103, | ||
594 | V4SHRU_RRR_0_OPCODE_X0 = 157, | ||
595 | V4SHRU_RRR_0_OPCODE_X1 = 104, | ||
596 | V4SUBSC_RRR_0_OPCODE_X0 = 158, | ||
597 | V4SUBSC_RRR_0_OPCODE_X1 = 105, | ||
598 | V4SUB_RRR_0_OPCODE_X0 = 159, | ||
599 | V4SUB_RRR_0_OPCODE_X1 = 106, | ||
600 | WH64_UNARY_OPCODE_X1 = 38, | ||
601 | XORI_IMM8_OPCODE_X0 = 20, | ||
602 | XORI_IMM8_OPCODE_X1 = 45, | ||
603 | XOR_RRR_0_OPCODE_X0 = 160, | ||
604 | XOR_RRR_0_OPCODE_X1 = 107, | ||
605 | XOR_RRR_5_OPCODE_Y0 = 3, | ||
606 | XOR_RRR_5_OPCODE_Y1 = 3 | ||
478 | }; | 607 | }; |
479 | 608 | ||
480 | #endif /* !_TILE_OPCODE_CONSTANTS_H */ | 609 | #endif /* !_TILE_OPCODE_CONSTANTS_H */ |
diff --git a/arch/tile/include/asm/page.h b/arch/tile/include/asm/page.h index 3eb53525bf9d..db93518fac03 100644 --- a/arch/tile/include/asm/page.h +++ b/arch/tile/include/asm/page.h | |||
@@ -16,7 +16,8 @@ | |||
16 | #define _ASM_TILE_PAGE_H | 16 | #define _ASM_TILE_PAGE_H |
17 | 17 | ||
18 | #include <linux/const.h> | 18 | #include <linux/const.h> |
19 | #include <hv/pagesize.h> | 19 | #include <hv/hypervisor.h> |
20 | #include <arch/chip.h> | ||
20 | 21 | ||
21 | /* PAGE_SHIFT and HPAGE_SHIFT determine the page sizes. */ | 22 | /* PAGE_SHIFT and HPAGE_SHIFT determine the page sizes. */ |
22 | #define PAGE_SHIFT HV_LOG2_PAGE_SIZE_SMALL | 23 | #define PAGE_SHIFT HV_LOG2_PAGE_SIZE_SMALL |
@@ -28,8 +29,6 @@ | |||
28 | #define PAGE_MASK (~(PAGE_SIZE - 1)) | 29 | #define PAGE_MASK (~(PAGE_SIZE - 1)) |
29 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 30 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) |
30 | 31 | ||
31 | #ifdef __KERNEL__ | ||
32 | |||
33 | /* | 32 | /* |
34 | * If the Kconfig doesn't specify, set a maximum zone order that | 33 | * If the Kconfig doesn't specify, set a maximum zone order that |
35 | * is enough so that we can create huge pages from small pages given | 34 | * is enough so that we can create huge pages from small pages given |
@@ -39,9 +38,6 @@ | |||
39 | #define CONFIG_FORCE_MAX_ZONEORDER (HPAGE_SHIFT - PAGE_SHIFT + 1) | 38 | #define CONFIG_FORCE_MAX_ZONEORDER (HPAGE_SHIFT - PAGE_SHIFT + 1) |
40 | #endif | 39 | #endif |
41 | 40 | ||
42 | #include <hv/hypervisor.h> | ||
43 | #include <arch/chip.h> | ||
44 | |||
45 | #ifndef __ASSEMBLY__ | 41 | #ifndef __ASSEMBLY__ |
46 | 42 | ||
47 | #include <linux/types.h> | 43 | #include <linux/types.h> |
@@ -91,6 +87,10 @@ typedef struct page *pgtable_t; | |||
91 | /* Must be a macro since it is used to create constants. */ | 87 | /* Must be a macro since it is used to create constants. */ |
92 | #define __pgprot(val) hv_pte(val) | 88 | #define __pgprot(val) hv_pte(val) |
93 | 89 | ||
90 | /* Rarely-used initializers, typically with a "zero" value. */ | ||
91 | #define __pte(x) hv_pte(x) | ||
92 | #define __pgd(x) hv_pte(x) | ||
93 | |||
94 | static inline u64 pgprot_val(pgprot_t pgprot) | 94 | static inline u64 pgprot_val(pgprot_t pgprot) |
95 | { | 95 | { |
96 | return hv_pte_val(pgprot); | 96 | return hv_pte_val(pgprot); |
@@ -110,6 +110,8 @@ static inline u64 pgd_val(pgd_t pgd) | |||
110 | 110 | ||
111 | typedef HV_PTE pmd_t; | 111 | typedef HV_PTE pmd_t; |
112 | 112 | ||
113 | #define __pmd(x) hv_pte(x) | ||
114 | |||
113 | static inline u64 pmd_val(pmd_t pmd) | 115 | static inline u64 pmd_val(pmd_t pmd) |
114 | { | 116 | { |
115 | return hv_pte_val(pmd); | 117 | return hv_pte_val(pmd); |
@@ -318,7 +320,7 @@ static inline int pfn_valid(unsigned long pfn) | |||
318 | 320 | ||
319 | /* Provide as macros since these require some other headers included. */ | 321 | /* Provide as macros since these require some other headers included. */ |
320 | #define page_to_pa(page) ((phys_addr_t)(page_to_pfn(page)) << PAGE_SHIFT) | 322 | #define page_to_pa(page) ((phys_addr_t)(page_to_pfn(page)) << PAGE_SHIFT) |
321 | #define virt_to_page(kaddr) pfn_to_page(kaddr_to_pfn(kaddr)) | 323 | #define virt_to_page(kaddr) pfn_to_page(kaddr_to_pfn((void *)(kaddr))) |
322 | #define page_to_virt(page) pfn_to_kaddr(page_to_pfn(page)) | 324 | #define page_to_virt(page) pfn_to_kaddr(page_to_pfn(page)) |
323 | 325 | ||
324 | struct mm_struct; | 326 | struct mm_struct; |
@@ -331,6 +333,4 @@ extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr); | |||
331 | 333 | ||
332 | #include <asm-generic/memory_model.h> | 334 | #include <asm-generic/memory_model.h> |
333 | 335 | ||
334 | #endif /* __KERNEL__ */ | ||
335 | |||
336 | #endif /* _ASM_TILE_PAGE_H */ | 336 | #endif /* _ASM_TILE_PAGE_H */ |
diff --git a/arch/tile/include/asm/parport.h b/arch/tile/include/asm/parport.h new file mode 100644 index 000000000000..cf252af64590 --- /dev/null +++ b/arch/tile/include/asm/parport.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/parport.h> | |||
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h index c3fc458a0d32..7f03cefed1b9 100644 --- a/arch/tile/include/asm/pci.h +++ b/arch/tile/include/asm/pci.h | |||
@@ -46,7 +46,8 @@ struct pci_controller { | |||
46 | */ | 46 | */ |
47 | #define PCI_DMA_BUS_IS_PHYS 1 | 47 | #define PCI_DMA_BUS_IS_PHYS 1 |
48 | 48 | ||
49 | int __init tile_pci_init(void); | 49 | int __devinit tile_pci_init(void); |
50 | int __devinit pcibios_init(void); | ||
50 | 51 | ||
51 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | 52 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); |
52 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} | 53 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} |
diff --git a/arch/tile/include/asm/pgtable_64.h b/arch/tile/include/asm/pgtable_64.h new file mode 100644 index 000000000000..fd80328523b4 --- /dev/null +++ b/arch/tile/include/asm/pgtable_64.h | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef _ASM_TILE_PGTABLE_64_H | ||
17 | #define _ASM_TILE_PGTABLE_64_H | ||
18 | |||
19 | /* The level-0 page table breaks the address space into 32-bit chunks. */ | ||
20 | #define PGDIR_SHIFT HV_LOG2_L1_SPAN | ||
21 | #define PGDIR_SIZE HV_L1_SPAN | ||
22 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
23 | #define PTRS_PER_PGD HV_L0_ENTRIES | ||
24 | #define SIZEOF_PGD (PTRS_PER_PGD * sizeof(pgd_t)) | ||
25 | |||
26 | /* | ||
27 | * The level-1 index is defined by the huge page size. A PMD is composed | ||
28 | * of PTRS_PER_PMD pgd_t's and is the middle level of the page table. | ||
29 | */ | ||
30 | #define PMD_SHIFT HV_LOG2_PAGE_SIZE_LARGE | ||
31 | #define PMD_SIZE HV_PAGE_SIZE_LARGE | ||
32 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
33 | #define PTRS_PER_PMD (1 << (PGDIR_SHIFT - PMD_SHIFT)) | ||
34 | #define SIZEOF_PMD (PTRS_PER_PMD * sizeof(pmd_t)) | ||
35 | |||
36 | /* | ||
37 | * The level-2 index is defined by the difference between the huge | ||
38 | * page size and the normal page size. A PTE is composed of | ||
39 | * PTRS_PER_PTE pte_t's and is the bottom level of the page table. | ||
40 | * Note that the hypervisor docs use PTE for what we call pte_t, so | ||
41 | * this nomenclature is somewhat confusing. | ||
42 | */ | ||
43 | #define PTRS_PER_PTE (1 << (HV_LOG2_PAGE_SIZE_LARGE - HV_LOG2_PAGE_SIZE_SMALL)) | ||
44 | #define SIZEOF_PTE (PTRS_PER_PTE * sizeof(pte_t)) | ||
45 | |||
46 | /* | ||
47 | * Align the vmalloc area to an L2 page table, and leave a guard page | ||
48 | * at the beginning and end. The vmalloc code also puts in an internal | ||
49 | * guard page between each allocation. | ||
50 | */ | ||
51 | #define _VMALLOC_END HUGE_VMAP_BASE | ||
52 | #define VMALLOC_END (_VMALLOC_END - PAGE_SIZE) | ||
53 | #define VMALLOC_START (_VMALLOC_START + PAGE_SIZE) | ||
54 | |||
55 | #define HUGE_VMAP_END (HUGE_VMAP_BASE + PGDIR_SIZE) | ||
56 | |||
57 | #ifndef __ASSEMBLY__ | ||
58 | |||
59 | /* We have no pud since we are a three-level page table. */ | ||
60 | #include <asm-generic/pgtable-nopud.h> | ||
61 | |||
62 | static inline int pud_none(pud_t pud) | ||
63 | { | ||
64 | return pud_val(pud) == 0; | ||
65 | } | ||
66 | |||
67 | static inline int pud_present(pud_t pud) | ||
68 | { | ||
69 | return pud_val(pud) & _PAGE_PRESENT; | ||
70 | } | ||
71 | |||
72 | #define pmd_ERROR(e) \ | ||
73 | pr_err("%s:%d: bad pmd 0x%016llx.\n", __FILE__, __LINE__, pmd_val(e)) | ||
74 | |||
75 | static inline void pud_clear(pud_t *pudp) | ||
76 | { | ||
77 | __pte_clear(&pudp->pgd); | ||
78 | } | ||
79 | |||
80 | static inline int pud_bad(pud_t pud) | ||
81 | { | ||
82 | return ((pud_val(pud) & _PAGE_ALL) != _PAGE_TABLE); | ||
83 | } | ||
84 | |||
85 | /* Return the page-table frame number (ptfn) that a pud_t points at. */ | ||
86 | #define pud_ptfn(pud) hv_pte_get_ptfn((pud).pgd) | ||
87 | |||
88 | /* | ||
89 | * A given kernel pud_t maps to a kernel pmd_t table at a specific | ||
90 | * virtual address. Since kernel pmd_t tables can be aligned at | ||
91 | * sub-page granularity, this macro can return non-page-aligned | ||
92 | * pointers, despite its name. | ||
93 | */ | ||
94 | #define pud_page_vaddr(pud) \ | ||
95 | (__va((phys_addr_t)pud_ptfn(pud) << HV_LOG2_PAGE_TABLE_ALIGN)) | ||
96 | |||
97 | /* | ||
98 | * A pud_t points to a pmd_t array. Since we can have multiple per | ||
99 | * page, we don't have a one-to-one mapping of pud_t's to pages. | ||
100 | */ | ||
101 | #define pud_page(pud) pfn_to_page(HV_PTFN_TO_PFN(pud_ptfn(pud))) | ||
102 | |||
103 | static inline unsigned long pud_index(unsigned long address) | ||
104 | { | ||
105 | return (address >> PUD_SHIFT) & (PTRS_PER_PUD - 1); | ||
106 | } | ||
107 | |||
108 | #define pmd_offset(pud, address) \ | ||
109 | ((pmd_t *)pud_page_vaddr(*(pud)) + pmd_index(address)) | ||
110 | |||
111 | static inline void __set_pmd(pmd_t *pmdp, pmd_t pmdval) | ||
112 | { | ||
113 | set_pte(pmdp, pmdval); | ||
114 | } | ||
115 | |||
116 | /* Create a pmd from a PTFN and pgprot. */ | ||
117 | static inline pmd_t ptfn_pmd(unsigned long ptfn, pgprot_t prot) | ||
118 | { | ||
119 | return hv_pte_set_ptfn(prot, ptfn); | ||
120 | } | ||
121 | |||
122 | /* Return the page-table frame number (ptfn) that a pmd_t points at. */ | ||
123 | static inline unsigned long pmd_ptfn(pmd_t pmd) | ||
124 | { | ||
125 | return hv_pte_get_ptfn(pmd); | ||
126 | } | ||
127 | |||
128 | static inline void pmd_clear(pmd_t *pmdp) | ||
129 | { | ||
130 | __pte_clear(pmdp); | ||
131 | } | ||
132 | |||
133 | /* Normalize an address to having the correct high bits set. */ | ||
134 | #define pgd_addr_normalize pgd_addr_normalize | ||
135 | static inline unsigned long pgd_addr_normalize(unsigned long addr) | ||
136 | { | ||
137 | return ((long)addr << (CHIP_WORD_SIZE() - CHIP_VA_WIDTH())) >> | ||
138 | (CHIP_WORD_SIZE() - CHIP_VA_WIDTH()); | ||
139 | } | ||
140 | |||
141 | /* We don't define any pgds for these addresses. */ | ||
142 | static inline int pgd_addr_invalid(unsigned long addr) | ||
143 | { | ||
144 | return addr >= MEM_HV_START || | ||
145 | (addr > MEM_LOW_END && addr < MEM_HIGH_START); | ||
146 | } | ||
147 | |||
148 | /* | ||
149 | * Use atomic instructions to provide atomicity against the hypervisor. | ||
150 | */ | ||
151 | #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG | ||
152 | static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, | ||
153 | unsigned long addr, pte_t *ptep) | ||
154 | { | ||
155 | return (__insn_fetchand(&ptep->val, ~HV_PTE_ACCESSED) >> | ||
156 | HV_PTE_INDEX_ACCESSED) & 0x1; | ||
157 | } | ||
158 | |||
159 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | ||
160 | static inline void ptep_set_wrprotect(struct mm_struct *mm, | ||
161 | unsigned long addr, pte_t *ptep) | ||
162 | { | ||
163 | __insn_fetchand(&ptep->val, ~HV_PTE_WRITABLE); | ||
164 | } | ||
165 | |||
166 | #define __HAVE_ARCH_PTEP_GET_AND_CLEAR | ||
167 | static inline pte_t ptep_get_and_clear(struct mm_struct *mm, | ||
168 | unsigned long addr, pte_t *ptep) | ||
169 | { | ||
170 | return hv_pte(__insn_exch(&ptep->val, 0UL)); | ||
171 | } | ||
172 | |||
173 | #endif /* __ASSEMBLY__ */ | ||
174 | |||
175 | #endif /* _ASM_TILE_PGTABLE_64_H */ | ||
diff --git a/arch/tile/include/asm/processor.h b/arch/tile/include/asm/processor.h index e6889474038a..34c1e01ffb5e 100644 --- a/arch/tile/include/asm/processor.h +++ b/arch/tile/include/asm/processor.h | |||
@@ -215,6 +215,8 @@ static inline void release_thread(struct task_struct *dead_task) | |||
215 | 215 | ||
216 | extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | 216 | extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); |
217 | 217 | ||
218 | extern int do_work_pending(struct pt_regs *regs, u32 flags); | ||
219 | |||
218 | 220 | ||
219 | /* | 221 | /* |
220 | * Return saved (kernel) PC of a blocked thread. | 222 | * Return saved (kernel) PC of a blocked thread. |
@@ -255,10 +257,6 @@ static inline void cpu_relax(void) | |||
255 | barrier(); | 257 | barrier(); |
256 | } | 258 | } |
257 | 259 | ||
258 | struct siginfo; | ||
259 | extern void arch_coredump_signal(struct siginfo *, struct pt_regs *); | ||
260 | #define arch_coredump_signal arch_coredump_signal | ||
261 | |||
262 | /* Info on this processor (see fs/proc/cpuinfo.c) */ | 260 | /* Info on this processor (see fs/proc/cpuinfo.c) */ |
263 | struct seq_operations; | 261 | struct seq_operations; |
264 | extern const struct seq_operations cpuinfo_op; | 262 | extern const struct seq_operations cpuinfo_op; |
@@ -269,9 +267,6 @@ extern char chip_model[64]; | |||
269 | /* Data on which physical memory controller corresponds to which NUMA node. */ | 267 | /* Data on which physical memory controller corresponds to which NUMA node. */ |
270 | extern int node_controller[]; | 268 | extern int node_controller[]; |
271 | 269 | ||
272 | /* Do we dump information to the console when a user application crashes? */ | ||
273 | extern int show_crashinfo; | ||
274 | |||
275 | #if CHIP_HAS_CBOX_HOME_MAP() | 270 | #if CHIP_HAS_CBOX_HOME_MAP() |
276 | /* Does the heap allocator return hash-for-home pages by default? */ | 271 | /* Does the heap allocator return hash-for-home pages by default? */ |
277 | extern int hash_default; | 272 | extern int hash_default; |
diff --git a/arch/tile/include/asm/serial.h b/arch/tile/include/asm/serial.h new file mode 100644 index 000000000000..a0cb0caff152 --- /dev/null +++ b/arch/tile/include/asm/serial.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/serial.h> | |||
diff --git a/arch/tile/include/asm/signal.h b/arch/tile/include/asm/signal.h index 81d92a45cd4b..1e1e616783eb 100644 --- a/arch/tile/include/asm/signal.h +++ b/arch/tile/include/asm/signal.h | |||
@@ -28,6 +28,10 @@ struct pt_regs; | |||
28 | int restore_sigcontext(struct pt_regs *, struct sigcontext __user *); | 28 | int restore_sigcontext(struct pt_regs *, struct sigcontext __user *); |
29 | int setup_sigcontext(struct sigcontext __user *, struct pt_regs *); | 29 | int setup_sigcontext(struct sigcontext __user *, struct pt_regs *); |
30 | void do_signal(struct pt_regs *regs); | 30 | void do_signal(struct pt_regs *regs); |
31 | void signal_fault(const char *type, struct pt_regs *, | ||
32 | void __user *frame, int sig); | ||
33 | void trace_unhandled_signal(const char *type, struct pt_regs *regs, | ||
34 | unsigned long address, int signo); | ||
31 | #endif | 35 | #endif |
32 | 36 | ||
33 | #endif /* _ASM_TILE_SIGNAL_H */ | 37 | #endif /* _ASM_TILE_SIGNAL_H */ |
diff --git a/arch/tile/include/asm/spinlock_64.h b/arch/tile/include/asm/spinlock_64.h new file mode 100644 index 000000000000..72be5904e020 --- /dev/null +++ b/arch/tile/include/asm/spinlock_64.h | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * 64-bit SMP ticket spinlocks, allowing only a single CPU anywhere | ||
15 | * (the type definitions are in asm/spinlock_types.h) | ||
16 | */ | ||
17 | |||
18 | #ifndef _ASM_TILE_SPINLOCK_64_H | ||
19 | #define _ASM_TILE_SPINLOCK_64_H | ||
20 | |||
21 | /* Shifts and masks for the various fields in "lock". */ | ||
22 | #define __ARCH_SPIN_CURRENT_SHIFT 17 | ||
23 | #define __ARCH_SPIN_NEXT_MASK 0x7fff | ||
24 | #define __ARCH_SPIN_NEXT_OVERFLOW 0x8000 | ||
25 | |||
26 | /* | ||
27 | * Return the "current" portion of a ticket lock value, | ||
28 | * i.e. the number that currently owns the lock. | ||
29 | */ | ||
30 | static inline int arch_spin_current(u32 val) | ||
31 | { | ||
32 | return val >> __ARCH_SPIN_CURRENT_SHIFT; | ||
33 | } | ||
34 | |||
35 | /* | ||
36 | * Return the "next" portion of a ticket lock value, | ||
37 | * i.e. the number that the next task to try to acquire the lock will get. | ||
38 | */ | ||
39 | static inline int arch_spin_next(u32 val) | ||
40 | { | ||
41 | return val & __ARCH_SPIN_NEXT_MASK; | ||
42 | } | ||
43 | |||
44 | /* The lock is locked if a task would have to wait to get it. */ | ||
45 | static inline int arch_spin_is_locked(arch_spinlock_t *lock) | ||
46 | { | ||
47 | u32 val = lock->lock; | ||
48 | return arch_spin_current(val) != arch_spin_next(val); | ||
49 | } | ||
50 | |||
51 | /* Bump the current ticket so the next task owns the lock. */ | ||
52 | static inline void arch_spin_unlock(arch_spinlock_t *lock) | ||
53 | { | ||
54 | wmb(); /* guarantee anything modified under the lock is visible */ | ||
55 | __insn_fetchadd4(&lock->lock, 1U << __ARCH_SPIN_CURRENT_SHIFT); | ||
56 | } | ||
57 | |||
58 | void arch_spin_unlock_wait(arch_spinlock_t *lock); | ||
59 | |||
60 | void arch_spin_lock_slow(arch_spinlock_t *lock, u32 val); | ||
61 | |||
62 | /* Grab the "next" ticket number and bump it atomically. | ||
63 | * If the current ticket is not ours, go to the slow path. | ||
64 | * We also take the slow path if the "next" value overflows. | ||
65 | */ | ||
66 | static inline void arch_spin_lock(arch_spinlock_t *lock) | ||
67 | { | ||
68 | u32 val = __insn_fetchadd4(&lock->lock, 1); | ||
69 | u32 ticket = val & (__ARCH_SPIN_NEXT_MASK | __ARCH_SPIN_NEXT_OVERFLOW); | ||
70 | if (unlikely(arch_spin_current(val) != ticket)) | ||
71 | arch_spin_lock_slow(lock, ticket); | ||
72 | } | ||
73 | |||
74 | /* Try to get the lock, and return whether we succeeded. */ | ||
75 | int arch_spin_trylock(arch_spinlock_t *lock); | ||
76 | |||
77 | /* We cannot take an interrupt after getting a ticket, so don't enable them. */ | ||
78 | #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) | ||
79 | |||
80 | /* | ||
81 | * Read-write spinlocks, allowing multiple readers | ||
82 | * but only one writer. | ||
83 | * | ||
84 | * We use fetchadd() for readers, and fetchor() with the sign bit | ||
85 | * for writers. | ||
86 | */ | ||
87 | |||
88 | #define __WRITE_LOCK_BIT (1 << 31) | ||
89 | |||
90 | static inline int arch_write_val_locked(int val) | ||
91 | { | ||
92 | return val < 0; /* Optimize "val & __WRITE_LOCK_BIT". */ | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * read_can_lock - would read_trylock() succeed? | ||
97 | * @lock: the rwlock in question. | ||
98 | */ | ||
99 | static inline int arch_read_can_lock(arch_rwlock_t *rw) | ||
100 | { | ||
101 | return !arch_write_val_locked(rw->lock); | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * write_can_lock - would write_trylock() succeed? | ||
106 | * @lock: the rwlock in question. | ||
107 | */ | ||
108 | static inline int arch_write_can_lock(arch_rwlock_t *rw) | ||
109 | { | ||
110 | return rw->lock == 0; | ||
111 | } | ||
112 | |||
113 | extern void __read_lock_failed(arch_rwlock_t *rw); | ||
114 | |||
115 | static inline void arch_read_lock(arch_rwlock_t *rw) | ||
116 | { | ||
117 | u32 val = __insn_fetchaddgez4(&rw->lock, 1); | ||
118 | if (unlikely(arch_write_val_locked(val))) | ||
119 | __read_lock_failed(rw); | ||
120 | } | ||
121 | |||
122 | extern void __write_lock_failed(arch_rwlock_t *rw, u32 val); | ||
123 | |||
124 | static inline void arch_write_lock(arch_rwlock_t *rw) | ||
125 | { | ||
126 | u32 val = __insn_fetchor4(&rw->lock, __WRITE_LOCK_BIT); | ||
127 | if (unlikely(val != 0)) | ||
128 | __write_lock_failed(rw, val); | ||
129 | } | ||
130 | |||
131 | static inline void arch_read_unlock(arch_rwlock_t *rw) | ||
132 | { | ||
133 | __insn_mf(); | ||
134 | __insn_fetchadd4(&rw->lock, -1); | ||
135 | } | ||
136 | |||
137 | static inline void arch_write_unlock(arch_rwlock_t *rw) | ||
138 | { | ||
139 | __insn_mf(); | ||
140 | rw->lock = 0; | ||
141 | } | ||
142 | |||
143 | static inline int arch_read_trylock(arch_rwlock_t *rw) | ||
144 | { | ||
145 | return !arch_write_val_locked(__insn_fetchaddgez4(&rw->lock, 1)); | ||
146 | } | ||
147 | |||
148 | static inline int arch_write_trylock(arch_rwlock_t *rw) | ||
149 | { | ||
150 | u32 val = __insn_fetchor4(&rw->lock, __WRITE_LOCK_BIT); | ||
151 | if (likely(val == 0)) | ||
152 | return 1; | ||
153 | if (!arch_write_val_locked(val)) | ||
154 | __insn_fetchand4(&rw->lock, ~__WRITE_LOCK_BIT); | ||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) | ||
159 | #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) | ||
160 | |||
161 | #endif /* _ASM_TILE_SPINLOCK_64_H */ | ||
diff --git a/arch/tile/include/asm/stat.h b/arch/tile/include/asm/stat.h index b16e5db8f0e7..c0db34d56be3 100644 --- a/arch/tile/include/asm/stat.h +++ b/arch/tile/include/asm/stat.h | |||
@@ -1,4 +1,4 @@ | |||
1 | #ifdef CONFIG_COMPAT | 1 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) |
2 | #define __ARCH_WANT_STAT64 /* Used for compat_sys_stat64() etc. */ | 2 | #define __ARCH_WANT_STAT64 /* Used for compat_sys_stat64() etc. */ |
3 | #endif | 3 | #endif |
4 | #include <asm-generic/stat.h> | 4 | #include <asm-generic/stat.h> |
diff --git a/arch/tile/include/asm/swab.h b/arch/tile/include/asm/swab.h index 25c686a00f1d..7c37b38f6c8d 100644 --- a/arch/tile/include/asm/swab.h +++ b/arch/tile/include/asm/swab.h | |||
@@ -18,12 +18,6 @@ | |||
18 | /* Tile gcc is always >= 4.3.0, so we use __builtin_bswap. */ | 18 | /* Tile gcc is always >= 4.3.0, so we use __builtin_bswap. */ |
19 | #define __arch_swab32(x) __builtin_bswap32(x) | 19 | #define __arch_swab32(x) __builtin_bswap32(x) |
20 | #define __arch_swab64(x) __builtin_bswap64(x) | 20 | #define __arch_swab64(x) __builtin_bswap64(x) |
21 | |||
22 | /* Use the variant that is natural for the wordsize. */ | ||
23 | #ifdef CONFIG_64BIT | ||
24 | #define __arch_swab16(x) (__builtin_bswap64(x) >> 48) | ||
25 | #else | ||
26 | #define __arch_swab16(x) (__builtin_bswap32(x) >> 16) | 21 | #define __arch_swab16(x) (__builtin_bswap32(x) >> 16) |
27 | #endif | ||
28 | 22 | ||
29 | #endif /* _ASM_TILE_SWAB_H */ | 23 | #endif /* _ASM_TILE_SWAB_H */ |
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h index 3405b52853b8..bc4f562bd459 100644 --- a/arch/tile/include/asm/thread_info.h +++ b/arch/tile/include/asm/thread_info.h | |||
@@ -125,6 +125,7 @@ extern void cpu_idle_on_new_stack(struct thread_info *old_ti, | |||
125 | #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ | 125 | #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ |
126 | #define TIF_SECCOMP 6 /* secure computing */ | 126 | #define TIF_SECCOMP 6 /* secure computing */ |
127 | #define TIF_MEMDIE 7 /* OOM killer at work */ | 127 | #define TIF_MEMDIE 7 /* OOM killer at work */ |
128 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ | ||
128 | 129 | ||
129 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 130 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
130 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 131 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
@@ -134,10 +135,12 @@ extern void cpu_idle_on_new_stack(struct thread_info *old_ti, | |||
134 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 135 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
135 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 136 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
136 | #define _TIF_MEMDIE (1<<TIF_MEMDIE) | 137 | #define _TIF_MEMDIE (1<<TIF_MEMDIE) |
138 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
137 | 139 | ||
138 | /* Work to do on any return to user space. */ | 140 | /* Work to do on any return to user space. */ |
139 | #define _TIF_ALLWORK_MASK \ | 141 | #define _TIF_ALLWORK_MASK \ |
140 | (_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SINGLESTEP|_TIF_ASYNC_TLB) | 142 | (_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SINGLESTEP|\ |
143 | _TIF_ASYNC_TLB|_TIF_NOTIFY_RESUME) | ||
141 | 144 | ||
142 | /* | 145 | /* |
143 | * Thread-synchronous status. | 146 | * Thread-synchronous status. |
diff --git a/arch/tile/include/asm/topology.h b/arch/tile/include/asm/topology.h index 343172d422a9..6fdd0c860193 100644 --- a/arch/tile/include/asm/topology.h +++ b/arch/tile/include/asm/topology.h | |||
@@ -44,25 +44,64 @@ static inline const struct cpumask *cpumask_of_node(int node) | |||
44 | /* For now, use numa node -1 for global allocation. */ | 44 | /* For now, use numa node -1 for global allocation. */ |
45 | #define pcibus_to_node(bus) ((void)(bus), -1) | 45 | #define pcibus_to_node(bus) ((void)(bus), -1) |
46 | 46 | ||
47 | /* | ||
48 | * TILE architecture has many cores integrated in one processor, so we need | ||
49 | * setup bigger balance_interval for both CPU/NODE scheduling domains to | ||
50 | * reduce process scheduling costs. | ||
51 | */ | ||
52 | |||
53 | /* sched_domains SD_CPU_INIT for TILE architecture */ | ||
54 | #define SD_CPU_INIT (struct sched_domain) { \ | ||
55 | .min_interval = 4, \ | ||
56 | .max_interval = 128, \ | ||
57 | .busy_factor = 64, \ | ||
58 | .imbalance_pct = 125, \ | ||
59 | .cache_nice_tries = 1, \ | ||
60 | .busy_idx = 2, \ | ||
61 | .idle_idx = 1, \ | ||
62 | .newidle_idx = 0, \ | ||
63 | .wake_idx = 0, \ | ||
64 | .forkexec_idx = 0, \ | ||
65 | \ | ||
66 | .flags = 1*SD_LOAD_BALANCE \ | ||
67 | | 1*SD_BALANCE_NEWIDLE \ | ||
68 | | 1*SD_BALANCE_EXEC \ | ||
69 | | 1*SD_BALANCE_FORK \ | ||
70 | | 0*SD_BALANCE_WAKE \ | ||
71 | | 0*SD_WAKE_AFFINE \ | ||
72 | | 0*SD_PREFER_LOCAL \ | ||
73 | | 0*SD_SHARE_CPUPOWER \ | ||
74 | | 0*SD_SHARE_PKG_RESOURCES \ | ||
75 | | 0*SD_SERIALIZE \ | ||
76 | , \ | ||
77 | .last_balance = jiffies, \ | ||
78 | .balance_interval = 32, \ | ||
79 | } | ||
80 | |||
47 | /* sched_domains SD_NODE_INIT for TILE architecture */ | 81 | /* sched_domains SD_NODE_INIT for TILE architecture */ |
48 | #define SD_NODE_INIT (struct sched_domain) { \ | 82 | #define SD_NODE_INIT (struct sched_domain) { \ |
49 | .min_interval = 8, \ | 83 | .min_interval = 16, \ |
50 | .max_interval = 32, \ | 84 | .max_interval = 512, \ |
51 | .busy_factor = 32, \ | 85 | .busy_factor = 32, \ |
52 | .imbalance_pct = 125, \ | 86 | .imbalance_pct = 125, \ |
53 | .cache_nice_tries = 1, \ | 87 | .cache_nice_tries = 1, \ |
54 | .busy_idx = 3, \ | 88 | .busy_idx = 3, \ |
55 | .idle_idx = 1, \ | 89 | .idle_idx = 1, \ |
56 | .newidle_idx = 2, \ | 90 | .newidle_idx = 2, \ |
57 | .wake_idx = 1, \ | 91 | .wake_idx = 1, \ |
58 | .flags = SD_LOAD_BALANCE \ | 92 | .flags = 1*SD_LOAD_BALANCE \ |
59 | | SD_BALANCE_NEWIDLE \ | 93 | | 1*SD_BALANCE_NEWIDLE \ |
60 | | SD_BALANCE_EXEC \ | 94 | | 1*SD_BALANCE_EXEC \ |
61 | | SD_BALANCE_FORK \ | 95 | | 1*SD_BALANCE_FORK \ |
62 | | SD_WAKE_AFFINE \ | 96 | | 0*SD_BALANCE_WAKE \ |
63 | | SD_SERIALIZE, \ | 97 | | 0*SD_WAKE_AFFINE \ |
64 | .last_balance = jiffies, \ | 98 | | 0*SD_PREFER_LOCAL \ |
65 | .balance_interval = 1, \ | 99 | | 0*SD_SHARE_CPUPOWER \ |
100 | | 0*SD_SHARE_PKG_RESOURCES \ | ||
101 | | 1*SD_SERIALIZE \ | ||
102 | , \ | ||
103 | .last_balance = jiffies, \ | ||
104 | .balance_interval = 128, \ | ||
66 | } | 105 | } |
67 | 106 | ||
68 | /* By definition, we create nodes based on online memory. */ | 107 | /* By definition, we create nodes based on online memory. */ |
diff --git a/arch/tile/include/asm/traps.h b/arch/tile/include/asm/traps.h index d06e35f57201..5f20f920f932 100644 --- a/arch/tile/include/asm/traps.h +++ b/arch/tile/include/asm/traps.h | |||
@@ -15,10 +15,14 @@ | |||
15 | #ifndef _ASM_TILE_TRAPS_H | 15 | #ifndef _ASM_TILE_TRAPS_H |
16 | #define _ASM_TILE_TRAPS_H | 16 | #define _ASM_TILE_TRAPS_H |
17 | 17 | ||
18 | #include <arch/chip.h> | ||
19 | |||
18 | /* mm/fault.c */ | 20 | /* mm/fault.c */ |
19 | void do_page_fault(struct pt_regs *, int fault_num, | 21 | void do_page_fault(struct pt_regs *, int fault_num, |
20 | unsigned long address, unsigned long write); | 22 | unsigned long address, unsigned long write); |
23 | #if CHIP_HAS_TILE_DMA() || CHIP_HAS_SN_PROC() | ||
21 | void do_async_page_fault(struct pt_regs *); | 24 | void do_async_page_fault(struct pt_regs *); |
25 | #endif | ||
22 | 26 | ||
23 | #ifndef __tilegx__ | 27 | #ifndef __tilegx__ |
24 | /* | 28 | /* |
diff --git a/arch/tile/include/asm/unistd.h b/arch/tile/include/asm/unistd.h index b35c2db71199..f70bf1c541f1 100644 --- a/arch/tile/include/asm/unistd.h +++ b/arch/tile/include/asm/unistd.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #if !defined(_ASM_TILE_UNISTD_H) || defined(__SYSCALL) | 15 | #if !defined(_ASM_TILE_UNISTD_H) || defined(__SYSCALL) |
16 | #define _ASM_TILE_UNISTD_H | 16 | #define _ASM_TILE_UNISTD_H |
17 | 17 | ||
18 | #ifndef __LP64__ | 18 | #if !defined(__LP64__) || defined(__SYSCALL_COMPAT) |
19 | /* Use the flavor of this syscall that matches the 32-bit API better. */ | 19 | /* Use the flavor of this syscall that matches the 32-bit API better. */ |
20 | #define __ARCH_WANT_SYNC_FILE_RANGE2 | 20 | #define __ARCH_WANT_SYNC_FILE_RANGE2 |
21 | #endif | 21 | #endif |
diff --git a/arch/tile/include/hv/pagesize.h b/arch/tile/include/asm/vga.h index 58bed114fedd..7b46e754d611 100644 --- a/arch/tile/include/hv/pagesize.h +++ b/arch/tile/include/asm/vga.h | |||
@@ -10,23 +10,30 @@ | |||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | 10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
11 | * NON INFRINGEMENT. See the GNU General Public License for | 11 | * NON INFRINGEMENT. See the GNU General Public License for |
12 | * more details. | 12 | * more details. |
13 | * | ||
14 | * Access to VGA videoram. | ||
13 | */ | 15 | */ |
14 | 16 | ||
15 | /** | 17 | #ifndef _ASM_TILE_VGA_H |
16 | * @file pagesize.h | 18 | #define _ASM_TILE_VGA_H |
17 | */ | ||
18 | 19 | ||
19 | #ifndef _HV_PAGESIZE_H | 20 | #include <asm/io.h> |
20 | #define _HV_PAGESIZE_H | ||
21 | 21 | ||
22 | /** The log2 of the size of small pages, in bytes. This value should | 22 | #define VT_BUF_HAVE_RW |
23 | * be verified at runtime by calling hv_sysconf(HV_SYSCONF_PAGE_SIZE_SMALL). | ||
24 | */ | ||
25 | #define HV_LOG2_PAGE_SIZE_SMALL 16 | ||
26 | 23 | ||
27 | /** The log2 of the size of large pages, in bytes. This value should be | 24 | static inline void scr_writew(u16 val, volatile u16 *addr) |
28 | * verified at runtime by calling hv_sysconf(HV_SYSCONF_PAGE_SIZE_LARGE). | 25 | { |
29 | */ | 26 | __raw_writew(val, (volatile u16 __iomem *) addr); |
30 | #define HV_LOG2_PAGE_SIZE_LARGE 24 | 27 | } |
28 | |||
29 | static inline u16 scr_readw(volatile const u16 *addr) | ||
30 | { | ||
31 | return __raw_readw((volatile const u16 __iomem *) addr); | ||
32 | } | ||
33 | |||
34 | #define vga_readb(a) readb((u8 __iomem *)(a)) | ||
35 | #define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a)) | ||
36 | |||
37 | #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s)) | ||
31 | 38 | ||
32 | #endif /* _HV_PAGESIZE_H */ | 39 | #endif |
diff --git a/arch/tile/include/hv/hypervisor.h b/arch/tile/include/hv/hypervisor.h index ee41bca4c8c4..72ec1e972f15 100644 --- a/arch/tile/include/hv/hypervisor.h +++ b/arch/tile/include/hv/hypervisor.h | |||
@@ -22,8 +22,6 @@ | |||
22 | 22 | ||
23 | #include <arch/chip.h> | 23 | #include <arch/chip.h> |
24 | 24 | ||
25 | #include <hv/pagesize.h> | ||
26 | |||
27 | /* Linux builds want unsigned long constants, but assembler wants numbers */ | 25 | /* Linux builds want unsigned long constants, but assembler wants numbers */ |
28 | #ifdef __ASSEMBLER__ | 26 | #ifdef __ASSEMBLER__ |
29 | /** One, for assembler */ | 27 | /** One, for assembler */ |
@@ -44,11 +42,21 @@ | |||
44 | */ | 42 | */ |
45 | #define HV_L1_SPAN (__HV_SIZE_ONE << HV_LOG2_L1_SPAN) | 43 | #define HV_L1_SPAN (__HV_SIZE_ONE << HV_LOG2_L1_SPAN) |
46 | 44 | ||
45 | /** The log2 of the size of small pages, in bytes. This value should | ||
46 | * be verified at runtime by calling hv_sysconf(HV_SYSCONF_PAGE_SIZE_SMALL). | ||
47 | */ | ||
48 | #define HV_LOG2_PAGE_SIZE_SMALL 16 | ||
49 | |||
47 | /** The size of small pages, in bytes. This value should be verified | 50 | /** The size of small pages, in bytes. This value should be verified |
48 | * at runtime by calling hv_sysconf(HV_SYSCONF_PAGE_SIZE_SMALL). | 51 | * at runtime by calling hv_sysconf(HV_SYSCONF_PAGE_SIZE_SMALL). |
49 | */ | 52 | */ |
50 | #define HV_PAGE_SIZE_SMALL (__HV_SIZE_ONE << HV_LOG2_PAGE_SIZE_SMALL) | 53 | #define HV_PAGE_SIZE_SMALL (__HV_SIZE_ONE << HV_LOG2_PAGE_SIZE_SMALL) |
51 | 54 | ||
55 | /** The log2 of the size of large pages, in bytes. This value should be | ||
56 | * verified at runtime by calling hv_sysconf(HV_SYSCONF_PAGE_SIZE_LARGE). | ||
57 | */ | ||
58 | #define HV_LOG2_PAGE_SIZE_LARGE 24 | ||
59 | |||
52 | /** The size of large pages, in bytes. This value should be verified | 60 | /** The size of large pages, in bytes. This value should be verified |
53 | * at runtime by calling hv_sysconf(HV_SYSCONF_PAGE_SIZE_LARGE). | 61 | * at runtime by calling hv_sysconf(HV_SYSCONF_PAGE_SIZE_LARGE). |
54 | */ | 62 | */ |
diff --git a/arch/tile/kernel/backtrace.c b/arch/tile/kernel/backtrace.c index 55a6a74974b4..1dc71eabfc5a 100644 --- a/arch/tile/kernel/backtrace.c +++ b/arch/tile/kernel/backtrace.c | |||
@@ -14,19 +14,11 @@ | |||
14 | 14 | ||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | |||
18 | #include <asm/backtrace.h> | 17 | #include <asm/backtrace.h> |
19 | |||
20 | #include <arch/chip.h> | ||
21 | |||
22 | #include <asm/opcode-tile.h> | 18 | #include <asm/opcode-tile.h> |
19 | #include <arch/abi.h> | ||
23 | 20 | ||
24 | 21 | #ifdef __tilegx__ | |
25 | #define TREG_SP 54 | ||
26 | #define TREG_LR 55 | ||
27 | |||
28 | |||
29 | #if TILE_CHIP >= 10 | ||
30 | #define tile_bundle_bits tilegx_bundle_bits | 22 | #define tile_bundle_bits tilegx_bundle_bits |
31 | #define TILE_MAX_INSTRUCTIONS_PER_BUNDLE TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE | 23 | #define TILE_MAX_INSTRUCTIONS_PER_BUNDLE TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE |
32 | #define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEGX_BUNDLE_ALIGNMENT_IN_BYTES | 24 | #define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEGX_BUNDLE_ALIGNMENT_IN_BYTES |
@@ -47,7 +39,7 @@ typedef long long bt_int_reg_t; | |||
47 | typedef int bt_int_reg_t; | 39 | typedef int bt_int_reg_t; |
48 | #endif | 40 | #endif |
49 | 41 | ||
50 | /** A decoded bundle used for backtracer analysis. */ | 42 | /* A decoded bundle used for backtracer analysis. */ |
51 | struct BacktraceBundle { | 43 | struct BacktraceBundle { |
52 | tile_bundle_bits bits; | 44 | tile_bundle_bits bits; |
53 | int num_insns; | 45 | int num_insns; |
@@ -56,23 +48,7 @@ struct BacktraceBundle { | |||
56 | }; | 48 | }; |
57 | 49 | ||
58 | 50 | ||
59 | /* This implementation only makes sense for native tools. */ | 51 | /* Locates an instruction inside the given bundle that |
60 | /** Default function to read memory. */ | ||
61 | static bool bt_read_memory(void *result, VirtualAddress addr, | ||
62 | unsigned int size, void *extra) | ||
63 | { | ||
64 | /* FIXME: this should do some horrible signal stuff to catch | ||
65 | * SEGV cleanly and fail. | ||
66 | * | ||
67 | * Or else the caller should do the setjmp for efficiency. | ||
68 | */ | ||
69 | |||
70 | memcpy(result, (const void *)addr, size); | ||
71 | return true; | ||
72 | } | ||
73 | |||
74 | |||
75 | /** Locates an instruction inside the given bundle that | ||
76 | * has the specified mnemonic, and whose first 'num_operands_to_match' | 52 | * has the specified mnemonic, and whose first 'num_operands_to_match' |
77 | * operands exactly match those in 'operand_values'. | 53 | * operands exactly match those in 'operand_values'. |
78 | */ | 54 | */ |
@@ -107,13 +83,13 @@ static const struct tile_decoded_instruction *find_matching_insn( | |||
107 | return NULL; | 83 | return NULL; |
108 | } | 84 | } |
109 | 85 | ||
110 | /** Does this bundle contain an 'iret' instruction? */ | 86 | /* Does this bundle contain an 'iret' instruction? */ |
111 | static inline bool bt_has_iret(const struct BacktraceBundle *bundle) | 87 | static inline bool bt_has_iret(const struct BacktraceBundle *bundle) |
112 | { | 88 | { |
113 | return find_matching_insn(bundle, TILE_OPC_IRET, NULL, 0) != NULL; | 89 | return find_matching_insn(bundle, TILE_OPC_IRET, NULL, 0) != NULL; |
114 | } | 90 | } |
115 | 91 | ||
116 | /** Does this bundle contain an 'addi sp, sp, OFFSET' or | 92 | /* Does this bundle contain an 'addi sp, sp, OFFSET' or |
117 | * 'addli sp, sp, OFFSET' instruction, and if so, what is OFFSET? | 93 | * 'addli sp, sp, OFFSET' instruction, and if so, what is OFFSET? |
118 | */ | 94 | */ |
119 | static bool bt_has_addi_sp(const struct BacktraceBundle *bundle, int *adjust) | 95 | static bool bt_has_addi_sp(const struct BacktraceBundle *bundle, int *adjust) |
@@ -124,7 +100,7 @@ static bool bt_has_addi_sp(const struct BacktraceBundle *bundle, int *adjust) | |||
124 | find_matching_insn(bundle, TILE_OPC_ADDI, vals, 2); | 100 | find_matching_insn(bundle, TILE_OPC_ADDI, vals, 2); |
125 | if (insn == NULL) | 101 | if (insn == NULL) |
126 | insn = find_matching_insn(bundle, TILE_OPC_ADDLI, vals, 2); | 102 | insn = find_matching_insn(bundle, TILE_OPC_ADDLI, vals, 2); |
127 | #if TILE_CHIP >= 10 | 103 | #ifdef __tilegx__ |
128 | if (insn == NULL) | 104 | if (insn == NULL) |
129 | insn = find_matching_insn(bundle, TILEGX_OPC_ADDXLI, vals, 2); | 105 | insn = find_matching_insn(bundle, TILEGX_OPC_ADDXLI, vals, 2); |
130 | if (insn == NULL) | 106 | if (insn == NULL) |
@@ -137,7 +113,7 @@ static bool bt_has_addi_sp(const struct BacktraceBundle *bundle, int *adjust) | |||
137 | return true; | 113 | return true; |
138 | } | 114 | } |
139 | 115 | ||
140 | /** Does this bundle contain any 'info OP' or 'infol OP' | 116 | /* Does this bundle contain any 'info OP' or 'infol OP' |
141 | * instruction, and if so, what are their OP? Note that OP is interpreted | 117 | * instruction, and if so, what are their OP? Note that OP is interpreted |
142 | * as an unsigned value by this code since that's what the caller wants. | 118 | * as an unsigned value by this code since that's what the caller wants. |
143 | * Returns the number of info ops found. | 119 | * Returns the number of info ops found. |
@@ -161,7 +137,7 @@ static int bt_get_info_ops(const struct BacktraceBundle *bundle, | |||
161 | return num_ops; | 137 | return num_ops; |
162 | } | 138 | } |
163 | 139 | ||
164 | /** Does this bundle contain a jrp instruction, and if so, to which | 140 | /* Does this bundle contain a jrp instruction, and if so, to which |
165 | * register is it jumping? | 141 | * register is it jumping? |
166 | */ | 142 | */ |
167 | static bool bt_has_jrp(const struct BacktraceBundle *bundle, int *target_reg) | 143 | static bool bt_has_jrp(const struct BacktraceBundle *bundle, int *target_reg) |
@@ -175,7 +151,7 @@ static bool bt_has_jrp(const struct BacktraceBundle *bundle, int *target_reg) | |||
175 | return true; | 151 | return true; |
176 | } | 152 | } |
177 | 153 | ||
178 | /** Does this bundle modify the specified register in any way? */ | 154 | /* Does this bundle modify the specified register in any way? */ |
179 | static bool bt_modifies_reg(const struct BacktraceBundle *bundle, int reg) | 155 | static bool bt_modifies_reg(const struct BacktraceBundle *bundle, int reg) |
180 | { | 156 | { |
181 | int i, j; | 157 | int i, j; |
@@ -195,34 +171,34 @@ static bool bt_modifies_reg(const struct BacktraceBundle *bundle, int reg) | |||
195 | return false; | 171 | return false; |
196 | } | 172 | } |
197 | 173 | ||
198 | /** Does this bundle modify sp? */ | 174 | /* Does this bundle modify sp? */ |
199 | static inline bool bt_modifies_sp(const struct BacktraceBundle *bundle) | 175 | static inline bool bt_modifies_sp(const struct BacktraceBundle *bundle) |
200 | { | 176 | { |
201 | return bt_modifies_reg(bundle, TREG_SP); | 177 | return bt_modifies_reg(bundle, TREG_SP); |
202 | } | 178 | } |
203 | 179 | ||
204 | /** Does this bundle modify lr? */ | 180 | /* Does this bundle modify lr? */ |
205 | static inline bool bt_modifies_lr(const struct BacktraceBundle *bundle) | 181 | static inline bool bt_modifies_lr(const struct BacktraceBundle *bundle) |
206 | { | 182 | { |
207 | return bt_modifies_reg(bundle, TREG_LR); | 183 | return bt_modifies_reg(bundle, TREG_LR); |
208 | } | 184 | } |
209 | 185 | ||
210 | /** Does this bundle contain the instruction 'move fp, sp'? */ | 186 | /* Does this bundle contain the instruction 'move fp, sp'? */ |
211 | static inline bool bt_has_move_r52_sp(const struct BacktraceBundle *bundle) | 187 | static inline bool bt_has_move_r52_sp(const struct BacktraceBundle *bundle) |
212 | { | 188 | { |
213 | static const int vals[2] = { 52, TREG_SP }; | 189 | static const int vals[2] = { 52, TREG_SP }; |
214 | return find_matching_insn(bundle, TILE_OPC_MOVE, vals, 2) != NULL; | 190 | return find_matching_insn(bundle, TILE_OPC_MOVE, vals, 2) != NULL; |
215 | } | 191 | } |
216 | 192 | ||
217 | /** Does this bundle contain a store of lr to sp? */ | 193 | /* Does this bundle contain a store of lr to sp? */ |
218 | static inline bool bt_has_sw_sp_lr(const struct BacktraceBundle *bundle) | 194 | static inline bool bt_has_sw_sp_lr(const struct BacktraceBundle *bundle) |
219 | { | 195 | { |
220 | static const int vals[2] = { TREG_SP, TREG_LR }; | 196 | static const int vals[2] = { TREG_SP, TREG_LR }; |
221 | return find_matching_insn(bundle, OPCODE_STORE, vals, 2) != NULL; | 197 | return find_matching_insn(bundle, OPCODE_STORE, vals, 2) != NULL; |
222 | } | 198 | } |
223 | 199 | ||
224 | #if TILE_CHIP >= 10 | 200 | #ifdef __tilegx__ |
225 | /** Track moveli values placed into registers. */ | 201 | /* Track moveli values placed into registers. */ |
226 | static inline void bt_update_moveli(const struct BacktraceBundle *bundle, | 202 | static inline void bt_update_moveli(const struct BacktraceBundle *bundle, |
227 | int moveli_args[]) | 203 | int moveli_args[]) |
228 | { | 204 | { |
@@ -238,7 +214,7 @@ static inline void bt_update_moveli(const struct BacktraceBundle *bundle, | |||
238 | } | 214 | } |
239 | } | 215 | } |
240 | 216 | ||
241 | /** Does this bundle contain an 'add sp, sp, reg' instruction | 217 | /* Does this bundle contain an 'add sp, sp, reg' instruction |
242 | * from a register that we saw a moveli into, and if so, what | 218 | * from a register that we saw a moveli into, and if so, what |
243 | * is the value in the register? | 219 | * is the value in the register? |
244 | */ | 220 | */ |
@@ -260,11 +236,11 @@ static bool bt_has_add_sp(const struct BacktraceBundle *bundle, int *adjust, | |||
260 | } | 236 | } |
261 | #endif | 237 | #endif |
262 | 238 | ||
263 | /** Locates the caller's PC and SP for a program starting at the | 239 | /* Locates the caller's PC and SP for a program starting at the |
264 | * given address. | 240 | * given address. |
265 | */ | 241 | */ |
266 | static void find_caller_pc_and_caller_sp(CallerLocation *location, | 242 | static void find_caller_pc_and_caller_sp(CallerLocation *location, |
267 | const VirtualAddress start_pc, | 243 | const unsigned long start_pc, |
268 | BacktraceMemoryReader read_memory_func, | 244 | BacktraceMemoryReader read_memory_func, |
269 | void *read_memory_func_extra) | 245 | void *read_memory_func_extra) |
270 | { | 246 | { |
@@ -288,9 +264,9 @@ static void find_caller_pc_and_caller_sp(CallerLocation *location, | |||
288 | tile_bundle_bits prefetched_bundles[32]; | 264 | tile_bundle_bits prefetched_bundles[32]; |
289 | int num_bundles_prefetched = 0; | 265 | int num_bundles_prefetched = 0; |
290 | int next_bundle = 0; | 266 | int next_bundle = 0; |
291 | VirtualAddress pc; | 267 | unsigned long pc; |
292 | 268 | ||
293 | #if TILE_CHIP >= 10 | 269 | #ifdef __tilegx__ |
294 | /* Naively try to track moveli values to support addx for -m32. */ | 270 | /* Naively try to track moveli values to support addx for -m32. */ |
295 | int moveli_args[TILEGX_NUM_REGISTERS] = { 0 }; | 271 | int moveli_args[TILEGX_NUM_REGISTERS] = { 0 }; |
296 | #endif | 272 | #endif |
@@ -369,10 +345,6 @@ static void find_caller_pc_and_caller_sp(CallerLocation *location, | |||
369 | /* Weird; reserved value, ignore it. */ | 345 | /* Weird; reserved value, ignore it. */ |
370 | continue; | 346 | continue; |
371 | } | 347 | } |
372 | if (info_operand & ENTRY_POINT_INFO_OP) { | ||
373 | /* This info op is ignored by the backtracer. */ | ||
374 | continue; | ||
375 | } | ||
376 | 348 | ||
377 | /* Skip info ops which are not in the | 349 | /* Skip info ops which are not in the |
378 | * "one_ago" mode we want right now. | 350 | * "one_ago" mode we want right now. |
@@ -453,7 +425,7 @@ static void find_caller_pc_and_caller_sp(CallerLocation *location, | |||
453 | if (!sp_determined) { | 425 | if (!sp_determined) { |
454 | int adjust; | 426 | int adjust; |
455 | if (bt_has_addi_sp(&bundle, &adjust) | 427 | if (bt_has_addi_sp(&bundle, &adjust) |
456 | #if TILE_CHIP >= 10 | 428 | #ifdef __tilegx__ |
457 | || bt_has_add_sp(&bundle, &adjust, moveli_args) | 429 | || bt_has_add_sp(&bundle, &adjust, moveli_args) |
458 | #endif | 430 | #endif |
459 | ) { | 431 | ) { |
@@ -504,7 +476,7 @@ static void find_caller_pc_and_caller_sp(CallerLocation *location, | |||
504 | } | 476 | } |
505 | } | 477 | } |
506 | 478 | ||
507 | #if TILE_CHIP >= 10 | 479 | #ifdef __tilegx__ |
508 | /* Track moveli arguments for -m32 mode. */ | 480 | /* Track moveli arguments for -m32 mode. */ |
509 | bt_update_moveli(&bundle, moveli_args); | 481 | bt_update_moveli(&bundle, moveli_args); |
510 | #endif | 482 | #endif |
@@ -546,18 +518,26 @@ static void find_caller_pc_and_caller_sp(CallerLocation *location, | |||
546 | } | 518 | } |
547 | } | 519 | } |
548 | 520 | ||
521 | /* Initializes a backtracer to start from the given location. | ||
522 | * | ||
523 | * If the frame pointer cannot be determined it is set to -1. | ||
524 | * | ||
525 | * state: The state to be filled in. | ||
526 | * read_memory_func: A callback that reads memory. | ||
527 | * read_memory_func_extra: An arbitrary argument to read_memory_func. | ||
528 | * pc: The current PC. | ||
529 | * lr: The current value of the 'lr' register. | ||
530 | * sp: The current value of the 'sp' register. | ||
531 | * r52: The current value of the 'r52' register. | ||
532 | */ | ||
549 | void backtrace_init(BacktraceIterator *state, | 533 | void backtrace_init(BacktraceIterator *state, |
550 | BacktraceMemoryReader read_memory_func, | 534 | BacktraceMemoryReader read_memory_func, |
551 | void *read_memory_func_extra, | 535 | void *read_memory_func_extra, |
552 | VirtualAddress pc, VirtualAddress lr, | 536 | unsigned long pc, unsigned long lr, |
553 | VirtualAddress sp, VirtualAddress r52) | 537 | unsigned long sp, unsigned long r52) |
554 | { | 538 | { |
555 | CallerLocation location; | 539 | CallerLocation location; |
556 | VirtualAddress fp, initial_frame_caller_pc; | 540 | unsigned long fp, initial_frame_caller_pc; |
557 | |||
558 | if (read_memory_func == NULL) { | ||
559 | read_memory_func = bt_read_memory; | ||
560 | } | ||
561 | 541 | ||
562 | /* Find out where we are in the initial frame. */ | 542 | /* Find out where we are in the initial frame. */ |
563 | find_caller_pc_and_caller_sp(&location, pc, | 543 | find_caller_pc_and_caller_sp(&location, pc, |
@@ -630,12 +610,15 @@ void backtrace_init(BacktraceIterator *state, | |||
630 | /* Handle the case where the register holds more bits than the VA. */ | 610 | /* Handle the case where the register holds more bits than the VA. */ |
631 | static bool valid_addr_reg(bt_int_reg_t reg) | 611 | static bool valid_addr_reg(bt_int_reg_t reg) |
632 | { | 612 | { |
633 | return ((VirtualAddress)reg == reg); | 613 | return ((unsigned long)reg == reg); |
634 | } | 614 | } |
635 | 615 | ||
616 | /* Advances the backtracing state to the calling frame, returning | ||
617 | * true iff successful. | ||
618 | */ | ||
636 | bool backtrace_next(BacktraceIterator *state) | 619 | bool backtrace_next(BacktraceIterator *state) |
637 | { | 620 | { |
638 | VirtualAddress next_fp, next_pc; | 621 | unsigned long next_fp, next_pc; |
639 | bt_int_reg_t next_frame[2]; | 622 | bt_int_reg_t next_frame[2]; |
640 | 623 | ||
641 | if (state->fp == -1) { | 624 | if (state->fp == -1) { |
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c index dbc213adf5e1..bf5e9d70266c 100644 --- a/arch/tile/kernel/compat.c +++ b/arch/tile/kernel/compat.c | |||
@@ -135,26 +135,15 @@ long tile_compat_sys_msgrcv(int msqid, | |||
135 | 135 | ||
136 | /* Provide the compat syscall number to call mapping. */ | 136 | /* Provide the compat syscall number to call mapping. */ |
137 | #undef __SYSCALL | 137 | #undef __SYSCALL |
138 | #define __SYSCALL(nr, call) [nr] = (compat_##call), | 138 | #define __SYSCALL(nr, call) [nr] = (call), |
139 | 139 | ||
140 | /* The generic versions of these don't work for Tile. */ | 140 | /* The generic versions of these don't work for Tile. */ |
141 | #define compat_sys_msgrcv tile_compat_sys_msgrcv | 141 | #define compat_sys_msgrcv tile_compat_sys_msgrcv |
142 | #define compat_sys_msgsnd tile_compat_sys_msgsnd | 142 | #define compat_sys_msgsnd tile_compat_sys_msgsnd |
143 | 143 | ||
144 | /* See comments in sys.c */ | 144 | /* See comments in sys.c */ |
145 | #define compat_sys_fadvise64 sys32_fadvise64 | ||
146 | #define compat_sys_fadvise64_64 sys32_fadvise64_64 | 145 | #define compat_sys_fadvise64_64 sys32_fadvise64_64 |
147 | #define compat_sys_readahead sys32_readahead | 146 | #define compat_sys_readahead sys32_readahead |
148 | #define compat_sys_sync_file_range compat_sys_sync_file_range2 | ||
149 | |||
150 | /* We leverage the "struct stat64" type for 32-bit time_t/nsec. */ | ||
151 | #define compat_sys_stat64 sys_stat64 | ||
152 | #define compat_sys_lstat64 sys_lstat64 | ||
153 | #define compat_sys_fstat64 sys_fstat64 | ||
154 | #define compat_sys_fstatat64 sys_fstatat64 | ||
155 | |||
156 | /* The native sys_ptrace dynamically handles compat binaries. */ | ||
157 | #define compat_sys_ptrace sys_ptrace | ||
158 | 147 | ||
159 | /* Call the trampolines to manage pt_regs where necessary. */ | 148 | /* Call the trampolines to manage pt_regs where necessary. */ |
160 | #define compat_sys_execve _compat_sys_execve | 149 | #define compat_sys_execve _compat_sys_execve |
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index dbb0dfc7bece..a7869ad62776 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c | |||
@@ -317,7 +317,7 @@ long compat_sys_rt_sigreturn(struct pt_regs *regs) | |||
317 | return 0; | 317 | return 0; |
318 | 318 | ||
319 | badframe: | 319 | badframe: |
320 | force_sig(SIGSEGV, current); | 320 | signal_fault("bad sigreturn frame", regs, frame, 0); |
321 | return 0; | 321 | return 0; |
322 | } | 322 | } |
323 | 323 | ||
@@ -431,6 +431,6 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
431 | return 0; | 431 | return 0; |
432 | 432 | ||
433 | give_sigsegv: | 433 | give_sigsegv: |
434 | force_sigsegv(sig, current); | 434 | signal_fault("bad setup frame", regs, frame, sig); |
435 | return -EFAULT; | 435 | return -EFAULT; |
436 | } | 436 | } |
diff --git a/arch/tile/kernel/futex_64.S b/arch/tile/kernel/futex_64.S new file mode 100644 index 000000000000..f465d1eda20f --- /dev/null +++ b/arch/tile/kernel/futex_64.S | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * Atomically access user memory, but use MMU to avoid propagating | ||
15 | * kernel exceptions. | ||
16 | */ | ||
17 | |||
18 | #include <linux/linkage.h> | ||
19 | #include <asm/errno.h> | ||
20 | #include <asm/futex.h> | ||
21 | #include <asm/page.h> | ||
22 | #include <asm/processor.h> | ||
23 | |||
24 | /* | ||
25 | * Provide a set of atomic memory operations supporting <asm/futex.h>. | ||
26 | * | ||
27 | * r0: user address to manipulate | ||
28 | * r1: new value to write, or for cmpxchg, old value to compare against | ||
29 | * r2: (cmpxchg only) new value to write | ||
30 | * | ||
31 | * Return __get_user struct, r0 with value, r1 with error. | ||
32 | */ | ||
33 | #define FUTEX_OP(name, ...) \ | ||
34 | STD_ENTRY(futex_##name) \ | ||
35 | __VA_ARGS__; \ | ||
36 | { \ | ||
37 | move r1, zero; \ | ||
38 | jrp lr \ | ||
39 | }; \ | ||
40 | STD_ENDPROC(futex_##name); \ | ||
41 | .pushsection __ex_table,"a"; \ | ||
42 | .quad 1b, get_user_fault; \ | ||
43 | .popsection | ||
44 | |||
45 | .pushsection .fixup,"ax" | ||
46 | get_user_fault: | ||
47 | { movei r1, -EFAULT; jrp lr } | ||
48 | ENDPROC(get_user_fault) | ||
49 | .popsection | ||
50 | |||
51 | FUTEX_OP(cmpxchg, mtspr CMPEXCH_VALUE, r1; 1: cmpexch4 r0, r0, r2) | ||
52 | FUTEX_OP(set, 1: exch4 r0, r0, r1) | ||
53 | FUTEX_OP(add, 1: fetchadd4 r0, r0, r1) | ||
54 | FUTEX_OP(or, 1: fetchor4 r0, r0, r1) | ||
55 | FUTEX_OP(andn, nor r1, r1, zero; 1: fetchand4 r0, r0, r1) | ||
diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c index e910530436e6..3bddef710de4 100644 --- a/arch/tile/kernel/hardwall.c +++ b/arch/tile/kernel/hardwall.c | |||
@@ -268,12 +268,10 @@ void __kprobes do_hardwall_trap(struct pt_regs* regs, int fault_num) | |||
268 | found_processes = 0; | 268 | found_processes = 0; |
269 | list_for_each_entry(p, &rect->task_head, thread.hardwall_list) { | 269 | list_for_each_entry(p, &rect->task_head, thread.hardwall_list) { |
270 | BUG_ON(p->thread.hardwall != rect); | 270 | BUG_ON(p->thread.hardwall != rect); |
271 | if (p->sighand) { | 271 | if (!(p->flags & PF_EXITING)) { |
272 | found_processes = 1; | 272 | found_processes = 1; |
273 | pr_notice("hardwall: killing %d\n", p->pid); | 273 | pr_notice("hardwall: killing %d\n", p->pid); |
274 | spin_lock(&p->sighand->siglock); | 274 | do_send_sig_info(info.si_signo, &info, p, false); |
275 | __group_send_sig_info(info.si_signo, &info, p); | ||
276 | spin_unlock(&p->sighand->siglock); | ||
277 | } | 275 | } |
278 | } | 276 | } |
279 | if (!found_processes) | 277 | if (!found_processes) |
diff --git a/arch/tile/kernel/head_64.S b/arch/tile/kernel/head_64.S new file mode 100644 index 000000000000..6bc3a932fe45 --- /dev/null +++ b/arch/tile/kernel/head_64.S | |||
@@ -0,0 +1,269 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * TILE startup code. | ||
15 | */ | ||
16 | |||
17 | #include <linux/linkage.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <asm/page.h> | ||
20 | #include <asm/pgtable.h> | ||
21 | #include <asm/thread_info.h> | ||
22 | #include <asm/processor.h> | ||
23 | #include <asm/asm-offsets.h> | ||
24 | #include <hv/hypervisor.h> | ||
25 | #include <arch/chip.h> | ||
26 | #include <arch/spr_def.h> | ||
27 | |||
28 | /* | ||
29 | * This module contains the entry code for kernel images. It performs the | ||
30 | * minimal setup needed to call the generic C routines. | ||
31 | */ | ||
32 | |||
33 | __HEAD | ||
34 | ENTRY(_start) | ||
35 | /* Notify the hypervisor of what version of the API we want */ | ||
36 | { | ||
37 | movei r1, TILE_CHIP | ||
38 | movei r2, TILE_CHIP_REV | ||
39 | } | ||
40 | { | ||
41 | moveli r0, _HV_VERSION | ||
42 | jal hv_init | ||
43 | } | ||
44 | /* Get a reasonable default ASID in r0 */ | ||
45 | { | ||
46 | move r0, zero | ||
47 | jal hv_inquire_asid | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * Install the default page table. The relocation required to | ||
52 | * statically define the table is a bit too complex, so we have | ||
53 | * to plug in the pointer from the L0 to the L1 table by hand. | ||
54 | * We only do this on the first cpu to boot, though, since the | ||
55 | * other CPUs should see a properly-constructed page table. | ||
56 | */ | ||
57 | { | ||
58 | v4int_l r2, zero, r0 /* ASID for hv_install_context */ | ||
59 | moveli r4, hw1_last(swapper_pgprot - PAGE_OFFSET) | ||
60 | } | ||
61 | { | ||
62 | shl16insli r4, r4, hw0(swapper_pgprot - PAGE_OFFSET) | ||
63 | } | ||
64 | { | ||
65 | ld r1, r4 /* access_pte for hv_install_context */ | ||
66 | } | ||
67 | { | ||
68 | moveli r0, hw1_last(.Lsv_data_pmd - PAGE_OFFSET) | ||
69 | moveli r6, hw1_last(temp_data_pmd - PAGE_OFFSET) | ||
70 | } | ||
71 | { | ||
72 | /* After initializing swapper_pgprot, HV_PTE_GLOBAL is set. */ | ||
73 | bfextu r7, r1, HV_PTE_INDEX_GLOBAL, HV_PTE_INDEX_GLOBAL | ||
74 | inv r4 | ||
75 | } | ||
76 | bnez r7, .Lno_write | ||
77 | { | ||
78 | shl16insli r0, r0, hw0(.Lsv_data_pmd - PAGE_OFFSET) | ||
79 | shl16insli r6, r6, hw0(temp_data_pmd - PAGE_OFFSET) | ||
80 | } | ||
81 | { | ||
82 | /* Cut off the low bits of the PT address. */ | ||
83 | shrui r6, r6, HV_LOG2_PAGE_TABLE_ALIGN | ||
84 | /* Start with our access pte. */ | ||
85 | move r5, r1 | ||
86 | } | ||
87 | { | ||
88 | /* Stuff the address into the page table pointer slot of the PTE. */ | ||
89 | bfins r5, r6, HV_PTE_INDEX_PTFN, \ | ||
90 | HV_PTE_INDEX_PTFN + HV_PTE_PTFN_BITS - 1 | ||
91 | } | ||
92 | { | ||
93 | /* Store the L0 data PTE. */ | ||
94 | st r0, r5 | ||
95 | addli r6, r6, (temp_code_pmd - temp_data_pmd) >> \ | ||
96 | HV_LOG2_PAGE_TABLE_ALIGN | ||
97 | } | ||
98 | { | ||
99 | addli r0, r0, .Lsv_code_pmd - .Lsv_data_pmd | ||
100 | bfins r5, r6, HV_PTE_INDEX_PTFN, \ | ||
101 | HV_PTE_INDEX_PTFN + HV_PTE_PTFN_BITS - 1 | ||
102 | } | ||
103 | /* Store the L0 code PTE. */ | ||
104 | st r0, r5 | ||
105 | |||
106 | .Lno_write: | ||
107 | moveli lr, hw2_last(1f) | ||
108 | { | ||
109 | shl16insli lr, lr, hw1(1f) | ||
110 | moveli r0, hw1_last(swapper_pg_dir - PAGE_OFFSET) | ||
111 | } | ||
112 | { | ||
113 | shl16insli lr, lr, hw0(1f) | ||
114 | shl16insli r0, r0, hw0(swapper_pg_dir - PAGE_OFFSET) | ||
115 | } | ||
116 | { | ||
117 | move r3, zero | ||
118 | j hv_install_context | ||
119 | } | ||
120 | 1: | ||
121 | |||
122 | /* Install the interrupt base. */ | ||
123 | moveli r0, hw2_last(MEM_SV_START) | ||
124 | shl16insli r0, r0, hw1(MEM_SV_START) | ||
125 | shl16insli r0, r0, hw0(MEM_SV_START) | ||
126 | mtspr SPR_INTERRUPT_VECTOR_BASE_K, r0 | ||
127 | |||
128 | /* | ||
129 | * Get our processor number and save it away in SAVE_K_0. | ||
130 | * Extract stuff from the topology structure: r4 = y, r6 = x, | ||
131 | * r5 = width. FIXME: consider whether we want to just make these | ||
132 | * 64-bit values (and if so fix smp_topology write below, too). | ||
133 | */ | ||
134 | jal hv_inquire_topology | ||
135 | { | ||
136 | v4int_l r5, zero, r1 /* r5 = width */ | ||
137 | shrui r4, r0, 32 /* r4 = y */ | ||
138 | } | ||
139 | { | ||
140 | v4int_l r6, zero, r0 /* r6 = x */ | ||
141 | mul_lu_lu r4, r4, r5 | ||
142 | } | ||
143 | { | ||
144 | add r4, r4, r6 /* r4 == cpu == y*width + x */ | ||
145 | } | ||
146 | |||
147 | #ifdef CONFIG_SMP | ||
148 | /* | ||
149 | * Load up our per-cpu offset. When the first (master) tile | ||
150 | * boots, this value is still zero, so we will load boot_pc | ||
151 | * with start_kernel, and boot_sp with init_stack + THREAD_SIZE. | ||
152 | * The master tile initializes the per-cpu offset array, so that | ||
153 | * when subsequent (secondary) tiles boot, they will instead load | ||
154 | * from their per-cpu versions of boot_sp and boot_pc. | ||
155 | */ | ||
156 | moveli r5, hw2_last(__per_cpu_offset) | ||
157 | shl16insli r5, r5, hw1(__per_cpu_offset) | ||
158 | shl16insli r5, r5, hw0(__per_cpu_offset) | ||
159 | shl3add r5, r4, r5 | ||
160 | ld r5, r5 | ||
161 | bnez r5, 1f | ||
162 | |||
163 | /* | ||
164 | * Save the width and height to the smp_topology variable | ||
165 | * for later use. | ||
166 | */ | ||
167 | moveli r0, hw2_last(smp_topology + HV_TOPOLOGY_WIDTH_OFFSET) | ||
168 | shl16insli r0, r0, hw1(smp_topology + HV_TOPOLOGY_WIDTH_OFFSET) | ||
169 | shl16insli r0, r0, hw0(smp_topology + HV_TOPOLOGY_WIDTH_OFFSET) | ||
170 | st r0, r1 | ||
171 | 1: | ||
172 | #else | ||
173 | move r5, zero | ||
174 | #endif | ||
175 | |||
176 | /* Load and go with the correct pc and sp. */ | ||
177 | { | ||
178 | moveli r1, hw2_last(boot_sp) | ||
179 | moveli r0, hw2_last(boot_pc) | ||
180 | } | ||
181 | { | ||
182 | shl16insli r1, r1, hw1(boot_sp) | ||
183 | shl16insli r0, r0, hw1(boot_pc) | ||
184 | } | ||
185 | { | ||
186 | shl16insli r1, r1, hw0(boot_sp) | ||
187 | shl16insli r0, r0, hw0(boot_pc) | ||
188 | } | ||
189 | { | ||
190 | add r1, r1, r5 | ||
191 | add r0, r0, r5 | ||
192 | } | ||
193 | ld r0, r0 | ||
194 | ld sp, r1 | ||
195 | or r4, sp, r4 | ||
196 | mtspr SPR_SYSTEM_SAVE_K_0, r4 /* save ksp0 + cpu */ | ||
197 | addi sp, sp, -STACK_TOP_DELTA | ||
198 | { | ||
199 | move lr, zero /* stop backtraces in the called function */ | ||
200 | jr r0 | ||
201 | } | ||
202 | ENDPROC(_start) | ||
203 | |||
204 | __PAGE_ALIGNED_BSS | ||
205 | .align PAGE_SIZE | ||
206 | ENTRY(empty_zero_page) | ||
207 | .fill PAGE_SIZE,1,0 | ||
208 | END(empty_zero_page) | ||
209 | |||
210 | .macro PTE cpa, bits1 | ||
211 | .quad HV_PTE_PAGE | HV_PTE_DIRTY | HV_PTE_PRESENT | HV_PTE_ACCESSED |\ | ||
212 | HV_PTE_GLOBAL | (HV_PTE_MODE_CACHE_NO_L3 << HV_PTE_INDEX_MODE) |\ | ||
213 | (\bits1) | (HV_CPA_TO_PFN(\cpa) << HV_PTE_INDEX_PFN) | ||
214 | .endm | ||
215 | |||
216 | __PAGE_ALIGNED_DATA | ||
217 | .align PAGE_SIZE | ||
218 | ENTRY(swapper_pg_dir) | ||
219 | .org swapper_pg_dir + HV_L0_INDEX(PAGE_OFFSET) * HV_PTE_SIZE | ||
220 | .Lsv_data_pmd: | ||
221 | .quad 0 /* PTE temp_data_pmd - PAGE_OFFSET, 0 */ | ||
222 | .org swapper_pg_dir + HV_L0_INDEX(MEM_SV_START) * HV_PTE_SIZE | ||
223 | .Lsv_code_pmd: | ||
224 | .quad 0 /* PTE temp_code_pmd - PAGE_OFFSET, 0 */ | ||
225 | .org swapper_pg_dir + HV_L0_SIZE | ||
226 | END(swapper_pg_dir) | ||
227 | |||
228 | .align HV_PAGE_TABLE_ALIGN | ||
229 | ENTRY(temp_data_pmd) | ||
230 | /* | ||
231 | * We fill the PAGE_OFFSET pmd with huge pages with | ||
232 | * VA = PA + PAGE_OFFSET. We remap things with more precise access | ||
233 | * permissions later. | ||
234 | */ | ||
235 | .set addr, 0 | ||
236 | .rept HV_L1_ENTRIES | ||
237 | PTE addr, HV_PTE_READABLE | HV_PTE_WRITABLE | ||
238 | .set addr, addr + HV_PAGE_SIZE_LARGE | ||
239 | .endr | ||
240 | .org temp_data_pmd + HV_L1_SIZE | ||
241 | END(temp_data_pmd) | ||
242 | |||
243 | .align HV_PAGE_TABLE_ALIGN | ||
244 | ENTRY(temp_code_pmd) | ||
245 | /* | ||
246 | * We fill the MEM_SV_START pmd with huge pages with | ||
247 | * VA = PA + PAGE_OFFSET. We remap things with more precise access | ||
248 | * permissions later. | ||
249 | */ | ||
250 | .set addr, 0 | ||
251 | .rept HV_L1_ENTRIES | ||
252 | PTE addr, HV_PTE_READABLE | HV_PTE_EXECUTABLE | ||
253 | .set addr, addr + HV_PAGE_SIZE_LARGE | ||
254 | .endr | ||
255 | .org temp_code_pmd + HV_L1_SIZE | ||
256 | END(temp_code_pmd) | ||
257 | |||
258 | /* | ||
259 | * Isolate swapper_pgprot to its own cache line, since each cpu | ||
260 | * starting up will read it using VA-is-PA and local homing. | ||
261 | * This would otherwise likely conflict with other data on the cache | ||
262 | * line, once we have set its permanent home in the page tables. | ||
263 | */ | ||
264 | __INITDATA | ||
265 | .align CHIP_L2_LINE_SIZE() | ||
266 | ENTRY(swapper_pgprot) | ||
267 | .quad HV_PTE_PRESENT | (HV_PTE_MODE_CACHE_NO_L3 << HV_PTE_INDEX_MODE) | ||
268 | .align CHIP_L2_LINE_SIZE() | ||
269 | END(swapper_pgprot) | ||
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S index fffcfa6b3a62..72ade79b621b 100644 --- a/arch/tile/kernel/intvec_32.S +++ b/arch/tile/kernel/intvec_32.S | |||
@@ -851,14 +851,27 @@ STD_ENTRY(interrupt_return) | |||
851 | /* Check to see if there is any work to do before returning to user. */ | 851 | /* Check to see if there is any work to do before returning to user. */ |
852 | { | 852 | { |
853 | addi r29, r32, THREAD_INFO_FLAGS_OFFSET | 853 | addi r29, r32, THREAD_INFO_FLAGS_OFFSET |
854 | moveli r28, lo16(_TIF_ALLWORK_MASK) | 854 | moveli r1, lo16(_TIF_ALLWORK_MASK) |
855 | } | 855 | } |
856 | { | 856 | { |
857 | lw r29, r29 | 857 | lw r29, r29 |
858 | auli r28, r28, ha16(_TIF_ALLWORK_MASK) | 858 | auli r1, r1, ha16(_TIF_ALLWORK_MASK) |
859 | } | 859 | } |
860 | and r28, r29, r28 | 860 | and r1, r29, r1 |
861 | bnz r28, .Lwork_pending | 861 | bzt r1, .Lrestore_all |
862 | |||
863 | /* | ||
864 | * Make sure we have all the registers saved for signal | ||
865 | * handling or single-step. Call out to C code to figure out | ||
866 | * exactly what we need to do for each flag bit, then if | ||
867 | * necessary, reload the flags and recheck. | ||
868 | */ | ||
869 | push_extra_callee_saves r0 | ||
870 | { | ||
871 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
872 | jal do_work_pending | ||
873 | } | ||
874 | bnz r0, .Lresume_userspace | ||
862 | 875 | ||
863 | /* | 876 | /* |
864 | * In the NMI case we | 877 | * In the NMI case we |
@@ -1099,99 +1112,6 @@ STD_ENTRY(interrupt_return) | |||
1099 | pop_reg r50 | 1112 | pop_reg r50 |
1100 | pop_reg r51, sp, PTREGS_OFFSET_REG(29) - PTREGS_OFFSET_REG(51) | 1113 | pop_reg r51, sp, PTREGS_OFFSET_REG(29) - PTREGS_OFFSET_REG(51) |
1101 | j .Lcontinue_restore_regs | 1114 | j .Lcontinue_restore_regs |
1102 | |||
1103 | .Lwork_pending: | ||
1104 | /* Mask the reschedule flag */ | ||
1105 | andi r28, r29, _TIF_NEED_RESCHED | ||
1106 | |||
1107 | { | ||
1108 | /* | ||
1109 | * If the NEED_RESCHED flag is called, we call schedule(), which | ||
1110 | * may drop this context right here and go do something else. | ||
1111 | * On return, jump back to .Lresume_userspace and recheck. | ||
1112 | */ | ||
1113 | bz r28, .Lasync_tlb | ||
1114 | |||
1115 | /* Mask the async-tlb flag */ | ||
1116 | andi r28, r29, _TIF_ASYNC_TLB | ||
1117 | } | ||
1118 | |||
1119 | jal schedule | ||
1120 | FEEDBACK_REENTER(interrupt_return) | ||
1121 | |||
1122 | /* Reload the flags and check again */ | ||
1123 | j .Lresume_userspace | ||
1124 | |||
1125 | .Lasync_tlb: | ||
1126 | { | ||
1127 | bz r28, .Lneed_sigpending | ||
1128 | |||
1129 | /* Mask the sigpending flag */ | ||
1130 | andi r28, r29, _TIF_SIGPENDING | ||
1131 | } | ||
1132 | |||
1133 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
1134 | jal do_async_page_fault | ||
1135 | FEEDBACK_REENTER(interrupt_return) | ||
1136 | |||
1137 | /* | ||
1138 | * Go restart the "resume userspace" process. We may have | ||
1139 | * fired a signal, and we need to disable interrupts again. | ||
1140 | */ | ||
1141 | j .Lresume_userspace | ||
1142 | |||
1143 | .Lneed_sigpending: | ||
1144 | /* | ||
1145 | * At this point we are either doing signal handling or single-step, | ||
1146 | * so either way make sure we have all the registers saved. | ||
1147 | */ | ||
1148 | push_extra_callee_saves r0 | ||
1149 | |||
1150 | { | ||
1151 | /* If no signal pending, skip to singlestep check */ | ||
1152 | bz r28, .Lneed_singlestep | ||
1153 | |||
1154 | /* Mask the singlestep flag */ | ||
1155 | andi r28, r29, _TIF_SINGLESTEP | ||
1156 | } | ||
1157 | |||
1158 | jal do_signal | ||
1159 | FEEDBACK_REENTER(interrupt_return) | ||
1160 | |||
1161 | /* Reload the flags and check again */ | ||
1162 | j .Lresume_userspace | ||
1163 | |||
1164 | .Lneed_singlestep: | ||
1165 | { | ||
1166 | /* Get a pointer to the EX1 field */ | ||
1167 | PTREGS_PTR(r29, PTREGS_OFFSET_EX1) | ||
1168 | |||
1169 | /* If we get here, our bit must be set. */ | ||
1170 | bz r28, .Lwork_confusion | ||
1171 | } | ||
1172 | /* If we are in priv mode, don't single step */ | ||
1173 | lw r28, r29 | ||
1174 | andi r28, r28, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */ | ||
1175 | bnz r28, .Lrestore_all | ||
1176 | |||
1177 | /* Allow interrupts within the single step code */ | ||
1178 | TRACE_IRQS_ON /* Note: clobbers registers r0-r29 */ | ||
1179 | IRQ_ENABLE(r20, r21) | ||
1180 | |||
1181 | /* try to single-step the current instruction */ | ||
1182 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
1183 | jal single_step_once | ||
1184 | FEEDBACK_REENTER(interrupt_return) | ||
1185 | |||
1186 | /* Re-disable interrupts. TRACE_IRQS_OFF in .Lrestore_all. */ | ||
1187 | IRQ_DISABLE(r20,r21) | ||
1188 | |||
1189 | j .Lrestore_all | ||
1190 | |||
1191 | .Lwork_confusion: | ||
1192 | move r0, r28 | ||
1193 | panic "thread_info allwork flags unhandled on userspace resume: %#x" | ||
1194 | |||
1195 | STD_ENDPROC(interrupt_return) | 1115 | STD_ENDPROC(interrupt_return) |
1196 | 1116 | ||
1197 | /* | 1117 | /* |
@@ -1550,7 +1470,10 @@ STD_ENTRY(_sys_clone) | |||
1550 | * We place it in the __HEAD section to ensure it is relatively | 1470 | * We place it in the __HEAD section to ensure it is relatively |
1551 | * near to the intvec_SWINT_1 code (reachable by a conditional branch). | 1471 | * near to the intvec_SWINT_1 code (reachable by a conditional branch). |
1552 | * | 1472 | * |
1553 | * Must match register usage in do_page_fault(). | 1473 | * Our use of ATOMIC_LOCK_REG here must match do_page_fault_ics(). |
1474 | * | ||
1475 | * As we do in lib/atomic_asm_32.S, we bypass a store if the value we | ||
1476 | * would store is the same as the value we just loaded. | ||
1554 | */ | 1477 | */ |
1555 | __HEAD | 1478 | __HEAD |
1556 | .align 64 | 1479 | .align 64 |
@@ -1611,17 +1534,7 @@ ENTRY(sys_cmpxchg) | |||
1611 | { | 1534 | { |
1612 | shri r20, r25, 32 - ATOMIC_HASH_L1_SHIFT | 1535 | shri r20, r25, 32 - ATOMIC_HASH_L1_SHIFT |
1613 | slt_u r23, r0, r23 | 1536 | slt_u r23, r0, r23 |
1614 | 1537 | lw r26, r0 /* see comment in the "#else" for the "lw r26". */ | |
1615 | /* | ||
1616 | * Ensure that the TLB is loaded before we take out the lock. | ||
1617 | * On TILEPro, this will start fetching the value all the way | ||
1618 | * into our L1 as well (and if it gets modified before we | ||
1619 | * grab the lock, it will be invalidated from our cache | ||
1620 | * before we reload it). On tile64, we'll start fetching it | ||
1621 | * into our L1 if we're the home, and if we're not, we'll | ||
1622 | * still at least start fetching it into the home's L2. | ||
1623 | */ | ||
1624 | lw r26, r0 | ||
1625 | } | 1538 | } |
1626 | { | 1539 | { |
1627 | s2a r21, r20, r21 | 1540 | s2a r21, r20, r21 |
@@ -1637,18 +1550,9 @@ ENTRY(sys_cmpxchg) | |||
1637 | bbs r23, .Lcmpxchg64 | 1550 | bbs r23, .Lcmpxchg64 |
1638 | andi r23, r0, 7 /* Precompute alignment for cmpxchg64. */ | 1551 | andi r23, r0, 7 /* Precompute alignment for cmpxchg64. */ |
1639 | } | 1552 | } |
1640 | |||
1641 | { | 1553 | { |
1642 | /* | ||
1643 | * We very carefully align the code that actually runs with | ||
1644 | * the lock held (nine bundles) so that we know it is all in | ||
1645 | * the icache when we start. This instruction (the jump) is | ||
1646 | * at the start of the first cache line, address zero mod 64; | ||
1647 | * we jump to somewhere in the second cache line to issue the | ||
1648 | * tns, then jump back to finish up. | ||
1649 | */ | ||
1650 | s2a ATOMIC_LOCK_REG_NAME, r25, r21 | 1554 | s2a ATOMIC_LOCK_REG_NAME, r25, r21 |
1651 | j .Lcmpxchg32_tns | 1555 | j .Lcmpxchg32_tns /* see comment in the #else for the jump. */ |
1652 | } | 1556 | } |
1653 | 1557 | ||
1654 | #else /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */ | 1558 | #else /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */ |
@@ -1713,24 +1617,25 @@ ENTRY(sys_cmpxchg) | |||
1713 | { | 1617 | { |
1714 | /* | 1618 | /* |
1715 | * We very carefully align the code that actually runs with | 1619 | * We very carefully align the code that actually runs with |
1716 | * the lock held (nine bundles) so that we know it is all in | 1620 | * the lock held (twelve bundles) so that we know it is all in |
1717 | * the icache when we start. This instruction (the jump) is | 1621 | * the icache when we start. This instruction (the jump) is |
1718 | * at the start of the first cache line, address zero mod 64; | 1622 | * at the start of the first cache line, address zero mod 64; |
1719 | * we jump to somewhere in the second cache line to issue the | 1623 | * we jump to the very end of the second cache line to get that |
1720 | * tns, then jump back to finish up. | 1624 | * line loaded in the icache, then fall through to issue the tns |
1625 | * in the third cache line, at which point it's all cached. | ||
1626 | * Note that is for performance, not correctness. | ||
1721 | */ | 1627 | */ |
1722 | j .Lcmpxchg32_tns | 1628 | j .Lcmpxchg32_tns |
1723 | } | 1629 | } |
1724 | 1630 | ||
1725 | #endif /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */ | 1631 | #endif /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */ |
1726 | 1632 | ||
1727 | ENTRY(__sys_cmpxchg_grab_lock) | 1633 | /* Symbol for do_page_fault_ics() to use to compare against the PC. */ |
1634 | .global __sys_cmpxchg_grab_lock | ||
1635 | __sys_cmpxchg_grab_lock: | ||
1728 | 1636 | ||
1729 | /* | 1637 | /* |
1730 | * Perform the actual cmpxchg or atomic_update. | 1638 | * Perform the actual cmpxchg or atomic_update. |
1731 | * Note that the system <arch/atomic.h> header relies on | ||
1732 | * atomic_update() to always perform an "mf", so don't make | ||
1733 | * it optional or conditional without modifying that code. | ||
1734 | */ | 1639 | */ |
1735 | .Ldo_cmpxchg32: | 1640 | .Ldo_cmpxchg32: |
1736 | { | 1641 | { |
@@ -1748,10 +1653,13 @@ ENTRY(sys_cmpxchg) | |||
1748 | } | 1653 | } |
1749 | { | 1654 | { |
1750 | mvnz r24, r23, r25 /* Use atomic_update value if appropriate. */ | 1655 | mvnz r24, r23, r25 /* Use atomic_update value if appropriate. */ |
1751 | bbns r22, .Lcmpxchg32_mismatch | 1656 | bbns r22, .Lcmpxchg32_nostore |
1752 | } | 1657 | } |
1658 | seq r22, r24, r21 /* Are we storing the value we loaded? */ | ||
1659 | bbs r22, .Lcmpxchg32_nostore | ||
1753 | sw r0, r24 | 1660 | sw r0, r24 |
1754 | 1661 | ||
1662 | /* The following instruction is the start of the second cache line. */ | ||
1755 | /* Do slow mtspr here so the following "mf" waits less. */ | 1663 | /* Do slow mtspr here so the following "mf" waits less. */ |
1756 | { | 1664 | { |
1757 | move sp, r27 | 1665 | move sp, r27 |
@@ -1759,7 +1667,6 @@ ENTRY(sys_cmpxchg) | |||
1759 | } | 1667 | } |
1760 | mf | 1668 | mf |
1761 | 1669 | ||
1762 | /* The following instruction is the start of the second cache line. */ | ||
1763 | { | 1670 | { |
1764 | move r0, r21 | 1671 | move r0, r21 |
1765 | sw ATOMIC_LOCK_REG_NAME, zero | 1672 | sw ATOMIC_LOCK_REG_NAME, zero |
@@ -1767,7 +1674,7 @@ ENTRY(sys_cmpxchg) | |||
1767 | iret | 1674 | iret |
1768 | 1675 | ||
1769 | /* Duplicated code here in the case where we don't overlap "mf" */ | 1676 | /* Duplicated code here in the case where we don't overlap "mf" */ |
1770 | .Lcmpxchg32_mismatch: | 1677 | .Lcmpxchg32_nostore: |
1771 | { | 1678 | { |
1772 | move r0, r21 | 1679 | move r0, r21 |
1773 | sw ATOMIC_LOCK_REG_NAME, zero | 1680 | sw ATOMIC_LOCK_REG_NAME, zero |
@@ -1783,8 +1690,6 @@ ENTRY(sys_cmpxchg) | |||
1783 | * and for 64-bit cmpxchg. We provide it as a macro and put | 1690 | * and for 64-bit cmpxchg. We provide it as a macro and put |
1784 | * it into both versions. We can't share the code literally | 1691 | * it into both versions. We can't share the code literally |
1785 | * since it depends on having the right branch-back address. | 1692 | * since it depends on having the right branch-back address. |
1786 | * Note that the first few instructions should share the cache | ||
1787 | * line with the second half of the actual locked code. | ||
1788 | */ | 1693 | */ |
1789 | .macro cmpxchg_lock, bitwidth | 1694 | .macro cmpxchg_lock, bitwidth |
1790 | 1695 | ||
@@ -1810,7 +1715,7 @@ ENTRY(sys_cmpxchg) | |||
1810 | } | 1715 | } |
1811 | /* | 1716 | /* |
1812 | * The preceding instruction is the last thing that must be | 1717 | * The preceding instruction is the last thing that must be |
1813 | * on the second cache line. | 1718 | * hot in the icache before we do the "tns" above. |
1814 | */ | 1719 | */ |
1815 | 1720 | ||
1816 | #ifdef CONFIG_SMP | 1721 | #ifdef CONFIG_SMP |
@@ -1841,6 +1746,12 @@ ENTRY(sys_cmpxchg) | |||
1841 | .endm | 1746 | .endm |
1842 | 1747 | ||
1843 | .Lcmpxchg32_tns: | 1748 | .Lcmpxchg32_tns: |
1749 | /* | ||
1750 | * This is the last instruction on the second cache line. | ||
1751 | * The nop here loads the second line, then we fall through | ||
1752 | * to the tns to load the third line before we take the lock. | ||
1753 | */ | ||
1754 | nop | ||
1844 | cmpxchg_lock 32 | 1755 | cmpxchg_lock 32 |
1845 | 1756 | ||
1846 | /* | 1757 | /* |
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S new file mode 100644 index 000000000000..79c93e10ba27 --- /dev/null +++ b/arch/tile/kernel/intvec_64.S | |||
@@ -0,0 +1,1231 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * Linux interrupt vectors. | ||
15 | */ | ||
16 | |||
17 | #include <linux/linkage.h> | ||
18 | #include <linux/errno.h> | ||
19 | #include <linux/unistd.h> | ||
20 | #include <asm/ptrace.h> | ||
21 | #include <asm/thread_info.h> | ||
22 | #include <asm/irqflags.h> | ||
23 | #include <asm/asm-offsets.h> | ||
24 | #include <asm/types.h> | ||
25 | #include <hv/hypervisor.h> | ||
26 | #include <arch/abi.h> | ||
27 | #include <arch/interrupts.h> | ||
28 | #include <arch/spr_def.h> | ||
29 | |||
30 | #ifdef CONFIG_PREEMPT | ||
31 | # error "No support for kernel preemption currently" | ||
32 | #endif | ||
33 | |||
34 | #define PTREGS_PTR(reg, ptreg) addli reg, sp, C_ABI_SAVE_AREA_SIZE + (ptreg) | ||
35 | |||
36 | #define PTREGS_OFFSET_SYSCALL PTREGS_OFFSET_REG(TREG_SYSCALL_NR) | ||
37 | |||
38 | |||
39 | .macro push_reg reg, ptr=sp, delta=-8 | ||
40 | { | ||
41 | st \ptr, \reg | ||
42 | addli \ptr, \ptr, \delta | ||
43 | } | ||
44 | .endm | ||
45 | |||
46 | .macro pop_reg reg, ptr=sp, delta=8 | ||
47 | { | ||
48 | ld \reg, \ptr | ||
49 | addli \ptr, \ptr, \delta | ||
50 | } | ||
51 | .endm | ||
52 | |||
53 | .macro pop_reg_zero reg, zreg, ptr=sp, delta=8 | ||
54 | { | ||
55 | move \zreg, zero | ||
56 | ld \reg, \ptr | ||
57 | addi \ptr, \ptr, \delta | ||
58 | } | ||
59 | .endm | ||
60 | |||
61 | .macro push_extra_callee_saves reg | ||
62 | PTREGS_PTR(\reg, PTREGS_OFFSET_REG(51)) | ||
63 | push_reg r51, \reg | ||
64 | push_reg r50, \reg | ||
65 | push_reg r49, \reg | ||
66 | push_reg r48, \reg | ||
67 | push_reg r47, \reg | ||
68 | push_reg r46, \reg | ||
69 | push_reg r45, \reg | ||
70 | push_reg r44, \reg | ||
71 | push_reg r43, \reg | ||
72 | push_reg r42, \reg | ||
73 | push_reg r41, \reg | ||
74 | push_reg r40, \reg | ||
75 | push_reg r39, \reg | ||
76 | push_reg r38, \reg | ||
77 | push_reg r37, \reg | ||
78 | push_reg r36, \reg | ||
79 | push_reg r35, \reg | ||
80 | push_reg r34, \reg, PTREGS_OFFSET_BASE - PTREGS_OFFSET_REG(34) | ||
81 | .endm | ||
82 | |||
83 | .macro panic str | ||
84 | .pushsection .rodata, "a" | ||
85 | 1: | ||
86 | .asciz "\str" | ||
87 | .popsection | ||
88 | { | ||
89 | moveli r0, hw2_last(1b) | ||
90 | } | ||
91 | { | ||
92 | shl16insli r0, r0, hw1(1b) | ||
93 | } | ||
94 | { | ||
95 | shl16insli r0, r0, hw0(1b) | ||
96 | jal panic | ||
97 | } | ||
98 | .endm | ||
99 | |||
100 | |||
101 | #ifdef __COLLECT_LINKER_FEEDBACK__ | ||
102 | .pushsection .text.intvec_feedback,"ax" | ||
103 | intvec_feedback: | ||
104 | .popsection | ||
105 | #endif | ||
106 | |||
107 | /* | ||
108 | * Default interrupt handler. | ||
109 | * | ||
110 | * vecnum is where we'll put this code. | ||
111 | * c_routine is the C routine we'll call. | ||
112 | * | ||
113 | * The C routine is passed two arguments: | ||
114 | * - A pointer to the pt_regs state. | ||
115 | * - The interrupt vector number. | ||
116 | * | ||
117 | * The "processing" argument specifies the code for processing | ||
118 | * the interrupt. Defaults to "handle_interrupt". | ||
119 | */ | ||
120 | .macro int_hand vecnum, vecname, c_routine, processing=handle_interrupt | ||
121 | .org (\vecnum << 8) | ||
122 | intvec_\vecname: | ||
123 | /* Temporarily save a register so we have somewhere to work. */ | ||
124 | |||
125 | mtspr SPR_SYSTEM_SAVE_K_1, r0 | ||
126 | mfspr r0, SPR_EX_CONTEXT_K_1 | ||
127 | |||
128 | andi r0, r0, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */ | ||
129 | |||
130 | .ifc \vecnum, INT_DOUBLE_FAULT | ||
131 | /* | ||
132 | * For double-faults from user-space, fall through to the normal | ||
133 | * register save and stack setup path. Otherwise, it's the | ||
134 | * hypervisor giving us one last chance to dump diagnostics, and we | ||
135 | * branch to the kernel_double_fault routine to do so. | ||
136 | */ | ||
137 | beqz r0, 1f | ||
138 | j _kernel_double_fault | ||
139 | 1: | ||
140 | .else | ||
141 | /* | ||
142 | * If we're coming from user-space, then set sp to the top of | ||
143 | * the kernel stack. Otherwise, assume sp is already valid. | ||
144 | */ | ||
145 | { | ||
146 | bnez r0, 0f | ||
147 | move r0, sp | ||
148 | } | ||
149 | .endif | ||
150 | |||
151 | .ifc \c_routine, do_page_fault | ||
152 | /* | ||
153 | * The page_fault handler may be downcalled directly by the | ||
154 | * hypervisor even when Linux is running and has ICS set. | ||
155 | * | ||
156 | * In this case the contents of EX_CONTEXT_K_1 reflect the | ||
157 | * previous fault and can't be relied on to choose whether or | ||
158 | * not to reinitialize the stack pointer. So we add a test | ||
159 | * to see whether SYSTEM_SAVE_K_2 has the high bit set, | ||
160 | * and if so we don't reinitialize sp, since we must be coming | ||
161 | * from Linux. (In fact the precise case is !(val & ~1), | ||
162 | * but any Linux PC has to have the high bit set.) | ||
163 | * | ||
164 | * Note that the hypervisor *always* sets SYSTEM_SAVE_K_2 for | ||
165 | * any path that turns into a downcall to one of our TLB handlers. | ||
166 | * | ||
167 | * FIXME: if we end up never using this path, perhaps we should | ||
168 | * prevent the hypervisor from generating downcalls in this case. | ||
169 | * The advantage of getting a downcall is we can panic in Linux. | ||
170 | */ | ||
171 | mfspr r0, SPR_SYSTEM_SAVE_K_2 | ||
172 | { | ||
173 | bltz r0, 0f /* high bit in S_S_1_2 is for a PC to use */ | ||
174 | move r0, sp | ||
175 | } | ||
176 | .endif | ||
177 | |||
178 | |||
179 | /* | ||
180 | * SYSTEM_SAVE_K_0 holds the cpu number in the low bits, and | ||
181 | * the current stack top in the higher bits. So we recover | ||
182 | * our stack top by just masking off the low bits, then | ||
183 | * point sp at the top aligned address on the actual stack page. | ||
184 | */ | ||
185 | mfspr r0, SPR_SYSTEM_SAVE_K_0 | ||
186 | mm r0, zero, LOG2_THREAD_SIZE, 63 | ||
187 | |||
188 | 0: | ||
189 | /* | ||
190 | * Align the stack mod 64 so we can properly predict what | ||
191 | * cache lines we need to write-hint to reduce memory fetch | ||
192 | * latency as we enter the kernel. The layout of memory is | ||
193 | * as follows, with cache line 0 at the lowest VA, and cache | ||
194 | * line 8 just below the r0 value this "andi" computes. | ||
195 | * Note that we never write to cache line 8, and we skip | ||
196 | * cache lines 1-3 for syscalls. | ||
197 | * | ||
198 | * cache line 8: ptregs padding (two words) | ||
199 | * cache line 7: sp, lr, pc, ex1, faultnum, orig_r0, flags, cmpexch | ||
200 | * cache line 6: r46...r53 (tp) | ||
201 | * cache line 5: r38...r45 | ||
202 | * cache line 4: r30...r37 | ||
203 | * cache line 3: r22...r29 | ||
204 | * cache line 2: r14...r21 | ||
205 | * cache line 1: r6...r13 | ||
206 | * cache line 0: 2 x frame, r0..r5 | ||
207 | */ | ||
208 | andi r0, r0, -64 | ||
209 | |||
210 | /* | ||
211 | * Push the first four registers on the stack, so that we can set | ||
212 | * them to vector-unique values before we jump to the common code. | ||
213 | * | ||
214 | * Registers are pushed on the stack as a struct pt_regs, | ||
215 | * with the sp initially just above the struct, and when we're | ||
216 | * done, sp points to the base of the struct, minus | ||
217 | * C_ABI_SAVE_AREA_SIZE, so we can directly jal to C code. | ||
218 | * | ||
219 | * This routine saves just the first four registers, plus the | ||
220 | * stack context so we can do proper backtracing right away, | ||
221 | * and defers to handle_interrupt to save the rest. | ||
222 | * The backtracer needs pc, ex1, lr, sp, r52, and faultnum. | ||
223 | */ | ||
224 | addli r0, r0, PTREGS_OFFSET_LR - (PTREGS_SIZE + KSTK_PTREGS_GAP) | ||
225 | wh64 r0 /* cache line 7 */ | ||
226 | { | ||
227 | st r0, lr | ||
228 | addli r0, r0, PTREGS_OFFSET_SP - PTREGS_OFFSET_LR | ||
229 | } | ||
230 | { | ||
231 | st r0, sp | ||
232 | addli sp, r0, PTREGS_OFFSET_REG(52) - PTREGS_OFFSET_SP | ||
233 | } | ||
234 | wh64 sp /* cache line 6 */ | ||
235 | { | ||
236 | st sp, r52 | ||
237 | addli sp, sp, PTREGS_OFFSET_REG(1) - PTREGS_OFFSET_REG(52) | ||
238 | } | ||
239 | wh64 sp /* cache line 0 */ | ||
240 | { | ||
241 | st sp, r1 | ||
242 | addli sp, sp, PTREGS_OFFSET_REG(2) - PTREGS_OFFSET_REG(1) | ||
243 | } | ||
244 | { | ||
245 | st sp, r2 | ||
246 | addli sp, sp, PTREGS_OFFSET_REG(3) - PTREGS_OFFSET_REG(2) | ||
247 | } | ||
248 | { | ||
249 | st sp, r3 | ||
250 | addli sp, sp, PTREGS_OFFSET_PC - PTREGS_OFFSET_REG(3) | ||
251 | } | ||
252 | mfspr r0, SPR_EX_CONTEXT_K_0 | ||
253 | .ifc \processing,handle_syscall | ||
254 | /* | ||
255 | * Bump the saved PC by one bundle so that when we return, we won't | ||
256 | * execute the same swint instruction again. We need to do this while | ||
257 | * we're in the critical section. | ||
258 | */ | ||
259 | addi r0, r0, 8 | ||
260 | .endif | ||
261 | { | ||
262 | st sp, r0 | ||
263 | addli sp, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC | ||
264 | } | ||
265 | mfspr r0, SPR_EX_CONTEXT_K_1 | ||
266 | { | ||
267 | st sp, r0 | ||
268 | addi sp, sp, PTREGS_OFFSET_FAULTNUM - PTREGS_OFFSET_EX1 | ||
269 | /* | ||
270 | * Use r0 for syscalls so it's a temporary; use r1 for interrupts | ||
271 | * so that it gets passed through unchanged to the handler routine. | ||
272 | * Note that the .if conditional confusingly spans bundles. | ||
273 | */ | ||
274 | .ifc \processing,handle_syscall | ||
275 | movei r0, \vecnum | ||
276 | } | ||
277 | { | ||
278 | st sp, r0 | ||
279 | .else | ||
280 | movei r1, \vecnum | ||
281 | } | ||
282 | { | ||
283 | st sp, r1 | ||
284 | .endif | ||
285 | addli sp, sp, PTREGS_OFFSET_REG(0) - PTREGS_OFFSET_FAULTNUM | ||
286 | } | ||
287 | mfspr r0, SPR_SYSTEM_SAVE_K_1 /* Original r0 */ | ||
288 | { | ||
289 | st sp, r0 | ||
290 | addi sp, sp, -PTREGS_OFFSET_REG(0) - 8 | ||
291 | } | ||
292 | { | ||
293 | st sp, zero /* write zero into "Next SP" frame pointer */ | ||
294 | addi sp, sp, -8 /* leave SP pointing at bottom of frame */ | ||
295 | } | ||
296 | .ifc \processing,handle_syscall | ||
297 | j handle_syscall | ||
298 | .else | ||
299 | /* Capture per-interrupt SPR context to registers. */ | ||
300 | .ifc \c_routine, do_page_fault | ||
301 | mfspr r2, SPR_SYSTEM_SAVE_K_3 /* address of page fault */ | ||
302 | mfspr r3, SPR_SYSTEM_SAVE_K_2 /* info about page fault */ | ||
303 | .else | ||
304 | .ifc \vecnum, INT_ILL_TRANS | ||
305 | mfspr r2, ILL_TRANS_REASON | ||
306 | .else | ||
307 | .ifc \vecnum, INT_DOUBLE_FAULT | ||
308 | mfspr r2, SPR_SYSTEM_SAVE_K_2 /* double fault info from HV */ | ||
309 | .else | ||
310 | .ifc \c_routine, do_trap | ||
311 | mfspr r2, GPV_REASON | ||
312 | .else | ||
313 | .ifc \c_routine, op_handle_perf_interrupt | ||
314 | mfspr r2, PERF_COUNT_STS | ||
315 | #if CHIP_HAS_AUX_PERF_COUNTERS() | ||
316 | .else | ||
317 | .ifc \c_routine, op_handle_aux_perf_interrupt | ||
318 | mfspr r2, AUX_PERF_COUNT_STS | ||
319 | .endif | ||
320 | #endif | ||
321 | .endif | ||
322 | .endif | ||
323 | .endif | ||
324 | .endif | ||
325 | .endif | ||
326 | /* Put function pointer in r0 */ | ||
327 | moveli r0, hw2_last(\c_routine) | ||
328 | shl16insli r0, r0, hw1(\c_routine) | ||
329 | { | ||
330 | shl16insli r0, r0, hw0(\c_routine) | ||
331 | j \processing | ||
332 | } | ||
333 | .endif | ||
334 | ENDPROC(intvec_\vecname) | ||
335 | |||
336 | #ifdef __COLLECT_LINKER_FEEDBACK__ | ||
337 | .pushsection .text.intvec_feedback,"ax" | ||
338 | .org (\vecnum << 5) | ||
339 | FEEDBACK_ENTER_EXPLICIT(intvec_\vecname, .intrpt1, 1 << 8) | ||
340 | jrp lr | ||
341 | .popsection | ||
342 | #endif | ||
343 | |||
344 | .endm | ||
345 | |||
346 | |||
347 | /* | ||
348 | * Save the rest of the registers that we didn't save in the actual | ||
349 | * vector itself. We can't use r0-r10 inclusive here. | ||
350 | */ | ||
351 | .macro finish_interrupt_save, function | ||
352 | |||
353 | /* If it's a syscall, save a proper orig_r0, otherwise just zero. */ | ||
354 | PTREGS_PTR(r52, PTREGS_OFFSET_ORIG_R0) | ||
355 | { | ||
356 | .ifc \function,handle_syscall | ||
357 | st r52, r0 | ||
358 | .else | ||
359 | st r52, zero | ||
360 | .endif | ||
361 | PTREGS_PTR(r52, PTREGS_OFFSET_TP) | ||
362 | } | ||
363 | st r52, tp | ||
364 | { | ||
365 | mfspr tp, CMPEXCH_VALUE | ||
366 | PTREGS_PTR(r52, PTREGS_OFFSET_CMPEXCH) | ||
367 | } | ||
368 | |||
369 | /* | ||
370 | * For ordinary syscalls, we save neither caller- nor callee- | ||
371 | * save registers, since the syscall invoker doesn't expect the | ||
372 | * caller-saves to be saved, and the called kernel functions will | ||
373 | * take care of saving the callee-saves for us. | ||
374 | * | ||
375 | * For interrupts we save just the caller-save registers. Saving | ||
376 | * them is required (since the "caller" can't save them). Again, | ||
377 | * the called kernel functions will restore the callee-save | ||
378 | * registers for us appropriately. | ||
379 | * | ||
380 | * On return, we normally restore nothing special for syscalls, | ||
381 | * and just the caller-save registers for interrupts. | ||
382 | * | ||
383 | * However, there are some important caveats to all this: | ||
384 | * | ||
385 | * - We always save a few callee-save registers to give us | ||
386 | * some scratchpad registers to carry across function calls. | ||
387 | * | ||
388 | * - fork/vfork/etc require us to save all the callee-save | ||
389 | * registers, which we do in PTREGS_SYSCALL_ALL_REGS, below. | ||
390 | * | ||
391 | * - We always save r0..r5 and r10 for syscalls, since we need | ||
392 | * to reload them a bit later for the actual kernel call, and | ||
393 | * since we might need them for -ERESTARTNOINTR, etc. | ||
394 | * | ||
395 | * - Before invoking a signal handler, we save the unsaved | ||
396 | * callee-save registers so they are visible to the | ||
397 | * signal handler or any ptracer. | ||
398 | * | ||
399 | * - If the unsaved callee-save registers are modified, we set | ||
400 | * a bit in pt_regs so we know to reload them from pt_regs | ||
401 | * and not just rely on the kernel function unwinding. | ||
402 | * (Done for ptrace register writes and SA_SIGINFO handler.) | ||
403 | */ | ||
404 | { | ||
405 | st r52, tp | ||
406 | PTREGS_PTR(r52, PTREGS_OFFSET_REG(33)) | ||
407 | } | ||
408 | wh64 r52 /* cache line 4 */ | ||
409 | push_reg r33, r52 | ||
410 | push_reg r32, r52 | ||
411 | push_reg r31, r52 | ||
412 | .ifc \function,handle_syscall | ||
413 | push_reg r30, r52, PTREGS_OFFSET_SYSCALL - PTREGS_OFFSET_REG(30) | ||
414 | push_reg TREG_SYSCALL_NR_NAME, r52, \ | ||
415 | PTREGS_OFFSET_REG(5) - PTREGS_OFFSET_SYSCALL | ||
416 | .else | ||
417 | |||
418 | push_reg r30, r52, PTREGS_OFFSET_REG(29) - PTREGS_OFFSET_REG(30) | ||
419 | wh64 r52 /* cache line 3 */ | ||
420 | push_reg r29, r52 | ||
421 | push_reg r28, r52 | ||
422 | push_reg r27, r52 | ||
423 | push_reg r26, r52 | ||
424 | push_reg r25, r52 | ||
425 | push_reg r24, r52 | ||
426 | push_reg r23, r52 | ||
427 | push_reg r22, r52 | ||
428 | wh64 r52 /* cache line 2 */ | ||
429 | push_reg r21, r52 | ||
430 | push_reg r20, r52 | ||
431 | push_reg r19, r52 | ||
432 | push_reg r18, r52 | ||
433 | push_reg r17, r52 | ||
434 | push_reg r16, r52 | ||
435 | push_reg r15, r52 | ||
436 | push_reg r14, r52 | ||
437 | wh64 r52 /* cache line 1 */ | ||
438 | push_reg r13, r52 | ||
439 | push_reg r12, r52 | ||
440 | push_reg r11, r52 | ||
441 | push_reg r10, r52 | ||
442 | push_reg r9, r52 | ||
443 | push_reg r8, r52 | ||
444 | push_reg r7, r52 | ||
445 | push_reg r6, r52 | ||
446 | |||
447 | .endif | ||
448 | |||
449 | push_reg r5, r52 | ||
450 | st r52, r4 | ||
451 | |||
452 | /* Load tp with our per-cpu offset. */ | ||
453 | #ifdef CONFIG_SMP | ||
454 | { | ||
455 | mfspr r20, SPR_SYSTEM_SAVE_K_0 | ||
456 | moveli r21, hw2_last(__per_cpu_offset) | ||
457 | } | ||
458 | { | ||
459 | shl16insli r21, r21, hw1(__per_cpu_offset) | ||
460 | bfextu r20, r20, 0, LOG2_THREAD_SIZE-1 | ||
461 | } | ||
462 | shl16insli r21, r21, hw0(__per_cpu_offset) | ||
463 | shl3add r20, r20, r21 | ||
464 | ld tp, r20 | ||
465 | #else | ||
466 | move tp, zero | ||
467 | #endif | ||
468 | |||
469 | /* | ||
470 | * If we will be returning to the kernel, we will need to | ||
471 | * reset the interrupt masks to the state they had before. | ||
472 | * Set DISABLE_IRQ in flags iff we came from PL1 with irqs disabled. | ||
473 | */ | ||
474 | mfspr r32, SPR_EX_CONTEXT_K_1 | ||
475 | { | ||
476 | andi r32, r32, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */ | ||
477 | PTREGS_PTR(r21, PTREGS_OFFSET_FLAGS) | ||
478 | } | ||
479 | beqzt r32, 1f /* zero if from user space */ | ||
480 | IRQS_DISABLED(r32) /* zero if irqs enabled */ | ||
481 | #if PT_FLAGS_DISABLE_IRQ != 1 | ||
482 | # error Value of IRQS_DISABLED used to set PT_FLAGS_DISABLE_IRQ; fix | ||
483 | #endif | ||
484 | 1: | ||
485 | .ifnc \function,handle_syscall | ||
486 | /* Record the fact that we saved the caller-save registers above. */ | ||
487 | ori r32, r32, PT_FLAGS_CALLER_SAVES | ||
488 | .endif | ||
489 | st r21, r32 | ||
490 | |||
491 | #ifdef __COLLECT_LINKER_FEEDBACK__ | ||
492 | /* | ||
493 | * Notify the feedback routines that we were in the | ||
494 | * appropriate fixed interrupt vector area. Note that we | ||
495 | * still have ICS set at this point, so we can't invoke any | ||
496 | * atomic operations or we will panic. The feedback | ||
497 | * routines internally preserve r0..r10 and r30 up. | ||
498 | */ | ||
499 | .ifnc \function,handle_syscall | ||
500 | shli r20, r1, 5 | ||
501 | .else | ||
502 | moveli r20, INT_SWINT_1 << 5 | ||
503 | .endif | ||
504 | moveli r21, hw2_last(intvec_feedback) | ||
505 | shl16insli r21, r21, hw1(intvec_feedback) | ||
506 | shl16insli r21, r21, hw0(intvec_feedback) | ||
507 | add r20, r20, r21 | ||
508 | jalr r20 | ||
509 | |||
510 | /* And now notify the feedback routines that we are here. */ | ||
511 | FEEDBACK_ENTER(\function) | ||
512 | #endif | ||
513 | |||
514 | /* | ||
515 | * we've captured enough state to the stack (including in | ||
516 | * particular our EX_CONTEXT state) that we can now release | ||
517 | * the interrupt critical section and replace it with our | ||
518 | * standard "interrupts disabled" mask value. This allows | ||
519 | * synchronous interrupts (and profile interrupts) to punch | ||
520 | * through from this point onwards. | ||
521 | */ | ||
522 | .ifc \function,handle_nmi | ||
523 | IRQ_DISABLE_ALL(r20) | ||
524 | .else | ||
525 | IRQ_DISABLE(r20, r21) | ||
526 | .endif | ||
527 | mtspr INTERRUPT_CRITICAL_SECTION, zero | ||
528 | |||
529 | /* | ||
530 | * Prepare the first 256 stack bytes to be rapidly accessible | ||
531 | * without having to fetch the background data. | ||
532 | */ | ||
533 | addi r52, sp, -64 | ||
534 | { | ||
535 | wh64 r52 | ||
536 | addi r52, r52, -64 | ||
537 | } | ||
538 | { | ||
539 | wh64 r52 | ||
540 | addi r52, r52, -64 | ||
541 | } | ||
542 | { | ||
543 | wh64 r52 | ||
544 | addi r52, r52, -64 | ||
545 | } | ||
546 | wh64 r52 | ||
547 | |||
548 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
549 | .ifnc \function,handle_nmi | ||
550 | /* | ||
551 | * We finally have enough state set up to notify the irq | ||
552 | * tracing code that irqs were disabled on entry to the handler. | ||
553 | * The TRACE_IRQS_OFF call clobbers registers r0-r29. | ||
554 | * For syscalls, we already have the register state saved away | ||
555 | * on the stack, so we don't bother to do any register saves here, | ||
556 | * and later we pop the registers back off the kernel stack. | ||
557 | * For interrupt handlers, save r0-r3 in callee-saved registers. | ||
558 | */ | ||
559 | .ifnc \function,handle_syscall | ||
560 | { move r30, r0; move r31, r1 } | ||
561 | { move r32, r2; move r33, r3 } | ||
562 | .endif | ||
563 | TRACE_IRQS_OFF | ||
564 | .ifnc \function,handle_syscall | ||
565 | { move r0, r30; move r1, r31 } | ||
566 | { move r2, r32; move r3, r33 } | ||
567 | .endif | ||
568 | .endif | ||
569 | #endif | ||
570 | |||
571 | .endm | ||
572 | |||
573 | /* | ||
574 | * Redispatch a downcall. | ||
575 | */ | ||
576 | .macro dc_dispatch vecnum, vecname | ||
577 | .org (\vecnum << 8) | ||
578 | intvec_\vecname: | ||
579 | j hv_downcall_dispatch | ||
580 | ENDPROC(intvec_\vecname) | ||
581 | .endm | ||
582 | |||
583 | /* | ||
584 | * Common code for most interrupts. The C function we're eventually | ||
585 | * going to is in r0, and the faultnum is in r1; the original | ||
586 | * values for those registers are on the stack. | ||
587 | */ | ||
588 | .pushsection .text.handle_interrupt,"ax" | ||
589 | handle_interrupt: | ||
590 | finish_interrupt_save handle_interrupt | ||
591 | |||
592 | /* Jump to the C routine; it should enable irqs as soon as possible. */ | ||
593 | { | ||
594 | jalr r0 | ||
595 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
596 | } | ||
597 | FEEDBACK_REENTER(handle_interrupt) | ||
598 | { | ||
599 | movei r30, 0 /* not an NMI */ | ||
600 | j interrupt_return | ||
601 | } | ||
602 | STD_ENDPROC(handle_interrupt) | ||
603 | |||
604 | /* | ||
605 | * This routine takes a boolean in r30 indicating if this is an NMI. | ||
606 | * If so, we also expect a boolean in r31 indicating whether to | ||
607 | * re-enable the oprofile interrupts. | ||
608 | */ | ||
609 | STD_ENTRY(interrupt_return) | ||
610 | /* If we're resuming to kernel space, don't check thread flags. */ | ||
611 | { | ||
612 | bnez r30, .Lrestore_all /* NMIs don't special-case user-space */ | ||
613 | PTREGS_PTR(r29, PTREGS_OFFSET_EX1) | ||
614 | } | ||
615 | ld r29, r29 | ||
616 | andi r29, r29, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */ | ||
617 | { | ||
618 | beqzt r29, .Lresume_userspace | ||
619 | PTREGS_PTR(r29, PTREGS_OFFSET_PC) | ||
620 | } | ||
621 | |||
622 | /* If we're resuming to _cpu_idle_nap, bump PC forward by 8. */ | ||
623 | moveli r27, hw2_last(_cpu_idle_nap) | ||
624 | { | ||
625 | ld r28, r29 | ||
626 | shl16insli r27, r27, hw1(_cpu_idle_nap) | ||
627 | } | ||
628 | { | ||
629 | shl16insli r27, r27, hw0(_cpu_idle_nap) | ||
630 | } | ||
631 | { | ||
632 | cmpeq r27, r27, r28 | ||
633 | } | ||
634 | { | ||
635 | blbc r27, .Lrestore_all | ||
636 | addi r28, r28, 8 | ||
637 | } | ||
638 | st r29, r28 | ||
639 | j .Lrestore_all | ||
640 | |||
641 | .Lresume_userspace: | ||
642 | FEEDBACK_REENTER(interrupt_return) | ||
643 | |||
644 | /* | ||
645 | * Disable interrupts so as to make sure we don't | ||
646 | * miss an interrupt that sets any of the thread flags (like | ||
647 | * need_resched or sigpending) between sampling and the iret. | ||
648 | * Routines like schedule() or do_signal() may re-enable | ||
649 | * interrupts before returning. | ||
650 | */ | ||
651 | IRQ_DISABLE(r20, r21) | ||
652 | TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */ | ||
653 | |||
654 | /* Get base of stack in r32; note r30/31 are used as arguments here. */ | ||
655 | GET_THREAD_INFO(r32) | ||
656 | |||
657 | |||
658 | /* Check to see if there is any work to do before returning to user. */ | ||
659 | { | ||
660 | addi r29, r32, THREAD_INFO_FLAGS_OFFSET | ||
661 | moveli r1, hw1_last(_TIF_ALLWORK_MASK) | ||
662 | } | ||
663 | { | ||
664 | ld r29, r29 | ||
665 | shl16insli r1, r1, hw0(_TIF_ALLWORK_MASK) | ||
666 | } | ||
667 | and r1, r29, r1 | ||
668 | beqzt r1, .Lrestore_all | ||
669 | |||
670 | /* | ||
671 | * Make sure we have all the registers saved for signal | ||
672 | * handling or single-step. Call out to C code to figure out | ||
673 | * exactly what we need to do for each flag bit, then if | ||
674 | * necessary, reload the flags and recheck. | ||
675 | */ | ||
676 | push_extra_callee_saves r0 | ||
677 | { | ||
678 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
679 | jal do_work_pending | ||
680 | } | ||
681 | bnez r0, .Lresume_userspace | ||
682 | |||
683 | /* | ||
684 | * In the NMI case we | ||
685 | * omit the call to single_process_check_nohz, which normally checks | ||
686 | * to see if we should start or stop the scheduler tick, because | ||
687 | * we can't call arbitrary Linux code from an NMI context. | ||
688 | * We always call the homecache TLB deferral code to re-trigger | ||
689 | * the deferral mechanism. | ||
690 | * | ||
691 | * The other chunk of responsibility this code has is to reset the | ||
692 | * interrupt masks appropriately to reset irqs and NMIs. We have | ||
693 | * to call TRACE_IRQS_OFF and TRACE_IRQS_ON to support all the | ||
694 | * lockdep-type stuff, but we can't set ICS until afterwards, since | ||
695 | * ICS can only be used in very tight chunks of code to avoid | ||
696 | * tripping over various assertions that it is off. | ||
697 | */ | ||
698 | .Lrestore_all: | ||
699 | PTREGS_PTR(r0, PTREGS_OFFSET_EX1) | ||
700 | { | ||
701 | ld r0, r0 | ||
702 | PTREGS_PTR(r32, PTREGS_OFFSET_FLAGS) | ||
703 | } | ||
704 | { | ||
705 | andi r0, r0, SPR_EX_CONTEXT_1_1__PL_MASK | ||
706 | ld r32, r32 | ||
707 | } | ||
708 | bnez r0, 1f | ||
709 | j 2f | ||
710 | #if PT_FLAGS_DISABLE_IRQ != 1 | ||
711 | # error Assuming PT_FLAGS_DISABLE_IRQ == 1 so we can use blbct below | ||
712 | #endif | ||
713 | 1: blbct r32, 2f | ||
714 | IRQ_DISABLE(r20,r21) | ||
715 | TRACE_IRQS_OFF | ||
716 | movei r0, 1 | ||
717 | mtspr INTERRUPT_CRITICAL_SECTION, r0 | ||
718 | beqzt r30, .Lrestore_regs | ||
719 | j 3f | ||
720 | 2: TRACE_IRQS_ON | ||
721 | movei r0, 1 | ||
722 | mtspr INTERRUPT_CRITICAL_SECTION, r0 | ||
723 | IRQ_ENABLE(r20, r21) | ||
724 | beqzt r30, .Lrestore_regs | ||
725 | 3: | ||
726 | |||
727 | |||
728 | /* | ||
729 | * We now commit to returning from this interrupt, since we will be | ||
730 | * doing things like setting EX_CONTEXT SPRs and unwinding the stack | ||
731 | * frame. No calls should be made to any other code after this point. | ||
732 | * This code should only be entered with ICS set. | ||
733 | * r32 must still be set to ptregs.flags. | ||
734 | * We launch loads to each cache line separately first, so we can | ||
735 | * get some parallelism out of the memory subsystem. | ||
736 | * We start zeroing caller-saved registers throughout, since | ||
737 | * that will save some cycles if this turns out to be a syscall. | ||
738 | */ | ||
739 | .Lrestore_regs: | ||
740 | FEEDBACK_REENTER(interrupt_return) /* called from elsewhere */ | ||
741 | |||
742 | /* | ||
743 | * Rotate so we have one high bit and one low bit to test. | ||
744 | * - low bit says whether to restore all the callee-saved registers, | ||
745 | * or just r30-r33, and r52 up. | ||
746 | * - high bit (i.e. sign bit) says whether to restore all the | ||
747 | * caller-saved registers, or just r0. | ||
748 | */ | ||
749 | #if PT_FLAGS_CALLER_SAVES != 2 || PT_FLAGS_RESTORE_REGS != 4 | ||
750 | # error Rotate trick does not work :-) | ||
751 | #endif | ||
752 | { | ||
753 | rotli r20, r32, 62 | ||
754 | PTREGS_PTR(sp, PTREGS_OFFSET_REG(0)) | ||
755 | } | ||
756 | |||
757 | /* | ||
758 | * Load cache lines 0, 4, 6 and 7, in that order, then use | ||
759 | * the last loaded value, which makes it likely that the other | ||
760 | * cache lines have also loaded, at which point we should be | ||
761 | * able to safely read all the remaining words on those cache | ||
762 | * lines without waiting for the memory subsystem. | ||
763 | */ | ||
764 | pop_reg r0, sp, PTREGS_OFFSET_REG(30) - PTREGS_OFFSET_REG(0) | ||
765 | pop_reg r30, sp, PTREGS_OFFSET_REG(52) - PTREGS_OFFSET_REG(30) | ||
766 | pop_reg_zero r52, r3, sp, PTREGS_OFFSET_CMPEXCH - PTREGS_OFFSET_REG(52) | ||
767 | pop_reg_zero r21, r27, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_CMPEXCH | ||
768 | pop_reg_zero lr, r2, sp, PTREGS_OFFSET_PC - PTREGS_OFFSET_EX1 | ||
769 | { | ||
770 | mtspr CMPEXCH_VALUE, r21 | ||
771 | move r4, zero | ||
772 | } | ||
773 | pop_reg r21, sp, PTREGS_OFFSET_REG(31) - PTREGS_OFFSET_PC | ||
774 | { | ||
775 | mtspr SPR_EX_CONTEXT_K_1, lr | ||
776 | andi lr, lr, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */ | ||
777 | } | ||
778 | { | ||
779 | mtspr SPR_EX_CONTEXT_K_0, r21 | ||
780 | move r5, zero | ||
781 | } | ||
782 | |||
783 | /* Restore callee-saveds that we actually use. */ | ||
784 | pop_reg_zero r31, r6 | ||
785 | pop_reg_zero r32, r7 | ||
786 | pop_reg_zero r33, r8, sp, PTREGS_OFFSET_REG(29) - PTREGS_OFFSET_REG(33) | ||
787 | |||
788 | /* | ||
789 | * If we modified other callee-saveds, restore them now. | ||
790 | * This is rare, but could be via ptrace or signal handler. | ||
791 | */ | ||
792 | { | ||
793 | move r9, zero | ||
794 | blbs r20, .Lrestore_callees | ||
795 | } | ||
796 | .Lcontinue_restore_regs: | ||
797 | |||
798 | /* Check if we're returning from a syscall. */ | ||
799 | { | ||
800 | move r10, zero | ||
801 | bltzt r20, 1f /* no, so go restore callee-save registers */ | ||
802 | } | ||
803 | |||
804 | /* | ||
805 | * Check if we're returning to userspace. | ||
806 | * Note that if we're not, we don't worry about zeroing everything. | ||
807 | */ | ||
808 | { | ||
809 | addli sp, sp, PTREGS_OFFSET_LR - PTREGS_OFFSET_REG(29) | ||
810 | bnez lr, .Lkernel_return | ||
811 | } | ||
812 | |||
813 | /* | ||
814 | * On return from syscall, we've restored r0 from pt_regs, but we | ||
815 | * clear the remainder of the caller-saved registers. We could | ||
816 | * restore the syscall arguments, but there's not much point, | ||
817 | * and it ensures user programs aren't trying to use the | ||
818 | * caller-saves if we clear them, as well as avoiding leaking | ||
819 | * kernel pointers into userspace. | ||
820 | */ | ||
821 | pop_reg_zero lr, r11, sp, PTREGS_OFFSET_TP - PTREGS_OFFSET_LR | ||
822 | pop_reg_zero tp, r12, sp, PTREGS_OFFSET_SP - PTREGS_OFFSET_TP | ||
823 | { | ||
824 | ld sp, sp | ||
825 | move r13, zero | ||
826 | move r14, zero | ||
827 | } | ||
828 | { move r15, zero; move r16, zero } | ||
829 | { move r17, zero; move r18, zero } | ||
830 | { move r19, zero; move r20, zero } | ||
831 | { move r21, zero; move r22, zero } | ||
832 | { move r23, zero; move r24, zero } | ||
833 | { move r25, zero; move r26, zero } | ||
834 | |||
835 | /* Set r1 to errno if we are returning an error, otherwise zero. */ | ||
836 | { | ||
837 | moveli r29, 4096 | ||
838 | sub r1, zero, r0 | ||
839 | } | ||
840 | { | ||
841 | move r28, zero | ||
842 | cmpltu r29, r1, r29 | ||
843 | } | ||
844 | { | ||
845 | mnz r1, r29, r1 | ||
846 | move r29, zero | ||
847 | } | ||
848 | iret | ||
849 | |||
850 | /* | ||
851 | * Not a syscall, so restore caller-saved registers. | ||
852 | * First kick off loads for cache lines 1-3, which we're touching | ||
853 | * for the first time here. | ||
854 | */ | ||
855 | .align 64 | ||
856 | 1: pop_reg r29, sp, PTREGS_OFFSET_REG(21) - PTREGS_OFFSET_REG(29) | ||
857 | pop_reg r21, sp, PTREGS_OFFSET_REG(13) - PTREGS_OFFSET_REG(21) | ||
858 | pop_reg r13, sp, PTREGS_OFFSET_REG(1) - PTREGS_OFFSET_REG(13) | ||
859 | pop_reg r1 | ||
860 | pop_reg r2 | ||
861 | pop_reg r3 | ||
862 | pop_reg r4 | ||
863 | pop_reg r5 | ||
864 | pop_reg r6 | ||
865 | pop_reg r7 | ||
866 | pop_reg r8 | ||
867 | pop_reg r9 | ||
868 | pop_reg r10 | ||
869 | pop_reg r11 | ||
870 | pop_reg r12, sp, 16 | ||
871 | /* r13 already restored above */ | ||
872 | pop_reg r14 | ||
873 | pop_reg r15 | ||
874 | pop_reg r16 | ||
875 | pop_reg r17 | ||
876 | pop_reg r18 | ||
877 | pop_reg r19 | ||
878 | pop_reg r20, sp, 16 | ||
879 | /* r21 already restored above */ | ||
880 | pop_reg r22 | ||
881 | pop_reg r23 | ||
882 | pop_reg r24 | ||
883 | pop_reg r25 | ||
884 | pop_reg r26 | ||
885 | pop_reg r27 | ||
886 | pop_reg r28, sp, PTREGS_OFFSET_LR - PTREGS_OFFSET_REG(28) | ||
887 | /* r29 already restored above */ | ||
888 | bnez lr, .Lkernel_return | ||
889 | pop_reg lr, sp, PTREGS_OFFSET_TP - PTREGS_OFFSET_LR | ||
890 | pop_reg tp, sp, PTREGS_OFFSET_SP - PTREGS_OFFSET_TP | ||
891 | ld sp, sp | ||
892 | iret | ||
893 | |||
894 | /* | ||
895 | * We can't restore tp when in kernel mode, since a thread might | ||
896 | * have migrated from another cpu and brought a stale tp value. | ||
897 | */ | ||
898 | .Lkernel_return: | ||
899 | pop_reg lr, sp, PTREGS_OFFSET_SP - PTREGS_OFFSET_LR | ||
900 | ld sp, sp | ||
901 | iret | ||
902 | |||
903 | /* Restore callee-saved registers from r34 to r51. */ | ||
904 | .Lrestore_callees: | ||
905 | addli sp, sp, PTREGS_OFFSET_REG(34) - PTREGS_OFFSET_REG(29) | ||
906 | pop_reg r34 | ||
907 | pop_reg r35 | ||
908 | pop_reg r36 | ||
909 | pop_reg r37 | ||
910 | pop_reg r38 | ||
911 | pop_reg r39 | ||
912 | pop_reg r40 | ||
913 | pop_reg r41 | ||
914 | pop_reg r42 | ||
915 | pop_reg r43 | ||
916 | pop_reg r44 | ||
917 | pop_reg r45 | ||
918 | pop_reg r46 | ||
919 | pop_reg r47 | ||
920 | pop_reg r48 | ||
921 | pop_reg r49 | ||
922 | pop_reg r50 | ||
923 | pop_reg r51, sp, PTREGS_OFFSET_REG(29) - PTREGS_OFFSET_REG(51) | ||
924 | j .Lcontinue_restore_regs | ||
925 | STD_ENDPROC(interrupt_return) | ||
926 | |||
927 | /* | ||
928 | * "NMI" interrupts mask ALL interrupts before calling the | ||
929 | * handler, and don't check thread flags, etc., on the way | ||
930 | * back out. In general, the only things we do here for NMIs | ||
931 | * are register save/restore and dataplane kernel-TLB management. | ||
932 | * We don't (for example) deal with start/stop of the sched tick. | ||
933 | */ | ||
934 | .pushsection .text.handle_nmi,"ax" | ||
935 | handle_nmi: | ||
936 | finish_interrupt_save handle_nmi | ||
937 | { | ||
938 | jalr r0 | ||
939 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | ||
940 | } | ||
941 | FEEDBACK_REENTER(handle_nmi) | ||
942 | { | ||
943 | movei r30, 1 | ||
944 | move r31, r0 | ||
945 | } | ||
946 | j interrupt_return | ||
947 | STD_ENDPROC(handle_nmi) | ||
948 | |||
949 | /* | ||
950 | * Parallel code for syscalls to handle_interrupt. | ||
951 | */ | ||
952 | .pushsection .text.handle_syscall,"ax" | ||
953 | handle_syscall: | ||
954 | finish_interrupt_save handle_syscall | ||
955 | |||
956 | /* Enable irqs. */ | ||
957 | TRACE_IRQS_ON | ||
958 | IRQ_ENABLE(r20, r21) | ||
959 | |||
960 | /* Bump the counter for syscalls made on this tile. */ | ||
961 | moveli r20, hw2_last(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET) | ||
962 | shl16insli r20, r20, hw1(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET) | ||
963 | shl16insli r20, r20, hw0(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET) | ||
964 | add r20, r20, tp | ||
965 | ld4s r21, r20 | ||
966 | addi r21, r21, 1 | ||
967 | st4 r20, r21 | ||
968 | |||
969 | /* Trace syscalls, if requested. */ | ||
970 | GET_THREAD_INFO(r31) | ||
971 | addi r31, r31, THREAD_INFO_FLAGS_OFFSET | ||
972 | ld r30, r31 | ||
973 | andi r30, r30, _TIF_SYSCALL_TRACE | ||
974 | { | ||
975 | addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET | ||
976 | beqzt r30, .Lrestore_syscall_regs | ||
977 | } | ||
978 | jal do_syscall_trace | ||
979 | FEEDBACK_REENTER(handle_syscall) | ||
980 | |||
981 | /* | ||
982 | * We always reload our registers from the stack at this | ||
983 | * point. They might be valid, if we didn't build with | ||
984 | * TRACE_IRQFLAGS, and this isn't a dataplane tile, and we're not | ||
985 | * doing syscall tracing, but there are enough cases now that it | ||
986 | * seems simplest just to do the reload unconditionally. | ||
987 | */ | ||
988 | .Lrestore_syscall_regs: | ||
989 | { | ||
990 | ld r30, r30 | ||
991 | PTREGS_PTR(r11, PTREGS_OFFSET_REG(0)) | ||
992 | } | ||
993 | pop_reg r0, r11 | ||
994 | pop_reg r1, r11 | ||
995 | pop_reg r2, r11 | ||
996 | pop_reg r3, r11 | ||
997 | pop_reg r4, r11 | ||
998 | pop_reg r5, r11, PTREGS_OFFSET_SYSCALL - PTREGS_OFFSET_REG(5) | ||
999 | { | ||
1000 | ld TREG_SYSCALL_NR_NAME, r11 | ||
1001 | moveli r21, __NR_syscalls | ||
1002 | } | ||
1003 | |||
1004 | /* Ensure that the syscall number is within the legal range. */ | ||
1005 | { | ||
1006 | moveli r20, hw2(sys_call_table) | ||
1007 | blbs r30, .Lcompat_syscall | ||
1008 | } | ||
1009 | { | ||
1010 | cmpltu r21, TREG_SYSCALL_NR_NAME, r21 | ||
1011 | shl16insli r20, r20, hw1(sys_call_table) | ||
1012 | } | ||
1013 | { | ||
1014 | blbc r21, .Linvalid_syscall | ||
1015 | shl16insli r20, r20, hw0(sys_call_table) | ||
1016 | } | ||
1017 | .Lload_syscall_pointer: | ||
1018 | shl3add r20, TREG_SYSCALL_NR_NAME, r20 | ||
1019 | ld r20, r20 | ||
1020 | |||
1021 | /* Jump to syscall handler. */ | ||
1022 | jalr r20 | ||
1023 | .Lhandle_syscall_link: /* value of "lr" after "jalr r20" above */ | ||
1024 | |||
1025 | /* | ||
1026 | * Write our r0 onto the stack so it gets restored instead | ||
1027 | * of whatever the user had there before. | ||
1028 | * In compat mode, sign-extend r0 before storing it. | ||
1029 | */ | ||
1030 | { | ||
1031 | PTREGS_PTR(r29, PTREGS_OFFSET_REG(0)) | ||
1032 | blbct r30, 1f | ||
1033 | } | ||
1034 | addxi r0, r0, 0 | ||
1035 | 1: st r29, r0 | ||
1036 | |||
1037 | .Lsyscall_sigreturn_skip: | ||
1038 | FEEDBACK_REENTER(handle_syscall) | ||
1039 | |||
1040 | /* Do syscall trace again, if requested. */ | ||
1041 | ld r30, r31 | ||
1042 | andi r30, r30, _TIF_SYSCALL_TRACE | ||
1043 | beqzt r30, 1f | ||
1044 | jal do_syscall_trace | ||
1045 | FEEDBACK_REENTER(handle_syscall) | ||
1046 | 1: j .Lresume_userspace /* jump into middle of interrupt_return */ | ||
1047 | |||
1048 | .Lcompat_syscall: | ||
1049 | /* | ||
1050 | * Load the base of the compat syscall table in r20, and | ||
1051 | * range-check the syscall number (duplicated from 64-bit path). | ||
1052 | * Sign-extend all the user's passed arguments to make them consistent. | ||
1053 | * Also save the original "r(n)" values away in "r(11+n)" in | ||
1054 | * case the syscall table entry wants to validate them. | ||
1055 | */ | ||
1056 | moveli r20, hw2(compat_sys_call_table) | ||
1057 | { | ||
1058 | cmpltu r21, TREG_SYSCALL_NR_NAME, r21 | ||
1059 | shl16insli r20, r20, hw1(compat_sys_call_table) | ||
1060 | } | ||
1061 | { | ||
1062 | blbc r21, .Linvalid_syscall | ||
1063 | shl16insli r20, r20, hw0(compat_sys_call_table) | ||
1064 | } | ||
1065 | { move r11, r0; addxi r0, r0, 0 } | ||
1066 | { move r12, r1; addxi r1, r1, 0 } | ||
1067 | { move r13, r2; addxi r2, r2, 0 } | ||
1068 | { move r14, r3; addxi r3, r3, 0 } | ||
1069 | { move r15, r4; addxi r4, r4, 0 } | ||
1070 | { move r16, r5; addxi r5, r5, 0 } | ||
1071 | j .Lload_syscall_pointer | ||
1072 | |||
1073 | .Linvalid_syscall: | ||
1074 | /* Report an invalid syscall back to the user program */ | ||
1075 | { | ||
1076 | PTREGS_PTR(r29, PTREGS_OFFSET_REG(0)) | ||
1077 | movei r28, -ENOSYS | ||
1078 | } | ||
1079 | st r29, r28 | ||
1080 | j .Lresume_userspace /* jump into middle of interrupt_return */ | ||
1081 | STD_ENDPROC(handle_syscall) | ||
1082 | |||
1083 | /* Return the address for oprofile to suppress in backtraces. */ | ||
1084 | STD_ENTRY_SECTION(handle_syscall_link_address, .text.handle_syscall) | ||
1085 | lnk r0 | ||
1086 | { | ||
1087 | addli r0, r0, .Lhandle_syscall_link - . | ||
1088 | jrp lr | ||
1089 | } | ||
1090 | STD_ENDPROC(handle_syscall_link_address) | ||
1091 | |||
1092 | STD_ENTRY(ret_from_fork) | ||
1093 | jal sim_notify_fork | ||
1094 | jal schedule_tail | ||
1095 | FEEDBACK_REENTER(ret_from_fork) | ||
1096 | j .Lresume_userspace | ||
1097 | STD_ENDPROC(ret_from_fork) | ||
1098 | |||
1099 | /* Various stub interrupt handlers and syscall handlers */ | ||
1100 | |||
1101 | STD_ENTRY_LOCAL(_kernel_double_fault) | ||
1102 | mfspr r1, SPR_EX_CONTEXT_K_0 | ||
1103 | move r2, lr | ||
1104 | move r3, sp | ||
1105 | move r4, r52 | ||
1106 | addi sp, sp, -C_ABI_SAVE_AREA_SIZE | ||
1107 | j kernel_double_fault | ||
1108 | STD_ENDPROC(_kernel_double_fault) | ||
1109 | |||
1110 | STD_ENTRY_LOCAL(bad_intr) | ||
1111 | mfspr r2, SPR_EX_CONTEXT_K_0 | ||
1112 | panic "Unhandled interrupt %#x: PC %#lx" | ||
1113 | STD_ENDPROC(bad_intr) | ||
1114 | |||
1115 | /* Put address of pt_regs in reg and jump. */ | ||
1116 | #define PTREGS_SYSCALL(x, reg) \ | ||
1117 | STD_ENTRY(_##x); \ | ||
1118 | { \ | ||
1119 | PTREGS_PTR(reg, PTREGS_OFFSET_BASE); \ | ||
1120 | j x \ | ||
1121 | }; \ | ||
1122 | STD_ENDPROC(_##x) | ||
1123 | |||
1124 | /* | ||
1125 | * Special-case sigreturn to not write r0 to the stack on return. | ||
1126 | * This is technically more efficient, but it also avoids difficulties | ||
1127 | * in the 64-bit OS when handling 32-bit compat code, since we must not | ||
1128 | * sign-extend r0 for the sigreturn return-value case. | ||
1129 | */ | ||
1130 | #define PTREGS_SYSCALL_SIGRETURN(x, reg) \ | ||
1131 | STD_ENTRY(_##x); \ | ||
1132 | addli lr, lr, .Lsyscall_sigreturn_skip - .Lhandle_syscall_link; \ | ||
1133 | { \ | ||
1134 | PTREGS_PTR(reg, PTREGS_OFFSET_BASE); \ | ||
1135 | j x \ | ||
1136 | }; \ | ||
1137 | STD_ENDPROC(_##x) | ||
1138 | |||
1139 | PTREGS_SYSCALL(sys_execve, r3) | ||
1140 | PTREGS_SYSCALL(sys_sigaltstack, r2) | ||
1141 | PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0) | ||
1142 | #ifdef CONFIG_COMPAT | ||
1143 | PTREGS_SYSCALL(compat_sys_execve, r3) | ||
1144 | PTREGS_SYSCALL(compat_sys_sigaltstack, r2) | ||
1145 | PTREGS_SYSCALL_SIGRETURN(compat_sys_rt_sigreturn, r0) | ||
1146 | #endif | ||
1147 | |||
1148 | /* Save additional callee-saves to pt_regs, put address in r4 and jump. */ | ||
1149 | STD_ENTRY(_sys_clone) | ||
1150 | push_extra_callee_saves r4 | ||
1151 | j sys_clone | ||
1152 | STD_ENDPROC(_sys_clone) | ||
1153 | |||
1154 | /* The single-step support may need to read all the registers. */ | ||
1155 | int_unalign: | ||
1156 | push_extra_callee_saves r0 | ||
1157 | j do_trap | ||
1158 | |||
1159 | /* Include .intrpt1 array of interrupt vectors */ | ||
1160 | .section ".intrpt1", "ax" | ||
1161 | |||
1162 | #define op_handle_perf_interrupt bad_intr | ||
1163 | #define op_handle_aux_perf_interrupt bad_intr | ||
1164 | |||
1165 | #ifndef CONFIG_HARDWALL | ||
1166 | #define do_hardwall_trap bad_intr | ||
1167 | #endif | ||
1168 | |||
1169 | int_hand INT_MEM_ERROR, MEM_ERROR, bad_intr | ||
1170 | int_hand INT_SINGLE_STEP_3, SINGLE_STEP_3, bad_intr | ||
1171 | #if CONFIG_KERNEL_PL == 2 | ||
1172 | int_hand INT_SINGLE_STEP_2, SINGLE_STEP_2, gx_singlestep_handle | ||
1173 | int_hand INT_SINGLE_STEP_1, SINGLE_STEP_1, bad_intr | ||
1174 | #else | ||
1175 | int_hand INT_SINGLE_STEP_2, SINGLE_STEP_2, bad_intr | ||
1176 | int_hand INT_SINGLE_STEP_1, SINGLE_STEP_1, gx_singlestep_handle | ||
1177 | #endif | ||
1178 | int_hand INT_SINGLE_STEP_0, SINGLE_STEP_0, bad_intr | ||
1179 | int_hand INT_IDN_COMPLETE, IDN_COMPLETE, bad_intr | ||
1180 | int_hand INT_UDN_COMPLETE, UDN_COMPLETE, bad_intr | ||
1181 | int_hand INT_ITLB_MISS, ITLB_MISS, do_page_fault | ||
1182 | int_hand INT_ILL, ILL, do_trap | ||
1183 | int_hand INT_GPV, GPV, do_trap | ||
1184 | int_hand INT_IDN_ACCESS, IDN_ACCESS, do_trap | ||
1185 | int_hand INT_UDN_ACCESS, UDN_ACCESS, do_trap | ||
1186 | int_hand INT_SWINT_3, SWINT_3, do_trap | ||
1187 | int_hand INT_SWINT_2, SWINT_2, do_trap | ||
1188 | int_hand INT_SWINT_1, SWINT_1, SYSCALL, handle_syscall | ||
1189 | int_hand INT_SWINT_0, SWINT_0, do_trap | ||
1190 | int_hand INT_ILL_TRANS, ILL_TRANS, do_trap | ||
1191 | int_hand INT_UNALIGN_DATA, UNALIGN_DATA, int_unalign | ||
1192 | int_hand INT_DTLB_MISS, DTLB_MISS, do_page_fault | ||
1193 | int_hand INT_DTLB_ACCESS, DTLB_ACCESS, do_page_fault | ||
1194 | int_hand INT_IDN_FIREWALL, IDN_FIREWALL, bad_intr | ||
1195 | int_hand INT_UDN_FIREWALL, UDN_FIREWALL, do_hardwall_trap | ||
1196 | int_hand INT_TILE_TIMER, TILE_TIMER, do_timer_interrupt | ||
1197 | int_hand INT_IDN_TIMER, IDN_TIMER, bad_intr | ||
1198 | int_hand INT_UDN_TIMER, UDN_TIMER, bad_intr | ||
1199 | int_hand INT_IDN_AVAIL, IDN_AVAIL, bad_intr | ||
1200 | int_hand INT_UDN_AVAIL, UDN_AVAIL, bad_intr | ||
1201 | int_hand INT_IPI_3, IPI_3, bad_intr | ||
1202 | #if CONFIG_KERNEL_PL == 2 | ||
1203 | int_hand INT_IPI_2, IPI_2, tile_dev_intr | ||
1204 | int_hand INT_IPI_1, IPI_1, bad_intr | ||
1205 | #else | ||
1206 | int_hand INT_IPI_2, IPI_2, bad_intr | ||
1207 | int_hand INT_IPI_1, IPI_1, tile_dev_intr | ||
1208 | #endif | ||
1209 | int_hand INT_IPI_0, IPI_0, bad_intr | ||
1210 | int_hand INT_PERF_COUNT, PERF_COUNT, \ | ||
1211 | op_handle_perf_interrupt, handle_nmi | ||
1212 | int_hand INT_AUX_PERF_COUNT, AUX_PERF_COUNT, \ | ||
1213 | op_handle_perf_interrupt, handle_nmi | ||
1214 | int_hand INT_INTCTRL_3, INTCTRL_3, bad_intr | ||
1215 | #if CONFIG_KERNEL_PL == 2 | ||
1216 | dc_dispatch INT_INTCTRL_2, INTCTRL_2 | ||
1217 | int_hand INT_INTCTRL_1, INTCTRL_1, bad_intr | ||
1218 | #else | ||
1219 | int_hand INT_INTCTRL_2, INTCTRL_2, bad_intr | ||
1220 | dc_dispatch INT_INTCTRL_1, INTCTRL_1 | ||
1221 | #endif | ||
1222 | int_hand INT_INTCTRL_0, INTCTRL_0, bad_intr | ||
1223 | int_hand INT_MESSAGE_RCV_DWNCL, MESSAGE_RCV_DWNCL, \ | ||
1224 | hv_message_intr | ||
1225 | int_hand INT_DEV_INTR_DWNCL, DEV_INTR_DWNCL, bad_intr | ||
1226 | int_hand INT_I_ASID, I_ASID, bad_intr | ||
1227 | int_hand INT_D_ASID, D_ASID, bad_intr | ||
1228 | int_hand INT_DOUBLE_FAULT, DOUBLE_FAULT, do_trap | ||
1229 | |||
1230 | /* Synthetic interrupt delivered only by the simulator */ | ||
1231 | int_hand INT_BREAKPOINT, BREAKPOINT, do_breakpoint | ||
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c index e2ab82b7c7e7..f68df69f1f67 100644 --- a/arch/tile/kernel/module.c +++ b/arch/tile/kernel/module.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <asm/opcode-tile.h> | 23 | #include <asm/opcode-tile.h> |
24 | #include <asm/pgtable.h> | 24 | #include <asm/pgtable.h> |
25 | #include <asm/homecache.h> | ||
25 | 26 | ||
26 | #ifdef __tilegx__ | 27 | #ifdef __tilegx__ |
27 | # define Elf_Rela Elf64_Rela | 28 | # define Elf_Rela Elf64_Rela |
@@ -86,8 +87,13 @@ error: | |||
86 | void module_free(struct module *mod, void *module_region) | 87 | void module_free(struct module *mod, void *module_region) |
87 | { | 88 | { |
88 | vfree(module_region); | 89 | vfree(module_region); |
90 | |||
91 | /* Globally flush the L1 icache. */ | ||
92 | flush_remote(0, HV_FLUSH_EVICT_L1I, cpu_online_mask, | ||
93 | 0, 0, 0, NULL, NULL, 0); | ||
94 | |||
89 | /* | 95 | /* |
90 | * FIXME: If module_region == mod->init_region, trim exception | 96 | * FIXME: If module_region == mod->module_init, trim exception |
91 | * table entries. | 97 | * table entries. |
92 | */ | 98 | */ |
93 | } | 99 | } |
diff --git a/arch/tile/kernel/pci-dma.c b/arch/tile/kernel/pci-dma.c index 658752b2835e..658f2ce426a4 100644 --- a/arch/tile/kernel/pci-dma.c +++ b/arch/tile/kernel/pci-dma.c | |||
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(dma_sync_single_range_for_device); | |||
244 | * dma_alloc_noncoherent() returns non-cacheable memory, so there's no | 244 | * dma_alloc_noncoherent() returns non-cacheable memory, so there's no |
245 | * need to do any flushing here. | 245 | * need to do any flushing here. |
246 | */ | 246 | */ |
247 | void dma_cache_sync(void *vaddr, size_t size, | 247 | void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
248 | enum dma_data_direction direction) | 248 | enum dma_data_direction direction) |
249 | { | 249 | { |
250 | } | 250 | } |
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c index ea38f0c9ec7c..6d4cb5d7a9fd 100644 --- a/arch/tile/kernel/pci.c +++ b/arch/tile/kernel/pci.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2010 Tilera Corporation. All Rights Reserved. | 2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
@@ -59,6 +59,7 @@ int __write_once tile_plx_gen1; | |||
59 | 59 | ||
60 | static struct pci_controller controllers[TILE_NUM_PCIE]; | 60 | static struct pci_controller controllers[TILE_NUM_PCIE]; |
61 | static int num_controllers; | 61 | static int num_controllers; |
62 | static int pci_scan_flags[TILE_NUM_PCIE]; | ||
62 | 63 | ||
63 | static struct pci_ops tile_cfg_ops; | 64 | static struct pci_ops tile_cfg_ops; |
64 | 65 | ||
@@ -79,7 +80,7 @@ EXPORT_SYMBOL(pcibios_align_resource); | |||
79 | * controller_id is the controller number, config type is 0 or 1 for | 80 | * controller_id is the controller number, config type is 0 or 1 for |
80 | * config0 or config1 operations. | 81 | * config0 or config1 operations. |
81 | */ | 82 | */ |
82 | static int __init tile_pcie_open(int controller_id, int config_type) | 83 | static int __devinit tile_pcie_open(int controller_id, int config_type) |
83 | { | 84 | { |
84 | char filename[32]; | 85 | char filename[32]; |
85 | int fd; | 86 | int fd; |
@@ -95,7 +96,7 @@ static int __init tile_pcie_open(int controller_id, int config_type) | |||
95 | /* | 96 | /* |
96 | * Get the IRQ numbers from the HV and set up the handlers for them. | 97 | * Get the IRQ numbers from the HV and set up the handlers for them. |
97 | */ | 98 | */ |
98 | static int __init tile_init_irqs(int controller_id, | 99 | static int __devinit tile_init_irqs(int controller_id, |
99 | struct pci_controller *controller) | 100 | struct pci_controller *controller) |
100 | { | 101 | { |
101 | char filename[32]; | 102 | char filename[32]; |
@@ -139,71 +140,74 @@ static int __init tile_init_irqs(int controller_id, | |||
139 | * | 140 | * |
140 | * Returns the number of controllers discovered. | 141 | * Returns the number of controllers discovered. |
141 | */ | 142 | */ |
142 | int __init tile_pci_init(void) | 143 | int __devinit tile_pci_init(void) |
143 | { | 144 | { |
144 | int i; | 145 | int i; |
145 | 146 | ||
146 | pr_info("PCI: Searching for controllers...\n"); | 147 | pr_info("PCI: Searching for controllers...\n"); |
147 | 148 | ||
149 | /* Re-init number of PCIe controllers to support hot-plug feature. */ | ||
150 | num_controllers = 0; | ||
151 | |||
148 | /* Do any configuration we need before using the PCIe */ | 152 | /* Do any configuration we need before using the PCIe */ |
149 | 153 | ||
150 | for (i = 0; i < TILE_NUM_PCIE; i++) { | 154 | for (i = 0; i < TILE_NUM_PCIE; i++) { |
151 | int hv_cfg_fd0 = -1; | ||
152 | int hv_cfg_fd1 = -1; | ||
153 | int hv_mem_fd = -1; | ||
154 | char name[32]; | ||
155 | struct pci_controller *controller; | ||
156 | |||
157 | /* | 155 | /* |
158 | * Open the fd to the HV. If it fails then this | 156 | * To see whether we need a real config op based on |
159 | * device doesn't exist. | 157 | * the results of pcibios_init(), to support PCIe hot-plug. |
160 | */ | 158 | */ |
161 | hv_cfg_fd0 = tile_pcie_open(i, 0); | 159 | if (pci_scan_flags[i] == 0) { |
162 | if (hv_cfg_fd0 < 0) | 160 | int hv_cfg_fd0 = -1; |
163 | continue; | 161 | int hv_cfg_fd1 = -1; |
164 | hv_cfg_fd1 = tile_pcie_open(i, 1); | 162 | int hv_mem_fd = -1; |
165 | if (hv_cfg_fd1 < 0) { | 163 | char name[32]; |
166 | pr_err("PCI: Couldn't open config fd to HV " | 164 | struct pci_controller *controller; |
167 | "for controller %d\n", i); | 165 | |
168 | goto err_cont; | 166 | /* |
169 | } | 167 | * Open the fd to the HV. If it fails then this |
170 | 168 | * device doesn't exist. | |
171 | sprintf(name, "pcie/%d/mem", i); | 169 | */ |
172 | hv_mem_fd = hv_dev_open((HV_VirtAddr)name, 0); | 170 | hv_cfg_fd0 = tile_pcie_open(i, 0); |
173 | if (hv_mem_fd < 0) { | 171 | if (hv_cfg_fd0 < 0) |
174 | pr_err("PCI: Could not open mem fd to HV!\n"); | 172 | continue; |
175 | goto err_cont; | 173 | hv_cfg_fd1 = tile_pcie_open(i, 1); |
176 | } | 174 | if (hv_cfg_fd1 < 0) { |
175 | pr_err("PCI: Couldn't open config fd to HV " | ||
176 | "for controller %d\n", i); | ||
177 | goto err_cont; | ||
178 | } | ||
177 | 179 | ||
178 | pr_info("PCI: Found PCI controller #%d\n", i); | 180 | sprintf(name, "pcie/%d/mem", i); |
181 | hv_mem_fd = hv_dev_open((HV_VirtAddr)name, 0); | ||
182 | if (hv_mem_fd < 0) { | ||
183 | pr_err("PCI: Could not open mem fd to HV!\n"); | ||
184 | goto err_cont; | ||
185 | } | ||
179 | 186 | ||
180 | controller = &controllers[num_controllers]; | 187 | pr_info("PCI: Found PCI controller #%d\n", i); |
181 | 188 | ||
182 | if (tile_init_irqs(i, controller)) { | 189 | controller = &controllers[i]; |
183 | pr_err("PCI: Could not initialize " | ||
184 | "IRQs, aborting.\n"); | ||
185 | goto err_cont; | ||
186 | } | ||
187 | 190 | ||
188 | controller->index = num_controllers; | 191 | controller->index = i; |
189 | controller->hv_cfg_fd[0] = hv_cfg_fd0; | 192 | controller->hv_cfg_fd[0] = hv_cfg_fd0; |
190 | controller->hv_cfg_fd[1] = hv_cfg_fd1; | 193 | controller->hv_cfg_fd[1] = hv_cfg_fd1; |
191 | controller->hv_mem_fd = hv_mem_fd; | 194 | controller->hv_mem_fd = hv_mem_fd; |
192 | controller->first_busno = 0; | 195 | controller->first_busno = 0; |
193 | controller->last_busno = 0xff; | 196 | controller->last_busno = 0xff; |
194 | controller->ops = &tile_cfg_ops; | 197 | controller->ops = &tile_cfg_ops; |
195 | 198 | ||
196 | num_controllers++; | 199 | num_controllers++; |
197 | continue; | 200 | continue; |
198 | 201 | ||
199 | err_cont: | 202 | err_cont: |
200 | if (hv_cfg_fd0 >= 0) | 203 | if (hv_cfg_fd0 >= 0) |
201 | hv_dev_close(hv_cfg_fd0); | 204 | hv_dev_close(hv_cfg_fd0); |
202 | if (hv_cfg_fd1 >= 0) | 205 | if (hv_cfg_fd1 >= 0) |
203 | hv_dev_close(hv_cfg_fd1); | 206 | hv_dev_close(hv_cfg_fd1); |
204 | if (hv_mem_fd >= 0) | 207 | if (hv_mem_fd >= 0) |
205 | hv_dev_close(hv_mem_fd); | 208 | hv_dev_close(hv_mem_fd); |
206 | continue; | 209 | continue; |
210 | } | ||
207 | } | 211 | } |
208 | 212 | ||
209 | /* | 213 | /* |
@@ -232,7 +236,7 @@ static int tile_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | |||
232 | } | 236 | } |
233 | 237 | ||
234 | 238 | ||
235 | static void __init fixup_read_and_payload_sizes(void) | 239 | static void __devinit fixup_read_and_payload_sizes(void) |
236 | { | 240 | { |
237 | struct pci_dev *dev = NULL; | 241 | struct pci_dev *dev = NULL; |
238 | int smallest_max_payload = 0x1; /* Tile maxes out at 256 bytes. */ | 242 | int smallest_max_payload = 0x1; /* Tile maxes out at 256 bytes. */ |
@@ -282,7 +286,7 @@ static void __init fixup_read_and_payload_sizes(void) | |||
282 | * The controllers have been set up by the time we get here, by a call to | 286 | * The controllers have been set up by the time we get here, by a call to |
283 | * tile_pci_init. | 287 | * tile_pci_init. |
284 | */ | 288 | */ |
285 | static int __init pcibios_init(void) | 289 | int __devinit pcibios_init(void) |
286 | { | 290 | { |
287 | int i; | 291 | int i; |
288 | 292 | ||
@@ -296,25 +300,36 @@ static int __init pcibios_init(void) | |||
296 | mdelay(250); | 300 | mdelay(250); |
297 | 301 | ||
298 | /* Scan all of the recorded PCI controllers. */ | 302 | /* Scan all of the recorded PCI controllers. */ |
299 | for (i = 0; i < num_controllers; i++) { | 303 | for (i = 0; i < TILE_NUM_PCIE; i++) { |
300 | struct pci_controller *controller = &controllers[i]; | ||
301 | struct pci_bus *bus; | ||
302 | |||
303 | pr_info("PCI: initializing controller #%d\n", i); | ||
304 | |||
305 | /* | 304 | /* |
306 | * This comes from the generic Linux PCI driver. | 305 | * Do real pcibios init ops if the controller is initialized |
307 | * | 306 | * by tile_pci_init() successfully and not initialized by |
308 | * It reads the PCI tree for this bus into the Linux | 307 | * pcibios_init() yet to support PCIe hot-plug. |
309 | * data structures. | ||
310 | * | ||
311 | * This is inlined in linux/pci.h and calls into | ||
312 | * pci_scan_bus_parented() in probe.c. | ||
313 | */ | 308 | */ |
314 | bus = pci_scan_bus(0, controller->ops, controller); | 309 | if (pci_scan_flags[i] == 0 && controllers[i].ops != NULL) { |
315 | controller->root_bus = bus; | 310 | struct pci_controller *controller = &controllers[i]; |
316 | controller->last_busno = bus->subordinate; | 311 | struct pci_bus *bus; |
317 | 312 | ||
313 | if (tile_init_irqs(i, controller)) { | ||
314 | pr_err("PCI: Could not initialize IRQs\n"); | ||
315 | continue; | ||
316 | } | ||
317 | |||
318 | pr_info("PCI: initializing controller #%d\n", i); | ||
319 | |||
320 | /* | ||
321 | * This comes from the generic Linux PCI driver. | ||
322 | * | ||
323 | * It reads the PCI tree for this bus into the Linux | ||
324 | * data structures. | ||
325 | * | ||
326 | * This is inlined in linux/pci.h and calls into | ||
327 | * pci_scan_bus_parented() in probe.c. | ||
328 | */ | ||
329 | bus = pci_scan_bus(0, controller->ops, controller); | ||
330 | controller->root_bus = bus; | ||
331 | controller->last_busno = bus->subordinate; | ||
332 | } | ||
318 | } | 333 | } |
319 | 334 | ||
320 | /* Do machine dependent PCI interrupt routing */ | 335 | /* Do machine dependent PCI interrupt routing */ |
@@ -326,34 +341,45 @@ static int __init pcibios_init(void) | |||
326 | * It allocates all of the resources (I/O memory, etc) | 341 | * It allocates all of the resources (I/O memory, etc) |
327 | * associated with the devices read in above. | 342 | * associated with the devices read in above. |
328 | */ | 343 | */ |
329 | |||
330 | pci_assign_unassigned_resources(); | 344 | pci_assign_unassigned_resources(); |
331 | 345 | ||
332 | /* Configure the max_read_size and max_payload_size values. */ | 346 | /* Configure the max_read_size and max_payload_size values. */ |
333 | fixup_read_and_payload_sizes(); | 347 | fixup_read_and_payload_sizes(); |
334 | 348 | ||
335 | /* Record the I/O resources in the PCI controller structure. */ | 349 | /* Record the I/O resources in the PCI controller structure. */ |
336 | for (i = 0; i < num_controllers; i++) { | 350 | for (i = 0; i < TILE_NUM_PCIE; i++) { |
337 | struct pci_bus *root_bus = controllers[i].root_bus; | 351 | /* |
338 | struct pci_bus *next_bus; | 352 | * Do real pcibios init ops if the controller is initialized |
339 | struct pci_dev *dev; | 353 | * by tile_pci_init() successfully and not initialized by |
340 | 354 | * pcibios_init() yet to support PCIe hot-plug. | |
341 | list_for_each_entry(dev, &root_bus->devices, bus_list) { | 355 | */ |
342 | /* Find the PCI host controller, ie. the 1st bridge. */ | 356 | if (pci_scan_flags[i] == 0 && controllers[i].ops != NULL) { |
343 | if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && | 357 | struct pci_bus *root_bus = controllers[i].root_bus; |
344 | (PCI_SLOT(dev->devfn) == 0)) { | 358 | struct pci_bus *next_bus; |
345 | next_bus = dev->subordinate; | 359 | struct pci_dev *dev; |
346 | controllers[i].mem_resources[0] = | 360 | |
347 | *next_bus->resource[0]; | 361 | list_for_each_entry(dev, &root_bus->devices, bus_list) { |
348 | controllers[i].mem_resources[1] = | 362 | /* |
349 | *next_bus->resource[1]; | 363 | * Find the PCI host controller, ie. the 1st |
350 | controllers[i].mem_resources[2] = | 364 | * bridge. |
351 | *next_bus->resource[2]; | 365 | */ |
352 | 366 | if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && | |
353 | break; | 367 | (PCI_SLOT(dev->devfn) == 0)) { |
368 | next_bus = dev->subordinate; | ||
369 | controllers[i].mem_resources[0] = | ||
370 | *next_bus->resource[0]; | ||
371 | controllers[i].mem_resources[1] = | ||
372 | *next_bus->resource[1]; | ||
373 | controllers[i].mem_resources[2] = | ||
374 | *next_bus->resource[2]; | ||
375 | |||
376 | /* Setup flags. */ | ||
377 | pci_scan_flags[i] = 1; | ||
378 | |||
379 | break; | ||
380 | } | ||
354 | } | 381 | } |
355 | } | 382 | } |
356 | |||
357 | } | 383 | } |
358 | 384 | ||
359 | return 0; | 385 | return 0; |
@@ -381,7 +407,7 @@ char __devinit *pcibios_setup(char *str) | |||
381 | /* | 407 | /* |
382 | * This is called from the generic Linux layer. | 408 | * This is called from the generic Linux layer. |
383 | */ | 409 | */ |
384 | void __init pcibios_update_irq(struct pci_dev *dev, int irq) | 410 | void __devinit pcibios_update_irq(struct pci_dev *dev, int irq) |
385 | { | 411 | { |
386 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | 412 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); |
387 | } | 413 | } |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index d0065103eb7b..9c45d8bbdf57 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
@@ -25,10 +25,13 @@ | |||
25 | #include <linux/hardirq.h> | 25 | #include <linux/hardirq.h> |
26 | #include <linux/syscalls.h> | 26 | #include <linux/syscalls.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/tracehook.h> | ||
29 | #include <linux/signal.h> | ||
28 | #include <asm/system.h> | 30 | #include <asm/system.h> |
29 | #include <asm/stack.h> | 31 | #include <asm/stack.h> |
30 | #include <asm/homecache.h> | 32 | #include <asm/homecache.h> |
31 | #include <asm/syscalls.h> | 33 | #include <asm/syscalls.h> |
34 | #include <asm/traps.h> | ||
32 | #ifdef CONFIG_HARDWALL | 35 | #ifdef CONFIG_HARDWALL |
33 | #include <asm/hardwall.h> | 36 | #include <asm/hardwall.h> |
34 | #endif | 37 | #endif |
@@ -546,6 +549,51 @@ struct task_struct *__sched _switch_to(struct task_struct *prev, | |||
546 | return __switch_to(prev, next, next_current_ksp0(next)); | 549 | return __switch_to(prev, next, next_current_ksp0(next)); |
547 | } | 550 | } |
548 | 551 | ||
552 | /* | ||
553 | * This routine is called on return from interrupt if any of the | ||
554 | * TIF_WORK_MASK flags are set in thread_info->flags. It is | ||
555 | * entered with interrupts disabled so we don't miss an event | ||
556 | * that modified the thread_info flags. If any flag is set, we | ||
557 | * handle it and return, and the calling assembly code will | ||
558 | * re-disable interrupts, reload the thread flags, and call back | ||
559 | * if more flags need to be handled. | ||
560 | * | ||
561 | * We return whether we need to check the thread_info flags again | ||
562 | * or not. Note that we don't clear TIF_SINGLESTEP here, so it's | ||
563 | * important that it be tested last, and then claim that we don't | ||
564 | * need to recheck the flags. | ||
565 | */ | ||
566 | int do_work_pending(struct pt_regs *regs, u32 thread_info_flags) | ||
567 | { | ||
568 | if (thread_info_flags & _TIF_NEED_RESCHED) { | ||
569 | schedule(); | ||
570 | return 1; | ||
571 | } | ||
572 | #if CHIP_HAS_TILE_DMA() || CHIP_HAS_SN_PROC() | ||
573 | if (thread_info_flags & _TIF_ASYNC_TLB) { | ||
574 | do_async_page_fault(regs); | ||
575 | return 1; | ||
576 | } | ||
577 | #endif | ||
578 | if (thread_info_flags & _TIF_SIGPENDING) { | ||
579 | do_signal(regs); | ||
580 | return 1; | ||
581 | } | ||
582 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | ||
583 | clear_thread_flag(TIF_NOTIFY_RESUME); | ||
584 | tracehook_notify_resume(regs); | ||
585 | if (current->replacement_session_keyring) | ||
586 | key_replace_session_keyring(); | ||
587 | return 1; | ||
588 | } | ||
589 | if (thread_info_flags & _TIF_SINGLESTEP) { | ||
590 | if ((regs->ex1 & SPR_EX_CONTEXT_1_1__PL_MASK) == 0) | ||
591 | single_step_once(regs); | ||
592 | return 0; | ||
593 | } | ||
594 | panic("work_pending: bad flags %#x\n", thread_info_flags); | ||
595 | } | ||
596 | |||
549 | /* Note there is an implicit fifth argument if (clone_flags & CLONE_SETTLS). */ | 597 | /* Note there is an implicit fifth argument if (clone_flags & CLONE_SETTLS). */ |
550 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, | 598 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, |
551 | void __user *, parent_tidptr, void __user *, child_tidptr, | 599 | void __user *, parent_tidptr, void __user *, child_tidptr, |
@@ -582,8 +630,8 @@ out: | |||
582 | 630 | ||
583 | #ifdef CONFIG_COMPAT | 631 | #ifdef CONFIG_COMPAT |
584 | long compat_sys_execve(const char __user *path, | 632 | long compat_sys_execve(const char __user *path, |
585 | const compat_uptr_t __user *argv, | 633 | compat_uptr_t __user *argv, |
586 | const compat_uptr_t __user *envp, | 634 | compat_uptr_t __user *envp, |
587 | struct pt_regs *regs) | 635 | struct pt_regs *regs) |
588 | { | 636 | { |
589 | long error; | 637 | long error; |
diff --git a/arch/tile/kernel/regs_64.S b/arch/tile/kernel/regs_64.S new file mode 100644 index 000000000000..f748c1e85285 --- /dev/null +++ b/arch/tile/kernel/regs_64.S | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/linkage.h> | ||
16 | #include <asm/system.h> | ||
17 | #include <asm/ptrace.h> | ||
18 | #include <asm/asm-offsets.h> | ||
19 | #include <arch/spr_def.h> | ||
20 | #include <asm/processor.h> | ||
21 | |||
22 | /* | ||
23 | * See <asm/system.h>; called with prev and next task_struct pointers. | ||
24 | * "prev" is returned in r0 for _switch_to and also for ret_from_fork. | ||
25 | * | ||
26 | * We want to save pc/sp in "prev", and get the new pc/sp from "next". | ||
27 | * We also need to save all the callee-saved registers on the stack. | ||
28 | * | ||
29 | * Intel enables/disables access to the hardware cycle counter in | ||
30 | * seccomp (secure computing) environments if necessary, based on | ||
31 | * has_secure_computing(). We might want to do this at some point, | ||
32 | * though it would require virtualizing the other SPRs under WORLD_ACCESS. | ||
33 | * | ||
34 | * Since we're saving to the stack, we omit sp from this list. | ||
35 | * And for parallels with other architectures, we save lr separately, | ||
36 | * in the thread_struct itself (as the "pc" field). | ||
37 | * | ||
38 | * This code also needs to be aligned with process.c copy_thread() | ||
39 | */ | ||
40 | |||
41 | #if CALLEE_SAVED_REGS_COUNT != 24 | ||
42 | # error Mismatch between <asm/system.h> and kernel/entry.S | ||
43 | #endif | ||
44 | #define FRAME_SIZE ((2 + CALLEE_SAVED_REGS_COUNT) * 8) | ||
45 | |||
46 | #define SAVE_REG(r) { st r12, r; addi r12, r12, 8 } | ||
47 | #define LOAD_REG(r) { ld r, r12; addi r12, r12, 8 } | ||
48 | #define FOR_EACH_CALLEE_SAVED_REG(f) \ | ||
49 | f(r30); f(r31); \ | ||
50 | f(r32); f(r33); f(r34); f(r35); f(r36); f(r37); f(r38); f(r39); \ | ||
51 | f(r40); f(r41); f(r42); f(r43); f(r44); f(r45); f(r46); f(r47); \ | ||
52 | f(r48); f(r49); f(r50); f(r51); f(r52); | ||
53 | |||
54 | STD_ENTRY_SECTION(__switch_to, .sched.text) | ||
55 | { | ||
56 | move r10, sp | ||
57 | st sp, lr | ||
58 | } | ||
59 | { | ||
60 | addli r11, sp, -FRAME_SIZE + 8 | ||
61 | addli sp, sp, -FRAME_SIZE | ||
62 | } | ||
63 | { | ||
64 | st r11, r10 | ||
65 | addli r4, r1, TASK_STRUCT_THREAD_KSP_OFFSET | ||
66 | } | ||
67 | { | ||
68 | ld r13, r4 /* Load new sp to a temp register early. */ | ||
69 | addi r12, sp, 16 | ||
70 | } | ||
71 | FOR_EACH_CALLEE_SAVED_REG(SAVE_REG) | ||
72 | addli r3, r0, TASK_STRUCT_THREAD_KSP_OFFSET | ||
73 | { | ||
74 | st r3, sp | ||
75 | addli r3, r0, TASK_STRUCT_THREAD_PC_OFFSET | ||
76 | } | ||
77 | { | ||
78 | st r3, lr | ||
79 | addli r4, r1, TASK_STRUCT_THREAD_PC_OFFSET | ||
80 | } | ||
81 | { | ||
82 | ld lr, r4 | ||
83 | addi r12, r13, 16 | ||
84 | } | ||
85 | { | ||
86 | /* Update sp and ksp0 simultaneously to avoid backtracer warnings. */ | ||
87 | move sp, r13 | ||
88 | mtspr SPR_SYSTEM_SAVE_K_0, r2 | ||
89 | } | ||
90 | FOR_EACH_CALLEE_SAVED_REG(LOAD_REG) | ||
91 | .L__switch_to_pc: | ||
92 | { | ||
93 | addli sp, sp, FRAME_SIZE | ||
94 | jrp lr /* r0 is still valid here, so return it */ | ||
95 | } | ||
96 | STD_ENDPROC(__switch_to) | ||
97 | |||
98 | /* Return a suitable address for the backtracer for suspended threads */ | ||
99 | STD_ENTRY_SECTION(get_switch_to_pc, .sched.text) | ||
100 | lnk r0 | ||
101 | { | ||
102 | addli r0, r0, .L__switch_to_pc - . | ||
103 | jrp lr | ||
104 | } | ||
105 | STD_ENDPROC(get_switch_to_pc) | ||
106 | |||
107 | STD_ENTRY(get_pt_regs) | ||
108 | .irp reg, r0, r1, r2, r3, r4, r5, r6, r7, \ | ||
109 | r8, r9, r10, r11, r12, r13, r14, r15, \ | ||
110 | r16, r17, r18, r19, r20, r21, r22, r23, \ | ||
111 | r24, r25, r26, r27, r28, r29, r30, r31, \ | ||
112 | r32, r33, r34, r35, r36, r37, r38, r39, \ | ||
113 | r40, r41, r42, r43, r44, r45, r46, r47, \ | ||
114 | r48, r49, r50, r51, r52, tp, sp | ||
115 | { | ||
116 | st r0, \reg | ||
117 | addi r0, r0, 8 | ||
118 | } | ||
119 | .endr | ||
120 | { | ||
121 | st r0, lr | ||
122 | addi r0, r0, PTREGS_OFFSET_PC - PTREGS_OFFSET_LR | ||
123 | } | ||
124 | lnk r1 | ||
125 | { | ||
126 | st r0, r1 | ||
127 | addi r0, r0, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC | ||
128 | } | ||
129 | mfspr r1, INTERRUPT_CRITICAL_SECTION | ||
130 | shli r1, r1, SPR_EX_CONTEXT_1_1__ICS_SHIFT | ||
131 | ori r1, r1, KERNEL_PL | ||
132 | { | ||
133 | st r0, r1 | ||
134 | addi r0, r0, PTREGS_OFFSET_FAULTNUM - PTREGS_OFFSET_EX1 | ||
135 | } | ||
136 | { | ||
137 | st r0, zero /* clear faultnum */ | ||
138 | addi r0, r0, PTREGS_OFFSET_ORIG_R0 - PTREGS_OFFSET_FAULTNUM | ||
139 | } | ||
140 | { | ||
141 | st r0, zero /* clear orig_r0 */ | ||
142 | addli r0, r0, -PTREGS_OFFSET_ORIG_R0 /* restore r0 to base */ | ||
143 | } | ||
144 | jrp lr | ||
145 | STD_ENDPROC(get_pt_regs) | ||
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index 3696b1832566..6cdc9ba55fe0 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -912,6 +912,8 @@ void __cpuinit setup_cpu(int boot) | |||
912 | #endif | 912 | #endif |
913 | } | 913 | } |
914 | 914 | ||
915 | #ifdef CONFIG_BLK_DEV_INITRD | ||
916 | |||
915 | static int __initdata set_initramfs_file; | 917 | static int __initdata set_initramfs_file; |
916 | static char __initdata initramfs_file[128] = "initramfs.cpio.gz"; | 918 | static char __initdata initramfs_file[128] = "initramfs.cpio.gz"; |
917 | 919 | ||
@@ -969,6 +971,10 @@ void __init free_initrd_mem(unsigned long begin, unsigned long end) | |||
969 | free_bootmem(__pa(begin), end - begin); | 971 | free_bootmem(__pa(begin), end - begin); |
970 | } | 972 | } |
971 | 973 | ||
974 | #else | ||
975 | static inline void load_hv_initrd(void) {} | ||
976 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
977 | |||
972 | static void __init validate_hv(void) | 978 | static void __init validate_hv(void) |
973 | { | 979 | { |
974 | /* | 980 | /* |
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c index 1260321155f1..bedaf4e9f3a7 100644 --- a/arch/tile/kernel/signal.c +++ b/arch/tile/kernel/signal.c | |||
@@ -39,7 +39,6 @@ | |||
39 | 39 | ||
40 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 40 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
41 | 41 | ||
42 | |||
43 | SYSCALL_DEFINE3(sigaltstack, const stack_t __user *, uss, | 42 | SYSCALL_DEFINE3(sigaltstack, const stack_t __user *, uss, |
44 | stack_t __user *, uoss, struct pt_regs *, regs) | 43 | stack_t __user *, uoss, struct pt_regs *, regs) |
45 | { | 44 | { |
@@ -78,6 +77,13 @@ int restore_sigcontext(struct pt_regs *regs, | |||
78 | return err; | 77 | return err; |
79 | } | 78 | } |
80 | 79 | ||
80 | void signal_fault(const char *type, struct pt_regs *regs, | ||
81 | void __user *frame, int sig) | ||
82 | { | ||
83 | trace_unhandled_signal(type, regs, (unsigned long)frame, SIGSEGV); | ||
84 | force_sigsegv(sig, current); | ||
85 | } | ||
86 | |||
81 | /* The assembly shim for this function arranges to ignore the return value. */ | 87 | /* The assembly shim for this function arranges to ignore the return value. */ |
82 | SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs) | 88 | SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs) |
83 | { | 89 | { |
@@ -105,7 +111,7 @@ SYSCALL_DEFINE1(rt_sigreturn, struct pt_regs *, regs) | |||
105 | return 0; | 111 | return 0; |
106 | 112 | ||
107 | badframe: | 113 | badframe: |
108 | force_sig(SIGSEGV, current); | 114 | signal_fault("bad sigreturn frame", regs, frame, 0); |
109 | return 0; | 115 | return 0; |
110 | } | 116 | } |
111 | 117 | ||
@@ -231,7 +237,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
231 | return 0; | 237 | return 0; |
232 | 238 | ||
233 | give_sigsegv: | 239 | give_sigsegv: |
234 | force_sigsegv(sig, current); | 240 | signal_fault("bad setup frame", regs, frame, sig); |
235 | return -EFAULT; | 241 | return -EFAULT; |
236 | } | 242 | } |
237 | 243 | ||
@@ -245,7 +251,6 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
245 | { | 251 | { |
246 | int ret; | 252 | int ret; |
247 | 253 | ||
248 | |||
249 | /* Are we from a system call? */ | 254 | /* Are we from a system call? */ |
250 | if (regs->faultnum == INT_SWINT_1) { | 255 | if (regs->faultnum == INT_SWINT_1) { |
251 | /* If so, check system call restarting.. */ | 256 | /* If so, check system call restarting.. */ |
@@ -363,3 +368,118 @@ done: | |||
363 | /* Avoid double syscall restart if there are nested signals. */ | 368 | /* Avoid double syscall restart if there are nested signals. */ |
364 | regs->faultnum = INT_SWINT_1_SIGRETURN; | 369 | regs->faultnum = INT_SWINT_1_SIGRETURN; |
365 | } | 370 | } |
371 | |||
372 | int show_unhandled_signals = 1; | ||
373 | |||
374 | static int __init crashinfo(char *str) | ||
375 | { | ||
376 | unsigned long val; | ||
377 | const char *word; | ||
378 | |||
379 | if (*str == '\0') | ||
380 | val = 2; | ||
381 | else if (*str != '=' || strict_strtoul(++str, 0, &val) != 0) | ||
382 | return 0; | ||
383 | show_unhandled_signals = val; | ||
384 | switch (show_unhandled_signals) { | ||
385 | case 0: | ||
386 | word = "No"; | ||
387 | break; | ||
388 | case 1: | ||
389 | word = "One-line"; | ||
390 | break; | ||
391 | default: | ||
392 | word = "Detailed"; | ||
393 | break; | ||
394 | } | ||
395 | pr_info("%s crash reports will be generated on the console\n", word); | ||
396 | return 1; | ||
397 | } | ||
398 | __setup("crashinfo", crashinfo); | ||
399 | |||
400 | static void dump_mem(void __user *address) | ||
401 | { | ||
402 | void __user *addr; | ||
403 | enum { region_size = 256, bytes_per_line = 16 }; | ||
404 | int i, j, k; | ||
405 | int found_readable_mem = 0; | ||
406 | |||
407 | pr_err("\n"); | ||
408 | if (!access_ok(VERIFY_READ, address, 1)) { | ||
409 | pr_err("Not dumping at address 0x%lx (kernel address)\n", | ||
410 | (unsigned long)address); | ||
411 | return; | ||
412 | } | ||
413 | |||
414 | addr = (void __user *) | ||
415 | (((unsigned long)address & -bytes_per_line) - region_size/2); | ||
416 | if (addr > address) | ||
417 | addr = NULL; | ||
418 | for (i = 0; i < region_size; | ||
419 | addr += bytes_per_line, i += bytes_per_line) { | ||
420 | unsigned char buf[bytes_per_line]; | ||
421 | char line[100]; | ||
422 | if (copy_from_user(buf, addr, bytes_per_line)) | ||
423 | continue; | ||
424 | if (!found_readable_mem) { | ||
425 | pr_err("Dumping memory around address 0x%lx:\n", | ||
426 | (unsigned long)address); | ||
427 | found_readable_mem = 1; | ||
428 | } | ||
429 | j = sprintf(line, REGFMT":", (unsigned long)addr); | ||
430 | for (k = 0; k < bytes_per_line; ++k) | ||
431 | j += sprintf(&line[j], " %02x", buf[k]); | ||
432 | pr_err("%s\n", line); | ||
433 | } | ||
434 | if (!found_readable_mem) | ||
435 | pr_err("No readable memory around address 0x%lx\n", | ||
436 | (unsigned long)address); | ||
437 | } | ||
438 | |||
439 | void trace_unhandled_signal(const char *type, struct pt_regs *regs, | ||
440 | unsigned long address, int sig) | ||
441 | { | ||
442 | struct task_struct *tsk = current; | ||
443 | |||
444 | if (show_unhandled_signals == 0) | ||
445 | return; | ||
446 | |||
447 | /* If the signal is handled, don't show it here. */ | ||
448 | if (!is_global_init(tsk)) { | ||
449 | void __user *handler = | ||
450 | tsk->sighand->action[sig-1].sa.sa_handler; | ||
451 | if (handler != SIG_IGN && handler != SIG_DFL) | ||
452 | return; | ||
453 | } | ||
454 | |||
455 | /* Rate-limit the one-line output, not the detailed output. */ | ||
456 | if (show_unhandled_signals <= 1 && !printk_ratelimit()) | ||
457 | return; | ||
458 | |||
459 | printk("%s%s[%d]: %s at %lx pc "REGFMT" signal %d", | ||
460 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, | ||
461 | tsk->comm, task_pid_nr(tsk), type, address, regs->pc, sig); | ||
462 | |||
463 | print_vma_addr(KERN_CONT " in ", regs->pc); | ||
464 | |||
465 | printk(KERN_CONT "\n"); | ||
466 | |||
467 | if (show_unhandled_signals > 1) { | ||
468 | switch (sig) { | ||
469 | case SIGILL: | ||
470 | case SIGFPE: | ||
471 | case SIGSEGV: | ||
472 | case SIGBUS: | ||
473 | pr_err("User crash: signal %d," | ||
474 | " trap %ld, address 0x%lx\n", | ||
475 | sig, regs->faultnum, address); | ||
476 | show_regs(regs); | ||
477 | dump_mem((void __user *)address); | ||
478 | break; | ||
479 | default: | ||
480 | pr_err("User crash: signal %d, trap %ld\n", | ||
481 | sig, regs->faultnum); | ||
482 | break; | ||
483 | } | ||
484 | } | ||
485 | } | ||
diff --git a/arch/tile/kernel/single_step.c b/arch/tile/kernel/single_step.c index 84a729e06ec4..4032ca8e51b6 100644 --- a/arch/tile/kernel/single_step.c +++ b/arch/tile/kernel/single_step.c | |||
@@ -186,6 +186,8 @@ static tile_bundle_bits rewrite_load_store_unaligned( | |||
186 | .si_code = SEGV_MAPERR, | 186 | .si_code = SEGV_MAPERR, |
187 | .si_addr = addr | 187 | .si_addr = addr |
188 | }; | 188 | }; |
189 | trace_unhandled_signal("segfault", regs, | ||
190 | (unsigned long)addr, SIGSEGV); | ||
189 | force_sig_info(info.si_signo, &info, current); | 191 | force_sig_info(info.si_signo, &info, current); |
190 | return (tile_bundle_bits) 0; | 192 | return (tile_bundle_bits) 0; |
191 | } | 193 | } |
@@ -196,6 +198,8 @@ static tile_bundle_bits rewrite_load_store_unaligned( | |||
196 | .si_code = BUS_ADRALN, | 198 | .si_code = BUS_ADRALN, |
197 | .si_addr = addr | 199 | .si_addr = addr |
198 | }; | 200 | }; |
201 | trace_unhandled_signal("unaligned trap", regs, | ||
202 | (unsigned long)addr, SIGBUS); | ||
199 | force_sig_info(info.si_signo, &info, current); | 203 | force_sig_info(info.si_signo, &info, current); |
200 | return (tile_bundle_bits) 0; | 204 | return (tile_bundle_bits) 0; |
201 | } | 205 | } |
@@ -318,6 +322,14 @@ void single_step_once(struct pt_regs *regs) | |||
318 | " .popsection\n" | 322 | " .popsection\n" |
319 | ); | 323 | ); |
320 | 324 | ||
325 | /* | ||
326 | * Enable interrupts here to allow touching userspace and the like. | ||
327 | * The callers expect this: do_trap() already has interrupts | ||
328 | * enabled, and do_work_pending() handles functions that enable | ||
329 | * interrupts internally. | ||
330 | */ | ||
331 | local_irq_enable(); | ||
332 | |||
321 | if (state == NULL) { | 333 | if (state == NULL) { |
322 | /* allocate a page of writable, executable memory */ | 334 | /* allocate a page of writable, executable memory */ |
323 | state = kmalloc(sizeof(struct single_step_state), GFP_KERNEL); | 335 | state = kmalloc(sizeof(struct single_step_state), GFP_KERNEL); |
diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c index dd81713a90dc..37ee4d037e0b 100644 --- a/arch/tile/kernel/stack.c +++ b/arch/tile/kernel/stack.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #define KBT_LOOP 3 /* Backtrace entered a loop */ | 36 | #define KBT_LOOP 3 /* Backtrace entered a loop */ |
37 | 37 | ||
38 | /* Is address on the specified kernel stack? */ | 38 | /* Is address on the specified kernel stack? */ |
39 | static int in_kernel_stack(struct KBacktraceIterator *kbt, VirtualAddress sp) | 39 | static int in_kernel_stack(struct KBacktraceIterator *kbt, unsigned long sp) |
40 | { | 40 | { |
41 | ulong kstack_base = (ulong) kbt->task->stack; | 41 | ulong kstack_base = (ulong) kbt->task->stack; |
42 | if (kstack_base == 0) /* corrupt task pointer; just follow stack... */ | 42 | if (kstack_base == 0) /* corrupt task pointer; just follow stack... */ |
@@ -45,7 +45,7 @@ static int in_kernel_stack(struct KBacktraceIterator *kbt, VirtualAddress sp) | |||
45 | } | 45 | } |
46 | 46 | ||
47 | /* Is address valid for reading? */ | 47 | /* Is address valid for reading? */ |
48 | static int valid_address(struct KBacktraceIterator *kbt, VirtualAddress address) | 48 | static int valid_address(struct KBacktraceIterator *kbt, unsigned long address) |
49 | { | 49 | { |
50 | HV_PTE *l1_pgtable = kbt->pgtable; | 50 | HV_PTE *l1_pgtable = kbt->pgtable; |
51 | HV_PTE *l2_pgtable; | 51 | HV_PTE *l2_pgtable; |
@@ -97,7 +97,7 @@ static int valid_address(struct KBacktraceIterator *kbt, VirtualAddress address) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | /* Callback for backtracer; basically a glorified memcpy */ | 99 | /* Callback for backtracer; basically a glorified memcpy */ |
100 | static bool read_memory_func(void *result, VirtualAddress address, | 100 | static bool read_memory_func(void *result, unsigned long address, |
101 | unsigned int size, void *vkbt) | 101 | unsigned int size, void *vkbt) |
102 | { | 102 | { |
103 | int retval; | 103 | int retval; |
@@ -124,7 +124,7 @@ static struct pt_regs *valid_fault_handler(struct KBacktraceIterator* kbt) | |||
124 | { | 124 | { |
125 | const char *fault = NULL; /* happy compiler */ | 125 | const char *fault = NULL; /* happy compiler */ |
126 | char fault_buf[64]; | 126 | char fault_buf[64]; |
127 | VirtualAddress sp = kbt->it.sp; | 127 | unsigned long sp = kbt->it.sp; |
128 | struct pt_regs *p; | 128 | struct pt_regs *p; |
129 | 129 | ||
130 | if (!in_kernel_stack(kbt, sp)) | 130 | if (!in_kernel_stack(kbt, sp)) |
@@ -163,7 +163,7 @@ static struct pt_regs *valid_fault_handler(struct KBacktraceIterator* kbt) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | /* Is the pc pointing to a sigreturn trampoline? */ | 165 | /* Is the pc pointing to a sigreturn trampoline? */ |
166 | static int is_sigreturn(VirtualAddress pc) | 166 | static int is_sigreturn(unsigned long pc) |
167 | { | 167 | { |
168 | return (pc == VDSO_BASE); | 168 | return (pc == VDSO_BASE); |
169 | } | 169 | } |
@@ -260,7 +260,7 @@ static void validate_stack(struct pt_regs *regs) | |||
260 | void KBacktraceIterator_init(struct KBacktraceIterator *kbt, | 260 | void KBacktraceIterator_init(struct KBacktraceIterator *kbt, |
261 | struct task_struct *t, struct pt_regs *regs) | 261 | struct task_struct *t, struct pt_regs *regs) |
262 | { | 262 | { |
263 | VirtualAddress pc, lr, sp, r52; | 263 | unsigned long pc, lr, sp, r52; |
264 | int is_current; | 264 | int is_current; |
265 | 265 | ||
266 | /* | 266 | /* |
@@ -331,7 +331,7 @@ EXPORT_SYMBOL(KBacktraceIterator_end); | |||
331 | 331 | ||
332 | void KBacktraceIterator_next(struct KBacktraceIterator *kbt) | 332 | void KBacktraceIterator_next(struct KBacktraceIterator *kbt) |
333 | { | 333 | { |
334 | VirtualAddress old_pc = kbt->it.pc, old_sp = kbt->it.sp; | 334 | unsigned long old_pc = kbt->it.pc, old_sp = kbt->it.sp; |
335 | kbt->new_context = 0; | 335 | kbt->new_context = 0; |
336 | if (!backtrace_next(&kbt->it) && !KBacktraceIterator_restart(kbt)) { | 336 | if (!backtrace_next(&kbt->it) && !KBacktraceIterator_restart(kbt)) { |
337 | kbt->end = KBT_DONE; | 337 | kbt->end = KBT_DONE; |
diff --git a/arch/tile/kernel/sys.c b/arch/tile/kernel/sys.c index e2187d24a9b4..cb44ba7ccd2d 100644 --- a/arch/tile/kernel/sys.c +++ b/arch/tile/kernel/sys.c | |||
@@ -56,13 +56,6 @@ ssize_t sys32_readahead(int fd, u32 offset_lo, u32 offset_hi, u32 count) | |||
56 | return sys_readahead(fd, ((loff_t)offset_hi << 32) | offset_lo, count); | 56 | return sys_readahead(fd, ((loff_t)offset_hi << 32) | offset_lo, count); |
57 | } | 57 | } |
58 | 58 | ||
59 | long sys32_fadvise64(int fd, u32 offset_lo, u32 offset_hi, | ||
60 | u32 len, int advice) | ||
61 | { | ||
62 | return sys_fadvise64_64(fd, ((loff_t)offset_hi << 32) | offset_lo, | ||
63 | len, advice); | ||
64 | } | ||
65 | |||
66 | int sys32_fadvise64_64(int fd, u32 offset_lo, u32 offset_hi, | 59 | int sys32_fadvise64_64(int fd, u32 offset_lo, u32 offset_hi, |
67 | u32 len_lo, u32 len_hi, int advice) | 60 | u32 len_lo, u32 len_hi, int advice) |
68 | { | 61 | { |
@@ -103,10 +96,8 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, | |||
103 | 96 | ||
104 | #ifndef __tilegx__ | 97 | #ifndef __tilegx__ |
105 | /* See comments at the top of the file. */ | 98 | /* See comments at the top of the file. */ |
106 | #define sys_fadvise64 sys32_fadvise64 | ||
107 | #define sys_fadvise64_64 sys32_fadvise64_64 | 99 | #define sys_fadvise64_64 sys32_fadvise64_64 |
108 | #define sys_readahead sys32_readahead | 100 | #define sys_readahead sys32_readahead |
109 | #define sys_sync_file_range sys_sync_file_range2 | ||
110 | #endif | 101 | #endif |
111 | 102 | ||
112 | /* Call the trampolines to manage pt_regs where necessary. */ | 103 | /* Call the trampolines to manage pt_regs where necessary. */ |
diff --git a/arch/tile/kernel/tile-desc_32.c b/arch/tile/kernel/tile-desc_32.c index 69af0e150f78..7e31a1285788 100644 --- a/arch/tile/kernel/tile-desc_32.c +++ b/arch/tile/kernel/tile-desc_32.c | |||
@@ -2413,12 +2413,13 @@ const struct tile_operand tile_operands[43] = | |||
2413 | 2413 | ||
2414 | 2414 | ||
2415 | 2415 | ||
2416 | /* Given a set of bundle bits and the lookup FSM for a specific pipe, | 2416 | /* Given a set of bundle bits and a specific pipe, returns which |
2417 | * returns which instruction the bundle contains in that pipe. | 2417 | * instruction the bundle contains in that pipe. |
2418 | */ | 2418 | */ |
2419 | static const struct tile_opcode * | 2419 | const struct tile_opcode * |
2420 | find_opcode(tile_bundle_bits bits, const unsigned short *table) | 2420 | find_opcode(tile_bundle_bits bits, tile_pipeline pipe) |
2421 | { | 2421 | { |
2422 | const unsigned short *table = tile_bundle_decoder_fsms[pipe]; | ||
2422 | int index = 0; | 2423 | int index = 0; |
2423 | 2424 | ||
2424 | while (1) | 2425 | while (1) |
@@ -2465,7 +2466,7 @@ parse_insn_tile(tile_bundle_bits bits, | |||
2465 | int i; | 2466 | int i; |
2466 | 2467 | ||
2467 | d = &decoded[num_instructions++]; | 2468 | d = &decoded[num_instructions++]; |
2468 | opc = find_opcode (bits, tile_bundle_decoder_fsms[pipe]); | 2469 | opc = find_opcode (bits, (tile_pipeline)pipe); |
2469 | d->opcode = opc; | 2470 | d->opcode = opc; |
2470 | 2471 | ||
2471 | /* Decode each operand, sign extending, etc. as appropriate. */ | 2472 | /* Decode each operand, sign extending, etc. as appropriate. */ |
diff --git a/arch/tile/kernel/tile-desc_64.c b/arch/tile/kernel/tile-desc_64.c new file mode 100644 index 000000000000..d57007bed77f --- /dev/null +++ b/arch/tile/kernel/tile-desc_64.c | |||
@@ -0,0 +1,2200 @@ | |||
1 | /* This define is BFD_RELOC_##x for real bfd, or -1 for everyone else. */ | ||
2 | #define BFD_RELOC(x) -1 | ||
3 | |||
4 | /* Special registers. */ | ||
5 | #define TREG_LR 55 | ||
6 | #define TREG_SN 56 | ||
7 | #define TREG_ZERO 63 | ||
8 | |||
9 | /* FIXME: Rename this. */ | ||
10 | #include <asm/opcode-tile_64.h> | ||
11 | |||
12 | #include <linux/stddef.h> | ||
13 | |||
14 | const struct tilegx_opcode tilegx_opcodes[334] = | ||
15 | { | ||
16 | { "bpt", TILEGX_OPC_BPT, 0x2, 0, TREG_ZERO, 0, | ||
17 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
18 | }, | ||
19 | { "info", TILEGX_OPC_INFO, 0xf, 1, TREG_ZERO, 1, | ||
20 | { { 0 }, { 1 }, { 2 }, { 3 }, { 0, } }, | ||
21 | }, | ||
22 | { "infol", TILEGX_OPC_INFOL, 0x3, 1, TREG_ZERO, 1, | ||
23 | { { 4 }, { 5 }, { 0, }, { 0, }, { 0, } }, | ||
24 | }, | ||
25 | { "move", TILEGX_OPC_MOVE, 0xf, 2, TREG_ZERO, 1, | ||
26 | { { 6, 7 }, { 8, 9 }, { 10, 11 }, { 12, 13 }, { 0, } }, | ||
27 | }, | ||
28 | { "movei", TILEGX_OPC_MOVEI, 0xf, 2, TREG_ZERO, 1, | ||
29 | { { 6, 0 }, { 8, 1 }, { 10, 2 }, { 12, 3 }, { 0, } }, | ||
30 | }, | ||
31 | { "moveli", TILEGX_OPC_MOVELI, 0x3, 2, TREG_ZERO, 1, | ||
32 | { { 6, 4 }, { 8, 5 }, { 0, }, { 0, }, { 0, } }, | ||
33 | }, | ||
34 | { "prefetch", TILEGX_OPC_PREFETCH, 0x12, 1, TREG_ZERO, 1, | ||
35 | { { 0, }, { 9 }, { 0, }, { 0, }, { 14 } }, | ||
36 | }, | ||
37 | { "prefetch_add_l1", TILEGX_OPC_PREFETCH_ADD_L1, 0x2, 2, TREG_ZERO, 1, | ||
38 | { { 0, }, { 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
39 | }, | ||
40 | { "prefetch_add_l1_fault", TILEGX_OPC_PREFETCH_ADD_L1_FAULT, 0x2, 2, TREG_ZERO, 1, | ||
41 | { { 0, }, { 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
42 | }, | ||
43 | { "prefetch_add_l2", TILEGX_OPC_PREFETCH_ADD_L2, 0x2, 2, TREG_ZERO, 1, | ||
44 | { { 0, }, { 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
45 | }, | ||
46 | { "prefetch_add_l2_fault", TILEGX_OPC_PREFETCH_ADD_L2_FAULT, 0x2, 2, TREG_ZERO, 1, | ||
47 | { { 0, }, { 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
48 | }, | ||
49 | { "prefetch_add_l3", TILEGX_OPC_PREFETCH_ADD_L3, 0x2, 2, TREG_ZERO, 1, | ||
50 | { { 0, }, { 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
51 | }, | ||
52 | { "prefetch_add_l3_fault", TILEGX_OPC_PREFETCH_ADD_L3_FAULT, 0x2, 2, TREG_ZERO, 1, | ||
53 | { { 0, }, { 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
54 | }, | ||
55 | { "prefetch_l1", TILEGX_OPC_PREFETCH_L1, 0x12, 1, TREG_ZERO, 1, | ||
56 | { { 0, }, { 9 }, { 0, }, { 0, }, { 14 } }, | ||
57 | }, | ||
58 | { "prefetch_l1_fault", TILEGX_OPC_PREFETCH_L1_FAULT, 0x12, 1, TREG_ZERO, 1, | ||
59 | { { 0, }, { 9 }, { 0, }, { 0, }, { 14 } }, | ||
60 | }, | ||
61 | { "prefetch_l2", TILEGX_OPC_PREFETCH_L2, 0x12, 1, TREG_ZERO, 1, | ||
62 | { { 0, }, { 9 }, { 0, }, { 0, }, { 14 } }, | ||
63 | }, | ||
64 | { "prefetch_l2_fault", TILEGX_OPC_PREFETCH_L2_FAULT, 0x12, 1, TREG_ZERO, 1, | ||
65 | { { 0, }, { 9 }, { 0, }, { 0, }, { 14 } }, | ||
66 | }, | ||
67 | { "prefetch_l3", TILEGX_OPC_PREFETCH_L3, 0x12, 1, TREG_ZERO, 1, | ||
68 | { { 0, }, { 9 }, { 0, }, { 0, }, { 14 } }, | ||
69 | }, | ||
70 | { "prefetch_l3_fault", TILEGX_OPC_PREFETCH_L3_FAULT, 0x12, 1, TREG_ZERO, 1, | ||
71 | { { 0, }, { 9 }, { 0, }, { 0, }, { 14 } }, | ||
72 | }, | ||
73 | { "raise", TILEGX_OPC_RAISE, 0x2, 0, TREG_ZERO, 1, | ||
74 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
75 | }, | ||
76 | { "add", TILEGX_OPC_ADD, 0xf, 3, TREG_ZERO, 1, | ||
77 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
78 | }, | ||
79 | { "addi", TILEGX_OPC_ADDI, 0xf, 3, TREG_ZERO, 1, | ||
80 | { { 6, 7, 0 }, { 8, 9, 1 }, { 10, 11, 2 }, { 12, 13, 3 }, { 0, } }, | ||
81 | }, | ||
82 | { "addli", TILEGX_OPC_ADDLI, 0x3, 3, TREG_ZERO, 1, | ||
83 | { { 6, 7, 4 }, { 8, 9, 5 }, { 0, }, { 0, }, { 0, } }, | ||
84 | }, | ||
85 | { "addx", TILEGX_OPC_ADDX, 0xf, 3, TREG_ZERO, 1, | ||
86 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
87 | }, | ||
88 | { "addxi", TILEGX_OPC_ADDXI, 0xf, 3, TREG_ZERO, 1, | ||
89 | { { 6, 7, 0 }, { 8, 9, 1 }, { 10, 11, 2 }, { 12, 13, 3 }, { 0, } }, | ||
90 | }, | ||
91 | { "addxli", TILEGX_OPC_ADDXLI, 0x3, 3, TREG_ZERO, 1, | ||
92 | { { 6, 7, 4 }, { 8, 9, 5 }, { 0, }, { 0, }, { 0, } }, | ||
93 | }, | ||
94 | { "addxsc", TILEGX_OPC_ADDXSC, 0x3, 3, TREG_ZERO, 1, | ||
95 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
96 | }, | ||
97 | { "and", TILEGX_OPC_AND, 0xf, 3, TREG_ZERO, 1, | ||
98 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
99 | }, | ||
100 | { "andi", TILEGX_OPC_ANDI, 0xf, 3, TREG_ZERO, 1, | ||
101 | { { 6, 7, 0 }, { 8, 9, 1 }, { 10, 11, 2 }, { 12, 13, 3 }, { 0, } }, | ||
102 | }, | ||
103 | { "beqz", TILEGX_OPC_BEQZ, 0x2, 2, TREG_ZERO, 1, | ||
104 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
105 | }, | ||
106 | { "beqzt", TILEGX_OPC_BEQZT, 0x2, 2, TREG_ZERO, 1, | ||
107 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
108 | }, | ||
109 | { "bfexts", TILEGX_OPC_BFEXTS, 0x1, 4, TREG_ZERO, 1, | ||
110 | { { 6, 7, 21, 22 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
111 | }, | ||
112 | { "bfextu", TILEGX_OPC_BFEXTU, 0x1, 4, TREG_ZERO, 1, | ||
113 | { { 6, 7, 21, 22 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
114 | }, | ||
115 | { "bfins", TILEGX_OPC_BFINS, 0x1, 4, TREG_ZERO, 1, | ||
116 | { { 23, 7, 21, 22 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
117 | }, | ||
118 | { "bgez", TILEGX_OPC_BGEZ, 0x2, 2, TREG_ZERO, 1, | ||
119 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
120 | }, | ||
121 | { "bgezt", TILEGX_OPC_BGEZT, 0x2, 2, TREG_ZERO, 1, | ||
122 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
123 | }, | ||
124 | { "bgtz", TILEGX_OPC_BGTZ, 0x2, 2, TREG_ZERO, 1, | ||
125 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
126 | }, | ||
127 | { "bgtzt", TILEGX_OPC_BGTZT, 0x2, 2, TREG_ZERO, 1, | ||
128 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
129 | }, | ||
130 | { "blbc", TILEGX_OPC_BLBC, 0x2, 2, TREG_ZERO, 1, | ||
131 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
132 | }, | ||
133 | { "blbct", TILEGX_OPC_BLBCT, 0x2, 2, TREG_ZERO, 1, | ||
134 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
135 | }, | ||
136 | { "blbs", TILEGX_OPC_BLBS, 0x2, 2, TREG_ZERO, 1, | ||
137 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
138 | }, | ||
139 | { "blbst", TILEGX_OPC_BLBST, 0x2, 2, TREG_ZERO, 1, | ||
140 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
141 | }, | ||
142 | { "blez", TILEGX_OPC_BLEZ, 0x2, 2, TREG_ZERO, 1, | ||
143 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
144 | }, | ||
145 | { "blezt", TILEGX_OPC_BLEZT, 0x2, 2, TREG_ZERO, 1, | ||
146 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
147 | }, | ||
148 | { "bltz", TILEGX_OPC_BLTZ, 0x2, 2, TREG_ZERO, 1, | ||
149 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
150 | }, | ||
151 | { "bltzt", TILEGX_OPC_BLTZT, 0x2, 2, TREG_ZERO, 1, | ||
152 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
153 | }, | ||
154 | { "bnez", TILEGX_OPC_BNEZ, 0x2, 2, TREG_ZERO, 1, | ||
155 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
156 | }, | ||
157 | { "bnezt", TILEGX_OPC_BNEZT, 0x2, 2, TREG_ZERO, 1, | ||
158 | { { 0, }, { 9, 20 }, { 0, }, { 0, }, { 0, } }, | ||
159 | }, | ||
160 | { "clz", TILEGX_OPC_CLZ, 0x5, 2, TREG_ZERO, 1, | ||
161 | { { 6, 7 }, { 0, }, { 10, 11 }, { 0, }, { 0, } }, | ||
162 | }, | ||
163 | { "cmoveqz", TILEGX_OPC_CMOVEQZ, 0x5, 3, TREG_ZERO, 1, | ||
164 | { { 23, 7, 16 }, { 0, }, { 24, 11, 18 }, { 0, }, { 0, } }, | ||
165 | }, | ||
166 | { "cmovnez", TILEGX_OPC_CMOVNEZ, 0x5, 3, TREG_ZERO, 1, | ||
167 | { { 23, 7, 16 }, { 0, }, { 24, 11, 18 }, { 0, }, { 0, } }, | ||
168 | }, | ||
169 | { "cmpeq", TILEGX_OPC_CMPEQ, 0xf, 3, TREG_ZERO, 1, | ||
170 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
171 | }, | ||
172 | { "cmpeqi", TILEGX_OPC_CMPEQI, 0xf, 3, TREG_ZERO, 1, | ||
173 | { { 6, 7, 0 }, { 8, 9, 1 }, { 10, 11, 2 }, { 12, 13, 3 }, { 0, } }, | ||
174 | }, | ||
175 | { "cmpexch", TILEGX_OPC_CMPEXCH, 0x2, 3, TREG_ZERO, 1, | ||
176 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
177 | }, | ||
178 | { "cmpexch4", TILEGX_OPC_CMPEXCH4, 0x2, 3, TREG_ZERO, 1, | ||
179 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
180 | }, | ||
181 | { "cmples", TILEGX_OPC_CMPLES, 0xf, 3, TREG_ZERO, 1, | ||
182 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
183 | }, | ||
184 | { "cmpleu", TILEGX_OPC_CMPLEU, 0xf, 3, TREG_ZERO, 1, | ||
185 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
186 | }, | ||
187 | { "cmplts", TILEGX_OPC_CMPLTS, 0xf, 3, TREG_ZERO, 1, | ||
188 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
189 | }, | ||
190 | { "cmpltsi", TILEGX_OPC_CMPLTSI, 0xf, 3, TREG_ZERO, 1, | ||
191 | { { 6, 7, 0 }, { 8, 9, 1 }, { 10, 11, 2 }, { 12, 13, 3 }, { 0, } }, | ||
192 | }, | ||
193 | { "cmpltu", TILEGX_OPC_CMPLTU, 0xf, 3, TREG_ZERO, 1, | ||
194 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
195 | }, | ||
196 | { "cmpltui", TILEGX_OPC_CMPLTUI, 0x3, 3, TREG_ZERO, 1, | ||
197 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
198 | }, | ||
199 | { "cmpne", TILEGX_OPC_CMPNE, 0xf, 3, TREG_ZERO, 1, | ||
200 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
201 | }, | ||
202 | { "cmul", TILEGX_OPC_CMUL, 0x1, 3, TREG_ZERO, 1, | ||
203 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
204 | }, | ||
205 | { "cmula", TILEGX_OPC_CMULA, 0x1, 3, TREG_ZERO, 1, | ||
206 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
207 | }, | ||
208 | { "cmulaf", TILEGX_OPC_CMULAF, 0x1, 3, TREG_ZERO, 1, | ||
209 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
210 | }, | ||
211 | { "cmulf", TILEGX_OPC_CMULF, 0x1, 3, TREG_ZERO, 1, | ||
212 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
213 | }, | ||
214 | { "cmulfr", TILEGX_OPC_CMULFR, 0x1, 3, TREG_ZERO, 1, | ||
215 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
216 | }, | ||
217 | { "cmulh", TILEGX_OPC_CMULH, 0x1, 3, TREG_ZERO, 1, | ||
218 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
219 | }, | ||
220 | { "cmulhr", TILEGX_OPC_CMULHR, 0x1, 3, TREG_ZERO, 1, | ||
221 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
222 | }, | ||
223 | { "crc32_32", TILEGX_OPC_CRC32_32, 0x1, 3, TREG_ZERO, 1, | ||
224 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
225 | }, | ||
226 | { "crc32_8", TILEGX_OPC_CRC32_8, 0x1, 3, TREG_ZERO, 1, | ||
227 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
228 | }, | ||
229 | { "ctz", TILEGX_OPC_CTZ, 0x5, 2, TREG_ZERO, 1, | ||
230 | { { 6, 7 }, { 0, }, { 10, 11 }, { 0, }, { 0, } }, | ||
231 | }, | ||
232 | { "dblalign", TILEGX_OPC_DBLALIGN, 0x1, 3, TREG_ZERO, 1, | ||
233 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
234 | }, | ||
235 | { "dblalign2", TILEGX_OPC_DBLALIGN2, 0x3, 3, TREG_ZERO, 1, | ||
236 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
237 | }, | ||
238 | { "dblalign4", TILEGX_OPC_DBLALIGN4, 0x3, 3, TREG_ZERO, 1, | ||
239 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
240 | }, | ||
241 | { "dblalign6", TILEGX_OPC_DBLALIGN6, 0x3, 3, TREG_ZERO, 1, | ||
242 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
243 | }, | ||
244 | { "drain", TILEGX_OPC_DRAIN, 0x2, 0, TREG_ZERO, 0, | ||
245 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
246 | }, | ||
247 | { "dtlbpr", TILEGX_OPC_DTLBPR, 0x2, 1, TREG_ZERO, 1, | ||
248 | { { 0, }, { 9 }, { 0, }, { 0, }, { 0, } }, | ||
249 | }, | ||
250 | { "exch", TILEGX_OPC_EXCH, 0x2, 3, TREG_ZERO, 1, | ||
251 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
252 | }, | ||
253 | { "exch4", TILEGX_OPC_EXCH4, 0x2, 3, TREG_ZERO, 1, | ||
254 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
255 | }, | ||
256 | { "fdouble_add_flags", TILEGX_OPC_FDOUBLE_ADD_FLAGS, 0x1, 3, TREG_ZERO, 1, | ||
257 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
258 | }, | ||
259 | { "fdouble_addsub", TILEGX_OPC_FDOUBLE_ADDSUB, 0x1, 3, TREG_ZERO, 1, | ||
260 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
261 | }, | ||
262 | { "fdouble_mul_flags", TILEGX_OPC_FDOUBLE_MUL_FLAGS, 0x1, 3, TREG_ZERO, 1, | ||
263 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
264 | }, | ||
265 | { "fdouble_pack1", TILEGX_OPC_FDOUBLE_PACK1, 0x1, 3, TREG_ZERO, 1, | ||
266 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
267 | }, | ||
268 | { "fdouble_pack2", TILEGX_OPC_FDOUBLE_PACK2, 0x1, 3, TREG_ZERO, 1, | ||
269 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
270 | }, | ||
271 | { "fdouble_sub_flags", TILEGX_OPC_FDOUBLE_SUB_FLAGS, 0x1, 3, TREG_ZERO, 1, | ||
272 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
273 | }, | ||
274 | { "fdouble_unpack_max", TILEGX_OPC_FDOUBLE_UNPACK_MAX, 0x1, 3, TREG_ZERO, 1, | ||
275 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
276 | }, | ||
277 | { "fdouble_unpack_min", TILEGX_OPC_FDOUBLE_UNPACK_MIN, 0x1, 3, TREG_ZERO, 1, | ||
278 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
279 | }, | ||
280 | { "fetchadd", TILEGX_OPC_FETCHADD, 0x2, 3, TREG_ZERO, 1, | ||
281 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
282 | }, | ||
283 | { "fetchadd4", TILEGX_OPC_FETCHADD4, 0x2, 3, TREG_ZERO, 1, | ||
284 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
285 | }, | ||
286 | { "fetchaddgez", TILEGX_OPC_FETCHADDGEZ, 0x2, 3, TREG_ZERO, 1, | ||
287 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
288 | }, | ||
289 | { "fetchaddgez4", TILEGX_OPC_FETCHADDGEZ4, 0x2, 3, TREG_ZERO, 1, | ||
290 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
291 | }, | ||
292 | { "fetchand", TILEGX_OPC_FETCHAND, 0x2, 3, TREG_ZERO, 1, | ||
293 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
294 | }, | ||
295 | { "fetchand4", TILEGX_OPC_FETCHAND4, 0x2, 3, TREG_ZERO, 1, | ||
296 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
297 | }, | ||
298 | { "fetchor", TILEGX_OPC_FETCHOR, 0x2, 3, TREG_ZERO, 1, | ||
299 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
300 | }, | ||
301 | { "fetchor4", TILEGX_OPC_FETCHOR4, 0x2, 3, TREG_ZERO, 1, | ||
302 | { { 0, }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
303 | }, | ||
304 | { "finv", TILEGX_OPC_FINV, 0x2, 1, TREG_ZERO, 1, | ||
305 | { { 0, }, { 9 }, { 0, }, { 0, }, { 0, } }, | ||
306 | }, | ||
307 | { "flush", TILEGX_OPC_FLUSH, 0x2, 1, TREG_ZERO, 1, | ||
308 | { { 0, }, { 9 }, { 0, }, { 0, }, { 0, } }, | ||
309 | }, | ||
310 | { "flushwb", TILEGX_OPC_FLUSHWB, 0x2, 0, TREG_ZERO, 1, | ||
311 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
312 | }, | ||
313 | { "fnop", TILEGX_OPC_FNOP, 0xf, 0, TREG_ZERO, 1, | ||
314 | { { }, { }, { }, { }, { 0, } }, | ||
315 | }, | ||
316 | { "fsingle_add1", TILEGX_OPC_FSINGLE_ADD1, 0x1, 3, TREG_ZERO, 1, | ||
317 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
318 | }, | ||
319 | { "fsingle_addsub2", TILEGX_OPC_FSINGLE_ADDSUB2, 0x1, 3, TREG_ZERO, 1, | ||
320 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
321 | }, | ||
322 | { "fsingle_mul1", TILEGX_OPC_FSINGLE_MUL1, 0x1, 3, TREG_ZERO, 1, | ||
323 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
324 | }, | ||
325 | { "fsingle_mul2", TILEGX_OPC_FSINGLE_MUL2, 0x1, 3, TREG_ZERO, 1, | ||
326 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
327 | }, | ||
328 | { "fsingle_pack1", TILEGX_OPC_FSINGLE_PACK1, 0x5, 2, TREG_ZERO, 1, | ||
329 | { { 6, 7 }, { 0, }, { 10, 11 }, { 0, }, { 0, } }, | ||
330 | }, | ||
331 | { "fsingle_pack2", TILEGX_OPC_FSINGLE_PACK2, 0x1, 3, TREG_ZERO, 1, | ||
332 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
333 | }, | ||
334 | { "fsingle_sub1", TILEGX_OPC_FSINGLE_SUB1, 0x1, 3, TREG_ZERO, 1, | ||
335 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
336 | }, | ||
337 | { "icoh", TILEGX_OPC_ICOH, 0x2, 1, TREG_ZERO, 1, | ||
338 | { { 0, }, { 9 }, { 0, }, { 0, }, { 0, } }, | ||
339 | }, | ||
340 | { "ill", TILEGX_OPC_ILL, 0xa, 0, TREG_ZERO, 1, | ||
341 | { { 0, }, { }, { 0, }, { }, { 0, } }, | ||
342 | }, | ||
343 | { "inv", TILEGX_OPC_INV, 0x2, 1, TREG_ZERO, 1, | ||
344 | { { 0, }, { 9 }, { 0, }, { 0, }, { 0, } }, | ||
345 | }, | ||
346 | { "iret", TILEGX_OPC_IRET, 0x2, 0, TREG_ZERO, 1, | ||
347 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
348 | }, | ||
349 | { "j", TILEGX_OPC_J, 0x2, 1, TREG_ZERO, 1, | ||
350 | { { 0, }, { 25 }, { 0, }, { 0, }, { 0, } }, | ||
351 | }, | ||
352 | { "jal", TILEGX_OPC_JAL, 0x2, 1, TREG_LR, 1, | ||
353 | { { 0, }, { 25 }, { 0, }, { 0, }, { 0, } }, | ||
354 | }, | ||
355 | { "jalr", TILEGX_OPC_JALR, 0xa, 1, TREG_LR, 1, | ||
356 | { { 0, }, { 9 }, { 0, }, { 13 }, { 0, } }, | ||
357 | }, | ||
358 | { "jalrp", TILEGX_OPC_JALRP, 0xa, 1, TREG_LR, 1, | ||
359 | { { 0, }, { 9 }, { 0, }, { 13 }, { 0, } }, | ||
360 | }, | ||
361 | { "jr", TILEGX_OPC_JR, 0xa, 1, TREG_ZERO, 1, | ||
362 | { { 0, }, { 9 }, { 0, }, { 13 }, { 0, } }, | ||
363 | }, | ||
364 | { "jrp", TILEGX_OPC_JRP, 0xa, 1, TREG_ZERO, 1, | ||
365 | { { 0, }, { 9 }, { 0, }, { 13 }, { 0, } }, | ||
366 | }, | ||
367 | { "ld", TILEGX_OPC_LD, 0x12, 2, TREG_ZERO, 1, | ||
368 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 26, 14 } }, | ||
369 | }, | ||
370 | { "ld1s", TILEGX_OPC_LD1S, 0x12, 2, TREG_ZERO, 1, | ||
371 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 26, 14 } }, | ||
372 | }, | ||
373 | { "ld1s_add", TILEGX_OPC_LD1S_ADD, 0x2, 3, TREG_ZERO, 1, | ||
374 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
375 | }, | ||
376 | { "ld1u", TILEGX_OPC_LD1U, 0x12, 2, TREG_ZERO, 1, | ||
377 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 26, 14 } }, | ||
378 | }, | ||
379 | { "ld1u_add", TILEGX_OPC_LD1U_ADD, 0x2, 3, TREG_ZERO, 1, | ||
380 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
381 | }, | ||
382 | { "ld2s", TILEGX_OPC_LD2S, 0x12, 2, TREG_ZERO, 1, | ||
383 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 26, 14 } }, | ||
384 | }, | ||
385 | { "ld2s_add", TILEGX_OPC_LD2S_ADD, 0x2, 3, TREG_ZERO, 1, | ||
386 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
387 | }, | ||
388 | { "ld2u", TILEGX_OPC_LD2U, 0x12, 2, TREG_ZERO, 1, | ||
389 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 26, 14 } }, | ||
390 | }, | ||
391 | { "ld2u_add", TILEGX_OPC_LD2U_ADD, 0x2, 3, TREG_ZERO, 1, | ||
392 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
393 | }, | ||
394 | { "ld4s", TILEGX_OPC_LD4S, 0x12, 2, TREG_ZERO, 1, | ||
395 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 26, 14 } }, | ||
396 | }, | ||
397 | { "ld4s_add", TILEGX_OPC_LD4S_ADD, 0x2, 3, TREG_ZERO, 1, | ||
398 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
399 | }, | ||
400 | { "ld4u", TILEGX_OPC_LD4U, 0x12, 2, TREG_ZERO, 1, | ||
401 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 26, 14 } }, | ||
402 | }, | ||
403 | { "ld4u_add", TILEGX_OPC_LD4U_ADD, 0x2, 3, TREG_ZERO, 1, | ||
404 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
405 | }, | ||
406 | { "ld_add", TILEGX_OPC_LD_ADD, 0x2, 3, TREG_ZERO, 1, | ||
407 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
408 | }, | ||
409 | { "ldna", TILEGX_OPC_LDNA, 0x2, 2, TREG_ZERO, 1, | ||
410 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 0, } }, | ||
411 | }, | ||
412 | { "ldna_add", TILEGX_OPC_LDNA_ADD, 0x2, 3, TREG_ZERO, 1, | ||
413 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
414 | }, | ||
415 | { "ldnt", TILEGX_OPC_LDNT, 0x2, 2, TREG_ZERO, 1, | ||
416 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 0, } }, | ||
417 | }, | ||
418 | { "ldnt1s", TILEGX_OPC_LDNT1S, 0x2, 2, TREG_ZERO, 1, | ||
419 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 0, } }, | ||
420 | }, | ||
421 | { "ldnt1s_add", TILEGX_OPC_LDNT1S_ADD, 0x2, 3, TREG_ZERO, 1, | ||
422 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
423 | }, | ||
424 | { "ldnt1u", TILEGX_OPC_LDNT1U, 0x2, 2, TREG_ZERO, 1, | ||
425 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 0, } }, | ||
426 | }, | ||
427 | { "ldnt1u_add", TILEGX_OPC_LDNT1U_ADD, 0x2, 3, TREG_ZERO, 1, | ||
428 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
429 | }, | ||
430 | { "ldnt2s", TILEGX_OPC_LDNT2S, 0x2, 2, TREG_ZERO, 1, | ||
431 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 0, } }, | ||
432 | }, | ||
433 | { "ldnt2s_add", TILEGX_OPC_LDNT2S_ADD, 0x2, 3, TREG_ZERO, 1, | ||
434 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
435 | }, | ||
436 | { "ldnt2u", TILEGX_OPC_LDNT2U, 0x2, 2, TREG_ZERO, 1, | ||
437 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 0, } }, | ||
438 | }, | ||
439 | { "ldnt2u_add", TILEGX_OPC_LDNT2U_ADD, 0x2, 3, TREG_ZERO, 1, | ||
440 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
441 | }, | ||
442 | { "ldnt4s", TILEGX_OPC_LDNT4S, 0x2, 2, TREG_ZERO, 1, | ||
443 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 0, } }, | ||
444 | }, | ||
445 | { "ldnt4s_add", TILEGX_OPC_LDNT4S_ADD, 0x2, 3, TREG_ZERO, 1, | ||
446 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
447 | }, | ||
448 | { "ldnt4u", TILEGX_OPC_LDNT4U, 0x2, 2, TREG_ZERO, 1, | ||
449 | { { 0, }, { 8, 9 }, { 0, }, { 0, }, { 0, } }, | ||
450 | }, | ||
451 | { "ldnt4u_add", TILEGX_OPC_LDNT4U_ADD, 0x2, 3, TREG_ZERO, 1, | ||
452 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
453 | }, | ||
454 | { "ldnt_add", TILEGX_OPC_LDNT_ADD, 0x2, 3, TREG_ZERO, 1, | ||
455 | { { 0, }, { 8, 15, 1 }, { 0, }, { 0, }, { 0, } }, | ||
456 | }, | ||
457 | { "lnk", TILEGX_OPC_LNK, 0xa, 1, TREG_ZERO, 1, | ||
458 | { { 0, }, { 8 }, { 0, }, { 12 }, { 0, } }, | ||
459 | }, | ||
460 | { "mf", TILEGX_OPC_MF, 0x2, 0, TREG_ZERO, 1, | ||
461 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
462 | }, | ||
463 | { "mfspr", TILEGX_OPC_MFSPR, 0x2, 2, TREG_ZERO, 1, | ||
464 | { { 0, }, { 8, 27 }, { 0, }, { 0, }, { 0, } }, | ||
465 | }, | ||
466 | { "mm", TILEGX_OPC_MM, 0x1, 4, TREG_ZERO, 1, | ||
467 | { { 23, 7, 21, 22 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
468 | }, | ||
469 | { "mnz", TILEGX_OPC_MNZ, 0xf, 3, TREG_ZERO, 1, | ||
470 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
471 | }, | ||
472 | { "mtspr", TILEGX_OPC_MTSPR, 0x2, 2, TREG_ZERO, 1, | ||
473 | { { 0, }, { 28, 9 }, { 0, }, { 0, }, { 0, } }, | ||
474 | }, | ||
475 | { "mul_hs_hs", TILEGX_OPC_MUL_HS_HS, 0x5, 3, TREG_ZERO, 1, | ||
476 | { { 6, 7, 16 }, { 0, }, { 10, 11, 18 }, { 0, }, { 0, } }, | ||
477 | }, | ||
478 | { "mul_hs_hu", TILEGX_OPC_MUL_HS_HU, 0x1, 3, TREG_ZERO, 1, | ||
479 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
480 | }, | ||
481 | { "mul_hs_ls", TILEGX_OPC_MUL_HS_LS, 0x1, 3, TREG_ZERO, 1, | ||
482 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
483 | }, | ||
484 | { "mul_hs_lu", TILEGX_OPC_MUL_HS_LU, 0x1, 3, TREG_ZERO, 1, | ||
485 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
486 | }, | ||
487 | { "mul_hu_hu", TILEGX_OPC_MUL_HU_HU, 0x5, 3, TREG_ZERO, 1, | ||
488 | { { 6, 7, 16 }, { 0, }, { 10, 11, 18 }, { 0, }, { 0, } }, | ||
489 | }, | ||
490 | { "mul_hu_ls", TILEGX_OPC_MUL_HU_LS, 0x1, 3, TREG_ZERO, 1, | ||
491 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
492 | }, | ||
493 | { "mul_hu_lu", TILEGX_OPC_MUL_HU_LU, 0x1, 3, TREG_ZERO, 1, | ||
494 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
495 | }, | ||
496 | { "mul_ls_ls", TILEGX_OPC_MUL_LS_LS, 0x5, 3, TREG_ZERO, 1, | ||
497 | { { 6, 7, 16 }, { 0, }, { 10, 11, 18 }, { 0, }, { 0, } }, | ||
498 | }, | ||
499 | { "mul_ls_lu", TILEGX_OPC_MUL_LS_LU, 0x1, 3, TREG_ZERO, 1, | ||
500 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
501 | }, | ||
502 | { "mul_lu_lu", TILEGX_OPC_MUL_LU_LU, 0x5, 3, TREG_ZERO, 1, | ||
503 | { { 6, 7, 16 }, { 0, }, { 10, 11, 18 }, { 0, }, { 0, } }, | ||
504 | }, | ||
505 | { "mula_hs_hs", TILEGX_OPC_MULA_HS_HS, 0x5, 3, TREG_ZERO, 1, | ||
506 | { { 23, 7, 16 }, { 0, }, { 24, 11, 18 }, { 0, }, { 0, } }, | ||
507 | }, | ||
508 | { "mula_hs_hu", TILEGX_OPC_MULA_HS_HU, 0x1, 3, TREG_ZERO, 1, | ||
509 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
510 | }, | ||
511 | { "mula_hs_ls", TILEGX_OPC_MULA_HS_LS, 0x1, 3, TREG_ZERO, 1, | ||
512 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
513 | }, | ||
514 | { "mula_hs_lu", TILEGX_OPC_MULA_HS_LU, 0x1, 3, TREG_ZERO, 1, | ||
515 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
516 | }, | ||
517 | { "mula_hu_hu", TILEGX_OPC_MULA_HU_HU, 0x5, 3, TREG_ZERO, 1, | ||
518 | { { 23, 7, 16 }, { 0, }, { 24, 11, 18 }, { 0, }, { 0, } }, | ||
519 | }, | ||
520 | { "mula_hu_ls", TILEGX_OPC_MULA_HU_LS, 0x1, 3, TREG_ZERO, 1, | ||
521 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
522 | }, | ||
523 | { "mula_hu_lu", TILEGX_OPC_MULA_HU_LU, 0x1, 3, TREG_ZERO, 1, | ||
524 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
525 | }, | ||
526 | { "mula_ls_ls", TILEGX_OPC_MULA_LS_LS, 0x5, 3, TREG_ZERO, 1, | ||
527 | { { 23, 7, 16 }, { 0, }, { 24, 11, 18 }, { 0, }, { 0, } }, | ||
528 | }, | ||
529 | { "mula_ls_lu", TILEGX_OPC_MULA_LS_LU, 0x1, 3, TREG_ZERO, 1, | ||
530 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
531 | }, | ||
532 | { "mula_lu_lu", TILEGX_OPC_MULA_LU_LU, 0x5, 3, TREG_ZERO, 1, | ||
533 | { { 23, 7, 16 }, { 0, }, { 24, 11, 18 }, { 0, }, { 0, } }, | ||
534 | }, | ||
535 | { "mulax", TILEGX_OPC_MULAX, 0x5, 3, TREG_ZERO, 1, | ||
536 | { { 23, 7, 16 }, { 0, }, { 24, 11, 18 }, { 0, }, { 0, } }, | ||
537 | }, | ||
538 | { "mulx", TILEGX_OPC_MULX, 0x5, 3, TREG_ZERO, 1, | ||
539 | { { 6, 7, 16 }, { 0, }, { 10, 11, 18 }, { 0, }, { 0, } }, | ||
540 | }, | ||
541 | { "mz", TILEGX_OPC_MZ, 0xf, 3, TREG_ZERO, 1, | ||
542 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
543 | }, | ||
544 | { "nap", TILEGX_OPC_NAP, 0x2, 0, TREG_ZERO, 0, | ||
545 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
546 | }, | ||
547 | { "nop", TILEGX_OPC_NOP, 0xf, 0, TREG_ZERO, 1, | ||
548 | { { }, { }, { }, { }, { 0, } }, | ||
549 | }, | ||
550 | { "nor", TILEGX_OPC_NOR, 0xf, 3, TREG_ZERO, 1, | ||
551 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
552 | }, | ||
553 | { "or", TILEGX_OPC_OR, 0xf, 3, TREG_ZERO, 1, | ||
554 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
555 | }, | ||
556 | { "ori", TILEGX_OPC_ORI, 0x3, 3, TREG_ZERO, 1, | ||
557 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
558 | }, | ||
559 | { "pcnt", TILEGX_OPC_PCNT, 0x5, 2, TREG_ZERO, 1, | ||
560 | { { 6, 7 }, { 0, }, { 10, 11 }, { 0, }, { 0, } }, | ||
561 | }, | ||
562 | { "revbits", TILEGX_OPC_REVBITS, 0x5, 2, TREG_ZERO, 1, | ||
563 | { { 6, 7 }, { 0, }, { 10, 11 }, { 0, }, { 0, } }, | ||
564 | }, | ||
565 | { "revbytes", TILEGX_OPC_REVBYTES, 0x5, 2, TREG_ZERO, 1, | ||
566 | { { 6, 7 }, { 0, }, { 10, 11 }, { 0, }, { 0, } }, | ||
567 | }, | ||
568 | { "rotl", TILEGX_OPC_ROTL, 0xf, 3, TREG_ZERO, 1, | ||
569 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
570 | }, | ||
571 | { "rotli", TILEGX_OPC_ROTLI, 0xf, 3, TREG_ZERO, 1, | ||
572 | { { 6, 7, 29 }, { 8, 9, 30 }, { 10, 11, 31 }, { 12, 13, 32 }, { 0, } }, | ||
573 | }, | ||
574 | { "shl", TILEGX_OPC_SHL, 0xf, 3, TREG_ZERO, 1, | ||
575 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
576 | }, | ||
577 | { "shl16insli", TILEGX_OPC_SHL16INSLI, 0x3, 3, TREG_ZERO, 1, | ||
578 | { { 6, 7, 4 }, { 8, 9, 5 }, { 0, }, { 0, }, { 0, } }, | ||
579 | }, | ||
580 | { "shl1add", TILEGX_OPC_SHL1ADD, 0xf, 3, TREG_ZERO, 1, | ||
581 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
582 | }, | ||
583 | { "shl1addx", TILEGX_OPC_SHL1ADDX, 0xf, 3, TREG_ZERO, 1, | ||
584 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
585 | }, | ||
586 | { "shl2add", TILEGX_OPC_SHL2ADD, 0xf, 3, TREG_ZERO, 1, | ||
587 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
588 | }, | ||
589 | { "shl2addx", TILEGX_OPC_SHL2ADDX, 0xf, 3, TREG_ZERO, 1, | ||
590 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
591 | }, | ||
592 | { "shl3add", TILEGX_OPC_SHL3ADD, 0xf, 3, TREG_ZERO, 1, | ||
593 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
594 | }, | ||
595 | { "shl3addx", TILEGX_OPC_SHL3ADDX, 0xf, 3, TREG_ZERO, 1, | ||
596 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
597 | }, | ||
598 | { "shli", TILEGX_OPC_SHLI, 0xf, 3, TREG_ZERO, 1, | ||
599 | { { 6, 7, 29 }, { 8, 9, 30 }, { 10, 11, 31 }, { 12, 13, 32 }, { 0, } }, | ||
600 | }, | ||
601 | { "shlx", TILEGX_OPC_SHLX, 0x3, 3, TREG_ZERO, 1, | ||
602 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
603 | }, | ||
604 | { "shlxi", TILEGX_OPC_SHLXI, 0x3, 3, TREG_ZERO, 1, | ||
605 | { { 6, 7, 29 }, { 8, 9, 30 }, { 0, }, { 0, }, { 0, } }, | ||
606 | }, | ||
607 | { "shrs", TILEGX_OPC_SHRS, 0xf, 3, TREG_ZERO, 1, | ||
608 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
609 | }, | ||
610 | { "shrsi", TILEGX_OPC_SHRSI, 0xf, 3, TREG_ZERO, 1, | ||
611 | { { 6, 7, 29 }, { 8, 9, 30 }, { 10, 11, 31 }, { 12, 13, 32 }, { 0, } }, | ||
612 | }, | ||
613 | { "shru", TILEGX_OPC_SHRU, 0xf, 3, TREG_ZERO, 1, | ||
614 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
615 | }, | ||
616 | { "shrui", TILEGX_OPC_SHRUI, 0xf, 3, TREG_ZERO, 1, | ||
617 | { { 6, 7, 29 }, { 8, 9, 30 }, { 10, 11, 31 }, { 12, 13, 32 }, { 0, } }, | ||
618 | }, | ||
619 | { "shrux", TILEGX_OPC_SHRUX, 0x3, 3, TREG_ZERO, 1, | ||
620 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
621 | }, | ||
622 | { "shruxi", TILEGX_OPC_SHRUXI, 0x3, 3, TREG_ZERO, 1, | ||
623 | { { 6, 7, 29 }, { 8, 9, 30 }, { 0, }, { 0, }, { 0, } }, | ||
624 | }, | ||
625 | { "shufflebytes", TILEGX_OPC_SHUFFLEBYTES, 0x1, 3, TREG_ZERO, 1, | ||
626 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
627 | }, | ||
628 | { "st", TILEGX_OPC_ST, 0x12, 2, TREG_ZERO, 1, | ||
629 | { { 0, }, { 9, 17 }, { 0, }, { 0, }, { 14, 33 } }, | ||
630 | }, | ||
631 | { "st1", TILEGX_OPC_ST1, 0x12, 2, TREG_ZERO, 1, | ||
632 | { { 0, }, { 9, 17 }, { 0, }, { 0, }, { 14, 33 } }, | ||
633 | }, | ||
634 | { "st1_add", TILEGX_OPC_ST1_ADD, 0x2, 3, TREG_ZERO, 1, | ||
635 | { { 0, }, { 15, 17, 34 }, { 0, }, { 0, }, { 0, } }, | ||
636 | }, | ||
637 | { "st2", TILEGX_OPC_ST2, 0x12, 2, TREG_ZERO, 1, | ||
638 | { { 0, }, { 9, 17 }, { 0, }, { 0, }, { 14, 33 } }, | ||
639 | }, | ||
640 | { "st2_add", TILEGX_OPC_ST2_ADD, 0x2, 3, TREG_ZERO, 1, | ||
641 | { { 0, }, { 15, 17, 34 }, { 0, }, { 0, }, { 0, } }, | ||
642 | }, | ||
643 | { "st4", TILEGX_OPC_ST4, 0x12, 2, TREG_ZERO, 1, | ||
644 | { { 0, }, { 9, 17 }, { 0, }, { 0, }, { 14, 33 } }, | ||
645 | }, | ||
646 | { "st4_add", TILEGX_OPC_ST4_ADD, 0x2, 3, TREG_ZERO, 1, | ||
647 | { { 0, }, { 15, 17, 34 }, { 0, }, { 0, }, { 0, } }, | ||
648 | }, | ||
649 | { "st_add", TILEGX_OPC_ST_ADD, 0x2, 3, TREG_ZERO, 1, | ||
650 | { { 0, }, { 15, 17, 34 }, { 0, }, { 0, }, { 0, } }, | ||
651 | }, | ||
652 | { "stnt", TILEGX_OPC_STNT, 0x2, 2, TREG_ZERO, 1, | ||
653 | { { 0, }, { 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
654 | }, | ||
655 | { "stnt1", TILEGX_OPC_STNT1, 0x2, 2, TREG_ZERO, 1, | ||
656 | { { 0, }, { 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
657 | }, | ||
658 | { "stnt1_add", TILEGX_OPC_STNT1_ADD, 0x2, 3, TREG_ZERO, 1, | ||
659 | { { 0, }, { 15, 17, 34 }, { 0, }, { 0, }, { 0, } }, | ||
660 | }, | ||
661 | { "stnt2", TILEGX_OPC_STNT2, 0x2, 2, TREG_ZERO, 1, | ||
662 | { { 0, }, { 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
663 | }, | ||
664 | { "stnt2_add", TILEGX_OPC_STNT2_ADD, 0x2, 3, TREG_ZERO, 1, | ||
665 | { { 0, }, { 15, 17, 34 }, { 0, }, { 0, }, { 0, } }, | ||
666 | }, | ||
667 | { "stnt4", TILEGX_OPC_STNT4, 0x2, 2, TREG_ZERO, 1, | ||
668 | { { 0, }, { 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
669 | }, | ||
670 | { "stnt4_add", TILEGX_OPC_STNT4_ADD, 0x2, 3, TREG_ZERO, 1, | ||
671 | { { 0, }, { 15, 17, 34 }, { 0, }, { 0, }, { 0, } }, | ||
672 | }, | ||
673 | { "stnt_add", TILEGX_OPC_STNT_ADD, 0x2, 3, TREG_ZERO, 1, | ||
674 | { { 0, }, { 15, 17, 34 }, { 0, }, { 0, }, { 0, } }, | ||
675 | }, | ||
676 | { "sub", TILEGX_OPC_SUB, 0xf, 3, TREG_ZERO, 1, | ||
677 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
678 | }, | ||
679 | { "subx", TILEGX_OPC_SUBX, 0xf, 3, TREG_ZERO, 1, | ||
680 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
681 | }, | ||
682 | { "subxsc", TILEGX_OPC_SUBXSC, 0x3, 3, TREG_ZERO, 1, | ||
683 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
684 | }, | ||
685 | { "swint0", TILEGX_OPC_SWINT0, 0x2, 0, TREG_ZERO, 0, | ||
686 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
687 | }, | ||
688 | { "swint1", TILEGX_OPC_SWINT1, 0x2, 0, TREG_ZERO, 0, | ||
689 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
690 | }, | ||
691 | { "swint2", TILEGX_OPC_SWINT2, 0x2, 0, TREG_ZERO, 0, | ||
692 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
693 | }, | ||
694 | { "swint3", TILEGX_OPC_SWINT3, 0x2, 0, TREG_ZERO, 0, | ||
695 | { { 0, }, { }, { 0, }, { 0, }, { 0, } }, | ||
696 | }, | ||
697 | { "tblidxb0", TILEGX_OPC_TBLIDXB0, 0x5, 2, TREG_ZERO, 1, | ||
698 | { { 23, 7 }, { 0, }, { 24, 11 }, { 0, }, { 0, } }, | ||
699 | }, | ||
700 | { "tblidxb1", TILEGX_OPC_TBLIDXB1, 0x5, 2, TREG_ZERO, 1, | ||
701 | { { 23, 7 }, { 0, }, { 24, 11 }, { 0, }, { 0, } }, | ||
702 | }, | ||
703 | { "tblidxb2", TILEGX_OPC_TBLIDXB2, 0x5, 2, TREG_ZERO, 1, | ||
704 | { { 23, 7 }, { 0, }, { 24, 11 }, { 0, }, { 0, } }, | ||
705 | }, | ||
706 | { "tblidxb3", TILEGX_OPC_TBLIDXB3, 0x5, 2, TREG_ZERO, 1, | ||
707 | { { 23, 7 }, { 0, }, { 24, 11 }, { 0, }, { 0, } }, | ||
708 | }, | ||
709 | { "v1add", TILEGX_OPC_V1ADD, 0x3, 3, TREG_ZERO, 1, | ||
710 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
711 | }, | ||
712 | { "v1addi", TILEGX_OPC_V1ADDI, 0x3, 3, TREG_ZERO, 1, | ||
713 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
714 | }, | ||
715 | { "v1adduc", TILEGX_OPC_V1ADDUC, 0x3, 3, TREG_ZERO, 1, | ||
716 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
717 | }, | ||
718 | { "v1adiffu", TILEGX_OPC_V1ADIFFU, 0x1, 3, TREG_ZERO, 1, | ||
719 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
720 | }, | ||
721 | { "v1avgu", TILEGX_OPC_V1AVGU, 0x1, 3, TREG_ZERO, 1, | ||
722 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
723 | }, | ||
724 | { "v1cmpeq", TILEGX_OPC_V1CMPEQ, 0x3, 3, TREG_ZERO, 1, | ||
725 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
726 | }, | ||
727 | { "v1cmpeqi", TILEGX_OPC_V1CMPEQI, 0x3, 3, TREG_ZERO, 1, | ||
728 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
729 | }, | ||
730 | { "v1cmples", TILEGX_OPC_V1CMPLES, 0x3, 3, TREG_ZERO, 1, | ||
731 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
732 | }, | ||
733 | { "v1cmpleu", TILEGX_OPC_V1CMPLEU, 0x3, 3, TREG_ZERO, 1, | ||
734 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
735 | }, | ||
736 | { "v1cmplts", TILEGX_OPC_V1CMPLTS, 0x3, 3, TREG_ZERO, 1, | ||
737 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
738 | }, | ||
739 | { "v1cmpltsi", TILEGX_OPC_V1CMPLTSI, 0x3, 3, TREG_ZERO, 1, | ||
740 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
741 | }, | ||
742 | { "v1cmpltu", TILEGX_OPC_V1CMPLTU, 0x3, 3, TREG_ZERO, 1, | ||
743 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
744 | }, | ||
745 | { "v1cmpltui", TILEGX_OPC_V1CMPLTUI, 0x3, 3, TREG_ZERO, 1, | ||
746 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
747 | }, | ||
748 | { "v1cmpne", TILEGX_OPC_V1CMPNE, 0x3, 3, TREG_ZERO, 1, | ||
749 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
750 | }, | ||
751 | { "v1ddotpu", TILEGX_OPC_V1DDOTPU, 0x1, 3, TREG_ZERO, 1, | ||
752 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
753 | }, | ||
754 | { "v1ddotpua", TILEGX_OPC_V1DDOTPUA, 0x1, 3, TREG_ZERO, 1, | ||
755 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
756 | }, | ||
757 | { "v1ddotpus", TILEGX_OPC_V1DDOTPUS, 0x1, 3, TREG_ZERO, 1, | ||
758 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
759 | }, | ||
760 | { "v1ddotpusa", TILEGX_OPC_V1DDOTPUSA, 0x1, 3, TREG_ZERO, 1, | ||
761 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
762 | }, | ||
763 | { "v1dotp", TILEGX_OPC_V1DOTP, 0x1, 3, TREG_ZERO, 1, | ||
764 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
765 | }, | ||
766 | { "v1dotpa", TILEGX_OPC_V1DOTPA, 0x1, 3, TREG_ZERO, 1, | ||
767 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
768 | }, | ||
769 | { "v1dotpu", TILEGX_OPC_V1DOTPU, 0x1, 3, TREG_ZERO, 1, | ||
770 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
771 | }, | ||
772 | { "v1dotpua", TILEGX_OPC_V1DOTPUA, 0x1, 3, TREG_ZERO, 1, | ||
773 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
774 | }, | ||
775 | { "v1dotpus", TILEGX_OPC_V1DOTPUS, 0x1, 3, TREG_ZERO, 1, | ||
776 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
777 | }, | ||
778 | { "v1dotpusa", TILEGX_OPC_V1DOTPUSA, 0x1, 3, TREG_ZERO, 1, | ||
779 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
780 | }, | ||
781 | { "v1int_h", TILEGX_OPC_V1INT_H, 0x3, 3, TREG_ZERO, 1, | ||
782 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
783 | }, | ||
784 | { "v1int_l", TILEGX_OPC_V1INT_L, 0x3, 3, TREG_ZERO, 1, | ||
785 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
786 | }, | ||
787 | { "v1maxu", TILEGX_OPC_V1MAXU, 0x3, 3, TREG_ZERO, 1, | ||
788 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
789 | }, | ||
790 | { "v1maxui", TILEGX_OPC_V1MAXUI, 0x3, 3, TREG_ZERO, 1, | ||
791 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
792 | }, | ||
793 | { "v1minu", TILEGX_OPC_V1MINU, 0x3, 3, TREG_ZERO, 1, | ||
794 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
795 | }, | ||
796 | { "v1minui", TILEGX_OPC_V1MINUI, 0x3, 3, TREG_ZERO, 1, | ||
797 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
798 | }, | ||
799 | { "v1mnz", TILEGX_OPC_V1MNZ, 0x3, 3, TREG_ZERO, 1, | ||
800 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
801 | }, | ||
802 | { "v1multu", TILEGX_OPC_V1MULTU, 0x1, 3, TREG_ZERO, 1, | ||
803 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
804 | }, | ||
805 | { "v1mulu", TILEGX_OPC_V1MULU, 0x1, 3, TREG_ZERO, 1, | ||
806 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
807 | }, | ||
808 | { "v1mulus", TILEGX_OPC_V1MULUS, 0x1, 3, TREG_ZERO, 1, | ||
809 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
810 | }, | ||
811 | { "v1mz", TILEGX_OPC_V1MZ, 0x3, 3, TREG_ZERO, 1, | ||
812 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
813 | }, | ||
814 | { "v1sadau", TILEGX_OPC_V1SADAU, 0x1, 3, TREG_ZERO, 1, | ||
815 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
816 | }, | ||
817 | { "v1sadu", TILEGX_OPC_V1SADU, 0x1, 3, TREG_ZERO, 1, | ||
818 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
819 | }, | ||
820 | { "v1shl", TILEGX_OPC_V1SHL, 0x3, 3, TREG_ZERO, 1, | ||
821 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
822 | }, | ||
823 | { "v1shli", TILEGX_OPC_V1SHLI, 0x3, 3, TREG_ZERO, 1, | ||
824 | { { 6, 7, 29 }, { 8, 9, 30 }, { 0, }, { 0, }, { 0, } }, | ||
825 | }, | ||
826 | { "v1shrs", TILEGX_OPC_V1SHRS, 0x3, 3, TREG_ZERO, 1, | ||
827 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
828 | }, | ||
829 | { "v1shrsi", TILEGX_OPC_V1SHRSI, 0x3, 3, TREG_ZERO, 1, | ||
830 | { { 6, 7, 29 }, { 8, 9, 30 }, { 0, }, { 0, }, { 0, } }, | ||
831 | }, | ||
832 | { "v1shru", TILEGX_OPC_V1SHRU, 0x3, 3, TREG_ZERO, 1, | ||
833 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
834 | }, | ||
835 | { "v1shrui", TILEGX_OPC_V1SHRUI, 0x3, 3, TREG_ZERO, 1, | ||
836 | { { 6, 7, 29 }, { 8, 9, 30 }, { 0, }, { 0, }, { 0, } }, | ||
837 | }, | ||
838 | { "v1sub", TILEGX_OPC_V1SUB, 0x3, 3, TREG_ZERO, 1, | ||
839 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
840 | }, | ||
841 | { "v1subuc", TILEGX_OPC_V1SUBUC, 0x3, 3, TREG_ZERO, 1, | ||
842 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
843 | }, | ||
844 | { "v2add", TILEGX_OPC_V2ADD, 0x3, 3, TREG_ZERO, 1, | ||
845 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
846 | }, | ||
847 | { "v2addi", TILEGX_OPC_V2ADDI, 0x3, 3, TREG_ZERO, 1, | ||
848 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
849 | }, | ||
850 | { "v2addsc", TILEGX_OPC_V2ADDSC, 0x3, 3, TREG_ZERO, 1, | ||
851 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
852 | }, | ||
853 | { "v2adiffs", TILEGX_OPC_V2ADIFFS, 0x1, 3, TREG_ZERO, 1, | ||
854 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
855 | }, | ||
856 | { "v2avgs", TILEGX_OPC_V2AVGS, 0x1, 3, TREG_ZERO, 1, | ||
857 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
858 | }, | ||
859 | { "v2cmpeq", TILEGX_OPC_V2CMPEQ, 0x3, 3, TREG_ZERO, 1, | ||
860 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
861 | }, | ||
862 | { "v2cmpeqi", TILEGX_OPC_V2CMPEQI, 0x3, 3, TREG_ZERO, 1, | ||
863 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
864 | }, | ||
865 | { "v2cmples", TILEGX_OPC_V2CMPLES, 0x3, 3, TREG_ZERO, 1, | ||
866 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
867 | }, | ||
868 | { "v2cmpleu", TILEGX_OPC_V2CMPLEU, 0x3, 3, TREG_ZERO, 1, | ||
869 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
870 | }, | ||
871 | { "v2cmplts", TILEGX_OPC_V2CMPLTS, 0x3, 3, TREG_ZERO, 1, | ||
872 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
873 | }, | ||
874 | { "v2cmpltsi", TILEGX_OPC_V2CMPLTSI, 0x3, 3, TREG_ZERO, 1, | ||
875 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
876 | }, | ||
877 | { "v2cmpltu", TILEGX_OPC_V2CMPLTU, 0x3, 3, TREG_ZERO, 1, | ||
878 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
879 | }, | ||
880 | { "v2cmpltui", TILEGX_OPC_V2CMPLTUI, 0x3, 3, TREG_ZERO, 1, | ||
881 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
882 | }, | ||
883 | { "v2cmpne", TILEGX_OPC_V2CMPNE, 0x3, 3, TREG_ZERO, 1, | ||
884 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
885 | }, | ||
886 | { "v2dotp", TILEGX_OPC_V2DOTP, 0x1, 3, TREG_ZERO, 1, | ||
887 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
888 | }, | ||
889 | { "v2dotpa", TILEGX_OPC_V2DOTPA, 0x1, 3, TREG_ZERO, 1, | ||
890 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
891 | }, | ||
892 | { "v2int_h", TILEGX_OPC_V2INT_H, 0x3, 3, TREG_ZERO, 1, | ||
893 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
894 | }, | ||
895 | { "v2int_l", TILEGX_OPC_V2INT_L, 0x3, 3, TREG_ZERO, 1, | ||
896 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
897 | }, | ||
898 | { "v2maxs", TILEGX_OPC_V2MAXS, 0x3, 3, TREG_ZERO, 1, | ||
899 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
900 | }, | ||
901 | { "v2maxsi", TILEGX_OPC_V2MAXSI, 0x3, 3, TREG_ZERO, 1, | ||
902 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
903 | }, | ||
904 | { "v2mins", TILEGX_OPC_V2MINS, 0x3, 3, TREG_ZERO, 1, | ||
905 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
906 | }, | ||
907 | { "v2minsi", TILEGX_OPC_V2MINSI, 0x3, 3, TREG_ZERO, 1, | ||
908 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
909 | }, | ||
910 | { "v2mnz", TILEGX_OPC_V2MNZ, 0x3, 3, TREG_ZERO, 1, | ||
911 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
912 | }, | ||
913 | { "v2mulfsc", TILEGX_OPC_V2MULFSC, 0x1, 3, TREG_ZERO, 1, | ||
914 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
915 | }, | ||
916 | { "v2muls", TILEGX_OPC_V2MULS, 0x1, 3, TREG_ZERO, 1, | ||
917 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
918 | }, | ||
919 | { "v2mults", TILEGX_OPC_V2MULTS, 0x1, 3, TREG_ZERO, 1, | ||
920 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
921 | }, | ||
922 | { "v2mz", TILEGX_OPC_V2MZ, 0x3, 3, TREG_ZERO, 1, | ||
923 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
924 | }, | ||
925 | { "v2packh", TILEGX_OPC_V2PACKH, 0x3, 3, TREG_ZERO, 1, | ||
926 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
927 | }, | ||
928 | { "v2packl", TILEGX_OPC_V2PACKL, 0x3, 3, TREG_ZERO, 1, | ||
929 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
930 | }, | ||
931 | { "v2packuc", TILEGX_OPC_V2PACKUC, 0x3, 3, TREG_ZERO, 1, | ||
932 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
933 | }, | ||
934 | { "v2sadas", TILEGX_OPC_V2SADAS, 0x1, 3, TREG_ZERO, 1, | ||
935 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
936 | }, | ||
937 | { "v2sadau", TILEGX_OPC_V2SADAU, 0x1, 3, TREG_ZERO, 1, | ||
938 | { { 23, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
939 | }, | ||
940 | { "v2sads", TILEGX_OPC_V2SADS, 0x1, 3, TREG_ZERO, 1, | ||
941 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
942 | }, | ||
943 | { "v2sadu", TILEGX_OPC_V2SADU, 0x1, 3, TREG_ZERO, 1, | ||
944 | { { 6, 7, 16 }, { 0, }, { 0, }, { 0, }, { 0, } }, | ||
945 | }, | ||
946 | { "v2shl", TILEGX_OPC_V2SHL, 0x3, 3, TREG_ZERO, 1, | ||
947 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
948 | }, | ||
949 | { "v2shli", TILEGX_OPC_V2SHLI, 0x3, 3, TREG_ZERO, 1, | ||
950 | { { 6, 7, 29 }, { 8, 9, 30 }, { 0, }, { 0, }, { 0, } }, | ||
951 | }, | ||
952 | { "v2shlsc", TILEGX_OPC_V2SHLSC, 0x3, 3, TREG_ZERO, 1, | ||
953 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
954 | }, | ||
955 | { "v2shrs", TILEGX_OPC_V2SHRS, 0x3, 3, TREG_ZERO, 1, | ||
956 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
957 | }, | ||
958 | { "v2shrsi", TILEGX_OPC_V2SHRSI, 0x3, 3, TREG_ZERO, 1, | ||
959 | { { 6, 7, 29 }, { 8, 9, 30 }, { 0, }, { 0, }, { 0, } }, | ||
960 | }, | ||
961 | { "v2shru", TILEGX_OPC_V2SHRU, 0x3, 3, TREG_ZERO, 1, | ||
962 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
963 | }, | ||
964 | { "v2shrui", TILEGX_OPC_V2SHRUI, 0x3, 3, TREG_ZERO, 1, | ||
965 | { { 6, 7, 29 }, { 8, 9, 30 }, { 0, }, { 0, }, { 0, } }, | ||
966 | }, | ||
967 | { "v2sub", TILEGX_OPC_V2SUB, 0x3, 3, TREG_ZERO, 1, | ||
968 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
969 | }, | ||
970 | { "v2subsc", TILEGX_OPC_V2SUBSC, 0x3, 3, TREG_ZERO, 1, | ||
971 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
972 | }, | ||
973 | { "v4add", TILEGX_OPC_V4ADD, 0x3, 3, TREG_ZERO, 1, | ||
974 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
975 | }, | ||
976 | { "v4addsc", TILEGX_OPC_V4ADDSC, 0x3, 3, TREG_ZERO, 1, | ||
977 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
978 | }, | ||
979 | { "v4int_h", TILEGX_OPC_V4INT_H, 0x3, 3, TREG_ZERO, 1, | ||
980 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
981 | }, | ||
982 | { "v4int_l", TILEGX_OPC_V4INT_L, 0x3, 3, TREG_ZERO, 1, | ||
983 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
984 | }, | ||
985 | { "v4packsc", TILEGX_OPC_V4PACKSC, 0x3, 3, TREG_ZERO, 1, | ||
986 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
987 | }, | ||
988 | { "v4shl", TILEGX_OPC_V4SHL, 0x3, 3, TREG_ZERO, 1, | ||
989 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
990 | }, | ||
991 | { "v4shlsc", TILEGX_OPC_V4SHLSC, 0x3, 3, TREG_ZERO, 1, | ||
992 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
993 | }, | ||
994 | { "v4shrs", TILEGX_OPC_V4SHRS, 0x3, 3, TREG_ZERO, 1, | ||
995 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
996 | }, | ||
997 | { "v4shru", TILEGX_OPC_V4SHRU, 0x3, 3, TREG_ZERO, 1, | ||
998 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
999 | }, | ||
1000 | { "v4sub", TILEGX_OPC_V4SUB, 0x3, 3, TREG_ZERO, 1, | ||
1001 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
1002 | }, | ||
1003 | { "v4subsc", TILEGX_OPC_V4SUBSC, 0x3, 3, TREG_ZERO, 1, | ||
1004 | { { 6, 7, 16 }, { 8, 9, 17 }, { 0, }, { 0, }, { 0, } }, | ||
1005 | }, | ||
1006 | { "wh64", TILEGX_OPC_WH64, 0x2, 1, TREG_ZERO, 1, | ||
1007 | { { 0, }, { 9 }, { 0, }, { 0, }, { 0, } }, | ||
1008 | }, | ||
1009 | { "xor", TILEGX_OPC_XOR, 0xf, 3, TREG_ZERO, 1, | ||
1010 | { { 6, 7, 16 }, { 8, 9, 17 }, { 10, 11, 18 }, { 12, 13, 19 }, { 0, } }, | ||
1011 | }, | ||
1012 | { "xori", TILEGX_OPC_XORI, 0x3, 3, TREG_ZERO, 1, | ||
1013 | { { 6, 7, 0 }, { 8, 9, 1 }, { 0, }, { 0, }, { 0, } }, | ||
1014 | }, | ||
1015 | { NULL, TILEGX_OPC_NONE, 0, 0, TREG_ZERO, 0, { { 0, } }, | ||
1016 | } | ||
1017 | }; | ||
1018 | #define BITFIELD(start, size) ((start) | (((1 << (size)) - 1) << 6)) | ||
1019 | #define CHILD(array_index) (TILEGX_OPC_NONE + (array_index)) | ||
1020 | |||
1021 | static const unsigned short decode_X0_fsm[936] = | ||
1022 | { | ||
1023 | BITFIELD(22, 9) /* index 0 */, | ||
1024 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1025 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1026 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1027 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1028 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1029 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1030 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1031 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1032 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1033 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1034 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1035 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1036 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1037 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1038 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1039 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1040 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1041 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1042 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1043 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1044 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1045 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1046 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1047 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1048 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1049 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1050 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), TILEGX_OPC_ADDXLI, | ||
1051 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1052 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1053 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1054 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1055 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1056 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1057 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1058 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1059 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1060 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1061 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1062 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1063 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1064 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1065 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1066 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_NONE, | ||
1067 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1068 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1069 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1070 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_BFEXTS, | ||
1071 | TILEGX_OPC_BFEXTS, TILEGX_OPC_BFEXTS, TILEGX_OPC_BFEXTS, TILEGX_OPC_BFEXTU, | ||
1072 | TILEGX_OPC_BFEXTU, TILEGX_OPC_BFEXTU, TILEGX_OPC_BFEXTU, TILEGX_OPC_BFINS, | ||
1073 | TILEGX_OPC_BFINS, TILEGX_OPC_BFINS, TILEGX_OPC_BFINS, TILEGX_OPC_MM, | ||
1074 | TILEGX_OPC_MM, TILEGX_OPC_MM, TILEGX_OPC_MM, TILEGX_OPC_NONE, | ||
1075 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1076 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1077 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1078 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1079 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1080 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1081 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1082 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, CHILD(528), CHILD(578), | ||
1083 | CHILD(583), CHILD(588), CHILD(593), CHILD(598), TILEGX_OPC_NONE, | ||
1084 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1085 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1086 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1087 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1088 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1089 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1090 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1091 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1092 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1093 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1094 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1095 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1096 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1097 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1098 | TILEGX_OPC_NONE, CHILD(603), CHILD(620), CHILD(637), CHILD(654), CHILD(671), | ||
1099 | CHILD(703), CHILD(797), CHILD(814), CHILD(831), CHILD(848), CHILD(865), | ||
1100 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1101 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1102 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1103 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1104 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1105 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1106 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1107 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1108 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1109 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1110 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1111 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1112 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1113 | TILEGX_OPC_NONE, CHILD(889), TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1114 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1115 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1116 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1117 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1118 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1119 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1120 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1121 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1122 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1123 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1124 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1125 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1126 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1127 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1128 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1129 | TILEGX_OPC_NONE, CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1130 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1131 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1132 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1133 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1134 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1135 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1136 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1137 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1138 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1139 | CHILD(906), CHILD(906), CHILD(906), CHILD(906), CHILD(906), | ||
1140 | BITFIELD(6, 2) /* index 513 */, | ||
1141 | TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, CHILD(518), | ||
1142 | BITFIELD(8, 2) /* index 518 */, | ||
1143 | TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, CHILD(523), | ||
1144 | BITFIELD(10, 2) /* index 523 */, | ||
1145 | TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, TILEGX_OPC_MOVELI, | ||
1146 | BITFIELD(20, 2) /* index 528 */, | ||
1147 | TILEGX_OPC_NONE, CHILD(533), TILEGX_OPC_ADDXI, CHILD(548), | ||
1148 | BITFIELD(6, 2) /* index 533 */, | ||
1149 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, CHILD(538), | ||
1150 | BITFIELD(8, 2) /* index 538 */, | ||
1151 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, CHILD(543), | ||
1152 | BITFIELD(10, 2) /* index 543 */, | ||
1153 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_MOVEI, | ||
1154 | BITFIELD(0, 2) /* index 548 */, | ||
1155 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(553), | ||
1156 | BITFIELD(2, 2) /* index 553 */, | ||
1157 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(558), | ||
1158 | BITFIELD(4, 2) /* index 558 */, | ||
1159 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(563), | ||
1160 | BITFIELD(6, 2) /* index 563 */, | ||
1161 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(568), | ||
1162 | BITFIELD(8, 2) /* index 568 */, | ||
1163 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(573), | ||
1164 | BITFIELD(10, 2) /* index 573 */, | ||
1165 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_INFO, | ||
1166 | BITFIELD(20, 2) /* index 578 */, | ||
1167 | TILEGX_OPC_CMPEQI, TILEGX_OPC_CMPLTSI, TILEGX_OPC_CMPLTUI, TILEGX_OPC_ORI, | ||
1168 | BITFIELD(20, 2) /* index 583 */, | ||
1169 | TILEGX_OPC_V1ADDI, TILEGX_OPC_V1CMPEQI, TILEGX_OPC_V1CMPLTSI, | ||
1170 | TILEGX_OPC_V1CMPLTUI, | ||
1171 | BITFIELD(20, 2) /* index 588 */, | ||
1172 | TILEGX_OPC_V1MAXUI, TILEGX_OPC_V1MINUI, TILEGX_OPC_V2ADDI, | ||
1173 | TILEGX_OPC_V2CMPEQI, | ||
1174 | BITFIELD(20, 2) /* index 593 */, | ||
1175 | TILEGX_OPC_V2CMPLTSI, TILEGX_OPC_V2CMPLTUI, TILEGX_OPC_V2MAXSI, | ||
1176 | TILEGX_OPC_V2MINSI, | ||
1177 | BITFIELD(20, 2) /* index 598 */, | ||
1178 | TILEGX_OPC_XORI, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1179 | BITFIELD(18, 4) /* index 603 */, | ||
1180 | TILEGX_OPC_NONE, TILEGX_OPC_ADDXSC, TILEGX_OPC_ADDX, TILEGX_OPC_ADD, | ||
1181 | TILEGX_OPC_AND, TILEGX_OPC_CMOVEQZ, TILEGX_OPC_CMOVNEZ, TILEGX_OPC_CMPEQ, | ||
1182 | TILEGX_OPC_CMPLES, TILEGX_OPC_CMPLEU, TILEGX_OPC_CMPLTS, TILEGX_OPC_CMPLTU, | ||
1183 | TILEGX_OPC_CMPNE, TILEGX_OPC_CMULAF, TILEGX_OPC_CMULA, TILEGX_OPC_CMULFR, | ||
1184 | BITFIELD(18, 4) /* index 620 */, | ||
1185 | TILEGX_OPC_CMULF, TILEGX_OPC_CMULHR, TILEGX_OPC_CMULH, TILEGX_OPC_CMUL, | ||
1186 | TILEGX_OPC_CRC32_32, TILEGX_OPC_CRC32_8, TILEGX_OPC_DBLALIGN2, | ||
1187 | TILEGX_OPC_DBLALIGN4, TILEGX_OPC_DBLALIGN6, TILEGX_OPC_DBLALIGN, | ||
1188 | TILEGX_OPC_FDOUBLE_ADDSUB, TILEGX_OPC_FDOUBLE_ADD_FLAGS, | ||
1189 | TILEGX_OPC_FDOUBLE_MUL_FLAGS, TILEGX_OPC_FDOUBLE_PACK1, | ||
1190 | TILEGX_OPC_FDOUBLE_PACK2, TILEGX_OPC_FDOUBLE_SUB_FLAGS, | ||
1191 | BITFIELD(18, 4) /* index 637 */, | ||
1192 | TILEGX_OPC_FDOUBLE_UNPACK_MAX, TILEGX_OPC_FDOUBLE_UNPACK_MIN, | ||
1193 | TILEGX_OPC_FSINGLE_ADD1, TILEGX_OPC_FSINGLE_ADDSUB2, | ||
1194 | TILEGX_OPC_FSINGLE_MUL1, TILEGX_OPC_FSINGLE_MUL2, TILEGX_OPC_FSINGLE_PACK2, | ||
1195 | TILEGX_OPC_FSINGLE_SUB1, TILEGX_OPC_MNZ, TILEGX_OPC_MULAX, | ||
1196 | TILEGX_OPC_MULA_HS_HS, TILEGX_OPC_MULA_HS_HU, TILEGX_OPC_MULA_HS_LS, | ||
1197 | TILEGX_OPC_MULA_HS_LU, TILEGX_OPC_MULA_HU_HU, TILEGX_OPC_MULA_HU_LS, | ||
1198 | BITFIELD(18, 4) /* index 654 */, | ||
1199 | TILEGX_OPC_MULA_HU_LU, TILEGX_OPC_MULA_LS_LS, TILEGX_OPC_MULA_LS_LU, | ||
1200 | TILEGX_OPC_MULA_LU_LU, TILEGX_OPC_MULX, TILEGX_OPC_MUL_HS_HS, | ||
1201 | TILEGX_OPC_MUL_HS_HU, TILEGX_OPC_MUL_HS_LS, TILEGX_OPC_MUL_HS_LU, | ||
1202 | TILEGX_OPC_MUL_HU_HU, TILEGX_OPC_MUL_HU_LS, TILEGX_OPC_MUL_HU_LU, | ||
1203 | TILEGX_OPC_MUL_LS_LS, TILEGX_OPC_MUL_LS_LU, TILEGX_OPC_MUL_LU_LU, | ||
1204 | TILEGX_OPC_MZ, | ||
1205 | BITFIELD(18, 4) /* index 671 */, | ||
1206 | TILEGX_OPC_NOR, CHILD(688), TILEGX_OPC_ROTL, TILEGX_OPC_SHL1ADDX, | ||
1207 | TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL2ADDX, TILEGX_OPC_SHL2ADD, | ||
1208 | TILEGX_OPC_SHL3ADDX, TILEGX_OPC_SHL3ADD, TILEGX_OPC_SHLX, TILEGX_OPC_SHL, | ||
1209 | TILEGX_OPC_SHRS, TILEGX_OPC_SHRUX, TILEGX_OPC_SHRU, TILEGX_OPC_SHUFFLEBYTES, | ||
1210 | TILEGX_OPC_SUBXSC, | ||
1211 | BITFIELD(12, 2) /* index 688 */, | ||
1212 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, CHILD(693), | ||
1213 | BITFIELD(14, 2) /* index 693 */, | ||
1214 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, CHILD(698), | ||
1215 | BITFIELD(16, 2) /* index 698 */, | ||
1216 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_MOVE, | ||
1217 | BITFIELD(18, 4) /* index 703 */, | ||
1218 | TILEGX_OPC_SUBX, TILEGX_OPC_SUB, CHILD(720), TILEGX_OPC_V1ADDUC, | ||
1219 | TILEGX_OPC_V1ADD, TILEGX_OPC_V1ADIFFU, TILEGX_OPC_V1AVGU, | ||
1220 | TILEGX_OPC_V1CMPEQ, TILEGX_OPC_V1CMPLES, TILEGX_OPC_V1CMPLEU, | ||
1221 | TILEGX_OPC_V1CMPLTS, TILEGX_OPC_V1CMPLTU, TILEGX_OPC_V1CMPNE, | ||
1222 | TILEGX_OPC_V1DDOTPUSA, TILEGX_OPC_V1DDOTPUS, TILEGX_OPC_V1DOTPA, | ||
1223 | BITFIELD(12, 4) /* index 720 */, | ||
1224 | TILEGX_OPC_NONE, CHILD(737), CHILD(742), CHILD(747), CHILD(752), CHILD(757), | ||
1225 | CHILD(762), CHILD(767), CHILD(772), CHILD(777), CHILD(782), CHILD(787), | ||
1226 | CHILD(792), TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1227 | BITFIELD(16, 2) /* index 737 */, | ||
1228 | TILEGX_OPC_CLZ, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1229 | BITFIELD(16, 2) /* index 742 */, | ||
1230 | TILEGX_OPC_CTZ, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1231 | BITFIELD(16, 2) /* index 747 */, | ||
1232 | TILEGX_OPC_FNOP, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1233 | BITFIELD(16, 2) /* index 752 */, | ||
1234 | TILEGX_OPC_FSINGLE_PACK1, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1235 | BITFIELD(16, 2) /* index 757 */, | ||
1236 | TILEGX_OPC_NOP, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1237 | BITFIELD(16, 2) /* index 762 */, | ||
1238 | TILEGX_OPC_PCNT, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1239 | BITFIELD(16, 2) /* index 767 */, | ||
1240 | TILEGX_OPC_REVBITS, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1241 | BITFIELD(16, 2) /* index 772 */, | ||
1242 | TILEGX_OPC_REVBYTES, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1243 | BITFIELD(16, 2) /* index 777 */, | ||
1244 | TILEGX_OPC_TBLIDXB0, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1245 | BITFIELD(16, 2) /* index 782 */, | ||
1246 | TILEGX_OPC_TBLIDXB1, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1247 | BITFIELD(16, 2) /* index 787 */, | ||
1248 | TILEGX_OPC_TBLIDXB2, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1249 | BITFIELD(16, 2) /* index 792 */, | ||
1250 | TILEGX_OPC_TBLIDXB3, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1251 | BITFIELD(18, 4) /* index 797 */, | ||
1252 | TILEGX_OPC_V1DOTPUSA, TILEGX_OPC_V1DOTPUS, TILEGX_OPC_V1DOTP, | ||
1253 | TILEGX_OPC_V1INT_H, TILEGX_OPC_V1INT_L, TILEGX_OPC_V1MAXU, | ||
1254 | TILEGX_OPC_V1MINU, TILEGX_OPC_V1MNZ, TILEGX_OPC_V1MULTU, TILEGX_OPC_V1MULUS, | ||
1255 | TILEGX_OPC_V1MULU, TILEGX_OPC_V1MZ, TILEGX_OPC_V1SADAU, TILEGX_OPC_V1SADU, | ||
1256 | TILEGX_OPC_V1SHL, TILEGX_OPC_V1SHRS, | ||
1257 | BITFIELD(18, 4) /* index 814 */, | ||
1258 | TILEGX_OPC_V1SHRU, TILEGX_OPC_V1SUBUC, TILEGX_OPC_V1SUB, TILEGX_OPC_V2ADDSC, | ||
1259 | TILEGX_OPC_V2ADD, TILEGX_OPC_V2ADIFFS, TILEGX_OPC_V2AVGS, | ||
1260 | TILEGX_OPC_V2CMPEQ, TILEGX_OPC_V2CMPLES, TILEGX_OPC_V2CMPLEU, | ||
1261 | TILEGX_OPC_V2CMPLTS, TILEGX_OPC_V2CMPLTU, TILEGX_OPC_V2CMPNE, | ||
1262 | TILEGX_OPC_V2DOTPA, TILEGX_OPC_V2DOTP, TILEGX_OPC_V2INT_H, | ||
1263 | BITFIELD(18, 4) /* index 831 */, | ||
1264 | TILEGX_OPC_V2INT_L, TILEGX_OPC_V2MAXS, TILEGX_OPC_V2MINS, TILEGX_OPC_V2MNZ, | ||
1265 | TILEGX_OPC_V2MULFSC, TILEGX_OPC_V2MULS, TILEGX_OPC_V2MULTS, TILEGX_OPC_V2MZ, | ||
1266 | TILEGX_OPC_V2PACKH, TILEGX_OPC_V2PACKL, TILEGX_OPC_V2PACKUC, | ||
1267 | TILEGX_OPC_V2SADAS, TILEGX_OPC_V2SADAU, TILEGX_OPC_V2SADS, | ||
1268 | TILEGX_OPC_V2SADU, TILEGX_OPC_V2SHLSC, | ||
1269 | BITFIELD(18, 4) /* index 848 */, | ||
1270 | TILEGX_OPC_V2SHL, TILEGX_OPC_V2SHRS, TILEGX_OPC_V2SHRU, TILEGX_OPC_V2SUBSC, | ||
1271 | TILEGX_OPC_V2SUB, TILEGX_OPC_V4ADDSC, TILEGX_OPC_V4ADD, TILEGX_OPC_V4INT_H, | ||
1272 | TILEGX_OPC_V4INT_L, TILEGX_OPC_V4PACKSC, TILEGX_OPC_V4SHLSC, | ||
1273 | TILEGX_OPC_V4SHL, TILEGX_OPC_V4SHRS, TILEGX_OPC_V4SHRU, TILEGX_OPC_V4SUBSC, | ||
1274 | TILEGX_OPC_V4SUB, | ||
1275 | BITFIELD(18, 3) /* index 865 */, | ||
1276 | CHILD(874), CHILD(877), CHILD(880), CHILD(883), CHILD(886), TILEGX_OPC_NONE, | ||
1277 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1278 | BITFIELD(21, 1) /* index 874 */, | ||
1279 | TILEGX_OPC_XOR, TILEGX_OPC_NONE, | ||
1280 | BITFIELD(21, 1) /* index 877 */, | ||
1281 | TILEGX_OPC_V1DDOTPUA, TILEGX_OPC_NONE, | ||
1282 | BITFIELD(21, 1) /* index 880 */, | ||
1283 | TILEGX_OPC_V1DDOTPU, TILEGX_OPC_NONE, | ||
1284 | BITFIELD(21, 1) /* index 883 */, | ||
1285 | TILEGX_OPC_V1DOTPUA, TILEGX_OPC_NONE, | ||
1286 | BITFIELD(21, 1) /* index 886 */, | ||
1287 | TILEGX_OPC_V1DOTPU, TILEGX_OPC_NONE, | ||
1288 | BITFIELD(18, 4) /* index 889 */, | ||
1289 | TILEGX_OPC_NONE, TILEGX_OPC_ROTLI, TILEGX_OPC_SHLI, TILEGX_OPC_SHLXI, | ||
1290 | TILEGX_OPC_SHRSI, TILEGX_OPC_SHRUI, TILEGX_OPC_SHRUXI, TILEGX_OPC_V1SHLI, | ||
1291 | TILEGX_OPC_V1SHRSI, TILEGX_OPC_V1SHRUI, TILEGX_OPC_V2SHLI, | ||
1292 | TILEGX_OPC_V2SHRSI, TILEGX_OPC_V2SHRUI, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1293 | TILEGX_OPC_NONE, | ||
1294 | BITFIELD(0, 2) /* index 906 */, | ||
1295 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1296 | CHILD(911), | ||
1297 | BITFIELD(2, 2) /* index 911 */, | ||
1298 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1299 | CHILD(916), | ||
1300 | BITFIELD(4, 2) /* index 916 */, | ||
1301 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1302 | CHILD(921), | ||
1303 | BITFIELD(6, 2) /* index 921 */, | ||
1304 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1305 | CHILD(926), | ||
1306 | BITFIELD(8, 2) /* index 926 */, | ||
1307 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1308 | CHILD(931), | ||
1309 | BITFIELD(10, 2) /* index 931 */, | ||
1310 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1311 | TILEGX_OPC_INFOL, | ||
1312 | }; | ||
1313 | |||
1314 | static const unsigned short decode_X1_fsm[1206] = | ||
1315 | { | ||
1316 | BITFIELD(53, 9) /* index 0 */, | ||
1317 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1318 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1319 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1320 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1321 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1322 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1323 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1324 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1325 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1326 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), CHILD(513), | ||
1327 | CHILD(513), CHILD(513), CHILD(513), CHILD(513), TILEGX_OPC_ADDXLI, | ||
1328 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1329 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1330 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1331 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1332 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1333 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1334 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1335 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1336 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1337 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1338 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1339 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1340 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1341 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1342 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, | ||
1343 | TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_ADDXLI, TILEGX_OPC_NONE, | ||
1344 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1345 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1346 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1347 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1348 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1349 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1350 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1351 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_BEQZT, | ||
1352 | TILEGX_OPC_BEQZT, TILEGX_OPC_BEQZ, TILEGX_OPC_BEQZ, TILEGX_OPC_BGEZT, | ||
1353 | TILEGX_OPC_BGEZT, TILEGX_OPC_BGEZ, TILEGX_OPC_BGEZ, TILEGX_OPC_BGTZT, | ||
1354 | TILEGX_OPC_BGTZT, TILEGX_OPC_BGTZ, TILEGX_OPC_BGTZ, TILEGX_OPC_BLBCT, | ||
1355 | TILEGX_OPC_BLBCT, TILEGX_OPC_BLBC, TILEGX_OPC_BLBC, TILEGX_OPC_BLBST, | ||
1356 | TILEGX_OPC_BLBST, TILEGX_OPC_BLBS, TILEGX_OPC_BLBS, TILEGX_OPC_BLEZT, | ||
1357 | TILEGX_OPC_BLEZT, TILEGX_OPC_BLEZ, TILEGX_OPC_BLEZ, TILEGX_OPC_BLTZT, | ||
1358 | TILEGX_OPC_BLTZT, TILEGX_OPC_BLTZ, TILEGX_OPC_BLTZ, TILEGX_OPC_BNEZT, | ||
1359 | TILEGX_OPC_BNEZT, TILEGX_OPC_BNEZ, TILEGX_OPC_BNEZ, CHILD(528), CHILD(578), | ||
1360 | CHILD(598), CHILD(663), CHILD(683), CHILD(688), CHILD(693), CHILD(698), | ||
1361 | CHILD(703), CHILD(708), CHILD(713), CHILD(718), TILEGX_OPC_NONE, | ||
1362 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1363 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1364 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1365 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1366 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1367 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1368 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1369 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1370 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1371 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1372 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1373 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1374 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_JAL, | ||
1375 | TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, | ||
1376 | TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, | ||
1377 | TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, | ||
1378 | TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, | ||
1379 | TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, | ||
1380 | TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, | ||
1381 | TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, | ||
1382 | TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_JAL, TILEGX_OPC_J, TILEGX_OPC_J, | ||
1383 | TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, | ||
1384 | TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, | ||
1385 | TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, | ||
1386 | TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, | ||
1387 | TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, | ||
1388 | TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, TILEGX_OPC_J, | ||
1389 | CHILD(723), CHILD(740), CHILD(772), CHILD(789), CHILD(1108), CHILD(1125), | ||
1390 | CHILD(1142), TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1391 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1392 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1393 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1394 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1395 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1396 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1397 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1398 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1399 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1400 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1401 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1402 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1403 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1404 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, CHILD(1159), TILEGX_OPC_NONE, | ||
1405 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1406 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1407 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1408 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1409 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1410 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1411 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1412 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1413 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1414 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1415 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1416 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1417 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1418 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1419 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1420 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, CHILD(1176), CHILD(1176), CHILD(1176), | ||
1421 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1422 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1423 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1424 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1425 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1426 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1427 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1428 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1429 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1430 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1431 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1432 | CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), CHILD(1176), | ||
1433 | CHILD(1176), | ||
1434 | BITFIELD(37, 2) /* index 513 */, | ||
1435 | TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, CHILD(518), | ||
1436 | BITFIELD(39, 2) /* index 518 */, | ||
1437 | TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, CHILD(523), | ||
1438 | BITFIELD(41, 2) /* index 523 */, | ||
1439 | TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, TILEGX_OPC_ADDLI, TILEGX_OPC_MOVELI, | ||
1440 | BITFIELD(51, 2) /* index 528 */, | ||
1441 | TILEGX_OPC_NONE, CHILD(533), TILEGX_OPC_ADDXI, CHILD(548), | ||
1442 | BITFIELD(37, 2) /* index 533 */, | ||
1443 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, CHILD(538), | ||
1444 | BITFIELD(39, 2) /* index 538 */, | ||
1445 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, CHILD(543), | ||
1446 | BITFIELD(41, 2) /* index 543 */, | ||
1447 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_MOVEI, | ||
1448 | BITFIELD(31, 2) /* index 548 */, | ||
1449 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(553), | ||
1450 | BITFIELD(33, 2) /* index 553 */, | ||
1451 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(558), | ||
1452 | BITFIELD(35, 2) /* index 558 */, | ||
1453 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(563), | ||
1454 | BITFIELD(37, 2) /* index 563 */, | ||
1455 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(568), | ||
1456 | BITFIELD(39, 2) /* index 568 */, | ||
1457 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(573), | ||
1458 | BITFIELD(41, 2) /* index 573 */, | ||
1459 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_INFO, | ||
1460 | BITFIELD(51, 2) /* index 578 */, | ||
1461 | TILEGX_OPC_CMPEQI, TILEGX_OPC_CMPLTSI, TILEGX_OPC_CMPLTUI, CHILD(583), | ||
1462 | BITFIELD(31, 2) /* index 583 */, | ||
1463 | TILEGX_OPC_LD1S_ADD, TILEGX_OPC_LD1S_ADD, TILEGX_OPC_LD1S_ADD, CHILD(588), | ||
1464 | BITFIELD(33, 2) /* index 588 */, | ||
1465 | TILEGX_OPC_LD1S_ADD, TILEGX_OPC_LD1S_ADD, TILEGX_OPC_LD1S_ADD, CHILD(593), | ||
1466 | BITFIELD(35, 2) /* index 593 */, | ||
1467 | TILEGX_OPC_LD1S_ADD, TILEGX_OPC_LD1S_ADD, TILEGX_OPC_LD1S_ADD, | ||
1468 | TILEGX_OPC_PREFETCH_ADD_L1_FAULT, | ||
1469 | BITFIELD(51, 2) /* index 598 */, | ||
1470 | CHILD(603), CHILD(618), CHILD(633), CHILD(648), | ||
1471 | BITFIELD(31, 2) /* index 603 */, | ||
1472 | TILEGX_OPC_LD1U_ADD, TILEGX_OPC_LD1U_ADD, TILEGX_OPC_LD1U_ADD, CHILD(608), | ||
1473 | BITFIELD(33, 2) /* index 608 */, | ||
1474 | TILEGX_OPC_LD1U_ADD, TILEGX_OPC_LD1U_ADD, TILEGX_OPC_LD1U_ADD, CHILD(613), | ||
1475 | BITFIELD(35, 2) /* index 613 */, | ||
1476 | TILEGX_OPC_LD1U_ADD, TILEGX_OPC_LD1U_ADD, TILEGX_OPC_LD1U_ADD, | ||
1477 | TILEGX_OPC_PREFETCH_ADD_L1, | ||
1478 | BITFIELD(31, 2) /* index 618 */, | ||
1479 | TILEGX_OPC_LD2S_ADD, TILEGX_OPC_LD2S_ADD, TILEGX_OPC_LD2S_ADD, CHILD(623), | ||
1480 | BITFIELD(33, 2) /* index 623 */, | ||
1481 | TILEGX_OPC_LD2S_ADD, TILEGX_OPC_LD2S_ADD, TILEGX_OPC_LD2S_ADD, CHILD(628), | ||
1482 | BITFIELD(35, 2) /* index 628 */, | ||
1483 | TILEGX_OPC_LD2S_ADD, TILEGX_OPC_LD2S_ADD, TILEGX_OPC_LD2S_ADD, | ||
1484 | TILEGX_OPC_PREFETCH_ADD_L2_FAULT, | ||
1485 | BITFIELD(31, 2) /* index 633 */, | ||
1486 | TILEGX_OPC_LD2U_ADD, TILEGX_OPC_LD2U_ADD, TILEGX_OPC_LD2U_ADD, CHILD(638), | ||
1487 | BITFIELD(33, 2) /* index 638 */, | ||
1488 | TILEGX_OPC_LD2U_ADD, TILEGX_OPC_LD2U_ADD, TILEGX_OPC_LD2U_ADD, CHILD(643), | ||
1489 | BITFIELD(35, 2) /* index 643 */, | ||
1490 | TILEGX_OPC_LD2U_ADD, TILEGX_OPC_LD2U_ADD, TILEGX_OPC_LD2U_ADD, | ||
1491 | TILEGX_OPC_PREFETCH_ADD_L2, | ||
1492 | BITFIELD(31, 2) /* index 648 */, | ||
1493 | TILEGX_OPC_LD4S_ADD, TILEGX_OPC_LD4S_ADD, TILEGX_OPC_LD4S_ADD, CHILD(653), | ||
1494 | BITFIELD(33, 2) /* index 653 */, | ||
1495 | TILEGX_OPC_LD4S_ADD, TILEGX_OPC_LD4S_ADD, TILEGX_OPC_LD4S_ADD, CHILD(658), | ||
1496 | BITFIELD(35, 2) /* index 658 */, | ||
1497 | TILEGX_OPC_LD4S_ADD, TILEGX_OPC_LD4S_ADD, TILEGX_OPC_LD4S_ADD, | ||
1498 | TILEGX_OPC_PREFETCH_ADD_L3_FAULT, | ||
1499 | BITFIELD(51, 2) /* index 663 */, | ||
1500 | CHILD(668), TILEGX_OPC_LDNT1S_ADD, TILEGX_OPC_LDNT1U_ADD, | ||
1501 | TILEGX_OPC_LDNT2S_ADD, | ||
1502 | BITFIELD(31, 2) /* index 668 */, | ||
1503 | TILEGX_OPC_LD4U_ADD, TILEGX_OPC_LD4U_ADD, TILEGX_OPC_LD4U_ADD, CHILD(673), | ||
1504 | BITFIELD(33, 2) /* index 673 */, | ||
1505 | TILEGX_OPC_LD4U_ADD, TILEGX_OPC_LD4U_ADD, TILEGX_OPC_LD4U_ADD, CHILD(678), | ||
1506 | BITFIELD(35, 2) /* index 678 */, | ||
1507 | TILEGX_OPC_LD4U_ADD, TILEGX_OPC_LD4U_ADD, TILEGX_OPC_LD4U_ADD, | ||
1508 | TILEGX_OPC_PREFETCH_ADD_L3, | ||
1509 | BITFIELD(51, 2) /* index 683 */, | ||
1510 | TILEGX_OPC_LDNT2U_ADD, TILEGX_OPC_LDNT4S_ADD, TILEGX_OPC_LDNT4U_ADD, | ||
1511 | TILEGX_OPC_LDNT_ADD, | ||
1512 | BITFIELD(51, 2) /* index 688 */, | ||
1513 | TILEGX_OPC_LD_ADD, TILEGX_OPC_LDNA_ADD, TILEGX_OPC_MFSPR, TILEGX_OPC_MTSPR, | ||
1514 | BITFIELD(51, 2) /* index 693 */, | ||
1515 | TILEGX_OPC_ORI, TILEGX_OPC_ST1_ADD, TILEGX_OPC_ST2_ADD, TILEGX_OPC_ST4_ADD, | ||
1516 | BITFIELD(51, 2) /* index 698 */, | ||
1517 | TILEGX_OPC_STNT1_ADD, TILEGX_OPC_STNT2_ADD, TILEGX_OPC_STNT4_ADD, | ||
1518 | TILEGX_OPC_STNT_ADD, | ||
1519 | BITFIELD(51, 2) /* index 703 */, | ||
1520 | TILEGX_OPC_ST_ADD, TILEGX_OPC_V1ADDI, TILEGX_OPC_V1CMPEQI, | ||
1521 | TILEGX_OPC_V1CMPLTSI, | ||
1522 | BITFIELD(51, 2) /* index 708 */, | ||
1523 | TILEGX_OPC_V1CMPLTUI, TILEGX_OPC_V1MAXUI, TILEGX_OPC_V1MINUI, | ||
1524 | TILEGX_OPC_V2ADDI, | ||
1525 | BITFIELD(51, 2) /* index 713 */, | ||
1526 | TILEGX_OPC_V2CMPEQI, TILEGX_OPC_V2CMPLTSI, TILEGX_OPC_V2CMPLTUI, | ||
1527 | TILEGX_OPC_V2MAXSI, | ||
1528 | BITFIELD(51, 2) /* index 718 */, | ||
1529 | TILEGX_OPC_V2MINSI, TILEGX_OPC_XORI, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1530 | BITFIELD(49, 4) /* index 723 */, | ||
1531 | TILEGX_OPC_NONE, TILEGX_OPC_ADDXSC, TILEGX_OPC_ADDX, TILEGX_OPC_ADD, | ||
1532 | TILEGX_OPC_AND, TILEGX_OPC_CMPEQ, TILEGX_OPC_CMPEXCH4, TILEGX_OPC_CMPEXCH, | ||
1533 | TILEGX_OPC_CMPLES, TILEGX_OPC_CMPLEU, TILEGX_OPC_CMPLTS, TILEGX_OPC_CMPLTU, | ||
1534 | TILEGX_OPC_CMPNE, TILEGX_OPC_DBLALIGN2, TILEGX_OPC_DBLALIGN4, | ||
1535 | TILEGX_OPC_DBLALIGN6, | ||
1536 | BITFIELD(49, 4) /* index 740 */, | ||
1537 | TILEGX_OPC_EXCH4, TILEGX_OPC_EXCH, TILEGX_OPC_FETCHADD4, | ||
1538 | TILEGX_OPC_FETCHADDGEZ4, TILEGX_OPC_FETCHADDGEZ, TILEGX_OPC_FETCHADD, | ||
1539 | TILEGX_OPC_FETCHAND4, TILEGX_OPC_FETCHAND, TILEGX_OPC_FETCHOR4, | ||
1540 | TILEGX_OPC_FETCHOR, TILEGX_OPC_MNZ, TILEGX_OPC_MZ, TILEGX_OPC_NOR, | ||
1541 | CHILD(757), TILEGX_OPC_ROTL, TILEGX_OPC_SHL1ADDX, | ||
1542 | BITFIELD(43, 2) /* index 757 */, | ||
1543 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, CHILD(762), | ||
1544 | BITFIELD(45, 2) /* index 762 */, | ||
1545 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, CHILD(767), | ||
1546 | BITFIELD(47, 2) /* index 767 */, | ||
1547 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_MOVE, | ||
1548 | BITFIELD(49, 4) /* index 772 */, | ||
1549 | TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL2ADDX, TILEGX_OPC_SHL2ADD, | ||
1550 | TILEGX_OPC_SHL3ADDX, TILEGX_OPC_SHL3ADD, TILEGX_OPC_SHLX, TILEGX_OPC_SHL, | ||
1551 | TILEGX_OPC_SHRS, TILEGX_OPC_SHRUX, TILEGX_OPC_SHRU, TILEGX_OPC_ST1, | ||
1552 | TILEGX_OPC_ST2, TILEGX_OPC_ST4, TILEGX_OPC_STNT1, TILEGX_OPC_STNT2, | ||
1553 | TILEGX_OPC_STNT4, | ||
1554 | BITFIELD(46, 7) /* index 789 */, | ||
1555 | TILEGX_OPC_STNT, TILEGX_OPC_STNT, TILEGX_OPC_STNT, TILEGX_OPC_STNT, | ||
1556 | TILEGX_OPC_STNT, TILEGX_OPC_STNT, TILEGX_OPC_STNT, TILEGX_OPC_STNT, | ||
1557 | TILEGX_OPC_ST, TILEGX_OPC_ST, TILEGX_OPC_ST, TILEGX_OPC_ST, TILEGX_OPC_ST, | ||
1558 | TILEGX_OPC_ST, TILEGX_OPC_ST, TILEGX_OPC_ST, TILEGX_OPC_SUBXSC, | ||
1559 | TILEGX_OPC_SUBXSC, TILEGX_OPC_SUBXSC, TILEGX_OPC_SUBXSC, TILEGX_OPC_SUBXSC, | ||
1560 | TILEGX_OPC_SUBXSC, TILEGX_OPC_SUBXSC, TILEGX_OPC_SUBXSC, TILEGX_OPC_SUBX, | ||
1561 | TILEGX_OPC_SUBX, TILEGX_OPC_SUBX, TILEGX_OPC_SUBX, TILEGX_OPC_SUBX, | ||
1562 | TILEGX_OPC_SUBX, TILEGX_OPC_SUBX, TILEGX_OPC_SUBX, TILEGX_OPC_SUB, | ||
1563 | TILEGX_OPC_SUB, TILEGX_OPC_SUB, TILEGX_OPC_SUB, TILEGX_OPC_SUB, | ||
1564 | TILEGX_OPC_SUB, TILEGX_OPC_SUB, TILEGX_OPC_SUB, CHILD(918), CHILD(927), | ||
1565 | CHILD(1006), CHILD(1090), CHILD(1099), TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1566 | TILEGX_OPC_NONE, TILEGX_OPC_V1ADDUC, TILEGX_OPC_V1ADDUC, TILEGX_OPC_V1ADDUC, | ||
1567 | TILEGX_OPC_V1ADDUC, TILEGX_OPC_V1ADDUC, TILEGX_OPC_V1ADDUC, | ||
1568 | TILEGX_OPC_V1ADDUC, TILEGX_OPC_V1ADDUC, TILEGX_OPC_V1ADD, TILEGX_OPC_V1ADD, | ||
1569 | TILEGX_OPC_V1ADD, TILEGX_OPC_V1ADD, TILEGX_OPC_V1ADD, TILEGX_OPC_V1ADD, | ||
1570 | TILEGX_OPC_V1ADD, TILEGX_OPC_V1ADD, TILEGX_OPC_V1CMPEQ, TILEGX_OPC_V1CMPEQ, | ||
1571 | TILEGX_OPC_V1CMPEQ, TILEGX_OPC_V1CMPEQ, TILEGX_OPC_V1CMPEQ, | ||
1572 | TILEGX_OPC_V1CMPEQ, TILEGX_OPC_V1CMPEQ, TILEGX_OPC_V1CMPEQ, | ||
1573 | TILEGX_OPC_V1CMPLES, TILEGX_OPC_V1CMPLES, TILEGX_OPC_V1CMPLES, | ||
1574 | TILEGX_OPC_V1CMPLES, TILEGX_OPC_V1CMPLES, TILEGX_OPC_V1CMPLES, | ||
1575 | TILEGX_OPC_V1CMPLES, TILEGX_OPC_V1CMPLES, TILEGX_OPC_V1CMPLEU, | ||
1576 | TILEGX_OPC_V1CMPLEU, TILEGX_OPC_V1CMPLEU, TILEGX_OPC_V1CMPLEU, | ||
1577 | TILEGX_OPC_V1CMPLEU, TILEGX_OPC_V1CMPLEU, TILEGX_OPC_V1CMPLEU, | ||
1578 | TILEGX_OPC_V1CMPLEU, TILEGX_OPC_V1CMPLTS, TILEGX_OPC_V1CMPLTS, | ||
1579 | TILEGX_OPC_V1CMPLTS, TILEGX_OPC_V1CMPLTS, TILEGX_OPC_V1CMPLTS, | ||
1580 | TILEGX_OPC_V1CMPLTS, TILEGX_OPC_V1CMPLTS, TILEGX_OPC_V1CMPLTS, | ||
1581 | TILEGX_OPC_V1CMPLTU, TILEGX_OPC_V1CMPLTU, TILEGX_OPC_V1CMPLTU, | ||
1582 | TILEGX_OPC_V1CMPLTU, TILEGX_OPC_V1CMPLTU, TILEGX_OPC_V1CMPLTU, | ||
1583 | TILEGX_OPC_V1CMPLTU, TILEGX_OPC_V1CMPLTU, TILEGX_OPC_V1CMPNE, | ||
1584 | TILEGX_OPC_V1CMPNE, TILEGX_OPC_V1CMPNE, TILEGX_OPC_V1CMPNE, | ||
1585 | TILEGX_OPC_V1CMPNE, TILEGX_OPC_V1CMPNE, TILEGX_OPC_V1CMPNE, | ||
1586 | TILEGX_OPC_V1CMPNE, TILEGX_OPC_V1INT_H, TILEGX_OPC_V1INT_H, | ||
1587 | TILEGX_OPC_V1INT_H, TILEGX_OPC_V1INT_H, TILEGX_OPC_V1INT_H, | ||
1588 | TILEGX_OPC_V1INT_H, TILEGX_OPC_V1INT_H, TILEGX_OPC_V1INT_H, | ||
1589 | TILEGX_OPC_V1INT_L, TILEGX_OPC_V1INT_L, TILEGX_OPC_V1INT_L, | ||
1590 | TILEGX_OPC_V1INT_L, TILEGX_OPC_V1INT_L, TILEGX_OPC_V1INT_L, | ||
1591 | TILEGX_OPC_V1INT_L, TILEGX_OPC_V1INT_L, | ||
1592 | BITFIELD(43, 3) /* index 918 */, | ||
1593 | TILEGX_OPC_NONE, TILEGX_OPC_DRAIN, TILEGX_OPC_DTLBPR, TILEGX_OPC_FINV, | ||
1594 | TILEGX_OPC_FLUSHWB, TILEGX_OPC_FLUSH, TILEGX_OPC_FNOP, TILEGX_OPC_ICOH, | ||
1595 | BITFIELD(43, 3) /* index 927 */, | ||
1596 | CHILD(936), TILEGX_OPC_INV, TILEGX_OPC_IRET, TILEGX_OPC_JALRP, | ||
1597 | TILEGX_OPC_JALR, TILEGX_OPC_JRP, TILEGX_OPC_JR, CHILD(991), | ||
1598 | BITFIELD(31, 2) /* index 936 */, | ||
1599 | CHILD(941), CHILD(966), TILEGX_OPC_ILL, TILEGX_OPC_ILL, | ||
1600 | BITFIELD(33, 2) /* index 941 */, | ||
1601 | TILEGX_OPC_ILL, TILEGX_OPC_ILL, TILEGX_OPC_ILL, CHILD(946), | ||
1602 | BITFIELD(35, 2) /* index 946 */, | ||
1603 | TILEGX_OPC_ILL, CHILD(951), TILEGX_OPC_ILL, TILEGX_OPC_ILL, | ||
1604 | BITFIELD(37, 2) /* index 951 */, | ||
1605 | TILEGX_OPC_ILL, CHILD(956), TILEGX_OPC_ILL, TILEGX_OPC_ILL, | ||
1606 | BITFIELD(39, 2) /* index 956 */, | ||
1607 | TILEGX_OPC_ILL, CHILD(961), TILEGX_OPC_ILL, TILEGX_OPC_ILL, | ||
1608 | BITFIELD(41, 2) /* index 961 */, | ||
1609 | TILEGX_OPC_ILL, TILEGX_OPC_ILL, TILEGX_OPC_BPT, TILEGX_OPC_ILL, | ||
1610 | BITFIELD(33, 2) /* index 966 */, | ||
1611 | TILEGX_OPC_ILL, TILEGX_OPC_ILL, TILEGX_OPC_ILL, CHILD(971), | ||
1612 | BITFIELD(35, 2) /* index 971 */, | ||
1613 | TILEGX_OPC_ILL, CHILD(976), TILEGX_OPC_ILL, TILEGX_OPC_ILL, | ||
1614 | BITFIELD(37, 2) /* index 976 */, | ||
1615 | TILEGX_OPC_ILL, CHILD(981), TILEGX_OPC_ILL, TILEGX_OPC_ILL, | ||
1616 | BITFIELD(39, 2) /* index 981 */, | ||
1617 | TILEGX_OPC_ILL, CHILD(986), TILEGX_OPC_ILL, TILEGX_OPC_ILL, | ||
1618 | BITFIELD(41, 2) /* index 986 */, | ||
1619 | TILEGX_OPC_ILL, TILEGX_OPC_ILL, TILEGX_OPC_RAISE, TILEGX_OPC_ILL, | ||
1620 | BITFIELD(31, 2) /* index 991 */, | ||
1621 | TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, CHILD(996), | ||
1622 | BITFIELD(33, 2) /* index 996 */, | ||
1623 | TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, CHILD(1001), | ||
1624 | BITFIELD(35, 2) /* index 1001 */, | ||
1625 | TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, | ||
1626 | TILEGX_OPC_PREFETCH_L1_FAULT, | ||
1627 | BITFIELD(43, 3) /* index 1006 */, | ||
1628 | CHILD(1015), CHILD(1030), CHILD(1045), CHILD(1060), CHILD(1075), | ||
1629 | TILEGX_OPC_LDNA, TILEGX_OPC_LDNT1S, TILEGX_OPC_LDNT1U, | ||
1630 | BITFIELD(31, 2) /* index 1015 */, | ||
1631 | TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, CHILD(1020), | ||
1632 | BITFIELD(33, 2) /* index 1020 */, | ||
1633 | TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, CHILD(1025), | ||
1634 | BITFIELD(35, 2) /* index 1025 */, | ||
1635 | TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, TILEGX_OPC_PREFETCH, | ||
1636 | BITFIELD(31, 2) /* index 1030 */, | ||
1637 | TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, CHILD(1035), | ||
1638 | BITFIELD(33, 2) /* index 1035 */, | ||
1639 | TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, CHILD(1040), | ||
1640 | BITFIELD(35, 2) /* index 1040 */, | ||
1641 | TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, | ||
1642 | TILEGX_OPC_PREFETCH_L2_FAULT, | ||
1643 | BITFIELD(31, 2) /* index 1045 */, | ||
1644 | TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, CHILD(1050), | ||
1645 | BITFIELD(33, 2) /* index 1050 */, | ||
1646 | TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, CHILD(1055), | ||
1647 | BITFIELD(35, 2) /* index 1055 */, | ||
1648 | TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, TILEGX_OPC_PREFETCH_L2, | ||
1649 | BITFIELD(31, 2) /* index 1060 */, | ||
1650 | TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, CHILD(1065), | ||
1651 | BITFIELD(33, 2) /* index 1065 */, | ||
1652 | TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, CHILD(1070), | ||
1653 | BITFIELD(35, 2) /* index 1070 */, | ||
1654 | TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, | ||
1655 | TILEGX_OPC_PREFETCH_L3_FAULT, | ||
1656 | BITFIELD(31, 2) /* index 1075 */, | ||
1657 | TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, CHILD(1080), | ||
1658 | BITFIELD(33, 2) /* index 1080 */, | ||
1659 | TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, CHILD(1085), | ||
1660 | BITFIELD(35, 2) /* index 1085 */, | ||
1661 | TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, TILEGX_OPC_PREFETCH_L3, | ||
1662 | BITFIELD(43, 3) /* index 1090 */, | ||
1663 | TILEGX_OPC_LDNT2S, TILEGX_OPC_LDNT2U, TILEGX_OPC_LDNT4S, TILEGX_OPC_LDNT4U, | ||
1664 | TILEGX_OPC_LDNT, TILEGX_OPC_LD, TILEGX_OPC_LNK, TILEGX_OPC_MF, | ||
1665 | BITFIELD(43, 3) /* index 1099 */, | ||
1666 | TILEGX_OPC_NAP, TILEGX_OPC_NOP, TILEGX_OPC_SWINT0, TILEGX_OPC_SWINT1, | ||
1667 | TILEGX_OPC_SWINT2, TILEGX_OPC_SWINT3, TILEGX_OPC_WH64, TILEGX_OPC_NONE, | ||
1668 | BITFIELD(49, 4) /* index 1108 */, | ||
1669 | TILEGX_OPC_V1MAXU, TILEGX_OPC_V1MINU, TILEGX_OPC_V1MNZ, TILEGX_OPC_V1MZ, | ||
1670 | TILEGX_OPC_V1SHL, TILEGX_OPC_V1SHRS, TILEGX_OPC_V1SHRU, TILEGX_OPC_V1SUBUC, | ||
1671 | TILEGX_OPC_V1SUB, TILEGX_OPC_V2ADDSC, TILEGX_OPC_V2ADD, TILEGX_OPC_V2CMPEQ, | ||
1672 | TILEGX_OPC_V2CMPLES, TILEGX_OPC_V2CMPLEU, TILEGX_OPC_V2CMPLTS, | ||
1673 | TILEGX_OPC_V2CMPLTU, | ||
1674 | BITFIELD(49, 4) /* index 1125 */, | ||
1675 | TILEGX_OPC_V2CMPNE, TILEGX_OPC_V2INT_H, TILEGX_OPC_V2INT_L, | ||
1676 | TILEGX_OPC_V2MAXS, TILEGX_OPC_V2MINS, TILEGX_OPC_V2MNZ, TILEGX_OPC_V2MZ, | ||
1677 | TILEGX_OPC_V2PACKH, TILEGX_OPC_V2PACKL, TILEGX_OPC_V2PACKUC, | ||
1678 | TILEGX_OPC_V2SHLSC, TILEGX_OPC_V2SHL, TILEGX_OPC_V2SHRS, TILEGX_OPC_V2SHRU, | ||
1679 | TILEGX_OPC_V2SUBSC, TILEGX_OPC_V2SUB, | ||
1680 | BITFIELD(49, 4) /* index 1142 */, | ||
1681 | TILEGX_OPC_V4ADDSC, TILEGX_OPC_V4ADD, TILEGX_OPC_V4INT_H, | ||
1682 | TILEGX_OPC_V4INT_L, TILEGX_OPC_V4PACKSC, TILEGX_OPC_V4SHLSC, | ||
1683 | TILEGX_OPC_V4SHL, TILEGX_OPC_V4SHRS, TILEGX_OPC_V4SHRU, TILEGX_OPC_V4SUBSC, | ||
1684 | TILEGX_OPC_V4SUB, TILEGX_OPC_XOR, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1685 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1686 | BITFIELD(49, 4) /* index 1159 */, | ||
1687 | TILEGX_OPC_NONE, TILEGX_OPC_ROTLI, TILEGX_OPC_SHLI, TILEGX_OPC_SHLXI, | ||
1688 | TILEGX_OPC_SHRSI, TILEGX_OPC_SHRUI, TILEGX_OPC_SHRUXI, TILEGX_OPC_V1SHLI, | ||
1689 | TILEGX_OPC_V1SHRSI, TILEGX_OPC_V1SHRUI, TILEGX_OPC_V2SHLI, | ||
1690 | TILEGX_OPC_V2SHRSI, TILEGX_OPC_V2SHRUI, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1691 | TILEGX_OPC_NONE, | ||
1692 | BITFIELD(31, 2) /* index 1176 */, | ||
1693 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1694 | CHILD(1181), | ||
1695 | BITFIELD(33, 2) /* index 1181 */, | ||
1696 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1697 | CHILD(1186), | ||
1698 | BITFIELD(35, 2) /* index 1186 */, | ||
1699 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1700 | CHILD(1191), | ||
1701 | BITFIELD(37, 2) /* index 1191 */, | ||
1702 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1703 | CHILD(1196), | ||
1704 | BITFIELD(39, 2) /* index 1196 */, | ||
1705 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1706 | CHILD(1201), | ||
1707 | BITFIELD(41, 2) /* index 1201 */, | ||
1708 | TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, TILEGX_OPC_SHL16INSLI, | ||
1709 | TILEGX_OPC_INFOL, | ||
1710 | }; | ||
1711 | |||
1712 | static const unsigned short decode_Y0_fsm[178] = | ||
1713 | { | ||
1714 | BITFIELD(27, 4) /* index 0 */, | ||
1715 | CHILD(17), TILEGX_OPC_ADDXI, CHILD(32), TILEGX_OPC_CMPEQI, | ||
1716 | TILEGX_OPC_CMPLTSI, CHILD(62), CHILD(67), CHILD(118), CHILD(123), | ||
1717 | CHILD(128), CHILD(133), CHILD(153), CHILD(158), CHILD(163), CHILD(168), | ||
1718 | CHILD(173), | ||
1719 | BITFIELD(6, 2) /* index 17 */, | ||
1720 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, CHILD(22), | ||
1721 | BITFIELD(8, 2) /* index 22 */, | ||
1722 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, CHILD(27), | ||
1723 | BITFIELD(10, 2) /* index 27 */, | ||
1724 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_MOVEI, | ||
1725 | BITFIELD(0, 2) /* index 32 */, | ||
1726 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(37), | ||
1727 | BITFIELD(2, 2) /* index 37 */, | ||
1728 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(42), | ||
1729 | BITFIELD(4, 2) /* index 42 */, | ||
1730 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(47), | ||
1731 | BITFIELD(6, 2) /* index 47 */, | ||
1732 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(52), | ||
1733 | BITFIELD(8, 2) /* index 52 */, | ||
1734 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(57), | ||
1735 | BITFIELD(10, 2) /* index 57 */, | ||
1736 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_INFO, | ||
1737 | BITFIELD(18, 2) /* index 62 */, | ||
1738 | TILEGX_OPC_ADDX, TILEGX_OPC_ADD, TILEGX_OPC_SUBX, TILEGX_OPC_SUB, | ||
1739 | BITFIELD(15, 5) /* index 67 */, | ||
1740 | TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL1ADD, | ||
1741 | TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL1ADD, | ||
1742 | TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL2ADD, | ||
1743 | TILEGX_OPC_SHL2ADD, TILEGX_OPC_SHL2ADD, TILEGX_OPC_SHL2ADD, | ||
1744 | TILEGX_OPC_SHL2ADD, TILEGX_OPC_SHL2ADD, TILEGX_OPC_SHL2ADD, | ||
1745 | TILEGX_OPC_SHL2ADD, TILEGX_OPC_SHL3ADD, TILEGX_OPC_SHL3ADD, | ||
1746 | TILEGX_OPC_SHL3ADD, TILEGX_OPC_SHL3ADD, TILEGX_OPC_SHL3ADD, | ||
1747 | TILEGX_OPC_SHL3ADD, TILEGX_OPC_SHL3ADD, TILEGX_OPC_SHL3ADD, CHILD(100), | ||
1748 | CHILD(109), TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1749 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1750 | BITFIELD(12, 3) /* index 100 */, | ||
1751 | TILEGX_OPC_NONE, TILEGX_OPC_CLZ, TILEGX_OPC_CTZ, TILEGX_OPC_FNOP, | ||
1752 | TILEGX_OPC_FSINGLE_PACK1, TILEGX_OPC_NOP, TILEGX_OPC_PCNT, | ||
1753 | TILEGX_OPC_REVBITS, | ||
1754 | BITFIELD(12, 3) /* index 109 */, | ||
1755 | TILEGX_OPC_REVBYTES, TILEGX_OPC_TBLIDXB0, TILEGX_OPC_TBLIDXB1, | ||
1756 | TILEGX_OPC_TBLIDXB2, TILEGX_OPC_TBLIDXB3, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1757 | TILEGX_OPC_NONE, | ||
1758 | BITFIELD(18, 2) /* index 118 */, | ||
1759 | TILEGX_OPC_CMPLES, TILEGX_OPC_CMPLEU, TILEGX_OPC_CMPLTS, TILEGX_OPC_CMPLTU, | ||
1760 | BITFIELD(18, 2) /* index 123 */, | ||
1761 | TILEGX_OPC_CMPEQ, TILEGX_OPC_CMPNE, TILEGX_OPC_MULAX, TILEGX_OPC_MULX, | ||
1762 | BITFIELD(18, 2) /* index 128 */, | ||
1763 | TILEGX_OPC_CMOVEQZ, TILEGX_OPC_CMOVNEZ, TILEGX_OPC_MNZ, TILEGX_OPC_MZ, | ||
1764 | BITFIELD(18, 2) /* index 133 */, | ||
1765 | TILEGX_OPC_AND, TILEGX_OPC_NOR, CHILD(138), TILEGX_OPC_XOR, | ||
1766 | BITFIELD(12, 2) /* index 138 */, | ||
1767 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, CHILD(143), | ||
1768 | BITFIELD(14, 2) /* index 143 */, | ||
1769 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, CHILD(148), | ||
1770 | BITFIELD(16, 2) /* index 148 */, | ||
1771 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_MOVE, | ||
1772 | BITFIELD(18, 2) /* index 153 */, | ||
1773 | TILEGX_OPC_ROTL, TILEGX_OPC_SHL, TILEGX_OPC_SHRS, TILEGX_OPC_SHRU, | ||
1774 | BITFIELD(18, 2) /* index 158 */, | ||
1775 | TILEGX_OPC_NONE, TILEGX_OPC_SHL1ADDX, TILEGX_OPC_SHL2ADDX, | ||
1776 | TILEGX_OPC_SHL3ADDX, | ||
1777 | BITFIELD(18, 2) /* index 163 */, | ||
1778 | TILEGX_OPC_MUL_HS_HS, TILEGX_OPC_MUL_HU_HU, TILEGX_OPC_MUL_LS_LS, | ||
1779 | TILEGX_OPC_MUL_LU_LU, | ||
1780 | BITFIELD(18, 2) /* index 168 */, | ||
1781 | TILEGX_OPC_MULA_HS_HS, TILEGX_OPC_MULA_HU_HU, TILEGX_OPC_MULA_LS_LS, | ||
1782 | TILEGX_OPC_MULA_LU_LU, | ||
1783 | BITFIELD(18, 2) /* index 173 */, | ||
1784 | TILEGX_OPC_ROTLI, TILEGX_OPC_SHLI, TILEGX_OPC_SHRSI, TILEGX_OPC_SHRUI, | ||
1785 | }; | ||
1786 | |||
1787 | static const unsigned short decode_Y1_fsm[167] = | ||
1788 | { | ||
1789 | BITFIELD(58, 4) /* index 0 */, | ||
1790 | TILEGX_OPC_NONE, CHILD(17), TILEGX_OPC_ADDXI, CHILD(32), TILEGX_OPC_CMPEQI, | ||
1791 | TILEGX_OPC_CMPLTSI, CHILD(62), CHILD(67), CHILD(117), CHILD(122), | ||
1792 | CHILD(127), CHILD(132), CHILD(152), CHILD(157), CHILD(162), TILEGX_OPC_NONE, | ||
1793 | BITFIELD(37, 2) /* index 17 */, | ||
1794 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, CHILD(22), | ||
1795 | BITFIELD(39, 2) /* index 22 */, | ||
1796 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, CHILD(27), | ||
1797 | BITFIELD(41, 2) /* index 27 */, | ||
1798 | TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_ADDI, TILEGX_OPC_MOVEI, | ||
1799 | BITFIELD(31, 2) /* index 32 */, | ||
1800 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(37), | ||
1801 | BITFIELD(33, 2) /* index 37 */, | ||
1802 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(42), | ||
1803 | BITFIELD(35, 2) /* index 42 */, | ||
1804 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(47), | ||
1805 | BITFIELD(37, 2) /* index 47 */, | ||
1806 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(52), | ||
1807 | BITFIELD(39, 2) /* index 52 */, | ||
1808 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, CHILD(57), | ||
1809 | BITFIELD(41, 2) /* index 57 */, | ||
1810 | TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_ANDI, TILEGX_OPC_INFO, | ||
1811 | BITFIELD(49, 2) /* index 62 */, | ||
1812 | TILEGX_OPC_ADDX, TILEGX_OPC_ADD, TILEGX_OPC_SUBX, TILEGX_OPC_SUB, | ||
1813 | BITFIELD(47, 4) /* index 67 */, | ||
1814 | TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL1ADD, | ||
1815 | TILEGX_OPC_SHL1ADD, TILEGX_OPC_SHL2ADD, TILEGX_OPC_SHL2ADD, | ||
1816 | TILEGX_OPC_SHL2ADD, TILEGX_OPC_SHL2ADD, TILEGX_OPC_SHL3ADD, | ||
1817 | TILEGX_OPC_SHL3ADD, TILEGX_OPC_SHL3ADD, TILEGX_OPC_SHL3ADD, CHILD(84), | ||
1818 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_NONE, | ||
1819 | BITFIELD(43, 3) /* index 84 */, | ||
1820 | CHILD(93), CHILD(96), CHILD(99), CHILD(102), CHILD(105), CHILD(108), | ||
1821 | CHILD(111), CHILD(114), | ||
1822 | BITFIELD(46, 1) /* index 93 */, | ||
1823 | TILEGX_OPC_NONE, TILEGX_OPC_FNOP, | ||
1824 | BITFIELD(46, 1) /* index 96 */, | ||
1825 | TILEGX_OPC_NONE, TILEGX_OPC_ILL, | ||
1826 | BITFIELD(46, 1) /* index 99 */, | ||
1827 | TILEGX_OPC_NONE, TILEGX_OPC_JALRP, | ||
1828 | BITFIELD(46, 1) /* index 102 */, | ||
1829 | TILEGX_OPC_NONE, TILEGX_OPC_JALR, | ||
1830 | BITFIELD(46, 1) /* index 105 */, | ||
1831 | TILEGX_OPC_NONE, TILEGX_OPC_JRP, | ||
1832 | BITFIELD(46, 1) /* index 108 */, | ||
1833 | TILEGX_OPC_NONE, TILEGX_OPC_JR, | ||
1834 | BITFIELD(46, 1) /* index 111 */, | ||
1835 | TILEGX_OPC_NONE, TILEGX_OPC_LNK, | ||
1836 | BITFIELD(46, 1) /* index 114 */, | ||
1837 | TILEGX_OPC_NONE, TILEGX_OPC_NOP, | ||
1838 | BITFIELD(49, 2) /* index 117 */, | ||
1839 | TILEGX_OPC_CMPLES, TILEGX_OPC_CMPLEU, TILEGX_OPC_CMPLTS, TILEGX_OPC_CMPLTU, | ||
1840 | BITFIELD(49, 2) /* index 122 */, | ||
1841 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_CMPEQ, TILEGX_OPC_CMPNE, | ||
1842 | BITFIELD(49, 2) /* index 127 */, | ||
1843 | TILEGX_OPC_NONE, TILEGX_OPC_NONE, TILEGX_OPC_MNZ, TILEGX_OPC_MZ, | ||
1844 | BITFIELD(49, 2) /* index 132 */, | ||
1845 | TILEGX_OPC_AND, TILEGX_OPC_NOR, CHILD(137), TILEGX_OPC_XOR, | ||
1846 | BITFIELD(43, 2) /* index 137 */, | ||
1847 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, CHILD(142), | ||
1848 | BITFIELD(45, 2) /* index 142 */, | ||
1849 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, CHILD(147), | ||
1850 | BITFIELD(47, 2) /* index 147 */, | ||
1851 | TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_OR, TILEGX_OPC_MOVE, | ||
1852 | BITFIELD(49, 2) /* index 152 */, | ||
1853 | TILEGX_OPC_ROTL, TILEGX_OPC_SHL, TILEGX_OPC_SHRS, TILEGX_OPC_SHRU, | ||
1854 | BITFIELD(49, 2) /* index 157 */, | ||
1855 | TILEGX_OPC_NONE, TILEGX_OPC_SHL1ADDX, TILEGX_OPC_SHL2ADDX, | ||
1856 | TILEGX_OPC_SHL3ADDX, | ||
1857 | BITFIELD(49, 2) /* index 162 */, | ||
1858 | TILEGX_OPC_ROTLI, TILEGX_OPC_SHLI, TILEGX_OPC_SHRSI, TILEGX_OPC_SHRUI, | ||
1859 | }; | ||
1860 | |||
1861 | static const unsigned short decode_Y2_fsm[118] = | ||
1862 | { | ||
1863 | BITFIELD(62, 2) /* index 0 */, | ||
1864 | TILEGX_OPC_NONE, CHILD(5), CHILD(66), CHILD(109), | ||
1865 | BITFIELD(55, 3) /* index 5 */, | ||
1866 | CHILD(14), CHILD(14), CHILD(14), CHILD(17), CHILD(40), CHILD(40), CHILD(40), | ||
1867 | CHILD(43), | ||
1868 | BITFIELD(26, 1) /* index 14 */, | ||
1869 | TILEGX_OPC_LD1S, TILEGX_OPC_LD1U, | ||
1870 | BITFIELD(26, 1) /* index 17 */, | ||
1871 | CHILD(20), CHILD(30), | ||
1872 | BITFIELD(51, 2) /* index 20 */, | ||
1873 | TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, CHILD(25), | ||
1874 | BITFIELD(53, 2) /* index 25 */, | ||
1875 | TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, TILEGX_OPC_LD1S, | ||
1876 | TILEGX_OPC_PREFETCH_L1_FAULT, | ||
1877 | BITFIELD(51, 2) /* index 30 */, | ||
1878 | TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, CHILD(35), | ||
1879 | BITFIELD(53, 2) /* index 35 */, | ||
1880 | TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, TILEGX_OPC_LD1U, TILEGX_OPC_PREFETCH, | ||
1881 | BITFIELD(26, 1) /* index 40 */, | ||
1882 | TILEGX_OPC_LD2S, TILEGX_OPC_LD2U, | ||
1883 | BITFIELD(26, 1) /* index 43 */, | ||
1884 | CHILD(46), CHILD(56), | ||
1885 | BITFIELD(51, 2) /* index 46 */, | ||
1886 | TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, CHILD(51), | ||
1887 | BITFIELD(53, 2) /* index 51 */, | ||
1888 | TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, TILEGX_OPC_LD2S, | ||
1889 | TILEGX_OPC_PREFETCH_L2_FAULT, | ||
1890 | BITFIELD(51, 2) /* index 56 */, | ||
1891 | TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, CHILD(61), | ||
1892 | BITFIELD(53, 2) /* index 61 */, | ||
1893 | TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, TILEGX_OPC_LD2U, TILEGX_OPC_PREFETCH_L2, | ||
1894 | BITFIELD(56, 2) /* index 66 */, | ||
1895 | CHILD(71), CHILD(74), CHILD(90), CHILD(93), | ||
1896 | BITFIELD(26, 1) /* index 71 */, | ||
1897 | TILEGX_OPC_NONE, TILEGX_OPC_LD4S, | ||
1898 | BITFIELD(26, 1) /* index 74 */, | ||
1899 | TILEGX_OPC_NONE, CHILD(77), | ||
1900 | BITFIELD(51, 2) /* index 77 */, | ||
1901 | TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, CHILD(82), | ||
1902 | BITFIELD(53, 2) /* index 82 */, | ||
1903 | TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, TILEGX_OPC_LD4S, CHILD(87), | ||
1904 | BITFIELD(55, 1) /* index 87 */, | ||
1905 | TILEGX_OPC_LD4S, TILEGX_OPC_PREFETCH_L3_FAULT, | ||
1906 | BITFIELD(26, 1) /* index 90 */, | ||
1907 | TILEGX_OPC_LD4U, TILEGX_OPC_LD, | ||
1908 | BITFIELD(26, 1) /* index 93 */, | ||
1909 | CHILD(96), TILEGX_OPC_LD, | ||
1910 | BITFIELD(51, 2) /* index 96 */, | ||
1911 | TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, CHILD(101), | ||
1912 | BITFIELD(53, 2) /* index 101 */, | ||
1913 | TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, TILEGX_OPC_LD4U, CHILD(106), | ||
1914 | BITFIELD(55, 1) /* index 106 */, | ||
1915 | TILEGX_OPC_LD4U, TILEGX_OPC_PREFETCH_L3, | ||
1916 | BITFIELD(26, 1) /* index 109 */, | ||
1917 | CHILD(112), CHILD(115), | ||
1918 | BITFIELD(57, 1) /* index 112 */, | ||
1919 | TILEGX_OPC_ST1, TILEGX_OPC_ST4, | ||
1920 | BITFIELD(57, 1) /* index 115 */, | ||
1921 | TILEGX_OPC_ST2, TILEGX_OPC_ST, | ||
1922 | }; | ||
1923 | |||
1924 | #undef BITFIELD | ||
1925 | #undef CHILD | ||
1926 | const unsigned short * const | ||
1927 | tilegx_bundle_decoder_fsms[TILEGX_NUM_PIPELINE_ENCODINGS] = | ||
1928 | { | ||
1929 | decode_X0_fsm, | ||
1930 | decode_X1_fsm, | ||
1931 | decode_Y0_fsm, | ||
1932 | decode_Y1_fsm, | ||
1933 | decode_Y2_fsm | ||
1934 | }; | ||
1935 | const struct tilegx_operand tilegx_operands[35] = | ||
1936 | { | ||
1937 | { | ||
1938 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_IMM8_X0), | ||
1939 | 8, 1, 0, 0, 0, 0, | ||
1940 | create_Imm8_X0, get_Imm8_X0 | ||
1941 | }, | ||
1942 | { | ||
1943 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_IMM8_X1), | ||
1944 | 8, 1, 0, 0, 0, 0, | ||
1945 | create_Imm8_X1, get_Imm8_X1 | ||
1946 | }, | ||
1947 | { | ||
1948 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_IMM8_Y0), | ||
1949 | 8, 1, 0, 0, 0, 0, | ||
1950 | create_Imm8_Y0, get_Imm8_Y0 | ||
1951 | }, | ||
1952 | { | ||
1953 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_IMM8_Y1), | ||
1954 | 8, 1, 0, 0, 0, 0, | ||
1955 | create_Imm8_Y1, get_Imm8_Y1 | ||
1956 | }, | ||
1957 | { | ||
1958 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_IMM16_X0_HW0_LAST), | ||
1959 | 16, 1, 0, 0, 0, 0, | ||
1960 | create_Imm16_X0, get_Imm16_X0 | ||
1961 | }, | ||
1962 | { | ||
1963 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_IMM16_X1_HW0_LAST), | ||
1964 | 16, 1, 0, 0, 0, 0, | ||
1965 | create_Imm16_X1, get_Imm16_X1 | ||
1966 | }, | ||
1967 | { | ||
1968 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
1969 | 6, 0, 0, 1, 0, 0, | ||
1970 | create_Dest_X0, get_Dest_X0 | ||
1971 | }, | ||
1972 | { | ||
1973 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
1974 | 6, 0, 1, 0, 0, 0, | ||
1975 | create_SrcA_X0, get_SrcA_X0 | ||
1976 | }, | ||
1977 | { | ||
1978 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
1979 | 6, 0, 0, 1, 0, 0, | ||
1980 | create_Dest_X1, get_Dest_X1 | ||
1981 | }, | ||
1982 | { | ||
1983 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
1984 | 6, 0, 1, 0, 0, 0, | ||
1985 | create_SrcA_X1, get_SrcA_X1 | ||
1986 | }, | ||
1987 | { | ||
1988 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
1989 | 6, 0, 0, 1, 0, 0, | ||
1990 | create_Dest_Y0, get_Dest_Y0 | ||
1991 | }, | ||
1992 | { | ||
1993 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
1994 | 6, 0, 1, 0, 0, 0, | ||
1995 | create_SrcA_Y0, get_SrcA_Y0 | ||
1996 | }, | ||
1997 | { | ||
1998 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
1999 | 6, 0, 0, 1, 0, 0, | ||
2000 | create_Dest_Y1, get_Dest_Y1 | ||
2001 | }, | ||
2002 | { | ||
2003 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2004 | 6, 0, 1, 0, 0, 0, | ||
2005 | create_SrcA_Y1, get_SrcA_Y1 | ||
2006 | }, | ||
2007 | { | ||
2008 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2009 | 6, 0, 1, 0, 0, 0, | ||
2010 | create_SrcA_Y2, get_SrcA_Y2 | ||
2011 | }, | ||
2012 | { | ||
2013 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2014 | 6, 0, 1, 1, 0, 0, | ||
2015 | create_SrcA_X1, get_SrcA_X1 | ||
2016 | }, | ||
2017 | { | ||
2018 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2019 | 6, 0, 1, 0, 0, 0, | ||
2020 | create_SrcB_X0, get_SrcB_X0 | ||
2021 | }, | ||
2022 | { | ||
2023 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2024 | 6, 0, 1, 0, 0, 0, | ||
2025 | create_SrcB_X1, get_SrcB_X1 | ||
2026 | }, | ||
2027 | { | ||
2028 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2029 | 6, 0, 1, 0, 0, 0, | ||
2030 | create_SrcB_Y0, get_SrcB_Y0 | ||
2031 | }, | ||
2032 | { | ||
2033 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2034 | 6, 0, 1, 0, 0, 0, | ||
2035 | create_SrcB_Y1, get_SrcB_Y1 | ||
2036 | }, | ||
2037 | { | ||
2038 | TILEGX_OP_TYPE_ADDRESS, BFD_RELOC(TILEGX_BROFF_X1), | ||
2039 | 17, 1, 0, 0, 1, TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES, | ||
2040 | create_BrOff_X1, get_BrOff_X1 | ||
2041 | }, | ||
2042 | { | ||
2043 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(NONE), | ||
2044 | 6, 0, 0, 0, 0, 0, | ||
2045 | create_BFStart_X0, get_BFStart_X0 | ||
2046 | }, | ||
2047 | { | ||
2048 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(NONE), | ||
2049 | 6, 0, 0, 0, 0, 0, | ||
2050 | create_BFEnd_X0, get_BFEnd_X0 | ||
2051 | }, | ||
2052 | { | ||
2053 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2054 | 6, 0, 1, 1, 0, 0, | ||
2055 | create_Dest_X0, get_Dest_X0 | ||
2056 | }, | ||
2057 | { | ||
2058 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2059 | 6, 0, 1, 1, 0, 0, | ||
2060 | create_Dest_Y0, get_Dest_Y0 | ||
2061 | }, | ||
2062 | { | ||
2063 | TILEGX_OP_TYPE_ADDRESS, BFD_RELOC(TILEGX_JUMPOFF_X1), | ||
2064 | 27, 1, 0, 0, 1, TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES, | ||
2065 | create_JumpOff_X1, get_JumpOff_X1 | ||
2066 | }, | ||
2067 | { | ||
2068 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2069 | 6, 0, 0, 1, 0, 0, | ||
2070 | create_SrcBDest_Y2, get_SrcBDest_Y2 | ||
2071 | }, | ||
2072 | { | ||
2073 | TILEGX_OP_TYPE_SPR, BFD_RELOC(TILEGX_MF_IMM14_X1), | ||
2074 | 14, 0, 0, 0, 0, 0, | ||
2075 | create_MF_Imm14_X1, get_MF_Imm14_X1 | ||
2076 | }, | ||
2077 | { | ||
2078 | TILEGX_OP_TYPE_SPR, BFD_RELOC(TILEGX_MT_IMM14_X1), | ||
2079 | 14, 0, 0, 0, 0, 0, | ||
2080 | create_MT_Imm14_X1, get_MT_Imm14_X1 | ||
2081 | }, | ||
2082 | { | ||
2083 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_SHAMT_X0), | ||
2084 | 6, 0, 0, 0, 0, 0, | ||
2085 | create_ShAmt_X0, get_ShAmt_X0 | ||
2086 | }, | ||
2087 | { | ||
2088 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_SHAMT_X1), | ||
2089 | 6, 0, 0, 0, 0, 0, | ||
2090 | create_ShAmt_X1, get_ShAmt_X1 | ||
2091 | }, | ||
2092 | { | ||
2093 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_SHAMT_Y0), | ||
2094 | 6, 0, 0, 0, 0, 0, | ||
2095 | create_ShAmt_Y0, get_ShAmt_Y0 | ||
2096 | }, | ||
2097 | { | ||
2098 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_SHAMT_Y1), | ||
2099 | 6, 0, 0, 0, 0, 0, | ||
2100 | create_ShAmt_Y1, get_ShAmt_Y1 | ||
2101 | }, | ||
2102 | { | ||
2103 | TILEGX_OP_TYPE_REGISTER, BFD_RELOC(NONE), | ||
2104 | 6, 0, 1, 0, 0, 0, | ||
2105 | create_SrcBDest_Y2, get_SrcBDest_Y2 | ||
2106 | }, | ||
2107 | { | ||
2108 | TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_DEST_IMM8_X1), | ||
2109 | 8, 1, 0, 0, 0, 0, | ||
2110 | create_Dest_Imm8_X1, get_Dest_Imm8_X1 | ||
2111 | } | ||
2112 | }; | ||
2113 | |||
2114 | |||
2115 | |||
2116 | |||
2117 | /* Given a set of bundle bits and the lookup FSM for a specific pipe, | ||
2118 | * returns which instruction the bundle contains in that pipe. | ||
2119 | */ | ||
2120 | static const struct tilegx_opcode * | ||
2121 | find_opcode(tilegx_bundle_bits bits, const unsigned short *table) | ||
2122 | { | ||
2123 | int index = 0; | ||
2124 | |||
2125 | while (1) | ||
2126 | { | ||
2127 | unsigned short bitspec = table[index]; | ||
2128 | unsigned int bitfield = | ||
2129 | ((unsigned int)(bits >> (bitspec & 63))) & (bitspec >> 6); | ||
2130 | |||
2131 | unsigned short next = table[index + 1 + bitfield]; | ||
2132 | if (next <= TILEGX_OPC_NONE) | ||
2133 | return &tilegx_opcodes[next]; | ||
2134 | |||
2135 | index = next - TILEGX_OPC_NONE; | ||
2136 | } | ||
2137 | } | ||
2138 | |||
2139 | |||
2140 | int | ||
2141 | parse_insn_tilegx(tilegx_bundle_bits bits, | ||
2142 | unsigned long long pc, | ||
2143 | struct tilegx_decoded_instruction | ||
2144 | decoded[TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE]) | ||
2145 | { | ||
2146 | int num_instructions = 0; | ||
2147 | int pipe; | ||
2148 | |||
2149 | int min_pipe, max_pipe; | ||
2150 | if ((bits & TILEGX_BUNDLE_MODE_MASK) == 0) | ||
2151 | { | ||
2152 | min_pipe = TILEGX_PIPELINE_X0; | ||
2153 | max_pipe = TILEGX_PIPELINE_X1; | ||
2154 | } | ||
2155 | else | ||
2156 | { | ||
2157 | min_pipe = TILEGX_PIPELINE_Y0; | ||
2158 | max_pipe = TILEGX_PIPELINE_Y2; | ||
2159 | } | ||
2160 | |||
2161 | /* For each pipe, find an instruction that fits. */ | ||
2162 | for (pipe = min_pipe; pipe <= max_pipe; pipe++) | ||
2163 | { | ||
2164 | const struct tilegx_opcode *opc; | ||
2165 | struct tilegx_decoded_instruction *d; | ||
2166 | int i; | ||
2167 | |||
2168 | d = &decoded[num_instructions++]; | ||
2169 | opc = find_opcode (bits, tilegx_bundle_decoder_fsms[pipe]); | ||
2170 | d->opcode = opc; | ||
2171 | |||
2172 | /* Decode each operand, sign extending, etc. as appropriate. */ | ||
2173 | for (i = 0; i < opc->num_operands; i++) | ||
2174 | { | ||
2175 | const struct tilegx_operand *op = | ||
2176 | &tilegx_operands[opc->operands[pipe][i]]; | ||
2177 | int raw_opval = op->extract (bits); | ||
2178 | long long opval; | ||
2179 | |||
2180 | if (op->is_signed) | ||
2181 | { | ||
2182 | /* Sign-extend the operand. */ | ||
2183 | int shift = (int)((sizeof(int) * 8) - op->num_bits); | ||
2184 | raw_opval = (raw_opval << shift) >> shift; | ||
2185 | } | ||
2186 | |||
2187 | /* Adjust PC-relative scaled branch offsets. */ | ||
2188 | if (op->type == TILEGX_OP_TYPE_ADDRESS) | ||
2189 | opval = (raw_opval * TILEGX_BUNDLE_SIZE_IN_BYTES) + pc; | ||
2190 | else | ||
2191 | opval = raw_opval; | ||
2192 | |||
2193 | /* Record the final value. */ | ||
2194 | d->operands[i] = op; | ||
2195 | d->operand_values[i] = opval; | ||
2196 | } | ||
2197 | } | ||
2198 | |||
2199 | return num_instructions; | ||
2200 | } | ||
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c index 49a605be94c5..c4be58cc5d50 100644 --- a/arch/tile/kernel/time.c +++ b/arch/tile/kernel/time.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/module.h> | ||
25 | #include <asm/irq_regs.h> | 26 | #include <asm/irq_regs.h> |
26 | #include <asm/traps.h> | 27 | #include <asm/traps.h> |
27 | #include <hv/hypervisor.h> | 28 | #include <hv/hypervisor.h> |
@@ -56,6 +57,7 @@ cycles_t get_cycles(void) | |||
56 | 57 | ||
57 | return (((cycles_t)high) << 32) | low; | 58 | return (((cycles_t)high) << 32) | low; |
58 | } | 59 | } |
60 | EXPORT_SYMBOL(get_cycles); | ||
59 | #endif | 61 | #endif |
60 | 62 | ||
61 | /* | 63 | /* |
diff --git a/arch/tile/kernel/tlb.c b/arch/tile/kernel/tlb.c index 2dffc1044d83..a5f241c24cac 100644 --- a/arch/tile/kernel/tlb.c +++ b/arch/tile/kernel/tlb.c | |||
@@ -34,13 +34,13 @@ void flush_tlb_mm(struct mm_struct *mm) | |||
34 | { | 34 | { |
35 | HV_Remote_ASID asids[NR_CPUS]; | 35 | HV_Remote_ASID asids[NR_CPUS]; |
36 | int i = 0, cpu; | 36 | int i = 0, cpu; |
37 | for_each_cpu(cpu, &mm->cpu_vm_mask) { | 37 | for_each_cpu(cpu, mm_cpumask(mm)) { |
38 | HV_Remote_ASID *asid = &asids[i++]; | 38 | HV_Remote_ASID *asid = &asids[i++]; |
39 | asid->y = cpu / smp_topology.width; | 39 | asid->y = cpu / smp_topology.width; |
40 | asid->x = cpu % smp_topology.width; | 40 | asid->x = cpu % smp_topology.width; |
41 | asid->asid = per_cpu(current_asid, cpu); | 41 | asid->asid = per_cpu(current_asid, cpu); |
42 | } | 42 | } |
43 | flush_remote(0, HV_FLUSH_EVICT_L1I, &mm->cpu_vm_mask, | 43 | flush_remote(0, HV_FLUSH_EVICT_L1I, mm_cpumask(mm), |
44 | 0, 0, 0, NULL, asids, i); | 44 | 0, 0, 0, NULL, asids, i); |
45 | } | 45 | } |
46 | 46 | ||
@@ -54,8 +54,8 @@ void flush_tlb_page_mm(const struct vm_area_struct *vma, struct mm_struct *mm, | |||
54 | { | 54 | { |
55 | unsigned long size = hv_page_size(vma); | 55 | unsigned long size = hv_page_size(vma); |
56 | int cache = (vma->vm_flags & VM_EXEC) ? HV_FLUSH_EVICT_L1I : 0; | 56 | int cache = (vma->vm_flags & VM_EXEC) ? HV_FLUSH_EVICT_L1I : 0; |
57 | flush_remote(0, cache, &mm->cpu_vm_mask, | 57 | flush_remote(0, cache, mm_cpumask(mm), |
58 | va, size, size, &mm->cpu_vm_mask, NULL, 0); | 58 | va, size, size, mm_cpumask(mm), NULL, 0); |
59 | } | 59 | } |
60 | 60 | ||
61 | void flush_tlb_page(const struct vm_area_struct *vma, unsigned long va) | 61 | void flush_tlb_page(const struct vm_area_struct *vma, unsigned long va) |
@@ -70,8 +70,8 @@ void flush_tlb_range(const struct vm_area_struct *vma, | |||
70 | unsigned long size = hv_page_size(vma); | 70 | unsigned long size = hv_page_size(vma); |
71 | struct mm_struct *mm = vma->vm_mm; | 71 | struct mm_struct *mm = vma->vm_mm; |
72 | int cache = (vma->vm_flags & VM_EXEC) ? HV_FLUSH_EVICT_L1I : 0; | 72 | int cache = (vma->vm_flags & VM_EXEC) ? HV_FLUSH_EVICT_L1I : 0; |
73 | flush_remote(0, cache, &mm->cpu_vm_mask, start, end - start, size, | 73 | flush_remote(0, cache, mm_cpumask(mm), start, end - start, size, |
74 | &mm->cpu_vm_mask, NULL, 0); | 74 | mm_cpumask(mm), NULL, 0); |
75 | } | 75 | } |
76 | 76 | ||
77 | void flush_tlb_all(void) | 77 | void flush_tlb_all(void) |
diff --git a/arch/tile/kernel/traps.c b/arch/tile/kernel/traps.c index 5474fc2e77e8..f9803dfa7357 100644 --- a/arch/tile/kernel/traps.c +++ b/arch/tile/kernel/traps.c | |||
@@ -308,6 +308,7 @@ void __kprobes do_trap(struct pt_regs *regs, int fault_num, | |||
308 | info.si_addr = (void __user *)address; | 308 | info.si_addr = (void __user *)address; |
309 | if (signo == SIGILL) | 309 | if (signo == SIGILL) |
310 | info.si_trapno = fault_num; | 310 | info.si_trapno = fault_num; |
311 | trace_unhandled_signal("trap", regs, address, signo); | ||
311 | force_sig_info(signo, &info, current); | 312 | force_sig_info(signo, &info, current); |
312 | } | 313 | } |
313 | 314 | ||
diff --git a/arch/tile/lib/atomic_asm_32.S b/arch/tile/lib/atomic_asm_32.S index 82f64cc63658..24448734f6f1 100644 --- a/arch/tile/lib/atomic_asm_32.S +++ b/arch/tile/lib/atomic_asm_32.S | |||
@@ -59,7 +59,7 @@ | |||
59 | * bad kernel addresses). | 59 | * bad kernel addresses). |
60 | * | 60 | * |
61 | * Note that if the value we would store is the same as what we | 61 | * Note that if the value we would store is the same as what we |
62 | * loaded, we bypass the load. Other platforms with true atomics can | 62 | * loaded, we bypass the store. Other platforms with true atomics can |
63 | * make the guarantee that a non-atomic __clear_bit(), for example, | 63 | * make the guarantee that a non-atomic __clear_bit(), for example, |
64 | * can safely race with an atomic test_and_set_bit(); this example is | 64 | * can safely race with an atomic test_and_set_bit(); this example is |
65 | * from bit_spinlock.h in slub_lock() / slub_unlock(). We can't do | 65 | * from bit_spinlock.h in slub_lock() / slub_unlock(). We can't do |
diff --git a/arch/tile/lib/cacheflush.c b/arch/tile/lib/cacheflush.c index 35c1d8ca5f38..8928aace7a64 100644 --- a/arch/tile/lib/cacheflush.c +++ b/arch/tile/lib/cacheflush.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/page.h> | 15 | #include <asm/page.h> |
16 | #include <asm/cacheflush.h> | 16 | #include <asm/cacheflush.h> |
17 | #include <arch/icache.h> | 17 | #include <arch/icache.h> |
18 | #include <arch/spr_def.h> | ||
18 | 19 | ||
19 | 20 | ||
20 | void __flush_icache_range(unsigned long start, unsigned long end) | 21 | void __flush_icache_range(unsigned long start, unsigned long end) |
@@ -39,6 +40,18 @@ void finv_buffer_remote(void *buffer, size_t size, int hfh) | |||
39 | char *p, *base; | 40 | char *p, *base; |
40 | size_t step_size, load_count; | 41 | size_t step_size, load_count; |
41 | const unsigned long STRIPE_WIDTH = 8192; | 42 | const unsigned long STRIPE_WIDTH = 8192; |
43 | #ifdef __tilegx__ | ||
44 | /* | ||
45 | * On TILE-Gx, we must disable the dstream prefetcher before doing | ||
46 | * a cache flush; otherwise, we could end up with data in the cache | ||
47 | * that we don't want there. Note that normally we'd do an mf | ||
48 | * after the SPR write to disabling the prefetcher, but we do one | ||
49 | * below, before any further loads, so there's no need to do it | ||
50 | * here. | ||
51 | */ | ||
52 | uint_reg_t old_dstream_pf = __insn_mfspr(SPR_DSTREAM_PF); | ||
53 | __insn_mtspr(SPR_DSTREAM_PF, 0); | ||
54 | #endif | ||
42 | 55 | ||
43 | /* | 56 | /* |
44 | * Flush and invalidate the buffer out of the local L1/L2 | 57 | * Flush and invalidate the buffer out of the local L1/L2 |
@@ -122,4 +135,9 @@ void finv_buffer_remote(void *buffer, size_t size, int hfh) | |||
122 | 135 | ||
123 | /* Wait for the load+inv's (and thus finvs) to have completed. */ | 136 | /* Wait for the load+inv's (and thus finvs) to have completed. */ |
124 | __insn_mf(); | 137 | __insn_mf(); |
138 | |||
139 | #ifdef __tilegx__ | ||
140 | /* Reenable the prefetcher. */ | ||
141 | __insn_mtspr(SPR_DSTREAM_PF, old_dstream_pf); | ||
142 | #endif | ||
125 | } | 143 | } |
diff --git a/arch/tile/lib/memchr_64.c b/arch/tile/lib/memchr_64.c new file mode 100644 index 000000000000..84fdc8d8e735 --- /dev/null +++ b/arch/tile/lib/memchr_64.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/module.h> | ||
18 | |||
19 | void *memchr(const void *s, int c, size_t n) | ||
20 | { | ||
21 | const uint64_t *last_word_ptr; | ||
22 | const uint64_t *p; | ||
23 | const char *last_byte_ptr; | ||
24 | uintptr_t s_int; | ||
25 | uint64_t goal, before_mask, v, bits; | ||
26 | char *ret; | ||
27 | |||
28 | if (__builtin_expect(n == 0, 0)) { | ||
29 | /* Don't dereference any memory if the array is empty. */ | ||
30 | return NULL; | ||
31 | } | ||
32 | |||
33 | /* Get an aligned pointer. */ | ||
34 | s_int = (uintptr_t) s; | ||
35 | p = (const uint64_t *)(s_int & -8); | ||
36 | |||
37 | /* Create eight copies of the byte for which we are looking. */ | ||
38 | goal = 0x0101010101010101ULL * (uint8_t) c; | ||
39 | |||
40 | /* Read the first word, but munge it so that bytes before the array | ||
41 | * will not match goal. | ||
42 | * | ||
43 | * Note that this shift count expression works because we know | ||
44 | * shift counts are taken mod 64. | ||
45 | */ | ||
46 | before_mask = (1ULL << (s_int << 3)) - 1; | ||
47 | v = (*p | before_mask) ^ (goal & before_mask); | ||
48 | |||
49 | /* Compute the address of the last byte. */ | ||
50 | last_byte_ptr = (const char *)s + n - 1; | ||
51 | |||
52 | /* Compute the address of the word containing the last byte. */ | ||
53 | last_word_ptr = (const uint64_t *)((uintptr_t) last_byte_ptr & -8); | ||
54 | |||
55 | while ((bits = __insn_v1cmpeq(v, goal)) == 0) { | ||
56 | if (__builtin_expect(p == last_word_ptr, 0)) { | ||
57 | /* We already read the last word in the array, | ||
58 | * so give up. | ||
59 | */ | ||
60 | return NULL; | ||
61 | } | ||
62 | v = *++p; | ||
63 | } | ||
64 | |||
65 | /* We found a match, but it might be in a byte past the end | ||
66 | * of the array. | ||
67 | */ | ||
68 | ret = ((char *)p) + (__insn_ctz(bits) >> 3); | ||
69 | return (ret <= last_byte_ptr) ? ret : NULL; | ||
70 | } | ||
71 | EXPORT_SYMBOL(memchr); | ||
diff --git a/arch/tile/lib/memcpy_64.c b/arch/tile/lib/memcpy_64.c new file mode 100644 index 000000000000..3fab9a6a2bbe --- /dev/null +++ b/arch/tile/lib/memcpy_64.c | |||
@@ -0,0 +1,220 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/module.h> | ||
18 | #define __memcpy memcpy | ||
19 | /* EXPORT_SYMBOL() is in arch/tile/lib/exports.c since this should be asm. */ | ||
20 | |||
21 | /* Must be 8 bytes in size. */ | ||
22 | #define word_t uint64_t | ||
23 | |||
24 | #if CHIP_L2_LINE_SIZE() != 64 && CHIP_L2_LINE_SIZE() != 128 | ||
25 | #error "Assumes 64 or 128 byte line size" | ||
26 | #endif | ||
27 | |||
28 | /* How many cache lines ahead should we prefetch? */ | ||
29 | #define PREFETCH_LINES_AHEAD 3 | ||
30 | |||
31 | /* | ||
32 | * Provide "base versions" of load and store for the normal code path. | ||
33 | * The kernel provides other versions for userspace copies. | ||
34 | */ | ||
35 | #define ST(p, v) (*(p) = (v)) | ||
36 | #define LD(p) (*(p)) | ||
37 | |||
38 | #ifndef USERCOPY_FUNC | ||
39 | #define ST1 ST | ||
40 | #define ST2 ST | ||
41 | #define ST4 ST | ||
42 | #define ST8 ST | ||
43 | #define LD1 LD | ||
44 | #define LD2 LD | ||
45 | #define LD4 LD | ||
46 | #define LD8 LD | ||
47 | #define RETVAL dstv | ||
48 | void *memcpy(void *__restrict dstv, const void *__restrict srcv, size_t n) | ||
49 | #else | ||
50 | /* | ||
51 | * Special kernel version will provide implementation of the LDn/STn | ||
52 | * macros to return a count of uncopied bytes due to mm fault. | ||
53 | */ | ||
54 | #define RETVAL 0 | ||
55 | int USERCOPY_FUNC(void *__restrict dstv, const void *__restrict srcv, size_t n) | ||
56 | #endif | ||
57 | { | ||
58 | char *__restrict dst1 = (char *)dstv; | ||
59 | const char *__restrict src1 = (const char *)srcv; | ||
60 | const char *__restrict src1_end; | ||
61 | const char *__restrict prefetch; | ||
62 | word_t *__restrict dst8; /* 8-byte pointer to destination memory. */ | ||
63 | word_t final; /* Final bytes to write to trailing word, if any */ | ||
64 | long i; | ||
65 | |||
66 | if (n < 16) { | ||
67 | for (; n; n--) | ||
68 | ST1(dst1++, LD1(src1++)); | ||
69 | return RETVAL; | ||
70 | } | ||
71 | |||
72 | /* | ||
73 | * Locate the end of source memory we will copy. Don't | ||
74 | * prefetch past this. | ||
75 | */ | ||
76 | src1_end = src1 + n - 1; | ||
77 | |||
78 | /* Prefetch ahead a few cache lines, but not past the end. */ | ||
79 | prefetch = src1; | ||
80 | for (i = 0; i < PREFETCH_LINES_AHEAD; i++) { | ||
81 | __insn_prefetch(prefetch); | ||
82 | prefetch += CHIP_L2_LINE_SIZE(); | ||
83 | prefetch = (prefetch > src1_end) ? prefetch : src1; | ||
84 | } | ||
85 | |||
86 | /* Copy bytes until dst is word-aligned. */ | ||
87 | for (; (uintptr_t)dst1 & (sizeof(word_t) - 1); n--) | ||
88 | ST1(dst1++, LD1(src1++)); | ||
89 | |||
90 | /* 8-byte pointer to destination memory. */ | ||
91 | dst8 = (word_t *)dst1; | ||
92 | |||
93 | if (__builtin_expect((uintptr_t)src1 & (sizeof(word_t) - 1), 0)) { | ||
94 | /* | ||
95 | * Misaligned copy. Copy 8 bytes at a time, but don't | ||
96 | * bother with other fanciness. | ||
97 | * | ||
98 | * TODO: Consider prefetching and using wh64 as well. | ||
99 | */ | ||
100 | |||
101 | /* Create an aligned src8. */ | ||
102 | const word_t *__restrict src8 = | ||
103 | (const word_t *)((uintptr_t)src1 & -sizeof(word_t)); | ||
104 | word_t b; | ||
105 | |||
106 | word_t a = LD8(src8++); | ||
107 | for (; n >= sizeof(word_t); n -= sizeof(word_t)) { | ||
108 | b = LD8(src8++); | ||
109 | a = __insn_dblalign(a, b, src1); | ||
110 | ST8(dst8++, a); | ||
111 | a = b; | ||
112 | } | ||
113 | |||
114 | if (n == 0) | ||
115 | return RETVAL; | ||
116 | |||
117 | b = ((const char *)src8 <= src1_end) ? *src8 : 0; | ||
118 | |||
119 | /* | ||
120 | * Final source bytes to write to trailing partial | ||
121 | * word, if any. | ||
122 | */ | ||
123 | final = __insn_dblalign(a, b, src1); | ||
124 | } else { | ||
125 | /* Aligned copy. */ | ||
126 | |||
127 | const word_t* __restrict src8 = (const word_t *)src1; | ||
128 | |||
129 | /* src8 and dst8 are both word-aligned. */ | ||
130 | if (n >= CHIP_L2_LINE_SIZE()) { | ||
131 | /* Copy until 'dst' is cache-line-aligned. */ | ||
132 | for (; (uintptr_t)dst8 & (CHIP_L2_LINE_SIZE() - 1); | ||
133 | n -= sizeof(word_t)) | ||
134 | ST8(dst8++, LD8(src8++)); | ||
135 | |||
136 | for (; n >= CHIP_L2_LINE_SIZE(); ) { | ||
137 | __insn_wh64(dst8); | ||
138 | |||
139 | /* | ||
140 | * Prefetch and advance to next line | ||
141 | * to prefetch, but don't go past the end | ||
142 | */ | ||
143 | __insn_prefetch(prefetch); | ||
144 | prefetch += CHIP_L2_LINE_SIZE(); | ||
145 | prefetch = (prefetch > src1_end) ? prefetch : | ||
146 | (const char *)src8; | ||
147 | |||
148 | /* | ||
149 | * Copy an entire cache line. Manually | ||
150 | * unrolled to avoid idiosyncracies of | ||
151 | * compiler unrolling. | ||
152 | */ | ||
153 | #define COPY_WORD(offset) ({ ST8(dst8+offset, LD8(src8+offset)); n -= 8; }) | ||
154 | COPY_WORD(0); | ||
155 | COPY_WORD(1); | ||
156 | COPY_WORD(2); | ||
157 | COPY_WORD(3); | ||
158 | COPY_WORD(4); | ||
159 | COPY_WORD(5); | ||
160 | COPY_WORD(6); | ||
161 | COPY_WORD(7); | ||
162 | #if CHIP_L2_LINE_SIZE() == 128 | ||
163 | COPY_WORD(8); | ||
164 | COPY_WORD(9); | ||
165 | COPY_WORD(10); | ||
166 | COPY_WORD(11); | ||
167 | COPY_WORD(12); | ||
168 | COPY_WORD(13); | ||
169 | COPY_WORD(14); | ||
170 | COPY_WORD(15); | ||
171 | #elif CHIP_L2_LINE_SIZE() != 64 | ||
172 | # error Fix code that assumes particular L2 cache line sizes | ||
173 | #endif | ||
174 | |||
175 | dst8 += CHIP_L2_LINE_SIZE() / sizeof(word_t); | ||
176 | src8 += CHIP_L2_LINE_SIZE() / sizeof(word_t); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | for (; n >= sizeof(word_t); n -= sizeof(word_t)) | ||
181 | ST8(dst8++, LD8(src8++)); | ||
182 | |||
183 | if (__builtin_expect(n == 0, 1)) | ||
184 | return RETVAL; | ||
185 | |||
186 | final = LD8(src8); | ||
187 | } | ||
188 | |||
189 | /* n != 0 if we get here. Write out any trailing bytes. */ | ||
190 | dst1 = (char *)dst8; | ||
191 | if (n & 4) { | ||
192 | ST4((uint32_t *)dst1, final); | ||
193 | dst1 += 4; | ||
194 | final >>= 32; | ||
195 | n &= 3; | ||
196 | } | ||
197 | if (n & 2) { | ||
198 | ST2((uint16_t *)dst1, final); | ||
199 | dst1 += 2; | ||
200 | final >>= 16; | ||
201 | n &= 1; | ||
202 | } | ||
203 | if (n) | ||
204 | ST1((uint8_t *)dst1, final); | ||
205 | |||
206 | return RETVAL; | ||
207 | } | ||
208 | |||
209 | |||
210 | #ifdef USERCOPY_FUNC | ||
211 | #undef ST1 | ||
212 | #undef ST2 | ||
213 | #undef ST4 | ||
214 | #undef ST8 | ||
215 | #undef LD1 | ||
216 | #undef LD2 | ||
217 | #undef LD4 | ||
218 | #undef LD8 | ||
219 | #undef USERCOPY_FUNC | ||
220 | #endif | ||
diff --git a/arch/tile/lib/memcpy_user_64.c b/arch/tile/lib/memcpy_user_64.c new file mode 100644 index 000000000000..4763b3aff1cc --- /dev/null +++ b/arch/tile/lib/memcpy_user_64.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * Do memcpy(), but trap and return "n" when a load or store faults. | ||
15 | * | ||
16 | * Note: this idiom only works when memcpy() compiles to a leaf function. | ||
17 | * If "sp" is updated during memcpy, the "jrp lr" will be incorrect. | ||
18 | * | ||
19 | * Also note that we are capturing "n" from the containing scope here. | ||
20 | */ | ||
21 | |||
22 | #define _ST(p, inst, v) \ | ||
23 | ({ \ | ||
24 | asm("1: " #inst " %0, %1;" \ | ||
25 | ".pushsection .coldtext.memcpy,\"ax\";" \ | ||
26 | "2: { move r0, %2; jrp lr };" \ | ||
27 | ".section __ex_table,\"a\";" \ | ||
28 | ".quad 1b, 2b;" \ | ||
29 | ".popsection" \ | ||
30 | : "=m" (*(p)) : "r" (v), "r" (n)); \ | ||
31 | }) | ||
32 | |||
33 | #define _LD(p, inst) \ | ||
34 | ({ \ | ||
35 | unsigned long __v; \ | ||
36 | asm("1: " #inst " %0, %1;" \ | ||
37 | ".pushsection .coldtext.memcpy,\"ax\";" \ | ||
38 | "2: { move r0, %2; jrp lr };" \ | ||
39 | ".section __ex_table,\"a\";" \ | ||
40 | ".quad 1b, 2b;" \ | ||
41 | ".popsection" \ | ||
42 | : "=r" (__v) : "m" (*(p)), "r" (n)); \ | ||
43 | __v; \ | ||
44 | }) | ||
45 | |||
46 | #define USERCOPY_FUNC __copy_to_user_inatomic | ||
47 | #define ST1(p, v) _ST((p), st1, (v)) | ||
48 | #define ST2(p, v) _ST((p), st2, (v)) | ||
49 | #define ST4(p, v) _ST((p), st4, (v)) | ||
50 | #define ST8(p, v) _ST((p), st, (v)) | ||
51 | #define LD1 LD | ||
52 | #define LD2 LD | ||
53 | #define LD4 LD | ||
54 | #define LD8 LD | ||
55 | #include "memcpy_64.c" | ||
56 | |||
57 | #define USERCOPY_FUNC __copy_from_user_inatomic | ||
58 | #define ST1 ST | ||
59 | #define ST2 ST | ||
60 | #define ST4 ST | ||
61 | #define ST8 ST | ||
62 | #define LD1(p) _LD((p), ld1u) | ||
63 | #define LD2(p) _LD((p), ld2u) | ||
64 | #define LD4(p) _LD((p), ld4u) | ||
65 | #define LD8(p) _LD((p), ld) | ||
66 | #include "memcpy_64.c" | ||
67 | |||
68 | #define USERCOPY_FUNC __copy_in_user_inatomic | ||
69 | #define ST1(p, v) _ST((p), st1, (v)) | ||
70 | #define ST2(p, v) _ST((p), st2, (v)) | ||
71 | #define ST4(p, v) _ST((p), st4, (v)) | ||
72 | #define ST8(p, v) _ST((p), st, (v)) | ||
73 | #define LD1(p) _LD((p), ld1u) | ||
74 | #define LD2(p) _LD((p), ld2u) | ||
75 | #define LD4(p) _LD((p), ld4u) | ||
76 | #define LD8(p) _LD((p), ld) | ||
77 | #include "memcpy_64.c" | ||
78 | |||
79 | unsigned long __copy_from_user_zeroing(void *to, const void __user *from, | ||
80 | unsigned long n) | ||
81 | { | ||
82 | unsigned long rc = __copy_from_user_inatomic(to, from, n); | ||
83 | if (unlikely(rc)) | ||
84 | memset(to + n - rc, 0, rc); | ||
85 | return rc; | ||
86 | } | ||
diff --git a/arch/tile/lib/memset_64.c b/arch/tile/lib/memset_64.c new file mode 100644 index 000000000000..3873085711d5 --- /dev/null +++ b/arch/tile/lib/memset_64.c | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <arch/chip.h> | ||
16 | |||
17 | #include <linux/types.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/module.h> | ||
20 | |||
21 | #undef memset | ||
22 | |||
23 | void *memset(void *s, int c, size_t n) | ||
24 | { | ||
25 | uint64_t *out64; | ||
26 | int n64, to_align64; | ||
27 | uint64_t v64; | ||
28 | uint8_t *out8 = s; | ||
29 | |||
30 | /* Experimentation shows that a trivial tight loop is a win up until | ||
31 | * around a size of 20, where writing a word at a time starts to win. | ||
32 | */ | ||
33 | #define BYTE_CUTOFF 20 | ||
34 | |||
35 | #if BYTE_CUTOFF < 7 | ||
36 | /* This must be at least at least this big, or some code later | ||
37 | * on doesn't work. | ||
38 | */ | ||
39 | #error "BYTE_CUTOFF is too small" | ||
40 | #endif | ||
41 | |||
42 | if (n < BYTE_CUTOFF) { | ||
43 | /* Strangely, this turns out to be the tightest way to | ||
44 | * write this loop. | ||
45 | */ | ||
46 | if (n != 0) { | ||
47 | do { | ||
48 | /* Strangely, combining these into one line | ||
49 | * performs worse. | ||
50 | */ | ||
51 | *out8 = c; | ||
52 | out8++; | ||
53 | } while (--n != 0); | ||
54 | } | ||
55 | |||
56 | return s; | ||
57 | } | ||
58 | |||
59 | /* Align 'out8'. We know n >= 7 so this won't write past the end. */ | ||
60 | while (((uintptr_t) out8 & 7) != 0) { | ||
61 | *out8++ = c; | ||
62 | --n; | ||
63 | } | ||
64 | |||
65 | /* Align 'n'. */ | ||
66 | while (n & 7) | ||
67 | out8[--n] = c; | ||
68 | |||
69 | out64 = (uint64_t *) out8; | ||
70 | n64 = n >> 3; | ||
71 | |||
72 | /* Tile input byte out to 64 bits. */ | ||
73 | /* KLUDGE */ | ||
74 | v64 = 0x0101010101010101ULL * (uint8_t)c; | ||
75 | |||
76 | /* This must be at least 8 or the following loop doesn't work. */ | ||
77 | #define CACHE_LINE_SIZE_IN_DOUBLEWORDS (CHIP_L2_LINE_SIZE() / 8) | ||
78 | |||
79 | /* Determine how many words we need to emit before the 'out32' | ||
80 | * pointer becomes aligned modulo the cache line size. | ||
81 | */ | ||
82 | to_align64 = (-((uintptr_t)out64 >> 3)) & | ||
83 | (CACHE_LINE_SIZE_IN_DOUBLEWORDS - 1); | ||
84 | |||
85 | /* Only bother aligning and using wh64 if there is at least | ||
86 | * one full cache line to process. This check also prevents | ||
87 | * overrunning the end of the buffer with alignment words. | ||
88 | */ | ||
89 | if (to_align64 <= n64 - CACHE_LINE_SIZE_IN_DOUBLEWORDS) { | ||
90 | int lines_left; | ||
91 | |||
92 | /* Align out64 mod the cache line size so we can use wh64. */ | ||
93 | n64 -= to_align64; | ||
94 | for (; to_align64 != 0; to_align64--) { | ||
95 | *out64 = v64; | ||
96 | out64++; | ||
97 | } | ||
98 | |||
99 | /* Use unsigned divide to turn this into a right shift. */ | ||
100 | lines_left = (unsigned)n64 / CACHE_LINE_SIZE_IN_DOUBLEWORDS; | ||
101 | |||
102 | do { | ||
103 | /* Only wh64 a few lines at a time, so we don't | ||
104 | * exceed the maximum number of victim lines. | ||
105 | */ | ||
106 | int x = ((lines_left < CHIP_MAX_OUTSTANDING_VICTIMS()) | ||
107 | ? lines_left | ||
108 | : CHIP_MAX_OUTSTANDING_VICTIMS()); | ||
109 | uint64_t *wh = out64; | ||
110 | int i = x; | ||
111 | int j; | ||
112 | |||
113 | lines_left -= x; | ||
114 | |||
115 | do { | ||
116 | __insn_wh64(wh); | ||
117 | wh += CACHE_LINE_SIZE_IN_DOUBLEWORDS; | ||
118 | } while (--i); | ||
119 | |||
120 | for (j = x * (CACHE_LINE_SIZE_IN_DOUBLEWORDS / 4); | ||
121 | j != 0; j--) { | ||
122 | *out64++ = v64; | ||
123 | *out64++ = v64; | ||
124 | *out64++ = v64; | ||
125 | *out64++ = v64; | ||
126 | } | ||
127 | } while (lines_left != 0); | ||
128 | |||
129 | /* We processed all full lines above, so only this many | ||
130 | * words remain to be processed. | ||
131 | */ | ||
132 | n64 &= CACHE_LINE_SIZE_IN_DOUBLEWORDS - 1; | ||
133 | } | ||
134 | |||
135 | /* Now handle any leftover values. */ | ||
136 | if (n64 != 0) { | ||
137 | do { | ||
138 | *out64 = v64; | ||
139 | out64++; | ||
140 | } while (--n64 != 0); | ||
141 | } | ||
142 | |||
143 | return s; | ||
144 | } | ||
145 | EXPORT_SYMBOL(memset); | ||
diff --git a/arch/tile/lib/spinlock_64.c b/arch/tile/lib/spinlock_64.c new file mode 100644 index 000000000000..d6fb9581e980 --- /dev/null +++ b/arch/tile/lib/spinlock_64.c | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/spinlock.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <asm/processor.h> | ||
18 | |||
19 | #include "spinlock_common.h" | ||
20 | |||
21 | /* | ||
22 | * Read the spinlock value without allocating in our cache and without | ||
23 | * causing an invalidation to another cpu with a copy of the cacheline. | ||
24 | * This is important when we are spinning waiting for the lock. | ||
25 | */ | ||
26 | static inline u32 arch_spin_read_noalloc(void *lock) | ||
27 | { | ||
28 | return atomic_cmpxchg((atomic_t *)lock, -1, -1); | ||
29 | } | ||
30 | |||
31 | /* | ||
32 | * Wait until the high bits (current) match my ticket. | ||
33 | * If we notice the overflow bit set on entry, we clear it. | ||
34 | */ | ||
35 | void arch_spin_lock_slow(arch_spinlock_t *lock, u32 my_ticket) | ||
36 | { | ||
37 | if (unlikely(my_ticket & __ARCH_SPIN_NEXT_OVERFLOW)) { | ||
38 | __insn_fetchand4(&lock->lock, ~__ARCH_SPIN_NEXT_OVERFLOW); | ||
39 | my_ticket &= ~__ARCH_SPIN_NEXT_OVERFLOW; | ||
40 | } | ||
41 | |||
42 | for (;;) { | ||
43 | u32 val = arch_spin_read_noalloc(lock); | ||
44 | u32 delta = my_ticket - arch_spin_current(val); | ||
45 | if (delta == 0) | ||
46 | return; | ||
47 | relax((128 / CYCLES_PER_RELAX_LOOP) * delta); | ||
48 | } | ||
49 | } | ||
50 | EXPORT_SYMBOL(arch_spin_lock_slow); | ||
51 | |||
52 | /* | ||
53 | * Check the lock to see if it is plausible, and try to get it with cmpxchg(). | ||
54 | */ | ||
55 | int arch_spin_trylock(arch_spinlock_t *lock) | ||
56 | { | ||
57 | u32 val = arch_spin_read_noalloc(lock); | ||
58 | if (unlikely(arch_spin_current(val) != arch_spin_next(val))) | ||
59 | return 0; | ||
60 | return cmpxchg(&lock->lock, val, (val + 1) & ~__ARCH_SPIN_NEXT_OVERFLOW) | ||
61 | == val; | ||
62 | } | ||
63 | EXPORT_SYMBOL(arch_spin_trylock); | ||
64 | |||
65 | void arch_spin_unlock_wait(arch_spinlock_t *lock) | ||
66 | { | ||
67 | u32 iterations = 0; | ||
68 | while (arch_spin_is_locked(lock)) | ||
69 | delay_backoff(iterations++); | ||
70 | } | ||
71 | EXPORT_SYMBOL(arch_spin_unlock_wait); | ||
72 | |||
73 | /* | ||
74 | * If the read lock fails due to a writer, we retry periodically | ||
75 | * until the value is positive and we write our incremented reader count. | ||
76 | */ | ||
77 | void __read_lock_failed(arch_rwlock_t *rw) | ||
78 | { | ||
79 | u32 val; | ||
80 | int iterations = 0; | ||
81 | do { | ||
82 | delay_backoff(iterations++); | ||
83 | val = __insn_fetchaddgez4(&rw->lock, 1); | ||
84 | } while (unlikely(arch_write_val_locked(val))); | ||
85 | } | ||
86 | EXPORT_SYMBOL(__read_lock_failed); | ||
87 | |||
88 | /* | ||
89 | * If we failed because there were readers, clear the "writer" bit | ||
90 | * so we don't block additional readers. Otherwise, there was another | ||
91 | * writer anyway, so our "fetchor" made no difference. Then wait, | ||
92 | * issuing periodic fetchor instructions, till we get the lock. | ||
93 | */ | ||
94 | void __write_lock_failed(arch_rwlock_t *rw, u32 val) | ||
95 | { | ||
96 | int iterations = 0; | ||
97 | do { | ||
98 | if (!arch_write_val_locked(val)) | ||
99 | val = __insn_fetchand4(&rw->lock, ~__WRITE_LOCK_BIT); | ||
100 | delay_backoff(iterations++); | ||
101 | val = __insn_fetchor4(&rw->lock, __WRITE_LOCK_BIT); | ||
102 | } while (val != 0); | ||
103 | } | ||
104 | EXPORT_SYMBOL(__write_lock_failed); | ||
diff --git a/arch/tile/lib/strchr_64.c b/arch/tile/lib/strchr_64.c new file mode 100644 index 000000000000..617a9273aaa8 --- /dev/null +++ b/arch/tile/lib/strchr_64.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/module.h> | ||
18 | |||
19 | #undef strchr | ||
20 | |||
21 | char *strchr(const char *s, int c) | ||
22 | { | ||
23 | int z, g; | ||
24 | |||
25 | /* Get an aligned pointer. */ | ||
26 | const uintptr_t s_int = (uintptr_t) s; | ||
27 | const uint64_t *p = (const uint64_t *)(s_int & -8); | ||
28 | |||
29 | /* Create eight copies of the byte for which we are looking. */ | ||
30 | const uint64_t goal = 0x0101010101010101ULL * (uint8_t) c; | ||
31 | |||
32 | /* Read the first aligned word, but force bytes before the string to | ||
33 | * match neither zero nor goal (we make sure the high bit of each | ||
34 | * byte is 1, and the low 7 bits are all the opposite of the goal | ||
35 | * byte). | ||
36 | * | ||
37 | * Note that this shift count expression works because we know shift | ||
38 | * counts are taken mod 64. | ||
39 | */ | ||
40 | const uint64_t before_mask = (1ULL << (s_int << 3)) - 1; | ||
41 | uint64_t v = (*p | before_mask) ^ | ||
42 | (goal & __insn_v1shrsi(before_mask, 1)); | ||
43 | |||
44 | uint64_t zero_matches, goal_matches; | ||
45 | while (1) { | ||
46 | /* Look for a terminating '\0'. */ | ||
47 | zero_matches = __insn_v1cmpeqi(v, 0); | ||
48 | |||
49 | /* Look for the goal byte. */ | ||
50 | goal_matches = __insn_v1cmpeq(v, goal); | ||
51 | |||
52 | if (__builtin_expect((zero_matches | goal_matches) != 0, 0)) | ||
53 | break; | ||
54 | |||
55 | v = *++p; | ||
56 | } | ||
57 | |||
58 | z = __insn_ctz(zero_matches); | ||
59 | g = __insn_ctz(goal_matches); | ||
60 | |||
61 | /* If we found c before '\0' we got a match. Note that if c == '\0' | ||
62 | * then g == z, and we correctly return the address of the '\0' | ||
63 | * rather than NULL. | ||
64 | */ | ||
65 | return (g <= z) ? ((char *)p) + (g >> 3) : NULL; | ||
66 | } | ||
67 | EXPORT_SYMBOL(strchr); | ||
diff --git a/arch/tile/lib/strlen_64.c b/arch/tile/lib/strlen_64.c new file mode 100644 index 000000000000..1c92d46202a8 --- /dev/null +++ b/arch/tile/lib/strlen_64.c | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/module.h> | ||
18 | |||
19 | #undef strlen | ||
20 | |||
21 | size_t strlen(const char *s) | ||
22 | { | ||
23 | /* Get an aligned pointer. */ | ||
24 | const uintptr_t s_int = (uintptr_t) s; | ||
25 | const uint64_t *p = (const uint64_t *)(s_int & -8); | ||
26 | |||
27 | /* Read the first word, but force bytes before the string to be nonzero. | ||
28 | * This expression works because we know shift counts are taken mod 64. | ||
29 | */ | ||
30 | uint64_t v = *p | ((1ULL << (s_int << 3)) - 1); | ||
31 | |||
32 | uint64_t bits; | ||
33 | while ((bits = __insn_v1cmpeqi(v, 0)) == 0) | ||
34 | v = *++p; | ||
35 | |||
36 | return ((const char *)p) + (__insn_ctz(bits) >> 3) - s; | ||
37 | } | ||
38 | EXPORT_SYMBOL(strlen); | ||
diff --git a/arch/tile/lib/usercopy_64.S b/arch/tile/lib/usercopy_64.S new file mode 100644 index 000000000000..2ff44f87b78e --- /dev/null +++ b/arch/tile/lib/usercopy_64.S | |||
@@ -0,0 +1,196 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/linkage.h> | ||
16 | #include <asm/errno.h> | ||
17 | #include <asm/cache.h> | ||
18 | #include <arch/chip.h> | ||
19 | |||
20 | /* Access user memory, but use MMU to avoid propagating kernel exceptions. */ | ||
21 | |||
22 | .pushsection .fixup,"ax" | ||
23 | |||
24 | get_user_fault: | ||
25 | { movei r1, -EFAULT; move r0, zero } | ||
26 | jrp lr | ||
27 | ENDPROC(get_user_fault) | ||
28 | |||
29 | put_user_fault: | ||
30 | { movei r0, -EFAULT; jrp lr } | ||
31 | ENDPROC(put_user_fault) | ||
32 | |||
33 | .popsection | ||
34 | |||
35 | /* | ||
36 | * __get_user_N functions take a pointer in r0, and return 0 in r1 | ||
37 | * on success, with the value in r0; or else -EFAULT in r1. | ||
38 | */ | ||
39 | #define __get_user_N(bytes, LOAD) \ | ||
40 | STD_ENTRY(__get_user_##bytes); \ | ||
41 | 1: { LOAD r0, r0; move r1, zero }; \ | ||
42 | jrp lr; \ | ||
43 | STD_ENDPROC(__get_user_##bytes); \ | ||
44 | .pushsection __ex_table,"a"; \ | ||
45 | .quad 1b, get_user_fault; \ | ||
46 | .popsection | ||
47 | |||
48 | __get_user_N(1, ld1u) | ||
49 | __get_user_N(2, ld2u) | ||
50 | __get_user_N(4, ld4u) | ||
51 | __get_user_N(8, ld) | ||
52 | |||
53 | /* | ||
54 | * __put_user_N functions take a value in r0 and a pointer in r1, | ||
55 | * and return 0 in r0 on success or -EFAULT on failure. | ||
56 | */ | ||
57 | #define __put_user_N(bytes, STORE) \ | ||
58 | STD_ENTRY(__put_user_##bytes); \ | ||
59 | 1: { STORE r1, r0; move r0, zero }; \ | ||
60 | jrp lr; \ | ||
61 | STD_ENDPROC(__put_user_##bytes); \ | ||
62 | .pushsection __ex_table,"a"; \ | ||
63 | .quad 1b, put_user_fault; \ | ||
64 | .popsection | ||
65 | |||
66 | __put_user_N(1, st1) | ||
67 | __put_user_N(2, st2) | ||
68 | __put_user_N(4, st4) | ||
69 | __put_user_N(8, st) | ||
70 | |||
71 | /* | ||
72 | * strnlen_user_asm takes the pointer in r0, and the length bound in r1. | ||
73 | * It returns the length, including the terminating NUL, or zero on exception. | ||
74 | * If length is greater than the bound, returns one plus the bound. | ||
75 | */ | ||
76 | STD_ENTRY(strnlen_user_asm) | ||
77 | { beqz r1, 2f; addi r3, r0, -1 } /* bias down to include NUL */ | ||
78 | 1: { ld1u r4, r0; addi r1, r1, -1 } | ||
79 | beqz r4, 2f | ||
80 | { bnezt r1, 1b; addi r0, r0, 1 } | ||
81 | 2: { sub r0, r0, r3; jrp lr } | ||
82 | STD_ENDPROC(strnlen_user_asm) | ||
83 | .pushsection .fixup,"ax" | ||
84 | strnlen_user_fault: | ||
85 | { move r0, zero; jrp lr } | ||
86 | ENDPROC(strnlen_user_fault) | ||
87 | .section __ex_table,"a" | ||
88 | .quad 1b, strnlen_user_fault | ||
89 | .popsection | ||
90 | |||
91 | /* | ||
92 | * strncpy_from_user_asm takes the kernel target pointer in r0, | ||
93 | * the userspace source pointer in r1, and the length bound (including | ||
94 | * the trailing NUL) in r2. On success, it returns the string length | ||
95 | * (not including the trailing NUL), or -EFAULT on failure. | ||
96 | */ | ||
97 | STD_ENTRY(strncpy_from_user_asm) | ||
98 | { beqz r2, 2f; move r3, r0 } | ||
99 | 1: { ld1u r4, r1; addi r1, r1, 1; addi r2, r2, -1 } | ||
100 | { st1 r0, r4; addi r0, r0, 1 } | ||
101 | beqz r2, 2f | ||
102 | bnezt r4, 1b | ||
103 | addi r0, r0, -1 /* don't count the trailing NUL */ | ||
104 | 2: { sub r0, r0, r3; jrp lr } | ||
105 | STD_ENDPROC(strncpy_from_user_asm) | ||
106 | .pushsection .fixup,"ax" | ||
107 | strncpy_from_user_fault: | ||
108 | { movei r0, -EFAULT; jrp lr } | ||
109 | ENDPROC(strncpy_from_user_fault) | ||
110 | .section __ex_table,"a" | ||
111 | .quad 1b, strncpy_from_user_fault | ||
112 | .popsection | ||
113 | |||
114 | /* | ||
115 | * clear_user_asm takes the user target address in r0 and the | ||
116 | * number of bytes to zero in r1. | ||
117 | * It returns the number of uncopiable bytes (hopefully zero) in r0. | ||
118 | * Note that we don't use a separate .fixup section here since we fall | ||
119 | * through into the "fixup" code as the last straight-line bundle anyway. | ||
120 | */ | ||
121 | STD_ENTRY(clear_user_asm) | ||
122 | { beqz r1, 2f; or r2, r0, r1 } | ||
123 | andi r2, r2, 7 | ||
124 | beqzt r2, .Lclear_aligned_user_asm | ||
125 | 1: { st1 r0, zero; addi r0, r0, 1; addi r1, r1, -1 } | ||
126 | bnezt r1, 1b | ||
127 | 2: { move r0, r1; jrp lr } | ||
128 | .pushsection __ex_table,"a" | ||
129 | .quad 1b, 2b | ||
130 | .popsection | ||
131 | |||
132 | .Lclear_aligned_user_asm: | ||
133 | 1: { st r0, zero; addi r0, r0, 8; addi r1, r1, -8 } | ||
134 | bnezt r1, 1b | ||
135 | 2: { move r0, r1; jrp lr } | ||
136 | STD_ENDPROC(clear_user_asm) | ||
137 | .pushsection __ex_table,"a" | ||
138 | .quad 1b, 2b | ||
139 | .popsection | ||
140 | |||
141 | /* | ||
142 | * flush_user_asm takes the user target address in r0 and the | ||
143 | * number of bytes to flush in r1. | ||
144 | * It returns the number of unflushable bytes (hopefully zero) in r0. | ||
145 | */ | ||
146 | STD_ENTRY(flush_user_asm) | ||
147 | beqz r1, 2f | ||
148 | { movei r2, L2_CACHE_BYTES; add r1, r0, r1 } | ||
149 | { sub r2, zero, r2; addi r1, r1, L2_CACHE_BYTES-1 } | ||
150 | { and r0, r0, r2; and r1, r1, r2 } | ||
151 | { sub r1, r1, r0 } | ||
152 | 1: { flush r0; addi r1, r1, -CHIP_FLUSH_STRIDE() } | ||
153 | { addi r0, r0, CHIP_FLUSH_STRIDE(); bnezt r1, 1b } | ||
154 | 2: { move r0, r1; jrp lr } | ||
155 | STD_ENDPROC(flush_user_asm) | ||
156 | .pushsection __ex_table,"a" | ||
157 | .quad 1b, 2b | ||
158 | .popsection | ||
159 | |||
160 | /* | ||
161 | * inv_user_asm takes the user target address in r0 and the | ||
162 | * number of bytes to invalidate in r1. | ||
163 | * It returns the number of not inv'able bytes (hopefully zero) in r0. | ||
164 | */ | ||
165 | STD_ENTRY(inv_user_asm) | ||
166 | beqz r1, 2f | ||
167 | { movei r2, L2_CACHE_BYTES; add r1, r0, r1 } | ||
168 | { sub r2, zero, r2; addi r1, r1, L2_CACHE_BYTES-1 } | ||
169 | { and r0, r0, r2; and r1, r1, r2 } | ||
170 | { sub r1, r1, r0 } | ||
171 | 1: { inv r0; addi r1, r1, -CHIP_INV_STRIDE() } | ||
172 | { addi r0, r0, CHIP_INV_STRIDE(); bnezt r1, 1b } | ||
173 | 2: { move r0, r1; jrp lr } | ||
174 | STD_ENDPROC(inv_user_asm) | ||
175 | .pushsection __ex_table,"a" | ||
176 | .quad 1b, 2b | ||
177 | .popsection | ||
178 | |||
179 | /* | ||
180 | * finv_user_asm takes the user target address in r0 and the | ||
181 | * number of bytes to flush-invalidate in r1. | ||
182 | * It returns the number of not finv'able bytes (hopefully zero) in r0. | ||
183 | */ | ||
184 | STD_ENTRY(finv_user_asm) | ||
185 | beqz r1, 2f | ||
186 | { movei r2, L2_CACHE_BYTES; add r1, r0, r1 } | ||
187 | { sub r2, zero, r2; addi r1, r1, L2_CACHE_BYTES-1 } | ||
188 | { and r0, r0, r2; and r1, r1, r2 } | ||
189 | { sub r1, r1, r0 } | ||
190 | 1: { finv r0; addi r1, r1, -CHIP_FINV_STRIDE() } | ||
191 | { addi r0, r0, CHIP_FINV_STRIDE(); bnezt r1, 1b } | ||
192 | 2: { move r0, r1; jrp lr } | ||
193 | STD_ENDPROC(finv_user_asm) | ||
194 | .pushsection __ex_table,"a" | ||
195 | .quad 1b, 2b | ||
196 | .popsection | ||
diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c index 51f8663bf074..25b7b90fd620 100644 --- a/arch/tile/mm/fault.c +++ b/arch/tile/mm/fault.c | |||
@@ -43,8 +43,11 @@ | |||
43 | 43 | ||
44 | #include <arch/interrupts.h> | 44 | #include <arch/interrupts.h> |
45 | 45 | ||
46 | static noinline void force_sig_info_fault(int si_signo, int si_code, | 46 | static noinline void force_sig_info_fault(const char *type, int si_signo, |
47 | unsigned long address, int fault_num, struct task_struct *tsk) | 47 | int si_code, unsigned long address, |
48 | int fault_num, | ||
49 | struct task_struct *tsk, | ||
50 | struct pt_regs *regs) | ||
48 | { | 51 | { |
49 | siginfo_t info; | 52 | siginfo_t info; |
50 | 53 | ||
@@ -59,6 +62,7 @@ static noinline void force_sig_info_fault(int si_signo, int si_code, | |||
59 | info.si_code = si_code; | 62 | info.si_code = si_code; |
60 | info.si_addr = (void __user *)address; | 63 | info.si_addr = (void __user *)address; |
61 | info.si_trapno = fault_num; | 64 | info.si_trapno = fault_num; |
65 | trace_unhandled_signal(type, regs, address, si_signo); | ||
62 | force_sig_info(si_signo, &info, tsk); | 66 | force_sig_info(si_signo, &info, tsk); |
63 | } | 67 | } |
64 | 68 | ||
@@ -71,11 +75,12 @@ SYSCALL_DEFINE2(cmpxchg_badaddr, unsigned long, address, | |||
71 | struct pt_regs *, regs) | 75 | struct pt_regs *, regs) |
72 | { | 76 | { |
73 | if (address >= PAGE_OFFSET) | 77 | if (address >= PAGE_OFFSET) |
74 | force_sig_info_fault(SIGSEGV, SEGV_MAPERR, address, | 78 | force_sig_info_fault("atomic segfault", SIGSEGV, SEGV_MAPERR, |
75 | INT_DTLB_MISS, current); | 79 | address, INT_DTLB_MISS, current, regs); |
76 | else | 80 | else |
77 | force_sig_info_fault(SIGBUS, BUS_ADRALN, address, | 81 | force_sig_info_fault("atomic alignment fault", SIGBUS, |
78 | INT_UNALIGN_DATA, current); | 82 | BUS_ADRALN, address, |
83 | INT_UNALIGN_DATA, current, regs); | ||
79 | 84 | ||
80 | /* | 85 | /* |
81 | * Adjust pc to point at the actual instruction, which is unusual | 86 | * Adjust pc to point at the actual instruction, which is unusual |
@@ -471,8 +476,8 @@ bad_area_nosemaphore: | |||
471 | */ | 476 | */ |
472 | local_irq_enable(); | 477 | local_irq_enable(); |
473 | 478 | ||
474 | force_sig_info_fault(SIGSEGV, si_code, address, | 479 | force_sig_info_fault("segfault", SIGSEGV, si_code, address, |
475 | fault_num, tsk); | 480 | fault_num, tsk, regs); |
476 | return 0; | 481 | return 0; |
477 | } | 482 | } |
478 | 483 | ||
@@ -547,7 +552,8 @@ do_sigbus: | |||
547 | if (is_kernel_mode) | 552 | if (is_kernel_mode) |
548 | goto no_context; | 553 | goto no_context; |
549 | 554 | ||
550 | force_sig_info_fault(SIGBUS, BUS_ADRERR, address, fault_num, tsk); | 555 | force_sig_info_fault("bus error", SIGBUS, BUS_ADRERR, address, |
556 | fault_num, tsk, regs); | ||
551 | return 0; | 557 | return 0; |
552 | } | 558 | } |
553 | 559 | ||
@@ -732,6 +738,7 @@ void do_page_fault(struct pt_regs *regs, int fault_num, | |||
732 | panic("Bad fault number %d in do_page_fault", fault_num); | 738 | panic("Bad fault number %d in do_page_fault", fault_num); |
733 | } | 739 | } |
734 | 740 | ||
741 | #if CHIP_HAS_TILE_DMA() || CHIP_HAS_SN_PROC() | ||
735 | if (EX1_PL(regs->ex1) != USER_PL) { | 742 | if (EX1_PL(regs->ex1) != USER_PL) { |
736 | struct async_tlb *async; | 743 | struct async_tlb *async; |
737 | switch (fault_num) { | 744 | switch (fault_num) { |
@@ -775,6 +782,7 @@ void do_page_fault(struct pt_regs *regs, int fault_num, | |||
775 | return; | 782 | return; |
776 | } | 783 | } |
777 | } | 784 | } |
785 | #endif | ||
778 | 786 | ||
779 | handle_page_fault(regs, fault_num, is_page_fault, address, write); | 787 | handle_page_fault(regs, fault_num, is_page_fault, address, write); |
780 | } | 788 | } |
@@ -801,8 +809,6 @@ static void handle_async_page_fault(struct pt_regs *regs, | |||
801 | async->address, async->is_write); | 809 | async->address, async->is_write); |
802 | } | 810 | } |
803 | } | 811 | } |
804 | #endif /* CHIP_HAS_TILE_DMA() || CHIP_HAS_SN_PROC() */ | ||
805 | |||
806 | 812 | ||
807 | /* | 813 | /* |
808 | * This routine effectively re-issues asynchronous page faults | 814 | * This routine effectively re-issues asynchronous page faults |
@@ -824,6 +830,8 @@ void do_async_page_fault(struct pt_regs *regs) | |||
824 | handle_async_page_fault(regs, ¤t->thread.sn_async_tlb); | 830 | handle_async_page_fault(regs, ¤t->thread.sn_async_tlb); |
825 | #endif | 831 | #endif |
826 | } | 832 | } |
833 | #endif /* CHIP_HAS_TILE_DMA() || CHIP_HAS_SN_PROC() */ | ||
834 | |||
827 | 835 | ||
828 | void vmalloc_sync_all(void) | 836 | void vmalloc_sync_all(void) |
829 | { | 837 | { |
diff --git a/arch/tile/mm/migrate_64.S b/arch/tile/mm/migrate_64.S new file mode 100644 index 000000000000..e76fea688beb --- /dev/null +++ b/arch/tile/mm/migrate_64.S | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * This routine is a helper for migrating the home of a set of pages to | ||
15 | * a new cpu. See the documentation in homecache.c for more information. | ||
16 | */ | ||
17 | |||
18 | #include <linux/linkage.h> | ||
19 | #include <linux/threads.h> | ||
20 | #include <asm/page.h> | ||
21 | #include <asm/thread_info.h> | ||
22 | #include <asm/types.h> | ||
23 | #include <asm/asm-offsets.h> | ||
24 | #include <hv/hypervisor.h> | ||
25 | |||
26 | .text | ||
27 | |||
28 | /* | ||
29 | * First, some definitions that apply to all the code in the file. | ||
30 | */ | ||
31 | |||
32 | /* Locals (caller-save) */ | ||
33 | #define r_tmp r10 | ||
34 | #define r_save_sp r11 | ||
35 | |||
36 | /* What we save where in the stack frame; must include all callee-saves. */ | ||
37 | #define FRAME_SP 8 | ||
38 | #define FRAME_R30 16 | ||
39 | #define FRAME_R31 24 | ||
40 | #define FRAME_R32 32 | ||
41 | #define FRAME_R33 40 | ||
42 | #define FRAME_SIZE 48 | ||
43 | |||
44 | |||
45 | |||
46 | |||
47 | /* | ||
48 | * On entry: | ||
49 | * | ||
50 | * r0 the new context PA to install (moved to r_context) | ||
51 | * r1 PTE to use for context access (moved to r_access) | ||
52 | * r2 ASID to use for new context (moved to r_asid) | ||
53 | * r3 pointer to cpumask with just this cpu set in it (r_my_cpumask) | ||
54 | */ | ||
55 | |||
56 | /* Arguments (caller-save) */ | ||
57 | #define r_context_in r0 | ||
58 | #define r_access_in r1 | ||
59 | #define r_asid_in r2 | ||
60 | #define r_my_cpumask r3 | ||
61 | |||
62 | /* Locals (callee-save); must not be more than FRAME_xxx above. */ | ||
63 | #define r_save_ics r30 | ||
64 | #define r_context r31 | ||
65 | #define r_access r32 | ||
66 | #define r_asid r33 | ||
67 | |||
68 | /* | ||
69 | * Caller-save locals and frame constants are the same as | ||
70 | * for homecache_migrate_stack_and_flush. | ||
71 | */ | ||
72 | |||
73 | STD_ENTRY(flush_and_install_context) | ||
74 | /* | ||
75 | * Create a stack frame; we can't touch it once we flush the | ||
76 | * cache until we install the new page table and flush the TLB. | ||
77 | */ | ||
78 | { | ||
79 | move r_save_sp, sp | ||
80 | st sp, lr | ||
81 | addi sp, sp, -FRAME_SIZE | ||
82 | } | ||
83 | addi r_tmp, sp, FRAME_SP | ||
84 | { | ||
85 | st r_tmp, r_save_sp | ||
86 | addi r_tmp, sp, FRAME_R30 | ||
87 | } | ||
88 | { | ||
89 | st r_tmp, r30 | ||
90 | addi r_tmp, sp, FRAME_R31 | ||
91 | } | ||
92 | { | ||
93 | st r_tmp, r31 | ||
94 | addi r_tmp, sp, FRAME_R32 | ||
95 | } | ||
96 | { | ||
97 | st r_tmp, r32 | ||
98 | addi r_tmp, sp, FRAME_R33 | ||
99 | } | ||
100 | st r_tmp, r33 | ||
101 | |||
102 | /* Move some arguments to callee-save registers. */ | ||
103 | { | ||
104 | move r_context, r_context_in | ||
105 | move r_access, r_access_in | ||
106 | } | ||
107 | move r_asid, r_asid_in | ||
108 | |||
109 | /* Disable interrupts, since we can't use our stack. */ | ||
110 | { | ||
111 | mfspr r_save_ics, INTERRUPT_CRITICAL_SECTION | ||
112 | movei r_tmp, 1 | ||
113 | } | ||
114 | mtspr INTERRUPT_CRITICAL_SECTION, r_tmp | ||
115 | |||
116 | /* First, flush our L2 cache. */ | ||
117 | { | ||
118 | move r0, zero /* cache_pa */ | ||
119 | moveli r1, hw2_last(HV_FLUSH_EVICT_L2) /* cache_control */ | ||
120 | } | ||
121 | { | ||
122 | shl16insli r1, r1, hw1(HV_FLUSH_EVICT_L2) | ||
123 | move r2, r_my_cpumask /* cache_cpumask */ | ||
124 | } | ||
125 | { | ||
126 | shl16insli r1, r1, hw0(HV_FLUSH_EVICT_L2) | ||
127 | move r3, zero /* tlb_va */ | ||
128 | } | ||
129 | { | ||
130 | move r4, zero /* tlb_length */ | ||
131 | move r5, zero /* tlb_pgsize */ | ||
132 | } | ||
133 | { | ||
134 | move r6, zero /* tlb_cpumask */ | ||
135 | move r7, zero /* asids */ | ||
136 | } | ||
137 | { | ||
138 | move r8, zero /* asidcount */ | ||
139 | jal hv_flush_remote | ||
140 | } | ||
141 | bnez r0, 1f | ||
142 | |||
143 | /* Now install the new page table. */ | ||
144 | { | ||
145 | move r0, r_context | ||
146 | move r1, r_access | ||
147 | } | ||
148 | { | ||
149 | move r2, r_asid | ||
150 | movei r3, HV_CTX_DIRECTIO | ||
151 | } | ||
152 | jal hv_install_context | ||
153 | bnez r0, 1f | ||
154 | |||
155 | /* Finally, flush the TLB. */ | ||
156 | { | ||
157 | movei r0, 0 /* preserve_global */ | ||
158 | jal hv_flush_all | ||
159 | } | ||
160 | |||
161 | 1: /* Reset interrupts back how they were before. */ | ||
162 | mtspr INTERRUPT_CRITICAL_SECTION, r_save_ics | ||
163 | |||
164 | /* Restore the callee-saved registers and return. */ | ||
165 | addli lr, sp, FRAME_SIZE | ||
166 | { | ||
167 | ld lr, lr | ||
168 | addli r_tmp, sp, FRAME_R30 | ||
169 | } | ||
170 | { | ||
171 | ld r30, r_tmp | ||
172 | addli r_tmp, sp, FRAME_R31 | ||
173 | } | ||
174 | { | ||
175 | ld r31, r_tmp | ||
176 | addli r_tmp, sp, FRAME_R32 | ||
177 | } | ||
178 | { | ||
179 | ld r32, r_tmp | ||
180 | addli r_tmp, sp, FRAME_R33 | ||
181 | } | ||
182 | { | ||
183 | ld r33, r_tmp | ||
184 | addi sp, sp, FRAME_SIZE | ||
185 | } | ||
186 | jrp lr | ||
187 | STD_ENDPROC(flush_and_install_context) | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index fa2cc8c5d01c..483775f42d2a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -915,6 +915,7 @@ config TOSHIBA | |||
915 | 915 | ||
916 | config I8K | 916 | config I8K |
917 | tristate "Dell laptop support" | 917 | tristate "Dell laptop support" |
918 | select HWMON | ||
918 | ---help--- | 919 | ---help--- |
919 | This adds a driver to safely access the System Management Mode | 920 | This adds a driver to safely access the System Management Mode |
920 | of the CPU on the Dell Inspiron 8000. The System Management Mode | 921 | of the CPU on the Dell Inspiron 8000. The System Management Mode |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 471fdcc5df85..07371cfdfae6 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -385,25 +385,40 @@ void blkiocg_update_timeslice_used(struct blkio_group *blkg, unsigned long time, | |||
385 | 385 | ||
386 | spin_lock_irqsave(&blkg->stats_lock, flags); | 386 | spin_lock_irqsave(&blkg->stats_lock, flags); |
387 | blkg->stats.time += time; | 387 | blkg->stats.time += time; |
388 | #ifdef CONFIG_DEBUG_BLK_CGROUP | ||
388 | blkg->stats.unaccounted_time += unaccounted_time; | 389 | blkg->stats.unaccounted_time += unaccounted_time; |
390 | #endif | ||
389 | spin_unlock_irqrestore(&blkg->stats_lock, flags); | 391 | spin_unlock_irqrestore(&blkg->stats_lock, flags); |
390 | } | 392 | } |
391 | EXPORT_SYMBOL_GPL(blkiocg_update_timeslice_used); | 393 | EXPORT_SYMBOL_GPL(blkiocg_update_timeslice_used); |
392 | 394 | ||
395 | /* | ||
396 | * should be called under rcu read lock or queue lock to make sure blkg pointer | ||
397 | * is valid. | ||
398 | */ | ||
393 | void blkiocg_update_dispatch_stats(struct blkio_group *blkg, | 399 | void blkiocg_update_dispatch_stats(struct blkio_group *blkg, |
394 | uint64_t bytes, bool direction, bool sync) | 400 | uint64_t bytes, bool direction, bool sync) |
395 | { | 401 | { |
396 | struct blkio_group_stats *stats; | 402 | struct blkio_group_stats_cpu *stats_cpu; |
397 | unsigned long flags; | 403 | unsigned long flags; |
398 | 404 | ||
399 | spin_lock_irqsave(&blkg->stats_lock, flags); | 405 | /* |
400 | stats = &blkg->stats; | 406 | * Disabling interrupts to provide mutual exclusion between two |
401 | stats->sectors += bytes >> 9; | 407 | * writes on same cpu. It probably is not needed for 64bit. Not |
402 | blkio_add_stat(stats->stat_arr[BLKIO_STAT_SERVICED], 1, direction, | 408 | * optimizing that case yet. |
403 | sync); | 409 | */ |
404 | blkio_add_stat(stats->stat_arr[BLKIO_STAT_SERVICE_BYTES], bytes, | 410 | local_irq_save(flags); |
405 | direction, sync); | 411 | |
406 | spin_unlock_irqrestore(&blkg->stats_lock, flags); | 412 | stats_cpu = this_cpu_ptr(blkg->stats_cpu); |
413 | |||
414 | u64_stats_update_begin(&stats_cpu->syncp); | ||
415 | stats_cpu->sectors += bytes >> 9; | ||
416 | blkio_add_stat(stats_cpu->stat_arr_cpu[BLKIO_STAT_CPU_SERVICED], | ||
417 | 1, direction, sync); | ||
418 | blkio_add_stat(stats_cpu->stat_arr_cpu[BLKIO_STAT_CPU_SERVICE_BYTES], | ||
419 | bytes, direction, sync); | ||
420 | u64_stats_update_end(&stats_cpu->syncp); | ||
421 | local_irq_restore(flags); | ||
407 | } | 422 | } |
408 | EXPORT_SYMBOL_GPL(blkiocg_update_dispatch_stats); | 423 | EXPORT_SYMBOL_GPL(blkiocg_update_dispatch_stats); |
409 | 424 | ||
@@ -426,18 +441,44 @@ void blkiocg_update_completion_stats(struct blkio_group *blkg, | |||
426 | } | 441 | } |
427 | EXPORT_SYMBOL_GPL(blkiocg_update_completion_stats); | 442 | EXPORT_SYMBOL_GPL(blkiocg_update_completion_stats); |
428 | 443 | ||
444 | /* Merged stats are per cpu. */ | ||
429 | void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction, | 445 | void blkiocg_update_io_merged_stats(struct blkio_group *blkg, bool direction, |
430 | bool sync) | 446 | bool sync) |
431 | { | 447 | { |
448 | struct blkio_group_stats_cpu *stats_cpu; | ||
432 | unsigned long flags; | 449 | unsigned long flags; |
433 | 450 | ||
434 | spin_lock_irqsave(&blkg->stats_lock, flags); | 451 | /* |
435 | blkio_add_stat(blkg->stats.stat_arr[BLKIO_STAT_MERGED], 1, direction, | 452 | * Disabling interrupts to provide mutual exclusion between two |
436 | sync); | 453 | * writes on same cpu. It probably is not needed for 64bit. Not |
437 | spin_unlock_irqrestore(&blkg->stats_lock, flags); | 454 | * optimizing that case yet. |
455 | */ | ||
456 | local_irq_save(flags); | ||
457 | |||
458 | stats_cpu = this_cpu_ptr(blkg->stats_cpu); | ||
459 | |||
460 | u64_stats_update_begin(&stats_cpu->syncp); | ||
461 | blkio_add_stat(stats_cpu->stat_arr_cpu[BLKIO_STAT_CPU_MERGED], 1, | ||
462 | direction, sync); | ||
463 | u64_stats_update_end(&stats_cpu->syncp); | ||
464 | local_irq_restore(flags); | ||
438 | } | 465 | } |
439 | EXPORT_SYMBOL_GPL(blkiocg_update_io_merged_stats); | 466 | EXPORT_SYMBOL_GPL(blkiocg_update_io_merged_stats); |
440 | 467 | ||
468 | /* | ||
469 | * This function allocates the per cpu stats for blkio_group. Should be called | ||
470 | * from sleepable context as alloc_per_cpu() requires that. | ||
471 | */ | ||
472 | int blkio_alloc_blkg_stats(struct blkio_group *blkg) | ||
473 | { | ||
474 | /* Allocate memory for per cpu stats */ | ||
475 | blkg->stats_cpu = alloc_percpu(struct blkio_group_stats_cpu); | ||
476 | if (!blkg->stats_cpu) | ||
477 | return -ENOMEM; | ||
478 | return 0; | ||
479 | } | ||
480 | EXPORT_SYMBOL_GPL(blkio_alloc_blkg_stats); | ||
481 | |||
441 | void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, | 482 | void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, |
442 | struct blkio_group *blkg, void *key, dev_t dev, | 483 | struct blkio_group *blkg, void *key, dev_t dev, |
443 | enum blkio_policy_id plid) | 484 | enum blkio_policy_id plid) |
@@ -508,6 +549,30 @@ struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key) | |||
508 | } | 549 | } |
509 | EXPORT_SYMBOL_GPL(blkiocg_lookup_group); | 550 | EXPORT_SYMBOL_GPL(blkiocg_lookup_group); |
510 | 551 | ||
552 | static void blkio_reset_stats_cpu(struct blkio_group *blkg) | ||
553 | { | ||
554 | struct blkio_group_stats_cpu *stats_cpu; | ||
555 | int i, j, k; | ||
556 | /* | ||
557 | * Note: On 64 bit arch this should not be an issue. This has the | ||
558 | * possibility of returning some inconsistent value on 32bit arch | ||
559 | * as 64bit update on 32bit is non atomic. Taking care of this | ||
560 | * corner case makes code very complicated, like sending IPIs to | ||
561 | * cpus, taking care of stats of offline cpus etc. | ||
562 | * | ||
563 | * reset stats is anyway more of a debug feature and this sounds a | ||
564 | * corner case. So I am not complicating the code yet until and | ||
565 | * unless this becomes a real issue. | ||
566 | */ | ||
567 | for_each_possible_cpu(i) { | ||
568 | stats_cpu = per_cpu_ptr(blkg->stats_cpu, i); | ||
569 | stats_cpu->sectors = 0; | ||
570 | for(j = 0; j < BLKIO_STAT_CPU_NR; j++) | ||
571 | for (k = 0; k < BLKIO_STAT_TOTAL; k++) | ||
572 | stats_cpu->stat_arr_cpu[j][k] = 0; | ||
573 | } | ||
574 | } | ||
575 | |||
511 | static int | 576 | static int |
512 | blkiocg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, u64 val) | 577 | blkiocg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, u64 val) |
513 | { | 578 | { |
@@ -552,7 +617,11 @@ blkiocg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, u64 val) | |||
552 | } | 617 | } |
553 | #endif | 618 | #endif |
554 | spin_unlock(&blkg->stats_lock); | 619 | spin_unlock(&blkg->stats_lock); |
620 | |||
621 | /* Reset Per cpu stats which don't take blkg->stats_lock */ | ||
622 | blkio_reset_stats_cpu(blkg); | ||
555 | } | 623 | } |
624 | |||
556 | spin_unlock_irq(&blkcg->lock); | 625 | spin_unlock_irq(&blkcg->lock); |
557 | return 0; | 626 | return 0; |
558 | } | 627 | } |
@@ -598,6 +667,59 @@ static uint64_t blkio_fill_stat(char *str, int chars_left, uint64_t val, | |||
598 | return val; | 667 | return val; |
599 | } | 668 | } |
600 | 669 | ||
670 | |||
671 | static uint64_t blkio_read_stat_cpu(struct blkio_group *blkg, | ||
672 | enum stat_type_cpu type, enum stat_sub_type sub_type) | ||
673 | { | ||
674 | int cpu; | ||
675 | struct blkio_group_stats_cpu *stats_cpu; | ||
676 | u64 val = 0, tval; | ||
677 | |||
678 | for_each_possible_cpu(cpu) { | ||
679 | unsigned int start; | ||
680 | stats_cpu = per_cpu_ptr(blkg->stats_cpu, cpu); | ||
681 | |||
682 | do { | ||
683 | start = u64_stats_fetch_begin(&stats_cpu->syncp); | ||
684 | if (type == BLKIO_STAT_CPU_SECTORS) | ||
685 | tval = stats_cpu->sectors; | ||
686 | else | ||
687 | tval = stats_cpu->stat_arr_cpu[type][sub_type]; | ||
688 | } while(u64_stats_fetch_retry(&stats_cpu->syncp, start)); | ||
689 | |||
690 | val += tval; | ||
691 | } | ||
692 | |||
693 | return val; | ||
694 | } | ||
695 | |||
696 | static uint64_t blkio_get_stat_cpu(struct blkio_group *blkg, | ||
697 | struct cgroup_map_cb *cb, dev_t dev, enum stat_type_cpu type) | ||
698 | { | ||
699 | uint64_t disk_total, val; | ||
700 | char key_str[MAX_KEY_LEN]; | ||
701 | enum stat_sub_type sub_type; | ||
702 | |||
703 | if (type == BLKIO_STAT_CPU_SECTORS) { | ||
704 | val = blkio_read_stat_cpu(blkg, type, 0); | ||
705 | return blkio_fill_stat(key_str, MAX_KEY_LEN - 1, val, cb, dev); | ||
706 | } | ||
707 | |||
708 | for (sub_type = BLKIO_STAT_READ; sub_type < BLKIO_STAT_TOTAL; | ||
709 | sub_type++) { | ||
710 | blkio_get_key_name(sub_type, dev, key_str, MAX_KEY_LEN, false); | ||
711 | val = blkio_read_stat_cpu(blkg, type, sub_type); | ||
712 | cb->fill(cb, key_str, val); | ||
713 | } | ||
714 | |||
715 | disk_total = blkio_read_stat_cpu(blkg, type, BLKIO_STAT_READ) + | ||
716 | blkio_read_stat_cpu(blkg, type, BLKIO_STAT_WRITE); | ||
717 | |||
718 | blkio_get_key_name(BLKIO_STAT_TOTAL, dev, key_str, MAX_KEY_LEN, false); | ||
719 | cb->fill(cb, key_str, disk_total); | ||
720 | return disk_total; | ||
721 | } | ||
722 | |||
601 | /* This should be called with blkg->stats_lock held */ | 723 | /* This should be called with blkg->stats_lock held */ |
602 | static uint64_t blkio_get_stat(struct blkio_group *blkg, | 724 | static uint64_t blkio_get_stat(struct blkio_group *blkg, |
603 | struct cgroup_map_cb *cb, dev_t dev, enum stat_type type) | 725 | struct cgroup_map_cb *cb, dev_t dev, enum stat_type type) |
@@ -609,9 +731,6 @@ static uint64_t blkio_get_stat(struct blkio_group *blkg, | |||
609 | if (type == BLKIO_STAT_TIME) | 731 | if (type == BLKIO_STAT_TIME) |
610 | return blkio_fill_stat(key_str, MAX_KEY_LEN - 1, | 732 | return blkio_fill_stat(key_str, MAX_KEY_LEN - 1, |
611 | blkg->stats.time, cb, dev); | 733 | blkg->stats.time, cb, dev); |
612 | if (type == BLKIO_STAT_SECTORS) | ||
613 | return blkio_fill_stat(key_str, MAX_KEY_LEN - 1, | ||
614 | blkg->stats.sectors, cb, dev); | ||
615 | #ifdef CONFIG_DEBUG_BLK_CGROUP | 734 | #ifdef CONFIG_DEBUG_BLK_CGROUP |
616 | if (type == BLKIO_STAT_UNACCOUNTED_TIME) | 735 | if (type == BLKIO_STAT_UNACCOUNTED_TIME) |
617 | return blkio_fill_stat(key_str, MAX_KEY_LEN - 1, | 736 | return blkio_fill_stat(key_str, MAX_KEY_LEN - 1, |
@@ -1075,8 +1194,8 @@ static int blkiocg_file_read(struct cgroup *cgrp, struct cftype *cft, | |||
1075 | } | 1194 | } |
1076 | 1195 | ||
1077 | static int blkio_read_blkg_stats(struct blkio_cgroup *blkcg, | 1196 | static int blkio_read_blkg_stats(struct blkio_cgroup *blkcg, |
1078 | struct cftype *cft, struct cgroup_map_cb *cb, enum stat_type type, | 1197 | struct cftype *cft, struct cgroup_map_cb *cb, |
1079 | bool show_total) | 1198 | enum stat_type type, bool show_total, bool pcpu) |
1080 | { | 1199 | { |
1081 | struct blkio_group *blkg; | 1200 | struct blkio_group *blkg; |
1082 | struct hlist_node *n; | 1201 | struct hlist_node *n; |
@@ -1087,10 +1206,15 @@ static int blkio_read_blkg_stats(struct blkio_cgroup *blkcg, | |||
1087 | if (blkg->dev) { | 1206 | if (blkg->dev) { |
1088 | if (!cftype_blkg_same_policy(cft, blkg)) | 1207 | if (!cftype_blkg_same_policy(cft, blkg)) |
1089 | continue; | 1208 | continue; |
1090 | spin_lock_irq(&blkg->stats_lock); | 1209 | if (pcpu) |
1091 | cgroup_total += blkio_get_stat(blkg, cb, blkg->dev, | 1210 | cgroup_total += blkio_get_stat_cpu(blkg, cb, |
1092 | type); | 1211 | blkg->dev, type); |
1093 | spin_unlock_irq(&blkg->stats_lock); | 1212 | else { |
1213 | spin_lock_irq(&blkg->stats_lock); | ||
1214 | cgroup_total += blkio_get_stat(blkg, cb, | ||
1215 | blkg->dev, type); | ||
1216 | spin_unlock_irq(&blkg->stats_lock); | ||
1217 | } | ||
1094 | } | 1218 | } |
1095 | } | 1219 | } |
1096 | if (show_total) | 1220 | if (show_total) |
@@ -1114,47 +1238,47 @@ static int blkiocg_file_read_map(struct cgroup *cgrp, struct cftype *cft, | |||
1114 | switch(name) { | 1238 | switch(name) { |
1115 | case BLKIO_PROP_time: | 1239 | case BLKIO_PROP_time: |
1116 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1240 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1117 | BLKIO_STAT_TIME, 0); | 1241 | BLKIO_STAT_TIME, 0, 0); |
1118 | case BLKIO_PROP_sectors: | 1242 | case BLKIO_PROP_sectors: |
1119 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1243 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1120 | BLKIO_STAT_SECTORS, 0); | 1244 | BLKIO_STAT_CPU_SECTORS, 0, 1); |
1121 | case BLKIO_PROP_io_service_bytes: | 1245 | case BLKIO_PROP_io_service_bytes: |
1122 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1246 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1123 | BLKIO_STAT_SERVICE_BYTES, 1); | 1247 | BLKIO_STAT_CPU_SERVICE_BYTES, 1, 1); |
1124 | case BLKIO_PROP_io_serviced: | 1248 | case BLKIO_PROP_io_serviced: |
1125 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1249 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1126 | BLKIO_STAT_SERVICED, 1); | 1250 | BLKIO_STAT_CPU_SERVICED, 1, 1); |
1127 | case BLKIO_PROP_io_service_time: | 1251 | case BLKIO_PROP_io_service_time: |
1128 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1252 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1129 | BLKIO_STAT_SERVICE_TIME, 1); | 1253 | BLKIO_STAT_SERVICE_TIME, 1, 0); |
1130 | case BLKIO_PROP_io_wait_time: | 1254 | case BLKIO_PROP_io_wait_time: |
1131 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1255 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1132 | BLKIO_STAT_WAIT_TIME, 1); | 1256 | BLKIO_STAT_WAIT_TIME, 1, 0); |
1133 | case BLKIO_PROP_io_merged: | 1257 | case BLKIO_PROP_io_merged: |
1134 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1258 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1135 | BLKIO_STAT_MERGED, 1); | 1259 | BLKIO_STAT_CPU_MERGED, 1, 1); |
1136 | case BLKIO_PROP_io_queued: | 1260 | case BLKIO_PROP_io_queued: |
1137 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1261 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1138 | BLKIO_STAT_QUEUED, 1); | 1262 | BLKIO_STAT_QUEUED, 1, 0); |
1139 | #ifdef CONFIG_DEBUG_BLK_CGROUP | 1263 | #ifdef CONFIG_DEBUG_BLK_CGROUP |
1140 | case BLKIO_PROP_unaccounted_time: | 1264 | case BLKIO_PROP_unaccounted_time: |
1141 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1265 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1142 | BLKIO_STAT_UNACCOUNTED_TIME, 0); | 1266 | BLKIO_STAT_UNACCOUNTED_TIME, 0, 0); |
1143 | case BLKIO_PROP_dequeue: | 1267 | case BLKIO_PROP_dequeue: |
1144 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1268 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1145 | BLKIO_STAT_DEQUEUE, 0); | 1269 | BLKIO_STAT_DEQUEUE, 0, 0); |
1146 | case BLKIO_PROP_avg_queue_size: | 1270 | case BLKIO_PROP_avg_queue_size: |
1147 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1271 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1148 | BLKIO_STAT_AVG_QUEUE_SIZE, 0); | 1272 | BLKIO_STAT_AVG_QUEUE_SIZE, 0, 0); |
1149 | case BLKIO_PROP_group_wait_time: | 1273 | case BLKIO_PROP_group_wait_time: |
1150 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1274 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1151 | BLKIO_STAT_GROUP_WAIT_TIME, 0); | 1275 | BLKIO_STAT_GROUP_WAIT_TIME, 0, 0); |
1152 | case BLKIO_PROP_idle_time: | 1276 | case BLKIO_PROP_idle_time: |
1153 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1277 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1154 | BLKIO_STAT_IDLE_TIME, 0); | 1278 | BLKIO_STAT_IDLE_TIME, 0, 0); |
1155 | case BLKIO_PROP_empty_time: | 1279 | case BLKIO_PROP_empty_time: |
1156 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1280 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1157 | BLKIO_STAT_EMPTY_TIME, 0); | 1281 | BLKIO_STAT_EMPTY_TIME, 0, 0); |
1158 | #endif | 1282 | #endif |
1159 | default: | 1283 | default: |
1160 | BUG(); | 1284 | BUG(); |
@@ -1164,10 +1288,10 @@ static int blkiocg_file_read_map(struct cgroup *cgrp, struct cftype *cft, | |||
1164 | switch(name){ | 1288 | switch(name){ |
1165 | case BLKIO_THROTL_io_service_bytes: | 1289 | case BLKIO_THROTL_io_service_bytes: |
1166 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1290 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1167 | BLKIO_STAT_SERVICE_BYTES, 1); | 1291 | BLKIO_STAT_CPU_SERVICE_BYTES, 1, 1); |
1168 | case BLKIO_THROTL_io_serviced: | 1292 | case BLKIO_THROTL_io_serviced: |
1169 | return blkio_read_blkg_stats(blkcg, cft, cb, | 1293 | return blkio_read_blkg_stats(blkcg, cft, cb, |
1170 | BLKIO_STAT_SERVICED, 1); | 1294 | BLKIO_STAT_CPU_SERVICED, 1, 1); |
1171 | default: | 1295 | default: |
1172 | BUG(); | 1296 | BUG(); |
1173 | } | 1297 | } |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index c774930cc206..a71d2904ffb9 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/cgroup.h> | 16 | #include <linux/cgroup.h> |
17 | #include <linux/u64_stats_sync.h> | ||
17 | 18 | ||
18 | enum blkio_policy_id { | 19 | enum blkio_policy_id { |
19 | BLKIO_POLICY_PROP = 0, /* Proportional Bandwidth division */ | 20 | BLKIO_POLICY_PROP = 0, /* Proportional Bandwidth division */ |
@@ -36,22 +37,15 @@ enum stat_type { | |||
36 | * request completion for IOs doen by this cgroup. This may not be | 37 | * request completion for IOs doen by this cgroup. This may not be |
37 | * accurate when NCQ is turned on. */ | 38 | * accurate when NCQ is turned on. */ |
38 | BLKIO_STAT_SERVICE_TIME = 0, | 39 | BLKIO_STAT_SERVICE_TIME = 0, |
39 | /* Total bytes transferred */ | ||
40 | BLKIO_STAT_SERVICE_BYTES, | ||
41 | /* Total IOs serviced, post merge */ | ||
42 | BLKIO_STAT_SERVICED, | ||
43 | /* Total time spent waiting in scheduler queue in ns */ | 40 | /* Total time spent waiting in scheduler queue in ns */ |
44 | BLKIO_STAT_WAIT_TIME, | 41 | BLKIO_STAT_WAIT_TIME, |
45 | /* Number of IOs merged */ | ||
46 | BLKIO_STAT_MERGED, | ||
47 | /* Number of IOs queued up */ | 42 | /* Number of IOs queued up */ |
48 | BLKIO_STAT_QUEUED, | 43 | BLKIO_STAT_QUEUED, |
49 | /* All the single valued stats go below this */ | 44 | /* All the single valued stats go below this */ |
50 | BLKIO_STAT_TIME, | 45 | BLKIO_STAT_TIME, |
51 | BLKIO_STAT_SECTORS, | 46 | #ifdef CONFIG_DEBUG_BLK_CGROUP |
52 | /* Time not charged to this cgroup */ | 47 | /* Time not charged to this cgroup */ |
53 | BLKIO_STAT_UNACCOUNTED_TIME, | 48 | BLKIO_STAT_UNACCOUNTED_TIME, |
54 | #ifdef CONFIG_DEBUG_BLK_CGROUP | ||
55 | BLKIO_STAT_AVG_QUEUE_SIZE, | 49 | BLKIO_STAT_AVG_QUEUE_SIZE, |
56 | BLKIO_STAT_IDLE_TIME, | 50 | BLKIO_STAT_IDLE_TIME, |
57 | BLKIO_STAT_EMPTY_TIME, | 51 | BLKIO_STAT_EMPTY_TIME, |
@@ -60,6 +54,18 @@ enum stat_type { | |||
60 | #endif | 54 | #endif |
61 | }; | 55 | }; |
62 | 56 | ||
57 | /* Per cpu stats */ | ||
58 | enum stat_type_cpu { | ||
59 | BLKIO_STAT_CPU_SECTORS, | ||
60 | /* Total bytes transferred */ | ||
61 | BLKIO_STAT_CPU_SERVICE_BYTES, | ||
62 | /* Total IOs serviced, post merge */ | ||
63 | BLKIO_STAT_CPU_SERVICED, | ||
64 | /* Number of IOs merged */ | ||
65 | BLKIO_STAT_CPU_MERGED, | ||
66 | BLKIO_STAT_CPU_NR | ||
67 | }; | ||
68 | |||
63 | enum stat_sub_type { | 69 | enum stat_sub_type { |
64 | BLKIO_STAT_READ = 0, | 70 | BLKIO_STAT_READ = 0, |
65 | BLKIO_STAT_WRITE, | 71 | BLKIO_STAT_WRITE, |
@@ -116,11 +122,11 @@ struct blkio_cgroup { | |||
116 | struct blkio_group_stats { | 122 | struct blkio_group_stats { |
117 | /* total disk time and nr sectors dispatched by this group */ | 123 | /* total disk time and nr sectors dispatched by this group */ |
118 | uint64_t time; | 124 | uint64_t time; |
119 | uint64_t sectors; | ||
120 | /* Time not charged to this cgroup */ | ||
121 | uint64_t unaccounted_time; | ||
122 | uint64_t stat_arr[BLKIO_STAT_QUEUED + 1][BLKIO_STAT_TOTAL]; | 125 | uint64_t stat_arr[BLKIO_STAT_QUEUED + 1][BLKIO_STAT_TOTAL]; |
123 | #ifdef CONFIG_DEBUG_BLK_CGROUP | 126 | #ifdef CONFIG_DEBUG_BLK_CGROUP |
127 | /* Time not charged to this cgroup */ | ||
128 | uint64_t unaccounted_time; | ||
129 | |||
124 | /* Sum of number of IOs queued across all samples */ | 130 | /* Sum of number of IOs queued across all samples */ |
125 | uint64_t avg_queue_size_sum; | 131 | uint64_t avg_queue_size_sum; |
126 | /* Count of samples taken for average */ | 132 | /* Count of samples taken for average */ |
@@ -145,6 +151,13 @@ struct blkio_group_stats { | |||
145 | #endif | 151 | #endif |
146 | }; | 152 | }; |
147 | 153 | ||
154 | /* Per cpu blkio group stats */ | ||
155 | struct blkio_group_stats_cpu { | ||
156 | uint64_t sectors; | ||
157 | uint64_t stat_arr_cpu[BLKIO_STAT_CPU_NR][BLKIO_STAT_TOTAL]; | ||
158 | struct u64_stats_sync syncp; | ||
159 | }; | ||
160 | |||
148 | struct blkio_group { | 161 | struct blkio_group { |
149 | /* An rcu protected unique identifier for the group */ | 162 | /* An rcu protected unique identifier for the group */ |
150 | void *key; | 163 | void *key; |
@@ -160,6 +173,8 @@ struct blkio_group { | |||
160 | /* Need to serialize the stats in the case of reset/update */ | 173 | /* Need to serialize the stats in the case of reset/update */ |
161 | spinlock_t stats_lock; | 174 | spinlock_t stats_lock; |
162 | struct blkio_group_stats stats; | 175 | struct blkio_group_stats stats; |
176 | /* Per cpu stats pointer */ | ||
177 | struct blkio_group_stats_cpu __percpu *stats_cpu; | ||
163 | }; | 178 | }; |
164 | 179 | ||
165 | struct blkio_policy_node { | 180 | struct blkio_policy_node { |
@@ -295,6 +310,7 @@ extern struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk); | |||
295 | extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, | 310 | extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, |
296 | struct blkio_group *blkg, void *key, dev_t dev, | 311 | struct blkio_group *blkg, void *key, dev_t dev, |
297 | enum blkio_policy_id plid); | 312 | enum blkio_policy_id plid); |
313 | extern int blkio_alloc_blkg_stats(struct blkio_group *blkg); | ||
298 | extern int blkiocg_del_blkio_group(struct blkio_group *blkg); | 314 | extern int blkiocg_del_blkio_group(struct blkio_group *blkg); |
299 | extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, | 315 | extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, |
300 | void *key); | 316 | void *key); |
@@ -322,6 +338,8 @@ static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, | |||
322 | struct blkio_group *blkg, void *key, dev_t dev, | 338 | struct blkio_group *blkg, void *key, dev_t dev, |
323 | enum blkio_policy_id plid) {} | 339 | enum blkio_policy_id plid) {} |
324 | 340 | ||
341 | static inline int blkio_alloc_blkg_stats(struct blkio_group *blkg) { return 0; } | ||
342 | |||
325 | static inline int | 343 | static inline int |
326 | blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; } | 344 | blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; } |
327 | 345 | ||
diff --git a/block/blk-core.c b/block/blk-core.c index 3fe00a14822a..c8303e9d919d 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -569,8 +569,6 @@ int blk_get_queue(struct request_queue *q) | |||
569 | 569 | ||
570 | static inline void blk_free_request(struct request_queue *q, struct request *rq) | 570 | static inline void blk_free_request(struct request_queue *q, struct request *rq) |
571 | { | 571 | { |
572 | BUG_ON(rq->cmd_flags & REQ_ON_PLUG); | ||
573 | |||
574 | if (rq->cmd_flags & REQ_ELVPRIV) | 572 | if (rq->cmd_flags & REQ_ELVPRIV) |
575 | elv_put_request(q, rq); | 573 | elv_put_request(q, rq); |
576 | mempool_free(rq, q->rq.rq_pool); | 574 | mempool_free(rq, q->rq.rq_pool); |
@@ -1110,14 +1108,6 @@ static bool bio_attempt_back_merge(struct request_queue *q, struct request *req, | |||
1110 | { | 1108 | { |
1111 | const int ff = bio->bi_rw & REQ_FAILFAST_MASK; | 1109 | const int ff = bio->bi_rw & REQ_FAILFAST_MASK; |
1112 | 1110 | ||
1113 | /* | ||
1114 | * Debug stuff, kill later | ||
1115 | */ | ||
1116 | if (!rq_mergeable(req)) { | ||
1117 | blk_dump_rq_flags(req, "back"); | ||
1118 | return false; | ||
1119 | } | ||
1120 | |||
1121 | if (!ll_back_merge_fn(q, req, bio)) | 1111 | if (!ll_back_merge_fn(q, req, bio)) |
1122 | return false; | 1112 | return false; |
1123 | 1113 | ||
@@ -1132,6 +1122,7 @@ static bool bio_attempt_back_merge(struct request_queue *q, struct request *req, | |||
1132 | req->ioprio = ioprio_best(req->ioprio, bio_prio(bio)); | 1122 | req->ioprio = ioprio_best(req->ioprio, bio_prio(bio)); |
1133 | 1123 | ||
1134 | drive_stat_acct(req, 0); | 1124 | drive_stat_acct(req, 0); |
1125 | elv_bio_merged(q, req, bio); | ||
1135 | return true; | 1126 | return true; |
1136 | } | 1127 | } |
1137 | 1128 | ||
@@ -1141,14 +1132,6 @@ static bool bio_attempt_front_merge(struct request_queue *q, | |||
1141 | const int ff = bio->bi_rw & REQ_FAILFAST_MASK; | 1132 | const int ff = bio->bi_rw & REQ_FAILFAST_MASK; |
1142 | sector_t sector; | 1133 | sector_t sector; |
1143 | 1134 | ||
1144 | /* | ||
1145 | * Debug stuff, kill later | ||
1146 | */ | ||
1147 | if (!rq_mergeable(req)) { | ||
1148 | blk_dump_rq_flags(req, "front"); | ||
1149 | return false; | ||
1150 | } | ||
1151 | |||
1152 | if (!ll_front_merge_fn(q, req, bio)) | 1135 | if (!ll_front_merge_fn(q, req, bio)) |
1153 | return false; | 1136 | return false; |
1154 | 1137 | ||
@@ -1173,6 +1156,7 @@ static bool bio_attempt_front_merge(struct request_queue *q, | |||
1173 | req->ioprio = ioprio_best(req->ioprio, bio_prio(bio)); | 1156 | req->ioprio = ioprio_best(req->ioprio, bio_prio(bio)); |
1174 | 1157 | ||
1175 | drive_stat_acct(req, 0); | 1158 | drive_stat_acct(req, 0); |
1159 | elv_bio_merged(q, req, bio); | ||
1176 | return true; | 1160 | return true; |
1177 | } | 1161 | } |
1178 | 1162 | ||
@@ -1258,14 +1242,12 @@ static int __make_request(struct request_queue *q, struct bio *bio) | |||
1258 | 1242 | ||
1259 | el_ret = elv_merge(q, &req, bio); | 1243 | el_ret = elv_merge(q, &req, bio); |
1260 | if (el_ret == ELEVATOR_BACK_MERGE) { | 1244 | if (el_ret == ELEVATOR_BACK_MERGE) { |
1261 | BUG_ON(req->cmd_flags & REQ_ON_PLUG); | ||
1262 | if (bio_attempt_back_merge(q, req, bio)) { | 1245 | if (bio_attempt_back_merge(q, req, bio)) { |
1263 | if (!attempt_back_merge(q, req)) | 1246 | if (!attempt_back_merge(q, req)) |
1264 | elv_merged_request(q, req, el_ret); | 1247 | elv_merged_request(q, req, el_ret); |
1265 | goto out_unlock; | 1248 | goto out_unlock; |
1266 | } | 1249 | } |
1267 | } else if (el_ret == ELEVATOR_FRONT_MERGE) { | 1250 | } else if (el_ret == ELEVATOR_FRONT_MERGE) { |
1268 | BUG_ON(req->cmd_flags & REQ_ON_PLUG); | ||
1269 | if (bio_attempt_front_merge(q, req, bio)) { | 1251 | if (bio_attempt_front_merge(q, req, bio)) { |
1270 | if (!attempt_front_merge(q, req)) | 1252 | if (!attempt_front_merge(q, req)) |
1271 | elv_merged_request(q, req, el_ret); | 1253 | elv_merged_request(q, req, el_ret); |
@@ -1320,10 +1302,6 @@ get_rq: | |||
1320 | if (__rq->q != q) | 1302 | if (__rq->q != q) |
1321 | plug->should_sort = 1; | 1303 | plug->should_sort = 1; |
1322 | } | 1304 | } |
1323 | /* | ||
1324 | * Debug flag, kill later | ||
1325 | */ | ||
1326 | req->cmd_flags |= REQ_ON_PLUG; | ||
1327 | list_add_tail(&req->queuelist, &plug->list); | 1305 | list_add_tail(&req->queuelist, &plug->list); |
1328 | drive_stat_acct(req, 1); | 1306 | drive_stat_acct(req, 1); |
1329 | } else { | 1307 | } else { |
@@ -1550,7 +1528,8 @@ static inline void __generic_make_request(struct bio *bio) | |||
1550 | goto end_io; | 1528 | goto end_io; |
1551 | } | 1529 | } |
1552 | 1530 | ||
1553 | blk_throtl_bio(q, &bio); | 1531 | if (blk_throtl_bio(q, &bio)) |
1532 | goto end_io; | ||
1554 | 1533 | ||
1555 | /* | 1534 | /* |
1556 | * If bio = NULL, bio has been throttled and will be submitted | 1535 | * If bio = NULL, bio has been throttled and will be submitted |
@@ -2748,7 +2727,6 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule) | |||
2748 | while (!list_empty(&list)) { | 2727 | while (!list_empty(&list)) { |
2749 | rq = list_entry_rq(list.next); | 2728 | rq = list_entry_rq(list.next); |
2750 | list_del_init(&rq->queuelist); | 2729 | list_del_init(&rq->queuelist); |
2751 | BUG_ON(!(rq->cmd_flags & REQ_ON_PLUG)); | ||
2752 | BUG_ON(!rq->q); | 2730 | BUG_ON(!rq->q); |
2753 | if (rq->q != q) { | 2731 | if (rq->q != q) { |
2754 | /* | 2732 | /* |
@@ -2760,8 +2738,6 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule) | |||
2760 | depth = 0; | 2738 | depth = 0; |
2761 | spin_lock(q->queue_lock); | 2739 | spin_lock(q->queue_lock); |
2762 | } | 2740 | } |
2763 | rq->cmd_flags &= ~REQ_ON_PLUG; | ||
2764 | |||
2765 | /* | 2741 | /* |
2766 | * rq is already accounted, so use raw insert | 2742 | * rq is already accounted, so use raw insert |
2767 | */ | 2743 | */ |
diff --git a/block/blk-exec.c b/block/blk-exec.c index 81e31819a597..8a0e7ec056e7 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c | |||
@@ -56,7 +56,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, | |||
56 | spin_lock_irq(q->queue_lock); | 56 | spin_lock_irq(q->queue_lock); |
57 | __elv_add_request(q, rq, where); | 57 | __elv_add_request(q, rq, where); |
58 | __blk_run_queue(q); | 58 | __blk_run_queue(q); |
59 | /* the queue is stopped so it won't be plugged+unplugged */ | 59 | /* the queue is stopped so it won't be run */ |
60 | if (rq->cmd_type == REQ_TYPE_PM_RESUME) | 60 | if (rq->cmd_type == REQ_TYPE_PM_RESUME) |
61 | q->request_fn(q); | 61 | q->request_fn(q); |
62 | spin_unlock_irq(q->queue_lock); | 62 | spin_unlock_irq(q->queue_lock); |
diff --git a/block/blk-flush.c b/block/blk-flush.c index 6c9b5e189e62..bb21e4c36f70 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -212,13 +212,19 @@ static void flush_end_io(struct request *flush_rq, int error) | |||
212 | } | 212 | } |
213 | 213 | ||
214 | /* | 214 | /* |
215 | * Moving a request silently to empty queue_head may stall the | 215 | * Kick the queue to avoid stall for two cases: |
216 | * queue. Kick the queue in those cases. This function is called | 216 | * 1. Moving a request silently to empty queue_head may stall the |
217 | * from request completion path and calling directly into | 217 | * queue. |
218 | * request_fn may confuse the driver. Always use kblockd. | 218 | * 2. When flush request is running in non-queueable queue, the |
219 | * queue is hold. Restart the queue after flush request is finished | ||
220 | * to avoid stall. | ||
221 | * This function is called from request completion path and calling | ||
222 | * directly into request_fn may confuse the driver. Always use | ||
223 | * kblockd. | ||
219 | */ | 224 | */ |
220 | if (queued) | 225 | if (queued || q->flush_queue_delayed) |
221 | blk_run_queue_async(q); | 226 | blk_run_queue_async(q); |
227 | q->flush_queue_delayed = 0; | ||
222 | } | 228 | } |
223 | 229 | ||
224 | /** | 230 | /** |
diff --git a/block/blk-ioc.c b/block/blk-ioc.c index b791022beef3..c898049dafd5 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c | |||
@@ -96,6 +96,9 @@ struct io_context *alloc_io_context(gfp_t gfp_flags, int node) | |||
96 | INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); | 96 | INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); |
97 | INIT_HLIST_HEAD(&ret->cic_list); | 97 | INIT_HLIST_HEAD(&ret->cic_list); |
98 | ret->ioc_data = NULL; | 98 | ret->ioc_data = NULL; |
99 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) | ||
100 | ret->cgroup_changed = 0; | ||
101 | #endif | ||
99 | } | 102 | } |
100 | 103 | ||
101 | return ret; | 104 | return ret; |
diff --git a/block/blk-lib.c b/block/blk-lib.c index 25de73e4759b..78e627e2581d 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c | |||
@@ -9,17 +9,20 @@ | |||
9 | 9 | ||
10 | #include "blk.h" | 10 | #include "blk.h" |
11 | 11 | ||
12 | static void blkdev_discard_end_io(struct bio *bio, int err) | 12 | struct bio_batch { |
13 | { | 13 | atomic_t done; |
14 | if (err) { | 14 | unsigned long flags; |
15 | if (err == -EOPNOTSUPP) | 15 | struct completion *wait; |
16 | set_bit(BIO_EOPNOTSUPP, &bio->bi_flags); | 16 | }; |
17 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | ||
18 | } | ||
19 | 17 | ||
20 | if (bio->bi_private) | 18 | static void bio_batch_end_io(struct bio *bio, int err) |
21 | complete(bio->bi_private); | 19 | { |
20 | struct bio_batch *bb = bio->bi_private; | ||
22 | 21 | ||
22 | if (err && (err != -EOPNOTSUPP)) | ||
23 | clear_bit(BIO_UPTODATE, &bb->flags); | ||
24 | if (atomic_dec_and_test(&bb->done)) | ||
25 | complete(bb->wait); | ||
23 | bio_put(bio); | 26 | bio_put(bio); |
24 | } | 27 | } |
25 | 28 | ||
@@ -41,6 +44,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
41 | struct request_queue *q = bdev_get_queue(bdev); | 44 | struct request_queue *q = bdev_get_queue(bdev); |
42 | int type = REQ_WRITE | REQ_DISCARD; | 45 | int type = REQ_WRITE | REQ_DISCARD; |
43 | unsigned int max_discard_sectors; | 46 | unsigned int max_discard_sectors; |
47 | struct bio_batch bb; | ||
44 | struct bio *bio; | 48 | struct bio *bio; |
45 | int ret = 0; | 49 | int ret = 0; |
46 | 50 | ||
@@ -67,7 +71,11 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
67 | type |= REQ_SECURE; | 71 | type |= REQ_SECURE; |
68 | } | 72 | } |
69 | 73 | ||
70 | while (nr_sects && !ret) { | 74 | atomic_set(&bb.done, 1); |
75 | bb.flags = 1 << BIO_UPTODATE; | ||
76 | bb.wait = &wait; | ||
77 | |||
78 | while (nr_sects) { | ||
71 | bio = bio_alloc(gfp_mask, 1); | 79 | bio = bio_alloc(gfp_mask, 1); |
72 | if (!bio) { | 80 | if (!bio) { |
73 | ret = -ENOMEM; | 81 | ret = -ENOMEM; |
@@ -75,9 +83,9 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
75 | } | 83 | } |
76 | 84 | ||
77 | bio->bi_sector = sector; | 85 | bio->bi_sector = sector; |
78 | bio->bi_end_io = blkdev_discard_end_io; | 86 | bio->bi_end_io = bio_batch_end_io; |
79 | bio->bi_bdev = bdev; | 87 | bio->bi_bdev = bdev; |
80 | bio->bi_private = &wait; | 88 | bio->bi_private = &bb; |
81 | 89 | ||
82 | if (nr_sects > max_discard_sectors) { | 90 | if (nr_sects > max_discard_sectors) { |
83 | bio->bi_size = max_discard_sectors << 9; | 91 | bio->bi_size = max_discard_sectors << 9; |
@@ -88,45 +96,21 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
88 | nr_sects = 0; | 96 | nr_sects = 0; |
89 | } | 97 | } |
90 | 98 | ||
91 | bio_get(bio); | 99 | atomic_inc(&bb.done); |
92 | submit_bio(type, bio); | 100 | submit_bio(type, bio); |
101 | } | ||
93 | 102 | ||
103 | /* Wait for bios in-flight */ | ||
104 | if (!atomic_dec_and_test(&bb.done)) | ||
94 | wait_for_completion(&wait); | 105 | wait_for_completion(&wait); |
95 | 106 | ||
96 | if (bio_flagged(bio, BIO_EOPNOTSUPP)) | 107 | if (!test_bit(BIO_UPTODATE, &bb.flags)) |
97 | ret = -EOPNOTSUPP; | 108 | ret = -EIO; |
98 | else if (!bio_flagged(bio, BIO_UPTODATE)) | ||
99 | ret = -EIO; | ||
100 | bio_put(bio); | ||
101 | } | ||
102 | 109 | ||
103 | return ret; | 110 | return ret; |
104 | } | 111 | } |
105 | EXPORT_SYMBOL(blkdev_issue_discard); | 112 | EXPORT_SYMBOL(blkdev_issue_discard); |
106 | 113 | ||
107 | struct bio_batch | ||
108 | { | ||
109 | atomic_t done; | ||
110 | unsigned long flags; | ||
111 | struct completion *wait; | ||
112 | }; | ||
113 | |||
114 | static void bio_batch_end_io(struct bio *bio, int err) | ||
115 | { | ||
116 | struct bio_batch *bb = bio->bi_private; | ||
117 | |||
118 | if (err) { | ||
119 | if (err == -EOPNOTSUPP) | ||
120 | set_bit(BIO_EOPNOTSUPP, &bb->flags); | ||
121 | else | ||
122 | clear_bit(BIO_UPTODATE, &bb->flags); | ||
123 | } | ||
124 | if (bb) | ||
125 | if (atomic_dec_and_test(&bb->done)) | ||
126 | complete(bb->wait); | ||
127 | bio_put(bio); | ||
128 | } | ||
129 | |||
130 | /** | 114 | /** |
131 | * blkdev_issue_zeroout - generate number of zero filed write bios | 115 | * blkdev_issue_zeroout - generate number of zero filed write bios |
132 | * @bdev: blockdev to issue | 116 | * @bdev: blockdev to issue |
@@ -151,7 +135,6 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, | |||
151 | bb.flags = 1 << BIO_UPTODATE; | 135 | bb.flags = 1 << BIO_UPTODATE; |
152 | bb.wait = &wait; | 136 | bb.wait = &wait; |
153 | 137 | ||
154 | submit: | ||
155 | ret = 0; | 138 | ret = 0; |
156 | while (nr_sects != 0) { | 139 | while (nr_sects != 0) { |
157 | bio = bio_alloc(gfp_mask, | 140 | bio = bio_alloc(gfp_mask, |
@@ -168,9 +151,6 @@ submit: | |||
168 | 151 | ||
169 | while (nr_sects != 0) { | 152 | while (nr_sects != 0) { |
170 | sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects); | 153 | sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects); |
171 | if (sz == 0) | ||
172 | /* bio has maximum size possible */ | ||
173 | break; | ||
174 | ret = bio_add_page(bio, ZERO_PAGE(0), sz << 9, 0); | 154 | ret = bio_add_page(bio, ZERO_PAGE(0), sz << 9, 0); |
175 | nr_sects -= ret >> 9; | 155 | nr_sects -= ret >> 9; |
176 | sector += ret >> 9; | 156 | sector += ret >> 9; |
@@ -190,16 +170,6 @@ submit: | |||
190 | /* One of bios in the batch was completed with error.*/ | 170 | /* One of bios in the batch was completed with error.*/ |
191 | ret = -EIO; | 171 | ret = -EIO; |
192 | 172 | ||
193 | if (ret) | ||
194 | goto out; | ||
195 | |||
196 | if (test_bit(BIO_EOPNOTSUPP, &bb.flags)) { | ||
197 | ret = -EOPNOTSUPP; | ||
198 | goto out; | ||
199 | } | ||
200 | if (nr_sects != 0) | ||
201 | goto submit; | ||
202 | out: | ||
203 | return ret; | 173 | return ret; |
204 | } | 174 | } |
205 | EXPORT_SYMBOL(blkdev_issue_zeroout); | 175 | EXPORT_SYMBOL(blkdev_issue_zeroout); |
diff --git a/block/blk-settings.c b/block/blk-settings.c index 1fa769293597..fa1eb0449a05 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -120,7 +120,7 @@ void blk_set_default_limits(struct queue_limits *lim) | |||
120 | lim->discard_granularity = 0; | 120 | lim->discard_granularity = 0; |
121 | lim->discard_alignment = 0; | 121 | lim->discard_alignment = 0; |
122 | lim->discard_misaligned = 0; | 122 | lim->discard_misaligned = 0; |
123 | lim->discard_zeroes_data = -1; | 123 | lim->discard_zeroes_data = 1; |
124 | lim->logical_block_size = lim->physical_block_size = lim->io_min = 512; | 124 | lim->logical_block_size = lim->physical_block_size = lim->io_min = 512; |
125 | lim->bounce_pfn = (unsigned long)(BLK_BOUNCE_ANY >> PAGE_SHIFT); | 125 | lim->bounce_pfn = (unsigned long)(BLK_BOUNCE_ANY >> PAGE_SHIFT); |
126 | lim->alignment_offset = 0; | 126 | lim->alignment_offset = 0; |
@@ -166,6 +166,7 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn) | |||
166 | 166 | ||
167 | blk_set_default_limits(&q->limits); | 167 | blk_set_default_limits(&q->limits); |
168 | blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); | 168 | blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); |
169 | q->limits.discard_zeroes_data = 0; | ||
169 | 170 | ||
170 | /* | 171 | /* |
171 | * by default assume old behaviour and bounce for any highmem page | 172 | * by default assume old behaviour and bounce for any highmem page |
@@ -790,6 +791,12 @@ void blk_queue_flush(struct request_queue *q, unsigned int flush) | |||
790 | } | 791 | } |
791 | EXPORT_SYMBOL_GPL(blk_queue_flush); | 792 | EXPORT_SYMBOL_GPL(blk_queue_flush); |
792 | 793 | ||
794 | void blk_queue_flush_queueable(struct request_queue *q, bool queueable) | ||
795 | { | ||
796 | q->flush_not_queueable = !queueable; | ||
797 | } | ||
798 | EXPORT_SYMBOL_GPL(blk_queue_flush_queueable); | ||
799 | |||
793 | static int __init blk_settings_init(void) | 800 | static int __init blk_settings_init(void) |
794 | { | 801 | { |
795 | blk_max_low_pfn = max_low_pfn - 1; | 802 | blk_max_low_pfn = max_low_pfn - 1; |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index bd236313f35d..d935bd859c87 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -152,7 +152,8 @@ static ssize_t queue_discard_granularity_show(struct request_queue *q, char *pag | |||
152 | 152 | ||
153 | static ssize_t queue_discard_max_show(struct request_queue *q, char *page) | 153 | static ssize_t queue_discard_max_show(struct request_queue *q, char *page) |
154 | { | 154 | { |
155 | return queue_var_show(q->limits.max_discard_sectors << 9, page); | 155 | return sprintf(page, "%llu\n", |
156 | (unsigned long long)q->limits.max_discard_sectors << 9); | ||
156 | } | 157 | } |
157 | 158 | ||
158 | static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *page) | 159 | static ssize_t queue_discard_zeroes_data_show(struct request_queue *q, char *page) |
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 252a81a306f7..a62be8d0dc1b 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -78,6 +78,8 @@ struct throtl_grp { | |||
78 | 78 | ||
79 | /* Some throttle limits got updated for the group */ | 79 | /* Some throttle limits got updated for the group */ |
80 | int limits_changed; | 80 | int limits_changed; |
81 | |||
82 | struct rcu_head rcu_head; | ||
81 | }; | 83 | }; |
82 | 84 | ||
83 | struct throtl_data | 85 | struct throtl_data |
@@ -88,7 +90,7 @@ struct throtl_data | |||
88 | /* service tree for active throtl groups */ | 90 | /* service tree for active throtl groups */ |
89 | struct throtl_rb_root tg_service_tree; | 91 | struct throtl_rb_root tg_service_tree; |
90 | 92 | ||
91 | struct throtl_grp root_tg; | 93 | struct throtl_grp *root_tg; |
92 | struct request_queue *queue; | 94 | struct request_queue *queue; |
93 | 95 | ||
94 | /* Total Number of queued bios on READ and WRITE lists */ | 96 | /* Total Number of queued bios on READ and WRITE lists */ |
@@ -151,56 +153,44 @@ static inline struct throtl_grp *throtl_ref_get_tg(struct throtl_grp *tg) | |||
151 | return tg; | 153 | return tg; |
152 | } | 154 | } |
153 | 155 | ||
154 | static void throtl_put_tg(struct throtl_grp *tg) | 156 | static void throtl_free_tg(struct rcu_head *head) |
155 | { | 157 | { |
156 | BUG_ON(atomic_read(&tg->ref) <= 0); | 158 | struct throtl_grp *tg; |
157 | if (!atomic_dec_and_test(&tg->ref)) | 159 | |
158 | return; | 160 | tg = container_of(head, struct throtl_grp, rcu_head); |
161 | free_percpu(tg->blkg.stats_cpu); | ||
159 | kfree(tg); | 162 | kfree(tg); |
160 | } | 163 | } |
161 | 164 | ||
162 | static struct throtl_grp * throtl_find_alloc_tg(struct throtl_data *td, | 165 | static void throtl_put_tg(struct throtl_grp *tg) |
163 | struct blkio_cgroup *blkcg) | ||
164 | { | 166 | { |
165 | struct throtl_grp *tg = NULL; | 167 | BUG_ON(atomic_read(&tg->ref) <= 0); |
166 | void *key = td; | 168 | if (!atomic_dec_and_test(&tg->ref)) |
167 | struct backing_dev_info *bdi = &td->queue->backing_dev_info; | 169 | return; |
168 | unsigned int major, minor; | ||
169 | 170 | ||
170 | /* | 171 | /* |
171 | * TODO: Speed up blkiocg_lookup_group() by maintaining a radix | 172 | * A group is freed in rcu manner. But having an rcu lock does not |
172 | * tree of blkg (instead of traversing through hash list all | 173 | * mean that one can access all the fields of blkg and assume these |
173 | * the time. | 174 | * are valid. For example, don't try to follow throtl_data and |
175 | * request queue links. | ||
176 | * | ||
177 | * Having a reference to blkg under an rcu allows acess to only | ||
178 | * values local to groups like group stats and group rate limits | ||
174 | */ | 179 | */ |
180 | call_rcu(&tg->rcu_head, throtl_free_tg); | ||
181 | } | ||
175 | 182 | ||
176 | /* | 183 | static void throtl_init_group(struct throtl_grp *tg) |
177 | * This is the common case when there are no blkio cgroups. | 184 | { |
178 | * Avoid lookup in this case | ||
179 | */ | ||
180 | if (blkcg == &blkio_root_cgroup) | ||
181 | tg = &td->root_tg; | ||
182 | else | ||
183 | tg = tg_of_blkg(blkiocg_lookup_group(blkcg, key)); | ||
184 | |||
185 | /* Fill in device details for root group */ | ||
186 | if (tg && !tg->blkg.dev && bdi->dev && dev_name(bdi->dev)) { | ||
187 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); | ||
188 | tg->blkg.dev = MKDEV(major, minor); | ||
189 | goto done; | ||
190 | } | ||
191 | |||
192 | if (tg) | ||
193 | goto done; | ||
194 | |||
195 | tg = kzalloc_node(sizeof(*tg), GFP_ATOMIC, td->queue->node); | ||
196 | if (!tg) | ||
197 | goto done; | ||
198 | |||
199 | INIT_HLIST_NODE(&tg->tg_node); | 185 | INIT_HLIST_NODE(&tg->tg_node); |
200 | RB_CLEAR_NODE(&tg->rb_node); | 186 | RB_CLEAR_NODE(&tg->rb_node); |
201 | bio_list_init(&tg->bio_lists[0]); | 187 | bio_list_init(&tg->bio_lists[0]); |
202 | bio_list_init(&tg->bio_lists[1]); | 188 | bio_list_init(&tg->bio_lists[1]); |
203 | td->limits_changed = false; | 189 | tg->limits_changed = false; |
190 | |||
191 | /* Practically unlimited BW */ | ||
192 | tg->bps[0] = tg->bps[1] = -1; | ||
193 | tg->iops[0] = tg->iops[1] = -1; | ||
204 | 194 | ||
205 | /* | 195 | /* |
206 | * Take the initial reference that will be released on destroy | 196 | * Take the initial reference that will be released on destroy |
@@ -209,33 +199,181 @@ static struct throtl_grp * throtl_find_alloc_tg(struct throtl_data *td, | |||
209 | * exit or cgroup deletion path depending on who is exiting first. | 199 | * exit or cgroup deletion path depending on who is exiting first. |
210 | */ | 200 | */ |
211 | atomic_set(&tg->ref, 1); | 201 | atomic_set(&tg->ref, 1); |
202 | } | ||
203 | |||
204 | /* Should be called with rcu read lock held (needed for blkcg) */ | ||
205 | static void | ||
206 | throtl_add_group_to_td_list(struct throtl_data *td, struct throtl_grp *tg) | ||
207 | { | ||
208 | hlist_add_head(&tg->tg_node, &td->tg_list); | ||
209 | td->nr_undestroyed_grps++; | ||
210 | } | ||
211 | |||
212 | static void | ||
213 | __throtl_tg_fill_dev_details(struct throtl_data *td, struct throtl_grp *tg) | ||
214 | { | ||
215 | struct backing_dev_info *bdi = &td->queue->backing_dev_info; | ||
216 | unsigned int major, minor; | ||
217 | |||
218 | if (!tg || tg->blkg.dev) | ||
219 | return; | ||
220 | |||
221 | /* | ||
222 | * Fill in device details for a group which might not have been | ||
223 | * filled at group creation time as queue was being instantiated | ||
224 | * and driver had not attached a device yet | ||
225 | */ | ||
226 | if (bdi->dev && dev_name(bdi->dev)) { | ||
227 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); | ||
228 | tg->blkg.dev = MKDEV(major, minor); | ||
229 | } | ||
230 | } | ||
231 | |||
232 | /* | ||
233 | * Should be called with without queue lock held. Here queue lock will be | ||
234 | * taken rarely. It will be taken only once during life time of a group | ||
235 | * if need be | ||
236 | */ | ||
237 | static void | ||
238 | throtl_tg_fill_dev_details(struct throtl_data *td, struct throtl_grp *tg) | ||
239 | { | ||
240 | if (!tg || tg->blkg.dev) | ||
241 | return; | ||
242 | |||
243 | spin_lock_irq(td->queue->queue_lock); | ||
244 | __throtl_tg_fill_dev_details(td, tg); | ||
245 | spin_unlock_irq(td->queue->queue_lock); | ||
246 | } | ||
247 | |||
248 | static void throtl_init_add_tg_lists(struct throtl_data *td, | ||
249 | struct throtl_grp *tg, struct blkio_cgroup *blkcg) | ||
250 | { | ||
251 | __throtl_tg_fill_dev_details(td, tg); | ||
212 | 252 | ||
213 | /* Add group onto cgroup list */ | 253 | /* Add group onto cgroup list */ |
214 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); | ||
215 | blkiocg_add_blkio_group(blkcg, &tg->blkg, (void *)td, | 254 | blkiocg_add_blkio_group(blkcg, &tg->blkg, (void *)td, |
216 | MKDEV(major, minor), BLKIO_POLICY_THROTL); | 255 | tg->blkg.dev, BLKIO_POLICY_THROTL); |
217 | 256 | ||
218 | tg->bps[READ] = blkcg_get_read_bps(blkcg, tg->blkg.dev); | 257 | tg->bps[READ] = blkcg_get_read_bps(blkcg, tg->blkg.dev); |
219 | tg->bps[WRITE] = blkcg_get_write_bps(blkcg, tg->blkg.dev); | 258 | tg->bps[WRITE] = blkcg_get_write_bps(blkcg, tg->blkg.dev); |
220 | tg->iops[READ] = blkcg_get_read_iops(blkcg, tg->blkg.dev); | 259 | tg->iops[READ] = blkcg_get_read_iops(blkcg, tg->blkg.dev); |
221 | tg->iops[WRITE] = blkcg_get_write_iops(blkcg, tg->blkg.dev); | 260 | tg->iops[WRITE] = blkcg_get_write_iops(blkcg, tg->blkg.dev); |
222 | 261 | ||
223 | hlist_add_head(&tg->tg_node, &td->tg_list); | 262 | throtl_add_group_to_td_list(td, tg); |
224 | td->nr_undestroyed_grps++; | 263 | } |
225 | done: | 264 | |
265 | /* Should be called without queue lock and outside of rcu period */ | ||
266 | static struct throtl_grp *throtl_alloc_tg(struct throtl_data *td) | ||
267 | { | ||
268 | struct throtl_grp *tg = NULL; | ||
269 | int ret; | ||
270 | |||
271 | tg = kzalloc_node(sizeof(*tg), GFP_ATOMIC, td->queue->node); | ||
272 | if (!tg) | ||
273 | return NULL; | ||
274 | |||
275 | ret = blkio_alloc_blkg_stats(&tg->blkg); | ||
276 | |||
277 | if (ret) { | ||
278 | kfree(tg); | ||
279 | return NULL; | ||
280 | } | ||
281 | |||
282 | throtl_init_group(tg); | ||
226 | return tg; | 283 | return tg; |
227 | } | 284 | } |
228 | 285 | ||
229 | static struct throtl_grp * throtl_get_tg(struct throtl_data *td) | 286 | static struct |
287 | throtl_grp *throtl_find_tg(struct throtl_data *td, struct blkio_cgroup *blkcg) | ||
230 | { | 288 | { |
231 | struct throtl_grp *tg = NULL; | 289 | struct throtl_grp *tg = NULL; |
290 | void *key = td; | ||
291 | |||
292 | /* | ||
293 | * This is the common case when there are no blkio cgroups. | ||
294 | * Avoid lookup in this case | ||
295 | */ | ||
296 | if (blkcg == &blkio_root_cgroup) | ||
297 | tg = td->root_tg; | ||
298 | else | ||
299 | tg = tg_of_blkg(blkiocg_lookup_group(blkcg, key)); | ||
300 | |||
301 | __throtl_tg_fill_dev_details(td, tg); | ||
302 | return tg; | ||
303 | } | ||
304 | |||
305 | /* | ||
306 | * This function returns with queue lock unlocked in case of error, like | ||
307 | * request queue is no more | ||
308 | */ | ||
309 | static struct throtl_grp * throtl_get_tg(struct throtl_data *td) | ||
310 | { | ||
311 | struct throtl_grp *tg = NULL, *__tg = NULL; | ||
232 | struct blkio_cgroup *blkcg; | 312 | struct blkio_cgroup *blkcg; |
313 | struct request_queue *q = td->queue; | ||
233 | 314 | ||
234 | rcu_read_lock(); | 315 | rcu_read_lock(); |
235 | blkcg = task_blkio_cgroup(current); | 316 | blkcg = task_blkio_cgroup(current); |
236 | tg = throtl_find_alloc_tg(td, blkcg); | 317 | tg = throtl_find_tg(td, blkcg); |
237 | if (!tg) | 318 | if (tg) { |
238 | tg = &td->root_tg; | 319 | rcu_read_unlock(); |
320 | return tg; | ||
321 | } | ||
322 | |||
323 | /* | ||
324 | * Need to allocate a group. Allocation of group also needs allocation | ||
325 | * of per cpu stats which in-turn takes a mutex() and can block. Hence | ||
326 | * we need to drop rcu lock and queue_lock before we call alloc | ||
327 | * | ||
328 | * Take the request queue reference to make sure queue does not | ||
329 | * go away once we return from allocation. | ||
330 | */ | ||
331 | blk_get_queue(q); | ||
332 | rcu_read_unlock(); | ||
333 | spin_unlock_irq(q->queue_lock); | ||
334 | |||
335 | tg = throtl_alloc_tg(td); | ||
336 | /* | ||
337 | * We might have slept in group allocation. Make sure queue is not | ||
338 | * dead | ||
339 | */ | ||
340 | if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { | ||
341 | blk_put_queue(q); | ||
342 | if (tg) | ||
343 | kfree(tg); | ||
344 | |||
345 | return ERR_PTR(-ENODEV); | ||
346 | } | ||
347 | blk_put_queue(q); | ||
348 | |||
349 | /* Group allocated and queue is still alive. take the lock */ | ||
350 | spin_lock_irq(q->queue_lock); | ||
351 | |||
352 | /* | ||
353 | * Initialize the new group. After sleeping, read the blkcg again. | ||
354 | */ | ||
355 | rcu_read_lock(); | ||
356 | blkcg = task_blkio_cgroup(current); | ||
357 | |||
358 | /* | ||
359 | * If some other thread already allocated the group while we were | ||
360 | * not holding queue lock, free up the group | ||
361 | */ | ||
362 | __tg = throtl_find_tg(td, blkcg); | ||
363 | |||
364 | if (__tg) { | ||
365 | kfree(tg); | ||
366 | rcu_read_unlock(); | ||
367 | return __tg; | ||
368 | } | ||
369 | |||
370 | /* Group allocation failed. Account the IO to root group */ | ||
371 | if (!tg) { | ||
372 | tg = td->root_tg; | ||
373 | return tg; | ||
374 | } | ||
375 | |||
376 | throtl_init_add_tg_lists(td, tg, blkcg); | ||
239 | rcu_read_unlock(); | 377 | rcu_read_unlock(); |
240 | return tg; | 378 | return tg; |
241 | } | 379 | } |
@@ -544,6 +682,12 @@ static bool tg_with_in_bps_limit(struct throtl_data *td, struct throtl_grp *tg, | |||
544 | return 0; | 682 | return 0; |
545 | } | 683 | } |
546 | 684 | ||
685 | static bool tg_no_rule_group(struct throtl_grp *tg, bool rw) { | ||
686 | if (tg->bps[rw] == -1 && tg->iops[rw] == -1) | ||
687 | return 1; | ||
688 | return 0; | ||
689 | } | ||
690 | |||
547 | /* | 691 | /* |
548 | * Returns whether one can dispatch a bio or not. Also returns approx number | 692 | * Returns whether one can dispatch a bio or not. Also returns approx number |
549 | * of jiffies to wait before this bio is with-in IO rate and can be dispatched | 693 | * of jiffies to wait before this bio is with-in IO rate and can be dispatched |
@@ -608,10 +752,6 @@ static void throtl_charge_bio(struct throtl_grp *tg, struct bio *bio) | |||
608 | tg->bytes_disp[rw] += bio->bi_size; | 752 | tg->bytes_disp[rw] += bio->bi_size; |
609 | tg->io_disp[rw]++; | 753 | tg->io_disp[rw]++; |
610 | 754 | ||
611 | /* | ||
612 | * TODO: This will take blkg->stats_lock. Figure out a way | ||
613 | * to avoid this cost. | ||
614 | */ | ||
615 | blkiocg_update_dispatch_stats(&tg->blkg, bio->bi_size, rw, sync); | 755 | blkiocg_update_dispatch_stats(&tg->blkg, bio->bi_size, rw, sync); |
616 | } | 756 | } |
617 | 757 | ||
@@ -989,15 +1129,51 @@ int blk_throtl_bio(struct request_queue *q, struct bio **biop) | |||
989 | struct throtl_grp *tg; | 1129 | struct throtl_grp *tg; |
990 | struct bio *bio = *biop; | 1130 | struct bio *bio = *biop; |
991 | bool rw = bio_data_dir(bio), update_disptime = true; | 1131 | bool rw = bio_data_dir(bio), update_disptime = true; |
1132 | struct blkio_cgroup *blkcg; | ||
992 | 1133 | ||
993 | if (bio->bi_rw & REQ_THROTTLED) { | 1134 | if (bio->bi_rw & REQ_THROTTLED) { |
994 | bio->bi_rw &= ~REQ_THROTTLED; | 1135 | bio->bi_rw &= ~REQ_THROTTLED; |
995 | return 0; | 1136 | return 0; |
996 | } | 1137 | } |
997 | 1138 | ||
1139 | /* | ||
1140 | * A throtl_grp pointer retrieved under rcu can be used to access | ||
1141 | * basic fields like stats and io rates. If a group has no rules, | ||
1142 | * just update the dispatch stats in lockless manner and return. | ||
1143 | */ | ||
1144 | |||
1145 | rcu_read_lock(); | ||
1146 | blkcg = task_blkio_cgroup(current); | ||
1147 | tg = throtl_find_tg(td, blkcg); | ||
1148 | if (tg) { | ||
1149 | throtl_tg_fill_dev_details(td, tg); | ||
1150 | |||
1151 | if (tg_no_rule_group(tg, rw)) { | ||
1152 | blkiocg_update_dispatch_stats(&tg->blkg, bio->bi_size, | ||
1153 | rw, bio->bi_rw & REQ_SYNC); | ||
1154 | rcu_read_unlock(); | ||
1155 | return 0; | ||
1156 | } | ||
1157 | } | ||
1158 | rcu_read_unlock(); | ||
1159 | |||
1160 | /* | ||
1161 | * Either group has not been allocated yet or it is not an unlimited | ||
1162 | * IO group | ||
1163 | */ | ||
1164 | |||
998 | spin_lock_irq(q->queue_lock); | 1165 | spin_lock_irq(q->queue_lock); |
999 | tg = throtl_get_tg(td); | 1166 | tg = throtl_get_tg(td); |
1000 | 1167 | ||
1168 | if (IS_ERR(tg)) { | ||
1169 | if (PTR_ERR(tg) == -ENODEV) { | ||
1170 | /* | ||
1171 | * Queue is gone. No queue lock held here. | ||
1172 | */ | ||
1173 | return -ENODEV; | ||
1174 | } | ||
1175 | } | ||
1176 | |||
1001 | if (tg->nr_queued[rw]) { | 1177 | if (tg->nr_queued[rw]) { |
1002 | /* | 1178 | /* |
1003 | * There is already another bio queued in same dir. No | 1179 | * There is already another bio queued in same dir. No |
@@ -1060,39 +1236,24 @@ int blk_throtl_init(struct request_queue *q) | |||
1060 | INIT_HLIST_HEAD(&td->tg_list); | 1236 | INIT_HLIST_HEAD(&td->tg_list); |
1061 | td->tg_service_tree = THROTL_RB_ROOT; | 1237 | td->tg_service_tree = THROTL_RB_ROOT; |
1062 | td->limits_changed = false; | 1238 | td->limits_changed = false; |
1239 | INIT_DELAYED_WORK(&td->throtl_work, blk_throtl_work); | ||
1063 | 1240 | ||
1064 | /* Init root group */ | 1241 | /* alloc and Init root group. */ |
1065 | tg = &td->root_tg; | 1242 | td->queue = q; |
1066 | INIT_HLIST_NODE(&tg->tg_node); | 1243 | tg = throtl_alloc_tg(td); |
1067 | RB_CLEAR_NODE(&tg->rb_node); | ||
1068 | bio_list_init(&tg->bio_lists[0]); | ||
1069 | bio_list_init(&tg->bio_lists[1]); | ||
1070 | |||
1071 | /* Practically unlimited BW */ | ||
1072 | tg->bps[0] = tg->bps[1] = -1; | ||
1073 | tg->iops[0] = tg->iops[1] = -1; | ||
1074 | td->limits_changed = false; | ||
1075 | 1244 | ||
1076 | /* | 1245 | if (!tg) { |
1077 | * Set root group reference to 2. One reference will be dropped when | 1246 | kfree(td); |
1078 | * all groups on tg_list are being deleted during queue exit. Other | 1247 | return -ENOMEM; |
1079 | * reference will remain there as we don't want to delete this group | 1248 | } |
1080 | * as it is statically allocated and gets destroyed when throtl_data | ||
1081 | * goes away. | ||
1082 | */ | ||
1083 | atomic_set(&tg->ref, 2); | ||
1084 | hlist_add_head(&tg->tg_node, &td->tg_list); | ||
1085 | td->nr_undestroyed_grps++; | ||
1086 | 1249 | ||
1087 | INIT_DELAYED_WORK(&td->throtl_work, blk_throtl_work); | 1250 | td->root_tg = tg; |
1088 | 1251 | ||
1089 | rcu_read_lock(); | 1252 | rcu_read_lock(); |
1090 | blkiocg_add_blkio_group(&blkio_root_cgroup, &tg->blkg, (void *)td, | 1253 | throtl_init_add_tg_lists(td, tg, &blkio_root_cgroup); |
1091 | 0, BLKIO_POLICY_THROTL); | ||
1092 | rcu_read_unlock(); | 1254 | rcu_read_unlock(); |
1093 | 1255 | ||
1094 | /* Attach throtl data to request queue */ | 1256 | /* Attach throtl data to request queue */ |
1095 | td->queue = q; | ||
1096 | q->td = td; | 1257 | q->td = td; |
1097 | return 0; | 1258 | return 0; |
1098 | } | 1259 | } |
diff --git a/block/blk.h b/block/blk.h index 61263463e38e..d6586287adc9 100644 --- a/block/blk.h +++ b/block/blk.h | |||
@@ -62,7 +62,28 @@ static inline struct request *__elv_next_request(struct request_queue *q) | |||
62 | return rq; | 62 | return rq; |
63 | } | 63 | } |
64 | 64 | ||
65 | if (!q->elevator->ops->elevator_dispatch_fn(q, 0)) | 65 | /* |
66 | * Flush request is running and flush request isn't queueable | ||
67 | * in the drive, we can hold the queue till flush request is | ||
68 | * finished. Even we don't do this, driver can't dispatch next | ||
69 | * requests and will requeue them. And this can improve | ||
70 | * throughput too. For example, we have request flush1, write1, | ||
71 | * flush 2. flush1 is dispatched, then queue is hold, write1 | ||
72 | * isn't inserted to queue. After flush1 is finished, flush2 | ||
73 | * will be dispatched. Since disk cache is already clean, | ||
74 | * flush2 will be finished very soon, so looks like flush2 is | ||
75 | * folded to flush1. | ||
76 | * Since the queue is hold, a flag is set to indicate the queue | ||
77 | * should be restarted later. Please see flush_end_io() for | ||
78 | * details. | ||
79 | */ | ||
80 | if (q->flush_pending_idx != q->flush_running_idx && | ||
81 | !queue_flush_queueable(q)) { | ||
82 | q->flush_queue_delayed = 1; | ||
83 | return NULL; | ||
84 | } | ||
85 | if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags) || | ||
86 | !q->elevator->ops->elevator_dispatch_fn(q, 0)) | ||
66 | return NULL; | 87 | return NULL; |
67 | } | 88 | } |
68 | } | 89 | } |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index ab7a9e6a9b1c..7c52d6888924 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -300,7 +300,9 @@ struct cfq_data { | |||
300 | 300 | ||
301 | /* List of cfq groups being managed on this device*/ | 301 | /* List of cfq groups being managed on this device*/ |
302 | struct hlist_head cfqg_list; | 302 | struct hlist_head cfqg_list; |
303 | struct rcu_head rcu; | 303 | |
304 | /* Number of groups which are on blkcg->blkg_list */ | ||
305 | unsigned int nr_blkcg_linked_grps; | ||
304 | }; | 306 | }; |
305 | 307 | ||
306 | static struct cfq_group *cfq_get_next_cfqg(struct cfq_data *cfqd); | 308 | static struct cfq_group *cfq_get_next_cfqg(struct cfq_data *cfqd); |
@@ -665,15 +667,11 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2, | |||
665 | if (rq2 == NULL) | 667 | if (rq2 == NULL) |
666 | return rq1; | 668 | return rq1; |
667 | 669 | ||
668 | if (rq_is_sync(rq1) && !rq_is_sync(rq2)) | 670 | if (rq_is_sync(rq1) != rq_is_sync(rq2)) |
669 | return rq1; | 671 | return rq_is_sync(rq1) ? rq1 : rq2; |
670 | else if (rq_is_sync(rq2) && !rq_is_sync(rq1)) | 672 | |
671 | return rq2; | 673 | if ((rq1->cmd_flags ^ rq2->cmd_flags) & REQ_META) |
672 | if ((rq1->cmd_flags & REQ_META) && !(rq2->cmd_flags & REQ_META)) | 674 | return rq1->cmd_flags & REQ_META ? rq1 : rq2; |
673 | return rq1; | ||
674 | else if ((rq2->cmd_flags & REQ_META) && | ||
675 | !(rq1->cmd_flags & REQ_META)) | ||
676 | return rq2; | ||
677 | 675 | ||
678 | s1 = blk_rq_pos(rq1); | 676 | s1 = blk_rq_pos(rq1); |
679 | s2 = blk_rq_pos(rq2); | 677 | s2 = blk_rq_pos(rq2); |
@@ -1014,28 +1012,47 @@ void cfq_update_blkio_group_weight(void *key, struct blkio_group *blkg, | |||
1014 | cfqg->needs_update = true; | 1012 | cfqg->needs_update = true; |
1015 | } | 1013 | } |
1016 | 1014 | ||
1017 | static struct cfq_group * cfq_find_alloc_cfqg(struct cfq_data *cfqd, | 1015 | static void cfq_init_add_cfqg_lists(struct cfq_data *cfqd, |
1018 | struct blkio_cgroup *blkcg, int create) | 1016 | struct cfq_group *cfqg, struct blkio_cgroup *blkcg) |
1019 | { | 1017 | { |
1020 | struct cfq_group *cfqg = NULL; | ||
1021 | void *key = cfqd; | ||
1022 | int i, j; | ||
1023 | struct cfq_rb_root *st; | ||
1024 | struct backing_dev_info *bdi = &cfqd->queue->backing_dev_info; | 1018 | struct backing_dev_info *bdi = &cfqd->queue->backing_dev_info; |
1025 | unsigned int major, minor; | 1019 | unsigned int major, minor; |
1026 | 1020 | ||
1027 | cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key)); | 1021 | /* |
1028 | if (cfqg && !cfqg->blkg.dev && bdi->dev && dev_name(bdi->dev)) { | 1022 | * Add group onto cgroup list. It might happen that bdi->dev is |
1023 | * not initialized yet. Initialize this new group without major | ||
1024 | * and minor info and this info will be filled in once a new thread | ||
1025 | * comes for IO. | ||
1026 | */ | ||
1027 | if (bdi->dev) { | ||
1029 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); | 1028 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); |
1030 | cfqg->blkg.dev = MKDEV(major, minor); | 1029 | cfq_blkiocg_add_blkio_group(blkcg, &cfqg->blkg, |
1031 | goto done; | 1030 | (void *)cfqd, MKDEV(major, minor)); |
1032 | } | 1031 | } else |
1033 | if (cfqg || !create) | 1032 | cfq_blkiocg_add_blkio_group(blkcg, &cfqg->blkg, |
1034 | goto done; | 1033 | (void *)cfqd, 0); |
1034 | |||
1035 | cfqd->nr_blkcg_linked_grps++; | ||
1036 | cfqg->weight = blkcg_get_weight(blkcg, cfqg->blkg.dev); | ||
1037 | |||
1038 | /* Add group on cfqd list */ | ||
1039 | hlist_add_head(&cfqg->cfqd_node, &cfqd->cfqg_list); | ||
1040 | } | ||
1041 | |||
1042 | /* | ||
1043 | * Should be called from sleepable context. No request queue lock as per | ||
1044 | * cpu stats are allocated dynamically and alloc_percpu needs to be called | ||
1045 | * from sleepable context. | ||
1046 | */ | ||
1047 | static struct cfq_group * cfq_alloc_cfqg(struct cfq_data *cfqd) | ||
1048 | { | ||
1049 | struct cfq_group *cfqg = NULL; | ||
1050 | int i, j, ret; | ||
1051 | struct cfq_rb_root *st; | ||
1035 | 1052 | ||
1036 | cfqg = kzalloc_node(sizeof(*cfqg), GFP_ATOMIC, cfqd->queue->node); | 1053 | cfqg = kzalloc_node(sizeof(*cfqg), GFP_ATOMIC, cfqd->queue->node); |
1037 | if (!cfqg) | 1054 | if (!cfqg) |
1038 | goto done; | 1055 | return NULL; |
1039 | 1056 | ||
1040 | for_each_cfqg_st(cfqg, i, j, st) | 1057 | for_each_cfqg_st(cfqg, i, j, st) |
1041 | *st = CFQ_RB_ROOT; | 1058 | *st = CFQ_RB_ROOT; |
@@ -1049,43 +1066,94 @@ static struct cfq_group * cfq_find_alloc_cfqg(struct cfq_data *cfqd, | |||
1049 | */ | 1066 | */ |
1050 | cfqg->ref = 1; | 1067 | cfqg->ref = 1; |
1051 | 1068 | ||
1069 | ret = blkio_alloc_blkg_stats(&cfqg->blkg); | ||
1070 | if (ret) { | ||
1071 | kfree(cfqg); | ||
1072 | return NULL; | ||
1073 | } | ||
1074 | |||
1075 | return cfqg; | ||
1076 | } | ||
1077 | |||
1078 | static struct cfq_group * | ||
1079 | cfq_find_cfqg(struct cfq_data *cfqd, struct blkio_cgroup *blkcg) | ||
1080 | { | ||
1081 | struct cfq_group *cfqg = NULL; | ||
1082 | void *key = cfqd; | ||
1083 | struct backing_dev_info *bdi = &cfqd->queue->backing_dev_info; | ||
1084 | unsigned int major, minor; | ||
1085 | |||
1052 | /* | 1086 | /* |
1053 | * Add group onto cgroup list. It might happen that bdi->dev is | 1087 | * This is the common case when there are no blkio cgroups. |
1054 | * not initialized yet. Initialize this new group without major | 1088 | * Avoid lookup in this case |
1055 | * and minor info and this info will be filled in once a new thread | ||
1056 | * comes for IO. See code above. | ||
1057 | */ | 1089 | */ |
1058 | if (bdi->dev) { | 1090 | if (blkcg == &blkio_root_cgroup) |
1059 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); | 1091 | cfqg = &cfqd->root_group; |
1060 | cfq_blkiocg_add_blkio_group(blkcg, &cfqg->blkg, (void *)cfqd, | 1092 | else |
1061 | MKDEV(major, minor)); | 1093 | cfqg = cfqg_of_blkg(blkiocg_lookup_group(blkcg, key)); |
1062 | } else | ||
1063 | cfq_blkiocg_add_blkio_group(blkcg, &cfqg->blkg, (void *)cfqd, | ||
1064 | 0); | ||
1065 | |||
1066 | cfqg->weight = blkcg_get_weight(blkcg, cfqg->blkg.dev); | ||
1067 | 1094 | ||
1068 | /* Add group on cfqd list */ | 1095 | if (cfqg && !cfqg->blkg.dev && bdi->dev && dev_name(bdi->dev)) { |
1069 | hlist_add_head(&cfqg->cfqd_node, &cfqd->cfqg_list); | 1096 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); |
1097 | cfqg->blkg.dev = MKDEV(major, minor); | ||
1098 | } | ||
1070 | 1099 | ||
1071 | done: | ||
1072 | return cfqg; | 1100 | return cfqg; |
1073 | } | 1101 | } |
1074 | 1102 | ||
1075 | /* | 1103 | /* |
1076 | * Search for the cfq group current task belongs to. If create = 1, then also | 1104 | * Search for the cfq group current task belongs to. request_queue lock must |
1077 | * create the cfq group if it does not exist. request_queue lock must be held. | 1105 | * be held. |
1078 | */ | 1106 | */ |
1079 | static struct cfq_group *cfq_get_cfqg(struct cfq_data *cfqd, int create) | 1107 | static struct cfq_group *cfq_get_cfqg(struct cfq_data *cfqd) |
1080 | { | 1108 | { |
1081 | struct blkio_cgroup *blkcg; | 1109 | struct blkio_cgroup *blkcg; |
1082 | struct cfq_group *cfqg = NULL; | 1110 | struct cfq_group *cfqg = NULL, *__cfqg = NULL; |
1111 | struct request_queue *q = cfqd->queue; | ||
1083 | 1112 | ||
1084 | rcu_read_lock(); | 1113 | rcu_read_lock(); |
1085 | blkcg = task_blkio_cgroup(current); | 1114 | blkcg = task_blkio_cgroup(current); |
1086 | cfqg = cfq_find_alloc_cfqg(cfqd, blkcg, create); | 1115 | cfqg = cfq_find_cfqg(cfqd, blkcg); |
1087 | if (!cfqg && create) | 1116 | if (cfqg) { |
1117 | rcu_read_unlock(); | ||
1118 | return cfqg; | ||
1119 | } | ||
1120 | |||
1121 | /* | ||
1122 | * Need to allocate a group. Allocation of group also needs allocation | ||
1123 | * of per cpu stats which in-turn takes a mutex() and can block. Hence | ||
1124 | * we need to drop rcu lock and queue_lock before we call alloc. | ||
1125 | * | ||
1126 | * Not taking any queue reference here and assuming that queue is | ||
1127 | * around by the time we return. CFQ queue allocation code does | ||
1128 | * the same. It might be racy though. | ||
1129 | */ | ||
1130 | |||
1131 | rcu_read_unlock(); | ||
1132 | spin_unlock_irq(q->queue_lock); | ||
1133 | |||
1134 | cfqg = cfq_alloc_cfqg(cfqd); | ||
1135 | |||
1136 | spin_lock_irq(q->queue_lock); | ||
1137 | |||
1138 | rcu_read_lock(); | ||
1139 | blkcg = task_blkio_cgroup(current); | ||
1140 | |||
1141 | /* | ||
1142 | * If some other thread already allocated the group while we were | ||
1143 | * not holding queue lock, free up the group | ||
1144 | */ | ||
1145 | __cfqg = cfq_find_cfqg(cfqd, blkcg); | ||
1146 | |||
1147 | if (__cfqg) { | ||
1148 | kfree(cfqg); | ||
1149 | rcu_read_unlock(); | ||
1150 | return __cfqg; | ||
1151 | } | ||
1152 | |||
1153 | if (!cfqg) | ||
1088 | cfqg = &cfqd->root_group; | 1154 | cfqg = &cfqd->root_group; |
1155 | |||
1156 | cfq_init_add_cfqg_lists(cfqd, cfqg, blkcg); | ||
1089 | rcu_read_unlock(); | 1157 | rcu_read_unlock(); |
1090 | return cfqg; | 1158 | return cfqg; |
1091 | } | 1159 | } |
@@ -1118,6 +1186,7 @@ static void cfq_put_cfqg(struct cfq_group *cfqg) | |||
1118 | return; | 1186 | return; |
1119 | for_each_cfqg_st(cfqg, i, j, st) | 1187 | for_each_cfqg_st(cfqg, i, j, st) |
1120 | BUG_ON(!RB_EMPTY_ROOT(&st->rb)); | 1188 | BUG_ON(!RB_EMPTY_ROOT(&st->rb)); |
1189 | free_percpu(cfqg->blkg.stats_cpu); | ||
1121 | kfree(cfqg); | 1190 | kfree(cfqg); |
1122 | } | 1191 | } |
1123 | 1192 | ||
@@ -1176,7 +1245,7 @@ void cfq_unlink_blkio_group(void *key, struct blkio_group *blkg) | |||
1176 | } | 1245 | } |
1177 | 1246 | ||
1178 | #else /* GROUP_IOSCHED */ | 1247 | #else /* GROUP_IOSCHED */ |
1179 | static struct cfq_group *cfq_get_cfqg(struct cfq_data *cfqd, int create) | 1248 | static struct cfq_group *cfq_get_cfqg(struct cfq_data *cfqd) |
1180 | { | 1249 | { |
1181 | return &cfqd->root_group; | 1250 | return &cfqd->root_group; |
1182 | } | 1251 | } |
@@ -1210,7 +1279,6 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1210 | struct cfq_rb_root *service_tree; | 1279 | struct cfq_rb_root *service_tree; |
1211 | int left; | 1280 | int left; |
1212 | int new_cfqq = 1; | 1281 | int new_cfqq = 1; |
1213 | int group_changed = 0; | ||
1214 | 1282 | ||
1215 | service_tree = service_tree_for(cfqq->cfqg, cfqq_prio(cfqq), | 1283 | service_tree = service_tree_for(cfqq->cfqg, cfqq_prio(cfqq), |
1216 | cfqq_type(cfqq)); | 1284 | cfqq_type(cfqq)); |
@@ -1281,7 +1349,7 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1281 | rb_link_node(&cfqq->rb_node, parent, p); | 1349 | rb_link_node(&cfqq->rb_node, parent, p); |
1282 | rb_insert_color(&cfqq->rb_node, &service_tree->rb); | 1350 | rb_insert_color(&cfqq->rb_node, &service_tree->rb); |
1283 | service_tree->count++; | 1351 | service_tree->count++; |
1284 | if ((add_front || !new_cfqq) && !group_changed) | 1352 | if (add_front || !new_cfqq) |
1285 | return; | 1353 | return; |
1286 | cfq_group_notify_queue_add(cfqd, cfqq->cfqg); | 1354 | cfq_group_notify_queue_add(cfqd, cfqq->cfqg); |
1287 | } | 1355 | } |
@@ -2029,7 +2097,7 @@ cfq_prio_to_maxrq(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
2029 | 2097 | ||
2030 | WARN_ON(cfqq->ioprio >= IOPRIO_BE_NR); | 2098 | WARN_ON(cfqq->ioprio >= IOPRIO_BE_NR); |
2031 | 2099 | ||
2032 | return 2 * (base_rq + base_rq * (CFQ_PRIO_LISTS - 1 - cfqq->ioprio)); | 2100 | return 2 * base_rq * (IOPRIO_BE_NR - cfqq->ioprio); |
2033 | } | 2101 | } |
2034 | 2102 | ||
2035 | /* | 2103 | /* |
@@ -2911,7 +2979,7 @@ cfq_find_alloc_queue(struct cfq_data *cfqd, bool is_sync, | |||
2911 | struct cfq_group *cfqg; | 2979 | struct cfq_group *cfqg; |
2912 | 2980 | ||
2913 | retry: | 2981 | retry: |
2914 | cfqg = cfq_get_cfqg(cfqd, 1); | 2982 | cfqg = cfq_get_cfqg(cfqd); |
2915 | cic = cfq_cic_lookup(cfqd, ioc); | 2983 | cic = cfq_cic_lookup(cfqd, ioc); |
2916 | /* cic always exists here */ | 2984 | /* cic always exists here */ |
2917 | cfqq = cic_to_cfqq(cic, is_sync); | 2985 | cfqq = cic_to_cfqq(cic, is_sync); |
@@ -3815,15 +3883,11 @@ static void cfq_put_async_queues(struct cfq_data *cfqd) | |||
3815 | cfq_put_queue(cfqd->async_idle_cfqq); | 3883 | cfq_put_queue(cfqd->async_idle_cfqq); |
3816 | } | 3884 | } |
3817 | 3885 | ||
3818 | static void cfq_cfqd_free(struct rcu_head *head) | ||
3819 | { | ||
3820 | kfree(container_of(head, struct cfq_data, rcu)); | ||
3821 | } | ||
3822 | |||
3823 | static void cfq_exit_queue(struct elevator_queue *e) | 3886 | static void cfq_exit_queue(struct elevator_queue *e) |
3824 | { | 3887 | { |
3825 | struct cfq_data *cfqd = e->elevator_data; | 3888 | struct cfq_data *cfqd = e->elevator_data; |
3826 | struct request_queue *q = cfqd->queue; | 3889 | struct request_queue *q = cfqd->queue; |
3890 | bool wait = false; | ||
3827 | 3891 | ||
3828 | cfq_shutdown_timer_wq(cfqd); | 3892 | cfq_shutdown_timer_wq(cfqd); |
3829 | 3893 | ||
@@ -3842,7 +3906,13 @@ static void cfq_exit_queue(struct elevator_queue *e) | |||
3842 | 3906 | ||
3843 | cfq_put_async_queues(cfqd); | 3907 | cfq_put_async_queues(cfqd); |
3844 | cfq_release_cfq_groups(cfqd); | 3908 | cfq_release_cfq_groups(cfqd); |
3845 | cfq_blkiocg_del_blkio_group(&cfqd->root_group.blkg); | 3909 | |
3910 | /* | ||
3911 | * If there are groups which we could not unlink from blkcg list, | ||
3912 | * wait for a rcu period for them to be freed. | ||
3913 | */ | ||
3914 | if (cfqd->nr_blkcg_linked_grps) | ||
3915 | wait = true; | ||
3846 | 3916 | ||
3847 | spin_unlock_irq(q->queue_lock); | 3917 | spin_unlock_irq(q->queue_lock); |
3848 | 3918 | ||
@@ -3852,8 +3922,25 @@ static void cfq_exit_queue(struct elevator_queue *e) | |||
3852 | ida_remove(&cic_index_ida, cfqd->cic_index); | 3922 | ida_remove(&cic_index_ida, cfqd->cic_index); |
3853 | spin_unlock(&cic_index_lock); | 3923 | spin_unlock(&cic_index_lock); |
3854 | 3924 | ||
3855 | /* Wait for cfqg->blkg->key accessors to exit their grace periods. */ | 3925 | /* |
3856 | call_rcu(&cfqd->rcu, cfq_cfqd_free); | 3926 | * Wait for cfqg->blkg->key accessors to exit their grace periods. |
3927 | * Do this wait only if there are other unlinked groups out | ||
3928 | * there. This can happen if cgroup deletion path claimed the | ||
3929 | * responsibility of cleaning up a group before queue cleanup code | ||
3930 | * get to the group. | ||
3931 | * | ||
3932 | * Do not call synchronize_rcu() unconditionally as there are drivers | ||
3933 | * which create/delete request queue hundreds of times during scan/boot | ||
3934 | * and synchronize_rcu() can take significant time and slow down boot. | ||
3935 | */ | ||
3936 | if (wait) | ||
3937 | synchronize_rcu(); | ||
3938 | |||
3939 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | ||
3940 | /* Free up per cpu stats for root group */ | ||
3941 | free_percpu(cfqd->root_group.blkg.stats_cpu); | ||
3942 | #endif | ||
3943 | kfree(cfqd); | ||
3857 | } | 3944 | } |
3858 | 3945 | ||
3859 | static int cfq_alloc_cic_index(void) | 3946 | static int cfq_alloc_cic_index(void) |
@@ -3886,8 +3973,12 @@ static void *cfq_init_queue(struct request_queue *q) | |||
3886 | return NULL; | 3973 | return NULL; |
3887 | 3974 | ||
3888 | cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node); | 3975 | cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node); |
3889 | if (!cfqd) | 3976 | if (!cfqd) { |
3977 | spin_lock(&cic_index_lock); | ||
3978 | ida_remove(&cic_index_ida, i); | ||
3979 | spin_unlock(&cic_index_lock); | ||
3890 | return NULL; | 3980 | return NULL; |
3981 | } | ||
3891 | 3982 | ||
3892 | /* | 3983 | /* |
3893 | * Don't need take queue_lock in the routine, since we are | 3984 | * Don't need take queue_lock in the routine, since we are |
@@ -3909,14 +4000,29 @@ static void *cfq_init_queue(struct request_queue *q) | |||
3909 | 4000 | ||
3910 | #ifdef CONFIG_CFQ_GROUP_IOSCHED | 4001 | #ifdef CONFIG_CFQ_GROUP_IOSCHED |
3911 | /* | 4002 | /* |
3912 | * Take a reference to root group which we never drop. This is just | 4003 | * Set root group reference to 2. One reference will be dropped when |
3913 | * to make sure that cfq_put_cfqg() does not try to kfree root group | 4004 | * all groups on cfqd->cfqg_list are being deleted during queue exit. |
4005 | * Other reference will remain there as we don't want to delete this | ||
4006 | * group as it is statically allocated and gets destroyed when | ||
4007 | * throtl_data goes away. | ||
3914 | */ | 4008 | */ |
3915 | cfqg->ref = 1; | 4009 | cfqg->ref = 2; |
4010 | |||
4011 | if (blkio_alloc_blkg_stats(&cfqg->blkg)) { | ||
4012 | kfree(cfqg); | ||
4013 | kfree(cfqd); | ||
4014 | return NULL; | ||
4015 | } | ||
4016 | |||
3916 | rcu_read_lock(); | 4017 | rcu_read_lock(); |
4018 | |||
3917 | cfq_blkiocg_add_blkio_group(&blkio_root_cgroup, &cfqg->blkg, | 4019 | cfq_blkiocg_add_blkio_group(&blkio_root_cgroup, &cfqg->blkg, |
3918 | (void *)cfqd, 0); | 4020 | (void *)cfqd, 0); |
3919 | rcu_read_unlock(); | 4021 | rcu_read_unlock(); |
4022 | cfqd->nr_blkcg_linked_grps++; | ||
4023 | |||
4024 | /* Add group on cfqd->cfqg_list */ | ||
4025 | hlist_add_head(&cfqg->cfqd_node, &cfqd->cfqg_list); | ||
3920 | #endif | 4026 | #endif |
3921 | /* | 4027 | /* |
3922 | * Not strictly needed (since RB_ROOT just clears the node and we | 4028 | * Not strictly needed (since RB_ROOT just clears the node and we |
diff --git a/block/elevator.c b/block/elevator.c index 45ca1e34f582..b0b38ce0dcb6 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -155,13 +155,8 @@ static struct elevator_type *elevator_get(const char *name) | |||
155 | 155 | ||
156 | e = elevator_find(name); | 156 | e = elevator_find(name); |
157 | if (!e) { | 157 | if (!e) { |
158 | char elv[ELV_NAME_MAX + strlen("-iosched")]; | ||
159 | |||
160 | spin_unlock(&elv_list_lock); | 158 | spin_unlock(&elv_list_lock); |
161 | 159 | request_module("%s-iosched", name); | |
162 | snprintf(elv, sizeof(elv), "%s-iosched", name); | ||
163 | |||
164 | request_module("%s", elv); | ||
165 | spin_lock(&elv_list_lock); | 160 | spin_lock(&elv_list_lock); |
166 | e = elevator_find(name); | 161 | e = elevator_find(name); |
167 | } | 162 | } |
@@ -421,8 +416,6 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq) | |||
421 | struct list_head *entry; | 416 | struct list_head *entry; |
422 | int stop_flags; | 417 | int stop_flags; |
423 | 418 | ||
424 | BUG_ON(rq->cmd_flags & REQ_ON_PLUG); | ||
425 | |||
426 | if (q->last_merge == rq) | 419 | if (q->last_merge == rq) |
427 | q->last_merge = NULL; | 420 | q->last_merge = NULL; |
428 | 421 | ||
@@ -661,8 +654,6 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) | |||
661 | 654 | ||
662 | rq->q = q; | 655 | rq->q = q; |
663 | 656 | ||
664 | BUG_ON(rq->cmd_flags & REQ_ON_PLUG); | ||
665 | |||
666 | if (rq->cmd_flags & REQ_SOFTBARRIER) { | 657 | if (rq->cmd_flags & REQ_SOFTBARRIER) { |
667 | /* barriers are scheduling boundary, update end_sector */ | 658 | /* barriers are scheduling boundary, update end_sector */ |
668 | if (rq->cmd_type == REQ_TYPE_FS || | 659 | if (rq->cmd_type == REQ_TYPE_FS || |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 3a17ca5fff6f..bc2218db5ba9 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -73,17 +73,6 @@ config ACPI_PROCFS_POWER | |||
73 | 73 | ||
74 | Say N to delete power /proc/acpi/ directories that have moved to /sys/ | 74 | Say N to delete power /proc/acpi/ directories that have moved to /sys/ |
75 | 75 | ||
76 | config ACPI_POWER_METER | ||
77 | tristate "ACPI 4.0 power meter" | ||
78 | depends on HWMON | ||
79 | help | ||
80 | This driver exposes ACPI 4.0 power meters as hardware monitoring | ||
81 | devices. Say Y (or M) if you have a computer with ACPI 4.0 firmware | ||
82 | and a power meter. | ||
83 | |||
84 | To compile this driver as a module, choose M here: | ||
85 | the module will be called power-meter. | ||
86 | |||
87 | config ACPI_EC_DEBUGFS | 76 | config ACPI_EC_DEBUGFS |
88 | tristate "EC read/write access through /sys/kernel/debug/ec" | 77 | tristate "EC read/write access through /sys/kernel/debug/ec" |
89 | default n | 78 | default n |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index d113fa5100b2..b66fbb2fc85f 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -59,7 +59,6 @@ obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o | |||
59 | obj-$(CONFIG_ACPI_BATTERY) += battery.o | 59 | obj-$(CONFIG_ACPI_BATTERY) += battery.o |
60 | obj-$(CONFIG_ACPI_SBS) += sbshc.o | 60 | obj-$(CONFIG_ACPI_SBS) += sbshc.o |
61 | obj-$(CONFIG_ACPI_SBS) += sbs.o | 61 | obj-$(CONFIG_ACPI_SBS) += sbs.o |
62 | obj-$(CONFIG_ACPI_POWER_METER) += power_meter.o | ||
63 | obj-$(CONFIG_ACPI_HED) += hed.o | 62 | obj-$(CONFIG_ACPI_HED) += hed.o |
64 | obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o | 63 | obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o |
65 | 64 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 30ea95f43e79..d51f9795c064 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1089,21 +1089,21 @@ static int atapi_drain_needed(struct request *rq) | |||
1089 | static int ata_scsi_dev_config(struct scsi_device *sdev, | 1089 | static int ata_scsi_dev_config(struct scsi_device *sdev, |
1090 | struct ata_device *dev) | 1090 | struct ata_device *dev) |
1091 | { | 1091 | { |
1092 | struct request_queue *q = sdev->request_queue; | ||
1093 | |||
1092 | if (!ata_id_has_unload(dev->id)) | 1094 | if (!ata_id_has_unload(dev->id)) |
1093 | dev->flags |= ATA_DFLAG_NO_UNLOAD; | 1095 | dev->flags |= ATA_DFLAG_NO_UNLOAD; |
1094 | 1096 | ||
1095 | /* configure max sectors */ | 1097 | /* configure max sectors */ |
1096 | blk_queue_max_hw_sectors(sdev->request_queue, dev->max_sectors); | 1098 | blk_queue_max_hw_sectors(q, dev->max_sectors); |
1097 | 1099 | ||
1098 | if (dev->class == ATA_DEV_ATAPI) { | 1100 | if (dev->class == ATA_DEV_ATAPI) { |
1099 | struct request_queue *q = sdev->request_queue; | ||
1100 | void *buf; | 1101 | void *buf; |
1101 | 1102 | ||
1102 | sdev->sector_size = ATA_SECT_SIZE; | 1103 | sdev->sector_size = ATA_SECT_SIZE; |
1103 | 1104 | ||
1104 | /* set DMA padding */ | 1105 | /* set DMA padding */ |
1105 | blk_queue_update_dma_pad(sdev->request_queue, | 1106 | blk_queue_update_dma_pad(q, ATA_DMA_PAD_SZ - 1); |
1106 | ATA_DMA_PAD_SZ - 1); | ||
1107 | 1107 | ||
1108 | /* configure draining */ | 1108 | /* configure draining */ |
1109 | buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL); | 1109 | buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL); |
@@ -1131,8 +1131,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
1131 | "sector_size=%u > PAGE_SIZE, PIO may malfunction\n", | 1131 | "sector_size=%u > PAGE_SIZE, PIO may malfunction\n", |
1132 | sdev->sector_size); | 1132 | sdev->sector_size); |
1133 | 1133 | ||
1134 | blk_queue_update_dma_alignment(sdev->request_queue, | 1134 | blk_queue_update_dma_alignment(q, sdev->sector_size - 1); |
1135 | sdev->sector_size - 1); | ||
1136 | 1135 | ||
1137 | if (dev->flags & ATA_DFLAG_AN) | 1136 | if (dev->flags & ATA_DFLAG_AN) |
1138 | set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); | 1137 | set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); |
@@ -1145,6 +1144,8 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
1145 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); | 1144 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); |
1146 | } | 1145 | } |
1147 | 1146 | ||
1147 | blk_queue_flush_queueable(q, false); | ||
1148 | |||
1148 | dev->sdev = sdev; | 1149 | dev->sdev = sdev; |
1149 | return 0; | 1150 | return 0; |
1150 | } | 1151 | } |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 83c32cb72582..717d6e4e18d3 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -470,6 +470,27 @@ config XEN_BLKDEV_FRONTEND | |||
470 | block device driver. It communicates with a back-end driver | 470 | block device driver. It communicates with a back-end driver |
471 | in another domain which drives the actual block device. | 471 | in another domain which drives the actual block device. |
472 | 472 | ||
473 | config XEN_BLKDEV_BACKEND | ||
474 | tristate "Block-device backend driver" | ||
475 | depends on XEN_BACKEND | ||
476 | help | ||
477 | The block-device backend driver allows the kernel to export its | ||
478 | block devices to other guests via a high-performance shared-memory | ||
479 | interface. | ||
480 | |||
481 | The corresponding Linux frontend driver is enabled by the | ||
482 | CONFIG_XEN_BLKDEV_FRONTEND configuration option. | ||
483 | |||
484 | The backend driver attaches itself to a any block device specified | ||
485 | in the XenBus configuration. There are no limits to what the block | ||
486 | device as long as it has a major and minor. | ||
487 | |||
488 | If you are compiling a kernel to run in a Xen block backend driver | ||
489 | domain (often this is domain 0) you should say Y here. To | ||
490 | compile this driver as a module, chose M here: the module | ||
491 | will be called xen-blkback. | ||
492 | |||
493 | |||
473 | config VIRTIO_BLK | 494 | config VIRTIO_BLK |
474 | tristate "Virtio block driver (EXPERIMENTAL)" | 495 | tristate "Virtio block driver (EXPERIMENTAL)" |
475 | depends on EXPERIMENTAL && VIRTIO | 496 | depends on EXPERIMENTAL && VIRTIO |
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 40528ba56d1b..76646e9a1c91 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile | |||
@@ -36,6 +36,7 @@ obj-$(CONFIG_BLK_DEV_UB) += ub.o | |||
36 | obj-$(CONFIG_BLK_DEV_HD) += hd.o | 36 | obj-$(CONFIG_BLK_DEV_HD) += hd.o |
37 | 37 | ||
38 | obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o | 38 | obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o |
39 | obj-$(CONFIG_XEN_BLKDEV_BACKEND) += xen-blkback/ | ||
39 | obj-$(CONFIG_BLK_DEV_DRBD) += drbd/ | 40 | obj-$(CONFIG_BLK_DEV_DRBD) += drbd/ |
40 | obj-$(CONFIG_BLK_DEV_RBD) += rbd.o | 41 | obj-$(CONFIG_BLK_DEV_RBD) += rbd.o |
41 | 42 | ||
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 9bf13988f1a2..8f4ef656a1af 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -64,6 +64,10 @@ MODULE_DESCRIPTION("Driver for HP Smart Array Controllers"); | |||
64 | MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers"); | 64 | MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers"); |
65 | MODULE_VERSION("3.6.26"); | 65 | MODULE_VERSION("3.6.26"); |
66 | MODULE_LICENSE("GPL"); | 66 | MODULE_LICENSE("GPL"); |
67 | static int cciss_tape_cmds = 6; | ||
68 | module_param(cciss_tape_cmds, int, 0644); | ||
69 | MODULE_PARM_DESC(cciss_tape_cmds, | ||
70 | "number of commands to allocate for tape devices (default: 6)"); | ||
67 | 71 | ||
68 | static DEFINE_MUTEX(cciss_mutex); | 72 | static DEFINE_MUTEX(cciss_mutex); |
69 | static struct proc_dir_entry *proc_cciss; | 73 | static struct proc_dir_entry *proc_cciss; |
@@ -194,6 +198,8 @@ static int __devinit cciss_find_cfg_addrs(struct pci_dev *pdev, | |||
194 | static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev, | 198 | static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev, |
195 | unsigned long *memory_bar); | 199 | unsigned long *memory_bar); |
196 | static inline u32 cciss_tag_discard_error_bits(ctlr_info_t *h, u32 tag); | 200 | static inline u32 cciss_tag_discard_error_bits(ctlr_info_t *h, u32 tag); |
201 | static __devinit int write_driver_ver_to_cfgtable( | ||
202 | CfgTable_struct __iomem *cfgtable); | ||
197 | 203 | ||
198 | /* performant mode helper functions */ | 204 | /* performant mode helper functions */ |
199 | static void calc_bucket_map(int *bucket, int num_buckets, int nsgs, | 205 | static void calc_bucket_map(int *bucket, int num_buckets, int nsgs, |
@@ -556,7 +562,7 @@ static void __devinit cciss_procinit(ctlr_info_t *h) | |||
556 | #define to_hba(n) container_of(n, struct ctlr_info, dev) | 562 | #define to_hba(n) container_of(n, struct ctlr_info, dev) |
557 | #define to_drv(n) container_of(n, drive_info_struct, dev) | 563 | #define to_drv(n) container_of(n, drive_info_struct, dev) |
558 | 564 | ||
559 | /* List of controllers which cannot be reset on kexec with reset_devices */ | 565 | /* List of controllers which cannot be hard reset on kexec with reset_devices */ |
560 | static u32 unresettable_controller[] = { | 566 | static u32 unresettable_controller[] = { |
561 | 0x324a103C, /* Smart Array P712m */ | 567 | 0x324a103C, /* Smart Array P712m */ |
562 | 0x324b103C, /* SmartArray P711m */ | 568 | 0x324b103C, /* SmartArray P711m */ |
@@ -574,23 +580,45 @@ static u32 unresettable_controller[] = { | |||
574 | 0x409D0E11, /* Smart Array 6400 EM */ | 580 | 0x409D0E11, /* Smart Array 6400 EM */ |
575 | }; | 581 | }; |
576 | 582 | ||
577 | static int ctlr_is_resettable(struct ctlr_info *h) | 583 | /* List of controllers which cannot even be soft reset */ |
584 | static u32 soft_unresettable_controller[] = { | ||
585 | 0x409C0E11, /* Smart Array 6400 */ | ||
586 | 0x409D0E11, /* Smart Array 6400 EM */ | ||
587 | }; | ||
588 | |||
589 | static int ctlr_is_hard_resettable(u32 board_id) | ||
578 | { | 590 | { |
579 | int i; | 591 | int i; |
580 | 592 | ||
581 | for (i = 0; i < ARRAY_SIZE(unresettable_controller); i++) | 593 | for (i = 0; i < ARRAY_SIZE(unresettable_controller); i++) |
582 | if (unresettable_controller[i] == h->board_id) | 594 | if (unresettable_controller[i] == board_id) |
583 | return 0; | 595 | return 0; |
584 | return 1; | 596 | return 1; |
585 | } | 597 | } |
586 | 598 | ||
599 | static int ctlr_is_soft_resettable(u32 board_id) | ||
600 | { | ||
601 | int i; | ||
602 | |||
603 | for (i = 0; i < ARRAY_SIZE(soft_unresettable_controller); i++) | ||
604 | if (soft_unresettable_controller[i] == board_id) | ||
605 | return 0; | ||
606 | return 1; | ||
607 | } | ||
608 | |||
609 | static int ctlr_is_resettable(u32 board_id) | ||
610 | { | ||
611 | return ctlr_is_hard_resettable(board_id) || | ||
612 | ctlr_is_soft_resettable(board_id); | ||
613 | } | ||
614 | |||
587 | static ssize_t host_show_resettable(struct device *dev, | 615 | static ssize_t host_show_resettable(struct device *dev, |
588 | struct device_attribute *attr, | 616 | struct device_attribute *attr, |
589 | char *buf) | 617 | char *buf) |
590 | { | 618 | { |
591 | struct ctlr_info *h = to_hba(dev); | 619 | struct ctlr_info *h = to_hba(dev); |
592 | 620 | ||
593 | return snprintf(buf, 20, "%d\n", ctlr_is_resettable(h)); | 621 | return snprintf(buf, 20, "%d\n", ctlr_is_resettable(h->board_id)); |
594 | } | 622 | } |
595 | static DEVICE_ATTR(resettable, S_IRUGO, host_show_resettable, NULL); | 623 | static DEVICE_ATTR(resettable, S_IRUGO, host_show_resettable, NULL); |
596 | 624 | ||
@@ -2567,7 +2595,7 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff, | |||
2567 | } | 2595 | } |
2568 | } else if (cmd_type == TYPE_MSG) { | 2596 | } else if (cmd_type == TYPE_MSG) { |
2569 | switch (cmd) { | 2597 | switch (cmd) { |
2570 | case 0: /* ABORT message */ | 2598 | case CCISS_ABORT_MSG: |
2571 | c->Request.CDBLen = 12; | 2599 | c->Request.CDBLen = 12; |
2572 | c->Request.Type.Attribute = ATTR_SIMPLE; | 2600 | c->Request.Type.Attribute = ATTR_SIMPLE; |
2573 | c->Request.Type.Direction = XFER_WRITE; | 2601 | c->Request.Type.Direction = XFER_WRITE; |
@@ -2577,16 +2605,16 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff, | |||
2577 | /* buff contains the tag of the command to abort */ | 2605 | /* buff contains the tag of the command to abort */ |
2578 | memcpy(&c->Request.CDB[4], buff, 8); | 2606 | memcpy(&c->Request.CDB[4], buff, 8); |
2579 | break; | 2607 | break; |
2580 | case 1: /* RESET message */ | 2608 | case CCISS_RESET_MSG: |
2581 | c->Request.CDBLen = 16; | 2609 | c->Request.CDBLen = 16; |
2582 | c->Request.Type.Attribute = ATTR_SIMPLE; | 2610 | c->Request.Type.Attribute = ATTR_SIMPLE; |
2583 | c->Request.Type.Direction = XFER_NONE; | 2611 | c->Request.Type.Direction = XFER_NONE; |
2584 | c->Request.Timeout = 0; | 2612 | c->Request.Timeout = 0; |
2585 | memset(&c->Request.CDB[0], 0, sizeof(c->Request.CDB)); | 2613 | memset(&c->Request.CDB[0], 0, sizeof(c->Request.CDB)); |
2586 | c->Request.CDB[0] = cmd; /* reset */ | 2614 | c->Request.CDB[0] = cmd; /* reset */ |
2587 | c->Request.CDB[1] = 0x03; /* reset a target */ | 2615 | c->Request.CDB[1] = CCISS_RESET_TYPE_TARGET; |
2588 | break; | 2616 | break; |
2589 | case 3: /* No-Op message */ | 2617 | case CCISS_NOOP_MSG: |
2590 | c->Request.CDBLen = 1; | 2618 | c->Request.CDBLen = 1; |
2591 | c->Request.Type.Attribute = ATTR_SIMPLE; | 2619 | c->Request.Type.Attribute = ATTR_SIMPLE; |
2592 | c->Request.Type.Direction = XFER_WRITE; | 2620 | c->Request.Type.Direction = XFER_WRITE; |
@@ -2615,6 +2643,31 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff, | |||
2615 | return status; | 2643 | return status; |
2616 | } | 2644 | } |
2617 | 2645 | ||
2646 | static int __devinit cciss_send_reset(ctlr_info_t *h, unsigned char *scsi3addr, | ||
2647 | u8 reset_type) | ||
2648 | { | ||
2649 | CommandList_struct *c; | ||
2650 | int return_status; | ||
2651 | |||
2652 | c = cmd_alloc(h); | ||
2653 | if (!c) | ||
2654 | return -ENOMEM; | ||
2655 | return_status = fill_cmd(h, c, CCISS_RESET_MSG, NULL, 0, 0, | ||
2656 | CTLR_LUNID, TYPE_MSG); | ||
2657 | c->Request.CDB[1] = reset_type; /* fill_cmd defaults to target reset */ | ||
2658 | if (return_status != IO_OK) { | ||
2659 | cmd_special_free(h, c); | ||
2660 | return return_status; | ||
2661 | } | ||
2662 | c->waiting = NULL; | ||
2663 | enqueue_cmd_and_start_io(h, c); | ||
2664 | /* Don't wait for completion, the reset won't complete. Don't free | ||
2665 | * the command either. This is the last command we will send before | ||
2666 | * re-initializing everything, so it doesn't matter and won't leak. | ||
2667 | */ | ||
2668 | return 0; | ||
2669 | } | ||
2670 | |||
2618 | static int check_target_status(ctlr_info_t *h, CommandList_struct *c) | 2671 | static int check_target_status(ctlr_info_t *h, CommandList_struct *c) |
2619 | { | 2672 | { |
2620 | switch (c->err_info->ScsiStatus) { | 2673 | switch (c->err_info->ScsiStatus) { |
@@ -3461,6 +3514,63 @@ static inline u32 process_nonindexed_cmd(ctlr_info_t *h, u32 raw_tag) | |||
3461 | return next_command(h); | 3514 | return next_command(h); |
3462 | } | 3515 | } |
3463 | 3516 | ||
3517 | /* Some controllers, like p400, will give us one interrupt | ||
3518 | * after a soft reset, even if we turned interrupts off. | ||
3519 | * Only need to check for this in the cciss_xxx_discard_completions | ||
3520 | * functions. | ||
3521 | */ | ||
3522 | static int ignore_bogus_interrupt(ctlr_info_t *h) | ||
3523 | { | ||
3524 | if (likely(!reset_devices)) | ||
3525 | return 0; | ||
3526 | |||
3527 | if (likely(h->interrupts_enabled)) | ||
3528 | return 0; | ||
3529 | |||
3530 | dev_info(&h->pdev->dev, "Received interrupt while interrupts disabled " | ||
3531 | "(known firmware bug.) Ignoring.\n"); | ||
3532 | |||
3533 | return 1; | ||
3534 | } | ||
3535 | |||
3536 | static irqreturn_t cciss_intx_discard_completions(int irq, void *dev_id) | ||
3537 | { | ||
3538 | ctlr_info_t *h = dev_id; | ||
3539 | unsigned long flags; | ||
3540 | u32 raw_tag; | ||
3541 | |||
3542 | if (ignore_bogus_interrupt(h)) | ||
3543 | return IRQ_NONE; | ||
3544 | |||
3545 | if (interrupt_not_for_us(h)) | ||
3546 | return IRQ_NONE; | ||
3547 | spin_lock_irqsave(&h->lock, flags); | ||
3548 | while (interrupt_pending(h)) { | ||
3549 | raw_tag = get_next_completion(h); | ||
3550 | while (raw_tag != FIFO_EMPTY) | ||
3551 | raw_tag = next_command(h); | ||
3552 | } | ||
3553 | spin_unlock_irqrestore(&h->lock, flags); | ||
3554 | return IRQ_HANDLED; | ||
3555 | } | ||
3556 | |||
3557 | static irqreturn_t cciss_msix_discard_completions(int irq, void *dev_id) | ||
3558 | { | ||
3559 | ctlr_info_t *h = dev_id; | ||
3560 | unsigned long flags; | ||
3561 | u32 raw_tag; | ||
3562 | |||
3563 | if (ignore_bogus_interrupt(h)) | ||
3564 | return IRQ_NONE; | ||
3565 | |||
3566 | spin_lock_irqsave(&h->lock, flags); | ||
3567 | raw_tag = get_next_completion(h); | ||
3568 | while (raw_tag != FIFO_EMPTY) | ||
3569 | raw_tag = next_command(h); | ||
3570 | spin_unlock_irqrestore(&h->lock, flags); | ||
3571 | return IRQ_HANDLED; | ||
3572 | } | ||
3573 | |||
3464 | static irqreturn_t do_cciss_intx(int irq, void *dev_id) | 3574 | static irqreturn_t do_cciss_intx(int irq, void *dev_id) |
3465 | { | 3575 | { |
3466 | ctlr_info_t *h = dev_id; | 3576 | ctlr_info_t *h = dev_id; |
@@ -4078,6 +4188,9 @@ static int __devinit cciss_find_cfgtables(ctlr_info_t *h) | |||
4078 | cfg_base_addr_index) + cfg_offset, sizeof(h->cfgtable)); | 4188 | cfg_base_addr_index) + cfg_offset, sizeof(h->cfgtable)); |
4079 | if (!h->cfgtable) | 4189 | if (!h->cfgtable) |
4080 | return -ENOMEM; | 4190 | return -ENOMEM; |
4191 | rc = write_driver_ver_to_cfgtable(h->cfgtable); | ||
4192 | if (rc) | ||
4193 | return rc; | ||
4081 | /* Find performant mode table. */ | 4194 | /* Find performant mode table. */ |
4082 | trans_offset = readl(&h->cfgtable->TransMethodOffset); | 4195 | trans_offset = readl(&h->cfgtable->TransMethodOffset); |
4083 | h->transtable = remap_pci_mem(pci_resource_start(h->pdev, | 4196 | h->transtable = remap_pci_mem(pci_resource_start(h->pdev, |
@@ -4112,7 +4225,7 @@ static void __devinit cciss_get_max_perf_mode_cmds(struct ctlr_info *h) | |||
4112 | static void __devinit cciss_find_board_params(ctlr_info_t *h) | 4225 | static void __devinit cciss_find_board_params(ctlr_info_t *h) |
4113 | { | 4226 | { |
4114 | cciss_get_max_perf_mode_cmds(h); | 4227 | cciss_get_max_perf_mode_cmds(h); |
4115 | h->nr_cmds = h->max_commands - 4; /* Allow room for some ioctls */ | 4228 | h->nr_cmds = h->max_commands - 4 - cciss_tape_cmds; |
4116 | h->maxsgentries = readl(&(h->cfgtable->MaxSGElements)); | 4229 | h->maxsgentries = readl(&(h->cfgtable->MaxSGElements)); |
4117 | /* | 4230 | /* |
4118 | * Limit in-command s/g elements to 32 save dma'able memory. | 4231 | * Limit in-command s/g elements to 32 save dma'able memory. |
@@ -4348,7 +4461,7 @@ static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, u | |||
4348 | tag = readl(vaddr + SA5_REPLY_PORT_OFFSET); | 4461 | tag = readl(vaddr + SA5_REPLY_PORT_OFFSET); |
4349 | if ((tag & ~3) == paddr32) | 4462 | if ((tag & ~3) == paddr32) |
4350 | break; | 4463 | break; |
4351 | schedule_timeout_uninterruptible(HZ); | 4464 | msleep(CCISS_POST_RESET_NOOP_TIMEOUT_MSECS); |
4352 | } | 4465 | } |
4353 | 4466 | ||
4354 | iounmap(vaddr); | 4467 | iounmap(vaddr); |
@@ -4375,11 +4488,10 @@ static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, u | |||
4375 | return 0; | 4488 | return 0; |
4376 | } | 4489 | } |
4377 | 4490 | ||
4378 | #define cciss_soft_reset_controller(p) cciss_message(p, 1, 0) | ||
4379 | #define cciss_noop(p) cciss_message(p, 3, 0) | 4491 | #define cciss_noop(p) cciss_message(p, 3, 0) |
4380 | 4492 | ||
4381 | static int cciss_controller_hard_reset(struct pci_dev *pdev, | 4493 | static int cciss_controller_hard_reset(struct pci_dev *pdev, |
4382 | void * __iomem vaddr, bool use_doorbell) | 4494 | void * __iomem vaddr, u32 use_doorbell) |
4383 | { | 4495 | { |
4384 | u16 pmcsr; | 4496 | u16 pmcsr; |
4385 | int pos; | 4497 | int pos; |
@@ -4390,8 +4502,7 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev, | |||
4390 | * other way using the doorbell register. | 4502 | * other way using the doorbell register. |
4391 | */ | 4503 | */ |
4392 | dev_info(&pdev->dev, "using doorbell to reset controller\n"); | 4504 | dev_info(&pdev->dev, "using doorbell to reset controller\n"); |
4393 | writel(DOORBELL_CTLR_RESET, vaddr + SA5_DOORBELL); | 4505 | writel(use_doorbell, vaddr + SA5_DOORBELL); |
4394 | msleep(1000); | ||
4395 | } else { /* Try to do it the PCI power state way */ | 4506 | } else { /* Try to do it the PCI power state way */ |
4396 | 4507 | ||
4397 | /* Quoting from the Open CISS Specification: "The Power | 4508 | /* Quoting from the Open CISS Specification: "The Power |
@@ -4422,12 +4533,64 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev, | |||
4422 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; | 4533 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; |
4423 | pmcsr |= PCI_D0; | 4534 | pmcsr |= PCI_D0; |
4424 | pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr); | 4535 | pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr); |
4425 | |||
4426 | msleep(500); | ||
4427 | } | 4536 | } |
4428 | return 0; | 4537 | return 0; |
4429 | } | 4538 | } |
4430 | 4539 | ||
4540 | static __devinit void init_driver_version(char *driver_version, int len) | ||
4541 | { | ||
4542 | memset(driver_version, 0, len); | ||
4543 | strncpy(driver_version, "cciss " DRIVER_NAME, len - 1); | ||
4544 | } | ||
4545 | |||
4546 | static __devinit int write_driver_ver_to_cfgtable( | ||
4547 | CfgTable_struct __iomem *cfgtable) | ||
4548 | { | ||
4549 | char *driver_version; | ||
4550 | int i, size = sizeof(cfgtable->driver_version); | ||
4551 | |||
4552 | driver_version = kmalloc(size, GFP_KERNEL); | ||
4553 | if (!driver_version) | ||
4554 | return -ENOMEM; | ||
4555 | |||
4556 | init_driver_version(driver_version, size); | ||
4557 | for (i = 0; i < size; i++) | ||
4558 | writeb(driver_version[i], &cfgtable->driver_version[i]); | ||
4559 | kfree(driver_version); | ||
4560 | return 0; | ||
4561 | } | ||
4562 | |||
4563 | static __devinit void read_driver_ver_from_cfgtable( | ||
4564 | CfgTable_struct __iomem *cfgtable, unsigned char *driver_ver) | ||
4565 | { | ||
4566 | int i; | ||
4567 | |||
4568 | for (i = 0; i < sizeof(cfgtable->driver_version); i++) | ||
4569 | driver_ver[i] = readb(&cfgtable->driver_version[i]); | ||
4570 | } | ||
4571 | |||
4572 | static __devinit int controller_reset_failed( | ||
4573 | CfgTable_struct __iomem *cfgtable) | ||
4574 | { | ||
4575 | |||
4576 | char *driver_ver, *old_driver_ver; | ||
4577 | int rc, size = sizeof(cfgtable->driver_version); | ||
4578 | |||
4579 | old_driver_ver = kmalloc(2 * size, GFP_KERNEL); | ||
4580 | if (!old_driver_ver) | ||
4581 | return -ENOMEM; | ||
4582 | driver_ver = old_driver_ver + size; | ||
4583 | |||
4584 | /* After a reset, the 32 bytes of "driver version" in the cfgtable | ||
4585 | * should have been changed, otherwise we know the reset failed. | ||
4586 | */ | ||
4587 | init_driver_version(old_driver_ver, size); | ||
4588 | read_driver_ver_from_cfgtable(cfgtable, driver_ver); | ||
4589 | rc = !memcmp(driver_ver, old_driver_ver, size); | ||
4590 | kfree(old_driver_ver); | ||
4591 | return rc; | ||
4592 | } | ||
4593 | |||
4431 | /* This does a hard reset of the controller using PCI power management | 4594 | /* This does a hard reset of the controller using PCI power management |
4432 | * states or using the doorbell register. */ | 4595 | * states or using the doorbell register. */ |
4433 | static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) | 4596 | static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) |
@@ -4437,10 +4600,10 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) | |||
4437 | u64 cfg_base_addr_index; | 4600 | u64 cfg_base_addr_index; |
4438 | void __iomem *vaddr; | 4601 | void __iomem *vaddr; |
4439 | unsigned long paddr; | 4602 | unsigned long paddr; |
4440 | u32 misc_fw_support, active_transport; | 4603 | u32 misc_fw_support; |
4441 | int rc; | 4604 | int rc; |
4442 | CfgTable_struct __iomem *cfgtable; | 4605 | CfgTable_struct __iomem *cfgtable; |
4443 | bool use_doorbell; | 4606 | u32 use_doorbell; |
4444 | u32 board_id; | 4607 | u32 board_id; |
4445 | u16 command_register; | 4608 | u16 command_register; |
4446 | 4609 | ||
@@ -4464,12 +4627,16 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) | |||
4464 | * likely not be happy. Just forbid resetting this conjoined mess. | 4627 | * likely not be happy. Just forbid resetting this conjoined mess. |
4465 | */ | 4628 | */ |
4466 | cciss_lookup_board_id(pdev, &board_id); | 4629 | cciss_lookup_board_id(pdev, &board_id); |
4467 | if (board_id == 0x409C0E11 || board_id == 0x409D0E11) { | 4630 | if (!ctlr_is_resettable(board_id)) { |
4468 | dev_warn(&pdev->dev, "Cannot reset Smart Array 640x " | 4631 | dev_warn(&pdev->dev, "Cannot reset Smart Array 640x " |
4469 | "due to shared cache module."); | 4632 | "due to shared cache module."); |
4470 | return -ENODEV; | 4633 | return -ENODEV; |
4471 | } | 4634 | } |
4472 | 4635 | ||
4636 | /* if controller is soft- but not hard resettable... */ | ||
4637 | if (!ctlr_is_hard_resettable(board_id)) | ||
4638 | return -ENOTSUPP; /* try soft reset later. */ | ||
4639 | |||
4473 | /* Save the PCI command register */ | 4640 | /* Save the PCI command register */ |
4474 | pci_read_config_word(pdev, 4, &command_register); | 4641 | pci_read_config_word(pdev, 4, &command_register); |
4475 | /* Turn the board off. This is so that later pci_restore_state() | 4642 | /* Turn the board off. This is so that later pci_restore_state() |
@@ -4497,16 +4664,28 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) | |||
4497 | rc = -ENOMEM; | 4664 | rc = -ENOMEM; |
4498 | goto unmap_vaddr; | 4665 | goto unmap_vaddr; |
4499 | } | 4666 | } |
4667 | rc = write_driver_ver_to_cfgtable(cfgtable); | ||
4668 | if (rc) | ||
4669 | goto unmap_vaddr; | ||
4500 | 4670 | ||
4501 | /* If reset via doorbell register is supported, use that. */ | 4671 | /* If reset via doorbell register is supported, use that. |
4502 | misc_fw_support = readl(&cfgtable->misc_fw_support); | 4672 | * There are two such methods. Favor the newest method. |
4503 | use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET; | ||
4504 | |||
4505 | /* The doorbell reset seems to cause lockups on some Smart | ||
4506 | * Arrays (e.g. P410, P410i, maybe others). Until this is | ||
4507 | * fixed or at least isolated, avoid the doorbell reset. | ||
4508 | */ | 4673 | */ |
4509 | use_doorbell = 0; | 4674 | misc_fw_support = readl(&cfgtable->misc_fw_support); |
4675 | use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET2; | ||
4676 | if (use_doorbell) { | ||
4677 | use_doorbell = DOORBELL_CTLR_RESET2; | ||
4678 | } else { | ||
4679 | use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET; | ||
4680 | if (use_doorbell) { | ||
4681 | dev_warn(&pdev->dev, "Controller claims that " | ||
4682 | "'Bit 2 doorbell reset' is " | ||
4683 | "supported, but not 'bit 5 doorbell reset'. " | ||
4684 | "Firmware update is recommended.\n"); | ||
4685 | rc = -ENOTSUPP; /* use the soft reset */ | ||
4686 | goto unmap_cfgtable; | ||
4687 | } | ||
4688 | } | ||
4510 | 4689 | ||
4511 | rc = cciss_controller_hard_reset(pdev, vaddr, use_doorbell); | 4690 | rc = cciss_controller_hard_reset(pdev, vaddr, use_doorbell); |
4512 | if (rc) | 4691 | if (rc) |
@@ -4524,30 +4703,31 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) | |||
4524 | msleep(CCISS_POST_RESET_PAUSE_MSECS); | 4703 | msleep(CCISS_POST_RESET_PAUSE_MSECS); |
4525 | 4704 | ||
4526 | /* Wait for board to become not ready, then ready. */ | 4705 | /* Wait for board to become not ready, then ready. */ |
4527 | dev_info(&pdev->dev, "Waiting for board to become ready.\n"); | 4706 | dev_info(&pdev->dev, "Waiting for board to reset.\n"); |
4528 | rc = cciss_wait_for_board_state(pdev, vaddr, BOARD_NOT_READY); | 4707 | rc = cciss_wait_for_board_state(pdev, vaddr, BOARD_NOT_READY); |
4529 | if (rc) /* Don't bail, might be E500, etc. which can't be reset */ | 4708 | if (rc) { |
4530 | dev_warn(&pdev->dev, | 4709 | dev_warn(&pdev->dev, "Failed waiting for board to hard reset." |
4531 | "failed waiting for board to become not ready\n"); | 4710 | " Will try soft reset.\n"); |
4711 | rc = -ENOTSUPP; /* Not expected, but try soft reset later */ | ||
4712 | goto unmap_cfgtable; | ||
4713 | } | ||
4532 | rc = cciss_wait_for_board_state(pdev, vaddr, BOARD_READY); | 4714 | rc = cciss_wait_for_board_state(pdev, vaddr, BOARD_READY); |
4533 | if (rc) { | 4715 | if (rc) { |
4534 | dev_warn(&pdev->dev, | 4716 | dev_warn(&pdev->dev, |
4535 | "failed waiting for board to become ready\n"); | 4717 | "failed waiting for board to become ready " |
4718 | "after hard reset\n"); | ||
4536 | goto unmap_cfgtable; | 4719 | goto unmap_cfgtable; |
4537 | } | 4720 | } |
4538 | dev_info(&pdev->dev, "board ready.\n"); | ||
4539 | 4721 | ||
4540 | /* Controller should be in simple mode at this point. If it's not, | 4722 | rc = controller_reset_failed(vaddr); |
4541 | * It means we're on one of those controllers which doesn't support | 4723 | if (rc < 0) |
4542 | * the doorbell reset method and on which the PCI power management reset | 4724 | goto unmap_cfgtable; |
4543 | * method doesn't work (P800, for example.) | 4725 | if (rc) { |
4544 | * In those cases, don't try to proceed, as it generally doesn't work. | 4726 | dev_warn(&pdev->dev, "Unable to successfully hard reset " |
4545 | */ | 4727 | "controller. Will try soft reset.\n"); |
4546 | active_transport = readl(&cfgtable->TransportActive); | 4728 | rc = -ENOTSUPP; /* Not expected, but try soft reset later */ |
4547 | if (active_transport & PERFORMANT_MODE) { | 4729 | } else { |
4548 | dev_warn(&pdev->dev, "Unable to successfully reset controller," | 4730 | dev_info(&pdev->dev, "Board ready after hard reset.\n"); |
4549 | " Ignoring controller.\n"); | ||
4550 | rc = -ENODEV; | ||
4551 | } | 4731 | } |
4552 | 4732 | ||
4553 | unmap_cfgtable: | 4733 | unmap_cfgtable: |
@@ -4574,11 +4754,12 @@ static __devinit int cciss_init_reset_devices(struct pci_dev *pdev) | |||
4574 | * due to concerns about shared bbwc between 6402/6404 pair. | 4754 | * due to concerns about shared bbwc between 6402/6404 pair. |
4575 | */ | 4755 | */ |
4576 | if (rc == -ENOTSUPP) | 4756 | if (rc == -ENOTSUPP) |
4577 | return 0; /* just try to do the kdump anyhow. */ | 4757 | return rc; /* just try to do the kdump anyhow. */ |
4578 | if (rc) | 4758 | if (rc) |
4579 | return -ENODEV; | 4759 | return -ENODEV; |
4580 | 4760 | ||
4581 | /* Now try to get the controller to respond to a no-op */ | 4761 | /* Now try to get the controller to respond to a no-op */ |
4762 | dev_warn(&pdev->dev, "Waiting for controller to respond to no-op\n"); | ||
4582 | for (i = 0; i < CCISS_POST_RESET_NOOP_RETRIES; i++) { | 4763 | for (i = 0; i < CCISS_POST_RESET_NOOP_RETRIES; i++) { |
4583 | if (cciss_noop(pdev) == 0) | 4764 | if (cciss_noop(pdev) == 0) |
4584 | break; | 4765 | break; |
@@ -4591,6 +4772,148 @@ static __devinit int cciss_init_reset_devices(struct pci_dev *pdev) | |||
4591 | return 0; | 4772 | return 0; |
4592 | } | 4773 | } |
4593 | 4774 | ||
4775 | static __devinit int cciss_allocate_cmd_pool(ctlr_info_t *h) | ||
4776 | { | ||
4777 | h->cmd_pool_bits = kmalloc( | ||
4778 | DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) * | ||
4779 | sizeof(unsigned long), GFP_KERNEL); | ||
4780 | h->cmd_pool = pci_alloc_consistent(h->pdev, | ||
4781 | h->nr_cmds * sizeof(CommandList_struct), | ||
4782 | &(h->cmd_pool_dhandle)); | ||
4783 | h->errinfo_pool = pci_alloc_consistent(h->pdev, | ||
4784 | h->nr_cmds * sizeof(ErrorInfo_struct), | ||
4785 | &(h->errinfo_pool_dhandle)); | ||
4786 | if ((h->cmd_pool_bits == NULL) | ||
4787 | || (h->cmd_pool == NULL) | ||
4788 | || (h->errinfo_pool == NULL)) { | ||
4789 | dev_err(&h->pdev->dev, "out of memory"); | ||
4790 | return -ENOMEM; | ||
4791 | } | ||
4792 | return 0; | ||
4793 | } | ||
4794 | |||
4795 | static __devinit int cciss_allocate_scatterlists(ctlr_info_t *h) | ||
4796 | { | ||
4797 | int i; | ||
4798 | |||
4799 | /* zero it, so that on free we need not know how many were alloc'ed */ | ||
4800 | h->scatter_list = kzalloc(h->max_commands * | ||
4801 | sizeof(struct scatterlist *), GFP_KERNEL); | ||
4802 | if (!h->scatter_list) | ||
4803 | return -ENOMEM; | ||
4804 | |||
4805 | for (i = 0; i < h->nr_cmds; i++) { | ||
4806 | h->scatter_list[i] = kmalloc(sizeof(struct scatterlist) * | ||
4807 | h->maxsgentries, GFP_KERNEL); | ||
4808 | if (h->scatter_list[i] == NULL) { | ||
4809 | dev_err(&h->pdev->dev, "could not allocate " | ||
4810 | "s/g lists\n"); | ||
4811 | return -ENOMEM; | ||
4812 | } | ||
4813 | } | ||
4814 | return 0; | ||
4815 | } | ||
4816 | |||
4817 | static void cciss_free_scatterlists(ctlr_info_t *h) | ||
4818 | { | ||
4819 | int i; | ||
4820 | |||
4821 | if (h->scatter_list) { | ||
4822 | for (i = 0; i < h->nr_cmds; i++) | ||
4823 | kfree(h->scatter_list[i]); | ||
4824 | kfree(h->scatter_list); | ||
4825 | } | ||
4826 | } | ||
4827 | |||
4828 | static void cciss_free_cmd_pool(ctlr_info_t *h) | ||
4829 | { | ||
4830 | kfree(h->cmd_pool_bits); | ||
4831 | if (h->cmd_pool) | ||
4832 | pci_free_consistent(h->pdev, | ||
4833 | h->nr_cmds * sizeof(CommandList_struct), | ||
4834 | h->cmd_pool, h->cmd_pool_dhandle); | ||
4835 | if (h->errinfo_pool) | ||
4836 | pci_free_consistent(h->pdev, | ||
4837 | h->nr_cmds * sizeof(ErrorInfo_struct), | ||
4838 | h->errinfo_pool, h->errinfo_pool_dhandle); | ||
4839 | } | ||
4840 | |||
4841 | static int cciss_request_irq(ctlr_info_t *h, | ||
4842 | irqreturn_t (*msixhandler)(int, void *), | ||
4843 | irqreturn_t (*intxhandler)(int, void *)) | ||
4844 | { | ||
4845 | if (h->msix_vector || h->msi_vector) { | ||
4846 | if (!request_irq(h->intr[PERF_MODE_INT], msixhandler, | ||
4847 | IRQF_DISABLED, h->devname, h)) | ||
4848 | return 0; | ||
4849 | dev_err(&h->pdev->dev, "Unable to get msi irq %d" | ||
4850 | " for %s\n", h->intr[PERF_MODE_INT], | ||
4851 | h->devname); | ||
4852 | return -1; | ||
4853 | } | ||
4854 | |||
4855 | if (!request_irq(h->intr[PERF_MODE_INT], intxhandler, | ||
4856 | IRQF_DISABLED, h->devname, h)) | ||
4857 | return 0; | ||
4858 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", | ||
4859 | h->intr[PERF_MODE_INT], h->devname); | ||
4860 | return -1; | ||
4861 | } | ||
4862 | |||
4863 | static int __devinit cciss_kdump_soft_reset(ctlr_info_t *h) | ||
4864 | { | ||
4865 | if (cciss_send_reset(h, CTLR_LUNID, CCISS_RESET_TYPE_CONTROLLER)) { | ||
4866 | dev_warn(&h->pdev->dev, "Resetting array controller failed.\n"); | ||
4867 | return -EIO; | ||
4868 | } | ||
4869 | |||
4870 | dev_info(&h->pdev->dev, "Waiting for board to soft reset.\n"); | ||
4871 | if (cciss_wait_for_board_state(h->pdev, h->vaddr, BOARD_NOT_READY)) { | ||
4872 | dev_warn(&h->pdev->dev, "Soft reset had no effect.\n"); | ||
4873 | return -1; | ||
4874 | } | ||
4875 | |||
4876 | dev_info(&h->pdev->dev, "Board reset, awaiting READY status.\n"); | ||
4877 | if (cciss_wait_for_board_state(h->pdev, h->vaddr, BOARD_READY)) { | ||
4878 | dev_warn(&h->pdev->dev, "Board failed to become ready " | ||
4879 | "after soft reset.\n"); | ||
4880 | return -1; | ||
4881 | } | ||
4882 | |||
4883 | return 0; | ||
4884 | } | ||
4885 | |||
4886 | static void cciss_undo_allocations_after_kdump_soft_reset(ctlr_info_t *h) | ||
4887 | { | ||
4888 | int ctlr = h->ctlr; | ||
4889 | |||
4890 | free_irq(h->intr[PERF_MODE_INT], h); | ||
4891 | #ifdef CONFIG_PCI_MSI | ||
4892 | if (h->msix_vector) | ||
4893 | pci_disable_msix(h->pdev); | ||
4894 | else if (h->msi_vector) | ||
4895 | pci_disable_msi(h->pdev); | ||
4896 | #endif /* CONFIG_PCI_MSI */ | ||
4897 | cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds); | ||
4898 | cciss_free_scatterlists(h); | ||
4899 | cciss_free_cmd_pool(h); | ||
4900 | kfree(h->blockFetchTable); | ||
4901 | if (h->reply_pool) | ||
4902 | pci_free_consistent(h->pdev, h->max_commands * sizeof(__u64), | ||
4903 | h->reply_pool, h->reply_pool_dhandle); | ||
4904 | if (h->transtable) | ||
4905 | iounmap(h->transtable); | ||
4906 | if (h->cfgtable) | ||
4907 | iounmap(h->cfgtable); | ||
4908 | if (h->vaddr) | ||
4909 | iounmap(h->vaddr); | ||
4910 | unregister_blkdev(h->major, h->devname); | ||
4911 | cciss_destroy_hba_sysfs_entry(h); | ||
4912 | pci_release_regions(h->pdev); | ||
4913 | kfree(h); | ||
4914 | hba[ctlr] = NULL; | ||
4915 | } | ||
4916 | |||
4594 | /* | 4917 | /* |
4595 | * This is it. Find all the controllers and register them. I really hate | 4918 | * This is it. Find all the controllers and register them. I really hate |
4596 | * stealing all these major device numbers. | 4919 | * stealing all these major device numbers. |
@@ -4601,15 +4924,28 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
4601 | { | 4924 | { |
4602 | int i; | 4925 | int i; |
4603 | int j = 0; | 4926 | int j = 0; |
4604 | int k = 0; | ||
4605 | int rc; | 4927 | int rc; |
4928 | int try_soft_reset = 0; | ||
4606 | int dac, return_code; | 4929 | int dac, return_code; |
4607 | InquiryData_struct *inq_buff; | 4930 | InquiryData_struct *inq_buff; |
4608 | ctlr_info_t *h; | 4931 | ctlr_info_t *h; |
4932 | unsigned long flags; | ||
4609 | 4933 | ||
4610 | rc = cciss_init_reset_devices(pdev); | 4934 | rc = cciss_init_reset_devices(pdev); |
4611 | if (rc) | 4935 | if (rc) { |
4612 | return rc; | 4936 | if (rc != -ENOTSUPP) |
4937 | return rc; | ||
4938 | /* If the reset fails in a particular way (it has no way to do | ||
4939 | * a proper hard reset, so returns -ENOTSUPP) we can try to do | ||
4940 | * a soft reset once we get the controller configured up to the | ||
4941 | * point that it can accept a command. | ||
4942 | */ | ||
4943 | try_soft_reset = 1; | ||
4944 | rc = 0; | ||
4945 | } | ||
4946 | |||
4947 | reinit_after_soft_reset: | ||
4948 | |||
4613 | i = alloc_cciss_hba(pdev); | 4949 | i = alloc_cciss_hba(pdev); |
4614 | if (i < 0) | 4950 | if (i < 0) |
4615 | return -1; | 4951 | return -1; |
@@ -4627,6 +4963,11 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
4627 | sprintf(h->devname, "cciss%d", i); | 4963 | sprintf(h->devname, "cciss%d", i); |
4628 | h->ctlr = i; | 4964 | h->ctlr = i; |
4629 | 4965 | ||
4966 | if (cciss_tape_cmds < 2) | ||
4967 | cciss_tape_cmds = 2; | ||
4968 | if (cciss_tape_cmds > 16) | ||
4969 | cciss_tape_cmds = 16; | ||
4970 | |||
4630 | init_completion(&h->scan_wait); | 4971 | init_completion(&h->scan_wait); |
4631 | 4972 | ||
4632 | if (cciss_create_hba_sysfs_entry(h)) | 4973 | if (cciss_create_hba_sysfs_entry(h)) |
@@ -4662,62 +5003,20 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
4662 | 5003 | ||
4663 | /* make sure the board interrupts are off */ | 5004 | /* make sure the board interrupts are off */ |
4664 | h->access.set_intr_mask(h, CCISS_INTR_OFF); | 5005 | h->access.set_intr_mask(h, CCISS_INTR_OFF); |
4665 | if (h->msi_vector || h->msix_vector) { | 5006 | rc = cciss_request_irq(h, do_cciss_msix_intr, do_cciss_intx); |
4666 | if (request_irq(h->intr[PERF_MODE_INT], | 5007 | if (rc) |
4667 | do_cciss_msix_intr, | 5008 | goto clean2; |
4668 | IRQF_DISABLED, h->devname, h)) { | ||
4669 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", | ||
4670 | h->intr[PERF_MODE_INT], h->devname); | ||
4671 | goto clean2; | ||
4672 | } | ||
4673 | } else { | ||
4674 | if (request_irq(h->intr[PERF_MODE_INT], do_cciss_intx, | ||
4675 | IRQF_DISABLED, h->devname, h)) { | ||
4676 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", | ||
4677 | h->intr[PERF_MODE_INT], h->devname); | ||
4678 | goto clean2; | ||
4679 | } | ||
4680 | } | ||
4681 | 5009 | ||
4682 | dev_info(&h->pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n", | 5010 | dev_info(&h->pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n", |
4683 | h->devname, pdev->device, pci_name(pdev), | 5011 | h->devname, pdev->device, pci_name(pdev), |
4684 | h->intr[PERF_MODE_INT], dac ? "" : " not"); | 5012 | h->intr[PERF_MODE_INT], dac ? "" : " not"); |
4685 | 5013 | ||
4686 | h->cmd_pool_bits = | 5014 | if (cciss_allocate_cmd_pool(h)) |
4687 | kmalloc(DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) | ||
4688 | * sizeof(unsigned long), GFP_KERNEL); | ||
4689 | h->cmd_pool = (CommandList_struct *) | ||
4690 | pci_alloc_consistent(h->pdev, | ||
4691 | h->nr_cmds * sizeof(CommandList_struct), | ||
4692 | &(h->cmd_pool_dhandle)); | ||
4693 | h->errinfo_pool = (ErrorInfo_struct *) | ||
4694 | pci_alloc_consistent(h->pdev, | ||
4695 | h->nr_cmds * sizeof(ErrorInfo_struct), | ||
4696 | &(h->errinfo_pool_dhandle)); | ||
4697 | if ((h->cmd_pool_bits == NULL) | ||
4698 | || (h->cmd_pool == NULL) | ||
4699 | || (h->errinfo_pool == NULL)) { | ||
4700 | dev_err(&h->pdev->dev, "out of memory"); | ||
4701 | goto clean4; | 5015 | goto clean4; |
4702 | } | ||
4703 | 5016 | ||
4704 | /* Need space for temp scatter list */ | 5017 | if (cciss_allocate_scatterlists(h)) |
4705 | h->scatter_list = kmalloc(h->max_commands * | ||
4706 | sizeof(struct scatterlist *), | ||
4707 | GFP_KERNEL); | ||
4708 | if (!h->scatter_list) | ||
4709 | goto clean4; | 5018 | goto clean4; |
4710 | 5019 | ||
4711 | for (k = 0; k < h->nr_cmds; k++) { | ||
4712 | h->scatter_list[k] = kmalloc(sizeof(struct scatterlist) * | ||
4713 | h->maxsgentries, | ||
4714 | GFP_KERNEL); | ||
4715 | if (h->scatter_list[k] == NULL) { | ||
4716 | dev_err(&h->pdev->dev, | ||
4717 | "could not allocate s/g lists\n"); | ||
4718 | goto clean4; | ||
4719 | } | ||
4720 | } | ||
4721 | h->cmd_sg_list = cciss_allocate_sg_chain_blocks(h, | 5020 | h->cmd_sg_list = cciss_allocate_sg_chain_blocks(h, |
4722 | h->chainsize, h->nr_cmds); | 5021 | h->chainsize, h->nr_cmds); |
4723 | if (!h->cmd_sg_list && h->chainsize > 0) | 5022 | if (!h->cmd_sg_list && h->chainsize > 0) |
@@ -4741,6 +5040,62 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
4741 | h->gendisk[j] = NULL; | 5040 | h->gendisk[j] = NULL; |
4742 | } | 5041 | } |
4743 | 5042 | ||
5043 | /* At this point, the controller is ready to take commands. | ||
5044 | * Now, if reset_devices and the hard reset didn't work, try | ||
5045 | * the soft reset and see if that works. | ||
5046 | */ | ||
5047 | if (try_soft_reset) { | ||
5048 | |||
5049 | /* This is kind of gross. We may or may not get a completion | ||
5050 | * from the soft reset command, and if we do, then the value | ||
5051 | * from the fifo may or may not be valid. So, we wait 10 secs | ||
5052 | * after the reset throwing away any completions we get during | ||
5053 | * that time. Unregister the interrupt handler and register | ||
5054 | * fake ones to scoop up any residual completions. | ||
5055 | */ | ||
5056 | spin_lock_irqsave(&h->lock, flags); | ||
5057 | h->access.set_intr_mask(h, CCISS_INTR_OFF); | ||
5058 | spin_unlock_irqrestore(&h->lock, flags); | ||
5059 | free_irq(h->intr[PERF_MODE_INT], h); | ||
5060 | rc = cciss_request_irq(h, cciss_msix_discard_completions, | ||
5061 | cciss_intx_discard_completions); | ||
5062 | if (rc) { | ||
5063 | dev_warn(&h->pdev->dev, "Failed to request_irq after " | ||
5064 | "soft reset.\n"); | ||
5065 | goto clean4; | ||
5066 | } | ||
5067 | |||
5068 | rc = cciss_kdump_soft_reset(h); | ||
5069 | if (rc) { | ||
5070 | dev_warn(&h->pdev->dev, "Soft reset failed.\n"); | ||
5071 | goto clean4; | ||
5072 | } | ||
5073 | |||
5074 | dev_info(&h->pdev->dev, "Board READY.\n"); | ||
5075 | dev_info(&h->pdev->dev, | ||
5076 | "Waiting for stale completions to drain.\n"); | ||
5077 | h->access.set_intr_mask(h, CCISS_INTR_ON); | ||
5078 | msleep(10000); | ||
5079 | h->access.set_intr_mask(h, CCISS_INTR_OFF); | ||
5080 | |||
5081 | rc = controller_reset_failed(h->cfgtable); | ||
5082 | if (rc) | ||
5083 | dev_info(&h->pdev->dev, | ||
5084 | "Soft reset appears to have failed.\n"); | ||
5085 | |||
5086 | /* since the controller's reset, we have to go back and re-init | ||
5087 | * everything. Easiest to just forget what we've done and do it | ||
5088 | * all over again. | ||
5089 | */ | ||
5090 | cciss_undo_allocations_after_kdump_soft_reset(h); | ||
5091 | try_soft_reset = 0; | ||
5092 | if (rc) | ||
5093 | /* don't go to clean4, we already unallocated */ | ||
5094 | return -ENODEV; | ||
5095 | |||
5096 | goto reinit_after_soft_reset; | ||
5097 | } | ||
5098 | |||
4744 | cciss_scsi_setup(h); | 5099 | cciss_scsi_setup(h); |
4745 | 5100 | ||
4746 | /* Turn the interrupts on so we can service requests */ | 5101 | /* Turn the interrupts on so we can service requests */ |
@@ -4775,21 +5130,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
4775 | return 1; | 5130 | return 1; |
4776 | 5131 | ||
4777 | clean4: | 5132 | clean4: |
4778 | kfree(h->cmd_pool_bits); | 5133 | cciss_free_cmd_pool(h); |
4779 | /* Free up sg elements */ | 5134 | cciss_free_scatterlists(h); |
4780 | for (k-- ; k >= 0; k--) | ||
4781 | kfree(h->scatter_list[k]); | ||
4782 | kfree(h->scatter_list); | ||
4783 | cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds); | 5135 | cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds); |
4784 | if (h->cmd_pool) | ||
4785 | pci_free_consistent(h->pdev, | ||
4786 | h->nr_cmds * sizeof(CommandList_struct), | ||
4787 | h->cmd_pool, h->cmd_pool_dhandle); | ||
4788 | if (h->errinfo_pool) | ||
4789 | pci_free_consistent(h->pdev, | ||
4790 | h->nr_cmds * sizeof(ErrorInfo_struct), | ||
4791 | h->errinfo_pool, | ||
4792 | h->errinfo_pool_dhandle); | ||
4793 | free_irq(h->intr[PERF_MODE_INT], h); | 5136 | free_irq(h->intr[PERF_MODE_INT], h); |
4794 | clean2: | 5137 | clean2: |
4795 | unregister_blkdev(h->major, h->devname); | 5138 | unregister_blkdev(h->major, h->devname); |
@@ -4887,16 +5230,16 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) | |||
4887 | iounmap(h->cfgtable); | 5230 | iounmap(h->cfgtable); |
4888 | iounmap(h->vaddr); | 5231 | iounmap(h->vaddr); |
4889 | 5232 | ||
4890 | pci_free_consistent(h->pdev, h->nr_cmds * sizeof(CommandList_struct), | 5233 | cciss_free_cmd_pool(h); |
4891 | h->cmd_pool, h->cmd_pool_dhandle); | ||
4892 | pci_free_consistent(h->pdev, h->nr_cmds * sizeof(ErrorInfo_struct), | ||
4893 | h->errinfo_pool, h->errinfo_pool_dhandle); | ||
4894 | kfree(h->cmd_pool_bits); | ||
4895 | /* Free up sg elements */ | 5234 | /* Free up sg elements */ |
4896 | for (j = 0; j < h->nr_cmds; j++) | 5235 | for (j = 0; j < h->nr_cmds; j++) |
4897 | kfree(h->scatter_list[j]); | 5236 | kfree(h->scatter_list[j]); |
4898 | kfree(h->scatter_list); | 5237 | kfree(h->scatter_list); |
4899 | cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds); | 5238 | cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds); |
5239 | kfree(h->blockFetchTable); | ||
5240 | if (h->reply_pool) | ||
5241 | pci_free_consistent(h->pdev, h->max_commands * sizeof(__u64), | ||
5242 | h->reply_pool, h->reply_pool_dhandle); | ||
4900 | /* | 5243 | /* |
4901 | * Deliberately omit pci_disable_device(): it does something nasty to | 5244 | * Deliberately omit pci_disable_device(): it does something nasty to |
4902 | * Smart Array controllers that pci_enable_device does not undo | 5245 | * Smart Array controllers that pci_enable_device does not undo |
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h index 554bbd907d14..16b4d58d84dd 100644 --- a/drivers/block/cciss.h +++ b/drivers/block/cciss.h | |||
@@ -200,7 +200,7 @@ struct ctlr_info | |||
200 | * the above. | 200 | * the above. |
201 | */ | 201 | */ |
202 | #define CCISS_BOARD_READY_WAIT_SECS (120) | 202 | #define CCISS_BOARD_READY_WAIT_SECS (120) |
203 | #define CCISS_BOARD_NOT_READY_WAIT_SECS (10) | 203 | #define CCISS_BOARD_NOT_READY_WAIT_SECS (100) |
204 | #define CCISS_BOARD_READY_POLL_INTERVAL_MSECS (100) | 204 | #define CCISS_BOARD_READY_POLL_INTERVAL_MSECS (100) |
205 | #define CCISS_BOARD_READY_ITERATIONS \ | 205 | #define CCISS_BOARD_READY_ITERATIONS \ |
206 | ((CCISS_BOARD_READY_WAIT_SECS * 1000) / \ | 206 | ((CCISS_BOARD_READY_WAIT_SECS * 1000) / \ |
@@ -209,8 +209,9 @@ struct ctlr_info | |||
209 | ((CCISS_BOARD_NOT_READY_WAIT_SECS * 1000) / \ | 209 | ((CCISS_BOARD_NOT_READY_WAIT_SECS * 1000) / \ |
210 | CCISS_BOARD_READY_POLL_INTERVAL_MSECS) | 210 | CCISS_BOARD_READY_POLL_INTERVAL_MSECS) |
211 | #define CCISS_POST_RESET_PAUSE_MSECS (3000) | 211 | #define CCISS_POST_RESET_PAUSE_MSECS (3000) |
212 | #define CCISS_POST_RESET_NOOP_INTERVAL_MSECS (1000) | 212 | #define CCISS_POST_RESET_NOOP_INTERVAL_MSECS (4000) |
213 | #define CCISS_POST_RESET_NOOP_RETRIES (12) | 213 | #define CCISS_POST_RESET_NOOP_RETRIES (12) |
214 | #define CCISS_POST_RESET_NOOP_TIMEOUT_MSECS (10000) | ||
214 | 215 | ||
215 | /* | 216 | /* |
216 | Send the command to the hardware | 217 | Send the command to the hardware |
@@ -239,11 +240,13 @@ static void SA5_intr_mask(ctlr_info_t *h, unsigned long val) | |||
239 | { /* Turn interrupts on */ | 240 | { /* Turn interrupts on */ |
240 | h->interrupts_enabled = 1; | 241 | h->interrupts_enabled = 1; |
241 | writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | 242 | writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); |
243 | (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | ||
242 | } else /* Turn them off */ | 244 | } else /* Turn them off */ |
243 | { | 245 | { |
244 | h->interrupts_enabled = 0; | 246 | h->interrupts_enabled = 0; |
245 | writel( SA5_INTR_OFF, | 247 | writel( SA5_INTR_OFF, |
246 | h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | 248 | h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); |
249 | (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | ||
247 | } | 250 | } |
248 | } | 251 | } |
249 | /* | 252 | /* |
@@ -257,11 +260,13 @@ static void SA5B_intr_mask(ctlr_info_t *h, unsigned long val) | |||
257 | { /* Turn interrupts on */ | 260 | { /* Turn interrupts on */ |
258 | h->interrupts_enabled = 1; | 261 | h->interrupts_enabled = 1; |
259 | writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | 262 | writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); |
263 | (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | ||
260 | } else /* Turn them off */ | 264 | } else /* Turn them off */ |
261 | { | 265 | { |
262 | h->interrupts_enabled = 0; | 266 | h->interrupts_enabled = 0; |
263 | writel( SA5B_INTR_OFF, | 267 | writel( SA5B_INTR_OFF, |
264 | h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | 268 | h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); |
269 | (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | ||
265 | } | 270 | } |
266 | } | 271 | } |
267 | 272 | ||
@@ -271,10 +276,12 @@ static void SA5_performant_intr_mask(ctlr_info_t *h, unsigned long val) | |||
271 | if (val) { /* turn on interrupts */ | 276 | if (val) { /* turn on interrupts */ |
272 | h->interrupts_enabled = 1; | 277 | h->interrupts_enabled = 1; |
273 | writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | 278 | writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); |
279 | (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | ||
274 | } else { | 280 | } else { |
275 | h->interrupts_enabled = 0; | 281 | h->interrupts_enabled = 0; |
276 | writel(SA5_PERF_INTR_OFF, | 282 | writel(SA5_PERF_INTR_OFF, |
277 | h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | 283 | h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); |
284 | (void) readl(h->vaddr + SA5_REPLY_INTR_MASK_OFFSET); | ||
278 | } | 285 | } |
279 | } | 286 | } |
280 | 287 | ||
diff --git a/drivers/block/cciss_cmd.h b/drivers/block/cciss_cmd.h index cd441bef031f..d9be6b4d49a6 100644 --- a/drivers/block/cciss_cmd.h +++ b/drivers/block/cciss_cmd.h | |||
@@ -53,6 +53,7 @@ | |||
53 | #define CFGTBL_ChangeReq 0x00000001l | 53 | #define CFGTBL_ChangeReq 0x00000001l |
54 | #define CFGTBL_AccCmds 0x00000001l | 54 | #define CFGTBL_AccCmds 0x00000001l |
55 | #define DOORBELL_CTLR_RESET 0x00000004l | 55 | #define DOORBELL_CTLR_RESET 0x00000004l |
56 | #define DOORBELL_CTLR_RESET2 0x00000020l | ||
56 | 57 | ||
57 | #define CFGTBL_Trans_Simple 0x00000002l | 58 | #define CFGTBL_Trans_Simple 0x00000002l |
58 | #define CFGTBL_Trans_Performant 0x00000004l | 59 | #define CFGTBL_Trans_Performant 0x00000004l |
@@ -142,6 +143,14 @@ typedef struct _ReadCapdata_struct_16 | |||
142 | #define BMIC_CACHE_FLUSH 0xc2 | 143 | #define BMIC_CACHE_FLUSH 0xc2 |
143 | #define CCISS_CACHE_FLUSH 0x01 /* C2 was already being used by CCISS */ | 144 | #define CCISS_CACHE_FLUSH 0x01 /* C2 was already being used by CCISS */ |
144 | 145 | ||
146 | #define CCISS_ABORT_MSG 0x00 | ||
147 | #define CCISS_RESET_MSG 0x01 | ||
148 | #define CCISS_RESET_TYPE_CONTROLLER 0x00 | ||
149 | #define CCISS_RESET_TYPE_BUS 0x01 | ||
150 | #define CCISS_RESET_TYPE_TARGET 0x03 | ||
151 | #define CCISS_RESET_TYPE_LUN 0x04 | ||
152 | #define CCISS_NOOP_MSG 0x03 | ||
153 | |||
145 | /* Command List Structure */ | 154 | /* Command List Structure */ |
146 | #define CTLR_LUNID "\0\0\0\0\0\0\0\0" | 155 | #define CTLR_LUNID "\0\0\0\0\0\0\0\0" |
147 | 156 | ||
@@ -235,6 +244,8 @@ typedef struct _CfgTable_struct { | |||
235 | u8 reserved[0x78 - 0x58]; | 244 | u8 reserved[0x78 - 0x58]; |
236 | u32 misc_fw_support; /* offset 0x78 */ | 245 | u32 misc_fw_support; /* offset 0x78 */ |
237 | #define MISC_FW_DOORBELL_RESET (0x02) | 246 | #define MISC_FW_DOORBELL_RESET (0x02) |
247 | #define MISC_FW_DOORBELL_RESET2 (0x10) | ||
248 | u8 driver_version[32]; | ||
238 | } CfgTable_struct; | 249 | } CfgTable_struct; |
239 | 250 | ||
240 | struct TransTable_struct { | 251 | struct TransTable_struct { |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index df793803f5ae..696100241a6f 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -84,7 +84,6 @@ static struct scsi_host_template cciss_driver_template = { | |||
84 | .proc_name = "cciss", | 84 | .proc_name = "cciss", |
85 | .proc_info = cciss_scsi_proc_info, | 85 | .proc_info = cciss_scsi_proc_info, |
86 | .queuecommand = cciss_scsi_queue_command, | 86 | .queuecommand = cciss_scsi_queue_command, |
87 | .can_queue = SCSI_CCISS_CAN_QUEUE, | ||
88 | .this_id = 7, | 87 | .this_id = 7, |
89 | .cmd_per_lun = 1, | 88 | .cmd_per_lun = 1, |
90 | .use_clustering = DISABLE_CLUSTERING, | 89 | .use_clustering = DISABLE_CLUSTERING, |
@@ -108,16 +107,13 @@ struct cciss_scsi_cmd_stack_elem_t { | |||
108 | 107 | ||
109 | #pragma pack() | 108 | #pragma pack() |
110 | 109 | ||
111 | #define CMD_STACK_SIZE (SCSI_CCISS_CAN_QUEUE * \ | ||
112 | CCISS_MAX_SCSI_DEVS_PER_HBA + 2) | ||
113 | // plus two for init time usage | ||
114 | |||
115 | #pragma pack(1) | 110 | #pragma pack(1) |
116 | struct cciss_scsi_cmd_stack_t { | 111 | struct cciss_scsi_cmd_stack_t { |
117 | struct cciss_scsi_cmd_stack_elem_t *pool; | 112 | struct cciss_scsi_cmd_stack_elem_t *pool; |
118 | struct cciss_scsi_cmd_stack_elem_t *elem[CMD_STACK_SIZE]; | 113 | struct cciss_scsi_cmd_stack_elem_t **elem; |
119 | dma_addr_t cmd_pool_handle; | 114 | dma_addr_t cmd_pool_handle; |
120 | int top; | 115 | int top; |
116 | int nelems; | ||
121 | }; | 117 | }; |
122 | #pragma pack() | 118 | #pragma pack() |
123 | 119 | ||
@@ -191,7 +187,7 @@ scsi_cmd_free(ctlr_info_t *h, CommandList_struct *c) | |||
191 | sa = h->scsi_ctlr; | 187 | sa = h->scsi_ctlr; |
192 | stk = &sa->cmd_stack; | 188 | stk = &sa->cmd_stack; |
193 | stk->top++; | 189 | stk->top++; |
194 | if (stk->top >= CMD_STACK_SIZE) { | 190 | if (stk->top >= stk->nelems) { |
195 | dev_err(&h->pdev->dev, | 191 | dev_err(&h->pdev->dev, |
196 | "scsi_cmd_free called too many times.\n"); | 192 | "scsi_cmd_free called too many times.\n"); |
197 | BUG(); | 193 | BUG(); |
@@ -206,13 +202,14 @@ scsi_cmd_stack_setup(ctlr_info_t *h, struct cciss_scsi_adapter_data_t *sa) | |||
206 | struct cciss_scsi_cmd_stack_t *stk; | 202 | struct cciss_scsi_cmd_stack_t *stk; |
207 | size_t size; | 203 | size_t size; |
208 | 204 | ||
205 | stk = &sa->cmd_stack; | ||
206 | stk->nelems = cciss_tape_cmds + 2; | ||
209 | sa->cmd_sg_list = cciss_allocate_sg_chain_blocks(h, | 207 | sa->cmd_sg_list = cciss_allocate_sg_chain_blocks(h, |
210 | h->chainsize, CMD_STACK_SIZE); | 208 | h->chainsize, stk->nelems); |
211 | if (!sa->cmd_sg_list && h->chainsize > 0) | 209 | if (!sa->cmd_sg_list && h->chainsize > 0) |
212 | return -ENOMEM; | 210 | return -ENOMEM; |
213 | 211 | ||
214 | stk = &sa->cmd_stack; | 212 | size = sizeof(struct cciss_scsi_cmd_stack_elem_t) * stk->nelems; |
215 | size = sizeof(struct cciss_scsi_cmd_stack_elem_t) * CMD_STACK_SIZE; | ||
216 | 213 | ||
217 | /* Check alignment, see cciss_cmd.h near CommandList_struct def. */ | 214 | /* Check alignment, see cciss_cmd.h near CommandList_struct def. */ |
218 | BUILD_BUG_ON((sizeof(*stk->pool) % COMMANDLIST_ALIGNMENT) != 0); | 215 | BUILD_BUG_ON((sizeof(*stk->pool) % COMMANDLIST_ALIGNMENT) != 0); |
@@ -221,18 +218,23 @@ scsi_cmd_stack_setup(ctlr_info_t *h, struct cciss_scsi_adapter_data_t *sa) | |||
221 | pci_alloc_consistent(h->pdev, size, &stk->cmd_pool_handle); | 218 | pci_alloc_consistent(h->pdev, size, &stk->cmd_pool_handle); |
222 | 219 | ||
223 | if (stk->pool == NULL) { | 220 | if (stk->pool == NULL) { |
224 | cciss_free_sg_chain_blocks(sa->cmd_sg_list, CMD_STACK_SIZE); | 221 | cciss_free_sg_chain_blocks(sa->cmd_sg_list, stk->nelems); |
225 | sa->cmd_sg_list = NULL; | 222 | sa->cmd_sg_list = NULL; |
226 | return -ENOMEM; | 223 | return -ENOMEM; |
227 | } | 224 | } |
228 | 225 | stk->elem = kmalloc(sizeof(stk->elem[0]) * stk->nelems, GFP_KERNEL); | |
229 | for (i=0; i<CMD_STACK_SIZE; i++) { | 226 | if (!stk->elem) { |
227 | pci_free_consistent(h->pdev, size, stk->pool, | ||
228 | stk->cmd_pool_handle); | ||
229 | return -1; | ||
230 | } | ||
231 | for (i = 0; i < stk->nelems; i++) { | ||
230 | stk->elem[i] = &stk->pool[i]; | 232 | stk->elem[i] = &stk->pool[i]; |
231 | stk->elem[i]->busaddr = (__u32) (stk->cmd_pool_handle + | 233 | stk->elem[i]->busaddr = (__u32) (stk->cmd_pool_handle + |
232 | (sizeof(struct cciss_scsi_cmd_stack_elem_t) * i)); | 234 | (sizeof(struct cciss_scsi_cmd_stack_elem_t) * i)); |
233 | stk->elem[i]->cmdindex = i; | 235 | stk->elem[i]->cmdindex = i; |
234 | } | 236 | } |
235 | stk->top = CMD_STACK_SIZE-1; | 237 | stk->top = stk->nelems-1; |
236 | return 0; | 238 | return 0; |
237 | } | 239 | } |
238 | 240 | ||
@@ -245,16 +247,18 @@ scsi_cmd_stack_free(ctlr_info_t *h) | |||
245 | 247 | ||
246 | sa = h->scsi_ctlr; | 248 | sa = h->scsi_ctlr; |
247 | stk = &sa->cmd_stack; | 249 | stk = &sa->cmd_stack; |
248 | if (stk->top != CMD_STACK_SIZE-1) { | 250 | if (stk->top != stk->nelems-1) { |
249 | dev_warn(&h->pdev->dev, | 251 | dev_warn(&h->pdev->dev, |
250 | "bug: %d scsi commands are still outstanding.\n", | 252 | "bug: %d scsi commands are still outstanding.\n", |
251 | CMD_STACK_SIZE - stk->top); | 253 | stk->nelems - stk->top); |
252 | } | 254 | } |
253 | size = sizeof(struct cciss_scsi_cmd_stack_elem_t) * CMD_STACK_SIZE; | 255 | size = sizeof(struct cciss_scsi_cmd_stack_elem_t) * stk->nelems; |
254 | 256 | ||
255 | pci_free_consistent(h->pdev, size, stk->pool, stk->cmd_pool_handle); | 257 | pci_free_consistent(h->pdev, size, stk->pool, stk->cmd_pool_handle); |
256 | stk->pool = NULL; | 258 | stk->pool = NULL; |
257 | cciss_free_sg_chain_blocks(sa->cmd_sg_list, CMD_STACK_SIZE); | 259 | cciss_free_sg_chain_blocks(sa->cmd_sg_list, stk->nelems); |
260 | kfree(stk->elem); | ||
261 | stk->elem = NULL; | ||
258 | } | 262 | } |
259 | 263 | ||
260 | #if 0 | 264 | #if 0 |
@@ -859,6 +863,7 @@ cciss_scsi_detect(ctlr_info_t *h) | |||
859 | sh->io_port = 0; // good enough? FIXME, | 863 | sh->io_port = 0; // good enough? FIXME, |
860 | sh->n_io_port = 0; // I don't think we use these two... | 864 | sh->n_io_port = 0; // I don't think we use these two... |
861 | sh->this_id = SELF_SCSI_ID; | 865 | sh->this_id = SELF_SCSI_ID; |
866 | sh->can_queue = cciss_tape_cmds; | ||
862 | sh->sg_tablesize = h->maxsgentries; | 867 | sh->sg_tablesize = h->maxsgentries; |
863 | sh->max_cmd_len = MAX_COMMAND_SIZE; | 868 | sh->max_cmd_len = MAX_COMMAND_SIZE; |
864 | 869 | ||
diff --git a/drivers/block/cciss_scsi.h b/drivers/block/cciss_scsi.h index 6d5822fe851a..e71d986727ca 100644 --- a/drivers/block/cciss_scsi.h +++ b/drivers/block/cciss_scsi.h | |||
@@ -36,13 +36,9 @@ | |||
36 | addressible natively, and may in fact turn | 36 | addressible natively, and may in fact turn |
37 | out to be not scsi at all. */ | 37 | out to be not scsi at all. */ |
38 | 38 | ||
39 | #define SCSI_CCISS_CAN_QUEUE 2 | ||
40 | 39 | ||
41 | /* | 40 | /* |
42 | 41 | ||
43 | Note, cmd_per_lun could give us some trouble, so I'm setting it very low. | ||
44 | Likewise, SCSI_CCISS_CAN_QUEUE is set very conservatively. | ||
45 | |||
46 | If the upper scsi layer tries to track how many commands we have | 42 | If the upper scsi layer tries to track how many commands we have |
47 | outstanding, it will be operating under the misapprehension that it is | 43 | outstanding, it will be operating under the misapprehension that it is |
48 | the only one sending us requests. We also have the block interface, | 44 | the only one sending us requests. We also have the block interface, |
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c index c6828b68d77b..09ef9a878ef0 100644 --- a/drivers/block/drbd/drbd_actlog.c +++ b/drivers/block/drbd/drbd_actlog.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "drbd_int.h" | 28 | #include "drbd_int.h" |
29 | #include "drbd_wrappers.h" | 29 | #include "drbd_wrappers.h" |
30 | 30 | ||
31 | /* We maintain a trivial check sum in our on disk activity log. | 31 | /* We maintain a trivial checksum in our on disk activity log. |
32 | * With that we can ensure correct operation even when the storage | 32 | * With that we can ensure correct operation even when the storage |
33 | * device might do a partial (last) sector write while losing power. | 33 | * device might do a partial (last) sector write while losing power. |
34 | */ | 34 | */ |
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index 76210ba401ac..f440a02dfdb1 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c | |||
@@ -74,7 +74,7 @@ | |||
74 | * as we are "attached" to a local disk, which at 32 GiB for 1PiB storage | 74 | * as we are "attached" to a local disk, which at 32 GiB for 1PiB storage |
75 | * seems excessive. | 75 | * seems excessive. |
76 | * | 76 | * |
77 | * We plan to reduce the amount of in-core bitmap pages by pageing them in | 77 | * We plan to reduce the amount of in-core bitmap pages by paging them in |
78 | * and out against their on-disk location as necessary, but need to make | 78 | * and out against their on-disk location as necessary, but need to make |
79 | * sure we don't cause too much meta data IO, and must not deadlock in | 79 | * sure we don't cause too much meta data IO, and must not deadlock in |
80 | * tight memory situations. This needs some more work. | 80 | * tight memory situations. This needs some more work. |
@@ -200,7 +200,7 @@ void drbd_bm_unlock(struct drbd_conf *mdev) | |||
200 | * we if bits have been cleared since last IO. */ | 200 | * we if bits have been cleared since last IO. */ |
201 | #define BM_PAGE_LAZY_WRITEOUT 28 | 201 | #define BM_PAGE_LAZY_WRITEOUT 28 |
202 | 202 | ||
203 | /* store_page_idx uses non-atomic assingment. It is only used directly after | 203 | /* store_page_idx uses non-atomic assignment. It is only used directly after |
204 | * allocating the page. All other bm_set_page_* and bm_clear_page_* need to | 204 | * allocating the page. All other bm_set_page_* and bm_clear_page_* need to |
205 | * use atomic bit manipulation, as set_out_of_sync (and therefore bitmap | 205 | * use atomic bit manipulation, as set_out_of_sync (and therefore bitmap |
206 | * changes) may happen from various contexts, and wait_on_bit/wake_up_bit | 206 | * changes) may happen from various contexts, and wait_on_bit/wake_up_bit |
@@ -318,7 +318,7 @@ static void bm_unmap(unsigned long *p_addr) | |||
318 | /* word offset from start of bitmap to word number _in_page_ | 318 | /* word offset from start of bitmap to word number _in_page_ |
319 | * modulo longs per page | 319 | * modulo longs per page |
320 | #define MLPP(X) ((X) % (PAGE_SIZE/sizeof(long)) | 320 | #define MLPP(X) ((X) % (PAGE_SIZE/sizeof(long)) |
321 | hm, well, Philipp thinks gcc might not optimze the % into & (... - 1) | 321 | hm, well, Philipp thinks gcc might not optimize the % into & (... - 1) |
322 | so do it explicitly: | 322 | so do it explicitly: |
323 | */ | 323 | */ |
324 | #define MLPP(X) ((X) & ((PAGE_SIZE/sizeof(long))-1)) | 324 | #define MLPP(X) ((X) & ((PAGE_SIZE/sizeof(long))-1)) |
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index d871b14ed5a1..ef2ceed3be4b 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -700,7 +700,7 @@ struct drbd_request { | |||
700 | * see drbd_endio_pri(). */ | 700 | * see drbd_endio_pri(). */ |
701 | struct bio *private_bio; | 701 | struct bio *private_bio; |
702 | 702 | ||
703 | struct hlist_node colision; | 703 | struct hlist_node collision; |
704 | sector_t sector; | 704 | sector_t sector; |
705 | unsigned int size; | 705 | unsigned int size; |
706 | unsigned int epoch; /* barrier_nr */ | 706 | unsigned int epoch; /* barrier_nr */ |
@@ -766,7 +766,7 @@ struct digest_info { | |||
766 | 766 | ||
767 | struct drbd_epoch_entry { | 767 | struct drbd_epoch_entry { |
768 | struct drbd_work w; | 768 | struct drbd_work w; |
769 | struct hlist_node colision; | 769 | struct hlist_node collision; |
770 | struct drbd_epoch *epoch; /* for writes */ | 770 | struct drbd_epoch *epoch; /* for writes */ |
771 | struct drbd_conf *mdev; | 771 | struct drbd_conf *mdev; |
772 | struct page *pages; | 772 | struct page *pages; |
@@ -1129,6 +1129,8 @@ struct drbd_conf { | |||
1129 | int rs_in_flight; /* resync sectors in flight (to proxy, in proxy and from proxy) */ | 1129 | int rs_in_flight; /* resync sectors in flight (to proxy, in proxy and from proxy) */ |
1130 | int rs_planed; /* resync sectors already planned */ | 1130 | int rs_planed; /* resync sectors already planned */ |
1131 | atomic_t ap_in_flight; /* App sectors in flight (waiting for ack) */ | 1131 | atomic_t ap_in_flight; /* App sectors in flight (waiting for ack) */ |
1132 | int peer_max_bio_size; | ||
1133 | int local_max_bio_size; | ||
1132 | }; | 1134 | }; |
1133 | 1135 | ||
1134 | static inline struct drbd_conf *minor_to_mdev(unsigned int minor) | 1136 | static inline struct drbd_conf *minor_to_mdev(unsigned int minor) |
@@ -1218,8 +1220,6 @@ extern void drbd_free_resources(struct drbd_conf *mdev); | |||
1218 | extern void tl_release(struct drbd_conf *mdev, unsigned int barrier_nr, | 1220 | extern void tl_release(struct drbd_conf *mdev, unsigned int barrier_nr, |
1219 | unsigned int set_size); | 1221 | unsigned int set_size); |
1220 | extern void tl_clear(struct drbd_conf *mdev); | 1222 | extern void tl_clear(struct drbd_conf *mdev); |
1221 | enum drbd_req_event; | ||
1222 | extern void tl_restart(struct drbd_conf *mdev, enum drbd_req_event what); | ||
1223 | extern void _tl_add_barrier(struct drbd_conf *, struct drbd_tl_epoch *); | 1223 | extern void _tl_add_barrier(struct drbd_conf *, struct drbd_tl_epoch *); |
1224 | extern void drbd_free_sock(struct drbd_conf *mdev); | 1224 | extern void drbd_free_sock(struct drbd_conf *mdev); |
1225 | extern int drbd_send(struct drbd_conf *mdev, struct socket *sock, | 1225 | extern int drbd_send(struct drbd_conf *mdev, struct socket *sock, |
@@ -1434,6 +1434,7 @@ struct bm_extent { | |||
1434 | * hash table. */ | 1434 | * hash table. */ |
1435 | #define HT_SHIFT 8 | 1435 | #define HT_SHIFT 8 |
1436 | #define DRBD_MAX_BIO_SIZE (1U<<(9+HT_SHIFT)) | 1436 | #define DRBD_MAX_BIO_SIZE (1U<<(9+HT_SHIFT)) |
1437 | #define DRBD_MAX_BIO_SIZE_SAFE (1 << 12) /* Works always = 4k */ | ||
1437 | 1438 | ||
1438 | #define DRBD_MAX_SIZE_H80_PACKET (1 << 15) /* The old header only allows packets up to 32Kib data */ | 1439 | #define DRBD_MAX_SIZE_H80_PACKET (1 << 15) /* The old header only allows packets up to 32Kib data */ |
1439 | 1440 | ||
@@ -1518,9 +1519,9 @@ extern void drbd_resume_io(struct drbd_conf *mdev); | |||
1518 | extern char *ppsize(char *buf, unsigned long long size); | 1519 | extern char *ppsize(char *buf, unsigned long long size); |
1519 | extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, int); | 1520 | extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, int); |
1520 | enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; | 1521 | enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; |
1521 | extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *, enum dds_flags) __must_hold(local); | 1522 | extern enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *, enum dds_flags) __must_hold(local); |
1522 | extern void resync_after_online_grow(struct drbd_conf *); | 1523 | extern void resync_after_online_grow(struct drbd_conf *); |
1523 | extern void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int) __must_hold(local); | 1524 | extern void drbd_reconsider_max_bio_size(struct drbd_conf *mdev); |
1524 | extern enum drbd_state_rv drbd_set_role(struct drbd_conf *mdev, | 1525 | extern enum drbd_state_rv drbd_set_role(struct drbd_conf *mdev, |
1525 | enum drbd_role new_role, | 1526 | enum drbd_role new_role, |
1526 | int force); | 1527 | int force); |
@@ -1828,6 +1829,8 @@ static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, int forcedetach, | |||
1828 | if (!forcedetach) { | 1829 | if (!forcedetach) { |
1829 | if (__ratelimit(&drbd_ratelimit_state)) | 1830 | if (__ratelimit(&drbd_ratelimit_state)) |
1830 | dev_err(DEV, "Local IO failed in %s.\n", where); | 1831 | dev_err(DEV, "Local IO failed in %s.\n", where); |
1832 | if (mdev->state.disk > D_INCONSISTENT) | ||
1833 | _drbd_set_state(_NS(mdev, disk, D_INCONSISTENT), CS_HARD, NULL); | ||
1831 | break; | 1834 | break; |
1832 | } | 1835 | } |
1833 | /* NOTE fall through to detach case if forcedetach set */ | 1836 | /* NOTE fall through to detach case if forcedetach set */ |
@@ -2153,6 +2156,10 @@ static inline int get_net_conf(struct drbd_conf *mdev) | |||
2153 | static inline void put_ldev(struct drbd_conf *mdev) | 2156 | static inline void put_ldev(struct drbd_conf *mdev) |
2154 | { | 2157 | { |
2155 | int i = atomic_dec_return(&mdev->local_cnt); | 2158 | int i = atomic_dec_return(&mdev->local_cnt); |
2159 | |||
2160 | /* This may be called from some endio handler, | ||
2161 | * so we must not sleep here. */ | ||
2162 | |||
2156 | __release(local); | 2163 | __release(local); |
2157 | D_ASSERT(i >= 0); | 2164 | D_ASSERT(i >= 0); |
2158 | if (i == 0) { | 2165 | if (i == 0) { |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 5b525c179f39..0358e55356c8 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -745,6 +745,9 @@ is_valid_state(struct drbd_conf *mdev, union drbd_state ns) | |||
745 | mdev->agreed_pro_version < 88) | 745 | mdev->agreed_pro_version < 88) |
746 | rv = SS_NOT_SUPPORTED; | 746 | rv = SS_NOT_SUPPORTED; |
747 | 747 | ||
748 | else if (ns.conn >= C_CONNECTED && ns.pdsk == D_UNKNOWN) | ||
749 | rv = SS_CONNECTED_OUTDATES; | ||
750 | |||
748 | return rv; | 751 | return rv; |
749 | } | 752 | } |
750 | 753 | ||
@@ -1565,6 +1568,10 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
1565 | put_ldev(mdev); | 1568 | put_ldev(mdev); |
1566 | } | 1569 | } |
1567 | 1570 | ||
1571 | /* Notify peer that I had a local IO error, and did not detached.. */ | ||
1572 | if (os.disk == D_UP_TO_DATE && ns.disk == D_INCONSISTENT) | ||
1573 | drbd_send_state(mdev); | ||
1574 | |||
1568 | /* Disks got bigger while they were detached */ | 1575 | /* Disks got bigger while they were detached */ |
1569 | if (ns.disk > D_NEGOTIATING && ns.pdsk > D_NEGOTIATING && | 1576 | if (ns.disk > D_NEGOTIATING && ns.pdsk > D_NEGOTIATING && |
1570 | test_and_clear_bit(RESYNC_AFTER_NEG, &mdev->flags)) { | 1577 | test_and_clear_bit(RESYNC_AFTER_NEG, &mdev->flags)) { |
@@ -2064,7 +2071,7 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl | |||
2064 | { | 2071 | { |
2065 | struct p_sizes p; | 2072 | struct p_sizes p; |
2066 | sector_t d_size, u_size; | 2073 | sector_t d_size, u_size; |
2067 | int q_order_type; | 2074 | int q_order_type, max_bio_size; |
2068 | int ok; | 2075 | int ok; |
2069 | 2076 | ||
2070 | if (get_ldev_if_state(mdev, D_NEGOTIATING)) { | 2077 | if (get_ldev_if_state(mdev, D_NEGOTIATING)) { |
@@ -2072,17 +2079,20 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl | |||
2072 | d_size = drbd_get_max_capacity(mdev->ldev); | 2079 | d_size = drbd_get_max_capacity(mdev->ldev); |
2073 | u_size = mdev->ldev->dc.disk_size; | 2080 | u_size = mdev->ldev->dc.disk_size; |
2074 | q_order_type = drbd_queue_order_type(mdev); | 2081 | q_order_type = drbd_queue_order_type(mdev); |
2082 | max_bio_size = queue_max_hw_sectors(mdev->ldev->backing_bdev->bd_disk->queue) << 9; | ||
2083 | max_bio_size = min_t(int, max_bio_size, DRBD_MAX_BIO_SIZE); | ||
2075 | put_ldev(mdev); | 2084 | put_ldev(mdev); |
2076 | } else { | 2085 | } else { |
2077 | d_size = 0; | 2086 | d_size = 0; |
2078 | u_size = 0; | 2087 | u_size = 0; |
2079 | q_order_type = QUEUE_ORDERED_NONE; | 2088 | q_order_type = QUEUE_ORDERED_NONE; |
2089 | max_bio_size = DRBD_MAX_BIO_SIZE; /* ... multiple BIOs per peer_request */ | ||
2080 | } | 2090 | } |
2081 | 2091 | ||
2082 | p.d_size = cpu_to_be64(d_size); | 2092 | p.d_size = cpu_to_be64(d_size); |
2083 | p.u_size = cpu_to_be64(u_size); | 2093 | p.u_size = cpu_to_be64(u_size); |
2084 | p.c_size = cpu_to_be64(trigger_reply ? 0 : drbd_get_capacity(mdev->this_bdev)); | 2094 | p.c_size = cpu_to_be64(trigger_reply ? 0 : drbd_get_capacity(mdev->this_bdev)); |
2085 | p.max_bio_size = cpu_to_be32(queue_max_hw_sectors(mdev->rq_queue) << 9); | 2095 | p.max_bio_size = cpu_to_be32(max_bio_size); |
2086 | p.queue_order_type = cpu_to_be16(q_order_type); | 2096 | p.queue_order_type = cpu_to_be16(q_order_type); |
2087 | p.dds_flags = cpu_to_be16(flags); | 2097 | p.dds_flags = cpu_to_be16(flags); |
2088 | 2098 | ||
@@ -2722,7 +2732,7 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req) | |||
2722 | 2732 | ||
2723 | /* double check digest, sometimes buffers have been modified in flight. */ | 2733 | /* double check digest, sometimes buffers have been modified in flight. */ |
2724 | if (dgs > 0 && dgs <= 64) { | 2734 | if (dgs > 0 && dgs <= 64) { |
2725 | /* 64 byte, 512 bit, is the larges digest size | 2735 | /* 64 byte, 512 bit, is the largest digest size |
2726 | * currently supported in kernel crypto. */ | 2736 | * currently supported in kernel crypto. */ |
2727 | unsigned char digest[64]; | 2737 | unsigned char digest[64]; |
2728 | drbd_csum_bio(mdev, mdev->integrity_w_tfm, req->master_bio, digest); | 2738 | drbd_csum_bio(mdev, mdev->integrity_w_tfm, req->master_bio, digest); |
@@ -3041,6 +3051,8 @@ void drbd_init_set_defaults(struct drbd_conf *mdev) | |||
3041 | mdev->agreed_pro_version = PRO_VERSION_MAX; | 3051 | mdev->agreed_pro_version = PRO_VERSION_MAX; |
3042 | mdev->write_ordering = WO_bdev_flush; | 3052 | mdev->write_ordering = WO_bdev_flush; |
3043 | mdev->resync_wenr = LC_FREE; | 3053 | mdev->resync_wenr = LC_FREE; |
3054 | mdev->peer_max_bio_size = DRBD_MAX_BIO_SIZE_SAFE; | ||
3055 | mdev->local_max_bio_size = DRBD_MAX_BIO_SIZE_SAFE; | ||
3044 | } | 3056 | } |
3045 | 3057 | ||
3046 | void drbd_mdev_cleanup(struct drbd_conf *mdev) | 3058 | void drbd_mdev_cleanup(struct drbd_conf *mdev) |
@@ -3275,7 +3287,7 @@ static void drbd_delete_device(unsigned int minor) | |||
3275 | 3287 | ||
3276 | drbd_release_ee_lists(mdev); | 3288 | drbd_release_ee_lists(mdev); |
3277 | 3289 | ||
3278 | /* should be free'd on disconnect? */ | 3290 | /* should be freed on disconnect? */ |
3279 | kfree(mdev->ee_hash); | 3291 | kfree(mdev->ee_hash); |
3280 | /* | 3292 | /* |
3281 | mdev->ee_hash_s = 0; | 3293 | mdev->ee_hash_s = 0; |
@@ -3415,7 +3427,9 @@ struct drbd_conf *drbd_new_device(unsigned int minor) | |||
3415 | q->backing_dev_info.congested_data = mdev; | 3427 | q->backing_dev_info.congested_data = mdev; |
3416 | 3428 | ||
3417 | blk_queue_make_request(q, drbd_make_request); | 3429 | blk_queue_make_request(q, drbd_make_request); |
3418 | blk_queue_max_hw_sectors(q, DRBD_MAX_BIO_SIZE >> 9); | 3430 | /* Setting the max_hw_sectors to an odd value of 8kibyte here |
3431 | This triggers a max_bio_size message upon first attach or connect */ | ||
3432 | blk_queue_max_hw_sectors(q, DRBD_MAX_BIO_SIZE_SAFE >> 8); | ||
3419 | blk_queue_bounce_limit(q, BLK_BOUNCE_ANY); | 3433 | blk_queue_bounce_limit(q, BLK_BOUNCE_ANY); |
3420 | blk_queue_merge_bvec(q, drbd_merge_bvec); | 3434 | blk_queue_merge_bvec(q, drbd_merge_bvec); |
3421 | q->queue_lock = &mdev->req_lock; | 3435 | q->queue_lock = &mdev->req_lock; |
@@ -3627,7 +3641,8 @@ struct meta_data_on_disk { | |||
3627 | /* `-- act_log->nr_elements <-- sync_conf.al_extents */ | 3641 | /* `-- act_log->nr_elements <-- sync_conf.al_extents */ |
3628 | u32 bm_offset; /* offset to the bitmap, from here */ | 3642 | u32 bm_offset; /* offset to the bitmap, from here */ |
3629 | u32 bm_bytes_per_bit; /* BM_BLOCK_SIZE */ | 3643 | u32 bm_bytes_per_bit; /* BM_BLOCK_SIZE */ |
3630 | u32 reserved_u32[4]; | 3644 | u32 la_peer_max_bio_size; /* last peer max_bio_size */ |
3645 | u32 reserved_u32[3]; | ||
3631 | 3646 | ||
3632 | } __packed; | 3647 | } __packed; |
3633 | 3648 | ||
@@ -3668,6 +3683,7 @@ void drbd_md_sync(struct drbd_conf *mdev) | |||
3668 | buffer->device_uuid = cpu_to_be64(mdev->ldev->md.device_uuid); | 3683 | buffer->device_uuid = cpu_to_be64(mdev->ldev->md.device_uuid); |
3669 | 3684 | ||
3670 | buffer->bm_offset = cpu_to_be32(mdev->ldev->md.bm_offset); | 3685 | buffer->bm_offset = cpu_to_be32(mdev->ldev->md.bm_offset); |
3686 | buffer->la_peer_max_bio_size = cpu_to_be32(mdev->peer_max_bio_size); | ||
3671 | 3687 | ||
3672 | D_ASSERT(drbd_md_ss__(mdev, mdev->ldev) == mdev->ldev->md.md_offset); | 3688 | D_ASSERT(drbd_md_ss__(mdev, mdev->ldev) == mdev->ldev->md.md_offset); |
3673 | sector = mdev->ldev->md.md_offset; | 3689 | sector = mdev->ldev->md.md_offset; |
@@ -3751,6 +3767,15 @@ int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) | |||
3751 | mdev->sync_conf.al_extents = be32_to_cpu(buffer->al_nr_extents); | 3767 | mdev->sync_conf.al_extents = be32_to_cpu(buffer->al_nr_extents); |
3752 | bdev->md.device_uuid = be64_to_cpu(buffer->device_uuid); | 3768 | bdev->md.device_uuid = be64_to_cpu(buffer->device_uuid); |
3753 | 3769 | ||
3770 | spin_lock_irq(&mdev->req_lock); | ||
3771 | if (mdev->state.conn < C_CONNECTED) { | ||
3772 | int peer; | ||
3773 | peer = be32_to_cpu(buffer->la_peer_max_bio_size); | ||
3774 | peer = max_t(int, peer, DRBD_MAX_BIO_SIZE_SAFE); | ||
3775 | mdev->peer_max_bio_size = peer; | ||
3776 | } | ||
3777 | spin_unlock_irq(&mdev->req_lock); | ||
3778 | |||
3754 | if (mdev->sync_conf.al_extents < 7) | 3779 | if (mdev->sync_conf.al_extents < 7) |
3755 | mdev->sync_conf.al_extents = 127; | 3780 | mdev->sync_conf.al_extents = 127; |
3756 | 3781 | ||
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 03b29f78a37d..515bcd948a43 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -272,9 +272,28 @@ static int _try_outdate_peer_async(void *data) | |||
272 | { | 272 | { |
273 | struct drbd_conf *mdev = (struct drbd_conf *)data; | 273 | struct drbd_conf *mdev = (struct drbd_conf *)data; |
274 | enum drbd_disk_state nps; | 274 | enum drbd_disk_state nps; |
275 | union drbd_state ns; | ||
275 | 276 | ||
276 | nps = drbd_try_outdate_peer(mdev); | 277 | nps = drbd_try_outdate_peer(mdev); |
277 | drbd_request_state(mdev, NS(pdsk, nps)); | 278 | |
279 | /* Not using | ||
280 | drbd_request_state(mdev, NS(pdsk, nps)); | ||
281 | here, because we might were able to re-establish the connection | ||
282 | in the meantime. This can only partially be solved in the state's | ||
283 | engine is_valid_state() and is_valid_state_transition() | ||
284 | functions. | ||
285 | |||
286 | nps can be D_INCONSISTENT, D_OUTDATED or D_UNKNOWN. | ||
287 | pdsk == D_INCONSISTENT while conn >= C_CONNECTED is valid, | ||
288 | therefore we have to have the pre state change check here. | ||
289 | */ | ||
290 | spin_lock_irq(&mdev->req_lock); | ||
291 | ns = mdev->state; | ||
292 | if (ns.conn < C_WF_REPORT_PARAMS) { | ||
293 | ns.pdsk = nps; | ||
294 | _drbd_set_state(mdev, ns, CS_VERBOSE, NULL); | ||
295 | } | ||
296 | spin_unlock_irq(&mdev->req_lock); | ||
278 | 297 | ||
279 | return 0; | 298 | return 0; |
280 | } | 299 | } |
@@ -577,7 +596,7 @@ void drbd_resume_io(struct drbd_conf *mdev) | |||
577 | * Returns 0 on success, negative return values indicate errors. | 596 | * Returns 0 on success, negative return values indicate errors. |
578 | * You should call drbd_md_sync() after calling this function. | 597 | * You should call drbd_md_sync() after calling this function. |
579 | */ | 598 | */ |
580 | enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev, enum dds_flags flags) __must_hold(local) | 599 | enum determine_dev_size drbd_determine_dev_size(struct drbd_conf *mdev, enum dds_flags flags) __must_hold(local) |
581 | { | 600 | { |
582 | sector_t prev_first_sect, prev_size; /* previous meta location */ | 601 | sector_t prev_first_sect, prev_size; /* previous meta location */ |
583 | sector_t la_size; | 602 | sector_t la_size; |
@@ -773,30 +792,78 @@ static int drbd_check_al_size(struct drbd_conf *mdev) | |||
773 | return 0; | 792 | return 0; |
774 | } | 793 | } |
775 | 794 | ||
776 | void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int max_bio_size) __must_hold(local) | 795 | static void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int max_bio_size) |
777 | { | 796 | { |
778 | struct request_queue * const q = mdev->rq_queue; | 797 | struct request_queue * const q = mdev->rq_queue; |
779 | struct request_queue * const b = mdev->ldev->backing_bdev->bd_disk->queue; | 798 | int max_hw_sectors = max_bio_size >> 9; |
780 | int max_segments = mdev->ldev->dc.max_bio_bvecs; | 799 | int max_segments = 0; |
781 | int max_hw_sectors = min(queue_max_hw_sectors(b), max_bio_size >> 9); | 800 | |
801 | if (get_ldev_if_state(mdev, D_ATTACHING)) { | ||
802 | struct request_queue * const b = mdev->ldev->backing_bdev->bd_disk->queue; | ||
803 | |||
804 | max_hw_sectors = min(queue_max_hw_sectors(b), max_bio_size >> 9); | ||
805 | max_segments = mdev->ldev->dc.max_bio_bvecs; | ||
806 | put_ldev(mdev); | ||
807 | } | ||
782 | 808 | ||
783 | blk_queue_logical_block_size(q, 512); | 809 | blk_queue_logical_block_size(q, 512); |
784 | blk_queue_max_hw_sectors(q, max_hw_sectors); | 810 | blk_queue_max_hw_sectors(q, max_hw_sectors); |
785 | /* This is the workaround for "bio would need to, but cannot, be split" */ | 811 | /* This is the workaround for "bio would need to, but cannot, be split" */ |
786 | blk_queue_max_segments(q, max_segments ? max_segments : BLK_MAX_SEGMENTS); | 812 | blk_queue_max_segments(q, max_segments ? max_segments : BLK_MAX_SEGMENTS); |
787 | blk_queue_segment_boundary(q, PAGE_CACHE_SIZE-1); | 813 | blk_queue_segment_boundary(q, PAGE_CACHE_SIZE-1); |
788 | blk_queue_stack_limits(q, b); | ||
789 | 814 | ||
790 | dev_info(DEV, "max BIO size = %u\n", queue_max_hw_sectors(q) << 9); | 815 | if (get_ldev_if_state(mdev, D_ATTACHING)) { |
816 | struct request_queue * const b = mdev->ldev->backing_bdev->bd_disk->queue; | ||
817 | |||
818 | blk_queue_stack_limits(q, b); | ||
791 | 819 | ||
792 | if (q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) { | 820 | if (q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) { |
793 | dev_info(DEV, "Adjusting my ra_pages to backing device's (%lu -> %lu)\n", | 821 | dev_info(DEV, "Adjusting my ra_pages to backing device's (%lu -> %lu)\n", |
794 | q->backing_dev_info.ra_pages, | 822 | q->backing_dev_info.ra_pages, |
795 | b->backing_dev_info.ra_pages); | 823 | b->backing_dev_info.ra_pages); |
796 | q->backing_dev_info.ra_pages = b->backing_dev_info.ra_pages; | 824 | q->backing_dev_info.ra_pages = b->backing_dev_info.ra_pages; |
825 | } | ||
826 | put_ldev(mdev); | ||
797 | } | 827 | } |
798 | } | 828 | } |
799 | 829 | ||
830 | void drbd_reconsider_max_bio_size(struct drbd_conf *mdev) | ||
831 | { | ||
832 | int now, new, local, peer; | ||
833 | |||
834 | now = queue_max_hw_sectors(mdev->rq_queue) << 9; | ||
835 | local = mdev->local_max_bio_size; /* Eventually last known value, from volatile memory */ | ||
836 | peer = mdev->peer_max_bio_size; /* Eventually last known value, from meta data */ | ||
837 | |||
838 | if (get_ldev_if_state(mdev, D_ATTACHING)) { | ||
839 | local = queue_max_hw_sectors(mdev->ldev->backing_bdev->bd_disk->queue) << 9; | ||
840 | mdev->local_max_bio_size = local; | ||
841 | put_ldev(mdev); | ||
842 | } | ||
843 | |||
844 | /* We may ignore peer limits if the peer is modern enough. | ||
845 | Because new from 8.3.8 onwards the peer can use multiple | ||
846 | BIOs for a single peer_request */ | ||
847 | if (mdev->state.conn >= C_CONNECTED) { | ||
848 | if (mdev->agreed_pro_version < 94) | ||
849 | peer = mdev->peer_max_bio_size; | ||
850 | else if (mdev->agreed_pro_version == 94) | ||
851 | peer = DRBD_MAX_SIZE_H80_PACKET; | ||
852 | else /* drbd 8.3.8 onwards */ | ||
853 | peer = DRBD_MAX_BIO_SIZE; | ||
854 | } | ||
855 | |||
856 | new = min_t(int, local, peer); | ||
857 | |||
858 | if (mdev->state.role == R_PRIMARY && new < now) | ||
859 | dev_err(DEV, "ASSERT FAILED new < now; (%d < %d)\n", new, now); | ||
860 | |||
861 | if (new != now) | ||
862 | dev_info(DEV, "max BIO size = %u\n", new); | ||
863 | |||
864 | drbd_setup_queue_param(mdev, new); | ||
865 | } | ||
866 | |||
800 | /* serialize deconfig (worker exiting, doing cleanup) | 867 | /* serialize deconfig (worker exiting, doing cleanup) |
801 | * and reconfig (drbdsetup disk, drbdsetup net) | 868 | * and reconfig (drbdsetup disk, drbdsetup net) |
802 | * | 869 | * |
@@ -865,7 +932,6 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
865 | struct block_device *bdev; | 932 | struct block_device *bdev; |
866 | struct lru_cache *resync_lru = NULL; | 933 | struct lru_cache *resync_lru = NULL; |
867 | union drbd_state ns, os; | 934 | union drbd_state ns, os; |
868 | unsigned int max_bio_size; | ||
869 | enum drbd_state_rv rv; | 935 | enum drbd_state_rv rv; |
870 | int cp_discovered = 0; | 936 | int cp_discovered = 0; |
871 | int logical_block_size; | 937 | int logical_block_size; |
@@ -1117,20 +1183,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
1117 | mdev->read_cnt = 0; | 1183 | mdev->read_cnt = 0; |
1118 | mdev->writ_cnt = 0; | 1184 | mdev->writ_cnt = 0; |
1119 | 1185 | ||
1120 | max_bio_size = DRBD_MAX_BIO_SIZE; | 1186 | drbd_reconsider_max_bio_size(mdev); |
1121 | if (mdev->state.conn == C_CONNECTED) { | ||
1122 | /* We are Primary, Connected, and now attach a new local | ||
1123 | * backing store. We must not increase the user visible maximum | ||
1124 | * bio size on this device to something the peer may not be | ||
1125 | * able to handle. */ | ||
1126 | if (mdev->agreed_pro_version < 94) | ||
1127 | max_bio_size = queue_max_hw_sectors(mdev->rq_queue) << 9; | ||
1128 | else if (mdev->agreed_pro_version == 94) | ||
1129 | max_bio_size = DRBD_MAX_SIZE_H80_PACKET; | ||
1130 | /* else: drbd 8.3.9 and later, stay with default */ | ||
1131 | } | ||
1132 | |||
1133 | drbd_setup_queue_param(mdev, max_bio_size); | ||
1134 | 1187 | ||
1135 | /* If I am currently not R_PRIMARY, | 1188 | /* If I am currently not R_PRIMARY, |
1136 | * but meta data primary indicator is set, | 1189 | * but meta data primary indicator is set, |
@@ -1152,7 +1205,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
1152 | !drbd_md_test_flag(mdev->ldev, MDF_CONNECTED_IND)) | 1205 | !drbd_md_test_flag(mdev->ldev, MDF_CONNECTED_IND)) |
1153 | set_bit(USE_DEGR_WFC_T, &mdev->flags); | 1206 | set_bit(USE_DEGR_WFC_T, &mdev->flags); |
1154 | 1207 | ||
1155 | dd = drbd_determin_dev_size(mdev, 0); | 1208 | dd = drbd_determine_dev_size(mdev, 0); |
1156 | if (dd == dev_size_error) { | 1209 | if (dd == dev_size_error) { |
1157 | retcode = ERR_NOMEM_BITMAP; | 1210 | retcode = ERR_NOMEM_BITMAP; |
1158 | goto force_diskless_dec; | 1211 | goto force_diskless_dec; |
@@ -1281,11 +1334,19 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
1281 | static int drbd_nl_detach(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | 1334 | static int drbd_nl_detach(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, |
1282 | struct drbd_nl_cfg_reply *reply) | 1335 | struct drbd_nl_cfg_reply *reply) |
1283 | { | 1336 | { |
1337 | enum drbd_ret_code retcode; | ||
1338 | int ret; | ||
1284 | drbd_suspend_io(mdev); /* so no-one is stuck in drbd_al_begin_io */ | 1339 | drbd_suspend_io(mdev); /* so no-one is stuck in drbd_al_begin_io */ |
1285 | reply->ret_code = drbd_request_state(mdev, NS(disk, D_DISKLESS)); | 1340 | retcode = drbd_request_state(mdev, NS(disk, D_FAILED)); |
1286 | if (mdev->state.disk == D_DISKLESS) | 1341 | /* D_FAILED will transition to DISKLESS. */ |
1287 | wait_event(mdev->misc_wait, !atomic_read(&mdev->local_cnt)); | 1342 | ret = wait_event_interruptible(mdev->misc_wait, |
1343 | mdev->state.disk != D_FAILED); | ||
1288 | drbd_resume_io(mdev); | 1344 | drbd_resume_io(mdev); |
1345 | if ((int)retcode == (int)SS_IS_DISKLESS) | ||
1346 | retcode = SS_NOTHING_TO_DO; | ||
1347 | if (ret) | ||
1348 | retcode = ERR_INTR; | ||
1349 | reply->ret_code = retcode; | ||
1289 | return 0; | 1350 | return 0; |
1290 | } | 1351 | } |
1291 | 1352 | ||
@@ -1658,7 +1719,7 @@ static int drbd_nl_resize(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
1658 | 1719 | ||
1659 | mdev->ldev->dc.disk_size = (sector_t)rs.resize_size; | 1720 | mdev->ldev->dc.disk_size = (sector_t)rs.resize_size; |
1660 | ddsf = (rs.resize_force ? DDSF_FORCED : 0) | (rs.no_resync ? DDSF_NO_RESYNC : 0); | 1721 | ddsf = (rs.resize_force ? DDSF_FORCED : 0) | (rs.no_resync ? DDSF_NO_RESYNC : 0); |
1661 | dd = drbd_determin_dev_size(mdev, ddsf); | 1722 | dd = drbd_determine_dev_size(mdev, ddsf); |
1662 | drbd_md_sync(mdev); | 1723 | drbd_md_sync(mdev); |
1663 | put_ldev(mdev); | 1724 | put_ldev(mdev); |
1664 | if (dd == dev_size_error) { | 1725 | if (dd == dev_size_error) { |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index fd26666c0b08..25d32c5aa50a 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -333,7 +333,7 @@ struct drbd_epoch_entry *drbd_alloc_ee(struct drbd_conf *mdev, | |||
333 | if (!page) | 333 | if (!page) |
334 | goto fail; | 334 | goto fail; |
335 | 335 | ||
336 | INIT_HLIST_NODE(&e->colision); | 336 | INIT_HLIST_NODE(&e->collision); |
337 | e->epoch = NULL; | 337 | e->epoch = NULL; |
338 | e->mdev = mdev; | 338 | e->mdev = mdev; |
339 | e->pages = page; | 339 | e->pages = page; |
@@ -356,7 +356,7 @@ void drbd_free_some_ee(struct drbd_conf *mdev, struct drbd_epoch_entry *e, int i | |||
356 | kfree(e->digest); | 356 | kfree(e->digest); |
357 | drbd_pp_free(mdev, e->pages, is_net); | 357 | drbd_pp_free(mdev, e->pages, is_net); |
358 | D_ASSERT(atomic_read(&e->pending_bios) == 0); | 358 | D_ASSERT(atomic_read(&e->pending_bios) == 0); |
359 | D_ASSERT(hlist_unhashed(&e->colision)); | 359 | D_ASSERT(hlist_unhashed(&e->collision)); |
360 | mempool_free(e, drbd_ee_mempool); | 360 | mempool_free(e, drbd_ee_mempool); |
361 | } | 361 | } |
362 | 362 | ||
@@ -787,7 +787,7 @@ static int drbd_connect(struct drbd_conf *mdev) | |||
787 | } | 787 | } |
788 | 788 | ||
789 | if (sock && msock) { | 789 | if (sock && msock) { |
790 | schedule_timeout_interruptible(HZ / 10); | 790 | schedule_timeout_interruptible(mdev->net_conf->ping_timeo*HZ/10); |
791 | ok = drbd_socket_okay(mdev, &sock); | 791 | ok = drbd_socket_okay(mdev, &sock); |
792 | ok = drbd_socket_okay(mdev, &msock) && ok; | 792 | ok = drbd_socket_okay(mdev, &msock) && ok; |
793 | if (ok) | 793 | if (ok) |
@@ -899,11 +899,6 @@ retry: | |||
899 | 899 | ||
900 | drbd_thread_start(&mdev->asender); | 900 | drbd_thread_start(&mdev->asender); |
901 | 901 | ||
902 | if (mdev->agreed_pro_version < 95 && get_ldev(mdev)) { | ||
903 | drbd_setup_queue_param(mdev, DRBD_MAX_SIZE_H80_PACKET); | ||
904 | put_ldev(mdev); | ||
905 | } | ||
906 | |||
907 | if (drbd_send_protocol(mdev) == -1) | 902 | if (drbd_send_protocol(mdev) == -1) |
908 | return -1; | 903 | return -1; |
909 | drbd_send_sync_param(mdev, &mdev->sync_conf); | 904 | drbd_send_sync_param(mdev, &mdev->sync_conf); |
@@ -1418,7 +1413,7 @@ static int e_end_resync_block(struct drbd_conf *mdev, struct drbd_work *w, int u | |||
1418 | sector_t sector = e->sector; | 1413 | sector_t sector = e->sector; |
1419 | int ok; | 1414 | int ok; |
1420 | 1415 | ||
1421 | D_ASSERT(hlist_unhashed(&e->colision)); | 1416 | D_ASSERT(hlist_unhashed(&e->collision)); |
1422 | 1417 | ||
1423 | if (likely((e->flags & EE_WAS_ERROR) == 0)) { | 1418 | if (likely((e->flags & EE_WAS_ERROR) == 0)) { |
1424 | drbd_set_in_sync(mdev, sector, e->size); | 1419 | drbd_set_in_sync(mdev, sector, e->size); |
@@ -1487,7 +1482,7 @@ static int receive_DataReply(struct drbd_conf *mdev, enum drbd_packets cmd, unsi | |||
1487 | return false; | 1482 | return false; |
1488 | } | 1483 | } |
1489 | 1484 | ||
1490 | /* hlist_del(&req->colision) is done in _req_may_be_done, to avoid | 1485 | /* hlist_del(&req->collision) is done in _req_may_be_done, to avoid |
1491 | * special casing it there for the various failure cases. | 1486 | * special casing it there for the various failure cases. |
1492 | * still no race with drbd_fail_pending_reads */ | 1487 | * still no race with drbd_fail_pending_reads */ |
1493 | ok = recv_dless_read(mdev, req, sector, data_size); | 1488 | ok = recv_dless_read(mdev, req, sector, data_size); |
@@ -1558,11 +1553,11 @@ static int e_end_block(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1558 | * P_WRITE_ACK / P_NEG_ACK, to get the sequence number right. */ | 1553 | * P_WRITE_ACK / P_NEG_ACK, to get the sequence number right. */ |
1559 | if (mdev->net_conf->two_primaries) { | 1554 | if (mdev->net_conf->two_primaries) { |
1560 | spin_lock_irq(&mdev->req_lock); | 1555 | spin_lock_irq(&mdev->req_lock); |
1561 | D_ASSERT(!hlist_unhashed(&e->colision)); | 1556 | D_ASSERT(!hlist_unhashed(&e->collision)); |
1562 | hlist_del_init(&e->colision); | 1557 | hlist_del_init(&e->collision); |
1563 | spin_unlock_irq(&mdev->req_lock); | 1558 | spin_unlock_irq(&mdev->req_lock); |
1564 | } else { | 1559 | } else { |
1565 | D_ASSERT(hlist_unhashed(&e->colision)); | 1560 | D_ASSERT(hlist_unhashed(&e->collision)); |
1566 | } | 1561 | } |
1567 | 1562 | ||
1568 | drbd_may_finish_epoch(mdev, e->epoch, EV_PUT + (cancel ? EV_CLEANUP : 0)); | 1563 | drbd_may_finish_epoch(mdev, e->epoch, EV_PUT + (cancel ? EV_CLEANUP : 0)); |
@@ -1579,8 +1574,8 @@ static int e_send_discard_ack(struct drbd_conf *mdev, struct drbd_work *w, int u | |||
1579 | ok = drbd_send_ack(mdev, P_DISCARD_ACK, e); | 1574 | ok = drbd_send_ack(mdev, P_DISCARD_ACK, e); |
1580 | 1575 | ||
1581 | spin_lock_irq(&mdev->req_lock); | 1576 | spin_lock_irq(&mdev->req_lock); |
1582 | D_ASSERT(!hlist_unhashed(&e->colision)); | 1577 | D_ASSERT(!hlist_unhashed(&e->collision)); |
1583 | hlist_del_init(&e->colision); | 1578 | hlist_del_init(&e->collision); |
1584 | spin_unlock_irq(&mdev->req_lock); | 1579 | spin_unlock_irq(&mdev->req_lock); |
1585 | 1580 | ||
1586 | dec_unacked(mdev); | 1581 | dec_unacked(mdev); |
@@ -1755,7 +1750,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
1755 | 1750 | ||
1756 | spin_lock_irq(&mdev->req_lock); | 1751 | spin_lock_irq(&mdev->req_lock); |
1757 | 1752 | ||
1758 | hlist_add_head(&e->colision, ee_hash_slot(mdev, sector)); | 1753 | hlist_add_head(&e->collision, ee_hash_slot(mdev, sector)); |
1759 | 1754 | ||
1760 | #define OVERLAPS overlaps(i->sector, i->size, sector, size) | 1755 | #define OVERLAPS overlaps(i->sector, i->size, sector, size) |
1761 | slot = tl_hash_slot(mdev, sector); | 1756 | slot = tl_hash_slot(mdev, sector); |
@@ -1765,7 +1760,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
1765 | int have_conflict = 0; | 1760 | int have_conflict = 0; |
1766 | prepare_to_wait(&mdev->misc_wait, &wait, | 1761 | prepare_to_wait(&mdev->misc_wait, &wait, |
1767 | TASK_INTERRUPTIBLE); | 1762 | TASK_INTERRUPTIBLE); |
1768 | hlist_for_each_entry(i, n, slot, colision) { | 1763 | hlist_for_each_entry(i, n, slot, collision) { |
1769 | if (OVERLAPS) { | 1764 | if (OVERLAPS) { |
1770 | /* only ALERT on first iteration, | 1765 | /* only ALERT on first iteration, |
1771 | * we may be woken up early... */ | 1766 | * we may be woken up early... */ |
@@ -1804,7 +1799,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
1804 | } | 1799 | } |
1805 | 1800 | ||
1806 | if (signal_pending(current)) { | 1801 | if (signal_pending(current)) { |
1807 | hlist_del_init(&e->colision); | 1802 | hlist_del_init(&e->collision); |
1808 | 1803 | ||
1809 | spin_unlock_irq(&mdev->req_lock); | 1804 | spin_unlock_irq(&mdev->req_lock); |
1810 | 1805 | ||
@@ -1862,7 +1857,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
1862 | dev_err(DEV, "submit failed, triggering re-connect\n"); | 1857 | dev_err(DEV, "submit failed, triggering re-connect\n"); |
1863 | spin_lock_irq(&mdev->req_lock); | 1858 | spin_lock_irq(&mdev->req_lock); |
1864 | list_del(&e->w.list); | 1859 | list_del(&e->w.list); |
1865 | hlist_del_init(&e->colision); | 1860 | hlist_del_init(&e->collision); |
1866 | spin_unlock_irq(&mdev->req_lock); | 1861 | spin_unlock_irq(&mdev->req_lock); |
1867 | if (e->flags & EE_CALL_AL_COMPLETE_IO) | 1862 | if (e->flags & EE_CALL_AL_COMPLETE_IO) |
1868 | drbd_al_complete_io(mdev, e->sector); | 1863 | drbd_al_complete_io(mdev, e->sector); |
@@ -2916,12 +2911,6 @@ disconnect: | |||
2916 | return false; | 2911 | return false; |
2917 | } | 2912 | } |
2918 | 2913 | ||
2919 | static void drbd_setup_order_type(struct drbd_conf *mdev, int peer) | ||
2920 | { | ||
2921 | /* sorry, we currently have no working implementation | ||
2922 | * of distributed TCQ */ | ||
2923 | } | ||
2924 | |||
2925 | /* warn if the arguments differ by more than 12.5% */ | 2914 | /* warn if the arguments differ by more than 12.5% */ |
2926 | static void warn_if_differ_considerably(struct drbd_conf *mdev, | 2915 | static void warn_if_differ_considerably(struct drbd_conf *mdev, |
2927 | const char *s, sector_t a, sector_t b) | 2916 | const char *s, sector_t a, sector_t b) |
@@ -2939,7 +2928,6 @@ static int receive_sizes(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
2939 | { | 2928 | { |
2940 | struct p_sizes *p = &mdev->data.rbuf.sizes; | 2929 | struct p_sizes *p = &mdev->data.rbuf.sizes; |
2941 | enum determine_dev_size dd = unchanged; | 2930 | enum determine_dev_size dd = unchanged; |
2942 | unsigned int max_bio_size; | ||
2943 | sector_t p_size, p_usize, my_usize; | 2931 | sector_t p_size, p_usize, my_usize; |
2944 | int ldsc = 0; /* local disk size changed */ | 2932 | int ldsc = 0; /* local disk size changed */ |
2945 | enum dds_flags ddsf; | 2933 | enum dds_flags ddsf; |
@@ -2994,7 +2982,7 @@ static int receive_sizes(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
2994 | 2982 | ||
2995 | ddsf = be16_to_cpu(p->dds_flags); | 2983 | ddsf = be16_to_cpu(p->dds_flags); |
2996 | if (get_ldev(mdev)) { | 2984 | if (get_ldev(mdev)) { |
2997 | dd = drbd_determin_dev_size(mdev, ddsf); | 2985 | dd = drbd_determine_dev_size(mdev, ddsf); |
2998 | put_ldev(mdev); | 2986 | put_ldev(mdev); |
2999 | if (dd == dev_size_error) | 2987 | if (dd == dev_size_error) |
3000 | return false; | 2988 | return false; |
@@ -3004,23 +2992,15 @@ static int receive_sizes(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
3004 | drbd_set_my_capacity(mdev, p_size); | 2992 | drbd_set_my_capacity(mdev, p_size); |
3005 | } | 2993 | } |
3006 | 2994 | ||
2995 | mdev->peer_max_bio_size = be32_to_cpu(p->max_bio_size); | ||
2996 | drbd_reconsider_max_bio_size(mdev); | ||
2997 | |||
3007 | if (get_ldev(mdev)) { | 2998 | if (get_ldev(mdev)) { |
3008 | if (mdev->ldev->known_size != drbd_get_capacity(mdev->ldev->backing_bdev)) { | 2999 | if (mdev->ldev->known_size != drbd_get_capacity(mdev->ldev->backing_bdev)) { |
3009 | mdev->ldev->known_size = drbd_get_capacity(mdev->ldev->backing_bdev); | 3000 | mdev->ldev->known_size = drbd_get_capacity(mdev->ldev->backing_bdev); |
3010 | ldsc = 1; | 3001 | ldsc = 1; |
3011 | } | 3002 | } |
3012 | 3003 | ||
3013 | if (mdev->agreed_pro_version < 94) | ||
3014 | max_bio_size = be32_to_cpu(p->max_bio_size); | ||
3015 | else if (mdev->agreed_pro_version == 94) | ||
3016 | max_bio_size = DRBD_MAX_SIZE_H80_PACKET; | ||
3017 | else /* drbd 8.3.8 onwards */ | ||
3018 | max_bio_size = DRBD_MAX_BIO_SIZE; | ||
3019 | |||
3020 | if (max_bio_size != queue_max_hw_sectors(mdev->rq_queue) << 9) | ||
3021 | drbd_setup_queue_param(mdev, max_bio_size); | ||
3022 | |||
3023 | drbd_setup_order_type(mdev, be16_to_cpu(p->queue_order_type)); | ||
3024 | put_ldev(mdev); | 3004 | put_ldev(mdev); |
3025 | } | 3005 | } |
3026 | 3006 | ||
@@ -4275,7 +4255,7 @@ static struct drbd_request *_ack_id_to_req(struct drbd_conf *mdev, | |||
4275 | struct hlist_node *n; | 4255 | struct hlist_node *n; |
4276 | struct drbd_request *req; | 4256 | struct drbd_request *req; |
4277 | 4257 | ||
4278 | hlist_for_each_entry(req, n, slot, colision) { | 4258 | hlist_for_each_entry(req, n, slot, collision) { |
4279 | if ((unsigned long)req == (unsigned long)id) { | 4259 | if ((unsigned long)req == (unsigned long)id) { |
4280 | if (req->sector != sector) { | 4260 | if (req->sector != sector) { |
4281 | dev_err(DEV, "_ack_id_to_req: found req %p but it has " | 4261 | dev_err(DEV, "_ack_id_to_req: found req %p but it has " |
@@ -4554,6 +4534,7 @@ int drbd_asender(struct drbd_thread *thi) | |||
4554 | int received = 0; | 4534 | int received = 0; |
4555 | int expect = sizeof(struct p_header80); | 4535 | int expect = sizeof(struct p_header80); |
4556 | int empty; | 4536 | int empty; |
4537 | int ping_timeout_active = 0; | ||
4557 | 4538 | ||
4558 | sprintf(current->comm, "drbd%d_asender", mdev_to_minor(mdev)); | 4539 | sprintf(current->comm, "drbd%d_asender", mdev_to_minor(mdev)); |
4559 | 4540 | ||
@@ -4566,6 +4547,7 @@ int drbd_asender(struct drbd_thread *thi) | |||
4566 | ERR_IF(!drbd_send_ping(mdev)) goto reconnect; | 4547 | ERR_IF(!drbd_send_ping(mdev)) goto reconnect; |
4567 | mdev->meta.socket->sk->sk_rcvtimeo = | 4548 | mdev->meta.socket->sk->sk_rcvtimeo = |
4568 | mdev->net_conf->ping_timeo*HZ/10; | 4549 | mdev->net_conf->ping_timeo*HZ/10; |
4550 | ping_timeout_active = 1; | ||
4569 | } | 4551 | } |
4570 | 4552 | ||
4571 | /* conditionally cork; | 4553 | /* conditionally cork; |
@@ -4620,8 +4602,7 @@ int drbd_asender(struct drbd_thread *thi) | |||
4620 | dev_err(DEV, "meta connection shut down by peer.\n"); | 4602 | dev_err(DEV, "meta connection shut down by peer.\n"); |
4621 | goto reconnect; | 4603 | goto reconnect; |
4622 | } else if (rv == -EAGAIN) { | 4604 | } else if (rv == -EAGAIN) { |
4623 | if (mdev->meta.socket->sk->sk_rcvtimeo == | 4605 | if (ping_timeout_active) { |
4624 | mdev->net_conf->ping_timeo*HZ/10) { | ||
4625 | dev_err(DEV, "PingAck did not arrive in time.\n"); | 4606 | dev_err(DEV, "PingAck did not arrive in time.\n"); |
4626 | goto reconnect; | 4607 | goto reconnect; |
4627 | } | 4608 | } |
@@ -4660,6 +4641,11 @@ int drbd_asender(struct drbd_thread *thi) | |||
4660 | if (!cmd->process(mdev, h)) | 4641 | if (!cmd->process(mdev, h)) |
4661 | goto reconnect; | 4642 | goto reconnect; |
4662 | 4643 | ||
4644 | /* the idle_timeout (ping-int) | ||
4645 | * has been restored in got_PingAck() */ | ||
4646 | if (cmd == get_asender_cmd(P_PING_ACK)) | ||
4647 | ping_timeout_active = 0; | ||
4648 | |||
4663 | buf = h; | 4649 | buf = h; |
4664 | received = 0; | 4650 | received = 0; |
4665 | expect = sizeof(struct p_header80); | 4651 | expect = sizeof(struct p_header80); |
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index 5c0c8be1bb0a..3424d675b769 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -163,7 +163,7 @@ static void _about_to_complete_local_write(struct drbd_conf *mdev, | |||
163 | * they must have been failed on the spot */ | 163 | * they must have been failed on the spot */ |
164 | #define OVERLAPS overlaps(sector, size, i->sector, i->size) | 164 | #define OVERLAPS overlaps(sector, size, i->sector, i->size) |
165 | slot = tl_hash_slot(mdev, sector); | 165 | slot = tl_hash_slot(mdev, sector); |
166 | hlist_for_each_entry(i, n, slot, colision) { | 166 | hlist_for_each_entry(i, n, slot, collision) { |
167 | if (OVERLAPS) { | 167 | if (OVERLAPS) { |
168 | dev_alert(DEV, "LOGIC BUG: completed: %p %llus +%u; " | 168 | dev_alert(DEV, "LOGIC BUG: completed: %p %llus +%u; " |
169 | "other: %p %llus +%u\n", | 169 | "other: %p %llus +%u\n", |
@@ -187,7 +187,7 @@ static void _about_to_complete_local_write(struct drbd_conf *mdev, | |||
187 | #undef OVERLAPS | 187 | #undef OVERLAPS |
188 | #define OVERLAPS overlaps(sector, size, e->sector, e->size) | 188 | #define OVERLAPS overlaps(sector, size, e->sector, e->size) |
189 | slot = ee_hash_slot(mdev, req->sector); | 189 | slot = ee_hash_slot(mdev, req->sector); |
190 | hlist_for_each_entry(e, n, slot, colision) { | 190 | hlist_for_each_entry(e, n, slot, collision) { |
191 | if (OVERLAPS) { | 191 | if (OVERLAPS) { |
192 | wake_up(&mdev->misc_wait); | 192 | wake_up(&mdev->misc_wait); |
193 | break; | 193 | break; |
@@ -260,8 +260,8 @@ void _req_may_be_done(struct drbd_request *req, struct bio_and_error *m) | |||
260 | 260 | ||
261 | /* remove the request from the conflict detection | 261 | /* remove the request from the conflict detection |
262 | * respective block_id verification hash */ | 262 | * respective block_id verification hash */ |
263 | if (!hlist_unhashed(&req->colision)) | 263 | if (!hlist_unhashed(&req->collision)) |
264 | hlist_del(&req->colision); | 264 | hlist_del(&req->collision); |
265 | else | 265 | else |
266 | D_ASSERT((s & (RQ_NET_MASK & ~RQ_NET_DONE)) == 0); | 266 | D_ASSERT((s & (RQ_NET_MASK & ~RQ_NET_DONE)) == 0); |
267 | 267 | ||
@@ -329,7 +329,7 @@ static int _req_conflicts(struct drbd_request *req) | |||
329 | struct hlist_node *n; | 329 | struct hlist_node *n; |
330 | struct hlist_head *slot; | 330 | struct hlist_head *slot; |
331 | 331 | ||
332 | D_ASSERT(hlist_unhashed(&req->colision)); | 332 | D_ASSERT(hlist_unhashed(&req->collision)); |
333 | 333 | ||
334 | if (!get_net_conf(mdev)) | 334 | if (!get_net_conf(mdev)) |
335 | return 0; | 335 | return 0; |
@@ -341,7 +341,7 @@ static int _req_conflicts(struct drbd_request *req) | |||
341 | 341 | ||
342 | #define OVERLAPS overlaps(i->sector, i->size, sector, size) | 342 | #define OVERLAPS overlaps(i->sector, i->size, sector, size) |
343 | slot = tl_hash_slot(mdev, sector); | 343 | slot = tl_hash_slot(mdev, sector); |
344 | hlist_for_each_entry(i, n, slot, colision) { | 344 | hlist_for_each_entry(i, n, slot, collision) { |
345 | if (OVERLAPS) { | 345 | if (OVERLAPS) { |
346 | dev_alert(DEV, "%s[%u] Concurrent local write detected! " | 346 | dev_alert(DEV, "%s[%u] Concurrent local write detected! " |
347 | "[DISCARD L] new: %llus +%u; " | 347 | "[DISCARD L] new: %llus +%u; " |
@@ -359,7 +359,7 @@ static int _req_conflicts(struct drbd_request *req) | |||
359 | #undef OVERLAPS | 359 | #undef OVERLAPS |
360 | #define OVERLAPS overlaps(e->sector, e->size, sector, size) | 360 | #define OVERLAPS overlaps(e->sector, e->size, sector, size) |
361 | slot = ee_hash_slot(mdev, sector); | 361 | slot = ee_hash_slot(mdev, sector); |
362 | hlist_for_each_entry(e, n, slot, colision) { | 362 | hlist_for_each_entry(e, n, slot, collision) { |
363 | if (OVERLAPS) { | 363 | if (OVERLAPS) { |
364 | dev_alert(DEV, "%s[%u] Concurrent remote write detected!" | 364 | dev_alert(DEV, "%s[%u] Concurrent remote write detected!" |
365 | " [DISCARD L] new: %llus +%u; " | 365 | " [DISCARD L] new: %llus +%u; " |
@@ -491,7 +491,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
491 | 491 | ||
492 | /* so we can verify the handle in the answer packet | 492 | /* so we can verify the handle in the answer packet |
493 | * corresponding hlist_del is in _req_may_be_done() */ | 493 | * corresponding hlist_del is in _req_may_be_done() */ |
494 | hlist_add_head(&req->colision, ar_hash_slot(mdev, req->sector)); | 494 | hlist_add_head(&req->collision, ar_hash_slot(mdev, req->sector)); |
495 | 495 | ||
496 | set_bit(UNPLUG_REMOTE, &mdev->flags); | 496 | set_bit(UNPLUG_REMOTE, &mdev->flags); |
497 | 497 | ||
@@ -507,7 +507,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
507 | /* assert something? */ | 507 | /* assert something? */ |
508 | /* from drbd_make_request_common only */ | 508 | /* from drbd_make_request_common only */ |
509 | 509 | ||
510 | hlist_add_head(&req->colision, tl_hash_slot(mdev, req->sector)); | 510 | hlist_add_head(&req->collision, tl_hash_slot(mdev, req->sector)); |
511 | /* corresponding hlist_del is in _req_may_be_done() */ | 511 | /* corresponding hlist_del is in _req_may_be_done() */ |
512 | 512 | ||
513 | /* NOTE | 513 | /* NOTE |
@@ -1033,7 +1033,7 @@ fail_conflicting: | |||
1033 | err = 0; | 1033 | err = 0; |
1034 | 1034 | ||
1035 | fail_free_complete: | 1035 | fail_free_complete: |
1036 | if (rw == WRITE && local) | 1036 | if (req->rq_state & RQ_IN_ACT_LOG) |
1037 | drbd_al_complete_io(mdev, sector); | 1037 | drbd_al_complete_io(mdev, sector); |
1038 | fail_and_free_req: | 1038 | fail_and_free_req: |
1039 | if (local) { | 1039 | if (local) { |
diff --git a/drivers/block/drbd/drbd_req.h b/drivers/block/drbd/drbd_req.h index 32e2c3e6a813..68a234a5fdc5 100644 --- a/drivers/block/drbd/drbd_req.h +++ b/drivers/block/drbd/drbd_req.h | |||
@@ -256,7 +256,7 @@ static inline struct drbd_request *_ar_id_to_req(struct drbd_conf *mdev, | |||
256 | struct hlist_node *n; | 256 | struct hlist_node *n; |
257 | struct drbd_request *req; | 257 | struct drbd_request *req; |
258 | 258 | ||
259 | hlist_for_each_entry(req, n, slot, colision) { | 259 | hlist_for_each_entry(req, n, slot, collision) { |
260 | if ((unsigned long)req == (unsigned long)id) { | 260 | if ((unsigned long)req == (unsigned long)id) { |
261 | D_ASSERT(req->sector == sector); | 261 | D_ASSERT(req->sector == sector); |
262 | return req; | 262 | return req; |
@@ -291,7 +291,7 @@ static inline struct drbd_request *drbd_req_new(struct drbd_conf *mdev, | |||
291 | req->epoch = 0; | 291 | req->epoch = 0; |
292 | req->sector = bio_src->bi_sector; | 292 | req->sector = bio_src->bi_sector; |
293 | req->size = bio_src->bi_size; | 293 | req->size = bio_src->bi_size; |
294 | INIT_HLIST_NODE(&req->colision); | 294 | INIT_HLIST_NODE(&req->collision); |
295 | INIT_LIST_HEAD(&req->tl_requests); | 295 | INIT_LIST_HEAD(&req->tl_requests); |
296 | INIT_LIST_HEAD(&req->w.list); | 296 | INIT_LIST_HEAD(&req->w.list); |
297 | } | 297 | } |
@@ -323,6 +323,7 @@ extern int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
323 | extern void complete_master_bio(struct drbd_conf *mdev, | 323 | extern void complete_master_bio(struct drbd_conf *mdev, |
324 | struct bio_and_error *m); | 324 | struct bio_and_error *m); |
325 | extern void request_timer_fn(unsigned long data); | 325 | extern void request_timer_fn(unsigned long data); |
326 | extern void tl_restart(struct drbd_conf *mdev, enum drbd_req_event what); | ||
326 | 327 | ||
327 | /* use this if you don't want to deal with calling complete_master_bio() | 328 | /* use this if you don't want to deal with calling complete_master_bio() |
328 | * outside the spinlock, e.g. when walking some list on cleanup. */ | 329 | * outside the spinlock, e.g. when walking some list on cleanup. */ |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index f7e6c92f8d03..4d76b06b6b20 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -126,7 +126,7 @@ static void drbd_endio_write_sec_final(struct drbd_epoch_entry *e) __releases(lo | |||
126 | list_del(&e->w.list); /* has been on active_ee or sync_ee */ | 126 | list_del(&e->w.list); /* has been on active_ee or sync_ee */ |
127 | list_add_tail(&e->w.list, &mdev->done_ee); | 127 | list_add_tail(&e->w.list, &mdev->done_ee); |
128 | 128 | ||
129 | /* No hlist_del_init(&e->colision) here, we did not send the Ack yet, | 129 | /* No hlist_del_init(&e->collision) here, we did not send the Ack yet, |
130 | * neither did we wake possibly waiting conflicting requests. | 130 | * neither did we wake possibly waiting conflicting requests. |
131 | * done from "drbd_process_done_ee" within the appropriate w.cb | 131 | * done from "drbd_process_done_ee" within the appropriate w.cb |
132 | * (e_end_block/e_end_resync_block) or from _drbd_clear_done_ee */ | 132 | * (e_end_block/e_end_resync_block) or from _drbd_clear_done_ee */ |
@@ -297,42 +297,48 @@ void drbd_csum_bio(struct drbd_conf *mdev, struct crypto_hash *tfm, struct bio * | |||
297 | crypto_hash_final(&desc, digest); | 297 | crypto_hash_final(&desc, digest); |
298 | } | 298 | } |
299 | 299 | ||
300 | static int w_e_send_csum(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | 300 | /* TODO merge common code with w_e_end_ov_req */ |
301 | int w_e_send_csum(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | ||
301 | { | 302 | { |
302 | struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w); | 303 | struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w); |
303 | int digest_size; | 304 | int digest_size; |
304 | void *digest; | 305 | void *digest; |
305 | int ok; | 306 | int ok = 1; |
306 | 307 | ||
307 | D_ASSERT(e->block_id == DRBD_MAGIC + 0xbeef); | 308 | D_ASSERT(e->block_id == DRBD_MAGIC + 0xbeef); |
308 | 309 | ||
309 | if (unlikely(cancel)) { | 310 | if (unlikely(cancel)) |
310 | drbd_free_ee(mdev, e); | 311 | goto out; |
311 | return 1; | ||
312 | } | ||
313 | 312 | ||
314 | if (likely((e->flags & EE_WAS_ERROR) == 0)) { | 313 | if (likely((e->flags & EE_WAS_ERROR) != 0)) |
315 | digest_size = crypto_hash_digestsize(mdev->csums_tfm); | 314 | goto out; |
316 | digest = kmalloc(digest_size, GFP_NOIO); | ||
317 | if (digest) { | ||
318 | drbd_csum_ee(mdev, mdev->csums_tfm, e, digest); | ||
319 | 315 | ||
320 | inc_rs_pending(mdev); | 316 | digest_size = crypto_hash_digestsize(mdev->csums_tfm); |
321 | ok = drbd_send_drequest_csum(mdev, | 317 | digest = kmalloc(digest_size, GFP_NOIO); |
322 | e->sector, | 318 | if (digest) { |
323 | e->size, | 319 | sector_t sector = e->sector; |
324 | digest, | 320 | unsigned int size = e->size; |
325 | digest_size, | 321 | drbd_csum_ee(mdev, mdev->csums_tfm, e, digest); |
326 | P_CSUM_RS_REQUEST); | 322 | /* Free e and pages before send. |
327 | kfree(digest); | 323 | * In case we block on congestion, we could otherwise run into |
328 | } else { | 324 | * some distributed deadlock, if the other side blocks on |
329 | dev_err(DEV, "kmalloc() of digest failed.\n"); | 325 | * congestion as well, because our receiver blocks in |
330 | ok = 0; | 326 | * drbd_pp_alloc due to pp_in_use > max_buffers. */ |
331 | } | 327 | drbd_free_ee(mdev, e); |
332 | } else | 328 | e = NULL; |
333 | ok = 1; | 329 | inc_rs_pending(mdev); |
330 | ok = drbd_send_drequest_csum(mdev, sector, size, | ||
331 | digest, digest_size, | ||
332 | P_CSUM_RS_REQUEST); | ||
333 | kfree(digest); | ||
334 | } else { | ||
335 | dev_err(DEV, "kmalloc() of digest failed.\n"); | ||
336 | ok = 0; | ||
337 | } | ||
334 | 338 | ||
335 | drbd_free_ee(mdev, e); | 339 | out: |
340 | if (e) | ||
341 | drbd_free_ee(mdev, e); | ||
336 | 342 | ||
337 | if (unlikely(!ok)) | 343 | if (unlikely(!ok)) |
338 | dev_err(DEV, "drbd_send_drequest(..., csum) failed\n"); | 344 | dev_err(DEV, "drbd_send_drequest(..., csum) failed\n"); |
@@ -834,7 +840,7 @@ int drbd_resync_finished(struct drbd_conf *mdev) | |||
834 | const int ratio = | 840 | const int ratio = |
835 | (t == 0) ? 0 : | 841 | (t == 0) ? 0 : |
836 | (t < 100000) ? ((s*100)/t) : (s/(t/100)); | 842 | (t < 100000) ? ((s*100)/t) : (s/(t/100)); |
837 | dev_info(DEV, "%u %% had equal check sums, eliminated: %luK; " | 843 | dev_info(DEV, "%u %% had equal checksums, eliminated: %luK; " |
838 | "transferred %luK total %luK\n", | 844 | "transferred %luK total %luK\n", |
839 | ratio, | 845 | ratio, |
840 | Bit2KB(mdev->rs_same_csum), | 846 | Bit2KB(mdev->rs_same_csum), |
@@ -1071,9 +1077,12 @@ int w_e_end_csum_rs_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1071 | return ok; | 1077 | return ok; |
1072 | } | 1078 | } |
1073 | 1079 | ||
1080 | /* TODO merge common code with w_e_send_csum */ | ||
1074 | int w_e_end_ov_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | 1081 | int w_e_end_ov_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel) |
1075 | { | 1082 | { |
1076 | struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w); | 1083 | struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w); |
1084 | sector_t sector = e->sector; | ||
1085 | unsigned int size = e->size; | ||
1077 | int digest_size; | 1086 | int digest_size; |
1078 | void *digest; | 1087 | void *digest; |
1079 | int ok = 1; | 1088 | int ok = 1; |
@@ -1093,17 +1102,25 @@ int w_e_end_ov_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1093 | else | 1102 | else |
1094 | memset(digest, 0, digest_size); | 1103 | memset(digest, 0, digest_size); |
1095 | 1104 | ||
1105 | /* Free e and pages before send. | ||
1106 | * In case we block on congestion, we could otherwise run into | ||
1107 | * some distributed deadlock, if the other side blocks on | ||
1108 | * congestion as well, because our receiver blocks in | ||
1109 | * drbd_pp_alloc due to pp_in_use > max_buffers. */ | ||
1110 | drbd_free_ee(mdev, e); | ||
1111 | e = NULL; | ||
1096 | inc_rs_pending(mdev); | 1112 | inc_rs_pending(mdev); |
1097 | ok = drbd_send_drequest_csum(mdev, e->sector, e->size, | 1113 | ok = drbd_send_drequest_csum(mdev, sector, size, |
1098 | digest, digest_size, P_OV_REPLY); | 1114 | digest, digest_size, |
1115 | P_OV_REPLY); | ||
1099 | if (!ok) | 1116 | if (!ok) |
1100 | dec_rs_pending(mdev); | 1117 | dec_rs_pending(mdev); |
1101 | kfree(digest); | 1118 | kfree(digest); |
1102 | 1119 | ||
1103 | out: | 1120 | out: |
1104 | drbd_free_ee(mdev, e); | 1121 | if (e) |
1122 | drbd_free_ee(mdev, e); | ||
1105 | dec_unacked(mdev); | 1123 | dec_unacked(mdev); |
1106 | |||
1107 | return ok; | 1124 | return ok; |
1108 | } | 1125 | } |
1109 | 1126 | ||
@@ -1122,8 +1139,10 @@ int w_e_end_ov_reply(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1122 | { | 1139 | { |
1123 | struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w); | 1140 | struct drbd_epoch_entry *e = container_of(w, struct drbd_epoch_entry, w); |
1124 | struct digest_info *di; | 1141 | struct digest_info *di; |
1125 | int digest_size; | ||
1126 | void *digest; | 1142 | void *digest; |
1143 | sector_t sector = e->sector; | ||
1144 | unsigned int size = e->size; | ||
1145 | int digest_size; | ||
1127 | int ok, eq = 0; | 1146 | int ok, eq = 0; |
1128 | 1147 | ||
1129 | if (unlikely(cancel)) { | 1148 | if (unlikely(cancel)) { |
@@ -1153,16 +1172,21 @@ int w_e_end_ov_reply(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1153 | } | 1172 | } |
1154 | } | 1173 | } |
1155 | 1174 | ||
1156 | dec_unacked(mdev); | 1175 | /* Free e and pages before send. |
1176 | * In case we block on congestion, we could otherwise run into | ||
1177 | * some distributed deadlock, if the other side blocks on | ||
1178 | * congestion as well, because our receiver blocks in | ||
1179 | * drbd_pp_alloc due to pp_in_use > max_buffers. */ | ||
1180 | drbd_free_ee(mdev, e); | ||
1157 | if (!eq) | 1181 | if (!eq) |
1158 | drbd_ov_oos_found(mdev, e->sector, e->size); | 1182 | drbd_ov_oos_found(mdev, sector, size); |
1159 | else | 1183 | else |
1160 | ov_oos_print(mdev); | 1184 | ov_oos_print(mdev); |
1161 | 1185 | ||
1162 | ok = drbd_send_ack_ex(mdev, P_OV_RESULT, e->sector, e->size, | 1186 | ok = drbd_send_ack_ex(mdev, P_OV_RESULT, sector, size, |
1163 | eq ? ID_IN_SYNC : ID_OUT_OF_SYNC); | 1187 | eq ? ID_IN_SYNC : ID_OUT_OF_SYNC); |
1164 | 1188 | ||
1165 | drbd_free_ee(mdev, e); | 1189 | dec_unacked(mdev); |
1166 | 1190 | ||
1167 | --mdev->ov_left; | 1191 | --mdev->ov_left; |
1168 | 1192 | ||
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index a076a14ca72d..c59a672a3de0 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -1658,7 +1658,7 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data) | |||
1658 | struct kobject *kobj; | 1658 | struct kobject *kobj; |
1659 | 1659 | ||
1660 | mutex_lock(&loop_devices_mutex); | 1660 | mutex_lock(&loop_devices_mutex); |
1661 | lo = loop_init_one(dev & MINORMASK); | 1661 | lo = loop_init_one(MINOR(dev) >> part_shift); |
1662 | kobj = lo ? get_disk(lo->lo_disk) : ERR_PTR(-ENOMEM); | 1662 | kobj = lo ? get_disk(lo->lo_disk) : ERR_PTR(-ENOMEM); |
1663 | mutex_unlock(&loop_devices_mutex); | 1663 | mutex_unlock(&loop_devices_mutex); |
1664 | 1664 | ||
@@ -1691,15 +1691,18 @@ static int __init loop_init(void) | |||
1691 | if (max_part > 0) | 1691 | if (max_part > 0) |
1692 | part_shift = fls(max_part); | 1692 | part_shift = fls(max_part); |
1693 | 1693 | ||
1694 | if ((1UL << part_shift) > DISK_MAX_PARTS) | ||
1695 | return -EINVAL; | ||
1696 | |||
1694 | if (max_loop > 1UL << (MINORBITS - part_shift)) | 1697 | if (max_loop > 1UL << (MINORBITS - part_shift)) |
1695 | return -EINVAL; | 1698 | return -EINVAL; |
1696 | 1699 | ||
1697 | if (max_loop) { | 1700 | if (max_loop) { |
1698 | nr = max_loop; | 1701 | nr = max_loop; |
1699 | range = max_loop; | 1702 | range = max_loop << part_shift; |
1700 | } else { | 1703 | } else { |
1701 | nr = 8; | 1704 | nr = 8; |
1702 | range = 1UL << (MINORBITS - part_shift); | 1705 | range = 1UL << MINORBITS; |
1703 | } | 1706 | } |
1704 | 1707 | ||
1705 | if (register_blkdev(LOOP_MAJOR, "loop")) | 1708 | if (register_blkdev(LOOP_MAJOR, "loop")) |
@@ -1738,7 +1741,7 @@ static void __exit loop_exit(void) | |||
1738 | unsigned long range; | 1741 | unsigned long range; |
1739 | struct loop_device *lo, *next; | 1742 | struct loop_device *lo, *next; |
1740 | 1743 | ||
1741 | range = max_loop ? max_loop : 1UL << (MINORBITS - part_shift); | 1744 | range = max_loop ? max_loop << part_shift : 1UL << MINORBITS; |
1742 | 1745 | ||
1743 | list_for_each_entry_safe(lo, next, &loop_devices, lo_list) | 1746 | list_for_each_entry_safe(lo, next, &loop_devices, lo_list) |
1744 | loop_del_one(lo); | 1747 | loop_del_one(lo); |
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index 8690e31d9932..a0aabd904a51 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
@@ -320,6 +320,8 @@ static void pcd_init_units(void) | |||
320 | disk->first_minor = unit; | 320 | disk->first_minor = unit; |
321 | strcpy(disk->disk_name, cd->name); /* umm... */ | 321 | strcpy(disk->disk_name, cd->name); /* umm... */ |
322 | disk->fops = &pcd_bdops; | 322 | disk->fops = &pcd_bdops; |
323 | disk->flags = GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; | ||
324 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
323 | } | 325 | } |
324 | } | 326 | } |
325 | 327 | ||
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 9712fad82bc6..1278098624e6 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1191,14 +1191,19 @@ static int rbd_req_sync_notify_ack(struct rbd_device *dev, | |||
1191 | static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) | 1191 | static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) |
1192 | { | 1192 | { |
1193 | struct rbd_device *dev = (struct rbd_device *)data; | 1193 | struct rbd_device *dev = (struct rbd_device *)data; |
1194 | int rc; | ||
1195 | |||
1194 | if (!dev) | 1196 | if (!dev) |
1195 | return; | 1197 | return; |
1196 | 1198 | ||
1197 | dout("rbd_watch_cb %s notify_id=%lld opcode=%d\n", dev->obj_md_name, | 1199 | dout("rbd_watch_cb %s notify_id=%lld opcode=%d\n", dev->obj_md_name, |
1198 | notify_id, (int)opcode); | 1200 | notify_id, (int)opcode); |
1199 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | 1201 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
1200 | __rbd_update_snaps(dev); | 1202 | rc = __rbd_update_snaps(dev); |
1201 | mutex_unlock(&ctl_mutex); | 1203 | mutex_unlock(&ctl_mutex); |
1204 | if (rc) | ||
1205 | pr_warning(DRV_NAME "%d got notification but failed to update" | ||
1206 | " snaps: %d\n", dev->major, rc); | ||
1202 | 1207 | ||
1203 | rbd_req_sync_notify_ack(dev, ver, notify_id, dev->obj_md_name); | 1208 | rbd_req_sync_notify_ack(dev, ver, notify_id, dev->obj_md_name); |
1204 | } | 1209 | } |
@@ -1597,7 +1602,7 @@ static int rbd_header_add_snap(struct rbd_device *dev, | |||
1597 | int name_len = strlen(snap_name); | 1602 | int name_len = strlen(snap_name); |
1598 | u64 new_snapid; | 1603 | u64 new_snapid; |
1599 | int ret; | 1604 | int ret; |
1600 | void *data, *data_start, *data_end; | 1605 | void *data, *p, *e; |
1601 | u64 ver; | 1606 | u64 ver; |
1602 | 1607 | ||
1603 | /* we should create a snapshot only if we're pointing at the head */ | 1608 | /* we should create a snapshot only if we're pointing at the head */ |
@@ -1614,16 +1619,16 @@ static int rbd_header_add_snap(struct rbd_device *dev, | |||
1614 | if (!data) | 1619 | if (!data) |
1615 | return -ENOMEM; | 1620 | return -ENOMEM; |
1616 | 1621 | ||
1617 | data_start = data; | 1622 | p = data; |
1618 | data_end = data + name_len + 16; | 1623 | e = data + name_len + 16; |
1619 | 1624 | ||
1620 | ceph_encode_string_safe(&data, data_end, snap_name, name_len, bad); | 1625 | ceph_encode_string_safe(&p, e, snap_name, name_len, bad); |
1621 | ceph_encode_64_safe(&data, data_end, new_snapid, bad); | 1626 | ceph_encode_64_safe(&p, e, new_snapid, bad); |
1622 | 1627 | ||
1623 | ret = rbd_req_sync_exec(dev, dev->obj_md_name, "rbd", "snap_add", | 1628 | ret = rbd_req_sync_exec(dev, dev->obj_md_name, "rbd", "snap_add", |
1624 | data_start, data - data_start, &ver); | 1629 | data, p - data, &ver); |
1625 | 1630 | ||
1626 | kfree(data_start); | 1631 | kfree(data); |
1627 | 1632 | ||
1628 | if (ret < 0) | 1633 | if (ret < 0) |
1629 | return ret; | 1634 | return ret; |
@@ -1659,6 +1664,9 @@ static int __rbd_update_snaps(struct rbd_device *rbd_dev) | |||
1659 | if (ret < 0) | 1664 | if (ret < 0) |
1660 | return ret; | 1665 | return ret; |
1661 | 1666 | ||
1667 | /* resized? */ | ||
1668 | set_capacity(rbd_dev->disk, h.image_size / 512ULL); | ||
1669 | |||
1662 | down_write(&rbd_dev->header.snap_rwsem); | 1670 | down_write(&rbd_dev->header.snap_rwsem); |
1663 | 1671 | ||
1664 | snap_seq = rbd_dev->header.snapc->seq; | 1672 | snap_seq = rbd_dev->header.snapc->seq; |
@@ -1716,7 +1724,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) | |||
1716 | if (!disk) | 1724 | if (!disk) |
1717 | goto out; | 1725 | goto out; |
1718 | 1726 | ||
1719 | sprintf(disk->disk_name, DRV_NAME "%d", rbd_dev->id); | 1727 | snprintf(disk->disk_name, sizeof(disk->disk_name), DRV_NAME "%d", |
1728 | rbd_dev->id); | ||
1720 | disk->major = rbd_dev->major; | 1729 | disk->major = rbd_dev->major; |
1721 | disk->first_minor = 0; | 1730 | disk->first_minor = 0; |
1722 | disk->fops = &rbd_bd_ops; | 1731 | disk->fops = &rbd_bd_ops; |
diff --git a/drivers/block/xen-blkback/Makefile b/drivers/block/xen-blkback/Makefile new file mode 100644 index 000000000000..e491c1b76878 --- /dev/null +++ b/drivers/block/xen-blkback/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | obj-$(CONFIG_XEN_BLKDEV_BACKEND) := xen-blkback.o | ||
2 | |||
3 | xen-blkback-y := blkback.o xenbus.o | ||
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c new file mode 100644 index 000000000000..c73910cc28c9 --- /dev/null +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -0,0 +1,824 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Back-end of the driver for virtual block devices. This portion of the | ||
4 | * driver exports a 'unified' block-device interface that can be accessed | ||
5 | * by any operating system that implements a compatible front end. A | ||
6 | * reference front-end implementation can be found in: | ||
7 | * drivers/block/xen-blkfront.c | ||
8 | * | ||
9 | * Copyright (c) 2003-2004, Keir Fraser & Steve Hand | ||
10 | * Copyright (c) 2005, Christopher Clark | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License version 2 | ||
14 | * as published by the Free Software Foundation; or, when distributed | ||
15 | * separately from the Linux kernel or incorporated into other | ||
16 | * software packages, subject to the following license: | ||
17 | * | ||
18 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
19 | * of this source file (the "Software"), to deal in the Software without | ||
20 | * restriction, including without limitation the rights to use, copy, modify, | ||
21 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
22 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
23 | * the following conditions: | ||
24 | * | ||
25 | * The above copyright notice and this permission notice shall be included in | ||
26 | * all copies or substantial portions of the Software. | ||
27 | * | ||
28 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
29 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
30 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
31 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
32 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
33 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
34 | * IN THE SOFTWARE. | ||
35 | */ | ||
36 | |||
37 | #include <linux/spinlock.h> | ||
38 | #include <linux/kthread.h> | ||
39 | #include <linux/list.h> | ||
40 | #include <linux/delay.h> | ||
41 | #include <linux/freezer.h> | ||
42 | |||
43 | #include <xen/events.h> | ||
44 | #include <xen/page.h> | ||
45 | #include <asm/xen/hypervisor.h> | ||
46 | #include <asm/xen/hypercall.h> | ||
47 | #include "common.h" | ||
48 | |||
49 | /* | ||
50 | * These are rather arbitrary. They are fairly large because adjacent requests | ||
51 | * pulled from a communication ring are quite likely to end up being part of | ||
52 | * the same scatter/gather request at the disc. | ||
53 | * | ||
54 | * ** TRY INCREASING 'xen_blkif_reqs' IF WRITE SPEEDS SEEM TOO LOW ** | ||
55 | * | ||
56 | * This will increase the chances of being able to write whole tracks. | ||
57 | * 64 should be enough to keep us competitive with Linux. | ||
58 | */ | ||
59 | static int xen_blkif_reqs = 64; | ||
60 | module_param_named(reqs, xen_blkif_reqs, int, 0); | ||
61 | MODULE_PARM_DESC(reqs, "Number of blkback requests to allocate"); | ||
62 | |||
63 | /* Run-time switchable: /sys/module/blkback/parameters/ */ | ||
64 | static unsigned int log_stats; | ||
65 | module_param(log_stats, int, 0644); | ||
66 | |||
67 | /* | ||
68 | * Each outstanding request that we've passed to the lower device layers has a | ||
69 | * 'pending_req' allocated to it. Each buffer_head that completes decrements | ||
70 | * the pendcnt towards zero. When it hits zero, the specified domain has a | ||
71 | * response queued for it, with the saved 'id' passed back. | ||
72 | */ | ||
73 | struct pending_req { | ||
74 | struct xen_blkif *blkif; | ||
75 | u64 id; | ||
76 | int nr_pages; | ||
77 | atomic_t pendcnt; | ||
78 | unsigned short operation; | ||
79 | int status; | ||
80 | struct list_head free_list; | ||
81 | }; | ||
82 | |||
83 | #define BLKBACK_INVALID_HANDLE (~0) | ||
84 | |||
85 | struct xen_blkbk { | ||
86 | struct pending_req *pending_reqs; | ||
87 | /* List of all 'pending_req' available */ | ||
88 | struct list_head pending_free; | ||
89 | /* And its spinlock. */ | ||
90 | spinlock_t pending_free_lock; | ||
91 | wait_queue_head_t pending_free_wq; | ||
92 | /* The list of all pages that are available. */ | ||
93 | struct page **pending_pages; | ||
94 | /* And the grant handles that are available. */ | ||
95 | grant_handle_t *pending_grant_handles; | ||
96 | }; | ||
97 | |||
98 | static struct xen_blkbk *blkbk; | ||
99 | |||
100 | /* | ||
101 | * Little helpful macro to figure out the index and virtual address of the | ||
102 | * pending_pages[..]. For each 'pending_req' we have have up to | ||
103 | * BLKIF_MAX_SEGMENTS_PER_REQUEST (11) pages. The seg would be from 0 through | ||
104 | * 10 and would index in the pending_pages[..]. | ||
105 | */ | ||
106 | static inline int vaddr_pagenr(struct pending_req *req, int seg) | ||
107 | { | ||
108 | return (req - blkbk->pending_reqs) * | ||
109 | BLKIF_MAX_SEGMENTS_PER_REQUEST + seg; | ||
110 | } | ||
111 | |||
112 | #define pending_page(req, seg) pending_pages[vaddr_pagenr(req, seg)] | ||
113 | |||
114 | static inline unsigned long vaddr(struct pending_req *req, int seg) | ||
115 | { | ||
116 | unsigned long pfn = page_to_pfn(blkbk->pending_page(req, seg)); | ||
117 | return (unsigned long)pfn_to_kaddr(pfn); | ||
118 | } | ||
119 | |||
120 | #define pending_handle(_req, _seg) \ | ||
121 | (blkbk->pending_grant_handles[vaddr_pagenr(_req, _seg)]) | ||
122 | |||
123 | |||
124 | static int do_block_io_op(struct xen_blkif *blkif); | ||
125 | static int dispatch_rw_block_io(struct xen_blkif *blkif, | ||
126 | struct blkif_request *req, | ||
127 | struct pending_req *pending_req); | ||
128 | static void make_response(struct xen_blkif *blkif, u64 id, | ||
129 | unsigned short op, int st); | ||
130 | |||
131 | /* | ||
132 | * Retrieve from the 'pending_reqs' a free pending_req structure to be used. | ||
133 | */ | ||
134 | static struct pending_req *alloc_req(void) | ||
135 | { | ||
136 | struct pending_req *req = NULL; | ||
137 | unsigned long flags; | ||
138 | |||
139 | spin_lock_irqsave(&blkbk->pending_free_lock, flags); | ||
140 | if (!list_empty(&blkbk->pending_free)) { | ||
141 | req = list_entry(blkbk->pending_free.next, struct pending_req, | ||
142 | free_list); | ||
143 | list_del(&req->free_list); | ||
144 | } | ||
145 | spin_unlock_irqrestore(&blkbk->pending_free_lock, flags); | ||
146 | return req; | ||
147 | } | ||
148 | |||
149 | /* | ||
150 | * Return the 'pending_req' structure back to the freepool. We also | ||
151 | * wake up the thread if it was waiting for a free page. | ||
152 | */ | ||
153 | static void free_req(struct pending_req *req) | ||
154 | { | ||
155 | unsigned long flags; | ||
156 | int was_empty; | ||
157 | |||
158 | spin_lock_irqsave(&blkbk->pending_free_lock, flags); | ||
159 | was_empty = list_empty(&blkbk->pending_free); | ||
160 | list_add(&req->free_list, &blkbk->pending_free); | ||
161 | spin_unlock_irqrestore(&blkbk->pending_free_lock, flags); | ||
162 | if (was_empty) | ||
163 | wake_up(&blkbk->pending_free_wq); | ||
164 | } | ||
165 | |||
166 | /* | ||
167 | * Routines for managing virtual block devices (vbds). | ||
168 | */ | ||
169 | static int xen_vbd_translate(struct phys_req *req, struct xen_blkif *blkif, | ||
170 | int operation) | ||
171 | { | ||
172 | struct xen_vbd *vbd = &blkif->vbd; | ||
173 | int rc = -EACCES; | ||
174 | |||
175 | if ((operation != READ) && vbd->readonly) | ||
176 | goto out; | ||
177 | |||
178 | if (likely(req->nr_sects)) { | ||
179 | blkif_sector_t end = req->sector_number + req->nr_sects; | ||
180 | |||
181 | if (unlikely(end < req->sector_number)) | ||
182 | goto out; | ||
183 | if (unlikely(end > vbd_sz(vbd))) | ||
184 | goto out; | ||
185 | } | ||
186 | |||
187 | req->dev = vbd->pdevice; | ||
188 | req->bdev = vbd->bdev; | ||
189 | rc = 0; | ||
190 | |||
191 | out: | ||
192 | return rc; | ||
193 | } | ||
194 | |||
195 | static void xen_vbd_resize(struct xen_blkif *blkif) | ||
196 | { | ||
197 | struct xen_vbd *vbd = &blkif->vbd; | ||
198 | struct xenbus_transaction xbt; | ||
199 | int err; | ||
200 | struct xenbus_device *dev = xen_blkbk_xenbus(blkif->be); | ||
201 | unsigned long long new_size = vbd_sz(vbd); | ||
202 | |||
203 | pr_info(DRV_PFX "VBD Resize: Domid: %d, Device: (%d, %d)\n", | ||
204 | blkif->domid, MAJOR(vbd->pdevice), MINOR(vbd->pdevice)); | ||
205 | pr_info(DRV_PFX "VBD Resize: new size %llu\n", new_size); | ||
206 | vbd->size = new_size; | ||
207 | again: | ||
208 | err = xenbus_transaction_start(&xbt); | ||
209 | if (err) { | ||
210 | pr_warn(DRV_PFX "Error starting transaction"); | ||
211 | return; | ||
212 | } | ||
213 | err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", | ||
214 | (unsigned long long)vbd_sz(vbd)); | ||
215 | if (err) { | ||
216 | pr_warn(DRV_PFX "Error writing new size"); | ||
217 | goto abort; | ||
218 | } | ||
219 | /* | ||
220 | * Write the current state; we will use this to synchronize | ||
221 | * the front-end. If the current state is "connected" the | ||
222 | * front-end will get the new size information online. | ||
223 | */ | ||
224 | err = xenbus_printf(xbt, dev->nodename, "state", "%d", dev->state); | ||
225 | if (err) { | ||
226 | pr_warn(DRV_PFX "Error writing the state"); | ||
227 | goto abort; | ||
228 | } | ||
229 | |||
230 | err = xenbus_transaction_end(xbt, 0); | ||
231 | if (err == -EAGAIN) | ||
232 | goto again; | ||
233 | if (err) | ||
234 | pr_warn(DRV_PFX "Error ending transaction"); | ||
235 | return; | ||
236 | abort: | ||
237 | xenbus_transaction_end(xbt, 1); | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * Notification from the guest OS. | ||
242 | */ | ||
243 | static void blkif_notify_work(struct xen_blkif *blkif) | ||
244 | { | ||
245 | blkif->waiting_reqs = 1; | ||
246 | wake_up(&blkif->wq); | ||
247 | } | ||
248 | |||
249 | irqreturn_t xen_blkif_be_int(int irq, void *dev_id) | ||
250 | { | ||
251 | blkif_notify_work(dev_id); | ||
252 | return IRQ_HANDLED; | ||
253 | } | ||
254 | |||
255 | /* | ||
256 | * SCHEDULER FUNCTIONS | ||
257 | */ | ||
258 | |||
259 | static void print_stats(struct xen_blkif *blkif) | ||
260 | { | ||
261 | pr_info("xen-blkback (%s): oo %3d | rd %4d | wr %4d | f %4d\n", | ||
262 | current->comm, blkif->st_oo_req, | ||
263 | blkif->st_rd_req, blkif->st_wr_req, blkif->st_f_req); | ||
264 | blkif->st_print = jiffies + msecs_to_jiffies(10 * 1000); | ||
265 | blkif->st_rd_req = 0; | ||
266 | blkif->st_wr_req = 0; | ||
267 | blkif->st_oo_req = 0; | ||
268 | } | ||
269 | |||
270 | int xen_blkif_schedule(void *arg) | ||
271 | { | ||
272 | struct xen_blkif *blkif = arg; | ||
273 | struct xen_vbd *vbd = &blkif->vbd; | ||
274 | |||
275 | xen_blkif_get(blkif); | ||
276 | |||
277 | while (!kthread_should_stop()) { | ||
278 | if (try_to_freeze()) | ||
279 | continue; | ||
280 | if (unlikely(vbd->size != vbd_sz(vbd))) | ||
281 | xen_vbd_resize(blkif); | ||
282 | |||
283 | wait_event_interruptible( | ||
284 | blkif->wq, | ||
285 | blkif->waiting_reqs || kthread_should_stop()); | ||
286 | wait_event_interruptible( | ||
287 | blkbk->pending_free_wq, | ||
288 | !list_empty(&blkbk->pending_free) || | ||
289 | kthread_should_stop()); | ||
290 | |||
291 | blkif->waiting_reqs = 0; | ||
292 | smp_mb(); /* clear flag *before* checking for work */ | ||
293 | |||
294 | if (do_block_io_op(blkif)) | ||
295 | blkif->waiting_reqs = 1; | ||
296 | |||
297 | if (log_stats && time_after(jiffies, blkif->st_print)) | ||
298 | print_stats(blkif); | ||
299 | } | ||
300 | |||
301 | if (log_stats) | ||
302 | print_stats(blkif); | ||
303 | |||
304 | blkif->xenblkd = NULL; | ||
305 | xen_blkif_put(blkif); | ||
306 | |||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | struct seg_buf { | ||
311 | unsigned long buf; | ||
312 | unsigned int nsec; | ||
313 | }; | ||
314 | /* | ||
315 | * Unmap the grant references, and also remove the M2P over-rides | ||
316 | * used in the 'pending_req'. | ||
317 | */ | ||
318 | static void xen_blkbk_unmap(struct pending_req *req) | ||
319 | { | ||
320 | struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
321 | unsigned int i, invcount = 0; | ||
322 | grant_handle_t handle; | ||
323 | int ret; | ||
324 | |||
325 | for (i = 0; i < req->nr_pages; i++) { | ||
326 | handle = pending_handle(req, i); | ||
327 | if (handle == BLKBACK_INVALID_HANDLE) | ||
328 | continue; | ||
329 | gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i), | ||
330 | GNTMAP_host_map, handle); | ||
331 | pending_handle(req, i) = BLKBACK_INVALID_HANDLE; | ||
332 | invcount++; | ||
333 | } | ||
334 | |||
335 | ret = HYPERVISOR_grant_table_op( | ||
336 | GNTTABOP_unmap_grant_ref, unmap, invcount); | ||
337 | BUG_ON(ret); | ||
338 | /* | ||
339 | * Note, we use invcount, so nr->pages, so we can't index | ||
340 | * using vaddr(req, i). | ||
341 | */ | ||
342 | for (i = 0; i < invcount; i++) { | ||
343 | ret = m2p_remove_override( | ||
344 | virt_to_page(unmap[i].host_addr), false); | ||
345 | if (ret) { | ||
346 | pr_alert(DRV_PFX "Failed to remove M2P override for %lx\n", | ||
347 | (unsigned long)unmap[i].host_addr); | ||
348 | continue; | ||
349 | } | ||
350 | } | ||
351 | } | ||
352 | |||
353 | static int xen_blkbk_map(struct blkif_request *req, | ||
354 | struct pending_req *pending_req, | ||
355 | struct seg_buf seg[]) | ||
356 | { | ||
357 | struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
358 | int i; | ||
359 | int nseg = req->nr_segments; | ||
360 | int ret = 0; | ||
361 | |||
362 | /* | ||
363 | * Fill out preq.nr_sects with proper amount of sectors, and setup | ||
364 | * assign map[..] with the PFN of the page in our domain with the | ||
365 | * corresponding grant reference for each page. | ||
366 | */ | ||
367 | for (i = 0; i < nseg; i++) { | ||
368 | uint32_t flags; | ||
369 | |||
370 | flags = GNTMAP_host_map; | ||
371 | if (pending_req->operation != BLKIF_OP_READ) | ||
372 | flags |= GNTMAP_readonly; | ||
373 | gnttab_set_map_op(&map[i], vaddr(pending_req, i), flags, | ||
374 | req->u.rw.seg[i].gref, | ||
375 | pending_req->blkif->domid); | ||
376 | } | ||
377 | |||
378 | ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nseg); | ||
379 | BUG_ON(ret); | ||
380 | |||
381 | /* | ||
382 | * Now swizzle the MFN in our domain with the MFN from the other domain | ||
383 | * so that when we access vaddr(pending_req,i) it has the contents of | ||
384 | * the page from the other domain. | ||
385 | */ | ||
386 | for (i = 0; i < nseg; i++) { | ||
387 | if (unlikely(map[i].status != 0)) { | ||
388 | pr_debug(DRV_PFX "invalid buffer -- could not remap it\n"); | ||
389 | map[i].handle = BLKBACK_INVALID_HANDLE; | ||
390 | ret |= 1; | ||
391 | } | ||
392 | |||
393 | pending_handle(pending_req, i) = map[i].handle; | ||
394 | |||
395 | if (ret) | ||
396 | continue; | ||
397 | |||
398 | ret = m2p_add_override(PFN_DOWN(map[i].dev_bus_addr), | ||
399 | blkbk->pending_page(pending_req, i), false); | ||
400 | if (ret) { | ||
401 | pr_alert(DRV_PFX "Failed to install M2P override for %lx (ret: %d)\n", | ||
402 | (unsigned long)map[i].dev_bus_addr, ret); | ||
403 | /* We could switch over to GNTTABOP_copy */ | ||
404 | continue; | ||
405 | } | ||
406 | |||
407 | seg[i].buf = map[i].dev_bus_addr | | ||
408 | (req->u.rw.seg[i].first_sect << 9); | ||
409 | } | ||
410 | return ret; | ||
411 | } | ||
412 | |||
413 | /* | ||
414 | * Completion callback on the bio's. Called as bh->b_end_io() | ||
415 | */ | ||
416 | |||
417 | static void __end_block_io_op(struct pending_req *pending_req, int error) | ||
418 | { | ||
419 | /* An error fails the entire request. */ | ||
420 | if ((pending_req->operation == BLKIF_OP_FLUSH_DISKCACHE) && | ||
421 | (error == -EOPNOTSUPP)) { | ||
422 | pr_debug(DRV_PFX "flush diskcache op failed, not supported\n"); | ||
423 | xen_blkbk_flush_diskcache(XBT_NIL, pending_req->blkif->be, 0); | ||
424 | pending_req->status = BLKIF_RSP_EOPNOTSUPP; | ||
425 | } else if (error) { | ||
426 | pr_debug(DRV_PFX "Buffer not up-to-date at end of operation," | ||
427 | " error=%d\n", error); | ||
428 | pending_req->status = BLKIF_RSP_ERROR; | ||
429 | } | ||
430 | |||
431 | /* | ||
432 | * If all of the bio's have completed it is time to unmap | ||
433 | * the grant references associated with 'request' and provide | ||
434 | * the proper response on the ring. | ||
435 | */ | ||
436 | if (atomic_dec_and_test(&pending_req->pendcnt)) { | ||
437 | xen_blkbk_unmap(pending_req); | ||
438 | make_response(pending_req->blkif, pending_req->id, | ||
439 | pending_req->operation, pending_req->status); | ||
440 | xen_blkif_put(pending_req->blkif); | ||
441 | free_req(pending_req); | ||
442 | } | ||
443 | } | ||
444 | |||
445 | /* | ||
446 | * bio callback. | ||
447 | */ | ||
448 | static void end_block_io_op(struct bio *bio, int error) | ||
449 | { | ||
450 | __end_block_io_op(bio->bi_private, error); | ||
451 | bio_put(bio); | ||
452 | } | ||
453 | |||
454 | |||
455 | |||
456 | /* | ||
457 | * Function to copy the from the ring buffer the 'struct blkif_request' | ||
458 | * (which has the sectors we want, number of them, grant references, etc), | ||
459 | * and transmute it to the block API to hand it over to the proper block disk. | ||
460 | */ | ||
461 | static int do_block_io_op(struct xen_blkif *blkif) | ||
462 | { | ||
463 | union blkif_back_rings *blk_rings = &blkif->blk_rings; | ||
464 | struct blkif_request req; | ||
465 | struct pending_req *pending_req; | ||
466 | RING_IDX rc, rp; | ||
467 | int more_to_do = 0; | ||
468 | |||
469 | rc = blk_rings->common.req_cons; | ||
470 | rp = blk_rings->common.sring->req_prod; | ||
471 | rmb(); /* Ensure we see queued requests up to 'rp'. */ | ||
472 | |||
473 | while (rc != rp) { | ||
474 | |||
475 | if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc)) | ||
476 | break; | ||
477 | |||
478 | if (kthread_should_stop()) { | ||
479 | more_to_do = 1; | ||
480 | break; | ||
481 | } | ||
482 | |||
483 | pending_req = alloc_req(); | ||
484 | if (NULL == pending_req) { | ||
485 | blkif->st_oo_req++; | ||
486 | more_to_do = 1; | ||
487 | break; | ||
488 | } | ||
489 | |||
490 | switch (blkif->blk_protocol) { | ||
491 | case BLKIF_PROTOCOL_NATIVE: | ||
492 | memcpy(&req, RING_GET_REQUEST(&blk_rings->native, rc), sizeof(req)); | ||
493 | break; | ||
494 | case BLKIF_PROTOCOL_X86_32: | ||
495 | blkif_get_x86_32_req(&req, RING_GET_REQUEST(&blk_rings->x86_32, rc)); | ||
496 | break; | ||
497 | case BLKIF_PROTOCOL_X86_64: | ||
498 | blkif_get_x86_64_req(&req, RING_GET_REQUEST(&blk_rings->x86_64, rc)); | ||
499 | break; | ||
500 | default: | ||
501 | BUG(); | ||
502 | } | ||
503 | blk_rings->common.req_cons = ++rc; /* before make_response() */ | ||
504 | |||
505 | /* Apply all sanity checks to /private copy/ of request. */ | ||
506 | barrier(); | ||
507 | |||
508 | if (dispatch_rw_block_io(blkif, &req, pending_req)) | ||
509 | break; | ||
510 | |||
511 | /* Yield point for this unbounded loop. */ | ||
512 | cond_resched(); | ||
513 | } | ||
514 | |||
515 | return more_to_do; | ||
516 | } | ||
517 | |||
518 | /* | ||
519 | * Transmutation of the 'struct blkif_request' to a proper 'struct bio' | ||
520 | * and call the 'submit_bio' to pass it to the underlying storage. | ||
521 | */ | ||
522 | static int dispatch_rw_block_io(struct xen_blkif *blkif, | ||
523 | struct blkif_request *req, | ||
524 | struct pending_req *pending_req) | ||
525 | { | ||
526 | struct phys_req preq; | ||
527 | struct seg_buf seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
528 | unsigned int nseg; | ||
529 | struct bio *bio = NULL; | ||
530 | struct bio *biolist[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
531 | int i, nbio = 0; | ||
532 | int operation; | ||
533 | struct blk_plug plug; | ||
534 | |||
535 | switch (req->operation) { | ||
536 | case BLKIF_OP_READ: | ||
537 | blkif->st_rd_req++; | ||
538 | operation = READ; | ||
539 | break; | ||
540 | case BLKIF_OP_WRITE: | ||
541 | blkif->st_wr_req++; | ||
542 | operation = WRITE_ODIRECT; | ||
543 | break; | ||
544 | case BLKIF_OP_FLUSH_DISKCACHE: | ||
545 | blkif->st_f_req++; | ||
546 | operation = WRITE_FLUSH; | ||
547 | break; | ||
548 | case BLKIF_OP_WRITE_BARRIER: | ||
549 | default: | ||
550 | operation = 0; /* make gcc happy */ | ||
551 | goto fail_response; | ||
552 | break; | ||
553 | } | ||
554 | |||
555 | /* Check that the number of segments is sane. */ | ||
556 | nseg = req->nr_segments; | ||
557 | if (unlikely(nseg == 0 && operation != WRITE_FLUSH) || | ||
558 | unlikely(nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST)) { | ||
559 | pr_debug(DRV_PFX "Bad number of segments in request (%d)\n", | ||
560 | nseg); | ||
561 | /* Haven't submitted any bio's yet. */ | ||
562 | goto fail_response; | ||
563 | } | ||
564 | |||
565 | preq.dev = req->handle; | ||
566 | preq.sector_number = req->u.rw.sector_number; | ||
567 | preq.nr_sects = 0; | ||
568 | |||
569 | pending_req->blkif = blkif; | ||
570 | pending_req->id = req->id; | ||
571 | pending_req->operation = req->operation; | ||
572 | pending_req->status = BLKIF_RSP_OKAY; | ||
573 | pending_req->nr_pages = nseg; | ||
574 | |||
575 | for (i = 0; i < nseg; i++) { | ||
576 | seg[i].nsec = req->u.rw.seg[i].last_sect - | ||
577 | req->u.rw.seg[i].first_sect + 1; | ||
578 | if ((req->u.rw.seg[i].last_sect >= (PAGE_SIZE >> 9)) || | ||
579 | (req->u.rw.seg[i].last_sect < req->u.rw.seg[i].first_sect)) | ||
580 | goto fail_response; | ||
581 | preq.nr_sects += seg[i].nsec; | ||
582 | |||
583 | } | ||
584 | |||
585 | if (xen_vbd_translate(&preq, blkif, operation) != 0) { | ||
586 | pr_debug(DRV_PFX "access denied: %s of [%llu,%llu] on dev=%04x\n", | ||
587 | operation == READ ? "read" : "write", | ||
588 | preq.sector_number, | ||
589 | preq.sector_number + preq.nr_sects, preq.dev); | ||
590 | goto fail_response; | ||
591 | } | ||
592 | |||
593 | /* | ||
594 | * This check _MUST_ be done after xen_vbd_translate as the preq.bdev | ||
595 | * is set there. | ||
596 | */ | ||
597 | for (i = 0; i < nseg; i++) { | ||
598 | if (((int)preq.sector_number|(int)seg[i].nsec) & | ||
599 | ((bdev_logical_block_size(preq.bdev) >> 9) - 1)) { | ||
600 | pr_debug(DRV_PFX "Misaligned I/O request from domain %d", | ||
601 | blkif->domid); | ||
602 | goto fail_response; | ||
603 | } | ||
604 | } | ||
605 | |||
606 | /* | ||
607 | * If we have failed at this point, we need to undo the M2P override, | ||
608 | * set gnttab_set_unmap_op on all of the grant references and perform | ||
609 | * the hypercall to unmap the grants - that is all done in | ||
610 | * xen_blkbk_unmap. | ||
611 | */ | ||
612 | if (xen_blkbk_map(req, pending_req, seg)) | ||
613 | goto fail_flush; | ||
614 | |||
615 | /* This corresponding xen_blkif_put is done in __end_block_io_op */ | ||
616 | xen_blkif_get(blkif); | ||
617 | |||
618 | for (i = 0; i < nseg; i++) { | ||
619 | while ((bio == NULL) || | ||
620 | (bio_add_page(bio, | ||
621 | blkbk->pending_page(pending_req, i), | ||
622 | seg[i].nsec << 9, | ||
623 | seg[i].buf & ~PAGE_MASK) == 0)) { | ||
624 | |||
625 | bio = bio_alloc(GFP_KERNEL, nseg-i); | ||
626 | if (unlikely(bio == NULL)) | ||
627 | goto fail_put_bio; | ||
628 | |||
629 | biolist[nbio++] = bio; | ||
630 | bio->bi_bdev = preq.bdev; | ||
631 | bio->bi_private = pending_req; | ||
632 | bio->bi_end_io = end_block_io_op; | ||
633 | bio->bi_sector = preq.sector_number; | ||
634 | } | ||
635 | |||
636 | preq.sector_number += seg[i].nsec; | ||
637 | } | ||
638 | |||
639 | /* This will be hit if the operation was a flush. */ | ||
640 | if (!bio) { | ||
641 | BUG_ON(operation != WRITE_FLUSH); | ||
642 | |||
643 | bio = bio_alloc(GFP_KERNEL, 0); | ||
644 | if (unlikely(bio == NULL)) | ||
645 | goto fail_put_bio; | ||
646 | |||
647 | biolist[nbio++] = bio; | ||
648 | bio->bi_bdev = preq.bdev; | ||
649 | bio->bi_private = pending_req; | ||
650 | bio->bi_end_io = end_block_io_op; | ||
651 | } | ||
652 | |||
653 | /* | ||
654 | * We set it one so that the last submit_bio does not have to call | ||
655 | * atomic_inc. | ||
656 | */ | ||
657 | atomic_set(&pending_req->pendcnt, nbio); | ||
658 | |||
659 | /* Get a reference count for the disk queue and start sending I/O */ | ||
660 | blk_start_plug(&plug); | ||
661 | |||
662 | for (i = 0; i < nbio; i++) | ||
663 | submit_bio(operation, biolist[i]); | ||
664 | |||
665 | /* Let the I/Os go.. */ | ||
666 | blk_finish_plug(&plug); | ||
667 | |||
668 | if (operation == READ) | ||
669 | blkif->st_rd_sect += preq.nr_sects; | ||
670 | else if (operation == WRITE || operation == WRITE_FLUSH) | ||
671 | blkif->st_wr_sect += preq.nr_sects; | ||
672 | |||
673 | return 0; | ||
674 | |||
675 | fail_flush: | ||
676 | xen_blkbk_unmap(pending_req); | ||
677 | fail_response: | ||
678 | /* Haven't submitted any bio's yet. */ | ||
679 | make_response(blkif, req->id, req->operation, BLKIF_RSP_ERROR); | ||
680 | free_req(pending_req); | ||
681 | msleep(1); /* back off a bit */ | ||
682 | return -EIO; | ||
683 | |||
684 | fail_put_bio: | ||
685 | for (i = 0; i < nbio; i++) | ||
686 | bio_put(biolist[i]); | ||
687 | __end_block_io_op(pending_req, -EINVAL); | ||
688 | msleep(1); /* back off a bit */ | ||
689 | return -EIO; | ||
690 | } | ||
691 | |||
692 | |||
693 | |||
694 | /* | ||
695 | * Put a response on the ring on how the operation fared. | ||
696 | */ | ||
697 | static void make_response(struct xen_blkif *blkif, u64 id, | ||
698 | unsigned short op, int st) | ||
699 | { | ||
700 | struct blkif_response resp; | ||
701 | unsigned long flags; | ||
702 | union blkif_back_rings *blk_rings = &blkif->blk_rings; | ||
703 | int more_to_do = 0; | ||
704 | int notify; | ||
705 | |||
706 | resp.id = id; | ||
707 | resp.operation = op; | ||
708 | resp.status = st; | ||
709 | |||
710 | spin_lock_irqsave(&blkif->blk_ring_lock, flags); | ||
711 | /* Place on the response ring for the relevant domain. */ | ||
712 | switch (blkif->blk_protocol) { | ||
713 | case BLKIF_PROTOCOL_NATIVE: | ||
714 | memcpy(RING_GET_RESPONSE(&blk_rings->native, blk_rings->native.rsp_prod_pvt), | ||
715 | &resp, sizeof(resp)); | ||
716 | break; | ||
717 | case BLKIF_PROTOCOL_X86_32: | ||
718 | memcpy(RING_GET_RESPONSE(&blk_rings->x86_32, blk_rings->x86_32.rsp_prod_pvt), | ||
719 | &resp, sizeof(resp)); | ||
720 | break; | ||
721 | case BLKIF_PROTOCOL_X86_64: | ||
722 | memcpy(RING_GET_RESPONSE(&blk_rings->x86_64, blk_rings->x86_64.rsp_prod_pvt), | ||
723 | &resp, sizeof(resp)); | ||
724 | break; | ||
725 | default: | ||
726 | BUG(); | ||
727 | } | ||
728 | blk_rings->common.rsp_prod_pvt++; | ||
729 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify); | ||
730 | if (blk_rings->common.rsp_prod_pvt == blk_rings->common.req_cons) { | ||
731 | /* | ||
732 | * Tail check for pending requests. Allows frontend to avoid | ||
733 | * notifications if requests are already in flight (lower | ||
734 | * overheads and promotes batching). | ||
735 | */ | ||
736 | RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do); | ||
737 | |||
738 | } else if (RING_HAS_UNCONSUMED_REQUESTS(&blk_rings->common)) { | ||
739 | more_to_do = 1; | ||
740 | } | ||
741 | |||
742 | spin_unlock_irqrestore(&blkif->blk_ring_lock, flags); | ||
743 | |||
744 | if (more_to_do) | ||
745 | blkif_notify_work(blkif); | ||
746 | if (notify) | ||
747 | notify_remote_via_irq(blkif->irq); | ||
748 | } | ||
749 | |||
750 | static int __init xen_blkif_init(void) | ||
751 | { | ||
752 | int i, mmap_pages; | ||
753 | int rc = 0; | ||
754 | |||
755 | if (!xen_pv_domain()) | ||
756 | return -ENODEV; | ||
757 | |||
758 | blkbk = kzalloc(sizeof(struct xen_blkbk), GFP_KERNEL); | ||
759 | if (!blkbk) { | ||
760 | pr_alert(DRV_PFX "%s: out of memory!\n", __func__); | ||
761 | return -ENOMEM; | ||
762 | } | ||
763 | |||
764 | mmap_pages = xen_blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST; | ||
765 | |||
766 | blkbk->pending_reqs = kmalloc(sizeof(blkbk->pending_reqs[0]) * | ||
767 | xen_blkif_reqs, GFP_KERNEL); | ||
768 | blkbk->pending_grant_handles = kzalloc(sizeof(blkbk->pending_grant_handles[0]) * | ||
769 | mmap_pages, GFP_KERNEL); | ||
770 | blkbk->pending_pages = kzalloc(sizeof(blkbk->pending_pages[0]) * | ||
771 | mmap_pages, GFP_KERNEL); | ||
772 | |||
773 | if (!blkbk->pending_reqs || !blkbk->pending_grant_handles || | ||
774 | !blkbk->pending_pages) { | ||
775 | rc = -ENOMEM; | ||
776 | goto out_of_memory; | ||
777 | } | ||
778 | |||
779 | for (i = 0; i < mmap_pages; i++) { | ||
780 | blkbk->pending_grant_handles[i] = BLKBACK_INVALID_HANDLE; | ||
781 | blkbk->pending_pages[i] = alloc_page(GFP_KERNEL); | ||
782 | if (blkbk->pending_pages[i] == NULL) { | ||
783 | rc = -ENOMEM; | ||
784 | goto out_of_memory; | ||
785 | } | ||
786 | } | ||
787 | rc = xen_blkif_interface_init(); | ||
788 | if (rc) | ||
789 | goto failed_init; | ||
790 | |||
791 | memset(blkbk->pending_reqs, 0, sizeof(blkbk->pending_reqs)); | ||
792 | |||
793 | INIT_LIST_HEAD(&blkbk->pending_free); | ||
794 | spin_lock_init(&blkbk->pending_free_lock); | ||
795 | init_waitqueue_head(&blkbk->pending_free_wq); | ||
796 | |||
797 | for (i = 0; i < xen_blkif_reqs; i++) | ||
798 | list_add_tail(&blkbk->pending_reqs[i].free_list, | ||
799 | &blkbk->pending_free); | ||
800 | |||
801 | rc = xen_blkif_xenbus_init(); | ||
802 | if (rc) | ||
803 | goto failed_init; | ||
804 | |||
805 | return 0; | ||
806 | |||
807 | out_of_memory: | ||
808 | pr_alert(DRV_PFX "%s: out of memory\n", __func__); | ||
809 | failed_init: | ||
810 | kfree(blkbk->pending_reqs); | ||
811 | kfree(blkbk->pending_grant_handles); | ||
812 | for (i = 0; i < mmap_pages; i++) { | ||
813 | if (blkbk->pending_pages[i]) | ||
814 | __free_page(blkbk->pending_pages[i]); | ||
815 | } | ||
816 | kfree(blkbk->pending_pages); | ||
817 | kfree(blkbk); | ||
818 | blkbk = NULL; | ||
819 | return rc; | ||
820 | } | ||
821 | |||
822 | module_init(xen_blkif_init); | ||
823 | |||
824 | MODULE_LICENSE("Dual BSD/GPL"); | ||
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h new file mode 100644 index 000000000000..9e40b283a468 --- /dev/null +++ b/drivers/block/xen-blkback/common.h | |||
@@ -0,0 +1,233 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or | ||
3 | * modify it under the terms of the GNU General Public License version 2 | ||
4 | * as published by the Free Software Foundation; or, when distributed | ||
5 | * separately from the Linux kernel or incorporated into other | ||
6 | * software packages, subject to the following license: | ||
7 | * | ||
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
9 | * of this source file (the "Software"), to deal in the Software without | ||
10 | * restriction, including without limitation the rights to use, copy, modify, | ||
11 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
12 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
13 | * the following conditions: | ||
14 | * | ||
15 | * The above copyright notice and this permission notice shall be included in | ||
16 | * all copies or substantial portions of the Software. | ||
17 | * | ||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
24 | * IN THE SOFTWARE. | ||
25 | */ | ||
26 | |||
27 | #ifndef __XEN_BLKIF__BACKEND__COMMON_H__ | ||
28 | #define __XEN_BLKIF__BACKEND__COMMON_H__ | ||
29 | |||
30 | #include <linux/version.h> | ||
31 | #include <linux/module.h> | ||
32 | #include <linux/interrupt.h> | ||
33 | #include <linux/slab.h> | ||
34 | #include <linux/blkdev.h> | ||
35 | #include <linux/vmalloc.h> | ||
36 | #include <linux/wait.h> | ||
37 | #include <linux/io.h> | ||
38 | #include <asm/setup.h> | ||
39 | #include <asm/pgalloc.h> | ||
40 | #include <asm/hypervisor.h> | ||
41 | #include <xen/grant_table.h> | ||
42 | #include <xen/xenbus.h> | ||
43 | #include <xen/interface/io/ring.h> | ||
44 | #include <xen/interface/io/blkif.h> | ||
45 | #include <xen/interface/io/protocols.h> | ||
46 | |||
47 | #define DRV_PFX "xen-blkback:" | ||
48 | #define DPRINTK(fmt, args...) \ | ||
49 | pr_debug(DRV_PFX "(%s:%d) " fmt ".\n", \ | ||
50 | __func__, __LINE__, ##args) | ||
51 | |||
52 | |||
53 | /* Not a real protocol. Used to generate ring structs which contain | ||
54 | * the elements common to all protocols only. This way we get a | ||
55 | * compiler-checkable way to use common struct elements, so we can | ||
56 | * avoid using switch(protocol) in a number of places. */ | ||
57 | struct blkif_common_request { | ||
58 | char dummy; | ||
59 | }; | ||
60 | struct blkif_common_response { | ||
61 | char dummy; | ||
62 | }; | ||
63 | |||
64 | /* i386 protocol version */ | ||
65 | #pragma pack(push, 4) | ||
66 | struct blkif_x86_32_request { | ||
67 | uint8_t operation; /* BLKIF_OP_??? */ | ||
68 | uint8_t nr_segments; /* number of segments */ | ||
69 | blkif_vdev_t handle; /* only for read/write requests */ | ||
70 | uint64_t id; /* private guest value, echoed in resp */ | ||
71 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | ||
72 | struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
73 | }; | ||
74 | struct blkif_x86_32_response { | ||
75 | uint64_t id; /* copied from request */ | ||
76 | uint8_t operation; /* copied from request */ | ||
77 | int16_t status; /* BLKIF_RSP_??? */ | ||
78 | }; | ||
79 | #pragma pack(pop) | ||
80 | |||
81 | /* x86_64 protocol version */ | ||
82 | struct blkif_x86_64_request { | ||
83 | uint8_t operation; /* BLKIF_OP_??? */ | ||
84 | uint8_t nr_segments; /* number of segments */ | ||
85 | blkif_vdev_t handle; /* only for read/write requests */ | ||
86 | uint64_t __attribute__((__aligned__(8))) id; | ||
87 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | ||
88 | struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
89 | }; | ||
90 | struct blkif_x86_64_response { | ||
91 | uint64_t __attribute__((__aligned__(8))) id; | ||
92 | uint8_t operation; /* copied from request */ | ||
93 | int16_t status; /* BLKIF_RSP_??? */ | ||
94 | }; | ||
95 | |||
96 | DEFINE_RING_TYPES(blkif_common, struct blkif_common_request, | ||
97 | struct blkif_common_response); | ||
98 | DEFINE_RING_TYPES(blkif_x86_32, struct blkif_x86_32_request, | ||
99 | struct blkif_x86_32_response); | ||
100 | DEFINE_RING_TYPES(blkif_x86_64, struct blkif_x86_64_request, | ||
101 | struct blkif_x86_64_response); | ||
102 | |||
103 | union blkif_back_rings { | ||
104 | struct blkif_back_ring native; | ||
105 | struct blkif_common_back_ring common; | ||
106 | struct blkif_x86_32_back_ring x86_32; | ||
107 | struct blkif_x86_64_back_ring x86_64; | ||
108 | }; | ||
109 | |||
110 | enum blkif_protocol { | ||
111 | BLKIF_PROTOCOL_NATIVE = 1, | ||
112 | BLKIF_PROTOCOL_X86_32 = 2, | ||
113 | BLKIF_PROTOCOL_X86_64 = 3, | ||
114 | }; | ||
115 | |||
116 | struct xen_vbd { | ||
117 | /* What the domain refers to this vbd as. */ | ||
118 | blkif_vdev_t handle; | ||
119 | /* Non-zero -> read-only */ | ||
120 | unsigned char readonly; | ||
121 | /* VDISK_xxx */ | ||
122 | unsigned char type; | ||
123 | /* phys device that this vbd maps to. */ | ||
124 | u32 pdevice; | ||
125 | struct block_device *bdev; | ||
126 | /* Cached size parameter. */ | ||
127 | sector_t size; | ||
128 | bool flush_support; | ||
129 | }; | ||
130 | |||
131 | struct backend_info; | ||
132 | |||
133 | struct xen_blkif { | ||
134 | /* Unique identifier for this interface. */ | ||
135 | domid_t domid; | ||
136 | unsigned int handle; | ||
137 | /* Physical parameters of the comms window. */ | ||
138 | unsigned int irq; | ||
139 | /* Comms information. */ | ||
140 | enum blkif_protocol blk_protocol; | ||
141 | union blkif_back_rings blk_rings; | ||
142 | struct vm_struct *blk_ring_area; | ||
143 | /* The VBD attached to this interface. */ | ||
144 | struct xen_vbd vbd; | ||
145 | /* Back pointer to the backend_info. */ | ||
146 | struct backend_info *be; | ||
147 | /* Private fields. */ | ||
148 | spinlock_t blk_ring_lock; | ||
149 | atomic_t refcnt; | ||
150 | |||
151 | wait_queue_head_t wq; | ||
152 | /* One thread per one blkif. */ | ||
153 | struct task_struct *xenblkd; | ||
154 | unsigned int waiting_reqs; | ||
155 | |||
156 | /* statistics */ | ||
157 | unsigned long st_print; | ||
158 | int st_rd_req; | ||
159 | int st_wr_req; | ||
160 | int st_oo_req; | ||
161 | int st_f_req; | ||
162 | int st_rd_sect; | ||
163 | int st_wr_sect; | ||
164 | |||
165 | wait_queue_head_t waiting_to_free; | ||
166 | |||
167 | grant_handle_t shmem_handle; | ||
168 | grant_ref_t shmem_ref; | ||
169 | }; | ||
170 | |||
171 | |||
172 | #define vbd_sz(_v) ((_v)->bdev->bd_part ? \ | ||
173 | (_v)->bdev->bd_part->nr_sects : \ | ||
174 | get_capacity((_v)->bdev->bd_disk)) | ||
175 | |||
176 | #define xen_blkif_get(_b) (atomic_inc(&(_b)->refcnt)) | ||
177 | #define xen_blkif_put(_b) \ | ||
178 | do { \ | ||
179 | if (atomic_dec_and_test(&(_b)->refcnt)) \ | ||
180 | wake_up(&(_b)->waiting_to_free);\ | ||
181 | } while (0) | ||
182 | |||
183 | struct phys_req { | ||
184 | unsigned short dev; | ||
185 | unsigned short nr_sects; | ||
186 | struct block_device *bdev; | ||
187 | blkif_sector_t sector_number; | ||
188 | }; | ||
189 | int xen_blkif_interface_init(void); | ||
190 | |||
191 | int xen_blkif_xenbus_init(void); | ||
192 | |||
193 | irqreturn_t xen_blkif_be_int(int irq, void *dev_id); | ||
194 | int xen_blkif_schedule(void *arg); | ||
195 | |||
196 | int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt, | ||
197 | struct backend_info *be, int state); | ||
198 | |||
199 | struct xenbus_device *xen_blkbk_xenbus(struct backend_info *be); | ||
200 | |||
201 | static inline void blkif_get_x86_32_req(struct blkif_request *dst, | ||
202 | struct blkif_x86_32_request *src) | ||
203 | { | ||
204 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; | ||
205 | dst->operation = src->operation; | ||
206 | dst->nr_segments = src->nr_segments; | ||
207 | dst->handle = src->handle; | ||
208 | dst->id = src->id; | ||
209 | dst->u.rw.sector_number = src->sector_number; | ||
210 | barrier(); | ||
211 | if (n > dst->nr_segments) | ||
212 | n = dst->nr_segments; | ||
213 | for (i = 0; i < n; i++) | ||
214 | dst->u.rw.seg[i] = src->seg[i]; | ||
215 | } | ||
216 | |||
217 | static inline void blkif_get_x86_64_req(struct blkif_request *dst, | ||
218 | struct blkif_x86_64_request *src) | ||
219 | { | ||
220 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; | ||
221 | dst->operation = src->operation; | ||
222 | dst->nr_segments = src->nr_segments; | ||
223 | dst->handle = src->handle; | ||
224 | dst->id = src->id; | ||
225 | dst->u.rw.sector_number = src->sector_number; | ||
226 | barrier(); | ||
227 | if (n > dst->nr_segments) | ||
228 | n = dst->nr_segments; | ||
229 | for (i = 0; i < n; i++) | ||
230 | dst->u.rw.seg[i] = src->seg[i]; | ||
231 | } | ||
232 | |||
233 | #endif /* __XEN_BLKIF__BACKEND__COMMON_H__ */ | ||
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c new file mode 100644 index 000000000000..34570823355b --- /dev/null +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -0,0 +1,768 @@ | |||
1 | /* Xenbus code for blkif backend | ||
2 | Copyright (C) 2005 Rusty Russell <rusty@rustcorp.com.au> | ||
3 | Copyright (C) 2005 XenSource Ltd | ||
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 as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | */ | ||
16 | |||
17 | #include <stdarg.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/kthread.h> | ||
20 | #include <xen/events.h> | ||
21 | #include <xen/grant_table.h> | ||
22 | #include "common.h" | ||
23 | |||
24 | struct backend_info { | ||
25 | struct xenbus_device *dev; | ||
26 | struct xen_blkif *blkif; | ||
27 | struct xenbus_watch backend_watch; | ||
28 | unsigned major; | ||
29 | unsigned minor; | ||
30 | char *mode; | ||
31 | }; | ||
32 | |||
33 | static struct kmem_cache *xen_blkif_cachep; | ||
34 | static void connect(struct backend_info *); | ||
35 | static int connect_ring(struct backend_info *); | ||
36 | static void backend_changed(struct xenbus_watch *, const char **, | ||
37 | unsigned int); | ||
38 | |||
39 | struct xenbus_device *xen_blkbk_xenbus(struct backend_info *be) | ||
40 | { | ||
41 | return be->dev; | ||
42 | } | ||
43 | |||
44 | static int blkback_name(struct xen_blkif *blkif, char *buf) | ||
45 | { | ||
46 | char *devpath, *devname; | ||
47 | struct xenbus_device *dev = blkif->be->dev; | ||
48 | |||
49 | devpath = xenbus_read(XBT_NIL, dev->nodename, "dev", NULL); | ||
50 | if (IS_ERR(devpath)) | ||
51 | return PTR_ERR(devpath); | ||
52 | |||
53 | devname = strstr(devpath, "/dev/"); | ||
54 | if (devname != NULL) | ||
55 | devname += strlen("/dev/"); | ||
56 | else | ||
57 | devname = devpath; | ||
58 | |||
59 | snprintf(buf, TASK_COMM_LEN, "blkback.%d.%s", blkif->domid, devname); | ||
60 | kfree(devpath); | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static void xen_update_blkif_status(struct xen_blkif *blkif) | ||
66 | { | ||
67 | int err; | ||
68 | char name[TASK_COMM_LEN]; | ||
69 | |||
70 | /* Not ready to connect? */ | ||
71 | if (!blkif->irq || !blkif->vbd.bdev) | ||
72 | return; | ||
73 | |||
74 | /* Already connected? */ | ||
75 | if (blkif->be->dev->state == XenbusStateConnected) | ||
76 | return; | ||
77 | |||
78 | /* Attempt to connect: exit if we fail to. */ | ||
79 | connect(blkif->be); | ||
80 | if (blkif->be->dev->state != XenbusStateConnected) | ||
81 | return; | ||
82 | |||
83 | err = blkback_name(blkif, name); | ||
84 | if (err) { | ||
85 | xenbus_dev_error(blkif->be->dev, err, "get blkback dev name"); | ||
86 | return; | ||
87 | } | ||
88 | |||
89 | err = filemap_write_and_wait(blkif->vbd.bdev->bd_inode->i_mapping); | ||
90 | if (err) { | ||
91 | xenbus_dev_error(blkif->be->dev, err, "block flush"); | ||
92 | return; | ||
93 | } | ||
94 | invalidate_inode_pages2(blkif->vbd.bdev->bd_inode->i_mapping); | ||
95 | |||
96 | blkif->xenblkd = kthread_run(xen_blkif_schedule, blkif, name); | ||
97 | if (IS_ERR(blkif->xenblkd)) { | ||
98 | err = PTR_ERR(blkif->xenblkd); | ||
99 | blkif->xenblkd = NULL; | ||
100 | xenbus_dev_error(blkif->be->dev, err, "start xenblkd"); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | static struct xen_blkif *xen_blkif_alloc(domid_t domid) | ||
105 | { | ||
106 | struct xen_blkif *blkif; | ||
107 | |||
108 | blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL); | ||
109 | if (!blkif) | ||
110 | return ERR_PTR(-ENOMEM); | ||
111 | |||
112 | memset(blkif, 0, sizeof(*blkif)); | ||
113 | blkif->domid = domid; | ||
114 | spin_lock_init(&blkif->blk_ring_lock); | ||
115 | atomic_set(&blkif->refcnt, 1); | ||
116 | init_waitqueue_head(&blkif->wq); | ||
117 | blkif->st_print = jiffies; | ||
118 | init_waitqueue_head(&blkif->waiting_to_free); | ||
119 | |||
120 | return blkif; | ||
121 | } | ||
122 | |||
123 | static int map_frontend_page(struct xen_blkif *blkif, unsigned long shared_page) | ||
124 | { | ||
125 | struct gnttab_map_grant_ref op; | ||
126 | |||
127 | gnttab_set_map_op(&op, (unsigned long)blkif->blk_ring_area->addr, | ||
128 | GNTMAP_host_map, shared_page, blkif->domid); | ||
129 | |||
130 | if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1)) | ||
131 | BUG(); | ||
132 | |||
133 | if (op.status) { | ||
134 | DPRINTK("Grant table operation failure !\n"); | ||
135 | return op.status; | ||
136 | } | ||
137 | |||
138 | blkif->shmem_ref = shared_page; | ||
139 | blkif->shmem_handle = op.handle; | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | static void unmap_frontend_page(struct xen_blkif *blkif) | ||
145 | { | ||
146 | struct gnttab_unmap_grant_ref op; | ||
147 | |||
148 | gnttab_set_unmap_op(&op, (unsigned long)blkif->blk_ring_area->addr, | ||
149 | GNTMAP_host_map, blkif->shmem_handle); | ||
150 | |||
151 | if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1)) | ||
152 | BUG(); | ||
153 | } | ||
154 | |||
155 | static int xen_blkif_map(struct xen_blkif *blkif, unsigned long shared_page, | ||
156 | unsigned int evtchn) | ||
157 | { | ||
158 | int err; | ||
159 | |||
160 | /* Already connected through? */ | ||
161 | if (blkif->irq) | ||
162 | return 0; | ||
163 | |||
164 | blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE); | ||
165 | if (!blkif->blk_ring_area) | ||
166 | return -ENOMEM; | ||
167 | |||
168 | err = map_frontend_page(blkif, shared_page); | ||
169 | if (err) { | ||
170 | free_vm_area(blkif->blk_ring_area); | ||
171 | return err; | ||
172 | } | ||
173 | |||
174 | switch (blkif->blk_protocol) { | ||
175 | case BLKIF_PROTOCOL_NATIVE: | ||
176 | { | ||
177 | struct blkif_sring *sring; | ||
178 | sring = (struct blkif_sring *)blkif->blk_ring_area->addr; | ||
179 | BACK_RING_INIT(&blkif->blk_rings.native, sring, PAGE_SIZE); | ||
180 | break; | ||
181 | } | ||
182 | case BLKIF_PROTOCOL_X86_32: | ||
183 | { | ||
184 | struct blkif_x86_32_sring *sring_x86_32; | ||
185 | sring_x86_32 = (struct blkif_x86_32_sring *)blkif->blk_ring_area->addr; | ||
186 | BACK_RING_INIT(&blkif->blk_rings.x86_32, sring_x86_32, PAGE_SIZE); | ||
187 | break; | ||
188 | } | ||
189 | case BLKIF_PROTOCOL_X86_64: | ||
190 | { | ||
191 | struct blkif_x86_64_sring *sring_x86_64; | ||
192 | sring_x86_64 = (struct blkif_x86_64_sring *)blkif->blk_ring_area->addr; | ||
193 | BACK_RING_INIT(&blkif->blk_rings.x86_64, sring_x86_64, PAGE_SIZE); | ||
194 | break; | ||
195 | } | ||
196 | default: | ||
197 | BUG(); | ||
198 | } | ||
199 | |||
200 | err = bind_interdomain_evtchn_to_irqhandler(blkif->domid, evtchn, | ||
201 | xen_blkif_be_int, 0, | ||
202 | "blkif-backend", blkif); | ||
203 | if (err < 0) { | ||
204 | unmap_frontend_page(blkif); | ||
205 | free_vm_area(blkif->blk_ring_area); | ||
206 | blkif->blk_rings.common.sring = NULL; | ||
207 | return err; | ||
208 | } | ||
209 | blkif->irq = err; | ||
210 | |||
211 | return 0; | ||
212 | } | ||
213 | |||
214 | static void xen_blkif_disconnect(struct xen_blkif *blkif) | ||
215 | { | ||
216 | if (blkif->xenblkd) { | ||
217 | kthread_stop(blkif->xenblkd); | ||
218 | blkif->xenblkd = NULL; | ||
219 | } | ||
220 | |||
221 | atomic_dec(&blkif->refcnt); | ||
222 | wait_event(blkif->waiting_to_free, atomic_read(&blkif->refcnt) == 0); | ||
223 | atomic_inc(&blkif->refcnt); | ||
224 | |||
225 | if (blkif->irq) { | ||
226 | unbind_from_irqhandler(blkif->irq, blkif); | ||
227 | blkif->irq = 0; | ||
228 | } | ||
229 | |||
230 | if (blkif->blk_rings.common.sring) { | ||
231 | unmap_frontend_page(blkif); | ||
232 | free_vm_area(blkif->blk_ring_area); | ||
233 | blkif->blk_rings.common.sring = NULL; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | void xen_blkif_free(struct xen_blkif *blkif) | ||
238 | { | ||
239 | if (!atomic_dec_and_test(&blkif->refcnt)) | ||
240 | BUG(); | ||
241 | kmem_cache_free(xen_blkif_cachep, blkif); | ||
242 | } | ||
243 | |||
244 | int __init xen_blkif_interface_init(void) | ||
245 | { | ||
246 | xen_blkif_cachep = kmem_cache_create("blkif_cache", | ||
247 | sizeof(struct xen_blkif), | ||
248 | 0, 0, NULL); | ||
249 | if (!xen_blkif_cachep) | ||
250 | return -ENOMEM; | ||
251 | |||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | /* | ||
256 | * sysfs interface for VBD I/O requests | ||
257 | */ | ||
258 | |||
259 | #define VBD_SHOW(name, format, args...) \ | ||
260 | static ssize_t show_##name(struct device *_dev, \ | ||
261 | struct device_attribute *attr, \ | ||
262 | char *buf) \ | ||
263 | { \ | ||
264 | struct xenbus_device *dev = to_xenbus_device(_dev); \ | ||
265 | struct backend_info *be = dev_get_drvdata(&dev->dev); \ | ||
266 | \ | ||
267 | return sprintf(buf, format, ##args); \ | ||
268 | } \ | ||
269 | static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) | ||
270 | |||
271 | VBD_SHOW(oo_req, "%d\n", be->blkif->st_oo_req); | ||
272 | VBD_SHOW(rd_req, "%d\n", be->blkif->st_rd_req); | ||
273 | VBD_SHOW(wr_req, "%d\n", be->blkif->st_wr_req); | ||
274 | VBD_SHOW(f_req, "%d\n", be->blkif->st_f_req); | ||
275 | VBD_SHOW(rd_sect, "%d\n", be->blkif->st_rd_sect); | ||
276 | VBD_SHOW(wr_sect, "%d\n", be->blkif->st_wr_sect); | ||
277 | |||
278 | static struct attribute *xen_vbdstat_attrs[] = { | ||
279 | &dev_attr_oo_req.attr, | ||
280 | &dev_attr_rd_req.attr, | ||
281 | &dev_attr_wr_req.attr, | ||
282 | &dev_attr_f_req.attr, | ||
283 | &dev_attr_rd_sect.attr, | ||
284 | &dev_attr_wr_sect.attr, | ||
285 | NULL | ||
286 | }; | ||
287 | |||
288 | static struct attribute_group xen_vbdstat_group = { | ||
289 | .name = "statistics", | ||
290 | .attrs = xen_vbdstat_attrs, | ||
291 | }; | ||
292 | |||
293 | VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor); | ||
294 | VBD_SHOW(mode, "%s\n", be->mode); | ||
295 | |||
296 | int xenvbd_sysfs_addif(struct xenbus_device *dev) | ||
297 | { | ||
298 | int error; | ||
299 | |||
300 | error = device_create_file(&dev->dev, &dev_attr_physical_device); | ||
301 | if (error) | ||
302 | goto fail1; | ||
303 | |||
304 | error = device_create_file(&dev->dev, &dev_attr_mode); | ||
305 | if (error) | ||
306 | goto fail2; | ||
307 | |||
308 | error = sysfs_create_group(&dev->dev.kobj, &xen_vbdstat_group); | ||
309 | if (error) | ||
310 | goto fail3; | ||
311 | |||
312 | return 0; | ||
313 | |||
314 | fail3: sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group); | ||
315 | fail2: device_remove_file(&dev->dev, &dev_attr_mode); | ||
316 | fail1: device_remove_file(&dev->dev, &dev_attr_physical_device); | ||
317 | return error; | ||
318 | } | ||
319 | |||
320 | void xenvbd_sysfs_delif(struct xenbus_device *dev) | ||
321 | { | ||
322 | sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group); | ||
323 | device_remove_file(&dev->dev, &dev_attr_mode); | ||
324 | device_remove_file(&dev->dev, &dev_attr_physical_device); | ||
325 | } | ||
326 | |||
327 | |||
328 | static void xen_vbd_free(struct xen_vbd *vbd) | ||
329 | { | ||
330 | if (vbd->bdev) | ||
331 | blkdev_put(vbd->bdev, vbd->readonly ? FMODE_READ : FMODE_WRITE); | ||
332 | vbd->bdev = NULL; | ||
333 | } | ||
334 | |||
335 | static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle, | ||
336 | unsigned major, unsigned minor, int readonly, | ||
337 | int cdrom) | ||
338 | { | ||
339 | struct xen_vbd *vbd; | ||
340 | struct block_device *bdev; | ||
341 | struct request_queue *q; | ||
342 | |||
343 | vbd = &blkif->vbd; | ||
344 | vbd->handle = handle; | ||
345 | vbd->readonly = readonly; | ||
346 | vbd->type = 0; | ||
347 | |||
348 | vbd->pdevice = MKDEV(major, minor); | ||
349 | |||
350 | bdev = blkdev_get_by_dev(vbd->pdevice, vbd->readonly ? | ||
351 | FMODE_READ : FMODE_WRITE, NULL); | ||
352 | |||
353 | if (IS_ERR(bdev)) { | ||
354 | DPRINTK("xen_vbd_create: device %08x could not be opened.\n", | ||
355 | vbd->pdevice); | ||
356 | return -ENOENT; | ||
357 | } | ||
358 | |||
359 | vbd->bdev = bdev; | ||
360 | vbd->size = vbd_sz(vbd); | ||
361 | |||
362 | if (vbd->bdev->bd_disk == NULL) { | ||
363 | DPRINTK("xen_vbd_create: device %08x doesn't exist.\n", | ||
364 | vbd->pdevice); | ||
365 | xen_vbd_free(vbd); | ||
366 | return -ENOENT; | ||
367 | } | ||
368 | |||
369 | if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom) | ||
370 | vbd->type |= VDISK_CDROM; | ||
371 | if (vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE) | ||
372 | vbd->type |= VDISK_REMOVABLE; | ||
373 | |||
374 | q = bdev_get_queue(bdev); | ||
375 | if (q && q->flush_flags) | ||
376 | vbd->flush_support = true; | ||
377 | |||
378 | DPRINTK("Successful creation of handle=%04x (dom=%u)\n", | ||
379 | handle, blkif->domid); | ||
380 | return 0; | ||
381 | } | ||
382 | static int xen_blkbk_remove(struct xenbus_device *dev) | ||
383 | { | ||
384 | struct backend_info *be = dev_get_drvdata(&dev->dev); | ||
385 | |||
386 | DPRINTK(""); | ||
387 | |||
388 | if (be->major || be->minor) | ||
389 | xenvbd_sysfs_delif(dev); | ||
390 | |||
391 | if (be->backend_watch.node) { | ||
392 | unregister_xenbus_watch(&be->backend_watch); | ||
393 | kfree(be->backend_watch.node); | ||
394 | be->backend_watch.node = NULL; | ||
395 | } | ||
396 | |||
397 | if (be->blkif) { | ||
398 | xen_blkif_disconnect(be->blkif); | ||
399 | xen_vbd_free(&be->blkif->vbd); | ||
400 | xen_blkif_free(be->blkif); | ||
401 | be->blkif = NULL; | ||
402 | } | ||
403 | |||
404 | kfree(be); | ||
405 | dev_set_drvdata(&dev->dev, NULL); | ||
406 | return 0; | ||
407 | } | ||
408 | |||
409 | int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt, | ||
410 | struct backend_info *be, int state) | ||
411 | { | ||
412 | struct xenbus_device *dev = be->dev; | ||
413 | int err; | ||
414 | |||
415 | err = xenbus_printf(xbt, dev->nodename, "feature-flush-cache", | ||
416 | "%d", state); | ||
417 | if (err) | ||
418 | xenbus_dev_fatal(dev, err, "writing feature-flush-cache"); | ||
419 | |||
420 | return err; | ||
421 | } | ||
422 | |||
423 | /* | ||
424 | * Entry point to this code when a new device is created. Allocate the basic | ||
425 | * structures, and watch the store waiting for the hotplug scripts to tell us | ||
426 | * the device's physical major and minor numbers. Switch to InitWait. | ||
427 | */ | ||
428 | static int xen_blkbk_probe(struct xenbus_device *dev, | ||
429 | const struct xenbus_device_id *id) | ||
430 | { | ||
431 | int err; | ||
432 | struct backend_info *be = kzalloc(sizeof(struct backend_info), | ||
433 | GFP_KERNEL); | ||
434 | if (!be) { | ||
435 | xenbus_dev_fatal(dev, -ENOMEM, | ||
436 | "allocating backend structure"); | ||
437 | return -ENOMEM; | ||
438 | } | ||
439 | be->dev = dev; | ||
440 | dev_set_drvdata(&dev->dev, be); | ||
441 | |||
442 | be->blkif = xen_blkif_alloc(dev->otherend_id); | ||
443 | if (IS_ERR(be->blkif)) { | ||
444 | err = PTR_ERR(be->blkif); | ||
445 | be->blkif = NULL; | ||
446 | xenbus_dev_fatal(dev, err, "creating block interface"); | ||
447 | goto fail; | ||
448 | } | ||
449 | |||
450 | /* setup back pointer */ | ||
451 | be->blkif->be = be; | ||
452 | |||
453 | err = xenbus_watch_pathfmt(dev, &be->backend_watch, backend_changed, | ||
454 | "%s/%s", dev->nodename, "physical-device"); | ||
455 | if (err) | ||
456 | goto fail; | ||
457 | |||
458 | err = xenbus_switch_state(dev, XenbusStateInitWait); | ||
459 | if (err) | ||
460 | goto fail; | ||
461 | |||
462 | return 0; | ||
463 | |||
464 | fail: | ||
465 | DPRINTK("failed"); | ||
466 | xen_blkbk_remove(dev); | ||
467 | return err; | ||
468 | } | ||
469 | |||
470 | |||
471 | /* | ||
472 | * Callback received when the hotplug scripts have placed the physical-device | ||
473 | * node. Read it and the mode node, and create a vbd. If the frontend is | ||
474 | * ready, connect. | ||
475 | */ | ||
476 | static void backend_changed(struct xenbus_watch *watch, | ||
477 | const char **vec, unsigned int len) | ||
478 | { | ||
479 | int err; | ||
480 | unsigned major; | ||
481 | unsigned minor; | ||
482 | struct backend_info *be | ||
483 | = container_of(watch, struct backend_info, backend_watch); | ||
484 | struct xenbus_device *dev = be->dev; | ||
485 | int cdrom = 0; | ||
486 | char *device_type; | ||
487 | |||
488 | DPRINTK(""); | ||
489 | |||
490 | err = xenbus_scanf(XBT_NIL, dev->nodename, "physical-device", "%x:%x", | ||
491 | &major, &minor); | ||
492 | if (XENBUS_EXIST_ERR(err)) { | ||
493 | /* | ||
494 | * Since this watch will fire once immediately after it is | ||
495 | * registered, we expect this. Ignore it, and wait for the | ||
496 | * hotplug scripts. | ||
497 | */ | ||
498 | return; | ||
499 | } | ||
500 | if (err != 2) { | ||
501 | xenbus_dev_fatal(dev, err, "reading physical-device"); | ||
502 | return; | ||
503 | } | ||
504 | |||
505 | if ((be->major || be->minor) && | ||
506 | ((be->major != major) || (be->minor != minor))) { | ||
507 | pr_warn(DRV_PFX "changing physical device (from %x:%x to %x:%x) not supported.\n", | ||
508 | be->major, be->minor, major, minor); | ||
509 | return; | ||
510 | } | ||
511 | |||
512 | be->mode = xenbus_read(XBT_NIL, dev->nodename, "mode", NULL); | ||
513 | if (IS_ERR(be->mode)) { | ||
514 | err = PTR_ERR(be->mode); | ||
515 | be->mode = NULL; | ||
516 | xenbus_dev_fatal(dev, err, "reading mode"); | ||
517 | return; | ||
518 | } | ||
519 | |||
520 | device_type = xenbus_read(XBT_NIL, dev->otherend, "device-type", NULL); | ||
521 | if (!IS_ERR(device_type)) { | ||
522 | cdrom = strcmp(device_type, "cdrom") == 0; | ||
523 | kfree(device_type); | ||
524 | } | ||
525 | |||
526 | if (be->major == 0 && be->minor == 0) { | ||
527 | /* Front end dir is a number, which is used as the handle. */ | ||
528 | |||
529 | char *p = strrchr(dev->otherend, '/') + 1; | ||
530 | long handle; | ||
531 | err = strict_strtoul(p, 0, &handle); | ||
532 | if (err) | ||
533 | return; | ||
534 | |||
535 | be->major = major; | ||
536 | be->minor = minor; | ||
537 | |||
538 | err = xen_vbd_create(be->blkif, handle, major, minor, | ||
539 | (NULL == strchr(be->mode, 'w')), cdrom); | ||
540 | if (err) { | ||
541 | be->major = 0; | ||
542 | be->minor = 0; | ||
543 | xenbus_dev_fatal(dev, err, "creating vbd structure"); | ||
544 | return; | ||
545 | } | ||
546 | |||
547 | err = xenvbd_sysfs_addif(dev); | ||
548 | if (err) { | ||
549 | xen_vbd_free(&be->blkif->vbd); | ||
550 | be->major = 0; | ||
551 | be->minor = 0; | ||
552 | xenbus_dev_fatal(dev, err, "creating sysfs entries"); | ||
553 | return; | ||
554 | } | ||
555 | |||
556 | /* We're potentially connected now */ | ||
557 | xen_update_blkif_status(be->blkif); | ||
558 | } | ||
559 | } | ||
560 | |||
561 | |||
562 | /* | ||
563 | * Callback received when the frontend's state changes. | ||
564 | */ | ||
565 | static void frontend_changed(struct xenbus_device *dev, | ||
566 | enum xenbus_state frontend_state) | ||
567 | { | ||
568 | struct backend_info *be = dev_get_drvdata(&dev->dev); | ||
569 | int err; | ||
570 | |||
571 | DPRINTK("%s", xenbus_strstate(frontend_state)); | ||
572 | |||
573 | switch (frontend_state) { | ||
574 | case XenbusStateInitialising: | ||
575 | if (dev->state == XenbusStateClosed) { | ||
576 | pr_info(DRV_PFX "%s: prepare for reconnect\n", | ||
577 | dev->nodename); | ||
578 | xenbus_switch_state(dev, XenbusStateInitWait); | ||
579 | } | ||
580 | break; | ||
581 | |||
582 | case XenbusStateInitialised: | ||
583 | case XenbusStateConnected: | ||
584 | /* | ||
585 | * Ensure we connect even when two watches fire in | ||
586 | * close successsion and we miss the intermediate value | ||
587 | * of frontend_state. | ||
588 | */ | ||
589 | if (dev->state == XenbusStateConnected) | ||
590 | break; | ||
591 | |||
592 | /* | ||
593 | * Enforce precondition before potential leak point. | ||
594 | * blkif_disconnect() is idempotent. | ||
595 | */ | ||
596 | xen_blkif_disconnect(be->blkif); | ||
597 | |||
598 | err = connect_ring(be); | ||
599 | if (err) | ||
600 | break; | ||
601 | xen_update_blkif_status(be->blkif); | ||
602 | break; | ||
603 | |||
604 | case XenbusStateClosing: | ||
605 | xen_blkif_disconnect(be->blkif); | ||
606 | xenbus_switch_state(dev, XenbusStateClosing); | ||
607 | break; | ||
608 | |||
609 | case XenbusStateClosed: | ||
610 | xenbus_switch_state(dev, XenbusStateClosed); | ||
611 | if (xenbus_dev_is_online(dev)) | ||
612 | break; | ||
613 | /* fall through if not online */ | ||
614 | case XenbusStateUnknown: | ||
615 | /* implies blkif_disconnect() via blkback_remove() */ | ||
616 | device_unregister(&dev->dev); | ||
617 | break; | ||
618 | |||
619 | default: | ||
620 | xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend", | ||
621 | frontend_state); | ||
622 | break; | ||
623 | } | ||
624 | } | ||
625 | |||
626 | |||
627 | /* ** Connection ** */ | ||
628 | |||
629 | |||
630 | /* | ||
631 | * Write the physical details regarding the block device to the store, and | ||
632 | * switch to Connected state. | ||
633 | */ | ||
634 | static void connect(struct backend_info *be) | ||
635 | { | ||
636 | struct xenbus_transaction xbt; | ||
637 | int err; | ||
638 | struct xenbus_device *dev = be->dev; | ||
639 | |||
640 | DPRINTK("%s", dev->otherend); | ||
641 | |||
642 | /* Supply the information about the device the frontend needs */ | ||
643 | again: | ||
644 | err = xenbus_transaction_start(&xbt); | ||
645 | if (err) { | ||
646 | xenbus_dev_fatal(dev, err, "starting transaction"); | ||
647 | return; | ||
648 | } | ||
649 | |||
650 | err = xen_blkbk_flush_diskcache(xbt, be, be->blkif->vbd.flush_support); | ||
651 | if (err) | ||
652 | goto abort; | ||
653 | |||
654 | err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", | ||
655 | (unsigned long long)vbd_sz(&be->blkif->vbd)); | ||
656 | if (err) { | ||
657 | xenbus_dev_fatal(dev, err, "writing %s/sectors", | ||
658 | dev->nodename); | ||
659 | goto abort; | ||
660 | } | ||
661 | |||
662 | /* FIXME: use a typename instead */ | ||
663 | err = xenbus_printf(xbt, dev->nodename, "info", "%u", | ||
664 | be->blkif->vbd.type | | ||
665 | (be->blkif->vbd.readonly ? VDISK_READONLY : 0)); | ||
666 | if (err) { | ||
667 | xenbus_dev_fatal(dev, err, "writing %s/info", | ||
668 | dev->nodename); | ||
669 | goto abort; | ||
670 | } | ||
671 | err = xenbus_printf(xbt, dev->nodename, "sector-size", "%lu", | ||
672 | (unsigned long) | ||
673 | bdev_logical_block_size(be->blkif->vbd.bdev)); | ||
674 | if (err) { | ||
675 | xenbus_dev_fatal(dev, err, "writing %s/sector-size", | ||
676 | dev->nodename); | ||
677 | goto abort; | ||
678 | } | ||
679 | |||
680 | err = xenbus_transaction_end(xbt, 0); | ||
681 | if (err == -EAGAIN) | ||
682 | goto again; | ||
683 | if (err) | ||
684 | xenbus_dev_fatal(dev, err, "ending transaction"); | ||
685 | |||
686 | err = xenbus_switch_state(dev, XenbusStateConnected); | ||
687 | if (err) | ||
688 | xenbus_dev_fatal(dev, err, "switching to Connected state", | ||
689 | dev->nodename); | ||
690 | |||
691 | return; | ||
692 | abort: | ||
693 | xenbus_transaction_end(xbt, 1); | ||
694 | } | ||
695 | |||
696 | |||
697 | static int connect_ring(struct backend_info *be) | ||
698 | { | ||
699 | struct xenbus_device *dev = be->dev; | ||
700 | unsigned long ring_ref; | ||
701 | unsigned int evtchn; | ||
702 | char protocol[64] = ""; | ||
703 | int err; | ||
704 | |||
705 | DPRINTK("%s", dev->otherend); | ||
706 | |||
707 | err = xenbus_gather(XBT_NIL, dev->otherend, "ring-ref", "%lu", | ||
708 | &ring_ref, "event-channel", "%u", &evtchn, NULL); | ||
709 | if (err) { | ||
710 | xenbus_dev_fatal(dev, err, | ||
711 | "reading %s/ring-ref and event-channel", | ||
712 | dev->otherend); | ||
713 | return err; | ||
714 | } | ||
715 | |||
716 | be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE; | ||
717 | err = xenbus_gather(XBT_NIL, dev->otherend, "protocol", | ||
718 | "%63s", protocol, NULL); | ||
719 | if (err) | ||
720 | strcpy(protocol, "unspecified, assuming native"); | ||
721 | else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) | ||
722 | be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE; | ||
723 | else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_32)) | ||
724 | be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_32; | ||
725 | else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_64)) | ||
726 | be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_64; | ||
727 | else { | ||
728 | xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); | ||
729 | return -1; | ||
730 | } | ||
731 | pr_info(DRV_PFX "ring-ref %ld, event-channel %d, protocol %d (%s)\n", | ||
732 | ring_ref, evtchn, be->blkif->blk_protocol, protocol); | ||
733 | |||
734 | /* Map the shared frame, irq etc. */ | ||
735 | err = xen_blkif_map(be->blkif, ring_ref, evtchn); | ||
736 | if (err) { | ||
737 | xenbus_dev_fatal(dev, err, "mapping ring-ref %lu port %u", | ||
738 | ring_ref, evtchn); | ||
739 | return err; | ||
740 | } | ||
741 | |||
742 | return 0; | ||
743 | } | ||
744 | |||
745 | |||
746 | /* ** Driver Registration ** */ | ||
747 | |||
748 | |||
749 | static const struct xenbus_device_id xen_blkbk_ids[] = { | ||
750 | { "vbd" }, | ||
751 | { "" } | ||
752 | }; | ||
753 | |||
754 | |||
755 | static struct xenbus_driver xen_blkbk = { | ||
756 | .name = "vbd", | ||
757 | .owner = THIS_MODULE, | ||
758 | .ids = xen_blkbk_ids, | ||
759 | .probe = xen_blkbk_probe, | ||
760 | .remove = xen_blkbk_remove, | ||
761 | .otherend_changed = frontend_changed | ||
762 | }; | ||
763 | |||
764 | |||
765 | int xen_blkif_xenbus_init(void) | ||
766 | { | ||
767 | return xenbus_register_backend(&xen_blkbk); | ||
768 | } | ||
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 9cb8668ff5f4..b536a9cef917 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -97,6 +97,7 @@ struct blkfront_info | |||
97 | struct blk_shadow shadow[BLK_RING_SIZE]; | 97 | struct blk_shadow shadow[BLK_RING_SIZE]; |
98 | unsigned long shadow_free; | 98 | unsigned long shadow_free; |
99 | unsigned int feature_flush; | 99 | unsigned int feature_flush; |
100 | unsigned int flush_op; | ||
100 | int is_ready; | 101 | int is_ready; |
101 | }; | 102 | }; |
102 | 103 | ||
@@ -250,8 +251,7 @@ static int blkif_ioctl(struct block_device *bdev, fmode_t mode, | |||
250 | 251 | ||
251 | /* | 252 | /* |
252 | * Generate a Xen blkfront IO request from a blk layer request. Reads | 253 | * Generate a Xen blkfront IO request from a blk layer request. Reads |
253 | * and writes are handled as expected. Since we lack a loose flush | 254 | * and writes are handled as expected. |
254 | * request, we map flushes into a full ordered barrier. | ||
255 | * | 255 | * |
256 | * @req: a request struct | 256 | * @req: a request struct |
257 | */ | 257 | */ |
@@ -293,14 +293,13 @@ static int blkif_queue_request(struct request *req) | |||
293 | 293 | ||
294 | if (req->cmd_flags & (REQ_FLUSH | REQ_FUA)) { | 294 | if (req->cmd_flags & (REQ_FLUSH | REQ_FUA)) { |
295 | /* | 295 | /* |
296 | * Ideally we could just do an unordered | 296 | * Ideally we can do an unordered flush-to-disk. In case the |
297 | * flush-to-disk, but all we have is a full write | 297 | * backend onlysupports barriers, use that. A barrier request |
298 | * barrier at the moment. However, a barrier write is | ||
299 | * a superset of FUA, so we can implement it the same | 298 | * a superset of FUA, so we can implement it the same |
300 | * way. (It's also a FLUSH+FUA, since it is | 299 | * way. (It's also a FLUSH+FUA, since it is |
301 | * guaranteed ordered WRT previous writes.) | 300 | * guaranteed ordered WRT previous writes.) |
302 | */ | 301 | */ |
303 | ring_req->operation = BLKIF_OP_WRITE_BARRIER; | 302 | ring_req->operation = info->flush_op; |
304 | } | 303 | } |
305 | 304 | ||
306 | ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg); | 305 | ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg); |
@@ -433,8 +432,11 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) | |||
433 | static void xlvbd_flush(struct blkfront_info *info) | 432 | static void xlvbd_flush(struct blkfront_info *info) |
434 | { | 433 | { |
435 | blk_queue_flush(info->rq, info->feature_flush); | 434 | blk_queue_flush(info->rq, info->feature_flush); |
436 | printk(KERN_INFO "blkfront: %s: barriers %s\n", | 435 | printk(KERN_INFO "blkfront: %s: %s: %s\n", |
437 | info->gd->disk_name, | 436 | info->gd->disk_name, |
437 | info->flush_op == BLKIF_OP_WRITE_BARRIER ? | ||
438 | "barrier" : (info->flush_op == BLKIF_OP_FLUSH_DISKCACHE ? | ||
439 | "flush diskcache" : "barrier or flush"), | ||
438 | info->feature_flush ? "enabled" : "disabled"); | 440 | info->feature_flush ? "enabled" : "disabled"); |
439 | } | 441 | } |
440 | 442 | ||
@@ -720,15 +722,20 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
720 | 722 | ||
721 | error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; | 723 | error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; |
722 | switch (bret->operation) { | 724 | switch (bret->operation) { |
725 | case BLKIF_OP_FLUSH_DISKCACHE: | ||
723 | case BLKIF_OP_WRITE_BARRIER: | 726 | case BLKIF_OP_WRITE_BARRIER: |
724 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { | 727 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { |
725 | printk(KERN_WARNING "blkfront: %s: write barrier op failed\n", | 728 | printk(KERN_WARNING "blkfront: %s: write %s op failed\n", |
729 | info->flush_op == BLKIF_OP_WRITE_BARRIER ? | ||
730 | "barrier" : "flush disk cache", | ||
726 | info->gd->disk_name); | 731 | info->gd->disk_name); |
727 | error = -EOPNOTSUPP; | 732 | error = -EOPNOTSUPP; |
728 | } | 733 | } |
729 | if (unlikely(bret->status == BLKIF_RSP_ERROR && | 734 | if (unlikely(bret->status == BLKIF_RSP_ERROR && |
730 | info->shadow[id].req.nr_segments == 0)) { | 735 | info->shadow[id].req.nr_segments == 0)) { |
731 | printk(KERN_WARNING "blkfront: %s: empty write barrier op failed\n", | 736 | printk(KERN_WARNING "blkfront: %s: empty write %s op failed\n", |
737 | info->flush_op == BLKIF_OP_WRITE_BARRIER ? | ||
738 | "barrier" : "flush disk cache", | ||
732 | info->gd->disk_name); | 739 | info->gd->disk_name); |
733 | error = -EOPNOTSUPP; | 740 | error = -EOPNOTSUPP; |
734 | } | 741 | } |
@@ -736,6 +743,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
736 | if (error == -EOPNOTSUPP) | 743 | if (error == -EOPNOTSUPP) |
737 | error = 0; | 744 | error = 0; |
738 | info->feature_flush = 0; | 745 | info->feature_flush = 0; |
746 | info->flush_op = 0; | ||
739 | xlvbd_flush(info); | 747 | xlvbd_flush(info); |
740 | } | 748 | } |
741 | /* fall through */ | 749 | /* fall through */ |
@@ -1100,7 +1108,7 @@ static void blkfront_connect(struct blkfront_info *info) | |||
1100 | unsigned long sector_size; | 1108 | unsigned long sector_size; |
1101 | unsigned int binfo; | 1109 | unsigned int binfo; |
1102 | int err; | 1110 | int err; |
1103 | int barrier; | 1111 | int barrier, flush; |
1104 | 1112 | ||
1105 | switch (info->connected) { | 1113 | switch (info->connected) { |
1106 | case BLKIF_STATE_CONNECTED: | 1114 | case BLKIF_STATE_CONNECTED: |
@@ -1140,8 +1148,11 @@ static void blkfront_connect(struct blkfront_info *info) | |||
1140 | return; | 1148 | return; |
1141 | } | 1149 | } |
1142 | 1150 | ||
1151 | info->feature_flush = 0; | ||
1152 | info->flush_op = 0; | ||
1153 | |||
1143 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | 1154 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, |
1144 | "feature-barrier", "%lu", &barrier, | 1155 | "feature-barrier", "%d", &barrier, |
1145 | NULL); | 1156 | NULL); |
1146 | 1157 | ||
1147 | /* | 1158 | /* |
@@ -1151,11 +1162,23 @@ static void blkfront_connect(struct blkfront_info *info) | |||
1151 | * | 1162 | * |
1152 | * If there are barriers, then we use flush. | 1163 | * If there are barriers, then we use flush. |
1153 | */ | 1164 | */ |
1154 | info->feature_flush = 0; | 1165 | if (!err && barrier) { |
1155 | |||
1156 | if (!err && barrier) | ||
1157 | info->feature_flush = REQ_FLUSH | REQ_FUA; | 1166 | info->feature_flush = REQ_FLUSH | REQ_FUA; |
1167 | info->flush_op = BLKIF_OP_WRITE_BARRIER; | ||
1168 | } | ||
1169 | /* | ||
1170 | * And if there is "feature-flush-cache" use that above | ||
1171 | * barriers. | ||
1172 | */ | ||
1173 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
1174 | "feature-flush-cache", "%d", &flush, | ||
1175 | NULL); | ||
1158 | 1176 | ||
1177 | if (!err && flush) { | ||
1178 | info->feature_flush = REQ_FLUSH; | ||
1179 | info->flush_op = BLKIF_OP_FLUSH_DISKCACHE; | ||
1180 | } | ||
1181 | |||
1159 | err = xlvbd_alloc_gendisk(sectors, info, binfo, sector_size); | 1182 | err = xlvbd_alloc_gendisk(sectors, info, binfo, sector_size); |
1160 | if (err) { | 1183 | if (err) { |
1161 | xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", | 1184 | xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index e427fbe45999..ae15a4ddaa9b 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -625,7 +625,9 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
625 | blk_queue_max_hw_sectors(q, 4096 / 512); | 625 | blk_queue_max_hw_sectors(q, 4096 / 512); |
626 | gendisk->queue = q; | 626 | gendisk->queue = q; |
627 | gendisk->fops = &viocd_fops; | 627 | gendisk->fops = &viocd_fops; |
628 | gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; | 628 | gendisk->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE | |
629 | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; | ||
630 | gendisk->events = DISK_EVENT_MEDIA_CHANGE; | ||
629 | set_capacity(gendisk, 0); | 631 | set_capacity(gendisk, 0); |
630 | gendisk->private_data = d; | 632 | gendisk->private_data = d; |
631 | d->viocd_disk = gendisk; | 633 | d->viocd_disk = gendisk; |
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index d72433f2d310..6e40072fbf67 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
@@ -5,6 +5,9 @@ | |||
5 | * | 5 | * |
6 | * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org> | 6 | * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org> |
7 | * | 7 | * |
8 | * Hwmon integration: | ||
9 | * Copyright (C) 2011 Jean Delvare <khali@linux-fr.org> | ||
10 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | 11 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 12 | * under the terms of the GNU General Public License as published by the |
10 | * Free Software Foundation; either version 2, or (at your option) any | 13 | * Free Software Foundation; either version 2, or (at your option) any |
@@ -24,6 +27,8 @@ | |||
24 | #include <linux/dmi.h> | 27 | #include <linux/dmi.h> |
25 | #include <linux/capability.h> | 28 | #include <linux/capability.h> |
26 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/hwmon.h> | ||
31 | #include <linux/hwmon-sysfs.h> | ||
27 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
28 | #include <asm/io.h> | 33 | #include <asm/io.h> |
29 | 34 | ||
@@ -58,6 +63,7 @@ | |||
58 | 63 | ||
59 | static DEFINE_MUTEX(i8k_mutex); | 64 | static DEFINE_MUTEX(i8k_mutex); |
60 | static char bios_version[4]; | 65 | static char bios_version[4]; |
66 | static struct device *i8k_hwmon_dev; | ||
61 | 67 | ||
62 | MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); | 68 | MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); |
63 | MODULE_DESCRIPTION("Driver for accessing SMM BIOS on Dell laptops"); | 69 | MODULE_DESCRIPTION("Driver for accessing SMM BIOS on Dell laptops"); |
@@ -139,8 +145,8 @@ static int i8k_smm(struct smm_regs *regs) | |||
139 | "movl %%edi,20(%%rax)\n\t" | 145 | "movl %%edi,20(%%rax)\n\t" |
140 | "popq %%rdx\n\t" | 146 | "popq %%rdx\n\t" |
141 | "movl %%edx,0(%%rax)\n\t" | 147 | "movl %%edx,0(%%rax)\n\t" |
142 | "lahf\n\t" | 148 | "pushfq\n\t" |
143 | "shrl $8,%%eax\n\t" | 149 | "popq %%rax\n\t" |
144 | "andl $1,%%eax\n" | 150 | "andl $1,%%eax\n" |
145 | :"=a"(rc) | 151 | :"=a"(rc) |
146 | : "a"(regs) | 152 | : "a"(regs) |
@@ -455,6 +461,152 @@ static int i8k_open_fs(struct inode *inode, struct file *file) | |||
455 | return single_open(file, i8k_proc_show, NULL); | 461 | return single_open(file, i8k_proc_show, NULL); |
456 | } | 462 | } |
457 | 463 | ||
464 | |||
465 | /* | ||
466 | * Hwmon interface | ||
467 | */ | ||
468 | |||
469 | static ssize_t i8k_hwmon_show_temp(struct device *dev, | ||
470 | struct device_attribute *devattr, | ||
471 | char *buf) | ||
472 | { | ||
473 | int cpu_temp; | ||
474 | |||
475 | cpu_temp = i8k_get_temp(0); | ||
476 | if (cpu_temp < 0) | ||
477 | return cpu_temp; | ||
478 | return sprintf(buf, "%d\n", cpu_temp * 1000); | ||
479 | } | ||
480 | |||
481 | static ssize_t i8k_hwmon_show_fan(struct device *dev, | ||
482 | struct device_attribute *devattr, | ||
483 | char *buf) | ||
484 | { | ||
485 | int index = to_sensor_dev_attr(devattr)->index; | ||
486 | int fan_speed; | ||
487 | |||
488 | fan_speed = i8k_get_fan_speed(index); | ||
489 | if (fan_speed < 0) | ||
490 | return fan_speed; | ||
491 | return sprintf(buf, "%d\n", fan_speed); | ||
492 | } | ||
493 | |||
494 | static ssize_t i8k_hwmon_show_label(struct device *dev, | ||
495 | struct device_attribute *devattr, | ||
496 | char *buf) | ||
497 | { | ||
498 | static const char *labels[4] = { | ||
499 | "i8k", | ||
500 | "CPU", | ||
501 | "Left Fan", | ||
502 | "Right Fan", | ||
503 | }; | ||
504 | int index = to_sensor_dev_attr(devattr)->index; | ||
505 | |||
506 | return sprintf(buf, "%s\n", labels[index]); | ||
507 | } | ||
508 | |||
509 | static DEVICE_ATTR(temp1_input, S_IRUGO, i8k_hwmon_show_temp, NULL); | ||
510 | static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, i8k_hwmon_show_fan, NULL, | ||
511 | I8K_FAN_LEFT); | ||
512 | static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, i8k_hwmon_show_fan, NULL, | ||
513 | I8K_FAN_RIGHT); | ||
514 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, i8k_hwmon_show_label, NULL, 0); | ||
515 | static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, i8k_hwmon_show_label, NULL, 1); | ||
516 | static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, i8k_hwmon_show_label, NULL, 2); | ||
517 | static SENSOR_DEVICE_ATTR(fan2_label, S_IRUGO, i8k_hwmon_show_label, NULL, 3); | ||
518 | |||
519 | static void i8k_hwmon_remove_files(struct device *dev) | ||
520 | { | ||
521 | device_remove_file(dev, &dev_attr_temp1_input); | ||
522 | device_remove_file(dev, &sensor_dev_attr_fan1_input.dev_attr); | ||
523 | device_remove_file(dev, &sensor_dev_attr_fan2_input.dev_attr); | ||
524 | device_remove_file(dev, &sensor_dev_attr_temp1_label.dev_attr); | ||
525 | device_remove_file(dev, &sensor_dev_attr_fan1_label.dev_attr); | ||
526 | device_remove_file(dev, &sensor_dev_attr_fan2_label.dev_attr); | ||
527 | device_remove_file(dev, &sensor_dev_attr_name.dev_attr); | ||
528 | } | ||
529 | |||
530 | static int __init i8k_init_hwmon(void) | ||
531 | { | ||
532 | int err; | ||
533 | |||
534 | i8k_hwmon_dev = hwmon_device_register(NULL); | ||
535 | if (IS_ERR(i8k_hwmon_dev)) { | ||
536 | err = PTR_ERR(i8k_hwmon_dev); | ||
537 | i8k_hwmon_dev = NULL; | ||
538 | printk(KERN_ERR "i8k: hwmon registration failed (%d)\n", err); | ||
539 | return err; | ||
540 | } | ||
541 | |||
542 | /* Required name attribute */ | ||
543 | err = device_create_file(i8k_hwmon_dev, | ||
544 | &sensor_dev_attr_name.dev_attr); | ||
545 | if (err) | ||
546 | goto exit_unregister; | ||
547 | |||
548 | /* CPU temperature attributes, if temperature reading is OK */ | ||
549 | err = i8k_get_temp(0); | ||
550 | if (err < 0) { | ||
551 | dev_dbg(i8k_hwmon_dev, | ||
552 | "Not creating temperature attributes (%d)\n", err); | ||
553 | } else { | ||
554 | err = device_create_file(i8k_hwmon_dev, &dev_attr_temp1_input); | ||
555 | if (err) | ||
556 | goto exit_remove_files; | ||
557 | err = device_create_file(i8k_hwmon_dev, | ||
558 | &sensor_dev_attr_temp1_label.dev_attr); | ||
559 | if (err) | ||
560 | goto exit_remove_files; | ||
561 | } | ||
562 | |||
563 | /* Left fan attributes, if left fan is present */ | ||
564 | err = i8k_get_fan_status(I8K_FAN_LEFT); | ||
565 | if (err < 0) { | ||
566 | dev_dbg(i8k_hwmon_dev, | ||
567 | "Not creating %s fan attributes (%d)\n", "left", err); | ||
568 | } else { | ||
569 | err = device_create_file(i8k_hwmon_dev, | ||
570 | &sensor_dev_attr_fan1_input.dev_attr); | ||
571 | if (err) | ||
572 | goto exit_remove_files; | ||
573 | err = device_create_file(i8k_hwmon_dev, | ||
574 | &sensor_dev_attr_fan1_label.dev_attr); | ||
575 | if (err) | ||
576 | goto exit_remove_files; | ||
577 | } | ||
578 | |||
579 | /* Right fan attributes, if right fan is present */ | ||
580 | err = i8k_get_fan_status(I8K_FAN_RIGHT); | ||
581 | if (err < 0) { | ||
582 | dev_dbg(i8k_hwmon_dev, | ||
583 | "Not creating %s fan attributes (%d)\n", "right", err); | ||
584 | } else { | ||
585 | err = device_create_file(i8k_hwmon_dev, | ||
586 | &sensor_dev_attr_fan2_input.dev_attr); | ||
587 | if (err) | ||
588 | goto exit_remove_files; | ||
589 | err = device_create_file(i8k_hwmon_dev, | ||
590 | &sensor_dev_attr_fan2_label.dev_attr); | ||
591 | if (err) | ||
592 | goto exit_remove_files; | ||
593 | } | ||
594 | |||
595 | return 0; | ||
596 | |||
597 | exit_remove_files: | ||
598 | i8k_hwmon_remove_files(i8k_hwmon_dev); | ||
599 | exit_unregister: | ||
600 | hwmon_device_unregister(i8k_hwmon_dev); | ||
601 | return err; | ||
602 | } | ||
603 | |||
604 | static void __exit i8k_exit_hwmon(void) | ||
605 | { | ||
606 | i8k_hwmon_remove_files(i8k_hwmon_dev); | ||
607 | hwmon_device_unregister(i8k_hwmon_dev); | ||
608 | } | ||
609 | |||
458 | static struct dmi_system_id __initdata i8k_dmi_table[] = { | 610 | static struct dmi_system_id __initdata i8k_dmi_table[] = { |
459 | { | 611 | { |
460 | .ident = "Dell Inspiron", | 612 | .ident = "Dell Inspiron", |
@@ -580,6 +732,7 @@ static int __init i8k_probe(void) | |||
580 | static int __init i8k_init(void) | 732 | static int __init i8k_init(void) |
581 | { | 733 | { |
582 | struct proc_dir_entry *proc_i8k; | 734 | struct proc_dir_entry *proc_i8k; |
735 | int err; | ||
583 | 736 | ||
584 | /* Are we running on an supported laptop? */ | 737 | /* Are we running on an supported laptop? */ |
585 | if (i8k_probe()) | 738 | if (i8k_probe()) |
@@ -590,15 +743,24 @@ static int __init i8k_init(void) | |||
590 | if (!proc_i8k) | 743 | if (!proc_i8k) |
591 | return -ENOENT; | 744 | return -ENOENT; |
592 | 745 | ||
746 | err = i8k_init_hwmon(); | ||
747 | if (err) | ||
748 | goto exit_remove_proc; | ||
749 | |||
593 | printk(KERN_INFO | 750 | printk(KERN_INFO |
594 | "Dell laptop SMM driver v%s Massimo Dal Zotto (dz@debian.org)\n", | 751 | "Dell laptop SMM driver v%s Massimo Dal Zotto (dz@debian.org)\n", |
595 | I8K_VERSION); | 752 | I8K_VERSION); |
596 | 753 | ||
597 | return 0; | 754 | return 0; |
755 | |||
756 | exit_remove_proc: | ||
757 | remove_proc_entry("i8k", NULL); | ||
758 | return err; | ||
598 | } | 759 | } |
599 | 760 | ||
600 | static void __exit i8k_exit(void) | 761 | static void __exit i8k_exit(void) |
601 | { | 762 | { |
763 | i8k_exit_hwmon(); | ||
602 | remove_proc_entry("i8k", NULL); | 764 | remove_proc_entry("i8k", NULL); |
603 | } | 765 | } |
604 | 766 | ||
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index c7f1a6f16b6e..e2fc2d21fa61 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile | |||
@@ -39,3 +39,5 @@ obj-$(CONFIG_X86_CPUFREQ_NFORCE2) += cpufreq-nforce2.o | |||
39 | 39 | ||
40 | ##################################################################################d | 40 | ##################################################################################d |
41 | 41 | ||
42 | # ARM SoC drivers | ||
43 | obj-$(CONFIG_UX500_SOC_DB8500) += db8500-cpufreq.o | ||
diff --git a/drivers/cpufreq/db8500-cpufreq.c b/drivers/cpufreq/db8500-cpufreq.c new file mode 100644 index 000000000000..d90456a809f9 --- /dev/null +++ b/drivers/cpufreq/db8500-cpufreq.c | |||
@@ -0,0 +1,169 @@ | |||
1 | /* | ||
2 | * Copyright (C) STMicroelectronics 2009 | ||
3 | * Copyright (C) ST-Ericsson SA 2010 | ||
4 | * | ||
5 | * License Terms: GNU General Public License v2 | ||
6 | * Author: Sundar Iyer <sundar.iyer@stericsson.com> | ||
7 | * Author: Martin Persson <martin.persson@stericsson.com> | ||
8 | * Author: Jonas Aaberg <jonas.aberg@stericsson.com> | ||
9 | * | ||
10 | */ | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/cpufreq.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <linux/slab.h> | ||
15 | #include <linux/mfd/db8500-prcmu.h> | ||
16 | #include <mach/id.h> | ||
17 | |||
18 | static struct cpufreq_frequency_table freq_table[] = { | ||
19 | [0] = { | ||
20 | .index = 0, | ||
21 | .frequency = 300000, | ||
22 | }, | ||
23 | [1] = { | ||
24 | .index = 1, | ||
25 | .frequency = 600000, | ||
26 | }, | ||
27 | [2] = { | ||
28 | /* Used for MAX_OPP, if available */ | ||
29 | .index = 2, | ||
30 | .frequency = CPUFREQ_TABLE_END, | ||
31 | }, | ||
32 | [3] = { | ||
33 | .index = 3, | ||
34 | .frequency = CPUFREQ_TABLE_END, | ||
35 | }, | ||
36 | }; | ||
37 | |||
38 | static enum arm_opp idx2opp[] = { | ||
39 | ARM_50_OPP, | ||
40 | ARM_100_OPP, | ||
41 | ARM_MAX_OPP | ||
42 | }; | ||
43 | |||
44 | static struct freq_attr *db8500_cpufreq_attr[] = { | ||
45 | &cpufreq_freq_attr_scaling_available_freqs, | ||
46 | NULL, | ||
47 | }; | ||
48 | |||
49 | static int db8500_cpufreq_verify_speed(struct cpufreq_policy *policy) | ||
50 | { | ||
51 | return cpufreq_frequency_table_verify(policy, freq_table); | ||
52 | } | ||
53 | |||
54 | static int db8500_cpufreq_target(struct cpufreq_policy *policy, | ||
55 | unsigned int target_freq, | ||
56 | unsigned int relation) | ||
57 | { | ||
58 | struct cpufreq_freqs freqs; | ||
59 | unsigned int idx; | ||
60 | |||
61 | /* scale the target frequency to one of the extremes supported */ | ||
62 | if (target_freq < policy->cpuinfo.min_freq) | ||
63 | target_freq = policy->cpuinfo.min_freq; | ||
64 | if (target_freq > policy->cpuinfo.max_freq) | ||
65 | target_freq = policy->cpuinfo.max_freq; | ||
66 | |||
67 | /* Lookup the next frequency */ | ||
68 | if (cpufreq_frequency_table_target | ||
69 | (policy, freq_table, target_freq, relation, &idx)) { | ||
70 | return -EINVAL; | ||
71 | } | ||
72 | |||
73 | freqs.old = policy->cur; | ||
74 | freqs.new = freq_table[idx].frequency; | ||
75 | freqs.cpu = policy->cpu; | ||
76 | |||
77 | if (freqs.old == freqs.new) | ||
78 | return 0; | ||
79 | |||
80 | /* pre-change notification */ | ||
81 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
82 | |||
83 | /* request the PRCM unit for opp change */ | ||
84 | if (prcmu_set_arm_opp(idx2opp[idx])) { | ||
85 | pr_err("db8500-cpufreq: Failed to set OPP level\n"); | ||
86 | return -EINVAL; | ||
87 | } | ||
88 | |||
89 | /* post change notification */ | ||
90 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
91 | |||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static unsigned int db8500_cpufreq_getspeed(unsigned int cpu) | ||
96 | { | ||
97 | int i; | ||
98 | /* request the prcm to get the current ARM opp */ | ||
99 | for (i = 0; prcmu_get_arm_opp() != idx2opp[i]; i++) | ||
100 | ; | ||
101 | return freq_table[i].frequency; | ||
102 | } | ||
103 | |||
104 | static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) | ||
105 | { | ||
106 | int res; | ||
107 | int i; | ||
108 | |||
109 | BUILD_BUG_ON(ARRAY_SIZE(idx2opp) + 1 != ARRAY_SIZE(freq_table)); | ||
110 | |||
111 | if (cpu_is_u8500v2() && !prcmu_is_u8400()) { | ||
112 | freq_table[0].frequency = 400000; | ||
113 | freq_table[1].frequency = 800000; | ||
114 | if (prcmu_has_arm_maxopp()) | ||
115 | freq_table[2].frequency = 1000000; | ||
116 | } | ||
117 | |||
118 | /* get policy fields based on the table */ | ||
119 | res = cpufreq_frequency_table_cpuinfo(policy, freq_table); | ||
120 | if (!res) | ||
121 | cpufreq_frequency_table_get_attr(freq_table, policy->cpu); | ||
122 | else { | ||
123 | pr_err("db8500-cpufreq : Failed to read policy table\n"); | ||
124 | return res; | ||
125 | } | ||
126 | |||
127 | policy->min = policy->cpuinfo.min_freq; | ||
128 | policy->max = policy->cpuinfo.max_freq; | ||
129 | policy->cur = db8500_cpufreq_getspeed(policy->cpu); | ||
130 | |||
131 | for (i = 0; freq_table[i].frequency != policy->cur; i++) | ||
132 | ; | ||
133 | |||
134 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
135 | |||
136 | /* | ||
137 | * FIXME : Need to take time measurement across the target() | ||
138 | * function with no/some/all drivers in the notification | ||
139 | * list. | ||
140 | */ | ||
141 | policy->cpuinfo.transition_latency = 20 * 1000; /* in ns */ | ||
142 | |||
143 | /* policy sharing between dual CPUs */ | ||
144 | cpumask_copy(policy->cpus, &cpu_present_map); | ||
145 | |||
146 | policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | static struct cpufreq_driver db8500_cpufreq_driver = { | ||
152 | .flags = CPUFREQ_STICKY, | ||
153 | .verify = db8500_cpufreq_verify_speed, | ||
154 | .target = db8500_cpufreq_target, | ||
155 | .get = db8500_cpufreq_getspeed, | ||
156 | .init = db8500_cpufreq_init, | ||
157 | .name = "DB8500", | ||
158 | .attr = db8500_cpufreq_attr, | ||
159 | }; | ||
160 | |||
161 | static int __init db8500_cpufreq_register(void) | ||
162 | { | ||
163 | if (!cpu_is_u8500v20_or_later()) | ||
164 | return -ENODEV; | ||
165 | |||
166 | pr_info("cpufreq for DB8500 started\n"); | ||
167 | return cpufreq_register_driver(&db8500_cpufreq_driver); | ||
168 | } | ||
169 | device_initcall(db8500_cpufreq_register); | ||
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index dcc1b2139fff..636e40925b16 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -213,12 +213,17 @@ static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val) | |||
213 | struct sh_dmae_device, common); | 213 | struct sh_dmae_device, common); |
214 | struct sh_dmae_pdata *pdata = shdev->pdata; | 214 | struct sh_dmae_pdata *pdata = shdev->pdata; |
215 | const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id]; | 215 | const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id]; |
216 | u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16); | 216 | u16 __iomem *addr = shdev->dmars; |
217 | int shift = chan_pdata->dmars_bit; | 217 | int shift = chan_pdata->dmars_bit; |
218 | 218 | ||
219 | if (dmae_is_busy(sh_chan)) | 219 | if (dmae_is_busy(sh_chan)) |
220 | return -EBUSY; | 220 | return -EBUSY; |
221 | 221 | ||
222 | /* in the case of a missing DMARS resource use first memory window */ | ||
223 | if (!addr) | ||
224 | addr = (u16 __iomem *)shdev->chan_reg; | ||
225 | addr += chan_pdata->dmars / sizeof(u16); | ||
226 | |||
222 | __raw_writew((__raw_readw(addr) & (0xff00 >> shift)) | (val << shift), | 227 | __raw_writew((__raw_readw(addr) & (0xff00 >> shift)) | (val << shift), |
223 | addr); | 228 | addr); |
224 | 229 | ||
@@ -1078,7 +1083,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1078 | unsigned long irqflags = IRQF_DISABLED, | 1083 | unsigned long irqflags = IRQF_DISABLED, |
1079 | chan_flag[SH_DMAC_MAX_CHANNELS] = {}; | 1084 | chan_flag[SH_DMAC_MAX_CHANNELS] = {}; |
1080 | int errirq, chan_irq[SH_DMAC_MAX_CHANNELS]; | 1085 | int errirq, chan_irq[SH_DMAC_MAX_CHANNELS]; |
1081 | int err, i, irq_cnt = 0, irqres = 0; | 1086 | int err, i, irq_cnt = 0, irqres = 0, irq_cap = 0; |
1082 | struct sh_dmae_device *shdev; | 1087 | struct sh_dmae_device *shdev; |
1083 | struct resource *chan, *dmars, *errirq_res, *chanirq_res; | 1088 | struct resource *chan, *dmars, *errirq_res, *chanirq_res; |
1084 | 1089 | ||
@@ -1087,7 +1092,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1087 | return -ENODEV; | 1092 | return -ENODEV; |
1088 | 1093 | ||
1089 | chan = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1094 | chan = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1090 | /* DMARS area is optional, if absent, this controller cannot do slave DMA */ | 1095 | /* DMARS area is optional */ |
1091 | dmars = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1096 | dmars = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
1092 | /* | 1097 | /* |
1093 | * IRQ resources: | 1098 | * IRQ resources: |
@@ -1154,7 +1159,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1154 | INIT_LIST_HEAD(&shdev->common.channels); | 1159 | INIT_LIST_HEAD(&shdev->common.channels); |
1155 | 1160 | ||
1156 | dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask); | 1161 | dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask); |
1157 | if (dmars) | 1162 | if (pdata->slave && pdata->slave_num) |
1158 | dma_cap_set(DMA_SLAVE, shdev->common.cap_mask); | 1163 | dma_cap_set(DMA_SLAVE, shdev->common.cap_mask); |
1159 | 1164 | ||
1160 | shdev->common.device_alloc_chan_resources | 1165 | shdev->common.device_alloc_chan_resources |
@@ -1203,8 +1208,13 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1203 | !platform_get_resource(pdev, IORESOURCE_IRQ, 1)) { | 1208 | !platform_get_resource(pdev, IORESOURCE_IRQ, 1)) { |
1204 | /* Special case - all multiplexed */ | 1209 | /* Special case - all multiplexed */ |
1205 | for (; irq_cnt < pdata->channel_num; irq_cnt++) { | 1210 | for (; irq_cnt < pdata->channel_num; irq_cnt++) { |
1206 | chan_irq[irq_cnt] = chanirq_res->start; | 1211 | if (irq_cnt < SH_DMAC_MAX_CHANNELS) { |
1207 | chan_flag[irq_cnt] = IRQF_SHARED; | 1212 | chan_irq[irq_cnt] = chanirq_res->start; |
1213 | chan_flag[irq_cnt] = IRQF_SHARED; | ||
1214 | } else { | ||
1215 | irq_cap = 1; | ||
1216 | break; | ||
1217 | } | ||
1208 | } | 1218 | } |
1209 | } else { | 1219 | } else { |
1210 | do { | 1220 | do { |
@@ -1218,22 +1228,32 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1218 | "Found IRQ %d for channel %d\n", | 1228 | "Found IRQ %d for channel %d\n", |
1219 | i, irq_cnt); | 1229 | i, irq_cnt); |
1220 | chan_irq[irq_cnt++] = i; | 1230 | chan_irq[irq_cnt++] = i; |
1231 | |||
1232 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) | ||
1233 | break; | ||
1234 | } | ||
1235 | |||
1236 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) { | ||
1237 | irq_cap = 1; | ||
1238 | break; | ||
1221 | } | 1239 | } |
1222 | chanirq_res = platform_get_resource(pdev, | 1240 | chanirq_res = platform_get_resource(pdev, |
1223 | IORESOURCE_IRQ, ++irqres); | 1241 | IORESOURCE_IRQ, ++irqres); |
1224 | } while (irq_cnt < pdata->channel_num && chanirq_res); | 1242 | } while (irq_cnt < pdata->channel_num && chanirq_res); |
1225 | } | 1243 | } |
1226 | 1244 | ||
1227 | if (irq_cnt < pdata->channel_num) | ||
1228 | goto eirqres; | ||
1229 | |||
1230 | /* Create DMA Channel */ | 1245 | /* Create DMA Channel */ |
1231 | for (i = 0; i < pdata->channel_num; i++) { | 1246 | for (i = 0; i < irq_cnt; i++) { |
1232 | err = sh_dmae_chan_probe(shdev, i, chan_irq[i], chan_flag[i]); | 1247 | err = sh_dmae_chan_probe(shdev, i, chan_irq[i], chan_flag[i]); |
1233 | if (err) | 1248 | if (err) |
1234 | goto chan_probe_err; | 1249 | goto chan_probe_err; |
1235 | } | 1250 | } |
1236 | 1251 | ||
1252 | if (irq_cap) | ||
1253 | dev_notice(&pdev->dev, "Attempting to register %d DMA " | ||
1254 | "channels when a maximum of %d are supported.\n", | ||
1255 | pdata->channel_num, SH_DMAC_MAX_CHANNELS); | ||
1256 | |||
1237 | pm_runtime_put(&pdev->dev); | 1257 | pm_runtime_put(&pdev->dev); |
1238 | 1258 | ||
1239 | platform_set_drvdata(pdev, shdev); | 1259 | platform_set_drvdata(pdev, shdev); |
@@ -1243,7 +1263,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1243 | 1263 | ||
1244 | chan_probe_err: | 1264 | chan_probe_err: |
1245 | sh_dmae_chan_remove(shdev); | 1265 | sh_dmae_chan_remove(shdev); |
1246 | eirqres: | 1266 | |
1247 | #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) | 1267 | #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) |
1248 | free_irq(errirq, shdev); | 1268 | free_irq(errirq, shdev); |
1249 | eirq_err: | 1269 | eirq_err: |
diff --git a/drivers/dma/shdma.h b/drivers/dma/shdma.h index 3f9d3cd06584..5ae9fc512180 100644 --- a/drivers/dma/shdma.h +++ b/drivers/dma/shdma.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
19 | 19 | ||
20 | #define SH_DMAC_MAX_CHANNELS 6 | 20 | #define SH_DMAC_MAX_CHANNELS 20 |
21 | #define SH_DMA_SLAVE_NUMBER 256 | 21 | #define SH_DMA_SLAVE_NUMBER 256 |
22 | #define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */ | 22 | #define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */ |
23 | 23 | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 43221beb9e97..16db83c83c8b 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -41,7 +41,7 @@ comment "Native drivers" | |||
41 | 41 | ||
42 | config SENSORS_ABITUGURU | 42 | config SENSORS_ABITUGURU |
43 | tristate "Abit uGuru (rev 1 & 2)" | 43 | tristate "Abit uGuru (rev 1 & 2)" |
44 | depends on X86 && EXPERIMENTAL | 44 | depends on X86 && DMI && EXPERIMENTAL |
45 | help | 45 | help |
46 | If you say yes here you get support for the sensor part of the first | 46 | If you say yes here you get support for the sensor part of the first |
47 | and second revision of the Abit uGuru chip. The voltage and frequency | 47 | and second revision of the Abit uGuru chip. The voltage and frequency |
@@ -56,7 +56,7 @@ config SENSORS_ABITUGURU | |||
56 | 56 | ||
57 | config SENSORS_ABITUGURU3 | 57 | config SENSORS_ABITUGURU3 |
58 | tristate "Abit uGuru (rev 3)" | 58 | tristate "Abit uGuru (rev 3)" |
59 | depends on X86 && EXPERIMENTAL | 59 | depends on X86 && DMI && EXPERIMENTAL |
60 | help | 60 | help |
61 | If you say yes here you get support for the sensor part of the | 61 | If you say yes here you get support for the sensor part of the |
62 | third revision of the Abit uGuru chip. Only reading the sensors | 62 | third revision of the Abit uGuru chip. Only reading the sensors |
@@ -213,7 +213,7 @@ config SENSORS_ADT7475 | |||
213 | 213 | ||
214 | config SENSORS_ASC7621 | 214 | config SENSORS_ASC7621 |
215 | tristate "Andigilog aSC7621" | 215 | tristate "Andigilog aSC7621" |
216 | depends on HWMON && I2C | 216 | depends on I2C |
217 | help | 217 | help |
218 | If you say yes here you get support for the aSC7621 | 218 | If you say yes here you get support for the aSC7621 |
219 | family of SMBus sensors chip found on most Intel X38, X48, X58, | 219 | family of SMBus sensors chip found on most Intel X38, X48, X58, |
@@ -237,17 +237,27 @@ config SENSORS_K8TEMP | |||
237 | will be called k8temp. | 237 | will be called k8temp. |
238 | 238 | ||
239 | config SENSORS_K10TEMP | 239 | config SENSORS_K10TEMP |
240 | tristate "AMD Family 10h/11h/12h/14h temperature sensor" | 240 | tristate "AMD Family 10h+ temperature sensor" |
241 | depends on X86 && PCI | 241 | depends on X86 && PCI |
242 | help | 242 | help |
243 | If you say yes here you get support for the temperature | 243 | If you say yes here you get support for the temperature |
244 | sensor(s) inside your CPU. Supported are later revisions of | 244 | sensor(s) inside your CPU. Supported are later revisions of |
245 | the AMD Family 10h and all revisions of the AMD Family 11h, | 245 | the AMD Family 10h and all revisions of the AMD Family 11h, |
246 | 12h (Llano), and 14h (Brazos) microarchitectures. | 246 | 12h (Llano), 14h (Brazos) and 15h (Bulldozer) microarchitectures. |
247 | 247 | ||
248 | This driver can also be built as a module. If so, the module | 248 | This driver can also be built as a module. If so, the module |
249 | will be called k10temp. | 249 | will be called k10temp. |
250 | 250 | ||
251 | config SENSORS_FAM15H_POWER | ||
252 | tristate "AMD Family 15h processor power" | ||
253 | depends on X86 && PCI | ||
254 | help | ||
255 | If you say yes here you get support for processor power | ||
256 | information of your AMD family 15h CPU. | ||
257 | |||
258 | This driver can also be built as a module. If so, the module | ||
259 | will be called fam15h_power. | ||
260 | |||
251 | config SENSORS_ASB100 | 261 | config SENSORS_ASB100 |
252 | tristate "Asus ASB100 Bach" | 262 | tristate "Asus ASB100 Bach" |
253 | depends on X86 && I2C && EXPERIMENTAL | 263 | depends on X86 && I2C && EXPERIMENTAL |
@@ -319,7 +329,7 @@ config SENSORS_F71882FG | |||
319 | If you say yes here you get support for hardware monitoring | 329 | If you say yes here you get support for hardware monitoring |
320 | features of many Fintek Super-I/O (LPC) chips. The currently | 330 | features of many Fintek Super-I/O (LPC) chips. The currently |
321 | supported chips are: | 331 | supported chips are: |
322 | F71808E | 332 | F71808E/A |
323 | F71858FG | 333 | F71858FG |
324 | F71862FG | 334 | F71862FG |
325 | F71863FG | 335 | F71863FG |
@@ -978,6 +988,16 @@ config SENSORS_EMC2103 | |||
978 | This driver can also be built as a module. If so, the module | 988 | This driver can also be built as a module. If so, the module |
979 | will be called emc2103. | 989 | will be called emc2103. |
980 | 990 | ||
991 | config SENSORS_EMC6W201 | ||
992 | tristate "SMSC EMC6W201" | ||
993 | depends on I2C | ||
994 | help | ||
995 | If you say yes here you get support for the SMSC EMC6W201 | ||
996 | hardware monitoring chip. | ||
997 | |||
998 | This driver can also be built as a module. If so, the module | ||
999 | will be called emc6w201. | ||
1000 | |||
981 | config SENSORS_SMSC47M1 | 1001 | config SENSORS_SMSC47M1 |
982 | tristate "SMSC LPC47M10x and compatibles" | 1002 | tristate "SMSC LPC47M10x and compatibles" |
983 | help | 1003 | help |
@@ -1341,6 +1361,16 @@ if ACPI | |||
1341 | 1361 | ||
1342 | comment "ACPI drivers" | 1362 | comment "ACPI drivers" |
1343 | 1363 | ||
1364 | config SENSORS_ACPI_POWER | ||
1365 | tristate "ACPI 4.0 power meter" | ||
1366 | help | ||
1367 | This driver exposes ACPI 4.0 power meters as hardware monitoring | ||
1368 | devices. Say Y (or M) if you have a computer with ACPI 4.0 firmware | ||
1369 | and a power meter. | ||
1370 | |||
1371 | To compile this driver as a module, choose M here: | ||
1372 | the module will be called acpi_power_meter. | ||
1373 | |||
1344 | config SENSORS_ATK0110 | 1374 | config SENSORS_ATK0110 |
1345 | tristate "ASUS ATK0110" | 1375 | tristate "ASUS ATK0110" |
1346 | depends on X86 && EXPERIMENTAL | 1376 | depends on X86 && EXPERIMENTAL |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 28e8d52f6379..28061cfa0cdb 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -6,6 +6,7 @@ obj-$(CONFIG_HWMON) += hwmon.o | |||
6 | obj-$(CONFIG_HWMON_VID) += hwmon-vid.o | 6 | obj-$(CONFIG_HWMON_VID) += hwmon-vid.o |
7 | 7 | ||
8 | # APCI drivers | 8 | # APCI drivers |
9 | obj-$(CONFIG_SENSORS_ACPI_POWER) += acpi_power_meter.o | ||
9 | obj-$(CONFIG_SENSORS_ATK0110) += asus_atk0110.o | 10 | obj-$(CONFIG_SENSORS_ATK0110) += asus_atk0110.o |
10 | 11 | ||
11 | # Native drivers | 12 | # Native drivers |
@@ -45,9 +46,11 @@ obj-$(CONFIG_SENSORS_DS620) += ds620.o | |||
45 | obj-$(CONFIG_SENSORS_DS1621) += ds1621.o | 46 | obj-$(CONFIG_SENSORS_DS1621) += ds1621.o |
46 | obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o | 47 | obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o |
47 | obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o | 48 | obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o |
49 | obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o | ||
48 | obj-$(CONFIG_SENSORS_F71805F) += f71805f.o | 50 | obj-$(CONFIG_SENSORS_F71805F) += f71805f.o |
49 | obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o | 51 | obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o |
50 | obj-$(CONFIG_SENSORS_F75375S) += f75375s.o | 52 | obj-$(CONFIG_SENSORS_F75375S) += f75375s.o |
53 | obj-$(CONFIG_SENSORS_FAM15H_POWER) += fam15h_power.o | ||
51 | obj-$(CONFIG_SENSORS_FSCHMD) += fschmd.o | 54 | obj-$(CONFIG_SENSORS_FSCHMD) += fschmd.o |
52 | obj-$(CONFIG_SENSORS_G760A) += g760a.o | 55 | obj-$(CONFIG_SENSORS_G760A) += g760a.o |
53 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o | 56 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o |
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index e7d4c4687f02..65a35cf5b3c5 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c | |||
@@ -1448,15 +1448,12 @@ static int __init abituguru_init(void) | |||
1448 | { | 1448 | { |
1449 | int address, err; | 1449 | int address, err; |
1450 | struct resource res = { .flags = IORESOURCE_IO }; | 1450 | struct resource res = { .flags = IORESOURCE_IO }; |
1451 | |||
1452 | #ifdef CONFIG_DMI | ||
1453 | const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | 1451 | const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); |
1454 | 1452 | ||
1455 | /* safety check, refuse to load on non Abit motherboards */ | 1453 | /* safety check, refuse to load on non Abit motherboards */ |
1456 | if (!force && (!board_vendor || | 1454 | if (!force && (!board_vendor || |
1457 | strcmp(board_vendor, "http://www.abit.com.tw/"))) | 1455 | strcmp(board_vendor, "http://www.abit.com.tw/"))) |
1458 | return -ENODEV; | 1456 | return -ENODEV; |
1459 | #endif | ||
1460 | 1457 | ||
1461 | address = abituguru_detect(); | 1458 | address = abituguru_detect(); |
1462 | if (address < 0) | 1459 | if (address < 0) |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index e89d572e3320..d30855a75786 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -1119,8 +1119,6 @@ static struct platform_driver abituguru3_driver = { | |||
1119 | .resume = abituguru3_resume | 1119 | .resume = abituguru3_resume |
1120 | }; | 1120 | }; |
1121 | 1121 | ||
1122 | #ifdef CONFIG_DMI | ||
1123 | |||
1124 | static int __init abituguru3_dmi_detect(void) | 1122 | static int __init abituguru3_dmi_detect(void) |
1125 | { | 1123 | { |
1126 | const char *board_vendor, *board_name; | 1124 | const char *board_vendor, *board_name; |
@@ -1159,15 +1157,6 @@ static int __init abituguru3_dmi_detect(void) | |||
1159 | return 1; | 1157 | return 1; |
1160 | } | 1158 | } |
1161 | 1159 | ||
1162 | #else /* !CONFIG_DMI */ | ||
1163 | |||
1164 | static inline int abituguru3_dmi_detect(void) | ||
1165 | { | ||
1166 | return 1; | ||
1167 | } | ||
1168 | |||
1169 | #endif /* CONFIG_DMI */ | ||
1170 | |||
1171 | /* FIXME: Manual detection should die eventually; we need to collect stable | 1160 | /* FIXME: Manual detection should die eventually; we need to collect stable |
1172 | * DMI model names first before we can rely entirely on CONFIG_DMI. | 1161 | * DMI model names first before we can rely entirely on CONFIG_DMI. |
1173 | */ | 1162 | */ |
@@ -1216,10 +1205,8 @@ static int __init abituguru3_init(void) | |||
1216 | if (err) | 1205 | if (err) |
1217 | return err; | 1206 | return err; |
1218 | 1207 | ||
1219 | #ifdef CONFIG_DMI | ||
1220 | pr_warn("this motherboard was not detected using DMI. " | 1208 | pr_warn("this motherboard was not detected using DMI. " |
1221 | "Please send the output of \"dmidecode\" to the abituguru3 maintainer (see MAINTAINERS)\n"); | 1209 | "Please send the output of \"dmidecode\" to the abituguru3 maintainer (see MAINTAINERS)\n"); |
1222 | #endif | ||
1223 | } | 1210 | } |
1224 | 1211 | ||
1225 | err = platform_driver_register(&abituguru3_driver); | 1212 | err = platform_driver_register(&abituguru3_driver); |
diff --git a/drivers/acpi/power_meter.c b/drivers/hwmon/acpi_power_meter.c index 66f67293341e..66f67293341e 100644 --- a/drivers/acpi/power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c | |||
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c index fbdc7655303b..b2cacbe707a8 100644 --- a/drivers/hwmon/adcxx.c +++ b/drivers/hwmon/adcxx.c | |||
@@ -62,7 +62,7 @@ static ssize_t adcxx_read(struct device *dev, | |||
62 | { | 62 | { |
63 | struct spi_device *spi = to_spi_device(dev); | 63 | struct spi_device *spi = to_spi_device(dev); |
64 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 64 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
65 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | 65 | struct adcxx *adc = spi_get_drvdata(spi); |
66 | u8 tx_buf[2]; | 66 | u8 tx_buf[2]; |
67 | u8 rx_buf[2]; | 67 | u8 rx_buf[2]; |
68 | int status; | 68 | int status; |
@@ -105,7 +105,7 @@ static ssize_t adcxx_show_max(struct device *dev, | |||
105 | struct device_attribute *devattr, char *buf) | 105 | struct device_attribute *devattr, char *buf) |
106 | { | 106 | { |
107 | struct spi_device *spi = to_spi_device(dev); | 107 | struct spi_device *spi = to_spi_device(dev); |
108 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | 108 | struct adcxx *adc = spi_get_drvdata(spi); |
109 | u32 reference; | 109 | u32 reference; |
110 | 110 | ||
111 | if (mutex_lock_interruptible(&adc->lock)) | 111 | if (mutex_lock_interruptible(&adc->lock)) |
@@ -122,7 +122,7 @@ static ssize_t adcxx_set_max(struct device *dev, | |||
122 | struct device_attribute *devattr, const char *buf, size_t count) | 122 | struct device_attribute *devattr, const char *buf, size_t count) |
123 | { | 123 | { |
124 | struct spi_device *spi = to_spi_device(dev); | 124 | struct spi_device *spi = to_spi_device(dev); |
125 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | 125 | struct adcxx *adc = spi_get_drvdata(spi); |
126 | unsigned long value; | 126 | unsigned long value; |
127 | 127 | ||
128 | if (strict_strtoul(buf, 10, &value)) | 128 | if (strict_strtoul(buf, 10, &value)) |
@@ -142,7 +142,7 @@ static ssize_t adcxx_show_name(struct device *dev, struct device_attribute | |||
142 | *devattr, char *buf) | 142 | *devattr, char *buf) |
143 | { | 143 | { |
144 | struct spi_device *spi = to_spi_device(dev); | 144 | struct spi_device *spi = to_spi_device(dev); |
145 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | 145 | struct adcxx *adc = spi_get_drvdata(spi); |
146 | 146 | ||
147 | return sprintf(buf, "adcxx%ds\n", adc->channels); | 147 | return sprintf(buf, "adcxx%ds\n", adc->channels); |
148 | } | 148 | } |
@@ -182,7 +182,7 @@ static int __devinit adcxx_probe(struct spi_device *spi) | |||
182 | 182 | ||
183 | mutex_lock(&adc->lock); | 183 | mutex_lock(&adc->lock); |
184 | 184 | ||
185 | dev_set_drvdata(&spi->dev, adc); | 185 | spi_set_drvdata(spi, adc); |
186 | 186 | ||
187 | for (i = 0; i < 3 + adc->channels; i++) { | 187 | for (i = 0; i < 3 + adc->channels; i++) { |
188 | status = device_create_file(&spi->dev, &ad_input[i].dev_attr); | 188 | status = device_create_file(&spi->dev, &ad_input[i].dev_attr); |
@@ -206,7 +206,7 @@ out_err: | |||
206 | for (i--; i >= 0; i--) | 206 | for (i--; i >= 0; i--) |
207 | device_remove_file(&spi->dev, &ad_input[i].dev_attr); | 207 | device_remove_file(&spi->dev, &ad_input[i].dev_attr); |
208 | 208 | ||
209 | dev_set_drvdata(&spi->dev, NULL); | 209 | spi_set_drvdata(spi, NULL); |
210 | mutex_unlock(&adc->lock); | 210 | mutex_unlock(&adc->lock); |
211 | kfree(adc); | 211 | kfree(adc); |
212 | return status; | 212 | return status; |
@@ -214,7 +214,7 @@ out_err: | |||
214 | 214 | ||
215 | static int __devexit adcxx_remove(struct spi_device *spi) | 215 | static int __devexit adcxx_remove(struct spi_device *spi) |
216 | { | 216 | { |
217 | struct adcxx *adc = dev_get_drvdata(&spi->dev); | 217 | struct adcxx *adc = spi_get_drvdata(spi); |
218 | int i; | 218 | int i; |
219 | 219 | ||
220 | mutex_lock(&adc->lock); | 220 | mutex_lock(&adc->lock); |
@@ -222,7 +222,7 @@ static int __devexit adcxx_remove(struct spi_device *spi) | |||
222 | for (i = 0; i < 3 + adc->channels; i++) | 222 | for (i = 0; i < 3 + adc->channels; i++) |
223 | device_remove_file(&spi->dev, &ad_input[i].dev_attr); | 223 | device_remove_file(&spi->dev, &ad_input[i].dev_attr); |
224 | 224 | ||
225 | dev_set_drvdata(&spi->dev, NULL); | 225 | spi_set_drvdata(spi, NULL); |
226 | mutex_unlock(&adc->lock); | 226 | mutex_unlock(&adc->lock); |
227 | kfree(adc); | 227 | kfree(adc); |
228 | 228 | ||
diff --git a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c new file mode 100644 index 000000000000..e0ef32378ac6 --- /dev/null +++ b/drivers/hwmon/emc6w201.c | |||
@@ -0,0 +1,539 @@ | |||
1 | /* | ||
2 | * emc6w201.c - Hardware monitoring driver for the SMSC EMC6W201 | ||
3 | * Copyright (C) 2011 Jean Delvare <khali@linux-fr.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 as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/jiffies.h> | ||
25 | #include <linux/i2c.h> | ||
26 | #include <linux/hwmon.h> | ||
27 | #include <linux/hwmon-sysfs.h> | ||
28 | #include <linux/err.h> | ||
29 | #include <linux/mutex.h> | ||
30 | |||
31 | /* | ||
32 | * Addresses to scan | ||
33 | */ | ||
34 | |||
35 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | ||
36 | |||
37 | /* | ||
38 | * The EMC6W201 registers | ||
39 | */ | ||
40 | |||
41 | #define EMC6W201_REG_IN(nr) (0x20 + (nr)) | ||
42 | #define EMC6W201_REG_TEMP(nr) (0x26 + (nr)) | ||
43 | #define EMC6W201_REG_FAN(nr) (0x2C + (nr) * 2) | ||
44 | #define EMC6W201_REG_COMPANY 0x3E | ||
45 | #define EMC6W201_REG_VERSTEP 0x3F | ||
46 | #define EMC6W201_REG_CONFIG 0x40 | ||
47 | #define EMC6W201_REG_IN_LOW(nr) (0x4A + (nr) * 2) | ||
48 | #define EMC6W201_REG_IN_HIGH(nr) (0x4B + (nr) * 2) | ||
49 | #define EMC6W201_REG_TEMP_LOW(nr) (0x56 + (nr) * 2) | ||
50 | #define EMC6W201_REG_TEMP_HIGH(nr) (0x57 + (nr) * 2) | ||
51 | #define EMC6W201_REG_FAN_MIN(nr) (0x62 + (nr) * 2) | ||
52 | |||
53 | enum { input, min, max } subfeature; | ||
54 | |||
55 | /* | ||
56 | * Per-device data | ||
57 | */ | ||
58 | |||
59 | struct emc6w201_data { | ||
60 | struct device *hwmon_dev; | ||
61 | struct mutex update_lock; | ||
62 | char valid; /* zero until following fields are valid */ | ||
63 | unsigned long last_updated; /* in jiffies */ | ||
64 | |||
65 | /* registers values */ | ||
66 | u8 in[3][6]; | ||
67 | s8 temp[3][6]; | ||
68 | u16 fan[2][5]; | ||
69 | }; | ||
70 | |||
71 | /* | ||
72 | * Combine LSB and MSB registers in a single value | ||
73 | * Locking: must be called with data->update_lock held | ||
74 | */ | ||
75 | static u16 emc6w201_read16(struct i2c_client *client, u8 reg) | ||
76 | { | ||
77 | int lsb, msb; | ||
78 | |||
79 | lsb = i2c_smbus_read_byte_data(client, reg); | ||
80 | msb = i2c_smbus_read_byte_data(client, reg + 1); | ||
81 | if (lsb < 0 || msb < 0) { | ||
82 | dev_err(&client->dev, "16-bit read failed at 0x%02x\n", reg); | ||
83 | return 0xFFFF; /* Arbitrary value */ | ||
84 | } | ||
85 | |||
86 | return (msb << 8) | lsb; | ||
87 | } | ||
88 | |||
89 | /* | ||
90 | * Write 16-bit value to LSB and MSB registers | ||
91 | * Locking: must be called with data->update_lock held | ||
92 | */ | ||
93 | static int emc6w201_write16(struct i2c_client *client, u8 reg, u16 val) | ||
94 | { | ||
95 | int err; | ||
96 | |||
97 | err = i2c_smbus_write_byte_data(client, reg, val & 0xff); | ||
98 | if (!err) | ||
99 | err = i2c_smbus_write_byte_data(client, reg + 1, val >> 8); | ||
100 | if (err < 0) | ||
101 | dev_err(&client->dev, "16-bit write failed at 0x%02x\n", reg); | ||
102 | |||
103 | return err; | ||
104 | } | ||
105 | |||
106 | static struct emc6w201_data *emc6w201_update_device(struct device *dev) | ||
107 | { | ||
108 | struct i2c_client *client = to_i2c_client(dev); | ||
109 | struct emc6w201_data *data = i2c_get_clientdata(client); | ||
110 | int nr; | ||
111 | |||
112 | mutex_lock(&data->update_lock); | ||
113 | |||
114 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { | ||
115 | for (nr = 0; nr < 6; nr++) { | ||
116 | data->in[input][nr] = | ||
117 | i2c_smbus_read_byte_data(client, | ||
118 | EMC6W201_REG_IN(nr)); | ||
119 | data->in[min][nr] = | ||
120 | i2c_smbus_read_byte_data(client, | ||
121 | EMC6W201_REG_IN_LOW(nr)); | ||
122 | data->in[max][nr] = | ||
123 | i2c_smbus_read_byte_data(client, | ||
124 | EMC6W201_REG_IN_HIGH(nr)); | ||
125 | } | ||
126 | |||
127 | for (nr = 0; nr < 6; nr++) { | ||
128 | data->temp[input][nr] = | ||
129 | i2c_smbus_read_byte_data(client, | ||
130 | EMC6W201_REG_TEMP(nr)); | ||
131 | data->temp[min][nr] = | ||
132 | i2c_smbus_read_byte_data(client, | ||
133 | EMC6W201_REG_TEMP_LOW(nr)); | ||
134 | data->temp[max][nr] = | ||
135 | i2c_smbus_read_byte_data(client, | ||
136 | EMC6W201_REG_TEMP_HIGH(nr)); | ||
137 | } | ||
138 | |||
139 | for (nr = 0; nr < 5; nr++) { | ||
140 | data->fan[input][nr] = | ||
141 | emc6w201_read16(client, | ||
142 | EMC6W201_REG_FAN(nr)); | ||
143 | data->fan[min][nr] = | ||
144 | emc6w201_read16(client, | ||
145 | EMC6W201_REG_FAN_MIN(nr)); | ||
146 | } | ||
147 | |||
148 | data->last_updated = jiffies; | ||
149 | data->valid = 1; | ||
150 | } | ||
151 | |||
152 | mutex_unlock(&data->update_lock); | ||
153 | |||
154 | return data; | ||
155 | } | ||
156 | |||
157 | /* | ||
158 | * Sysfs callback functions | ||
159 | */ | ||
160 | |||
161 | static const u16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 }; | ||
162 | |||
163 | static ssize_t show_in(struct device *dev, struct device_attribute *devattr, | ||
164 | char *buf) | ||
165 | { | ||
166 | struct emc6w201_data *data = emc6w201_update_device(dev); | ||
167 | int sf = to_sensor_dev_attr_2(devattr)->index; | ||
168 | int nr = to_sensor_dev_attr_2(devattr)->nr; | ||
169 | |||
170 | return sprintf(buf, "%u\n", | ||
171 | (unsigned)data->in[sf][nr] * nominal_mv[nr] / 0xC0); | ||
172 | } | ||
173 | |||
174 | static ssize_t set_in(struct device *dev, struct device_attribute *devattr, | ||
175 | const char *buf, size_t count) | ||
176 | { | ||
177 | struct i2c_client *client = to_i2c_client(dev); | ||
178 | struct emc6w201_data *data = i2c_get_clientdata(client); | ||
179 | int sf = to_sensor_dev_attr_2(devattr)->index; | ||
180 | int nr = to_sensor_dev_attr_2(devattr)->nr; | ||
181 | int err; | ||
182 | long val; | ||
183 | u8 reg; | ||
184 | |||
185 | err = strict_strtol(buf, 10, &val); | ||
186 | if (err < 0) | ||
187 | return err; | ||
188 | |||
189 | val = DIV_ROUND_CLOSEST(val * 0xC0, nominal_mv[nr]); | ||
190 | reg = (sf == min) ? EMC6W201_REG_IN_LOW(nr) | ||
191 | : EMC6W201_REG_IN_HIGH(nr); | ||
192 | |||
193 | mutex_lock(&data->update_lock); | ||
194 | data->in[sf][nr] = SENSORS_LIMIT(val, 0, 255); | ||
195 | err = i2c_smbus_write_byte_data(client, reg, data->in[sf][nr]); | ||
196 | mutex_unlock(&data->update_lock); | ||
197 | |||
198 | return err < 0 ? err : count; | ||
199 | } | ||
200 | |||
201 | static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, | ||
202 | char *buf) | ||
203 | { | ||
204 | struct emc6w201_data *data = emc6w201_update_device(dev); | ||
205 | int sf = to_sensor_dev_attr_2(devattr)->index; | ||
206 | int nr = to_sensor_dev_attr_2(devattr)->nr; | ||
207 | |||
208 | return sprintf(buf, "%d\n", (int)data->temp[sf][nr] * 1000); | ||
209 | } | ||
210 | |||
211 | static ssize_t set_temp(struct device *dev, struct device_attribute *devattr, | ||
212 | const char *buf, size_t count) | ||
213 | { | ||
214 | struct i2c_client *client = to_i2c_client(dev); | ||
215 | struct emc6w201_data *data = i2c_get_clientdata(client); | ||
216 | int sf = to_sensor_dev_attr_2(devattr)->index; | ||
217 | int nr = to_sensor_dev_attr_2(devattr)->nr; | ||
218 | int err; | ||
219 | long val; | ||
220 | u8 reg; | ||
221 | |||
222 | err = strict_strtol(buf, 10, &val); | ||
223 | if (err < 0) | ||
224 | return err; | ||
225 | |||
226 | val /= 1000; | ||
227 | reg = (sf == min) ? EMC6W201_REG_TEMP_LOW(nr) | ||
228 | : EMC6W201_REG_TEMP_HIGH(nr); | ||
229 | |||
230 | mutex_lock(&data->update_lock); | ||
231 | data->temp[sf][nr] = SENSORS_LIMIT(val, -127, 128); | ||
232 | err = i2c_smbus_write_byte_data(client, reg, data->temp[sf][nr]); | ||
233 | mutex_unlock(&data->update_lock); | ||
234 | |||
235 | return err < 0 ? err : count; | ||
236 | } | ||
237 | |||
238 | static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, | ||
239 | char *buf) | ||
240 | { | ||
241 | struct emc6w201_data *data = emc6w201_update_device(dev); | ||
242 | int sf = to_sensor_dev_attr_2(devattr)->index; | ||
243 | int nr = to_sensor_dev_attr_2(devattr)->nr; | ||
244 | unsigned rpm; | ||
245 | |||
246 | if (data->fan[sf][nr] == 0 || data->fan[sf][nr] == 0xFFFF) | ||
247 | rpm = 0; | ||
248 | else | ||
249 | rpm = 5400000U / data->fan[sf][nr]; | ||
250 | |||
251 | return sprintf(buf, "%u\n", rpm); | ||
252 | } | ||
253 | |||
254 | static ssize_t set_fan(struct device *dev, struct device_attribute *devattr, | ||
255 | const char *buf, size_t count) | ||
256 | { | ||
257 | struct i2c_client *client = to_i2c_client(dev); | ||
258 | struct emc6w201_data *data = i2c_get_clientdata(client); | ||
259 | int sf = to_sensor_dev_attr_2(devattr)->index; | ||
260 | int nr = to_sensor_dev_attr_2(devattr)->nr; | ||
261 | int err; | ||
262 | unsigned long val; | ||
263 | |||
264 | err = strict_strtoul(buf, 10, &val); | ||
265 | if (err < 0) | ||
266 | return err; | ||
267 | |||
268 | if (val == 0) { | ||
269 | val = 0xFFFF; | ||
270 | } else { | ||
271 | val = DIV_ROUND_CLOSEST(5400000U, val); | ||
272 | val = SENSORS_LIMIT(val, 0, 0xFFFE); | ||
273 | } | ||
274 | |||
275 | mutex_lock(&data->update_lock); | ||
276 | data->fan[sf][nr] = val; | ||
277 | err = emc6w201_write16(client, EMC6W201_REG_FAN_MIN(nr), | ||
278 | data->fan[sf][nr]); | ||
279 | mutex_unlock(&data->update_lock); | ||
280 | |||
281 | return err < 0 ? err : count; | ||
282 | } | ||
283 | |||
284 | static SENSOR_DEVICE_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, input); | ||
285 | static SENSOR_DEVICE_ATTR_2(in0_min, S_IRUGO | S_IWUSR, show_in, set_in, | ||
286 | 0, min); | ||
287 | static SENSOR_DEVICE_ATTR_2(in0_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
288 | 0, max); | ||
289 | static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 1, input); | ||
290 | static SENSOR_DEVICE_ATTR_2(in1_min, S_IRUGO | S_IWUSR, show_in, set_in, | ||
291 | 1, min); | ||
292 | static SENSOR_DEVICE_ATTR_2(in1_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
293 | 1, max); | ||
294 | static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 2, input); | ||
295 | static SENSOR_DEVICE_ATTR_2(in2_min, S_IRUGO | S_IWUSR, show_in, set_in, | ||
296 | 2, min); | ||
297 | static SENSOR_DEVICE_ATTR_2(in2_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
298 | 2, max); | ||
299 | static SENSOR_DEVICE_ATTR_2(in3_input, S_IRUGO, show_in, NULL, 3, input); | ||
300 | static SENSOR_DEVICE_ATTR_2(in3_min, S_IRUGO | S_IWUSR, show_in, set_in, | ||
301 | 3, min); | ||
302 | static SENSOR_DEVICE_ATTR_2(in3_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
303 | 3, max); | ||
304 | static SENSOR_DEVICE_ATTR_2(in4_input, S_IRUGO, show_in, NULL, 4, input); | ||
305 | static SENSOR_DEVICE_ATTR_2(in4_min, S_IRUGO | S_IWUSR, show_in, set_in, | ||
306 | 4, min); | ||
307 | static SENSOR_DEVICE_ATTR_2(in4_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
308 | 4, max); | ||
309 | static SENSOR_DEVICE_ATTR_2(in5_input, S_IRUGO, show_in, NULL, 5, input); | ||
310 | static SENSOR_DEVICE_ATTR_2(in5_min, S_IRUGO | S_IWUSR, show_in, set_in, | ||
311 | 5, min); | ||
312 | static SENSOR_DEVICE_ATTR_2(in5_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
313 | 5, max); | ||
314 | |||
315 | static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, input); | ||
316 | static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
317 | 0, min); | ||
318 | static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
319 | 0, max); | ||
320 | static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 1, input); | ||
321 | static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
322 | 1, min); | ||
323 | static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
324 | 1, max); | ||
325 | static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 2, input); | ||
326 | static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
327 | 2, min); | ||
328 | static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
329 | 2, max); | ||
330 | static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 3, input); | ||
331 | static SENSOR_DEVICE_ATTR_2(temp4_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
332 | 3, min); | ||
333 | static SENSOR_DEVICE_ATTR_2(temp4_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
334 | 3, max); | ||
335 | static SENSOR_DEVICE_ATTR_2(temp5_input, S_IRUGO, show_temp, NULL, 4, input); | ||
336 | static SENSOR_DEVICE_ATTR_2(temp5_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
337 | 4, min); | ||
338 | static SENSOR_DEVICE_ATTR_2(temp5_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
339 | 4, max); | ||
340 | static SENSOR_DEVICE_ATTR_2(temp6_input, S_IRUGO, show_temp, NULL, 5, input); | ||
341 | static SENSOR_DEVICE_ATTR_2(temp6_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
342 | 5, min); | ||
343 | static SENSOR_DEVICE_ATTR_2(temp6_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
344 | 5, max); | ||
345 | |||
346 | static SENSOR_DEVICE_ATTR_2(fan1_input, S_IRUGO, show_fan, NULL, 0, input); | ||
347 | static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_fan, set_fan, | ||
348 | 0, min); | ||
349 | static SENSOR_DEVICE_ATTR_2(fan2_input, S_IRUGO, show_fan, NULL, 1, input); | ||
350 | static SENSOR_DEVICE_ATTR_2(fan2_min, S_IRUGO | S_IWUSR, show_fan, set_fan, | ||
351 | 1, min); | ||
352 | static SENSOR_DEVICE_ATTR_2(fan3_input, S_IRUGO, show_fan, NULL, 2, input); | ||
353 | static SENSOR_DEVICE_ATTR_2(fan3_min, S_IRUGO | S_IWUSR, show_fan, set_fan, | ||
354 | 2, min); | ||
355 | static SENSOR_DEVICE_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 3, input); | ||
356 | static SENSOR_DEVICE_ATTR_2(fan4_min, S_IRUGO | S_IWUSR, show_fan, set_fan, | ||
357 | 3, min); | ||
358 | static SENSOR_DEVICE_ATTR_2(fan5_input, S_IRUGO, show_fan, NULL, 4, input); | ||
359 | static SENSOR_DEVICE_ATTR_2(fan5_min, S_IRUGO | S_IWUSR, show_fan, set_fan, | ||
360 | 4, min); | ||
361 | |||
362 | static struct attribute *emc6w201_attributes[] = { | ||
363 | &sensor_dev_attr_in0_input.dev_attr.attr, | ||
364 | &sensor_dev_attr_in0_min.dev_attr.attr, | ||
365 | &sensor_dev_attr_in0_max.dev_attr.attr, | ||
366 | &sensor_dev_attr_in1_input.dev_attr.attr, | ||
367 | &sensor_dev_attr_in1_min.dev_attr.attr, | ||
368 | &sensor_dev_attr_in1_max.dev_attr.attr, | ||
369 | &sensor_dev_attr_in2_input.dev_attr.attr, | ||
370 | &sensor_dev_attr_in2_min.dev_attr.attr, | ||
371 | &sensor_dev_attr_in2_max.dev_attr.attr, | ||
372 | &sensor_dev_attr_in3_input.dev_attr.attr, | ||
373 | &sensor_dev_attr_in3_min.dev_attr.attr, | ||
374 | &sensor_dev_attr_in3_max.dev_attr.attr, | ||
375 | &sensor_dev_attr_in4_input.dev_attr.attr, | ||
376 | &sensor_dev_attr_in4_min.dev_attr.attr, | ||
377 | &sensor_dev_attr_in4_max.dev_attr.attr, | ||
378 | &sensor_dev_attr_in5_input.dev_attr.attr, | ||
379 | &sensor_dev_attr_in5_min.dev_attr.attr, | ||
380 | &sensor_dev_attr_in5_max.dev_attr.attr, | ||
381 | |||
382 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
383 | &sensor_dev_attr_temp1_min.dev_attr.attr, | ||
384 | &sensor_dev_attr_temp1_max.dev_attr.attr, | ||
385 | &sensor_dev_attr_temp2_input.dev_attr.attr, | ||
386 | &sensor_dev_attr_temp2_min.dev_attr.attr, | ||
387 | &sensor_dev_attr_temp2_max.dev_attr.attr, | ||
388 | &sensor_dev_attr_temp3_input.dev_attr.attr, | ||
389 | &sensor_dev_attr_temp3_min.dev_attr.attr, | ||
390 | &sensor_dev_attr_temp3_max.dev_attr.attr, | ||
391 | &sensor_dev_attr_temp4_input.dev_attr.attr, | ||
392 | &sensor_dev_attr_temp4_min.dev_attr.attr, | ||
393 | &sensor_dev_attr_temp4_max.dev_attr.attr, | ||
394 | &sensor_dev_attr_temp5_input.dev_attr.attr, | ||
395 | &sensor_dev_attr_temp5_min.dev_attr.attr, | ||
396 | &sensor_dev_attr_temp5_max.dev_attr.attr, | ||
397 | &sensor_dev_attr_temp6_input.dev_attr.attr, | ||
398 | &sensor_dev_attr_temp6_min.dev_attr.attr, | ||
399 | &sensor_dev_attr_temp6_max.dev_attr.attr, | ||
400 | |||
401 | &sensor_dev_attr_fan1_input.dev_attr.attr, | ||
402 | &sensor_dev_attr_fan1_min.dev_attr.attr, | ||
403 | &sensor_dev_attr_fan2_input.dev_attr.attr, | ||
404 | &sensor_dev_attr_fan2_min.dev_attr.attr, | ||
405 | &sensor_dev_attr_fan3_input.dev_attr.attr, | ||
406 | &sensor_dev_attr_fan3_min.dev_attr.attr, | ||
407 | &sensor_dev_attr_fan4_input.dev_attr.attr, | ||
408 | &sensor_dev_attr_fan4_min.dev_attr.attr, | ||
409 | &sensor_dev_attr_fan5_input.dev_attr.attr, | ||
410 | &sensor_dev_attr_fan5_min.dev_attr.attr, | ||
411 | NULL | ||
412 | }; | ||
413 | |||
414 | static const struct attribute_group emc6w201_group = { | ||
415 | .attrs = emc6w201_attributes, | ||
416 | }; | ||
417 | |||
418 | /* | ||
419 | * Driver interface | ||
420 | */ | ||
421 | |||
422 | /* Return 0 if detection is successful, -ENODEV otherwise */ | ||
423 | static int emc6w201_detect(struct i2c_client *client, | ||
424 | struct i2c_board_info *info) | ||
425 | { | ||
426 | struct i2c_adapter *adapter = client->adapter; | ||
427 | int company, verstep, config; | ||
428 | |||
429 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | ||
430 | return -ENODEV; | ||
431 | |||
432 | /* Identification */ | ||
433 | company = i2c_smbus_read_byte_data(client, EMC6W201_REG_COMPANY); | ||
434 | if (company != 0x5C) | ||
435 | return -ENODEV; | ||
436 | verstep = i2c_smbus_read_byte_data(client, EMC6W201_REG_VERSTEP); | ||
437 | if (verstep < 0 || (verstep & 0xF0) != 0xB0) | ||
438 | return -ENODEV; | ||
439 | if ((verstep & 0x0F) > 2) { | ||
440 | dev_dbg(&client->dev, "Unknwown EMC6W201 stepping %d\n", | ||
441 | verstep & 0x0F); | ||
442 | return -ENODEV; | ||
443 | } | ||
444 | |||
445 | /* Check configuration */ | ||
446 | config = i2c_smbus_read_byte_data(client, EMC6W201_REG_CONFIG); | ||
447 | if ((config & 0xF4) != 0x04) | ||
448 | return -ENODEV; | ||
449 | if (!(config & 0x01)) { | ||
450 | dev_err(&client->dev, "Monitoring not enabled\n"); | ||
451 | return -ENODEV; | ||
452 | } | ||
453 | |||
454 | strlcpy(info->type, "emc6w201", I2C_NAME_SIZE); | ||
455 | |||
456 | return 0; | ||
457 | } | ||
458 | |||
459 | static int emc6w201_probe(struct i2c_client *client, | ||
460 | const struct i2c_device_id *id) | ||
461 | { | ||
462 | struct emc6w201_data *data; | ||
463 | int err; | ||
464 | |||
465 | data = kzalloc(sizeof(struct emc6w201_data), GFP_KERNEL); | ||
466 | if (!data) { | ||
467 | err = -ENOMEM; | ||
468 | goto exit; | ||
469 | } | ||
470 | |||
471 | i2c_set_clientdata(client, data); | ||
472 | mutex_init(&data->update_lock); | ||
473 | |||
474 | /* Create sysfs attribute */ | ||
475 | err = sysfs_create_group(&client->dev.kobj, &emc6w201_group); | ||
476 | if (err) | ||
477 | goto exit_free; | ||
478 | |||
479 | /* Expose as a hwmon device */ | ||
480 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
481 | if (IS_ERR(data->hwmon_dev)) { | ||
482 | err = PTR_ERR(data->hwmon_dev); | ||
483 | goto exit_remove; | ||
484 | } | ||
485 | |||
486 | return 0; | ||
487 | |||
488 | exit_remove: | ||
489 | sysfs_remove_group(&client->dev.kobj, &emc6w201_group); | ||
490 | exit_free: | ||
491 | kfree(data); | ||
492 | exit: | ||
493 | return err; | ||
494 | } | ||
495 | |||
496 | static int emc6w201_remove(struct i2c_client *client) | ||
497 | { | ||
498 | struct emc6w201_data *data = i2c_get_clientdata(client); | ||
499 | |||
500 | hwmon_device_unregister(data->hwmon_dev); | ||
501 | sysfs_remove_group(&client->dev.kobj, &emc6w201_group); | ||
502 | kfree(data); | ||
503 | |||
504 | return 0; | ||
505 | } | ||
506 | |||
507 | static const struct i2c_device_id emc6w201_id[] = { | ||
508 | { "emc6w201", 0 }, | ||
509 | { } | ||
510 | }; | ||
511 | MODULE_DEVICE_TABLE(i2c, emc6w201_id); | ||
512 | |||
513 | static struct i2c_driver emc6w201_driver = { | ||
514 | .class = I2C_CLASS_HWMON, | ||
515 | .driver = { | ||
516 | .name = "emc6w201", | ||
517 | }, | ||
518 | .probe = emc6w201_probe, | ||
519 | .remove = emc6w201_remove, | ||
520 | .id_table = emc6w201_id, | ||
521 | .detect = emc6w201_detect, | ||
522 | .address_list = normal_i2c, | ||
523 | }; | ||
524 | |||
525 | static int __init sensors_emc6w201_init(void) | ||
526 | { | ||
527 | return i2c_add_driver(&emc6w201_driver); | ||
528 | } | ||
529 | module_init(sensors_emc6w201_init); | ||
530 | |||
531 | static void __exit sensors_emc6w201_exit(void) | ||
532 | { | ||
533 | i2c_del_driver(&emc6w201_driver); | ||
534 | } | ||
535 | module_exit(sensors_emc6w201_exit); | ||
536 | |||
537 | MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>"); | ||
538 | MODULE_DESCRIPTION("SMSC EMC6W201 hardware monitoring driver"); | ||
539 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index ca07a32447c2..a4a94a096c90 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -48,6 +48,7 @@ | |||
48 | 48 | ||
49 | #define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ | 49 | #define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ |
50 | #define SIO_F71808E_ID 0x0901 /* Chipset ID */ | 50 | #define SIO_F71808E_ID 0x0901 /* Chipset ID */ |
51 | #define SIO_F71808A_ID 0x1001 /* Chipset ID */ | ||
51 | #define SIO_F71858_ID 0x0507 /* Chipset ID */ | 52 | #define SIO_F71858_ID 0x0507 /* Chipset ID */ |
52 | #define SIO_F71862_ID 0x0601 /* Chipset ID */ | 53 | #define SIO_F71862_ID 0x0601 /* Chipset ID */ |
53 | #define SIO_F71869_ID 0x0814 /* Chipset ID */ | 54 | #define SIO_F71869_ID 0x0814 /* Chipset ID */ |
@@ -107,11 +108,12 @@ static unsigned short force_id; | |||
107 | module_param(force_id, ushort, 0); | 108 | module_param(force_id, ushort, 0); |
108 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | 109 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
109 | 110 | ||
110 | enum chips { f71808e, f71858fg, f71862fg, f71869, f71882fg, f71889fg, | 111 | enum chips { f71808e, f71808a, f71858fg, f71862fg, f71869, f71882fg, f71889fg, |
111 | f71889ed, f71889a, f8000, f81865f }; | 112 | f71889ed, f71889a, f8000, f81865f }; |
112 | 113 | ||
113 | static const char *f71882fg_names[] = { | 114 | static const char *f71882fg_names[] = { |
114 | "f71808e", | 115 | "f71808e", |
116 | "f71808a", | ||
115 | "f71858fg", | 117 | "f71858fg", |
116 | "f71862fg", | 118 | "f71862fg", |
117 | "f71869", /* Both f71869f and f71869e, reg. compatible and same id */ | 119 | "f71869", /* Both f71869f and f71869e, reg. compatible and same id */ |
@@ -125,6 +127,7 @@ static const char *f71882fg_names[] = { | |||
125 | 127 | ||
126 | static const char f71882fg_has_in[][F71882FG_MAX_INS] = { | 128 | static const char f71882fg_has_in[][F71882FG_MAX_INS] = { |
127 | [f71808e] = { 1, 1, 1, 1, 1, 1, 0, 1, 1 }, | 129 | [f71808e] = { 1, 1, 1, 1, 1, 1, 0, 1, 1 }, |
130 | [f71808a] = { 1, 1, 1, 1, 0, 0, 0, 1, 1 }, | ||
128 | [f71858fg] = { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, | 131 | [f71858fg] = { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, |
129 | [f71862fg] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, | 132 | [f71862fg] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, |
130 | [f71869] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, | 133 | [f71869] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, |
@@ -138,6 +141,7 @@ static const char f71882fg_has_in[][F71882FG_MAX_INS] = { | |||
138 | 141 | ||
139 | static const char f71882fg_has_in1_alarm[] = { | 142 | static const char f71882fg_has_in1_alarm[] = { |
140 | [f71808e] = 0, | 143 | [f71808e] = 0, |
144 | [f71808a] = 0, | ||
141 | [f71858fg] = 0, | 145 | [f71858fg] = 0, |
142 | [f71862fg] = 0, | 146 | [f71862fg] = 0, |
143 | [f71869] = 0, | 147 | [f71869] = 0, |
@@ -149,8 +153,9 @@ static const char f71882fg_has_in1_alarm[] = { | |||
149 | [f81865f] = 1, | 153 | [f81865f] = 1, |
150 | }; | 154 | }; |
151 | 155 | ||
152 | static const char f71882fg_has_beep[] = { | 156 | static const char f71882fg_fan_has_beep[] = { |
153 | [f71808e] = 0, | 157 | [f71808e] = 0, |
158 | [f71808a] = 0, | ||
154 | [f71858fg] = 0, | 159 | [f71858fg] = 0, |
155 | [f71862fg] = 1, | 160 | [f71862fg] = 1, |
156 | [f71869] = 1, | 161 | [f71869] = 1, |
@@ -164,6 +169,7 @@ static const char f71882fg_has_beep[] = { | |||
164 | 169 | ||
165 | static const char f71882fg_nr_fans[] = { | 170 | static const char f71882fg_nr_fans[] = { |
166 | [f71808e] = 3, | 171 | [f71808e] = 3, |
172 | [f71808a] = 2, /* +1 fan which is monitor + simple pwm only */ | ||
167 | [f71858fg] = 3, | 173 | [f71858fg] = 3, |
168 | [f71862fg] = 3, | 174 | [f71862fg] = 3, |
169 | [f71869] = 3, | 175 | [f71869] = 3, |
@@ -171,12 +177,27 @@ static const char f71882fg_nr_fans[] = { | |||
171 | [f71889fg] = 3, | 177 | [f71889fg] = 3, |
172 | [f71889ed] = 3, | 178 | [f71889ed] = 3, |
173 | [f71889a] = 3, | 179 | [f71889a] = 3, |
174 | [f8000] = 3, | 180 | [f8000] = 3, /* +1 fan which is monitor only */ |
175 | [f81865f] = 2, | 181 | [f81865f] = 2, |
176 | }; | 182 | }; |
177 | 183 | ||
184 | static const char f71882fg_temp_has_beep[] = { | ||
185 | [f71808e] = 0, | ||
186 | [f71808a] = 1, | ||
187 | [f71858fg] = 0, | ||
188 | [f71862fg] = 1, | ||
189 | [f71869] = 1, | ||
190 | [f71882fg] = 1, | ||
191 | [f71889fg] = 1, | ||
192 | [f71889ed] = 1, | ||
193 | [f71889a] = 1, | ||
194 | [f8000] = 0, | ||
195 | [f81865f] = 1, | ||
196 | }; | ||
197 | |||
178 | static const char f71882fg_nr_temps[] = { | 198 | static const char f71882fg_nr_temps[] = { |
179 | [f71808e] = 2, | 199 | [f71808e] = 2, |
200 | [f71808a] = 2, | ||
180 | [f71858fg] = 3, | 201 | [f71858fg] = 3, |
181 | [f71862fg] = 3, | 202 | [f71862fg] = 3, |
182 | [f71869] = 3, | 203 | [f71869] = 3, |
@@ -301,6 +322,10 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, | |||
301 | char *buf); | 322 | char *buf); |
302 | static ssize_t store_pwm(struct device *dev, struct device_attribute *devattr, | 323 | static ssize_t store_pwm(struct device *dev, struct device_attribute *devattr, |
303 | const char *buf, size_t count); | 324 | const char *buf, size_t count); |
325 | static ssize_t show_simple_pwm(struct device *dev, | ||
326 | struct device_attribute *devattr, char *buf); | ||
327 | static ssize_t store_simple_pwm(struct device *dev, | ||
328 | struct device_attribute *devattr, const char *buf, size_t count); | ||
304 | static ssize_t show_pwm_enable(struct device *dev, | 329 | static ssize_t show_pwm_enable(struct device *dev, |
305 | struct device_attribute *devattr, char *buf); | 330 | struct device_attribute *devattr, char *buf); |
306 | static ssize_t store_pwm_enable(struct device *dev, | 331 | static ssize_t store_pwm_enable(struct device *dev, |
@@ -550,6 +575,14 @@ static struct sensor_device_attribute_2 fxxxx_fan_attr[4][6] = { { | |||
550 | show_pwm_interpolate, store_pwm_interpolate, 0, 3), | 575 | show_pwm_interpolate, store_pwm_interpolate, 0, 3), |
551 | } }; | 576 | } }; |
552 | 577 | ||
578 | /* Attr for the third fan of the f71808a, which only has manual pwm */ | ||
579 | static struct sensor_device_attribute_2 f71808a_fan3_attr[] = { | ||
580 | SENSOR_ATTR_2(fan3_input, S_IRUGO, show_fan, NULL, 0, 2), | ||
581 | SENSOR_ATTR_2(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 2), | ||
582 | SENSOR_ATTR_2(pwm3, S_IRUGO|S_IWUSR, | ||
583 | show_simple_pwm, store_simple_pwm, 0, 2), | ||
584 | }; | ||
585 | |||
553 | /* Attr for models which can beep on Fan alarm */ | 586 | /* Attr for models which can beep on Fan alarm */ |
554 | static struct sensor_device_attribute_2 fxxxx_fan_beep_attr[] = { | 587 | static struct sensor_device_attribute_2 fxxxx_fan_beep_attr[] = { |
555 | SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep, | 588 | SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep, |
@@ -1146,12 +1179,13 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) | |||
1146 | data->temp_type[3] = (reg & 0x08) ? 2 : 4; | 1179 | data->temp_type[3] = (reg & 0x08) ? 2 : 4; |
1147 | } | 1180 | } |
1148 | 1181 | ||
1149 | if (f71882fg_has_beep[data->type]) { | 1182 | if (f71882fg_fan_has_beep[data->type]) |
1150 | data->fan_beep = f71882fg_read8(data, | 1183 | data->fan_beep = f71882fg_read8(data, |
1151 | F71882FG_REG_FAN_BEEP); | 1184 | F71882FG_REG_FAN_BEEP); |
1185 | |||
1186 | if (f71882fg_temp_has_beep[data->type]) | ||
1152 | data->temp_beep = f71882fg_read8(data, | 1187 | data->temp_beep = f71882fg_read8(data, |
1153 | F71882FG_REG_TEMP_BEEP); | 1188 | F71882FG_REG_TEMP_BEEP); |
1154 | } | ||
1155 | 1189 | ||
1156 | data->pwm_enable = f71882fg_read8(data, | 1190 | data->pwm_enable = f71882fg_read8(data, |
1157 | F71882FG_REG_PWM_ENABLE); | 1191 | F71882FG_REG_PWM_ENABLE); |
@@ -1232,7 +1266,13 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) | |||
1232 | data->pwm[nr] = | 1266 | data->pwm[nr] = |
1233 | f71882fg_read8(data, F71882FG_REG_PWM(nr)); | 1267 | f71882fg_read8(data, F71882FG_REG_PWM(nr)); |
1234 | } | 1268 | } |
1235 | /* The f8000 can monitor 1 more fan, but has no pwm for it */ | 1269 | /* Some models have 1 more fan with limited capabilities */ |
1270 | if (data->type == f71808a) { | ||
1271 | data->fan[2] = f71882fg_read16(data, | ||
1272 | F71882FG_REG_FAN(2)); | ||
1273 | data->pwm[2] = f71882fg_read8(data, | ||
1274 | F71882FG_REG_PWM(2)); | ||
1275 | } | ||
1236 | if (data->type == f8000) | 1276 | if (data->type == f8000) |
1237 | data->fan[3] = f71882fg_read16(data, | 1277 | data->fan[3] = f71882fg_read16(data, |
1238 | F71882FG_REG_FAN(3)); | 1278 | F71882FG_REG_FAN(3)); |
@@ -1722,6 +1762,38 @@ leave: | |||
1722 | return count; | 1762 | return count; |
1723 | } | 1763 | } |
1724 | 1764 | ||
1765 | static ssize_t show_simple_pwm(struct device *dev, | ||
1766 | struct device_attribute *devattr, char *buf) | ||
1767 | { | ||
1768 | struct f71882fg_data *data = f71882fg_update_device(dev); | ||
1769 | int val, nr = to_sensor_dev_attr_2(devattr)->index; | ||
1770 | |||
1771 | val = data->pwm[nr]; | ||
1772 | return sprintf(buf, "%d\n", val); | ||
1773 | } | ||
1774 | |||
1775 | static ssize_t store_simple_pwm(struct device *dev, | ||
1776 | struct device_attribute *devattr, | ||
1777 | const char *buf, size_t count) | ||
1778 | { | ||
1779 | struct f71882fg_data *data = dev_get_drvdata(dev); | ||
1780 | int err, nr = to_sensor_dev_attr_2(devattr)->index; | ||
1781 | long val; | ||
1782 | |||
1783 | err = strict_strtol(buf, 10, &val); | ||
1784 | if (err) | ||
1785 | return err; | ||
1786 | |||
1787 | val = SENSORS_LIMIT(val, 0, 255); | ||
1788 | |||
1789 | mutex_lock(&data->update_lock); | ||
1790 | f71882fg_write8(data, F71882FG_REG_PWM(nr), val); | ||
1791 | data->pwm[nr] = val; | ||
1792 | mutex_unlock(&data->update_lock); | ||
1793 | |||
1794 | return count; | ||
1795 | } | ||
1796 | |||
1725 | static ssize_t show_pwm_enable(struct device *dev, | 1797 | static ssize_t show_pwm_enable(struct device *dev, |
1726 | struct device_attribute *devattr, char *buf) | 1798 | struct device_attribute *devattr, char *buf) |
1727 | { | 1799 | { |
@@ -2140,7 +2212,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2140 | if (err) | 2212 | if (err) |
2141 | goto exit_unregister_sysfs; | 2213 | goto exit_unregister_sysfs; |
2142 | 2214 | ||
2143 | if (f71882fg_has_beep[data->type]) { | 2215 | if (f71882fg_temp_has_beep[data->type]) { |
2144 | err = f71882fg_create_sysfs_files(pdev, | 2216 | err = f71882fg_create_sysfs_files(pdev, |
2145 | &fxxxx_temp_beep_attr[0][0], | 2217 | &fxxxx_temp_beep_attr[0][0], |
2146 | ARRAY_SIZE(fxxxx_temp_beep_attr[0]) | 2218 | ARRAY_SIZE(fxxxx_temp_beep_attr[0]) |
@@ -2169,6 +2241,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2169 | if (start_reg & 0x02) { | 2241 | if (start_reg & 0x02) { |
2170 | switch (data->type) { | 2242 | switch (data->type) { |
2171 | case f71808e: | 2243 | case f71808e: |
2244 | case f71808a: | ||
2172 | case f71869: | 2245 | case f71869: |
2173 | /* These always have signed auto point temps */ | 2246 | /* These always have signed auto point temps */ |
2174 | data->auto_point_temp_signed = 1; | 2247 | data->auto_point_temp_signed = 1; |
@@ -2221,7 +2294,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2221 | if (err) | 2294 | if (err) |
2222 | goto exit_unregister_sysfs; | 2295 | goto exit_unregister_sysfs; |
2223 | 2296 | ||
2224 | if (f71882fg_has_beep[data->type]) { | 2297 | if (f71882fg_fan_has_beep[data->type]) { |
2225 | err = f71882fg_create_sysfs_files(pdev, | 2298 | err = f71882fg_create_sysfs_files(pdev, |
2226 | fxxxx_fan_beep_attr, nr_fans); | 2299 | fxxxx_fan_beep_attr, nr_fans); |
2227 | if (err) | 2300 | if (err) |
@@ -2230,6 +2303,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2230 | 2303 | ||
2231 | switch (data->type) { | 2304 | switch (data->type) { |
2232 | case f71808e: | 2305 | case f71808e: |
2306 | case f71808a: | ||
2233 | case f71869: | 2307 | case f71869: |
2234 | case f71889fg: | 2308 | case f71889fg: |
2235 | case f71889ed: | 2309 | case f71889ed: |
@@ -2255,6 +2329,16 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2255 | } | 2329 | } |
2256 | 2330 | ||
2257 | switch (data->type) { | 2331 | switch (data->type) { |
2332 | case f71808a: | ||
2333 | err = f71882fg_create_sysfs_files(pdev, | ||
2334 | &fxxxx_auto_pwm_attr[0][0], | ||
2335 | ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans); | ||
2336 | if (err) | ||
2337 | goto exit_unregister_sysfs; | ||
2338 | err = f71882fg_create_sysfs_files(pdev, | ||
2339 | f71808a_fan3_attr, | ||
2340 | ARRAY_SIZE(f71808a_fan3_attr)); | ||
2341 | break; | ||
2258 | case f71862fg: | 2342 | case f71862fg: |
2259 | err = f71882fg_create_sysfs_files(pdev, | 2343 | err = f71882fg_create_sysfs_files(pdev, |
2260 | f71862fg_auto_pwm_attr, | 2344 | f71862fg_auto_pwm_attr, |
@@ -2343,7 +2427,7 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
2343 | &fxxxx_temp_attr[0][0], | 2427 | &fxxxx_temp_attr[0][0], |
2344 | ARRAY_SIZE(fxxxx_temp_attr[0]) * nr_temps); | 2428 | ARRAY_SIZE(fxxxx_temp_attr[0]) * nr_temps); |
2345 | } | 2429 | } |
2346 | if (f71882fg_has_beep[data->type]) { | 2430 | if (f71882fg_temp_has_beep[data->type]) { |
2347 | f71882fg_remove_sysfs_files(pdev, | 2431 | f71882fg_remove_sysfs_files(pdev, |
2348 | &fxxxx_temp_beep_attr[0][0], | 2432 | &fxxxx_temp_beep_attr[0][0], |
2349 | ARRAY_SIZE(fxxxx_temp_beep_attr[0]) * nr_temps); | 2433 | ARRAY_SIZE(fxxxx_temp_beep_attr[0]) * nr_temps); |
@@ -2366,12 +2450,20 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
2366 | f71882fg_remove_sysfs_files(pdev, &fxxxx_fan_attr[0][0], | 2450 | f71882fg_remove_sysfs_files(pdev, &fxxxx_fan_attr[0][0], |
2367 | ARRAY_SIZE(fxxxx_fan_attr[0]) * nr_fans); | 2451 | ARRAY_SIZE(fxxxx_fan_attr[0]) * nr_fans); |
2368 | 2452 | ||
2369 | if (f71882fg_has_beep[data->type]) { | 2453 | if (f71882fg_fan_has_beep[data->type]) { |
2370 | f71882fg_remove_sysfs_files(pdev, | 2454 | f71882fg_remove_sysfs_files(pdev, |
2371 | fxxxx_fan_beep_attr, nr_fans); | 2455 | fxxxx_fan_beep_attr, nr_fans); |
2372 | } | 2456 | } |
2373 | 2457 | ||
2374 | switch (data->type) { | 2458 | switch (data->type) { |
2459 | case f71808a: | ||
2460 | f71882fg_remove_sysfs_files(pdev, | ||
2461 | &fxxxx_auto_pwm_attr[0][0], | ||
2462 | ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans); | ||
2463 | f71882fg_remove_sysfs_files(pdev, | ||
2464 | f71808a_fan3_attr, | ||
2465 | ARRAY_SIZE(f71808a_fan3_attr)); | ||
2466 | break; | ||
2375 | case f71862fg: | 2467 | case f71862fg: |
2376 | f71882fg_remove_sysfs_files(pdev, | 2468 | f71882fg_remove_sysfs_files(pdev, |
2377 | f71862fg_auto_pwm_attr, | 2469 | f71862fg_auto_pwm_attr, |
@@ -2424,6 +2516,9 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
2424 | case SIO_F71808E_ID: | 2516 | case SIO_F71808E_ID: |
2425 | sio_data->type = f71808e; | 2517 | sio_data->type = f71808e; |
2426 | break; | 2518 | break; |
2519 | case SIO_F71808A_ID: | ||
2520 | sio_data->type = f71808a; | ||
2521 | break; | ||
2427 | case SIO_F71858_ID: | 2522 | case SIO_F71858_ID: |
2428 | sio_data->type = f71858fg; | 2523 | sio_data->type = f71858fg; |
2429 | break; | 2524 | break; |
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c new file mode 100644 index 000000000000..523f8fb9e7d9 --- /dev/null +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -0,0 +1,229 @@ | |||
1 | /* | ||
2 | * fam15h_power.c - AMD Family 15h processor power monitoring | ||
3 | * | ||
4 | * Copyright (c) 2011 Advanced Micro Devices, Inc. | ||
5 | * Author: Andreas Herrmann <andreas.herrmann3@amd.com> | ||
6 | * | ||
7 | * | ||
8 | * This driver is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License; either | ||
10 | * version 2 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This driver is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
15 | * See the GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this driver; if not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | ||
20 | |||
21 | #include <linux/err.h> | ||
22 | #include <linux/hwmon.h> | ||
23 | #include <linux/hwmon-sysfs.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/pci.h> | ||
27 | #include <linux/bitops.h> | ||
28 | #include <asm/processor.h> | ||
29 | |||
30 | MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor"); | ||
31 | MODULE_AUTHOR("Andreas Herrmann <andreas.herrmann3@amd.com>"); | ||
32 | MODULE_LICENSE("GPL"); | ||
33 | |||
34 | /* D18F3 */ | ||
35 | #define REG_NORTHBRIDGE_CAP 0xe8 | ||
36 | |||
37 | /* D18F4 */ | ||
38 | #define REG_PROCESSOR_TDP 0x1b8 | ||
39 | |||
40 | /* D18F5 */ | ||
41 | #define REG_TDP_RUNNING_AVERAGE 0xe0 | ||
42 | #define REG_TDP_LIMIT3 0xe8 | ||
43 | |||
44 | struct fam15h_power_data { | ||
45 | struct device *hwmon_dev; | ||
46 | unsigned int tdp_to_watts; | ||
47 | unsigned int base_tdp; | ||
48 | unsigned int processor_pwr_watts; | ||
49 | }; | ||
50 | |||
51 | static ssize_t show_power(struct device *dev, | ||
52 | struct device_attribute *attr, char *buf) | ||
53 | { | ||
54 | u32 val, tdp_limit, running_avg_range; | ||
55 | s32 running_avg_capture; | ||
56 | u64 curr_pwr_watts; | ||
57 | struct pci_dev *f4 = to_pci_dev(dev); | ||
58 | struct fam15h_power_data *data = dev_get_drvdata(dev); | ||
59 | |||
60 | pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5), | ||
61 | REG_TDP_RUNNING_AVERAGE, &val); | ||
62 | running_avg_capture = (val >> 4) & 0x3fffff; | ||
63 | running_avg_capture = sign_extend32(running_avg_capture, 22); | ||
64 | running_avg_range = val & 0xf; | ||
65 | |||
66 | pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5), | ||
67 | REG_TDP_LIMIT3, &val); | ||
68 | |||
69 | tdp_limit = val >> 16; | ||
70 | curr_pwr_watts = tdp_limit + data->base_tdp - | ||
71 | (s32)(running_avg_capture >> (running_avg_range + 1)); | ||
72 | curr_pwr_watts *= data->tdp_to_watts; | ||
73 | |||
74 | /* | ||
75 | * Convert to microWatt | ||
76 | * | ||
77 | * power is in Watt provided as fixed point integer with | ||
78 | * scaling factor 1/(2^16). For conversion we use | ||
79 | * (10^6)/(2^16) = 15625/(2^10) | ||
80 | */ | ||
81 | curr_pwr_watts = (curr_pwr_watts * 15625) >> 10; | ||
82 | return sprintf(buf, "%u\n", (unsigned int) curr_pwr_watts); | ||
83 | } | ||
84 | static DEVICE_ATTR(power1_input, S_IRUGO, show_power, NULL); | ||
85 | |||
86 | static ssize_t show_power_crit(struct device *dev, | ||
87 | struct device_attribute *attr, char *buf) | ||
88 | { | ||
89 | struct fam15h_power_data *data = dev_get_drvdata(dev); | ||
90 | |||
91 | return sprintf(buf, "%u\n", data->processor_pwr_watts); | ||
92 | } | ||
93 | static DEVICE_ATTR(power1_crit, S_IRUGO, show_power_crit, NULL); | ||
94 | |||
95 | static ssize_t show_name(struct device *dev, | ||
96 | struct device_attribute *attr, char *buf) | ||
97 | { | ||
98 | return sprintf(buf, "fam15h_power\n"); | ||
99 | } | ||
100 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | ||
101 | |||
102 | static struct attribute *fam15h_power_attrs[] = { | ||
103 | &dev_attr_power1_input.attr, | ||
104 | &dev_attr_power1_crit.attr, | ||
105 | &dev_attr_name.attr, | ||
106 | NULL | ||
107 | }; | ||
108 | |||
109 | static const struct attribute_group fam15h_power_attr_group = { | ||
110 | .attrs = fam15h_power_attrs, | ||
111 | }; | ||
112 | |||
113 | static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | ||
114 | { | ||
115 | u32 val; | ||
116 | |||
117 | pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 3), | ||
118 | REG_NORTHBRIDGE_CAP, &val); | ||
119 | if ((val & BIT(29)) && ((val >> 30) & 3)) | ||
120 | return false; | ||
121 | |||
122 | return true; | ||
123 | } | ||
124 | |||
125 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | ||
126 | struct fam15h_power_data *data) | ||
127 | { | ||
128 | u32 val; | ||
129 | u64 tmp; | ||
130 | |||
131 | pci_read_config_dword(f4, REG_PROCESSOR_TDP, &val); | ||
132 | data->base_tdp = val >> 16; | ||
133 | tmp = val & 0xffff; | ||
134 | |||
135 | pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5), | ||
136 | REG_TDP_LIMIT3, &val); | ||
137 | |||
138 | data->tdp_to_watts = ((val & 0x3ff) << 6) | ((val >> 10) & 0x3f); | ||
139 | tmp *= data->tdp_to_watts; | ||
140 | |||
141 | /* result not allowed to be >= 256W */ | ||
142 | if ((tmp >> 16) >= 256) | ||
143 | dev_warn(&f4->dev, "Bogus value for ProcessorPwrWatts " | ||
144 | "(processor_pwr_watts>=%u)\n", | ||
145 | (unsigned int) (tmp >> 16)); | ||
146 | |||
147 | /* convert to microWatt */ | ||
148 | data->processor_pwr_watts = (tmp * 15625) >> 10; | ||
149 | } | ||
150 | |||
151 | static int __devinit fam15h_power_probe(struct pci_dev *pdev, | ||
152 | const struct pci_device_id *id) | ||
153 | { | ||
154 | struct fam15h_power_data *data; | ||
155 | struct device *dev; | ||
156 | int err; | ||
157 | |||
158 | if (!fam15h_power_is_internal_node0(pdev)) { | ||
159 | err = -ENODEV; | ||
160 | goto exit; | ||
161 | } | ||
162 | |||
163 | data = kzalloc(sizeof(struct fam15h_power_data), GFP_KERNEL); | ||
164 | if (!data) { | ||
165 | err = -ENOMEM; | ||
166 | goto exit; | ||
167 | } | ||
168 | fam15h_power_init_data(pdev, data); | ||
169 | dev = &pdev->dev; | ||
170 | |||
171 | dev_set_drvdata(dev, data); | ||
172 | err = sysfs_create_group(&dev->kobj, &fam15h_power_attr_group); | ||
173 | if (err) | ||
174 | goto exit_free_data; | ||
175 | |||
176 | data->hwmon_dev = hwmon_device_register(dev); | ||
177 | if (IS_ERR(data->hwmon_dev)) { | ||
178 | err = PTR_ERR(data->hwmon_dev); | ||
179 | goto exit_remove_group; | ||
180 | } | ||
181 | |||
182 | return 0; | ||
183 | |||
184 | exit_remove_group: | ||
185 | sysfs_remove_group(&dev->kobj, &fam15h_power_attr_group); | ||
186 | exit_free_data: | ||
187 | kfree(data); | ||
188 | exit: | ||
189 | return err; | ||
190 | } | ||
191 | |||
192 | static void __devexit fam15h_power_remove(struct pci_dev *pdev) | ||
193 | { | ||
194 | struct device *dev; | ||
195 | struct fam15h_power_data *data; | ||
196 | |||
197 | dev = &pdev->dev; | ||
198 | data = dev_get_drvdata(dev); | ||
199 | hwmon_device_unregister(data->hwmon_dev); | ||
200 | sysfs_remove_group(&dev->kobj, &fam15h_power_attr_group); | ||
201 | dev_set_drvdata(dev, NULL); | ||
202 | kfree(data); | ||
203 | } | ||
204 | |||
205 | static DEFINE_PCI_DEVICE_TABLE(fam15h_power_id_table) = { | ||
206 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | ||
207 | {} | ||
208 | }; | ||
209 | MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); | ||
210 | |||
211 | static struct pci_driver fam15h_power_driver = { | ||
212 | .name = "fam15h_power", | ||
213 | .id_table = fam15h_power_id_table, | ||
214 | .probe = fam15h_power_probe, | ||
215 | .remove = __devexit_p(fam15h_power_remove), | ||
216 | }; | ||
217 | |||
218 | static int __init fam15h_power_init(void) | ||
219 | { | ||
220 | return pci_register_driver(&fam15h_power_driver); | ||
221 | } | ||
222 | |||
223 | static void __exit fam15h_power_exit(void) | ||
224 | { | ||
225 | pci_unregister_driver(&fam15h_power_driver); | ||
226 | } | ||
227 | |||
228 | module_init(fam15h_power_init) | ||
229 | module_exit(fam15h_power_exit) | ||
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c index bc6e2ab3a361..537409d07ee7 100644 --- a/drivers/hwmon/ibmaem.c +++ b/drivers/hwmon/ibmaem.c | |||
@@ -523,7 +523,7 @@ static void aem_delete(struct aem_data *data) | |||
523 | aem_remove_sensors(data); | 523 | aem_remove_sensors(data); |
524 | hwmon_device_unregister(data->hwmon_dev); | 524 | hwmon_device_unregister(data->hwmon_dev); |
525 | ipmi_destroy_user(data->ipmi.user); | 525 | ipmi_destroy_user(data->ipmi.user); |
526 | dev_set_drvdata(&data->pdev->dev, NULL); | 526 | platform_set_drvdata(data->pdev, NULL); |
527 | platform_device_unregister(data->pdev); | 527 | platform_device_unregister(data->pdev); |
528 | aem_idr_put(data->id); | 528 | aem_idr_put(data->id); |
529 | kfree(data); | 529 | kfree(data); |
@@ -594,7 +594,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle) | |||
594 | if (res) | 594 | if (res) |
595 | goto ipmi_err; | 595 | goto ipmi_err; |
596 | 596 | ||
597 | dev_set_drvdata(&data->pdev->dev, data); | 597 | platform_set_drvdata(data->pdev, data); |
598 | 598 | ||
599 | /* Set up IPMI interface */ | 599 | /* Set up IPMI interface */ |
600 | if (aem_init_ipmi_data(&data->ipmi, probe->interface, | 600 | if (aem_init_ipmi_data(&data->ipmi, probe->interface, |
@@ -630,7 +630,7 @@ sensor_err: | |||
630 | hwmon_reg_err: | 630 | hwmon_reg_err: |
631 | ipmi_destroy_user(data->ipmi.user); | 631 | ipmi_destroy_user(data->ipmi.user); |
632 | ipmi_err: | 632 | ipmi_err: |
633 | dev_set_drvdata(&data->pdev->dev, NULL); | 633 | platform_set_drvdata(data->pdev, NULL); |
634 | platform_device_unregister(data->pdev); | 634 | platform_device_unregister(data->pdev); |
635 | dev_err: | 635 | dev_err: |
636 | aem_idr_put(data->id); | 636 | aem_idr_put(data->id); |
@@ -727,7 +727,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe, | |||
727 | if (res) | 727 | if (res) |
728 | goto ipmi_err; | 728 | goto ipmi_err; |
729 | 729 | ||
730 | dev_set_drvdata(&data->pdev->dev, data); | 730 | platform_set_drvdata(data->pdev, data); |
731 | 731 | ||
732 | /* Set up IPMI interface */ | 732 | /* Set up IPMI interface */ |
733 | if (aem_init_ipmi_data(&data->ipmi, probe->interface, | 733 | if (aem_init_ipmi_data(&data->ipmi, probe->interface, |
@@ -763,7 +763,7 @@ sensor_err: | |||
763 | hwmon_reg_err: | 763 | hwmon_reg_err: |
764 | ipmi_destroy_user(data->ipmi.user); | 764 | ipmi_destroy_user(data->ipmi.user); |
765 | ipmi_err: | 765 | ipmi_err: |
766 | dev_set_drvdata(&data->pdev->dev, NULL); | 766 | platform_set_drvdata(data->pdev, NULL); |
767 | platform_device_unregister(data->pdev); | 767 | platform_device_unregister(data->pdev); |
768 | dev_err: | 768 | dev_err: |
769 | aem_idr_put(data->id); | 769 | aem_idr_put(data->id); |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 316b64823f7b..bb6405b92007 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -77,15 +77,13 @@ static struct platform_device *pdev; | |||
77 | #define DEVID 0x20 /* Register: Device ID */ | 77 | #define DEVID 0x20 /* Register: Device ID */ |
78 | #define DEVREV 0x22 /* Register: Device Revision */ | 78 | #define DEVREV 0x22 /* Register: Device Revision */ |
79 | 79 | ||
80 | static inline int | 80 | static inline int superio_inb(int reg) |
81 | superio_inb(int reg) | ||
82 | { | 81 | { |
83 | outb(reg, REG); | 82 | outb(reg, REG); |
84 | return inb(VAL); | 83 | return inb(VAL); |
85 | } | 84 | } |
86 | 85 | ||
87 | static inline void | 86 | static inline void superio_outb(int reg, int val) |
88 | superio_outb(int reg, int val) | ||
89 | { | 87 | { |
90 | outb(reg, REG); | 88 | outb(reg, REG); |
91 | outb(val, VAL); | 89 | outb(val, VAL); |
@@ -101,27 +99,32 @@ static int superio_inw(int reg) | |||
101 | return val; | 99 | return val; |
102 | } | 100 | } |
103 | 101 | ||
104 | static inline void | 102 | static inline void superio_select(int ldn) |
105 | superio_select(int ldn) | ||
106 | { | 103 | { |
107 | outb(DEV, REG); | 104 | outb(DEV, REG); |
108 | outb(ldn, VAL); | 105 | outb(ldn, VAL); |
109 | } | 106 | } |
110 | 107 | ||
111 | static inline void | 108 | static inline int superio_enter(void) |
112 | superio_enter(void) | ||
113 | { | 109 | { |
110 | /* | ||
111 | * Try to reserve REG and REG + 1 for exclusive access. | ||
112 | */ | ||
113 | if (!request_muxed_region(REG, 2, DRVNAME)) | ||
114 | return -EBUSY; | ||
115 | |||
114 | outb(0x87, REG); | 116 | outb(0x87, REG); |
115 | outb(0x01, REG); | 117 | outb(0x01, REG); |
116 | outb(0x55, REG); | 118 | outb(0x55, REG); |
117 | outb(0x55, REG); | 119 | outb(0x55, REG); |
120 | return 0; | ||
118 | } | 121 | } |
119 | 122 | ||
120 | static inline void | 123 | static inline void superio_exit(void) |
121 | superio_exit(void) | ||
122 | { | 124 | { |
123 | outb(0x02, REG); | 125 | outb(0x02, REG); |
124 | outb(0x02, VAL); | 126 | outb(0x02, VAL); |
127 | release_region(REG, 2); | ||
125 | } | 128 | } |
126 | 129 | ||
127 | /* Logical device 4 registers */ | 130 | /* Logical device 4 registers */ |
@@ -1542,11 +1545,15 @@ static const struct attribute_group it87_group_label = { | |||
1542 | static int __init it87_find(unsigned short *address, | 1545 | static int __init it87_find(unsigned short *address, |
1543 | struct it87_sio_data *sio_data) | 1546 | struct it87_sio_data *sio_data) |
1544 | { | 1547 | { |
1545 | int err = -ENODEV; | 1548 | int err; |
1546 | u16 chip_type; | 1549 | u16 chip_type; |
1547 | const char *board_vendor, *board_name; | 1550 | const char *board_vendor, *board_name; |
1548 | 1551 | ||
1549 | superio_enter(); | 1552 | err = superio_enter(); |
1553 | if (err) | ||
1554 | return err; | ||
1555 | |||
1556 | err = -ENODEV; | ||
1550 | chip_type = force_id ? force_id : superio_inw(DEVID); | 1557 | chip_type = force_id ? force_id : superio_inw(DEVID); |
1551 | 1558 | ||
1552 | switch (chip_type) { | 1559 | switch (chip_type) { |
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c index 934991237061..02cebb74e206 100644 --- a/drivers/hwmon/jc42.c +++ b/drivers/hwmon/jc42.c | |||
@@ -213,7 +213,7 @@ static const struct dev_pm_ops jc42_dev_pm_ops = { | |||
213 | 213 | ||
214 | /* This is the driver that will be inserted */ | 214 | /* This is the driver that will be inserted */ |
215 | static struct i2c_driver jc42_driver = { | 215 | static struct i2c_driver jc42_driver = { |
216 | .class = I2C_CLASS_HWMON, | 216 | .class = I2C_CLASS_SPD, |
217 | .driver = { | 217 | .driver = { |
218 | .name = "jc42", | 218 | .name = "jc42", |
219 | .pm = JC42_DEV_PM_OPS, | 219 | .pm = JC42_DEV_PM_OPS, |
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index 82bf65aa2968..41aa6a319870 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * k10temp.c - AMD Family 10h/11h/12h/14h processor hardware monitoring | 2 | * k10temp.c - AMD Family 10h/11h/12h/14h/15h processor hardware monitoring |
3 | * | 3 | * |
4 | * Copyright (c) 2009 Clemens Ladisch <clemens@ladisch.de> | 4 | * Copyright (c) 2009 Clemens Ladisch <clemens@ladisch.de> |
5 | * | 5 | * |
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <asm/processor.h> | 26 | #include <asm/processor.h> |
27 | 27 | ||
28 | MODULE_DESCRIPTION("AMD Family 10h/11h/12h/14h CPU core temperature monitor"); | 28 | MODULE_DESCRIPTION("AMD Family 10h+ CPU core temperature monitor"); |
29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
30 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
31 | 31 | ||
@@ -173,7 +173,7 @@ static int __devinit k10temp_probe(struct pci_dev *pdev, | |||
173 | err = PTR_ERR(hwmon_dev); | 173 | err = PTR_ERR(hwmon_dev); |
174 | goto exit_remove; | 174 | goto exit_remove; |
175 | } | 175 | } |
176 | dev_set_drvdata(&pdev->dev, hwmon_dev); | 176 | pci_set_drvdata(pdev, hwmon_dev); |
177 | 177 | ||
178 | if (unreliable && force) | 178 | if (unreliable && force) |
179 | dev_warn(&pdev->dev, | 179 | dev_warn(&pdev->dev, |
@@ -194,7 +194,7 @@ exit: | |||
194 | 194 | ||
195 | static void __devexit k10temp_remove(struct pci_dev *pdev) | 195 | static void __devexit k10temp_remove(struct pci_dev *pdev) |
196 | { | 196 | { |
197 | hwmon_device_unregister(dev_get_drvdata(&pdev->dev)); | 197 | hwmon_device_unregister(pci_get_drvdata(pdev)); |
198 | device_remove_file(&pdev->dev, &dev_attr_name); | 198 | device_remove_file(&pdev->dev, &dev_attr_name); |
199 | device_remove_file(&pdev->dev, &dev_attr_temp1_input); | 199 | device_remove_file(&pdev->dev, &dev_attr_temp1_input); |
200 | device_remove_file(&pdev->dev, &dev_attr_temp1_max); | 200 | device_remove_file(&pdev->dev, &dev_attr_temp1_max); |
@@ -202,13 +202,14 @@ static void __devexit k10temp_remove(struct pci_dev *pdev) | |||
202 | &sensor_dev_attr_temp1_crit.dev_attr); | 202 | &sensor_dev_attr_temp1_crit.dev_attr); |
203 | device_remove_file(&pdev->dev, | 203 | device_remove_file(&pdev->dev, |
204 | &sensor_dev_attr_temp1_crit_hyst.dev_attr); | 204 | &sensor_dev_attr_temp1_crit_hyst.dev_attr); |
205 | dev_set_drvdata(&pdev->dev, NULL); | 205 | pci_set_drvdata(pdev, NULL); |
206 | } | 206 | } |
207 | 207 | ||
208 | static const struct pci_device_id k10temp_id_table[] = { | 208 | static const struct pci_device_id k10temp_id_table[] = { |
209 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, | 209 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, |
210 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, | 210 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, |
211 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, | 211 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, |
212 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, | ||
212 | {} | 213 | {} |
213 | }; | 214 | }; |
214 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); | 215 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); |
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index 418496f13020..b923bc2307ad 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c | |||
@@ -252,7 +252,7 @@ static int __devinit k8temp_probe(struct pci_dev *pdev, | |||
252 | 252 | ||
253 | data->name = "k8temp"; | 253 | data->name = "k8temp"; |
254 | mutex_init(&data->update_lock); | 254 | mutex_init(&data->update_lock); |
255 | dev_set_drvdata(&pdev->dev, data); | 255 | pci_set_drvdata(pdev, data); |
256 | 256 | ||
257 | /* Register sysfs hooks */ | 257 | /* Register sysfs hooks */ |
258 | err = device_create_file(&pdev->dev, | 258 | err = device_create_file(&pdev->dev, |
@@ -307,7 +307,7 @@ exit_remove: | |||
307 | &sensor_dev_attr_temp4_input.dev_attr); | 307 | &sensor_dev_attr_temp4_input.dev_attr); |
308 | device_remove_file(&pdev->dev, &dev_attr_name); | 308 | device_remove_file(&pdev->dev, &dev_attr_name); |
309 | exit_free: | 309 | exit_free: |
310 | dev_set_drvdata(&pdev->dev, NULL); | 310 | pci_set_drvdata(pdev, NULL); |
311 | kfree(data); | 311 | kfree(data); |
312 | exit: | 312 | exit: |
313 | return err; | 313 | return err; |
@@ -315,7 +315,7 @@ exit: | |||
315 | 315 | ||
316 | static void __devexit k8temp_remove(struct pci_dev *pdev) | 316 | static void __devexit k8temp_remove(struct pci_dev *pdev) |
317 | { | 317 | { |
318 | struct k8temp_data *data = dev_get_drvdata(&pdev->dev); | 318 | struct k8temp_data *data = pci_get_drvdata(pdev); |
319 | 319 | ||
320 | hwmon_device_unregister(data->hwmon_dev); | 320 | hwmon_device_unregister(data->hwmon_dev); |
321 | device_remove_file(&pdev->dev, | 321 | device_remove_file(&pdev->dev, |
@@ -327,7 +327,7 @@ static void __devexit k8temp_remove(struct pci_dev *pdev) | |||
327 | device_remove_file(&pdev->dev, | 327 | device_remove_file(&pdev->dev, |
328 | &sensor_dev_attr_temp4_input.dev_attr); | 328 | &sensor_dev_attr_temp4_input.dev_attr); |
329 | device_remove_file(&pdev->dev, &dev_attr_name); | 329 | device_remove_file(&pdev->dev, &dev_attr_name); |
330 | dev_set_drvdata(&pdev->dev, NULL); | 330 | pci_set_drvdata(pdev, NULL); |
331 | kfree(data); | 331 | kfree(data); |
332 | } | 332 | } |
333 | 333 | ||
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index 3b84fb503053..c274ea25d899 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c | |||
@@ -58,7 +58,7 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
58 | int status, val = 0; | 58 | int status, val = 0; |
59 | u8 rxbuf[2]; | 59 | u8 rxbuf[2]; |
60 | s16 raw=0; | 60 | s16 raw=0; |
61 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); | 61 | struct lm70 *p_lm70 = spi_get_drvdata(spi); |
62 | 62 | ||
63 | if (mutex_lock_interruptible(&p_lm70->lock)) | 63 | if (mutex_lock_interruptible(&p_lm70->lock)) |
64 | return -ERESTARTSYS; | 64 | return -ERESTARTSYS; |
@@ -163,7 +163,7 @@ static int __devinit lm70_probe(struct spi_device *spi) | |||
163 | status = PTR_ERR(p_lm70->hwmon_dev); | 163 | status = PTR_ERR(p_lm70->hwmon_dev); |
164 | goto out_dev_reg_failed; | 164 | goto out_dev_reg_failed; |
165 | } | 165 | } |
166 | dev_set_drvdata(&spi->dev, p_lm70); | 166 | spi_set_drvdata(spi, p_lm70); |
167 | 167 | ||
168 | if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input)) | 168 | if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input)) |
169 | || (status = device_create_file(&spi->dev, &dev_attr_name))) { | 169 | || (status = device_create_file(&spi->dev, &dev_attr_name))) { |
@@ -177,19 +177,19 @@ out_dev_create_file_failed: | |||
177 | device_remove_file(&spi->dev, &dev_attr_temp1_input); | 177 | device_remove_file(&spi->dev, &dev_attr_temp1_input); |
178 | hwmon_device_unregister(p_lm70->hwmon_dev); | 178 | hwmon_device_unregister(p_lm70->hwmon_dev); |
179 | out_dev_reg_failed: | 179 | out_dev_reg_failed: |
180 | dev_set_drvdata(&spi->dev, NULL); | 180 | spi_set_drvdata(spi, NULL); |
181 | kfree(p_lm70); | 181 | kfree(p_lm70); |
182 | return status; | 182 | return status; |
183 | } | 183 | } |
184 | 184 | ||
185 | static int __devexit lm70_remove(struct spi_device *spi) | 185 | static int __devexit lm70_remove(struct spi_device *spi) |
186 | { | 186 | { |
187 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); | 187 | struct lm70 *p_lm70 = spi_get_drvdata(spi); |
188 | 188 | ||
189 | device_remove_file(&spi->dev, &dev_attr_temp1_input); | 189 | device_remove_file(&spi->dev, &dev_attr_temp1_input); |
190 | device_remove_file(&spi->dev, &dev_attr_name); | 190 | device_remove_file(&spi->dev, &dev_attr_name); |
191 | hwmon_device_unregister(p_lm70->hwmon_dev); | 191 | hwmon_device_unregister(p_lm70->hwmon_dev); |
192 | dev_set_drvdata(&spi->dev, NULL); | 192 | spi_set_drvdata(spi, NULL); |
193 | kfree(p_lm70); | 193 | kfree(p_lm70); |
194 | 194 | ||
195 | return 0; | 195 | return 0; |
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index 9a11532ecae8..ece3aafa54b3 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c | |||
@@ -41,13 +41,6 @@ | |||
41 | #include <linux/err.h> | 41 | #include <linux/err.h> |
42 | 42 | ||
43 | /* | 43 | /* |
44 | * Addresses to scan. There are four disjoint possibilities, by pin config. | ||
45 | */ | ||
46 | |||
47 | static const unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b, | ||
48 | I2C_CLIENT_END}; | ||
49 | |||
50 | /* | ||
51 | * Insmod parameters | 44 | * Insmod parameters |
52 | */ | 45 | */ |
53 | 46 | ||
@@ -114,8 +107,6 @@ module_param(clock, int, S_IRUGO); | |||
114 | 107 | ||
115 | static int max6650_probe(struct i2c_client *client, | 108 | static int max6650_probe(struct i2c_client *client, |
116 | const struct i2c_device_id *id); | 109 | const struct i2c_device_id *id); |
117 | static int max6650_detect(struct i2c_client *client, | ||
118 | struct i2c_board_info *info); | ||
119 | static int max6650_init_client(struct i2c_client *client); | 110 | static int max6650_init_client(struct i2c_client *client); |
120 | static int max6650_remove(struct i2c_client *client); | 111 | static int max6650_remove(struct i2c_client *client); |
121 | static struct max6650_data *max6650_update_device(struct device *dev); | 112 | static struct max6650_data *max6650_update_device(struct device *dev); |
@@ -125,21 +116,19 @@ static struct max6650_data *max6650_update_device(struct device *dev); | |||
125 | */ | 116 | */ |
126 | 117 | ||
127 | static const struct i2c_device_id max6650_id[] = { | 118 | static const struct i2c_device_id max6650_id[] = { |
128 | { "max6650", 0 }, | 119 | { "max6650", 1 }, |
120 | { "max6651", 4 }, | ||
129 | { } | 121 | { } |
130 | }; | 122 | }; |
131 | MODULE_DEVICE_TABLE(i2c, max6650_id); | 123 | MODULE_DEVICE_TABLE(i2c, max6650_id); |
132 | 124 | ||
133 | static struct i2c_driver max6650_driver = { | 125 | static struct i2c_driver max6650_driver = { |
134 | .class = I2C_CLASS_HWMON, | ||
135 | .driver = { | 126 | .driver = { |
136 | .name = "max6650", | 127 | .name = "max6650", |
137 | }, | 128 | }, |
138 | .probe = max6650_probe, | 129 | .probe = max6650_probe, |
139 | .remove = max6650_remove, | 130 | .remove = max6650_remove, |
140 | .id_table = max6650_id, | 131 | .id_table = max6650_id, |
141 | .detect = max6650_detect, | ||
142 | .address_list = normal_i2c, | ||
143 | }; | 132 | }; |
144 | 133 | ||
145 | /* | 134 | /* |
@@ -150,6 +139,7 @@ struct max6650_data | |||
150 | { | 139 | { |
151 | struct device *hwmon_dev; | 140 | struct device *hwmon_dev; |
152 | struct mutex update_lock; | 141 | struct mutex update_lock; |
142 | int nr_fans; | ||
153 | char valid; /* zero until following fields are valid */ | 143 | char valid; /* zero until following fields are valid */ |
154 | unsigned long last_updated; /* in jiffies */ | 144 | unsigned long last_updated; /* in jiffies */ |
155 | 145 | ||
@@ -501,9 +491,6 @@ static mode_t max6650_attrs_visible(struct kobject *kobj, struct attribute *a, | |||
501 | 491 | ||
502 | static struct attribute *max6650_attrs[] = { | 492 | static struct attribute *max6650_attrs[] = { |
503 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 493 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
504 | &sensor_dev_attr_fan2_input.dev_attr.attr, | ||
505 | &sensor_dev_attr_fan3_input.dev_attr.attr, | ||
506 | &sensor_dev_attr_fan4_input.dev_attr.attr, | ||
507 | &dev_attr_fan1_target.attr, | 494 | &dev_attr_fan1_target.attr, |
508 | &dev_attr_fan1_div.attr, | 495 | &dev_attr_fan1_div.attr, |
509 | &dev_attr_pwm1_enable.attr, | 496 | &dev_attr_pwm1_enable.attr, |
@@ -521,42 +508,21 @@ static struct attribute_group max6650_attr_grp = { | |||
521 | .is_visible = max6650_attrs_visible, | 508 | .is_visible = max6650_attrs_visible, |
522 | }; | 509 | }; |
523 | 510 | ||
511 | static struct attribute *max6651_attrs[] = { | ||
512 | &sensor_dev_attr_fan2_input.dev_attr.attr, | ||
513 | &sensor_dev_attr_fan3_input.dev_attr.attr, | ||
514 | &sensor_dev_attr_fan4_input.dev_attr.attr, | ||
515 | NULL | ||
516 | }; | ||
517 | |||
518 | static const struct attribute_group max6651_attr_grp = { | ||
519 | .attrs = max6651_attrs, | ||
520 | }; | ||
521 | |||
524 | /* | 522 | /* |
525 | * Real code | 523 | * Real code |
526 | */ | 524 | */ |
527 | 525 | ||
528 | /* Return 0 if detection is successful, -ENODEV otherwise */ | ||
529 | static int max6650_detect(struct i2c_client *client, | ||
530 | struct i2c_board_info *info) | ||
531 | { | ||
532 | struct i2c_adapter *adapter = client->adapter; | ||
533 | int address = client->addr; | ||
534 | |||
535 | dev_dbg(&adapter->dev, "max6650_detect called\n"); | ||
536 | |||
537 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { | ||
538 | dev_dbg(&adapter->dev, "max6650: I2C bus doesn't support " | ||
539 | "byte read mode, skipping.\n"); | ||
540 | return -ENODEV; | ||
541 | } | ||
542 | |||
543 | if (((i2c_smbus_read_byte_data(client, MAX6650_REG_CONFIG) & 0xC0) | ||
544 | ||(i2c_smbus_read_byte_data(client, MAX6650_REG_GPIO_STAT) & 0xE0) | ||
545 | ||(i2c_smbus_read_byte_data(client, MAX6650_REG_ALARM_EN) & 0xE0) | ||
546 | ||(i2c_smbus_read_byte_data(client, MAX6650_REG_ALARM) & 0xE0) | ||
547 | ||(i2c_smbus_read_byte_data(client, MAX6650_REG_COUNT) & 0xFC))) { | ||
548 | dev_dbg(&adapter->dev, | ||
549 | "max6650: detection failed at 0x%02x.\n", address); | ||
550 | return -ENODEV; | ||
551 | } | ||
552 | |||
553 | dev_info(&adapter->dev, "max6650: chip found at 0x%02x.\n", address); | ||
554 | |||
555 | strlcpy(info->type, "max6650", I2C_NAME_SIZE); | ||
556 | |||
557 | return 0; | ||
558 | } | ||
559 | |||
560 | static int max6650_probe(struct i2c_client *client, | 526 | static int max6650_probe(struct i2c_client *client, |
561 | const struct i2c_device_id *id) | 527 | const struct i2c_device_id *id) |
562 | { | 528 | { |
@@ -570,6 +536,7 @@ static int max6650_probe(struct i2c_client *client, | |||
570 | 536 | ||
571 | i2c_set_clientdata(client, data); | 537 | i2c_set_clientdata(client, data); |
572 | mutex_init(&data->update_lock); | 538 | mutex_init(&data->update_lock); |
539 | data->nr_fans = id->driver_data; | ||
573 | 540 | ||
574 | /* | 541 | /* |
575 | * Initialize the max6650 chip | 542 | * Initialize the max6650 chip |
@@ -581,6 +548,12 @@ static int max6650_probe(struct i2c_client *client, | |||
581 | err = sysfs_create_group(&client->dev.kobj, &max6650_attr_grp); | 548 | err = sysfs_create_group(&client->dev.kobj, &max6650_attr_grp); |
582 | if (err) | 549 | if (err) |
583 | goto err_free; | 550 | goto err_free; |
551 | /* 3 additional fan inputs for the MAX6651 */ | ||
552 | if (data->nr_fans == 4) { | ||
553 | err = sysfs_create_group(&client->dev.kobj, &max6651_attr_grp); | ||
554 | if (err) | ||
555 | goto err_remove; | ||
556 | } | ||
584 | 557 | ||
585 | data->hwmon_dev = hwmon_device_register(&client->dev); | 558 | data->hwmon_dev = hwmon_device_register(&client->dev); |
586 | if (!IS_ERR(data->hwmon_dev)) | 559 | if (!IS_ERR(data->hwmon_dev)) |
@@ -588,6 +561,9 @@ static int max6650_probe(struct i2c_client *client, | |||
588 | 561 | ||
589 | err = PTR_ERR(data->hwmon_dev); | 562 | err = PTR_ERR(data->hwmon_dev); |
590 | dev_err(&client->dev, "error registering hwmon device.\n"); | 563 | dev_err(&client->dev, "error registering hwmon device.\n"); |
564 | if (data->nr_fans == 4) | ||
565 | sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp); | ||
566 | err_remove: | ||
591 | sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp); | 567 | sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp); |
592 | err_free: | 568 | err_free: |
593 | kfree(data); | 569 | kfree(data); |
@@ -598,8 +574,10 @@ static int max6650_remove(struct i2c_client *client) | |||
598 | { | 574 | { |
599 | struct max6650_data *data = i2c_get_clientdata(client); | 575 | struct max6650_data *data = i2c_get_clientdata(client); |
600 | 576 | ||
601 | sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp); | ||
602 | hwmon_device_unregister(data->hwmon_dev); | 577 | hwmon_device_unregister(data->hwmon_dev); |
578 | if (data->nr_fans == 4) | ||
579 | sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp); | ||
580 | sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp); | ||
603 | kfree(data); | 581 | kfree(data); |
604 | return 0; | 582 | return 0; |
605 | } | 583 | } |
@@ -712,7 +690,7 @@ static struct max6650_data *max6650_update_device(struct device *dev) | |||
712 | MAX6650_REG_SPEED); | 690 | MAX6650_REG_SPEED); |
713 | data->config = i2c_smbus_read_byte_data(client, | 691 | data->config = i2c_smbus_read_byte_data(client, |
714 | MAX6650_REG_CONFIG); | 692 | MAX6650_REG_CONFIG); |
715 | for (i = 0; i < 4; i++) { | 693 | for (i = 0; i < data->nr_fans; i++) { |
716 | data->tach[i] = i2c_smbus_read_byte_data(client, | 694 | data->tach[i] = i2c_smbus_read_byte_data(client, |
717 | tach_reg[i]); | 695 | tach_reg[i]); |
718 | } | 696 | } |
diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index 9a51dcca9b0d..020c87273ea1 100644 --- a/drivers/hwmon/sch5627.c +++ b/drivers/hwmon/sch5627.c | |||
@@ -52,6 +52,9 @@ | |||
52 | #define SCH5627_COMPANY_ID 0x5c | 52 | #define SCH5627_COMPANY_ID 0x5c |
53 | #define SCH5627_PRIMARY_ID 0xa0 | 53 | #define SCH5627_PRIMARY_ID 0xa0 |
54 | 54 | ||
55 | #define SCH5627_CMD_READ 0x02 | ||
56 | #define SCH5627_CMD_WRITE 0x03 | ||
57 | |||
55 | #define SCH5627_REG_BUILD_CODE 0x39 | 58 | #define SCH5627_REG_BUILD_CODE 0x39 |
56 | #define SCH5627_REG_BUILD_ID 0x3a | 59 | #define SCH5627_REG_BUILD_ID 0x3a |
57 | #define SCH5627_REG_HWMON_ID 0x3c | 60 | #define SCH5627_REG_HWMON_ID 0x3c |
@@ -94,11 +97,13 @@ static const char * const SCH5627_IN_LABELS[SCH5627_NO_IN] = { | |||
94 | struct sch5627_data { | 97 | struct sch5627_data { |
95 | unsigned short addr; | 98 | unsigned short addr; |
96 | struct device *hwmon_dev; | 99 | struct device *hwmon_dev; |
100 | u8 control; | ||
97 | u8 temp_max[SCH5627_NO_TEMPS]; | 101 | u8 temp_max[SCH5627_NO_TEMPS]; |
98 | u8 temp_crit[SCH5627_NO_TEMPS]; | 102 | u8 temp_crit[SCH5627_NO_TEMPS]; |
99 | u16 fan_min[SCH5627_NO_FANS]; | 103 | u16 fan_min[SCH5627_NO_FANS]; |
100 | 104 | ||
101 | struct mutex update_lock; | 105 | struct mutex update_lock; |
106 | unsigned long last_battery; /* In jiffies */ | ||
102 | char valid; /* !=0 if following fields are valid */ | 107 | char valid; /* !=0 if following fields are valid */ |
103 | unsigned long last_updated; /* In jiffies */ | 108 | unsigned long last_updated; /* In jiffies */ |
104 | u16 temp[SCH5627_NO_TEMPS]; | 109 | u16 temp[SCH5627_NO_TEMPS]; |
@@ -140,7 +145,7 @@ static inline void superio_exit(int base) | |||
140 | release_region(base, 2); | 145 | release_region(base, 2); |
141 | } | 146 | } |
142 | 147 | ||
143 | static int sch5627_read_virtual_reg(struct sch5627_data *data, u16 reg) | 148 | static int sch5627_send_cmd(struct sch5627_data *data, u8 cmd, u16 reg, u8 v) |
144 | { | 149 | { |
145 | u8 val; | 150 | u8 val; |
146 | int i; | 151 | int i; |
@@ -163,10 +168,14 @@ static int sch5627_read_virtual_reg(struct sch5627_data *data, u16 reg) | |||
163 | outb(0x80, data->addr + 3); | 168 | outb(0x80, data->addr + 3); |
164 | 169 | ||
165 | /* Write Request Packet Header */ | 170 | /* Write Request Packet Header */ |
166 | outb(0x02, data->addr + 4); /* Access Type: VREG read */ | 171 | outb(cmd, data->addr + 4); /* VREG Access Type read:0x02 write:0x03 */ |
167 | outb(0x01, data->addr + 5); /* # of Entries: 1 Byte (8-bit) */ | 172 | outb(0x01, data->addr + 5); /* # of Entries: 1 Byte (8-bit) */ |
168 | outb(0x04, data->addr + 2); /* Mailbox AP to first data entry loc. */ | 173 | outb(0x04, data->addr + 2); /* Mailbox AP to first data entry loc. */ |
169 | 174 | ||
175 | /* Write Value field */ | ||
176 | if (cmd == SCH5627_CMD_WRITE) | ||
177 | outb(v, data->addr + 4); | ||
178 | |||
170 | /* Write Address field */ | 179 | /* Write Address field */ |
171 | outb(reg & 0xff, data->addr + 6); | 180 | outb(reg & 0xff, data->addr + 6); |
172 | outb(reg >> 8, data->addr + 7); | 181 | outb(reg >> 8, data->addr + 7); |
@@ -224,8 +233,22 @@ static int sch5627_read_virtual_reg(struct sch5627_data *data, u16 reg) | |||
224 | * But if we do that things don't work, so let's not. | 233 | * But if we do that things don't work, so let's not. |
225 | */ | 234 | */ |
226 | 235 | ||
227 | /* Read Data from Mailbox */ | 236 | /* Read Value field */ |
228 | return inb(data->addr + 4); | 237 | if (cmd == SCH5627_CMD_READ) |
238 | return inb(data->addr + 4); | ||
239 | |||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | static int sch5627_read_virtual_reg(struct sch5627_data *data, u16 reg) | ||
244 | { | ||
245 | return sch5627_send_cmd(data, SCH5627_CMD_READ, reg, 0); | ||
246 | } | ||
247 | |||
248 | static int sch5627_write_virtual_reg(struct sch5627_data *data, | ||
249 | u16 reg, u8 val) | ||
250 | { | ||
251 | return sch5627_send_cmd(data, SCH5627_CMD_WRITE, reg, val); | ||
229 | } | 252 | } |
230 | 253 | ||
231 | static int sch5627_read_virtual_reg16(struct sch5627_data *data, u16 reg) | 254 | static int sch5627_read_virtual_reg16(struct sch5627_data *data, u16 reg) |
@@ -272,6 +295,13 @@ static struct sch5627_data *sch5627_update_device(struct device *dev) | |||
272 | 295 | ||
273 | mutex_lock(&data->update_lock); | 296 | mutex_lock(&data->update_lock); |
274 | 297 | ||
298 | /* Trigger a Vbat voltage measurement every 5 minutes */ | ||
299 | if (time_after(jiffies, data->last_battery + 300 * HZ)) { | ||
300 | sch5627_write_virtual_reg(data, SCH5627_REG_CTRL, | ||
301 | data->control | 0x10); | ||
302 | data->last_battery = jiffies; | ||
303 | } | ||
304 | |||
275 | /* Cache the values for 1 second */ | 305 | /* Cache the values for 1 second */ |
276 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { | 306 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { |
277 | for (i = 0; i < SCH5627_NO_TEMPS; i++) { | 307 | for (i = 0; i < SCH5627_NO_TEMPS; i++) { |
@@ -696,11 +726,17 @@ static int __devinit sch5627_probe(struct platform_device *pdev) | |||
696 | err = val; | 726 | err = val; |
697 | goto error; | 727 | goto error; |
698 | } | 728 | } |
699 | if (!(val & 0x01)) { | 729 | data->control = val; |
730 | if (!(data->control & 0x01)) { | ||
700 | pr_err("hardware monitoring not enabled\n"); | 731 | pr_err("hardware monitoring not enabled\n"); |
701 | err = -ENODEV; | 732 | err = -ENODEV; |
702 | goto error; | 733 | goto error; |
703 | } | 734 | } |
735 | /* Trigger a Vbat voltage measurement, so that we get a valid reading | ||
736 | the first time we read Vbat */ | ||
737 | sch5627_write_virtual_reg(data, SCH5627_REG_CTRL, | ||
738 | data->control | 0x10); | ||
739 | data->last_battery = jiffies; | ||
704 | 740 | ||
705 | /* | 741 | /* |
706 | * Read limits, we do this only once as reading a register on | 742 | * Read limits, we do this only once as reading a register on |
diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c index 1f36c635d933..27a62711e0a6 100644 --- a/drivers/hwmon/ultra45_env.c +++ b/drivers/hwmon/ultra45_env.c | |||
@@ -258,7 +258,7 @@ static int __devinit env_probe(struct platform_device *op) | |||
258 | goto out_sysfs_remove_group; | 258 | goto out_sysfs_remove_group; |
259 | } | 259 | } |
260 | 260 | ||
261 | dev_set_drvdata(&op->dev, p); | 261 | platform_set_drvdata(op, p); |
262 | err = 0; | 262 | err = 0; |
263 | 263 | ||
264 | out: | 264 | out: |
@@ -277,7 +277,7 @@ out_free: | |||
277 | 277 | ||
278 | static int __devexit env_remove(struct platform_device *op) | 278 | static int __devexit env_remove(struct platform_device *op) |
279 | { | 279 | { |
280 | struct env *p = dev_get_drvdata(&op->dev); | 280 | struct env *p = platform_get_drvdata(op); |
281 | 281 | ||
282 | if (p) { | 282 | if (p) { |
283 | sysfs_remove_group(&op->dev.kobj, &env_group); | 283 | sysfs_remove_group(&op->dev.kobj, &env_group); |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index a5ec5a7cb381..6e5123b1d341 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1781,7 +1781,8 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
1781 | 1781 | ||
1782 | ide_cd_read_toc(drive, &sense); | 1782 | ide_cd_read_toc(drive, &sense); |
1783 | g->fops = &idecd_ops; | 1783 | g->fops = &idecd_ops; |
1784 | g->flags |= GENHD_FL_REMOVABLE; | 1784 | g->flags |= GENHD_FL_REMOVABLE | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; |
1785 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
1785 | add_disk(g); | 1786 | add_disk(g); |
1786 | return 0; | 1787 | return 0; |
1787 | 1788 | ||
diff --git a/drivers/input/input-compat.h b/drivers/input/input-compat.h index 4d8ea32e8a00..22be27b424de 100644 --- a/drivers/input/input-compat.h +++ b/drivers/input/input-compat.h | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | /* Note to the author of this code: did it ever occur to | 20 | /* Note to the author of this code: did it ever occur to |
21 | you why the ifdefs are needed? Think about it again. -AK */ | 21 | you why the ifdefs are needed? Think about it again. -AK */ |
22 | #ifdef CONFIG_X86_64 | 22 | #if defined(CONFIG_X86_64) || defined(CONFIG_TILE) |
23 | # define INPUT_COMPAT_TEST is_compat_task() | 23 | # define INPUT_COMPAT_TEST is_compat_task() |
24 | #elif defined(CONFIG_S390) | 24 | #elif defined(CONFIG_S390) |
25 | # define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT) | 25 | # define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT) |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3ed3ff06be5d..481770ab2716 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -538,7 +538,7 @@ config AB8500_CORE | |||
538 | 538 | ||
539 | config AB8500_I2C_CORE | 539 | config AB8500_I2C_CORE |
540 | bool "AB8500 register access via PRCMU I2C" | 540 | bool "AB8500 register access via PRCMU I2C" |
541 | depends on AB8500_CORE && UX500_SOC_DB8500 | 541 | depends on AB8500_CORE && MFD_DB8500_PRCMU |
542 | default y | 542 | default y |
543 | help | 543 | help |
544 | This enables register access to the AB8500 chip via PRCMU I2C. | 544 | This enables register access to the AB8500 chip via PRCMU I2C. |
@@ -575,6 +575,26 @@ config AB3550_CORE | |||
575 | LEDs, vibrator, system power and temperature, power management | 575 | LEDs, vibrator, system power and temperature, power management |
576 | and ALSA sound. | 576 | and ALSA sound. |
577 | 577 | ||
578 | config MFD_DB8500_PRCMU | ||
579 | bool "ST-Ericsson DB8500 Power Reset Control Management Unit" | ||
580 | depends on UX500_SOC_DB8500 | ||
581 | select MFD_CORE | ||
582 | help | ||
583 | Select this option to enable support for the DB8500 Power Reset | ||
584 | and Control Management Unit. This is basically an autonomous | ||
585 | system controller running an XP70 microprocessor, which is accessed | ||
586 | through a register map. | ||
587 | |||
588 | config MFD_DB5500_PRCMU | ||
589 | bool "ST-Ericsson DB5500 Power Reset Control Management Unit" | ||
590 | depends on UX500_SOC_DB5500 | ||
591 | select MFD_CORE | ||
592 | help | ||
593 | Select this option to enable support for the DB5500 Power Reset | ||
594 | and Control Management Unit. This is basically an autonomous | ||
595 | system controller running an XP70 microprocessor, which is accessed | ||
596 | through a register map. | ||
597 | |||
578 | config MFD_CS5535 | 598 | config MFD_CS5535 |
579 | tristate "Support for CS5535 and CS5536 southbridge core functions" | 599 | tristate "Support for CS5535 and CS5536 southbridge core functions" |
580 | select MFD_CORE | 600 | select MFD_CORE |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 419caa9d7dcf..24aa44448daf 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -74,9 +74,12 @@ obj-$(CONFIG_AB3100_CORE) += ab3100-core.o | |||
74 | obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o | 74 | obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o |
75 | obj-$(CONFIG_AB3550_CORE) += ab3550-core.o | 75 | obj-$(CONFIG_AB3550_CORE) += ab3550-core.o |
76 | obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o | 76 | obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o |
77 | obj-$(CONFIG_AB8500_I2C_CORE) += ab8500-i2c.o | ||
78 | obj-$(CONFIG_AB8500_DEBUG) += ab8500-debugfs.o | 77 | obj-$(CONFIG_AB8500_DEBUG) += ab8500-debugfs.o |
79 | obj-$(CONFIG_AB8500_GPADC) += ab8500-gpadc.o | 78 | obj-$(CONFIG_AB8500_GPADC) += ab8500-gpadc.o |
79 | obj-$(CONFIG_MFD_DB8500_PRCMU) += db8500-prcmu.o | ||
80 | # ab8500-i2c need to come after db8500-prcmu (which provides the channel) | ||
81 | obj-$(CONFIG_AB8500_I2C_CORE) += ab8500-i2c.o | ||
82 | obj-$(CONFIG_MFD_DB5500_PRCMU) += db5500-prcmu.o | ||
80 | obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o | 83 | obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o |
81 | obj-$(CONFIG_PMIC_ADP5520) += adp5520.o | 84 | obj-$(CONFIG_PMIC_ADP5520) += adp5520.o |
82 | obj-$(CONFIG_LPC_SCH) += lpc_sch.o | 85 | obj-$(CONFIG_LPC_SCH) += lpc_sch.o |
diff --git a/drivers/mfd/ab8500-i2c.c b/drivers/mfd/ab8500-i2c.c index 821e6b86afd2..9be541c6b004 100644 --- a/drivers/mfd/ab8500-i2c.c +++ b/drivers/mfd/ab8500-i2c.c | |||
@@ -11,8 +11,7 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
13 | #include <linux/mfd/ab8500.h> | 13 | #include <linux/mfd/ab8500.h> |
14 | 14 | #include <linux/mfd/db8500-prcmu.h> | |
15 | #include <mach/prcmu.h> | ||
16 | 15 | ||
17 | static int ab8500_i2c_write(struct ab8500 *ab8500, u16 addr, u8 data) | 16 | static int ab8500_i2c_write(struct ab8500 *ab8500, u16 addr, u8 data) |
18 | { | 17 | { |
diff --git a/arch/arm/mach-ux500/include/mach/prcmu-regs.h b/drivers/mfd/db5500-prcmu-regs.h index 455467e88791..9a8e9e4ddd33 100644 --- a/arch/arm/mach-ux500/include/mach/prcmu-regs.h +++ b/drivers/mfd/db5500-prcmu-regs.h | |||
@@ -15,11 +15,20 @@ | |||
15 | 15 | ||
16 | #include <mach/hardware.h> | 16 | #include <mach/hardware.h> |
17 | 17 | ||
18 | #define _PRCMU_BASE IO_ADDRESS(U8500_PRCMU_BASE) | ||
19 | |||
20 | #define PRCM_ARM_PLLDIVPS (_PRCMU_BASE + 0x118) | 18 | #define PRCM_ARM_PLLDIVPS (_PRCMU_BASE + 0x118) |
19 | #define PRCM_ARM_PLLDIVPS_ARM_BRM_RATE 0x3f | ||
20 | #define PRCM_ARM_PLLDIVPS_MAX_MASK 0xf | ||
21 | |||
22 | #define PRCM_PLLARM_LOCKP (_PRCMU_BASE + 0x0a8) | ||
23 | #define PRCM_PLLARM_LOCKP_PRCM_PLLARM_LOCKP3 0x2 | ||
24 | |||
21 | #define PRCM_ARM_CHGCLKREQ (_PRCMU_BASE + 0x114) | 25 | #define PRCM_ARM_CHGCLKREQ (_PRCMU_BASE + 0x114) |
26 | #define PRCM_ARM_CHGCLKREQ_PRCM_ARM_CHGCLKREQ 0x1 | ||
27 | |||
22 | #define PRCM_PLLARM_ENABLE (_PRCMU_BASE + 0x98) | 28 | #define PRCM_PLLARM_ENABLE (_PRCMU_BASE + 0x98) |
29 | #define PRCM_PLLARM_ENABLE_PRCM_PLLARM_ENABLE 0x1 | ||
30 | #define PRCM_PLLARM_ENABLE_PRCM_PLLARM_COUNTON 0x100 | ||
31 | |||
23 | #define PRCM_ARMCLKFIX_MGT (_PRCMU_BASE + 0x0) | 32 | #define PRCM_ARMCLKFIX_MGT (_PRCMU_BASE + 0x0) |
24 | #define PRCM_A9_RESETN_CLR (_PRCMU_BASE + 0x1f4) | 33 | #define PRCM_A9_RESETN_CLR (_PRCMU_BASE + 0x1f4) |
25 | #define PRCM_A9_RESETN_SET (_PRCMU_BASE + 0x1f0) | 34 | #define PRCM_A9_RESETN_SET (_PRCMU_BASE + 0x1f0) |
@@ -28,7 +37,8 @@ | |||
28 | 37 | ||
29 | /* ARM WFI Standby signal register */ | 38 | /* ARM WFI Standby signal register */ |
30 | #define PRCM_ARM_WFI_STANDBY (_PRCMU_BASE + 0x130) | 39 | #define PRCM_ARM_WFI_STANDBY (_PRCMU_BASE + 0x130) |
31 | #define PRCMU_IOCR (_PRCMU_BASE + 0x310) | 40 | #define PRCM_IOCR (_PRCMU_BASE + 0x310) |
41 | #define PRCM_IOCR_IOFORCE 0x1 | ||
32 | 42 | ||
33 | /* CPU mailbox registers */ | 43 | /* CPU mailbox registers */ |
34 | #define PRCM_MBOX_CPU_VAL (_PRCMU_BASE + 0x0fc) | 44 | #define PRCM_MBOX_CPU_VAL (_PRCMU_BASE + 0x0fc) |
@@ -37,6 +47,8 @@ | |||
37 | 47 | ||
38 | /* Dual A9 core interrupt management unit registers */ | 48 | /* Dual A9 core interrupt management unit registers */ |
39 | #define PRCM_A9_MASK_REQ (_PRCMU_BASE + 0x328) | 49 | #define PRCM_A9_MASK_REQ (_PRCMU_BASE + 0x328) |
50 | #define PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ 0x1 | ||
51 | |||
40 | #define PRCM_A9_MASK_ACK (_PRCMU_BASE + 0x32c) | 52 | #define PRCM_A9_MASK_ACK (_PRCMU_BASE + 0x32c) |
41 | #define PRCM_ARMITMSK31TO0 (_PRCMU_BASE + 0x11c) | 53 | #define PRCM_ARMITMSK31TO0 (_PRCMU_BASE + 0x11c) |
42 | #define PRCM_ARMITMSK63TO32 (_PRCMU_BASE + 0x120) | 54 | #define PRCM_ARMITMSK63TO32 (_PRCMU_BASE + 0x120) |
@@ -74,14 +86,17 @@ | |||
74 | /* PRCMU clock/PLL/reset registers */ | 86 | /* PRCMU clock/PLL/reset registers */ |
75 | #define PRCM_PLLDSI_FREQ (_PRCMU_BASE + 0x500) | 87 | #define PRCM_PLLDSI_FREQ (_PRCMU_BASE + 0x500) |
76 | #define PRCM_PLLDSI_ENABLE (_PRCMU_BASE + 0x504) | 88 | #define PRCM_PLLDSI_ENABLE (_PRCMU_BASE + 0x504) |
89 | #define PRCM_PLLDSI_LOCKP (_PRCMU_BASE + 0x508) | ||
77 | #define PRCM_LCDCLK_MGT (_PRCMU_BASE + 0x044) | 90 | #define PRCM_LCDCLK_MGT (_PRCMU_BASE + 0x044) |
78 | #define PRCM_MCDECLK_MGT (_PRCMU_BASE + 0x064) | 91 | #define PRCM_MCDECLK_MGT (_PRCMU_BASE + 0x064) |
79 | #define PRCM_HDMICLK_MGT (_PRCMU_BASE + 0x058) | 92 | #define PRCM_HDMICLK_MGT (_PRCMU_BASE + 0x058) |
80 | #define PRCM_TVCLK_MGT (_PRCMU_BASE + 0x07c) | 93 | #define PRCM_TVCLK_MGT (_PRCMU_BASE + 0x07c) |
81 | #define PRCM_DSI_PLLOUT_SEL (_PRCMU_BASE + 0x530) | 94 | #define PRCM_DSI_PLLOUT_SEL (_PRCMU_BASE + 0x530) |
82 | #define PRCM_DSITVCLK_DIV (_PRCMU_BASE + 0x52C) | 95 | #define PRCM_DSITVCLK_DIV (_PRCMU_BASE + 0x52C) |
96 | #define PRCM_PLLDSI_LOCKP (_PRCMU_BASE + 0x508) | ||
83 | #define PRCM_APE_RESETN_SET (_PRCMU_BASE + 0x1E4) | 97 | #define PRCM_APE_RESETN_SET (_PRCMU_BASE + 0x1E4) |
84 | #define PRCM_APE_RESETN_CLR (_PRCMU_BASE + 0x1E8) | 98 | #define PRCM_APE_RESETN_CLR (_PRCMU_BASE + 0x1E8) |
99 | #define PRCM_CLKOCR (_PRCMU_BASE + 0x1CC) | ||
85 | 100 | ||
86 | /* ePOD and memory power signal control registers */ | 101 | /* ePOD and memory power signal control registers */ |
87 | #define PRCM_EPOD_C_SET (_PRCMU_BASE + 0x410) | 102 | #define PRCM_EPOD_C_SET (_PRCMU_BASE + 0x410) |
@@ -92,5 +107,9 @@ | |||
92 | 107 | ||
93 | /* Miscellaneous unit registers */ | 108 | /* Miscellaneous unit registers */ |
94 | #define PRCM_DSI_SW_RESET (_PRCMU_BASE + 0x324) | 109 | #define PRCM_DSI_SW_RESET (_PRCMU_BASE + 0x324) |
110 | #define PRCM_GPIOCR (_PRCMU_BASE + 0x138) | ||
111 | #define PRCM_GPIOCR_DBG_STM_MOD_CMD1 0x800 | ||
112 | #define PRCM_GPIOCR_DBG_UARTMOD_CMD0 0x1 | ||
113 | |||
95 | 114 | ||
96 | #endif /* __MACH_PRCMU_REGS_H */ | 115 | #endif /* __MACH_PRCMU__REGS_H */ |
diff --git a/drivers/mfd/db5500-prcmu.c b/drivers/mfd/db5500-prcmu.c new file mode 100644 index 000000000000..9dbb3cab4a6f --- /dev/null +++ b/drivers/mfd/db5500-prcmu.c | |||
@@ -0,0 +1,448 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License Terms: GNU General Public License v2 | ||
5 | * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> | ||
6 | * | ||
7 | * U5500 PRCM Unit interface driver | ||
8 | */ | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/delay.h> | ||
12 | #include <linux/errno.h> | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/spinlock.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/mutex.h> | ||
18 | #include <linux/completion.h> | ||
19 | #include <linux/irq.h> | ||
20 | #include <linux/jiffies.h> | ||
21 | #include <linux/bitops.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/mfd/db5500-prcmu.h> | ||
24 | #include <mach/hardware.h> | ||
25 | #include <mach/irqs.h> | ||
26 | #include <mach/db5500-regs.h> | ||
27 | #include "db5500-prcmu-regs.h" | ||
28 | |||
29 | #define _PRCM_MB_HEADER (tcdm_base + 0xFE8) | ||
30 | #define PRCM_REQ_MB0_HEADER (_PRCM_MB_HEADER + 0x0) | ||
31 | #define PRCM_REQ_MB1_HEADER (_PRCM_MB_HEADER + 0x1) | ||
32 | #define PRCM_REQ_MB2_HEADER (_PRCM_MB_HEADER + 0x2) | ||
33 | #define PRCM_REQ_MB3_HEADER (_PRCM_MB_HEADER + 0x3) | ||
34 | #define PRCM_REQ_MB4_HEADER (_PRCM_MB_HEADER + 0x4) | ||
35 | #define PRCM_REQ_MB5_HEADER (_PRCM_MB_HEADER + 0x5) | ||
36 | #define PRCM_REQ_MB6_HEADER (_PRCM_MB_HEADER + 0x6) | ||
37 | #define PRCM_REQ_MB7_HEADER (_PRCM_MB_HEADER + 0x7) | ||
38 | #define PRCM_ACK_MB0_HEADER (_PRCM_MB_HEADER + 0x8) | ||
39 | #define PRCM_ACK_MB1_HEADER (_PRCM_MB_HEADER + 0x9) | ||
40 | #define PRCM_ACK_MB2_HEADER (_PRCM_MB_HEADER + 0xa) | ||
41 | #define PRCM_ACK_MB3_HEADER (_PRCM_MB_HEADER + 0xb) | ||
42 | #define PRCM_ACK_MB4_HEADER (_PRCM_MB_HEADER + 0xc) | ||
43 | #define PRCM_ACK_MB5_HEADER (_PRCM_MB_HEADER + 0xd) | ||
44 | #define PRCM_ACK_MB6_HEADER (_PRCM_MB_HEADER + 0xe) | ||
45 | #define PRCM_ACK_MB7_HEADER (_PRCM_MB_HEADER + 0xf) | ||
46 | |||
47 | /* Req Mailboxes */ | ||
48 | #define PRCM_REQ_MB0 (tcdm_base + 0xFD8) | ||
49 | #define PRCM_REQ_MB1 (tcdm_base + 0xFCC) | ||
50 | #define PRCM_REQ_MB2 (tcdm_base + 0xFC4) | ||
51 | #define PRCM_REQ_MB3 (tcdm_base + 0xFC0) | ||
52 | #define PRCM_REQ_MB4 (tcdm_base + 0xF98) | ||
53 | #define PRCM_REQ_MB5 (tcdm_base + 0xF90) | ||
54 | #define PRCM_REQ_MB6 (tcdm_base + 0xF8C) | ||
55 | #define PRCM_REQ_MB7 (tcdm_base + 0xF84) | ||
56 | |||
57 | /* Ack Mailboxes */ | ||
58 | #define PRCM_ACK_MB0 (tcdm_base + 0xF38) | ||
59 | #define PRCM_ACK_MB1 (tcdm_base + 0xF30) | ||
60 | #define PRCM_ACK_MB2 (tcdm_base + 0xF24) | ||
61 | #define PRCM_ACK_MB3 (tcdm_base + 0xF20) | ||
62 | #define PRCM_ACK_MB4 (tcdm_base + 0xF1C) | ||
63 | #define PRCM_ACK_MB5 (tcdm_base + 0xF14) | ||
64 | #define PRCM_ACK_MB6 (tcdm_base + 0xF0C) | ||
65 | #define PRCM_ACK_MB7 (tcdm_base + 0xF08) | ||
66 | |||
67 | enum mb_return_code { | ||
68 | RC_SUCCESS, | ||
69 | RC_FAIL, | ||
70 | }; | ||
71 | |||
72 | /* Mailbox 0 headers. */ | ||
73 | enum mb0_header { | ||
74 | /* request */ | ||
75 | RMB0H_PWR_STATE_TRANS = 1, | ||
76 | RMB0H_WAKE_UP_CFG, | ||
77 | RMB0H_RD_WAKE_UP_ACK, | ||
78 | /* acknowledge */ | ||
79 | AMB0H_WAKE_UP = 1, | ||
80 | }; | ||
81 | |||
82 | /* Mailbox 5 headers. */ | ||
83 | enum mb5_header { | ||
84 | MB5H_I2C_WRITE = 1, | ||
85 | MB5H_I2C_READ, | ||
86 | }; | ||
87 | |||
88 | /* Request mailbox 5 fields. */ | ||
89 | #define PRCM_REQ_MB5_I2C_SLAVE (PRCM_REQ_MB5 + 0) | ||
90 | #define PRCM_REQ_MB5_I2C_REG (PRCM_REQ_MB5 + 1) | ||
91 | #define PRCM_REQ_MB5_I2C_SIZE (PRCM_REQ_MB5 + 2) | ||
92 | #define PRCM_REQ_MB5_I2C_DATA (PRCM_REQ_MB5 + 4) | ||
93 | |||
94 | /* Acknowledge mailbox 5 fields. */ | ||
95 | #define PRCM_ACK_MB5_RETURN_CODE (PRCM_ACK_MB5 + 0) | ||
96 | #define PRCM_ACK_MB5_I2C_DATA (PRCM_ACK_MB5 + 4) | ||
97 | |||
98 | #define NUM_MB 8 | ||
99 | #define MBOX_BIT BIT | ||
100 | #define ALL_MBOX_BITS (MBOX_BIT(NUM_MB) - 1) | ||
101 | |||
102 | /* | ||
103 | * Used by MCDE to setup all necessary PRCMU registers | ||
104 | */ | ||
105 | #define PRCMU_RESET_DSIPLL 0x00004000 | ||
106 | #define PRCMU_UNCLAMP_DSIPLL 0x00400800 | ||
107 | |||
108 | /* HDMI CLK MGT PLLSW=001 (PLLSOC0), PLLDIV=0x8, = 50 Mhz*/ | ||
109 | #define PRCMU_DSI_CLOCK_SETTING 0x00000128 | ||
110 | /* TVCLK_MGT PLLSW=001 (PLLSOC0) PLLDIV=0x13, = 19.05 MHZ */ | ||
111 | #define PRCMU_DSI_LP_CLOCK_SETTING 0x00000135 | ||
112 | #define PRCMU_PLLDSI_FREQ_SETTING 0x0004013C | ||
113 | #define PRCMU_DSI_PLLOUT_SEL_SETTING 0x00000002 | ||
114 | #define PRCMU_ENABLE_ESCAPE_CLOCK_DIV 0x03000101 | ||
115 | #define PRCMU_DISABLE_ESCAPE_CLOCK_DIV 0x00000101 | ||
116 | |||
117 | #define PRCMU_ENABLE_PLLDSI 0x00000001 | ||
118 | #define PRCMU_DISABLE_PLLDSI 0x00000000 | ||
119 | |||
120 | #define PRCMU_DSI_RESET_SW 0x00000003 | ||
121 | |||
122 | #define PRCMU_PLLDSI_LOCKP_LOCKED 0x3 | ||
123 | |||
124 | /* | ||
125 | * mb0_transfer - state needed for mailbox 0 communication. | ||
126 | * @lock: The transaction lock. | ||
127 | */ | ||
128 | static struct { | ||
129 | spinlock_t lock; | ||
130 | } mb0_transfer; | ||
131 | |||
132 | /* | ||
133 | * mb5_transfer - state needed for mailbox 5 communication. | ||
134 | * @lock: The transaction lock. | ||
135 | * @work: The transaction completion structure. | ||
136 | * @ack: Reply ("acknowledge") data. | ||
137 | */ | ||
138 | static struct { | ||
139 | struct mutex lock; | ||
140 | struct completion work; | ||
141 | struct { | ||
142 | u8 header; | ||
143 | u8 status; | ||
144 | u8 value[4]; | ||
145 | } ack; | ||
146 | } mb5_transfer; | ||
147 | |||
148 | /* PRCMU TCDM base IO address. */ | ||
149 | static __iomem void *tcdm_base; | ||
150 | |||
151 | /** | ||
152 | * db5500_prcmu_abb_read() - Read register value(s) from the ABB. | ||
153 | * @slave: The I2C slave address. | ||
154 | * @reg: The (start) register address. | ||
155 | * @value: The read out value(s). | ||
156 | * @size: The number of registers to read. | ||
157 | * | ||
158 | * Reads register value(s) from the ABB. | ||
159 | * @size has to be <= 4. | ||
160 | */ | ||
161 | int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
162 | { | ||
163 | int r; | ||
164 | |||
165 | if ((size < 1) || (4 < size)) | ||
166 | return -EINVAL; | ||
167 | |||
168 | mutex_lock(&mb5_transfer.lock); | ||
169 | |||
170 | while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(5)) | ||
171 | cpu_relax(); | ||
172 | writeb(slave, PRCM_REQ_MB5_I2C_SLAVE); | ||
173 | writeb(reg, PRCM_REQ_MB5_I2C_REG); | ||
174 | writeb(size, PRCM_REQ_MB5_I2C_SIZE); | ||
175 | writeb(MB5H_I2C_READ, PRCM_REQ_MB5_HEADER); | ||
176 | |||
177 | writel(MBOX_BIT(5), PRCM_MBOX_CPU_SET); | ||
178 | wait_for_completion(&mb5_transfer.work); | ||
179 | |||
180 | r = 0; | ||
181 | if ((mb5_transfer.ack.header == MB5H_I2C_READ) && | ||
182 | (mb5_transfer.ack.status == RC_SUCCESS)) | ||
183 | memcpy(value, mb5_transfer.ack.value, (size_t)size); | ||
184 | else | ||
185 | r = -EIO; | ||
186 | |||
187 | mutex_unlock(&mb5_transfer.lock); | ||
188 | |||
189 | return r; | ||
190 | } | ||
191 | |||
192 | /** | ||
193 | * db5500_prcmu_abb_write() - Write register value(s) to the ABB. | ||
194 | * @slave: The I2C slave address. | ||
195 | * @reg: The (start) register address. | ||
196 | * @value: The value(s) to write. | ||
197 | * @size: The number of registers to write. | ||
198 | * | ||
199 | * Writes register value(s) to the ABB. | ||
200 | * @size has to be <= 4. | ||
201 | */ | ||
202 | int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | ||
203 | { | ||
204 | int r; | ||
205 | |||
206 | if ((size < 1) || (4 < size)) | ||
207 | return -EINVAL; | ||
208 | |||
209 | mutex_lock(&mb5_transfer.lock); | ||
210 | |||
211 | while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(5)) | ||
212 | cpu_relax(); | ||
213 | writeb(slave, PRCM_REQ_MB5_I2C_SLAVE); | ||
214 | writeb(reg, PRCM_REQ_MB5_I2C_REG); | ||
215 | writeb(size, PRCM_REQ_MB5_I2C_SIZE); | ||
216 | memcpy_toio(PRCM_REQ_MB5_I2C_DATA, value, size); | ||
217 | writeb(MB5H_I2C_WRITE, PRCM_REQ_MB5_HEADER); | ||
218 | |||
219 | writel(MBOX_BIT(5), PRCM_MBOX_CPU_SET); | ||
220 | wait_for_completion(&mb5_transfer.work); | ||
221 | |||
222 | if ((mb5_transfer.ack.header == MB5H_I2C_WRITE) && | ||
223 | (mb5_transfer.ack.status == RC_SUCCESS)) | ||
224 | r = 0; | ||
225 | else | ||
226 | r = -EIO; | ||
227 | |||
228 | mutex_unlock(&mb5_transfer.lock); | ||
229 | |||
230 | return r; | ||
231 | } | ||
232 | |||
233 | int db5500_prcmu_enable_dsipll(void) | ||
234 | { | ||
235 | int i; | ||
236 | |||
237 | /* Enable DSIPLL_RESETN resets */ | ||
238 | writel(PRCMU_RESET_DSIPLL, PRCM_APE_RESETN_CLR); | ||
239 | /* Unclamp DSIPLL in/out */ | ||
240 | writel(PRCMU_UNCLAMP_DSIPLL, PRCM_MMIP_LS_CLAMP_CLR); | ||
241 | /* Set DSI PLL FREQ */ | ||
242 | writel(PRCMU_PLLDSI_FREQ_SETTING, PRCM_PLLDSI_FREQ); | ||
243 | writel(PRCMU_DSI_PLLOUT_SEL_SETTING, | ||
244 | PRCM_DSI_PLLOUT_SEL); | ||
245 | /* Enable Escape clocks */ | ||
246 | writel(PRCMU_ENABLE_ESCAPE_CLOCK_DIV, PRCM_DSITVCLK_DIV); | ||
247 | |||
248 | /* Start DSI PLL */ | ||
249 | writel(PRCMU_ENABLE_PLLDSI, PRCM_PLLDSI_ENABLE); | ||
250 | /* Reset DSI PLL */ | ||
251 | writel(PRCMU_DSI_RESET_SW, PRCM_DSI_SW_RESET); | ||
252 | for (i = 0; i < 10; i++) { | ||
253 | if ((readl(PRCM_PLLDSI_LOCKP) & | ||
254 | PRCMU_PLLDSI_LOCKP_LOCKED) == PRCMU_PLLDSI_LOCKP_LOCKED) | ||
255 | break; | ||
256 | udelay(100); | ||
257 | } | ||
258 | /* Release DSIPLL_RESETN */ | ||
259 | writel(PRCMU_RESET_DSIPLL, PRCM_APE_RESETN_SET); | ||
260 | return 0; | ||
261 | } | ||
262 | |||
263 | int db5500_prcmu_disable_dsipll(void) | ||
264 | { | ||
265 | /* Disable dsi pll */ | ||
266 | writel(PRCMU_DISABLE_PLLDSI, PRCM_PLLDSI_ENABLE); | ||
267 | /* Disable escapeclock */ | ||
268 | writel(PRCMU_DISABLE_ESCAPE_CLOCK_DIV, PRCM_DSITVCLK_DIV); | ||
269 | return 0; | ||
270 | } | ||
271 | |||
272 | int db5500_prcmu_set_display_clocks(void) | ||
273 | { | ||
274 | /* HDMI and TVCLK Should be handled somewhere else */ | ||
275 | /* PLLDIV=8, PLLSW=2, CLKEN=1 */ | ||
276 | writel(PRCMU_DSI_CLOCK_SETTING, PRCM_HDMICLK_MGT); | ||
277 | /* PLLDIV=14, PLLSW=2, CLKEN=1 */ | ||
278 | writel(PRCMU_DSI_LP_CLOCK_SETTING, PRCM_TVCLK_MGT); | ||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | static void ack_dbb_wakeup(void) | ||
283 | { | ||
284 | unsigned long flags; | ||
285 | |||
286 | spin_lock_irqsave(&mb0_transfer.lock, flags); | ||
287 | |||
288 | while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(0)) | ||
289 | cpu_relax(); | ||
290 | |||
291 | writeb(RMB0H_RD_WAKE_UP_ACK, PRCM_REQ_MB0_HEADER); | ||
292 | writel(MBOX_BIT(0), PRCM_MBOX_CPU_SET); | ||
293 | |||
294 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); | ||
295 | } | ||
296 | |||
297 | static inline void print_unknown_header_warning(u8 n, u8 header) | ||
298 | { | ||
299 | pr_warning("prcmu: Unknown message header (%d) in mailbox %d.\n", | ||
300 | header, n); | ||
301 | } | ||
302 | |||
303 | static bool read_mailbox_0(void) | ||
304 | { | ||
305 | bool r; | ||
306 | u8 header; | ||
307 | |||
308 | header = readb(PRCM_ACK_MB0_HEADER); | ||
309 | switch (header) { | ||
310 | case AMB0H_WAKE_UP: | ||
311 | r = true; | ||
312 | break; | ||
313 | default: | ||
314 | print_unknown_header_warning(0, header); | ||
315 | r = false; | ||
316 | break; | ||
317 | } | ||
318 | writel(MBOX_BIT(0), PRCM_ARM_IT1_CLEAR); | ||
319 | return r; | ||
320 | } | ||
321 | |||
322 | static bool read_mailbox_1(void) | ||
323 | { | ||
324 | writel(MBOX_BIT(1), PRCM_ARM_IT1_CLEAR); | ||
325 | return false; | ||
326 | } | ||
327 | |||
328 | static bool read_mailbox_2(void) | ||
329 | { | ||
330 | writel(MBOX_BIT(2), PRCM_ARM_IT1_CLEAR); | ||
331 | return false; | ||
332 | } | ||
333 | |||
334 | static bool read_mailbox_3(void) | ||
335 | { | ||
336 | writel(MBOX_BIT(3), PRCM_ARM_IT1_CLEAR); | ||
337 | return false; | ||
338 | } | ||
339 | |||
340 | static bool read_mailbox_4(void) | ||
341 | { | ||
342 | writel(MBOX_BIT(4), PRCM_ARM_IT1_CLEAR); | ||
343 | return false; | ||
344 | } | ||
345 | |||
346 | static bool read_mailbox_5(void) | ||
347 | { | ||
348 | u8 header; | ||
349 | |||
350 | header = readb(PRCM_ACK_MB5_HEADER); | ||
351 | switch (header) { | ||
352 | case MB5H_I2C_READ: | ||
353 | memcpy_fromio(mb5_transfer.ack.value, PRCM_ACK_MB5_I2C_DATA, 4); | ||
354 | case MB5H_I2C_WRITE: | ||
355 | mb5_transfer.ack.header = header; | ||
356 | mb5_transfer.ack.status = readb(PRCM_ACK_MB5_RETURN_CODE); | ||
357 | complete(&mb5_transfer.work); | ||
358 | break; | ||
359 | default: | ||
360 | print_unknown_header_warning(5, header); | ||
361 | break; | ||
362 | } | ||
363 | writel(MBOX_BIT(5), PRCM_ARM_IT1_CLEAR); | ||
364 | return false; | ||
365 | } | ||
366 | |||
367 | static bool read_mailbox_6(void) | ||
368 | { | ||
369 | writel(MBOX_BIT(6), PRCM_ARM_IT1_CLEAR); | ||
370 | return false; | ||
371 | } | ||
372 | |||
373 | static bool read_mailbox_7(void) | ||
374 | { | ||
375 | writel(MBOX_BIT(7), PRCM_ARM_IT1_CLEAR); | ||
376 | return false; | ||
377 | } | ||
378 | |||
379 | static bool (* const read_mailbox[NUM_MB])(void) = { | ||
380 | read_mailbox_0, | ||
381 | read_mailbox_1, | ||
382 | read_mailbox_2, | ||
383 | read_mailbox_3, | ||
384 | read_mailbox_4, | ||
385 | read_mailbox_5, | ||
386 | read_mailbox_6, | ||
387 | read_mailbox_7 | ||
388 | }; | ||
389 | |||
390 | static irqreturn_t prcmu_irq_handler(int irq, void *data) | ||
391 | { | ||
392 | u32 bits; | ||
393 | u8 n; | ||
394 | irqreturn_t r; | ||
395 | |||
396 | bits = (readl(PRCM_ARM_IT1_VAL) & ALL_MBOX_BITS); | ||
397 | if (unlikely(!bits)) | ||
398 | return IRQ_NONE; | ||
399 | |||
400 | r = IRQ_HANDLED; | ||
401 | for (n = 0; bits; n++) { | ||
402 | if (bits & MBOX_BIT(n)) { | ||
403 | bits -= MBOX_BIT(n); | ||
404 | if (read_mailbox[n]()) | ||
405 | r = IRQ_WAKE_THREAD; | ||
406 | } | ||
407 | } | ||
408 | return r; | ||
409 | } | ||
410 | |||
411 | static irqreturn_t prcmu_irq_thread_fn(int irq, void *data) | ||
412 | { | ||
413 | ack_dbb_wakeup(); | ||
414 | return IRQ_HANDLED; | ||
415 | } | ||
416 | |||
417 | void __init db5500_prcmu_early_init(void) | ||
418 | { | ||
419 | tcdm_base = __io_address(U5500_PRCMU_TCDM_BASE); | ||
420 | spin_lock_init(&mb0_transfer.lock); | ||
421 | mutex_init(&mb5_transfer.lock); | ||
422 | init_completion(&mb5_transfer.work); | ||
423 | } | ||
424 | |||
425 | /** | ||
426 | * prcmu_fw_init - arch init call for the Linux PRCMU fw init logic | ||
427 | * | ||
428 | */ | ||
429 | int __init db5500_prcmu_init(void) | ||
430 | { | ||
431 | int r = 0; | ||
432 | |||
433 | if (ux500_is_svp() || !cpu_is_u5500()) | ||
434 | return -ENODEV; | ||
435 | |||
436 | /* Clean up the mailbox interrupts after pre-kernel code. */ | ||
437 | writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLEAR); | ||
438 | |||
439 | r = request_threaded_irq(IRQ_DB5500_PRCMU1, prcmu_irq_handler, | ||
440 | prcmu_irq_thread_fn, 0, "prcmu", NULL); | ||
441 | if (r < 0) { | ||
442 | pr_err("prcmu: Failed to allocate IRQ_DB5500_PRCMU1.\n"); | ||
443 | return -EBUSY; | ||
444 | } | ||
445 | return 0; | ||
446 | } | ||
447 | |||
448 | arch_initcall(db5500_prcmu_init); | ||
diff --git a/drivers/mfd/db8500-prcmu-regs.h b/drivers/mfd/db8500-prcmu-regs.h new file mode 100644 index 000000000000..3bbf04d58043 --- /dev/null +++ b/drivers/mfd/db8500-prcmu-regs.h | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | * Copyright (C) STMicroelectronics 2009 | ||
3 | * Copyright (C) ST-Ericsson SA 2010 | ||
4 | * | ||
5 | * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.com> | ||
6 | * Author: Sundar Iyer <sundar.iyer@stericsson.com> | ||
7 | * | ||
8 | * License Terms: GNU General Public License v2 | ||
9 | * | ||
10 | * PRCM Unit registers | ||
11 | */ | ||
12 | #ifndef __DB8500_PRCMU_REGS_H | ||
13 | #define __DB8500_PRCMU_REGS_H | ||
14 | |||
15 | #include <linux/bitops.h> | ||
16 | #include <mach/hardware.h> | ||
17 | |||
18 | #define BITS(_start, _end) ((BIT(_end) - BIT(_start)) + BIT(_end)) | ||
19 | |||
20 | #define PRCM_ARM_PLLDIVPS 0x118 | ||
21 | #define PRCM_ARM_PLLDIVPS_ARM_BRM_RATE BITS(0, 5) | ||
22 | #define PRCM_ARM_PLLDIVPS_MAX_MASK 0xF | ||
23 | |||
24 | #define PRCM_PLLARM_LOCKP 0x0A8 | ||
25 | #define PRCM_PLLARM_LOCKP_PRCM_PLLARM_LOCKP3 BIT(1) | ||
26 | |||
27 | #define PRCM_ARM_CHGCLKREQ 0x114 | ||
28 | #define PRCM_ARM_CHGCLKREQ_PRCM_ARM_CHGCLKREQ BIT(0) | ||
29 | |||
30 | #define PRCM_PLLARM_ENABLE 0x98 | ||
31 | #define PRCM_PLLARM_ENABLE_PRCM_PLLARM_ENABLE BIT(0) | ||
32 | #define PRCM_PLLARM_ENABLE_PRCM_PLLARM_COUNTON BIT(8) | ||
33 | |||
34 | #define PRCM_ARMCLKFIX_MGT 0x0 | ||
35 | #define PRCM_A9_RESETN_CLR 0x1f4 | ||
36 | #define PRCM_A9_RESETN_SET 0x1f0 | ||
37 | #define PRCM_ARM_LS_CLAMP 0x30C | ||
38 | #define PRCM_SRAM_A9 0x308 | ||
39 | |||
40 | /* ARM WFI Standby signal register */ | ||
41 | #define PRCM_ARM_WFI_STANDBY 0x130 | ||
42 | #define PRCM_IOCR 0x310 | ||
43 | #define PRCM_IOCR_IOFORCE BIT(0) | ||
44 | |||
45 | /* CPU mailbox registers */ | ||
46 | #define PRCM_MBOX_CPU_VAL 0x0FC | ||
47 | #define PRCM_MBOX_CPU_SET 0x100 | ||
48 | |||
49 | /* Dual A9 core interrupt management unit registers */ | ||
50 | #define PRCM_A9_MASK_REQ 0x328 | ||
51 | #define PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ BIT(0) | ||
52 | |||
53 | #define PRCM_A9_MASK_ACK 0x32C | ||
54 | #define PRCM_ARMITMSK31TO0 0x11C | ||
55 | #define PRCM_ARMITMSK63TO32 0x120 | ||
56 | #define PRCM_ARMITMSK95TO64 0x124 | ||
57 | #define PRCM_ARMITMSK127TO96 0x128 | ||
58 | #define PRCM_POWER_STATE_VAL 0x25C | ||
59 | #define PRCM_ARMITVAL31TO0 0x260 | ||
60 | #define PRCM_ARMITVAL63TO32 0x264 | ||
61 | #define PRCM_ARMITVAL95TO64 0x268 | ||
62 | #define PRCM_ARMITVAL127TO96 0x26C | ||
63 | |||
64 | #define PRCM_HOSTACCESS_REQ 0x334 | ||
65 | #define PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ BIT(0) | ||
66 | |||
67 | #define PRCM_ARM_IT1_CLR 0x48C | ||
68 | #define PRCM_ARM_IT1_VAL 0x494 | ||
69 | |||
70 | #define PRCM_ITSTATUS0 0x148 | ||
71 | #define PRCM_ITSTATUS1 0x150 | ||
72 | #define PRCM_ITSTATUS2 0x158 | ||
73 | #define PRCM_ITSTATUS3 0x160 | ||
74 | #define PRCM_ITSTATUS4 0x168 | ||
75 | #define PRCM_ITSTATUS5 0x484 | ||
76 | #define PRCM_ITCLEAR5 0x488 | ||
77 | #define PRCM_ARMIT_MASKXP70_IT 0x1018 | ||
78 | |||
79 | /* System reset register */ | ||
80 | #define PRCM_APE_SOFTRST 0x228 | ||
81 | |||
82 | /* Level shifter and clamp control registers */ | ||
83 | #define PRCM_MMIP_LS_CLAMP_SET 0x420 | ||
84 | #define PRCM_MMIP_LS_CLAMP_CLR 0x424 | ||
85 | |||
86 | /* PRCMU HW semaphore */ | ||
87 | #define PRCM_SEM 0x400 | ||
88 | #define PRCM_SEM_PRCM_SEM BIT(0) | ||
89 | |||
90 | /* PRCMU clock/PLL/reset registers */ | ||
91 | #define PRCM_PLLDSI_FREQ 0x500 | ||
92 | #define PRCM_PLLDSI_ENABLE 0x504 | ||
93 | #define PRCM_PLLDSI_LOCKP 0x508 | ||
94 | #define PRCM_DSI_PLLOUT_SEL 0x530 | ||
95 | #define PRCM_DSITVCLK_DIV 0x52C | ||
96 | #define PRCM_APE_RESETN_SET 0x1E4 | ||
97 | #define PRCM_APE_RESETN_CLR 0x1E8 | ||
98 | |||
99 | #define PRCM_TCR 0x1C8 | ||
100 | #define PRCM_TCR_TENSEL_MASK BITS(0, 7) | ||
101 | #define PRCM_TCR_STOP_TIMERS BIT(16) | ||
102 | #define PRCM_TCR_DOZE_MODE BIT(17) | ||
103 | |||
104 | #define PRCM_CLKOCR 0x1CC | ||
105 | #define PRCM_CLKOCR_CLKODIV0_SHIFT 0 | ||
106 | #define PRCM_CLKOCR_CLKODIV0_MASK BITS(0, 5) | ||
107 | #define PRCM_CLKOCR_CLKOSEL0_SHIFT 6 | ||
108 | #define PRCM_CLKOCR_CLKOSEL0_MASK BITS(6, 8) | ||
109 | #define PRCM_CLKOCR_CLKODIV1_SHIFT 16 | ||
110 | #define PRCM_CLKOCR_CLKODIV1_MASK BITS(16, 21) | ||
111 | #define PRCM_CLKOCR_CLKOSEL1_SHIFT 22 | ||
112 | #define PRCM_CLKOCR_CLKOSEL1_MASK BITS(22, 24) | ||
113 | #define PRCM_CLKOCR_CLK1TYPE BIT(28) | ||
114 | |||
115 | #define PRCM_SGACLK_MGT 0x014 | ||
116 | #define PRCM_UARTCLK_MGT 0x018 | ||
117 | #define PRCM_MSP02CLK_MGT 0x01C | ||
118 | #define PRCM_MSP1CLK_MGT 0x288 | ||
119 | #define PRCM_I2CCLK_MGT 0x020 | ||
120 | #define PRCM_SDMMCCLK_MGT 0x024 | ||
121 | #define PRCM_SLIMCLK_MGT 0x028 | ||
122 | #define PRCM_PER1CLK_MGT 0x02C | ||
123 | #define PRCM_PER2CLK_MGT 0x030 | ||
124 | #define PRCM_PER3CLK_MGT 0x034 | ||
125 | #define PRCM_PER5CLK_MGT 0x038 | ||
126 | #define PRCM_PER6CLK_MGT 0x03C | ||
127 | #define PRCM_PER7CLK_MGT 0x040 | ||
128 | #define PRCM_LCDCLK_MGT 0x044 | ||
129 | #define PRCM_BMLCLK_MGT 0x04C | ||
130 | #define PRCM_HSITXCLK_MGT 0x050 | ||
131 | #define PRCM_HSIRXCLK_MGT 0x054 | ||
132 | #define PRCM_HDMICLK_MGT 0x058 | ||
133 | #define PRCM_APEATCLK_MGT 0x05C | ||
134 | #define PRCM_APETRACECLK_MGT 0x060 | ||
135 | #define PRCM_MCDECLK_MGT 0x064 | ||
136 | #define PRCM_IPI2CCLK_MGT 0x068 | ||
137 | #define PRCM_DSIALTCLK_MGT 0x06C | ||
138 | #define PRCM_DMACLK_MGT 0x074 | ||
139 | #define PRCM_B2R2CLK_MGT 0x078 | ||
140 | #define PRCM_TVCLK_MGT 0x07C | ||
141 | #define PRCM_UNIPROCLK_MGT 0x278 | ||
142 | #define PRCM_SSPCLK_MGT 0x280 | ||
143 | #define PRCM_RNGCLK_MGT 0x284 | ||
144 | #define PRCM_UICCCLK_MGT 0x27C | ||
145 | |||
146 | #define PRCM_CLK_MGT_CLKPLLDIV_MASK BITS(0, 4) | ||
147 | #define PRCM_CLK_MGT_CLKPLLSW_MASK BITS(5, 7) | ||
148 | #define PRCM_CLK_MGT_CLKEN BIT(8) | ||
149 | |||
150 | /* ePOD and memory power signal control registers */ | ||
151 | #define PRCM_EPOD_C_SET 0x410 | ||
152 | #define PRCM_SRAM_LS_SLEEP 0x304 | ||
153 | |||
154 | /* Debug power control unit registers */ | ||
155 | #define PRCM_POWER_STATE_SET 0x254 | ||
156 | |||
157 | /* Miscellaneous unit registers */ | ||
158 | #define PRCM_DSI_SW_RESET 0x324 | ||
159 | #define PRCM_GPIOCR 0x138 | ||
160 | |||
161 | /* GPIOCR register */ | ||
162 | #define PRCM_GPIOCR_SPI2_SELECT BIT(23) | ||
163 | |||
164 | #define PRCM_DDR_SUBSYS_APE_MINBW 0x438 | ||
165 | |||
166 | #endif /* __DB8500_PRCMU_REGS_H */ | ||
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c new file mode 100644 index 000000000000..e63782107e2f --- /dev/null +++ b/drivers/mfd/db8500-prcmu.c | |||
@@ -0,0 +1,2069 @@ | |||
1 | /* | ||
2 | * Copyright (C) STMicroelectronics 2009 | ||
3 | * Copyright (C) ST-Ericsson SA 2010 | ||
4 | * | ||
5 | * License Terms: GNU General Public License v2 | ||
6 | * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.com> | ||
7 | * Author: Sundar Iyer <sundar.iyer@stericsson.com> | ||
8 | * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> | ||
9 | * | ||
10 | * U8500 PRCM Unit interface driver | ||
11 | * | ||
12 | */ | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <linux/spinlock.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/mutex.h> | ||
22 | #include <linux/completion.h> | ||
23 | #include <linux/irq.h> | ||
24 | #include <linux/jiffies.h> | ||
25 | #include <linux/bitops.h> | ||
26 | #include <linux/fs.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/uaccess.h> | ||
29 | #include <linux/mfd/core.h> | ||
30 | #include <linux/mfd/db8500-prcmu.h> | ||
31 | #include <linux/regulator/db8500-prcmu.h> | ||
32 | #include <linux/regulator/machine.h> | ||
33 | #include <mach/hardware.h> | ||
34 | #include <mach/irqs.h> | ||
35 | #include <mach/db8500-regs.h> | ||
36 | #include <mach/id.h> | ||
37 | #include "db8500-prcmu-regs.h" | ||
38 | |||
39 | /* Offset for the firmware version within the TCPM */ | ||
40 | #define PRCMU_FW_VERSION_OFFSET 0xA4 | ||
41 | |||
42 | /* PRCMU project numbers, defined by PRCMU FW */ | ||
43 | #define PRCMU_PROJECT_ID_8500V1_0 1 | ||
44 | #define PRCMU_PROJECT_ID_8500V2_0 2 | ||
45 | #define PRCMU_PROJECT_ID_8400V2_0 3 | ||
46 | |||
47 | /* Index of different voltages to be used when accessing AVSData */ | ||
48 | #define PRCM_AVS_BASE 0x2FC | ||
49 | #define PRCM_AVS_VBB_RET (PRCM_AVS_BASE + 0x0) | ||
50 | #define PRCM_AVS_VBB_MAX_OPP (PRCM_AVS_BASE + 0x1) | ||
51 | #define PRCM_AVS_VBB_100_OPP (PRCM_AVS_BASE + 0x2) | ||
52 | #define PRCM_AVS_VBB_50_OPP (PRCM_AVS_BASE + 0x3) | ||
53 | #define PRCM_AVS_VARM_MAX_OPP (PRCM_AVS_BASE + 0x4) | ||
54 | #define PRCM_AVS_VARM_100_OPP (PRCM_AVS_BASE + 0x5) | ||
55 | #define PRCM_AVS_VARM_50_OPP (PRCM_AVS_BASE + 0x6) | ||
56 | #define PRCM_AVS_VARM_RET (PRCM_AVS_BASE + 0x7) | ||
57 | #define PRCM_AVS_VAPE_100_OPP (PRCM_AVS_BASE + 0x8) | ||
58 | #define PRCM_AVS_VAPE_50_OPP (PRCM_AVS_BASE + 0x9) | ||
59 | #define PRCM_AVS_VMOD_100_OPP (PRCM_AVS_BASE + 0xA) | ||
60 | #define PRCM_AVS_VMOD_50_OPP (PRCM_AVS_BASE + 0xB) | ||
61 | #define PRCM_AVS_VSAFE (PRCM_AVS_BASE + 0xC) | ||
62 | |||
63 | #define PRCM_AVS_VOLTAGE 0 | ||
64 | #define PRCM_AVS_VOLTAGE_MASK 0x3f | ||
65 | #define PRCM_AVS_ISSLOWSTARTUP 6 | ||
66 | #define PRCM_AVS_ISSLOWSTARTUP_MASK (1 << PRCM_AVS_ISSLOWSTARTUP) | ||
67 | #define PRCM_AVS_ISMODEENABLE 7 | ||
68 | #define PRCM_AVS_ISMODEENABLE_MASK (1 << PRCM_AVS_ISMODEENABLE) | ||
69 | |||
70 | #define PRCM_BOOT_STATUS 0xFFF | ||
71 | #define PRCM_ROMCODE_A2P 0xFFE | ||
72 | #define PRCM_ROMCODE_P2A 0xFFD | ||
73 | #define PRCM_XP70_CUR_PWR_STATE 0xFFC /* 4 BYTES */ | ||
74 | |||
75 | #define PRCM_SW_RST_REASON 0xFF8 /* 2 bytes */ | ||
76 | |||
77 | #define _PRCM_MBOX_HEADER 0xFE8 /* 16 bytes */ | ||
78 | #define PRCM_MBOX_HEADER_REQ_MB0 (_PRCM_MBOX_HEADER + 0x0) | ||
79 | #define PRCM_MBOX_HEADER_REQ_MB1 (_PRCM_MBOX_HEADER + 0x1) | ||
80 | #define PRCM_MBOX_HEADER_REQ_MB2 (_PRCM_MBOX_HEADER + 0x2) | ||
81 | #define PRCM_MBOX_HEADER_REQ_MB3 (_PRCM_MBOX_HEADER + 0x3) | ||
82 | #define PRCM_MBOX_HEADER_REQ_MB4 (_PRCM_MBOX_HEADER + 0x4) | ||
83 | #define PRCM_MBOX_HEADER_REQ_MB5 (_PRCM_MBOX_HEADER + 0x5) | ||
84 | #define PRCM_MBOX_HEADER_ACK_MB0 (_PRCM_MBOX_HEADER + 0x8) | ||
85 | |||
86 | /* Req Mailboxes */ | ||
87 | #define PRCM_REQ_MB0 0xFDC /* 12 bytes */ | ||
88 | #define PRCM_REQ_MB1 0xFD0 /* 12 bytes */ | ||
89 | #define PRCM_REQ_MB2 0xFC0 /* 16 bytes */ | ||
90 | #define PRCM_REQ_MB3 0xE4C /* 372 bytes */ | ||
91 | #define PRCM_REQ_MB4 0xE48 /* 4 bytes */ | ||
92 | #define PRCM_REQ_MB5 0xE44 /* 4 bytes */ | ||
93 | |||
94 | /* Ack Mailboxes */ | ||
95 | #define PRCM_ACK_MB0 0xE08 /* 52 bytes */ | ||
96 | #define PRCM_ACK_MB1 0xE04 /* 4 bytes */ | ||
97 | #define PRCM_ACK_MB2 0xE00 /* 4 bytes */ | ||
98 | #define PRCM_ACK_MB3 0xDFC /* 4 bytes */ | ||
99 | #define PRCM_ACK_MB4 0xDF8 /* 4 bytes */ | ||
100 | #define PRCM_ACK_MB5 0xDF4 /* 4 bytes */ | ||
101 | |||
102 | /* Mailbox 0 headers */ | ||
103 | #define MB0H_POWER_STATE_TRANS 0 | ||
104 | #define MB0H_CONFIG_WAKEUPS_EXE 1 | ||
105 | #define MB0H_READ_WAKEUP_ACK 3 | ||
106 | #define MB0H_CONFIG_WAKEUPS_SLEEP 4 | ||
107 | |||
108 | #define MB0H_WAKEUP_EXE 2 | ||
109 | #define MB0H_WAKEUP_SLEEP 5 | ||
110 | |||
111 | /* Mailbox 0 REQs */ | ||
112 | #define PRCM_REQ_MB0_AP_POWER_STATE (PRCM_REQ_MB0 + 0x0) | ||
113 | #define PRCM_REQ_MB0_AP_PLL_STATE (PRCM_REQ_MB0 + 0x1) | ||
114 | #define PRCM_REQ_MB0_ULP_CLOCK_STATE (PRCM_REQ_MB0 + 0x2) | ||
115 | #define PRCM_REQ_MB0_DO_NOT_WFI (PRCM_REQ_MB0 + 0x3) | ||
116 | #define PRCM_REQ_MB0_WAKEUP_8500 (PRCM_REQ_MB0 + 0x4) | ||
117 | #define PRCM_REQ_MB0_WAKEUP_4500 (PRCM_REQ_MB0 + 0x8) | ||
118 | |||
119 | /* Mailbox 0 ACKs */ | ||
120 | #define PRCM_ACK_MB0_AP_PWRSTTR_STATUS (PRCM_ACK_MB0 + 0x0) | ||
121 | #define PRCM_ACK_MB0_READ_POINTER (PRCM_ACK_MB0 + 0x1) | ||
122 | #define PRCM_ACK_MB0_WAKEUP_0_8500 (PRCM_ACK_MB0 + 0x4) | ||
123 | #define PRCM_ACK_MB0_WAKEUP_0_4500 (PRCM_ACK_MB0 + 0x8) | ||
124 | #define PRCM_ACK_MB0_WAKEUP_1_8500 (PRCM_ACK_MB0 + 0x1C) | ||
125 | #define PRCM_ACK_MB0_WAKEUP_1_4500 (PRCM_ACK_MB0 + 0x20) | ||
126 | #define PRCM_ACK_MB0_EVENT_4500_NUMBERS 20 | ||
127 | |||
128 | /* Mailbox 1 headers */ | ||
129 | #define MB1H_ARM_APE_OPP 0x0 | ||
130 | #define MB1H_RESET_MODEM 0x2 | ||
131 | #define MB1H_REQUEST_APE_OPP_100_VOLT 0x3 | ||
132 | #define MB1H_RELEASE_APE_OPP_100_VOLT 0x4 | ||
133 | #define MB1H_RELEASE_USB_WAKEUP 0x5 | ||
134 | |||
135 | /* Mailbox 1 Requests */ | ||
136 | #define PRCM_REQ_MB1_ARM_OPP (PRCM_REQ_MB1 + 0x0) | ||
137 | #define PRCM_REQ_MB1_APE_OPP (PRCM_REQ_MB1 + 0x1) | ||
138 | #define PRCM_REQ_MB1_APE_OPP_100_RESTORE (PRCM_REQ_MB1 + 0x4) | ||
139 | #define PRCM_REQ_MB1_ARM_OPP_100_RESTORE (PRCM_REQ_MB1 + 0x8) | ||
140 | |||
141 | /* Mailbox 1 ACKs */ | ||
142 | #define PRCM_ACK_MB1_CURRENT_ARM_OPP (PRCM_ACK_MB1 + 0x0) | ||
143 | #define PRCM_ACK_MB1_CURRENT_APE_OPP (PRCM_ACK_MB1 + 0x1) | ||
144 | #define PRCM_ACK_MB1_APE_VOLTAGE_STATUS (PRCM_ACK_MB1 + 0x2) | ||
145 | #define PRCM_ACK_MB1_DVFS_STATUS (PRCM_ACK_MB1 + 0x3) | ||
146 | |||
147 | /* Mailbox 2 headers */ | ||
148 | #define MB2H_DPS 0x0 | ||
149 | #define MB2H_AUTO_PWR 0x1 | ||
150 | |||
151 | /* Mailbox 2 REQs */ | ||
152 | #define PRCM_REQ_MB2_SVA_MMDSP (PRCM_REQ_MB2 + 0x0) | ||
153 | #define PRCM_REQ_MB2_SVA_PIPE (PRCM_REQ_MB2 + 0x1) | ||
154 | #define PRCM_REQ_MB2_SIA_MMDSP (PRCM_REQ_MB2 + 0x2) | ||
155 | #define PRCM_REQ_MB2_SIA_PIPE (PRCM_REQ_MB2 + 0x3) | ||
156 | #define PRCM_REQ_MB2_SGA (PRCM_REQ_MB2 + 0x4) | ||
157 | #define PRCM_REQ_MB2_B2R2_MCDE (PRCM_REQ_MB2 + 0x5) | ||
158 | #define PRCM_REQ_MB2_ESRAM12 (PRCM_REQ_MB2 + 0x6) | ||
159 | #define PRCM_REQ_MB2_ESRAM34 (PRCM_REQ_MB2 + 0x7) | ||
160 | #define PRCM_REQ_MB2_AUTO_PM_SLEEP (PRCM_REQ_MB2 + 0x8) | ||
161 | #define PRCM_REQ_MB2_AUTO_PM_IDLE (PRCM_REQ_MB2 + 0xC) | ||
162 | |||
163 | /* Mailbox 2 ACKs */ | ||
164 | #define PRCM_ACK_MB2_DPS_STATUS (PRCM_ACK_MB2 + 0x0) | ||
165 | #define HWACC_PWR_ST_OK 0xFE | ||
166 | |||
167 | /* Mailbox 3 headers */ | ||
168 | #define MB3H_ANC 0x0 | ||
169 | #define MB3H_SIDETONE 0x1 | ||
170 | #define MB3H_SYSCLK 0xE | ||
171 | |||
172 | /* Mailbox 3 Requests */ | ||
173 | #define PRCM_REQ_MB3_ANC_FIR_COEFF (PRCM_REQ_MB3 + 0x0) | ||
174 | #define PRCM_REQ_MB3_ANC_IIR_COEFF (PRCM_REQ_MB3 + 0x20) | ||
175 | #define PRCM_REQ_MB3_ANC_SHIFTER (PRCM_REQ_MB3 + 0x60) | ||
176 | #define PRCM_REQ_MB3_ANC_WARP (PRCM_REQ_MB3 + 0x64) | ||
177 | #define PRCM_REQ_MB3_SIDETONE_FIR_GAIN (PRCM_REQ_MB3 + 0x68) | ||
178 | #define PRCM_REQ_MB3_SIDETONE_FIR_COEFF (PRCM_REQ_MB3 + 0x6C) | ||
179 | #define PRCM_REQ_MB3_SYSCLK_MGT (PRCM_REQ_MB3 + 0x16C) | ||
180 | |||
181 | /* Mailbox 4 headers */ | ||
182 | #define MB4H_DDR_INIT 0x0 | ||
183 | #define MB4H_MEM_ST 0x1 | ||
184 | #define MB4H_HOTDOG 0x12 | ||
185 | #define MB4H_HOTMON 0x13 | ||
186 | #define MB4H_HOT_PERIOD 0x14 | ||
187 | |||
188 | /* Mailbox 4 Requests */ | ||
189 | #define PRCM_REQ_MB4_DDR_ST_AP_SLEEP_IDLE (PRCM_REQ_MB4 + 0x0) | ||
190 | #define PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE (PRCM_REQ_MB4 + 0x1) | ||
191 | #define PRCM_REQ_MB4_ESRAM0_ST (PRCM_REQ_MB4 + 0x3) | ||
192 | #define PRCM_REQ_MB4_HOTDOG_THRESHOLD (PRCM_REQ_MB4 + 0x0) | ||
193 | #define PRCM_REQ_MB4_HOTMON_LOW (PRCM_REQ_MB4 + 0x0) | ||
194 | #define PRCM_REQ_MB4_HOTMON_HIGH (PRCM_REQ_MB4 + 0x1) | ||
195 | #define PRCM_REQ_MB4_HOTMON_CONFIG (PRCM_REQ_MB4 + 0x2) | ||
196 | #define PRCM_REQ_MB4_HOT_PERIOD (PRCM_REQ_MB4 + 0x0) | ||
197 | #define HOTMON_CONFIG_LOW BIT(0) | ||
198 | #define HOTMON_CONFIG_HIGH BIT(1) | ||
199 | |||
200 | /* Mailbox 5 Requests */ | ||
201 | #define PRCM_REQ_MB5_I2C_SLAVE_OP (PRCM_REQ_MB5 + 0x0) | ||
202 | #define PRCM_REQ_MB5_I2C_HW_BITS (PRCM_REQ_MB5 + 0x1) | ||
203 | #define PRCM_REQ_MB5_I2C_REG (PRCM_REQ_MB5 + 0x2) | ||
204 | #define PRCM_REQ_MB5_I2C_VAL (PRCM_REQ_MB5 + 0x3) | ||
205 | #define PRCMU_I2C_WRITE(slave) \ | ||
206 | (((slave) << 1) | (cpu_is_u8500v2() ? BIT(6) : 0)) | ||
207 | #define PRCMU_I2C_READ(slave) \ | ||
208 | (((slave) << 1) | BIT(0) | (cpu_is_u8500v2() ? BIT(6) : 0)) | ||
209 | #define PRCMU_I2C_STOP_EN BIT(3) | ||
210 | |||
211 | /* Mailbox 5 ACKs */ | ||
212 | #define PRCM_ACK_MB5_I2C_STATUS (PRCM_ACK_MB5 + 0x1) | ||
213 | #define PRCM_ACK_MB5_I2C_VAL (PRCM_ACK_MB5 + 0x3) | ||
214 | #define I2C_WR_OK 0x1 | ||
215 | #define I2C_RD_OK 0x2 | ||
216 | |||
217 | #define NUM_MB 8 | ||
218 | #define MBOX_BIT BIT | ||
219 | #define ALL_MBOX_BITS (MBOX_BIT(NUM_MB) - 1) | ||
220 | |||
221 | /* | ||
222 | * Wakeups/IRQs | ||
223 | */ | ||
224 | |||
225 | #define WAKEUP_BIT_RTC BIT(0) | ||
226 | #define WAKEUP_BIT_RTT0 BIT(1) | ||
227 | #define WAKEUP_BIT_RTT1 BIT(2) | ||
228 | #define WAKEUP_BIT_HSI0 BIT(3) | ||
229 | #define WAKEUP_BIT_HSI1 BIT(4) | ||
230 | #define WAKEUP_BIT_CA_WAKE BIT(5) | ||
231 | #define WAKEUP_BIT_USB BIT(6) | ||
232 | #define WAKEUP_BIT_ABB BIT(7) | ||
233 | #define WAKEUP_BIT_ABB_FIFO BIT(8) | ||
234 | #define WAKEUP_BIT_SYSCLK_OK BIT(9) | ||
235 | #define WAKEUP_BIT_CA_SLEEP BIT(10) | ||
236 | #define WAKEUP_BIT_AC_WAKE_ACK BIT(11) | ||
237 | #define WAKEUP_BIT_SIDE_TONE_OK BIT(12) | ||
238 | #define WAKEUP_BIT_ANC_OK BIT(13) | ||
239 | #define WAKEUP_BIT_SW_ERROR BIT(14) | ||
240 | #define WAKEUP_BIT_AC_SLEEP_ACK BIT(15) | ||
241 | #define WAKEUP_BIT_ARM BIT(17) | ||
242 | #define WAKEUP_BIT_HOTMON_LOW BIT(18) | ||
243 | #define WAKEUP_BIT_HOTMON_HIGH BIT(19) | ||
244 | #define WAKEUP_BIT_MODEM_SW_RESET_REQ BIT(20) | ||
245 | #define WAKEUP_BIT_GPIO0 BIT(23) | ||
246 | #define WAKEUP_BIT_GPIO1 BIT(24) | ||
247 | #define WAKEUP_BIT_GPIO2 BIT(25) | ||
248 | #define WAKEUP_BIT_GPIO3 BIT(26) | ||
249 | #define WAKEUP_BIT_GPIO4 BIT(27) | ||
250 | #define WAKEUP_BIT_GPIO5 BIT(28) | ||
251 | #define WAKEUP_BIT_GPIO6 BIT(29) | ||
252 | #define WAKEUP_BIT_GPIO7 BIT(30) | ||
253 | #define WAKEUP_BIT_GPIO8 BIT(31) | ||
254 | |||
255 | /* | ||
256 | * This vector maps irq numbers to the bits in the bit field used in | ||
257 | * communication with the PRCMU firmware. | ||
258 | * | ||
259 | * The reason for having this is to keep the irq numbers contiguous even though | ||
260 | * the bits in the bit field are not. (The bits also have a tendency to move | ||
261 | * around, to further complicate matters.) | ||
262 | */ | ||
263 | #define IRQ_INDEX(_name) ((IRQ_PRCMU_##_name) - IRQ_PRCMU_BASE) | ||
264 | #define IRQ_ENTRY(_name)[IRQ_INDEX(_name)] = (WAKEUP_BIT_##_name) | ||
265 | static u32 prcmu_irq_bit[NUM_PRCMU_WAKEUPS] = { | ||
266 | IRQ_ENTRY(RTC), | ||
267 | IRQ_ENTRY(RTT0), | ||
268 | IRQ_ENTRY(RTT1), | ||
269 | IRQ_ENTRY(HSI0), | ||
270 | IRQ_ENTRY(HSI1), | ||
271 | IRQ_ENTRY(CA_WAKE), | ||
272 | IRQ_ENTRY(USB), | ||
273 | IRQ_ENTRY(ABB), | ||
274 | IRQ_ENTRY(ABB_FIFO), | ||
275 | IRQ_ENTRY(CA_SLEEP), | ||
276 | IRQ_ENTRY(ARM), | ||
277 | IRQ_ENTRY(HOTMON_LOW), | ||
278 | IRQ_ENTRY(HOTMON_HIGH), | ||
279 | IRQ_ENTRY(MODEM_SW_RESET_REQ), | ||
280 | IRQ_ENTRY(GPIO0), | ||
281 | IRQ_ENTRY(GPIO1), | ||
282 | IRQ_ENTRY(GPIO2), | ||
283 | IRQ_ENTRY(GPIO3), | ||
284 | IRQ_ENTRY(GPIO4), | ||
285 | IRQ_ENTRY(GPIO5), | ||
286 | IRQ_ENTRY(GPIO6), | ||
287 | IRQ_ENTRY(GPIO7), | ||
288 | IRQ_ENTRY(GPIO8) | ||
289 | }; | ||
290 | |||
291 | #define VALID_WAKEUPS (BIT(NUM_PRCMU_WAKEUP_INDICES) - 1) | ||
292 | #define WAKEUP_ENTRY(_name)[PRCMU_WAKEUP_INDEX_##_name] = (WAKEUP_BIT_##_name) | ||
293 | static u32 prcmu_wakeup_bit[NUM_PRCMU_WAKEUP_INDICES] = { | ||
294 | WAKEUP_ENTRY(RTC), | ||
295 | WAKEUP_ENTRY(RTT0), | ||
296 | WAKEUP_ENTRY(RTT1), | ||
297 | WAKEUP_ENTRY(HSI0), | ||
298 | WAKEUP_ENTRY(HSI1), | ||
299 | WAKEUP_ENTRY(USB), | ||
300 | WAKEUP_ENTRY(ABB), | ||
301 | WAKEUP_ENTRY(ABB_FIFO), | ||
302 | WAKEUP_ENTRY(ARM) | ||
303 | }; | ||
304 | |||
305 | /* | ||
306 | * mb0_transfer - state needed for mailbox 0 communication. | ||
307 | * @lock: The transaction lock. | ||
308 | * @dbb_events_lock: A lock used to handle concurrent access to (parts of) | ||
309 | * the request data. | ||
310 | * @mask_work: Work structure used for (un)masking wakeup interrupts. | ||
311 | * @req: Request data that need to persist between requests. | ||
312 | */ | ||
313 | static struct { | ||
314 | spinlock_t lock; | ||
315 | spinlock_t dbb_irqs_lock; | ||
316 | struct work_struct mask_work; | ||
317 | struct mutex ac_wake_lock; | ||
318 | struct completion ac_wake_work; | ||
319 | struct { | ||
320 | u32 dbb_irqs; | ||
321 | u32 dbb_wakeups; | ||
322 | u32 abb_events; | ||
323 | } req; | ||
324 | } mb0_transfer; | ||
325 | |||
326 | /* | ||
327 | * mb1_transfer - state needed for mailbox 1 communication. | ||
328 | * @lock: The transaction lock. | ||
329 | * @work: The transaction completion structure. | ||
330 | * @ack: Reply ("acknowledge") data. | ||
331 | */ | ||
332 | static struct { | ||
333 | struct mutex lock; | ||
334 | struct completion work; | ||
335 | struct { | ||
336 | u8 header; | ||
337 | u8 arm_opp; | ||
338 | u8 ape_opp; | ||
339 | u8 ape_voltage_status; | ||
340 | } ack; | ||
341 | } mb1_transfer; | ||
342 | |||
343 | /* | ||
344 | * mb2_transfer - state needed for mailbox 2 communication. | ||
345 | * @lock: The transaction lock. | ||
346 | * @work: The transaction completion structure. | ||
347 | * @auto_pm_lock: The autonomous power management configuration lock. | ||
348 | * @auto_pm_enabled: A flag indicating whether autonomous PM is enabled. | ||
349 | * @req: Request data that need to persist between requests. | ||
350 | * @ack: Reply ("acknowledge") data. | ||
351 | */ | ||
352 | static struct { | ||
353 | struct mutex lock; | ||
354 | struct completion work; | ||
355 | spinlock_t auto_pm_lock; | ||
356 | bool auto_pm_enabled; | ||
357 | struct { | ||
358 | u8 status; | ||
359 | } ack; | ||
360 | } mb2_transfer; | ||
361 | |||
362 | /* | ||
363 | * mb3_transfer - state needed for mailbox 3 communication. | ||
364 | * @lock: The request lock. | ||
365 | * @sysclk_lock: A lock used to handle concurrent sysclk requests. | ||
366 | * @sysclk_work: Work structure used for sysclk requests. | ||
367 | */ | ||
368 | static struct { | ||
369 | spinlock_t lock; | ||
370 | struct mutex sysclk_lock; | ||
371 | struct completion sysclk_work; | ||
372 | } mb3_transfer; | ||
373 | |||
374 | /* | ||
375 | * mb4_transfer - state needed for mailbox 4 communication. | ||
376 | * @lock: The transaction lock. | ||
377 | * @work: The transaction completion structure. | ||
378 | */ | ||
379 | static struct { | ||
380 | struct mutex lock; | ||
381 | struct completion work; | ||
382 | } mb4_transfer; | ||
383 | |||
384 | /* | ||
385 | * mb5_transfer - state needed for mailbox 5 communication. | ||
386 | * @lock: The transaction lock. | ||
387 | * @work: The transaction completion structure. | ||
388 | * @ack: Reply ("acknowledge") data. | ||
389 | */ | ||
390 | static struct { | ||
391 | struct mutex lock; | ||
392 | struct completion work; | ||
393 | struct { | ||
394 | u8 status; | ||
395 | u8 value; | ||
396 | } ack; | ||
397 | } mb5_transfer; | ||
398 | |||
399 | static atomic_t ac_wake_req_state = ATOMIC_INIT(0); | ||
400 | |||
401 | /* Spinlocks */ | ||
402 | static DEFINE_SPINLOCK(clkout_lock); | ||
403 | static DEFINE_SPINLOCK(gpiocr_lock); | ||
404 | |||
405 | /* Global var to runtime determine TCDM base for v2 or v1 */ | ||
406 | static __iomem void *tcdm_base; | ||
407 | |||
408 | struct clk_mgt { | ||
409 | unsigned int offset; | ||
410 | u32 pllsw; | ||
411 | }; | ||
412 | |||
413 | static DEFINE_SPINLOCK(clk_mgt_lock); | ||
414 | |||
415 | #define CLK_MGT_ENTRY(_name)[PRCMU_##_name] = { (PRCM_##_name##_MGT), 0 } | ||
416 | struct clk_mgt clk_mgt[PRCMU_NUM_REG_CLOCKS] = { | ||
417 | CLK_MGT_ENTRY(SGACLK), | ||
418 | CLK_MGT_ENTRY(UARTCLK), | ||
419 | CLK_MGT_ENTRY(MSP02CLK), | ||
420 | CLK_MGT_ENTRY(MSP1CLK), | ||
421 | CLK_MGT_ENTRY(I2CCLK), | ||
422 | CLK_MGT_ENTRY(SDMMCCLK), | ||
423 | CLK_MGT_ENTRY(SLIMCLK), | ||
424 | CLK_MGT_ENTRY(PER1CLK), | ||
425 | CLK_MGT_ENTRY(PER2CLK), | ||
426 | CLK_MGT_ENTRY(PER3CLK), | ||
427 | CLK_MGT_ENTRY(PER5CLK), | ||
428 | CLK_MGT_ENTRY(PER6CLK), | ||
429 | CLK_MGT_ENTRY(PER7CLK), | ||
430 | CLK_MGT_ENTRY(LCDCLK), | ||
431 | CLK_MGT_ENTRY(BMLCLK), | ||
432 | CLK_MGT_ENTRY(HSITXCLK), | ||
433 | CLK_MGT_ENTRY(HSIRXCLK), | ||
434 | CLK_MGT_ENTRY(HDMICLK), | ||
435 | CLK_MGT_ENTRY(APEATCLK), | ||
436 | CLK_MGT_ENTRY(APETRACECLK), | ||
437 | CLK_MGT_ENTRY(MCDECLK), | ||
438 | CLK_MGT_ENTRY(IPI2CCLK), | ||
439 | CLK_MGT_ENTRY(DSIALTCLK), | ||
440 | CLK_MGT_ENTRY(DMACLK), | ||
441 | CLK_MGT_ENTRY(B2R2CLK), | ||
442 | CLK_MGT_ENTRY(TVCLK), | ||
443 | CLK_MGT_ENTRY(SSPCLK), | ||
444 | CLK_MGT_ENTRY(RNGCLK), | ||
445 | CLK_MGT_ENTRY(UICCCLK), | ||
446 | }; | ||
447 | |||
448 | /* | ||
449 | * Used by MCDE to setup all necessary PRCMU registers | ||
450 | */ | ||
451 | #define PRCMU_RESET_DSIPLL 0x00004000 | ||
452 | #define PRCMU_UNCLAMP_DSIPLL 0x00400800 | ||
453 | |||
454 | #define PRCMU_CLK_PLL_DIV_SHIFT 0 | ||
455 | #define PRCMU_CLK_PLL_SW_SHIFT 5 | ||
456 | #define PRCMU_CLK_38 (1 << 9) | ||
457 | #define PRCMU_CLK_38_SRC (1 << 10) | ||
458 | #define PRCMU_CLK_38_DIV (1 << 11) | ||
459 | |||
460 | /* PLLDIV=12, PLLSW=4 (PLLDDR) */ | ||
461 | #define PRCMU_DSI_CLOCK_SETTING 0x0000008C | ||
462 | |||
463 | /* PLLDIV=8, PLLSW=4 (PLLDDR) */ | ||
464 | #define PRCMU_DSI_CLOCK_SETTING_U8400 0x00000088 | ||
465 | |||
466 | /* DPI 50000000 Hz */ | ||
467 | #define PRCMU_DPI_CLOCK_SETTING ((1 << PRCMU_CLK_PLL_SW_SHIFT) | \ | ||
468 | (16 << PRCMU_CLK_PLL_DIV_SHIFT)) | ||
469 | #define PRCMU_DSI_LP_CLOCK_SETTING 0x00000E00 | ||
470 | |||
471 | /* D=101, N=1, R=4, SELDIV2=0 */ | ||
472 | #define PRCMU_PLLDSI_FREQ_SETTING 0x00040165 | ||
473 | |||
474 | /* D=70, N=1, R=3, SELDIV2=0 */ | ||
475 | #define PRCMU_PLLDSI_FREQ_SETTING_U8400 0x00030146 | ||
476 | |||
477 | #define PRCMU_ENABLE_PLLDSI 0x00000001 | ||
478 | #define PRCMU_DISABLE_PLLDSI 0x00000000 | ||
479 | #define PRCMU_RELEASE_RESET_DSS 0x0000400C | ||
480 | #define PRCMU_DSI_PLLOUT_SEL_SETTING 0x00000202 | ||
481 | /* ESC clk, div0=1, div1=1, div2=3 */ | ||
482 | #define PRCMU_ENABLE_ESCAPE_CLOCK_DIV 0x07030101 | ||
483 | #define PRCMU_DISABLE_ESCAPE_CLOCK_DIV 0x00030101 | ||
484 | #define PRCMU_DSI_RESET_SW 0x00000007 | ||
485 | |||
486 | #define PRCMU_PLLDSI_LOCKP_LOCKED 0x3 | ||
487 | |||
488 | static struct { | ||
489 | u8 project_number; | ||
490 | u8 api_version; | ||
491 | u8 func_version; | ||
492 | u8 errata; | ||
493 | } prcmu_version; | ||
494 | |||
495 | |||
496 | int prcmu_enable_dsipll(void) | ||
497 | { | ||
498 | int i; | ||
499 | unsigned int plldsifreq; | ||
500 | |||
501 | /* Clear DSIPLL_RESETN */ | ||
502 | writel(PRCMU_RESET_DSIPLL, (_PRCMU_BASE + PRCM_APE_RESETN_CLR)); | ||
503 | /* Unclamp DSIPLL in/out */ | ||
504 | writel(PRCMU_UNCLAMP_DSIPLL, (_PRCMU_BASE + PRCM_MMIP_LS_CLAMP_CLR)); | ||
505 | |||
506 | if (prcmu_is_u8400()) | ||
507 | plldsifreq = PRCMU_PLLDSI_FREQ_SETTING_U8400; | ||
508 | else | ||
509 | plldsifreq = PRCMU_PLLDSI_FREQ_SETTING; | ||
510 | /* Set DSI PLL FREQ */ | ||
511 | writel(plldsifreq, (_PRCMU_BASE + PRCM_PLLDSI_FREQ)); | ||
512 | writel(PRCMU_DSI_PLLOUT_SEL_SETTING, | ||
513 | (_PRCMU_BASE + PRCM_DSI_PLLOUT_SEL)); | ||
514 | /* Enable Escape clocks */ | ||
515 | writel(PRCMU_ENABLE_ESCAPE_CLOCK_DIV, | ||
516 | (_PRCMU_BASE + PRCM_DSITVCLK_DIV)); | ||
517 | |||
518 | /* Start DSI PLL */ | ||
519 | writel(PRCMU_ENABLE_PLLDSI, (_PRCMU_BASE + PRCM_PLLDSI_ENABLE)); | ||
520 | /* Reset DSI PLL */ | ||
521 | writel(PRCMU_DSI_RESET_SW, (_PRCMU_BASE + PRCM_DSI_SW_RESET)); | ||
522 | for (i = 0; i < 10; i++) { | ||
523 | if ((readl(_PRCMU_BASE + PRCM_PLLDSI_LOCKP) & | ||
524 | PRCMU_PLLDSI_LOCKP_LOCKED) | ||
525 | == PRCMU_PLLDSI_LOCKP_LOCKED) | ||
526 | break; | ||
527 | udelay(100); | ||
528 | } | ||
529 | /* Set DSIPLL_RESETN */ | ||
530 | writel(PRCMU_RESET_DSIPLL, (_PRCMU_BASE + PRCM_APE_RESETN_SET)); | ||
531 | return 0; | ||
532 | } | ||
533 | |||
534 | int prcmu_disable_dsipll(void) | ||
535 | { | ||
536 | /* Disable dsi pll */ | ||
537 | writel(PRCMU_DISABLE_PLLDSI, (_PRCMU_BASE + PRCM_PLLDSI_ENABLE)); | ||
538 | /* Disable escapeclock */ | ||
539 | writel(PRCMU_DISABLE_ESCAPE_CLOCK_DIV, | ||
540 | (_PRCMU_BASE + PRCM_DSITVCLK_DIV)); | ||
541 | return 0; | ||
542 | } | ||
543 | |||
544 | int prcmu_set_display_clocks(void) | ||
545 | { | ||
546 | unsigned long flags; | ||
547 | unsigned int dsiclk; | ||
548 | |||
549 | if (prcmu_is_u8400()) | ||
550 | dsiclk = PRCMU_DSI_CLOCK_SETTING_U8400; | ||
551 | else | ||
552 | dsiclk = PRCMU_DSI_CLOCK_SETTING; | ||
553 | |||
554 | spin_lock_irqsave(&clk_mgt_lock, flags); | ||
555 | |||
556 | /* Grab the HW semaphore. */ | ||
557 | while ((readl(_PRCMU_BASE + PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0) | ||
558 | cpu_relax(); | ||
559 | |||
560 | writel(dsiclk, (_PRCMU_BASE + PRCM_HDMICLK_MGT)); | ||
561 | writel(PRCMU_DSI_LP_CLOCK_SETTING, (_PRCMU_BASE + PRCM_TVCLK_MGT)); | ||
562 | writel(PRCMU_DPI_CLOCK_SETTING, (_PRCMU_BASE + PRCM_LCDCLK_MGT)); | ||
563 | |||
564 | /* Release the HW semaphore. */ | ||
565 | writel(0, (_PRCMU_BASE + PRCM_SEM)); | ||
566 | |||
567 | spin_unlock_irqrestore(&clk_mgt_lock, flags); | ||
568 | |||
569 | return 0; | ||
570 | } | ||
571 | |||
572 | /** | ||
573 | * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1. | ||
574 | */ | ||
575 | void prcmu_enable_spi2(void) | ||
576 | { | ||
577 | u32 reg; | ||
578 | unsigned long flags; | ||
579 | |||
580 | spin_lock_irqsave(&gpiocr_lock, flags); | ||
581 | reg = readl(_PRCMU_BASE + PRCM_GPIOCR); | ||
582 | writel(reg | PRCM_GPIOCR_SPI2_SELECT, _PRCMU_BASE + PRCM_GPIOCR); | ||
583 | spin_unlock_irqrestore(&gpiocr_lock, flags); | ||
584 | } | ||
585 | |||
586 | /** | ||
587 | * prcmu_disable_spi2 - Disables pin muxing for SPI2 on OtherAlternateC1. | ||
588 | */ | ||
589 | void prcmu_disable_spi2(void) | ||
590 | { | ||
591 | u32 reg; | ||
592 | unsigned long flags; | ||
593 | |||
594 | spin_lock_irqsave(&gpiocr_lock, flags); | ||
595 | reg = readl(_PRCMU_BASE + PRCM_GPIOCR); | ||
596 | writel(reg & ~PRCM_GPIOCR_SPI2_SELECT, _PRCMU_BASE + PRCM_GPIOCR); | ||
597 | spin_unlock_irqrestore(&gpiocr_lock, flags); | ||
598 | } | ||
599 | |||
600 | bool prcmu_has_arm_maxopp(void) | ||
601 | { | ||
602 | return (readb(tcdm_base + PRCM_AVS_VARM_MAX_OPP) & | ||
603 | PRCM_AVS_ISMODEENABLE_MASK) == PRCM_AVS_ISMODEENABLE_MASK; | ||
604 | } | ||
605 | |||
606 | bool prcmu_is_u8400(void) | ||
607 | { | ||
608 | return prcmu_version.project_number == PRCMU_PROJECT_ID_8400V2_0; | ||
609 | } | ||
610 | |||
611 | /** | ||
612 | * prcmu_get_boot_status - PRCMU boot status checking | ||
613 | * Returns: the current PRCMU boot status | ||
614 | */ | ||
615 | int prcmu_get_boot_status(void) | ||
616 | { | ||
617 | return readb(tcdm_base + PRCM_BOOT_STATUS); | ||
618 | } | ||
619 | |||
620 | /** | ||
621 | * prcmu_set_rc_a2p - This function is used to run few power state sequences | ||
622 | * @val: Value to be set, i.e. transition requested | ||
623 | * Returns: 0 on success, -EINVAL on invalid argument | ||
624 | * | ||
625 | * This function is used to run the following power state sequences - | ||
626 | * any state to ApReset, ApDeepSleep to ApExecute, ApExecute to ApDeepSleep | ||
627 | */ | ||
628 | int prcmu_set_rc_a2p(enum romcode_write val) | ||
629 | { | ||
630 | if (val < RDY_2_DS || val > RDY_2_XP70_RST) | ||
631 | return -EINVAL; | ||
632 | writeb(val, (tcdm_base + PRCM_ROMCODE_A2P)); | ||
633 | return 0; | ||
634 | } | ||
635 | |||
636 | /** | ||
637 | * prcmu_get_rc_p2a - This function is used to get power state sequences | ||
638 | * Returns: the power transition that has last happened | ||
639 | * | ||
640 | * This function can return the following transitions- | ||
641 | * any state to ApReset, ApDeepSleep to ApExecute, ApExecute to ApDeepSleep | ||
642 | */ | ||
643 | enum romcode_read prcmu_get_rc_p2a(void) | ||
644 | { | ||
645 | return readb(tcdm_base + PRCM_ROMCODE_P2A); | ||
646 | } | ||
647 | |||
648 | /** | ||
649 | * prcmu_get_current_mode - Return the current XP70 power mode | ||
650 | * Returns: Returns the current AP(ARM) power mode: init, | ||
651 | * apBoot, apExecute, apDeepSleep, apSleep, apIdle, apReset | ||
652 | */ | ||
653 | enum ap_pwrst prcmu_get_xp70_current_state(void) | ||
654 | { | ||
655 | return readb(tcdm_base + PRCM_XP70_CUR_PWR_STATE); | ||
656 | } | ||
657 | |||
658 | /** | ||
659 | * prcmu_config_clkout - Configure one of the programmable clock outputs. | ||
660 | * @clkout: The CLKOUT number (0 or 1). | ||
661 | * @source: The clock to be used (one of the PRCMU_CLKSRC_*). | ||
662 | * @div: The divider to be applied. | ||
663 | * | ||
664 | * Configures one of the programmable clock outputs (CLKOUTs). | ||
665 | * @div should be in the range [1,63] to request a configuration, or 0 to | ||
666 | * inform that the configuration is no longer requested. | ||
667 | */ | ||
668 | int prcmu_config_clkout(u8 clkout, u8 source, u8 div) | ||
669 | { | ||
670 | static int requests[2]; | ||
671 | int r = 0; | ||
672 | unsigned long flags; | ||
673 | u32 val; | ||
674 | u32 bits; | ||
675 | u32 mask; | ||
676 | u32 div_mask; | ||
677 | |||
678 | BUG_ON(clkout > 1); | ||
679 | BUG_ON(div > 63); | ||
680 | BUG_ON((clkout == 0) && (source > PRCMU_CLKSRC_CLK009)); | ||
681 | |||
682 | if (!div && !requests[clkout]) | ||
683 | return -EINVAL; | ||
684 | |||
685 | switch (clkout) { | ||
686 | case 0: | ||
687 | div_mask = PRCM_CLKOCR_CLKODIV0_MASK; | ||
688 | mask = (PRCM_CLKOCR_CLKODIV0_MASK | PRCM_CLKOCR_CLKOSEL0_MASK); | ||
689 | bits = ((source << PRCM_CLKOCR_CLKOSEL0_SHIFT) | | ||
690 | (div << PRCM_CLKOCR_CLKODIV0_SHIFT)); | ||
691 | break; | ||
692 | case 1: | ||
693 | div_mask = PRCM_CLKOCR_CLKODIV1_MASK; | ||
694 | mask = (PRCM_CLKOCR_CLKODIV1_MASK | PRCM_CLKOCR_CLKOSEL1_MASK | | ||
695 | PRCM_CLKOCR_CLK1TYPE); | ||
696 | bits = ((source << PRCM_CLKOCR_CLKOSEL1_SHIFT) | | ||
697 | (div << PRCM_CLKOCR_CLKODIV1_SHIFT)); | ||
698 | break; | ||
699 | } | ||
700 | bits &= mask; | ||
701 | |||
702 | spin_lock_irqsave(&clkout_lock, flags); | ||
703 | |||
704 | val = readl(_PRCMU_BASE + PRCM_CLKOCR); | ||
705 | if (val & div_mask) { | ||
706 | if (div) { | ||
707 | if ((val & mask) != bits) { | ||
708 | r = -EBUSY; | ||
709 | goto unlock_and_return; | ||
710 | } | ||
711 | } else { | ||
712 | if ((val & mask & ~div_mask) != bits) { | ||
713 | r = -EINVAL; | ||
714 | goto unlock_and_return; | ||
715 | } | ||
716 | } | ||
717 | } | ||
718 | writel((bits | (val & ~mask)), (_PRCMU_BASE + PRCM_CLKOCR)); | ||
719 | requests[clkout] += (div ? 1 : -1); | ||
720 | |||
721 | unlock_and_return: | ||
722 | spin_unlock_irqrestore(&clkout_lock, flags); | ||
723 | |||
724 | return r; | ||
725 | } | ||
726 | |||
727 | int prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll) | ||
728 | { | ||
729 | unsigned long flags; | ||
730 | |||
731 | BUG_ON((state < PRCMU_AP_SLEEP) || (PRCMU_AP_DEEP_IDLE < state)); | ||
732 | |||
733 | spin_lock_irqsave(&mb0_transfer.lock, flags); | ||
734 | |||
735 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(0)) | ||
736 | cpu_relax(); | ||
737 | |||
738 | writeb(MB0H_POWER_STATE_TRANS, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB0)); | ||
739 | writeb(state, (tcdm_base + PRCM_REQ_MB0_AP_POWER_STATE)); | ||
740 | writeb((keep_ap_pll ? 1 : 0), (tcdm_base + PRCM_REQ_MB0_AP_PLL_STATE)); | ||
741 | writeb((keep_ulp_clk ? 1 : 0), | ||
742 | (tcdm_base + PRCM_REQ_MB0_ULP_CLOCK_STATE)); | ||
743 | writeb(0, (tcdm_base + PRCM_REQ_MB0_DO_NOT_WFI)); | ||
744 | writel(MBOX_BIT(0), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
745 | |||
746 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); | ||
747 | |||
748 | return 0; | ||
749 | } | ||
750 | |||
751 | /* This function should only be called while mb0_transfer.lock is held. */ | ||
752 | static void config_wakeups(void) | ||
753 | { | ||
754 | const u8 header[2] = { | ||
755 | MB0H_CONFIG_WAKEUPS_EXE, | ||
756 | MB0H_CONFIG_WAKEUPS_SLEEP | ||
757 | }; | ||
758 | static u32 last_dbb_events; | ||
759 | static u32 last_abb_events; | ||
760 | u32 dbb_events; | ||
761 | u32 abb_events; | ||
762 | unsigned int i; | ||
763 | |||
764 | dbb_events = mb0_transfer.req.dbb_irqs | mb0_transfer.req.dbb_wakeups; | ||
765 | dbb_events |= (WAKEUP_BIT_AC_WAKE_ACK | WAKEUP_BIT_AC_SLEEP_ACK); | ||
766 | |||
767 | abb_events = mb0_transfer.req.abb_events; | ||
768 | |||
769 | if ((dbb_events == last_dbb_events) && (abb_events == last_abb_events)) | ||
770 | return; | ||
771 | |||
772 | for (i = 0; i < 2; i++) { | ||
773 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(0)) | ||
774 | cpu_relax(); | ||
775 | writel(dbb_events, (tcdm_base + PRCM_REQ_MB0_WAKEUP_8500)); | ||
776 | writel(abb_events, (tcdm_base + PRCM_REQ_MB0_WAKEUP_4500)); | ||
777 | writeb(header[i], (tcdm_base + PRCM_MBOX_HEADER_REQ_MB0)); | ||
778 | writel(MBOX_BIT(0), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
779 | } | ||
780 | last_dbb_events = dbb_events; | ||
781 | last_abb_events = abb_events; | ||
782 | } | ||
783 | |||
784 | void prcmu_enable_wakeups(u32 wakeups) | ||
785 | { | ||
786 | unsigned long flags; | ||
787 | u32 bits; | ||
788 | int i; | ||
789 | |||
790 | BUG_ON(wakeups != (wakeups & VALID_WAKEUPS)); | ||
791 | |||
792 | for (i = 0, bits = 0; i < NUM_PRCMU_WAKEUP_INDICES; i++) { | ||
793 | if (wakeups & BIT(i)) | ||
794 | bits |= prcmu_wakeup_bit[i]; | ||
795 | } | ||
796 | |||
797 | spin_lock_irqsave(&mb0_transfer.lock, flags); | ||
798 | |||
799 | mb0_transfer.req.dbb_wakeups = bits; | ||
800 | config_wakeups(); | ||
801 | |||
802 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); | ||
803 | } | ||
804 | |||
805 | void prcmu_config_abb_event_readout(u32 abb_events) | ||
806 | { | ||
807 | unsigned long flags; | ||
808 | |||
809 | spin_lock_irqsave(&mb0_transfer.lock, flags); | ||
810 | |||
811 | mb0_transfer.req.abb_events = abb_events; | ||
812 | config_wakeups(); | ||
813 | |||
814 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); | ||
815 | } | ||
816 | |||
817 | void prcmu_get_abb_event_buffer(void __iomem **buf) | ||
818 | { | ||
819 | if (readb(tcdm_base + PRCM_ACK_MB0_READ_POINTER) & 1) | ||
820 | *buf = (tcdm_base + PRCM_ACK_MB0_WAKEUP_1_4500); | ||
821 | else | ||
822 | *buf = (tcdm_base + PRCM_ACK_MB0_WAKEUP_0_4500); | ||
823 | } | ||
824 | |||
825 | /** | ||
826 | * prcmu_set_arm_opp - set the appropriate ARM OPP | ||
827 | * @opp: The new ARM operating point to which transition is to be made | ||
828 | * Returns: 0 on success, non-zero on failure | ||
829 | * | ||
830 | * This function sets the the operating point of the ARM. | ||
831 | */ | ||
832 | int prcmu_set_arm_opp(u8 opp) | ||
833 | { | ||
834 | int r; | ||
835 | |||
836 | if (opp < ARM_NO_CHANGE || opp > ARM_EXTCLK) | ||
837 | return -EINVAL; | ||
838 | |||
839 | r = 0; | ||
840 | |||
841 | mutex_lock(&mb1_transfer.lock); | ||
842 | |||
843 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) | ||
844 | cpu_relax(); | ||
845 | |||
846 | writeb(MB1H_ARM_APE_OPP, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); | ||
847 | writeb(opp, (tcdm_base + PRCM_REQ_MB1_ARM_OPP)); | ||
848 | writeb(APE_NO_CHANGE, (tcdm_base + PRCM_REQ_MB1_APE_OPP)); | ||
849 | |||
850 | writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
851 | wait_for_completion(&mb1_transfer.work); | ||
852 | |||
853 | if ((mb1_transfer.ack.header != MB1H_ARM_APE_OPP) || | ||
854 | (mb1_transfer.ack.arm_opp != opp)) | ||
855 | r = -EIO; | ||
856 | |||
857 | mutex_unlock(&mb1_transfer.lock); | ||
858 | |||
859 | return r; | ||
860 | } | ||
861 | |||
862 | /** | ||
863 | * prcmu_get_arm_opp - get the current ARM OPP | ||
864 | * | ||
865 | * Returns: the current ARM OPP | ||
866 | */ | ||
867 | int prcmu_get_arm_opp(void) | ||
868 | { | ||
869 | return readb(tcdm_base + PRCM_ACK_MB1_CURRENT_ARM_OPP); | ||
870 | } | ||
871 | |||
872 | /** | ||
873 | * prcmu_get_ddr_opp - get the current DDR OPP | ||
874 | * | ||
875 | * Returns: the current DDR OPP | ||
876 | */ | ||
877 | int prcmu_get_ddr_opp(void) | ||
878 | { | ||
879 | return readb(_PRCMU_BASE + PRCM_DDR_SUBSYS_APE_MINBW); | ||
880 | } | ||
881 | |||
882 | /** | ||
883 | * set_ddr_opp - set the appropriate DDR OPP | ||
884 | * @opp: The new DDR operating point to which transition is to be made | ||
885 | * Returns: 0 on success, non-zero on failure | ||
886 | * | ||
887 | * This function sets the operating point of the DDR. | ||
888 | */ | ||
889 | int prcmu_set_ddr_opp(u8 opp) | ||
890 | { | ||
891 | if (opp < DDR_100_OPP || opp > DDR_25_OPP) | ||
892 | return -EINVAL; | ||
893 | /* Changing the DDR OPP can hang the hardware pre-v21 */ | ||
894 | if (cpu_is_u8500v20_or_later() && !cpu_is_u8500v20()) | ||
895 | writeb(opp, (_PRCMU_BASE + PRCM_DDR_SUBSYS_APE_MINBW)); | ||
896 | |||
897 | return 0; | ||
898 | } | ||
899 | /** | ||
900 | * set_ape_opp - set the appropriate APE OPP | ||
901 | * @opp: The new APE operating point to which transition is to be made | ||
902 | * Returns: 0 on success, non-zero on failure | ||
903 | * | ||
904 | * This function sets the operating point of the APE. | ||
905 | */ | ||
906 | int prcmu_set_ape_opp(u8 opp) | ||
907 | { | ||
908 | int r = 0; | ||
909 | |||
910 | mutex_lock(&mb1_transfer.lock); | ||
911 | |||
912 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) | ||
913 | cpu_relax(); | ||
914 | |||
915 | writeb(MB1H_ARM_APE_OPP, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); | ||
916 | writeb(ARM_NO_CHANGE, (tcdm_base + PRCM_REQ_MB1_ARM_OPP)); | ||
917 | writeb(opp, (tcdm_base + PRCM_REQ_MB1_APE_OPP)); | ||
918 | |||
919 | writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
920 | wait_for_completion(&mb1_transfer.work); | ||
921 | |||
922 | if ((mb1_transfer.ack.header != MB1H_ARM_APE_OPP) || | ||
923 | (mb1_transfer.ack.ape_opp != opp)) | ||
924 | r = -EIO; | ||
925 | |||
926 | mutex_unlock(&mb1_transfer.lock); | ||
927 | |||
928 | return r; | ||
929 | } | ||
930 | |||
931 | /** | ||
932 | * prcmu_get_ape_opp - get the current APE OPP | ||
933 | * | ||
934 | * Returns: the current APE OPP | ||
935 | */ | ||
936 | int prcmu_get_ape_opp(void) | ||
937 | { | ||
938 | return readb(tcdm_base + PRCM_ACK_MB1_CURRENT_APE_OPP); | ||
939 | } | ||
940 | |||
941 | /** | ||
942 | * prcmu_request_ape_opp_100_voltage - Request APE OPP 100% voltage | ||
943 | * @enable: true to request the higher voltage, false to drop a request. | ||
944 | * | ||
945 | * Calls to this function to enable and disable requests must be balanced. | ||
946 | */ | ||
947 | int prcmu_request_ape_opp_100_voltage(bool enable) | ||
948 | { | ||
949 | int r = 0; | ||
950 | u8 header; | ||
951 | static unsigned int requests; | ||
952 | |||
953 | mutex_lock(&mb1_transfer.lock); | ||
954 | |||
955 | if (enable) { | ||
956 | if (0 != requests++) | ||
957 | goto unlock_and_return; | ||
958 | header = MB1H_REQUEST_APE_OPP_100_VOLT; | ||
959 | } else { | ||
960 | if (requests == 0) { | ||
961 | r = -EIO; | ||
962 | goto unlock_and_return; | ||
963 | } else if (1 != requests--) { | ||
964 | goto unlock_and_return; | ||
965 | } | ||
966 | header = MB1H_RELEASE_APE_OPP_100_VOLT; | ||
967 | } | ||
968 | |||
969 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) | ||
970 | cpu_relax(); | ||
971 | |||
972 | writeb(header, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); | ||
973 | |||
974 | writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
975 | wait_for_completion(&mb1_transfer.work); | ||
976 | |||
977 | if ((mb1_transfer.ack.header != header) || | ||
978 | ((mb1_transfer.ack.ape_voltage_status & BIT(0)) != 0)) | ||
979 | r = -EIO; | ||
980 | |||
981 | unlock_and_return: | ||
982 | mutex_unlock(&mb1_transfer.lock); | ||
983 | |||
984 | return r; | ||
985 | } | ||
986 | |||
987 | /** | ||
988 | * prcmu_release_usb_wakeup_state - release the state required by a USB wakeup | ||
989 | * | ||
990 | * This function releases the power state requirements of a USB wakeup. | ||
991 | */ | ||
992 | int prcmu_release_usb_wakeup_state(void) | ||
993 | { | ||
994 | int r = 0; | ||
995 | |||
996 | mutex_lock(&mb1_transfer.lock); | ||
997 | |||
998 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) | ||
999 | cpu_relax(); | ||
1000 | |||
1001 | writeb(MB1H_RELEASE_USB_WAKEUP, | ||
1002 | (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); | ||
1003 | |||
1004 | writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1005 | wait_for_completion(&mb1_transfer.work); | ||
1006 | |||
1007 | if ((mb1_transfer.ack.header != MB1H_RELEASE_USB_WAKEUP) || | ||
1008 | ((mb1_transfer.ack.ape_voltage_status & BIT(0)) != 0)) | ||
1009 | r = -EIO; | ||
1010 | |||
1011 | mutex_unlock(&mb1_transfer.lock); | ||
1012 | |||
1013 | return r; | ||
1014 | } | ||
1015 | |||
1016 | /** | ||
1017 | * prcmu_set_epod - set the state of a EPOD (power domain) | ||
1018 | * @epod_id: The EPOD to set | ||
1019 | * @epod_state: The new EPOD state | ||
1020 | * | ||
1021 | * This function sets the state of a EPOD (power domain). It may not be called | ||
1022 | * from interrupt context. | ||
1023 | */ | ||
1024 | int prcmu_set_epod(u16 epod_id, u8 epod_state) | ||
1025 | { | ||
1026 | int r = 0; | ||
1027 | bool ram_retention = false; | ||
1028 | int i; | ||
1029 | |||
1030 | /* check argument */ | ||
1031 | BUG_ON(epod_id >= NUM_EPOD_ID); | ||
1032 | |||
1033 | /* set flag if retention is possible */ | ||
1034 | switch (epod_id) { | ||
1035 | case EPOD_ID_SVAMMDSP: | ||
1036 | case EPOD_ID_SIAMMDSP: | ||
1037 | case EPOD_ID_ESRAM12: | ||
1038 | case EPOD_ID_ESRAM34: | ||
1039 | ram_retention = true; | ||
1040 | break; | ||
1041 | } | ||
1042 | |||
1043 | /* check argument */ | ||
1044 | BUG_ON(epod_state > EPOD_STATE_ON); | ||
1045 | BUG_ON(epod_state == EPOD_STATE_RAMRET && !ram_retention); | ||
1046 | |||
1047 | /* get lock */ | ||
1048 | mutex_lock(&mb2_transfer.lock); | ||
1049 | |||
1050 | /* wait for mailbox */ | ||
1051 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(2)) | ||
1052 | cpu_relax(); | ||
1053 | |||
1054 | /* fill in mailbox */ | ||
1055 | for (i = 0; i < NUM_EPOD_ID; i++) | ||
1056 | writeb(EPOD_STATE_NO_CHANGE, (tcdm_base + PRCM_REQ_MB2 + i)); | ||
1057 | writeb(epod_state, (tcdm_base + PRCM_REQ_MB2 + epod_id)); | ||
1058 | |||
1059 | writeb(MB2H_DPS, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB2)); | ||
1060 | |||
1061 | writel(MBOX_BIT(2), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1062 | |||
1063 | /* | ||
1064 | * The current firmware version does not handle errors correctly, | ||
1065 | * and we cannot recover if there is an error. | ||
1066 | * This is expected to change when the firmware is updated. | ||
1067 | */ | ||
1068 | if (!wait_for_completion_timeout(&mb2_transfer.work, | ||
1069 | msecs_to_jiffies(20000))) { | ||
1070 | pr_err("prcmu: %s timed out (20 s) waiting for a reply.\n", | ||
1071 | __func__); | ||
1072 | r = -EIO; | ||
1073 | goto unlock_and_return; | ||
1074 | } | ||
1075 | |||
1076 | if (mb2_transfer.ack.status != HWACC_PWR_ST_OK) | ||
1077 | r = -EIO; | ||
1078 | |||
1079 | unlock_and_return: | ||
1080 | mutex_unlock(&mb2_transfer.lock); | ||
1081 | return r; | ||
1082 | } | ||
1083 | |||
1084 | /** | ||
1085 | * prcmu_configure_auto_pm - Configure autonomous power management. | ||
1086 | * @sleep: Configuration for ApSleep. | ||
1087 | * @idle: Configuration for ApIdle. | ||
1088 | */ | ||
1089 | void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, | ||
1090 | struct prcmu_auto_pm_config *idle) | ||
1091 | { | ||
1092 | u32 sleep_cfg; | ||
1093 | u32 idle_cfg; | ||
1094 | unsigned long flags; | ||
1095 | |||
1096 | BUG_ON((sleep == NULL) || (idle == NULL)); | ||
1097 | |||
1098 | sleep_cfg = (sleep->sva_auto_pm_enable & 0xF); | ||
1099 | sleep_cfg = ((sleep_cfg << 4) | (sleep->sia_auto_pm_enable & 0xF)); | ||
1100 | sleep_cfg = ((sleep_cfg << 8) | (sleep->sva_power_on & 0xFF)); | ||
1101 | sleep_cfg = ((sleep_cfg << 8) | (sleep->sia_power_on & 0xFF)); | ||
1102 | sleep_cfg = ((sleep_cfg << 4) | (sleep->sva_policy & 0xF)); | ||
1103 | sleep_cfg = ((sleep_cfg << 4) | (sleep->sia_policy & 0xF)); | ||
1104 | |||
1105 | idle_cfg = (idle->sva_auto_pm_enable & 0xF); | ||
1106 | idle_cfg = ((idle_cfg << 4) | (idle->sia_auto_pm_enable & 0xF)); | ||
1107 | idle_cfg = ((idle_cfg << 8) | (idle->sva_power_on & 0xFF)); | ||
1108 | idle_cfg = ((idle_cfg << 8) | (idle->sia_power_on & 0xFF)); | ||
1109 | idle_cfg = ((idle_cfg << 4) | (idle->sva_policy & 0xF)); | ||
1110 | idle_cfg = ((idle_cfg << 4) | (idle->sia_policy & 0xF)); | ||
1111 | |||
1112 | spin_lock_irqsave(&mb2_transfer.auto_pm_lock, flags); | ||
1113 | |||
1114 | /* | ||
1115 | * The autonomous power management configuration is done through | ||
1116 | * fields in mailbox 2, but these fields are only used as shared | ||
1117 | * variables - i.e. there is no need to send a message. | ||
1118 | */ | ||
1119 | writel(sleep_cfg, (tcdm_base + PRCM_REQ_MB2_AUTO_PM_SLEEP)); | ||
1120 | writel(idle_cfg, (tcdm_base + PRCM_REQ_MB2_AUTO_PM_IDLE)); | ||
1121 | |||
1122 | mb2_transfer.auto_pm_enabled = | ||
1123 | ((sleep->sva_auto_pm_enable == PRCMU_AUTO_PM_ON) || | ||
1124 | (sleep->sia_auto_pm_enable == PRCMU_AUTO_PM_ON) || | ||
1125 | (idle->sva_auto_pm_enable == PRCMU_AUTO_PM_ON) || | ||
1126 | (idle->sia_auto_pm_enable == PRCMU_AUTO_PM_ON)); | ||
1127 | |||
1128 | spin_unlock_irqrestore(&mb2_transfer.auto_pm_lock, flags); | ||
1129 | } | ||
1130 | EXPORT_SYMBOL(prcmu_configure_auto_pm); | ||
1131 | |||
1132 | bool prcmu_is_auto_pm_enabled(void) | ||
1133 | { | ||
1134 | return mb2_transfer.auto_pm_enabled; | ||
1135 | } | ||
1136 | |||
1137 | static int request_sysclk(bool enable) | ||
1138 | { | ||
1139 | int r; | ||
1140 | unsigned long flags; | ||
1141 | |||
1142 | r = 0; | ||
1143 | |||
1144 | mutex_lock(&mb3_transfer.sysclk_lock); | ||
1145 | |||
1146 | spin_lock_irqsave(&mb3_transfer.lock, flags); | ||
1147 | |||
1148 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(3)) | ||
1149 | cpu_relax(); | ||
1150 | |||
1151 | writeb((enable ? ON : OFF), (tcdm_base + PRCM_REQ_MB3_SYSCLK_MGT)); | ||
1152 | |||
1153 | writeb(MB3H_SYSCLK, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB3)); | ||
1154 | writel(MBOX_BIT(3), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1155 | |||
1156 | spin_unlock_irqrestore(&mb3_transfer.lock, flags); | ||
1157 | |||
1158 | /* | ||
1159 | * The firmware only sends an ACK if we want to enable the | ||
1160 | * SysClk, and it succeeds. | ||
1161 | */ | ||
1162 | if (enable && !wait_for_completion_timeout(&mb3_transfer.sysclk_work, | ||
1163 | msecs_to_jiffies(20000))) { | ||
1164 | pr_err("prcmu: %s timed out (20 s) waiting for a reply.\n", | ||
1165 | __func__); | ||
1166 | r = -EIO; | ||
1167 | } | ||
1168 | |||
1169 | mutex_unlock(&mb3_transfer.sysclk_lock); | ||
1170 | |||
1171 | return r; | ||
1172 | } | ||
1173 | |||
1174 | static int request_timclk(bool enable) | ||
1175 | { | ||
1176 | u32 val = (PRCM_TCR_DOZE_MODE | PRCM_TCR_TENSEL_MASK); | ||
1177 | |||
1178 | if (!enable) | ||
1179 | val |= PRCM_TCR_STOP_TIMERS; | ||
1180 | writel(val, (_PRCMU_BASE + PRCM_TCR)); | ||
1181 | |||
1182 | return 0; | ||
1183 | } | ||
1184 | |||
1185 | static int request_reg_clock(u8 clock, bool enable) | ||
1186 | { | ||
1187 | u32 val; | ||
1188 | unsigned long flags; | ||
1189 | |||
1190 | spin_lock_irqsave(&clk_mgt_lock, flags); | ||
1191 | |||
1192 | /* Grab the HW semaphore. */ | ||
1193 | while ((readl(_PRCMU_BASE + PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0) | ||
1194 | cpu_relax(); | ||
1195 | |||
1196 | val = readl(_PRCMU_BASE + clk_mgt[clock].offset); | ||
1197 | if (enable) { | ||
1198 | val |= (PRCM_CLK_MGT_CLKEN | clk_mgt[clock].pllsw); | ||
1199 | } else { | ||
1200 | clk_mgt[clock].pllsw = (val & PRCM_CLK_MGT_CLKPLLSW_MASK); | ||
1201 | val &= ~(PRCM_CLK_MGT_CLKEN | PRCM_CLK_MGT_CLKPLLSW_MASK); | ||
1202 | } | ||
1203 | writel(val, (_PRCMU_BASE + clk_mgt[clock].offset)); | ||
1204 | |||
1205 | /* Release the HW semaphore. */ | ||
1206 | writel(0, (_PRCMU_BASE + PRCM_SEM)); | ||
1207 | |||
1208 | spin_unlock_irqrestore(&clk_mgt_lock, flags); | ||
1209 | |||
1210 | return 0; | ||
1211 | } | ||
1212 | |||
1213 | /** | ||
1214 | * prcmu_request_clock() - Request for a clock to be enabled or disabled. | ||
1215 | * @clock: The clock for which the request is made. | ||
1216 | * @enable: Whether the clock should be enabled (true) or disabled (false). | ||
1217 | * | ||
1218 | * This function should only be used by the clock implementation. | ||
1219 | * Do not use it from any other place! | ||
1220 | */ | ||
1221 | int prcmu_request_clock(u8 clock, bool enable) | ||
1222 | { | ||
1223 | if (clock < PRCMU_NUM_REG_CLOCKS) | ||
1224 | return request_reg_clock(clock, enable); | ||
1225 | else if (clock == PRCMU_TIMCLK) | ||
1226 | return request_timclk(enable); | ||
1227 | else if (clock == PRCMU_SYSCLK) | ||
1228 | return request_sysclk(enable); | ||
1229 | else | ||
1230 | return -EINVAL; | ||
1231 | } | ||
1232 | |||
1233 | int prcmu_config_esram0_deep_sleep(u8 state) | ||
1234 | { | ||
1235 | if ((state > ESRAM0_DEEP_SLEEP_STATE_RET) || | ||
1236 | (state < ESRAM0_DEEP_SLEEP_STATE_OFF)) | ||
1237 | return -EINVAL; | ||
1238 | |||
1239 | mutex_lock(&mb4_transfer.lock); | ||
1240 | |||
1241 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(4)) | ||
1242 | cpu_relax(); | ||
1243 | |||
1244 | writeb(MB4H_MEM_ST, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4)); | ||
1245 | writeb(((DDR_PWR_STATE_OFFHIGHLAT << 4) | DDR_PWR_STATE_ON), | ||
1246 | (tcdm_base + PRCM_REQ_MB4_DDR_ST_AP_SLEEP_IDLE)); | ||
1247 | writeb(DDR_PWR_STATE_ON, | ||
1248 | (tcdm_base + PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE)); | ||
1249 | writeb(state, (tcdm_base + PRCM_REQ_MB4_ESRAM0_ST)); | ||
1250 | |||
1251 | writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1252 | wait_for_completion(&mb4_transfer.work); | ||
1253 | |||
1254 | mutex_unlock(&mb4_transfer.lock); | ||
1255 | |||
1256 | return 0; | ||
1257 | } | ||
1258 | |||
1259 | int prcmu_config_hotdog(u8 threshold) | ||
1260 | { | ||
1261 | mutex_lock(&mb4_transfer.lock); | ||
1262 | |||
1263 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(4)) | ||
1264 | cpu_relax(); | ||
1265 | |||
1266 | writeb(threshold, (tcdm_base + PRCM_REQ_MB4_HOTDOG_THRESHOLD)); | ||
1267 | writeb(MB4H_HOTDOG, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4)); | ||
1268 | |||
1269 | writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1270 | wait_for_completion(&mb4_transfer.work); | ||
1271 | |||
1272 | mutex_unlock(&mb4_transfer.lock); | ||
1273 | |||
1274 | return 0; | ||
1275 | } | ||
1276 | |||
1277 | int prcmu_config_hotmon(u8 low, u8 high) | ||
1278 | { | ||
1279 | mutex_lock(&mb4_transfer.lock); | ||
1280 | |||
1281 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(4)) | ||
1282 | cpu_relax(); | ||
1283 | |||
1284 | writeb(low, (tcdm_base + PRCM_REQ_MB4_HOTMON_LOW)); | ||
1285 | writeb(high, (tcdm_base + PRCM_REQ_MB4_HOTMON_HIGH)); | ||
1286 | writeb((HOTMON_CONFIG_LOW | HOTMON_CONFIG_HIGH), | ||
1287 | (tcdm_base + PRCM_REQ_MB4_HOTMON_CONFIG)); | ||
1288 | writeb(MB4H_HOTMON, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4)); | ||
1289 | |||
1290 | writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1291 | wait_for_completion(&mb4_transfer.work); | ||
1292 | |||
1293 | mutex_unlock(&mb4_transfer.lock); | ||
1294 | |||
1295 | return 0; | ||
1296 | } | ||
1297 | |||
1298 | static int config_hot_period(u16 val) | ||
1299 | { | ||
1300 | mutex_lock(&mb4_transfer.lock); | ||
1301 | |||
1302 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(4)) | ||
1303 | cpu_relax(); | ||
1304 | |||
1305 | writew(val, (tcdm_base + PRCM_REQ_MB4_HOT_PERIOD)); | ||
1306 | writeb(MB4H_HOT_PERIOD, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4)); | ||
1307 | |||
1308 | writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1309 | wait_for_completion(&mb4_transfer.work); | ||
1310 | |||
1311 | mutex_unlock(&mb4_transfer.lock); | ||
1312 | |||
1313 | return 0; | ||
1314 | } | ||
1315 | |||
1316 | int prcmu_start_temp_sense(u16 cycles32k) | ||
1317 | { | ||
1318 | if (cycles32k == 0xFFFF) | ||
1319 | return -EINVAL; | ||
1320 | |||
1321 | return config_hot_period(cycles32k); | ||
1322 | } | ||
1323 | |||
1324 | int prcmu_stop_temp_sense(void) | ||
1325 | { | ||
1326 | return config_hot_period(0xFFFF); | ||
1327 | } | ||
1328 | |||
1329 | /** | ||
1330 | * prcmu_set_clock_divider() - Configure the clock divider. | ||
1331 | * @clock: The clock for which the request is made. | ||
1332 | * @divider: The clock divider. (< 32) | ||
1333 | * | ||
1334 | * This function should only be used by the clock implementation. | ||
1335 | * Do not use it from any other place! | ||
1336 | */ | ||
1337 | int prcmu_set_clock_divider(u8 clock, u8 divider) | ||
1338 | { | ||
1339 | u32 val; | ||
1340 | unsigned long flags; | ||
1341 | |||
1342 | if ((clock >= PRCMU_NUM_REG_CLOCKS) || (divider < 1) || (31 < divider)) | ||
1343 | return -EINVAL; | ||
1344 | |||
1345 | spin_lock_irqsave(&clk_mgt_lock, flags); | ||
1346 | |||
1347 | /* Grab the HW semaphore. */ | ||
1348 | while ((readl(_PRCMU_BASE + PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0) | ||
1349 | cpu_relax(); | ||
1350 | |||
1351 | val = readl(_PRCMU_BASE + clk_mgt[clock].offset); | ||
1352 | val &= ~(PRCM_CLK_MGT_CLKPLLDIV_MASK); | ||
1353 | val |= (u32)divider; | ||
1354 | writel(val, (_PRCMU_BASE + clk_mgt[clock].offset)); | ||
1355 | |||
1356 | /* Release the HW semaphore. */ | ||
1357 | writel(0, (_PRCMU_BASE + PRCM_SEM)); | ||
1358 | |||
1359 | spin_unlock_irqrestore(&clk_mgt_lock, flags); | ||
1360 | |||
1361 | return 0; | ||
1362 | } | ||
1363 | |||
1364 | /** | ||
1365 | * prcmu_abb_read() - Read register value(s) from the ABB. | ||
1366 | * @slave: The I2C slave address. | ||
1367 | * @reg: The (start) register address. | ||
1368 | * @value: The read out value(s). | ||
1369 | * @size: The number of registers to read. | ||
1370 | * | ||
1371 | * Reads register value(s) from the ABB. | ||
1372 | * @size has to be 1 for the current firmware version. | ||
1373 | */ | ||
1374 | int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
1375 | { | ||
1376 | int r; | ||
1377 | |||
1378 | if (size != 1) | ||
1379 | return -EINVAL; | ||
1380 | |||
1381 | mutex_lock(&mb5_transfer.lock); | ||
1382 | |||
1383 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(5)) | ||
1384 | cpu_relax(); | ||
1385 | |||
1386 | writeb(PRCMU_I2C_READ(slave), (tcdm_base + PRCM_REQ_MB5_I2C_SLAVE_OP)); | ||
1387 | writeb(PRCMU_I2C_STOP_EN, (tcdm_base + PRCM_REQ_MB5_I2C_HW_BITS)); | ||
1388 | writeb(reg, (tcdm_base + PRCM_REQ_MB5_I2C_REG)); | ||
1389 | writeb(0, (tcdm_base + PRCM_REQ_MB5_I2C_VAL)); | ||
1390 | |||
1391 | writel(MBOX_BIT(5), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1392 | |||
1393 | if (!wait_for_completion_timeout(&mb5_transfer.work, | ||
1394 | msecs_to_jiffies(20000))) { | ||
1395 | pr_err("prcmu: %s timed out (20 s) waiting for a reply.\n", | ||
1396 | __func__); | ||
1397 | r = -EIO; | ||
1398 | } else { | ||
1399 | r = ((mb5_transfer.ack.status == I2C_RD_OK) ? 0 : -EIO); | ||
1400 | } | ||
1401 | |||
1402 | if (!r) | ||
1403 | *value = mb5_transfer.ack.value; | ||
1404 | |||
1405 | mutex_unlock(&mb5_transfer.lock); | ||
1406 | |||
1407 | return r; | ||
1408 | } | ||
1409 | |||
1410 | /** | ||
1411 | * prcmu_abb_write() - Write register value(s) to the ABB. | ||
1412 | * @slave: The I2C slave address. | ||
1413 | * @reg: The (start) register address. | ||
1414 | * @value: The value(s) to write. | ||
1415 | * @size: The number of registers to write. | ||
1416 | * | ||
1417 | * Reads register value(s) from the ABB. | ||
1418 | * @size has to be 1 for the current firmware version. | ||
1419 | */ | ||
1420 | int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | ||
1421 | { | ||
1422 | int r; | ||
1423 | |||
1424 | if (size != 1) | ||
1425 | return -EINVAL; | ||
1426 | |||
1427 | mutex_lock(&mb5_transfer.lock); | ||
1428 | |||
1429 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(5)) | ||
1430 | cpu_relax(); | ||
1431 | |||
1432 | writeb(PRCMU_I2C_WRITE(slave), (tcdm_base + PRCM_REQ_MB5_I2C_SLAVE_OP)); | ||
1433 | writeb(PRCMU_I2C_STOP_EN, (tcdm_base + PRCM_REQ_MB5_I2C_HW_BITS)); | ||
1434 | writeb(reg, (tcdm_base + PRCM_REQ_MB5_I2C_REG)); | ||
1435 | writeb(*value, (tcdm_base + PRCM_REQ_MB5_I2C_VAL)); | ||
1436 | |||
1437 | writel(MBOX_BIT(5), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1438 | |||
1439 | if (!wait_for_completion_timeout(&mb5_transfer.work, | ||
1440 | msecs_to_jiffies(20000))) { | ||
1441 | pr_err("prcmu: %s timed out (20 s) waiting for a reply.\n", | ||
1442 | __func__); | ||
1443 | r = -EIO; | ||
1444 | } else { | ||
1445 | r = ((mb5_transfer.ack.status == I2C_WR_OK) ? 0 : -EIO); | ||
1446 | } | ||
1447 | |||
1448 | mutex_unlock(&mb5_transfer.lock); | ||
1449 | |||
1450 | return r; | ||
1451 | } | ||
1452 | |||
1453 | /** | ||
1454 | * prcmu_ac_wake_req - should be called whenever ARM wants to wakeup Modem | ||
1455 | */ | ||
1456 | void prcmu_ac_wake_req(void) | ||
1457 | { | ||
1458 | u32 val; | ||
1459 | |||
1460 | mutex_lock(&mb0_transfer.ac_wake_lock); | ||
1461 | |||
1462 | val = readl(_PRCMU_BASE + PRCM_HOSTACCESS_REQ); | ||
1463 | if (val & PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ) | ||
1464 | goto unlock_and_return; | ||
1465 | |||
1466 | atomic_set(&ac_wake_req_state, 1); | ||
1467 | |||
1468 | writel((val | PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ), | ||
1469 | (_PRCMU_BASE + PRCM_HOSTACCESS_REQ)); | ||
1470 | |||
1471 | if (!wait_for_completion_timeout(&mb0_transfer.ac_wake_work, | ||
1472 | msecs_to_jiffies(20000))) { | ||
1473 | pr_err("prcmu: %s timed out (20 s) waiting for a reply.\n", | ||
1474 | __func__); | ||
1475 | } | ||
1476 | |||
1477 | unlock_and_return: | ||
1478 | mutex_unlock(&mb0_transfer.ac_wake_lock); | ||
1479 | } | ||
1480 | |||
1481 | /** | ||
1482 | * prcmu_ac_sleep_req - called when ARM no longer needs to talk to modem | ||
1483 | */ | ||
1484 | void prcmu_ac_sleep_req() | ||
1485 | { | ||
1486 | u32 val; | ||
1487 | |||
1488 | mutex_lock(&mb0_transfer.ac_wake_lock); | ||
1489 | |||
1490 | val = readl(_PRCMU_BASE + PRCM_HOSTACCESS_REQ); | ||
1491 | if (!(val & PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ)) | ||
1492 | goto unlock_and_return; | ||
1493 | |||
1494 | writel((val & ~PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ), | ||
1495 | (_PRCMU_BASE + PRCM_HOSTACCESS_REQ)); | ||
1496 | |||
1497 | if (!wait_for_completion_timeout(&mb0_transfer.ac_wake_work, | ||
1498 | msecs_to_jiffies(20000))) { | ||
1499 | pr_err("prcmu: %s timed out (20 s) waiting for a reply.\n", | ||
1500 | __func__); | ||
1501 | } | ||
1502 | |||
1503 | atomic_set(&ac_wake_req_state, 0); | ||
1504 | |||
1505 | unlock_and_return: | ||
1506 | mutex_unlock(&mb0_transfer.ac_wake_lock); | ||
1507 | } | ||
1508 | |||
1509 | bool prcmu_is_ac_wake_requested(void) | ||
1510 | { | ||
1511 | return (atomic_read(&ac_wake_req_state) != 0); | ||
1512 | } | ||
1513 | |||
1514 | /** | ||
1515 | * prcmu_system_reset - System reset | ||
1516 | * | ||
1517 | * Saves the reset reason code and then sets the APE_SOFRST register which | ||
1518 | * fires interrupt to fw | ||
1519 | */ | ||
1520 | void prcmu_system_reset(u16 reset_code) | ||
1521 | { | ||
1522 | writew(reset_code, (tcdm_base + PRCM_SW_RST_REASON)); | ||
1523 | writel(1, (_PRCMU_BASE + PRCM_APE_SOFTRST)); | ||
1524 | } | ||
1525 | |||
1526 | /** | ||
1527 | * prcmu_reset_modem - ask the PRCMU to reset modem | ||
1528 | */ | ||
1529 | void prcmu_modem_reset(void) | ||
1530 | { | ||
1531 | mutex_lock(&mb1_transfer.lock); | ||
1532 | |||
1533 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) | ||
1534 | cpu_relax(); | ||
1535 | |||
1536 | writeb(MB1H_RESET_MODEM, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); | ||
1537 | writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1538 | wait_for_completion(&mb1_transfer.work); | ||
1539 | |||
1540 | /* | ||
1541 | * No need to check return from PRCMU as modem should go in reset state | ||
1542 | * This state is already managed by upper layer | ||
1543 | */ | ||
1544 | |||
1545 | mutex_unlock(&mb1_transfer.lock); | ||
1546 | } | ||
1547 | |||
1548 | static void ack_dbb_wakeup(void) | ||
1549 | { | ||
1550 | unsigned long flags; | ||
1551 | |||
1552 | spin_lock_irqsave(&mb0_transfer.lock, flags); | ||
1553 | |||
1554 | while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(0)) | ||
1555 | cpu_relax(); | ||
1556 | |||
1557 | writeb(MB0H_READ_WAKEUP_ACK, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB0)); | ||
1558 | writel(MBOX_BIT(0), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); | ||
1559 | |||
1560 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); | ||
1561 | } | ||
1562 | |||
1563 | static inline void print_unknown_header_warning(u8 n, u8 header) | ||
1564 | { | ||
1565 | pr_warning("prcmu: Unknown message header (%d) in mailbox %d.\n", | ||
1566 | header, n); | ||
1567 | } | ||
1568 | |||
1569 | static bool read_mailbox_0(void) | ||
1570 | { | ||
1571 | bool r; | ||
1572 | u32 ev; | ||
1573 | unsigned int n; | ||
1574 | u8 header; | ||
1575 | |||
1576 | header = readb(tcdm_base + PRCM_MBOX_HEADER_ACK_MB0); | ||
1577 | switch (header) { | ||
1578 | case MB0H_WAKEUP_EXE: | ||
1579 | case MB0H_WAKEUP_SLEEP: | ||
1580 | if (readb(tcdm_base + PRCM_ACK_MB0_READ_POINTER) & 1) | ||
1581 | ev = readl(tcdm_base + PRCM_ACK_MB0_WAKEUP_1_8500); | ||
1582 | else | ||
1583 | ev = readl(tcdm_base + PRCM_ACK_MB0_WAKEUP_0_8500); | ||
1584 | |||
1585 | if (ev & (WAKEUP_BIT_AC_WAKE_ACK | WAKEUP_BIT_AC_SLEEP_ACK)) | ||
1586 | complete(&mb0_transfer.ac_wake_work); | ||
1587 | if (ev & WAKEUP_BIT_SYSCLK_OK) | ||
1588 | complete(&mb3_transfer.sysclk_work); | ||
1589 | |||
1590 | ev &= mb0_transfer.req.dbb_irqs; | ||
1591 | |||
1592 | for (n = 0; n < NUM_PRCMU_WAKEUPS; n++) { | ||
1593 | if (ev & prcmu_irq_bit[n]) | ||
1594 | generic_handle_irq(IRQ_PRCMU_BASE + n); | ||
1595 | } | ||
1596 | r = true; | ||
1597 | break; | ||
1598 | default: | ||
1599 | print_unknown_header_warning(0, header); | ||
1600 | r = false; | ||
1601 | break; | ||
1602 | } | ||
1603 | writel(MBOX_BIT(0), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); | ||
1604 | return r; | ||
1605 | } | ||
1606 | |||
1607 | static bool read_mailbox_1(void) | ||
1608 | { | ||
1609 | mb1_transfer.ack.header = readb(tcdm_base + PRCM_MBOX_HEADER_REQ_MB1); | ||
1610 | mb1_transfer.ack.arm_opp = readb(tcdm_base + | ||
1611 | PRCM_ACK_MB1_CURRENT_ARM_OPP); | ||
1612 | mb1_transfer.ack.ape_opp = readb(tcdm_base + | ||
1613 | PRCM_ACK_MB1_CURRENT_APE_OPP); | ||
1614 | mb1_transfer.ack.ape_voltage_status = readb(tcdm_base + | ||
1615 | PRCM_ACK_MB1_APE_VOLTAGE_STATUS); | ||
1616 | writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); | ||
1617 | complete(&mb1_transfer.work); | ||
1618 | return false; | ||
1619 | } | ||
1620 | |||
1621 | static bool read_mailbox_2(void) | ||
1622 | { | ||
1623 | mb2_transfer.ack.status = readb(tcdm_base + PRCM_ACK_MB2_DPS_STATUS); | ||
1624 | writel(MBOX_BIT(2), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); | ||
1625 | complete(&mb2_transfer.work); | ||
1626 | return false; | ||
1627 | } | ||
1628 | |||
1629 | static bool read_mailbox_3(void) | ||
1630 | { | ||
1631 | writel(MBOX_BIT(3), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); | ||
1632 | return false; | ||
1633 | } | ||
1634 | |||
1635 | static bool read_mailbox_4(void) | ||
1636 | { | ||
1637 | u8 header; | ||
1638 | bool do_complete = true; | ||
1639 | |||
1640 | header = readb(tcdm_base + PRCM_MBOX_HEADER_REQ_MB4); | ||
1641 | switch (header) { | ||
1642 | case MB4H_MEM_ST: | ||
1643 | case MB4H_HOTDOG: | ||
1644 | case MB4H_HOTMON: | ||
1645 | case MB4H_HOT_PERIOD: | ||
1646 | break; | ||
1647 | default: | ||
1648 | print_unknown_header_warning(4, header); | ||
1649 | do_complete = false; | ||
1650 | break; | ||
1651 | } | ||
1652 | |||
1653 | writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); | ||
1654 | |||
1655 | if (do_complete) | ||
1656 | complete(&mb4_transfer.work); | ||
1657 | |||
1658 | return false; | ||
1659 | } | ||
1660 | |||
1661 | static bool read_mailbox_5(void) | ||
1662 | { | ||
1663 | mb5_transfer.ack.status = readb(tcdm_base + PRCM_ACK_MB5_I2C_STATUS); | ||
1664 | mb5_transfer.ack.value = readb(tcdm_base + PRCM_ACK_MB5_I2C_VAL); | ||
1665 | writel(MBOX_BIT(5), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); | ||
1666 | complete(&mb5_transfer.work); | ||
1667 | return false; | ||
1668 | } | ||
1669 | |||
1670 | static bool read_mailbox_6(void) | ||
1671 | { | ||
1672 | writel(MBOX_BIT(6), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); | ||
1673 | return false; | ||
1674 | } | ||
1675 | |||
1676 | static bool read_mailbox_7(void) | ||
1677 | { | ||
1678 | writel(MBOX_BIT(7), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); | ||
1679 | return false; | ||
1680 | } | ||
1681 | |||
1682 | static bool (* const read_mailbox[NUM_MB])(void) = { | ||
1683 | read_mailbox_0, | ||
1684 | read_mailbox_1, | ||
1685 | read_mailbox_2, | ||
1686 | read_mailbox_3, | ||
1687 | read_mailbox_4, | ||
1688 | read_mailbox_5, | ||
1689 | read_mailbox_6, | ||
1690 | read_mailbox_7 | ||
1691 | }; | ||
1692 | |||
1693 | static irqreturn_t prcmu_irq_handler(int irq, void *data) | ||
1694 | { | ||
1695 | u32 bits; | ||
1696 | u8 n; | ||
1697 | irqreturn_t r; | ||
1698 | |||
1699 | bits = (readl(_PRCMU_BASE + PRCM_ARM_IT1_VAL) & ALL_MBOX_BITS); | ||
1700 | if (unlikely(!bits)) | ||
1701 | return IRQ_NONE; | ||
1702 | |||
1703 | r = IRQ_HANDLED; | ||
1704 | for (n = 0; bits; n++) { | ||
1705 | if (bits & MBOX_BIT(n)) { | ||
1706 | bits -= MBOX_BIT(n); | ||
1707 | if (read_mailbox[n]()) | ||
1708 | r = IRQ_WAKE_THREAD; | ||
1709 | } | ||
1710 | } | ||
1711 | return r; | ||
1712 | } | ||
1713 | |||
1714 | static irqreturn_t prcmu_irq_thread_fn(int irq, void *data) | ||
1715 | { | ||
1716 | ack_dbb_wakeup(); | ||
1717 | return IRQ_HANDLED; | ||
1718 | } | ||
1719 | |||
1720 | static void prcmu_mask_work(struct work_struct *work) | ||
1721 | { | ||
1722 | unsigned long flags; | ||
1723 | |||
1724 | spin_lock_irqsave(&mb0_transfer.lock, flags); | ||
1725 | |||
1726 | config_wakeups(); | ||
1727 | |||
1728 | spin_unlock_irqrestore(&mb0_transfer.lock, flags); | ||
1729 | } | ||
1730 | |||
1731 | static void prcmu_irq_mask(struct irq_data *d) | ||
1732 | { | ||
1733 | unsigned long flags; | ||
1734 | |||
1735 | spin_lock_irqsave(&mb0_transfer.dbb_irqs_lock, flags); | ||
1736 | |||
1737 | mb0_transfer.req.dbb_irqs &= ~prcmu_irq_bit[d->irq - IRQ_PRCMU_BASE]; | ||
1738 | |||
1739 | spin_unlock_irqrestore(&mb0_transfer.dbb_irqs_lock, flags); | ||
1740 | |||
1741 | if (d->irq != IRQ_PRCMU_CA_SLEEP) | ||
1742 | schedule_work(&mb0_transfer.mask_work); | ||
1743 | } | ||
1744 | |||
1745 | static void prcmu_irq_unmask(struct irq_data *d) | ||
1746 | { | ||
1747 | unsigned long flags; | ||
1748 | |||
1749 | spin_lock_irqsave(&mb0_transfer.dbb_irqs_lock, flags); | ||
1750 | |||
1751 | mb0_transfer.req.dbb_irqs |= prcmu_irq_bit[d->irq - IRQ_PRCMU_BASE]; | ||
1752 | |||
1753 | spin_unlock_irqrestore(&mb0_transfer.dbb_irqs_lock, flags); | ||
1754 | |||
1755 | if (d->irq != IRQ_PRCMU_CA_SLEEP) | ||
1756 | schedule_work(&mb0_transfer.mask_work); | ||
1757 | } | ||
1758 | |||
1759 | static void noop(struct irq_data *d) | ||
1760 | { | ||
1761 | } | ||
1762 | |||
1763 | static struct irq_chip prcmu_irq_chip = { | ||
1764 | .name = "prcmu", | ||
1765 | .irq_disable = prcmu_irq_mask, | ||
1766 | .irq_ack = noop, | ||
1767 | .irq_mask = prcmu_irq_mask, | ||
1768 | .irq_unmask = prcmu_irq_unmask, | ||
1769 | }; | ||
1770 | |||
1771 | void __init prcmu_early_init(void) | ||
1772 | { | ||
1773 | unsigned int i; | ||
1774 | |||
1775 | if (cpu_is_u8500v1()) { | ||
1776 | tcdm_base = __io_address(U8500_PRCMU_TCDM_BASE_V1); | ||
1777 | } else if (cpu_is_u8500v2()) { | ||
1778 | void *tcpm_base = ioremap_nocache(U8500_PRCMU_TCPM_BASE, SZ_4K); | ||
1779 | |||
1780 | if (tcpm_base != NULL) { | ||
1781 | int version; | ||
1782 | version = readl(tcpm_base + PRCMU_FW_VERSION_OFFSET); | ||
1783 | prcmu_version.project_number = version & 0xFF; | ||
1784 | prcmu_version.api_version = (version >> 8) & 0xFF; | ||
1785 | prcmu_version.func_version = (version >> 16) & 0xFF; | ||
1786 | prcmu_version.errata = (version >> 24) & 0xFF; | ||
1787 | pr_info("PRCMU firmware version %d.%d.%d\n", | ||
1788 | (version >> 8) & 0xFF, (version >> 16) & 0xFF, | ||
1789 | (version >> 24) & 0xFF); | ||
1790 | iounmap(tcpm_base); | ||
1791 | } | ||
1792 | |||
1793 | tcdm_base = __io_address(U8500_PRCMU_TCDM_BASE); | ||
1794 | } else { | ||
1795 | pr_err("prcmu: Unsupported chip version\n"); | ||
1796 | BUG(); | ||
1797 | } | ||
1798 | |||
1799 | spin_lock_init(&mb0_transfer.lock); | ||
1800 | spin_lock_init(&mb0_transfer.dbb_irqs_lock); | ||
1801 | mutex_init(&mb0_transfer.ac_wake_lock); | ||
1802 | init_completion(&mb0_transfer.ac_wake_work); | ||
1803 | mutex_init(&mb1_transfer.lock); | ||
1804 | init_completion(&mb1_transfer.work); | ||
1805 | mutex_init(&mb2_transfer.lock); | ||
1806 | init_completion(&mb2_transfer.work); | ||
1807 | spin_lock_init(&mb2_transfer.auto_pm_lock); | ||
1808 | spin_lock_init(&mb3_transfer.lock); | ||
1809 | mutex_init(&mb3_transfer.sysclk_lock); | ||
1810 | init_completion(&mb3_transfer.sysclk_work); | ||
1811 | mutex_init(&mb4_transfer.lock); | ||
1812 | init_completion(&mb4_transfer.work); | ||
1813 | mutex_init(&mb5_transfer.lock); | ||
1814 | init_completion(&mb5_transfer.work); | ||
1815 | |||
1816 | INIT_WORK(&mb0_transfer.mask_work, prcmu_mask_work); | ||
1817 | |||
1818 | /* Initalize irqs. */ | ||
1819 | for (i = 0; i < NUM_PRCMU_WAKEUPS; i++) { | ||
1820 | unsigned int irq; | ||
1821 | |||
1822 | irq = IRQ_PRCMU_BASE + i; | ||
1823 | irq_set_chip_and_handler(irq, &prcmu_irq_chip, | ||
1824 | handle_simple_irq); | ||
1825 | set_irq_flags(irq, IRQF_VALID); | ||
1826 | } | ||
1827 | } | ||
1828 | |||
1829 | /* | ||
1830 | * Power domain switches (ePODs) modeled as regulators for the DB8500 SoC | ||
1831 | */ | ||
1832 | static struct regulator_consumer_supply db8500_vape_consumers[] = { | ||
1833 | REGULATOR_SUPPLY("v-ape", NULL), | ||
1834 | REGULATOR_SUPPLY("v-i2c", "nmk-i2c.0"), | ||
1835 | REGULATOR_SUPPLY("v-i2c", "nmk-i2c.1"), | ||
1836 | REGULATOR_SUPPLY("v-i2c", "nmk-i2c.2"), | ||
1837 | REGULATOR_SUPPLY("v-i2c", "nmk-i2c.3"), | ||
1838 | /* "v-mmc" changed to "vcore" in the mainline kernel */ | ||
1839 | REGULATOR_SUPPLY("vcore", "sdi0"), | ||
1840 | REGULATOR_SUPPLY("vcore", "sdi1"), | ||
1841 | REGULATOR_SUPPLY("vcore", "sdi2"), | ||
1842 | REGULATOR_SUPPLY("vcore", "sdi3"), | ||
1843 | REGULATOR_SUPPLY("vcore", "sdi4"), | ||
1844 | REGULATOR_SUPPLY("v-dma", "dma40.0"), | ||
1845 | REGULATOR_SUPPLY("v-ape", "ab8500-usb.0"), | ||
1846 | /* "v-uart" changed to "vcore" in the mainline kernel */ | ||
1847 | REGULATOR_SUPPLY("vcore", "uart0"), | ||
1848 | REGULATOR_SUPPLY("vcore", "uart1"), | ||
1849 | REGULATOR_SUPPLY("vcore", "uart2"), | ||
1850 | REGULATOR_SUPPLY("v-ape", "nmk-ske-keypad.0"), | ||
1851 | }; | ||
1852 | |||
1853 | static struct regulator_consumer_supply db8500_vsmps2_consumers[] = { | ||
1854 | /* CG2900 and CW1200 power to off-chip peripherals */ | ||
1855 | REGULATOR_SUPPLY("gbf_1v8", "cg2900-uart.0"), | ||
1856 | REGULATOR_SUPPLY("wlan_1v8", "cw1200.0"), | ||
1857 | REGULATOR_SUPPLY("musb_1v8", "ab8500-usb.0"), | ||
1858 | /* AV8100 regulator */ | ||
1859 | REGULATOR_SUPPLY("hdmi_1v8", "0-0070"), | ||
1860 | }; | ||
1861 | |||
1862 | static struct regulator_consumer_supply db8500_b2r2_mcde_consumers[] = { | ||
1863 | REGULATOR_SUPPLY("vsupply", "b2r2.0"), | ||
1864 | REGULATOR_SUPPLY("vsupply", "mcde.0"), | ||
1865 | }; | ||
1866 | |||
1867 | static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { | ||
1868 | [DB8500_REGULATOR_VAPE] = { | ||
1869 | .constraints = { | ||
1870 | .name = "db8500-vape", | ||
1871 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1872 | }, | ||
1873 | .consumer_supplies = db8500_vape_consumers, | ||
1874 | .num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers), | ||
1875 | }, | ||
1876 | [DB8500_REGULATOR_VARM] = { | ||
1877 | .constraints = { | ||
1878 | .name = "db8500-varm", | ||
1879 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1880 | }, | ||
1881 | }, | ||
1882 | [DB8500_REGULATOR_VMODEM] = { | ||
1883 | .constraints = { | ||
1884 | .name = "db8500-vmodem", | ||
1885 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1886 | }, | ||
1887 | }, | ||
1888 | [DB8500_REGULATOR_VPLL] = { | ||
1889 | .constraints = { | ||
1890 | .name = "db8500-vpll", | ||
1891 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1892 | }, | ||
1893 | }, | ||
1894 | [DB8500_REGULATOR_VSMPS1] = { | ||
1895 | .constraints = { | ||
1896 | .name = "db8500-vsmps1", | ||
1897 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1898 | }, | ||
1899 | }, | ||
1900 | [DB8500_REGULATOR_VSMPS2] = { | ||
1901 | .constraints = { | ||
1902 | .name = "db8500-vsmps2", | ||
1903 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1904 | }, | ||
1905 | .consumer_supplies = db8500_vsmps2_consumers, | ||
1906 | .num_consumer_supplies = ARRAY_SIZE(db8500_vsmps2_consumers), | ||
1907 | }, | ||
1908 | [DB8500_REGULATOR_VSMPS3] = { | ||
1909 | .constraints = { | ||
1910 | .name = "db8500-vsmps3", | ||
1911 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1912 | }, | ||
1913 | }, | ||
1914 | [DB8500_REGULATOR_VRF1] = { | ||
1915 | .constraints = { | ||
1916 | .name = "db8500-vrf1", | ||
1917 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1918 | }, | ||
1919 | }, | ||
1920 | [DB8500_REGULATOR_SWITCH_SVAMMDSP] = { | ||
1921 | .supply_regulator = "db8500-vape", | ||
1922 | .constraints = { | ||
1923 | .name = "db8500-sva-mmdsp", | ||
1924 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1925 | }, | ||
1926 | }, | ||
1927 | [DB8500_REGULATOR_SWITCH_SVAMMDSPRET] = { | ||
1928 | .constraints = { | ||
1929 | /* "ret" means "retention" */ | ||
1930 | .name = "db8500-sva-mmdsp-ret", | ||
1931 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1932 | }, | ||
1933 | }, | ||
1934 | [DB8500_REGULATOR_SWITCH_SVAPIPE] = { | ||
1935 | .supply_regulator = "db8500-vape", | ||
1936 | .constraints = { | ||
1937 | .name = "db8500-sva-pipe", | ||
1938 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1939 | }, | ||
1940 | }, | ||
1941 | [DB8500_REGULATOR_SWITCH_SIAMMDSP] = { | ||
1942 | .supply_regulator = "db8500-vape", | ||
1943 | .constraints = { | ||
1944 | .name = "db8500-sia-mmdsp", | ||
1945 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1946 | }, | ||
1947 | }, | ||
1948 | [DB8500_REGULATOR_SWITCH_SIAMMDSPRET] = { | ||
1949 | .constraints = { | ||
1950 | .name = "db8500-sia-mmdsp-ret", | ||
1951 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1952 | }, | ||
1953 | }, | ||
1954 | [DB8500_REGULATOR_SWITCH_SIAPIPE] = { | ||
1955 | .supply_regulator = "db8500-vape", | ||
1956 | .constraints = { | ||
1957 | .name = "db8500-sia-pipe", | ||
1958 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1959 | }, | ||
1960 | }, | ||
1961 | [DB8500_REGULATOR_SWITCH_SGA] = { | ||
1962 | .supply_regulator = "db8500-vape", | ||
1963 | .constraints = { | ||
1964 | .name = "db8500-sga", | ||
1965 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1966 | }, | ||
1967 | }, | ||
1968 | [DB8500_REGULATOR_SWITCH_B2R2_MCDE] = { | ||
1969 | .supply_regulator = "db8500-vape", | ||
1970 | .constraints = { | ||
1971 | .name = "db8500-b2r2-mcde", | ||
1972 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1973 | }, | ||
1974 | .consumer_supplies = db8500_b2r2_mcde_consumers, | ||
1975 | .num_consumer_supplies = ARRAY_SIZE(db8500_b2r2_mcde_consumers), | ||
1976 | }, | ||
1977 | [DB8500_REGULATOR_SWITCH_ESRAM12] = { | ||
1978 | .supply_regulator = "db8500-vape", | ||
1979 | .constraints = { | ||
1980 | .name = "db8500-esram12", | ||
1981 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1982 | }, | ||
1983 | }, | ||
1984 | [DB8500_REGULATOR_SWITCH_ESRAM12RET] = { | ||
1985 | .constraints = { | ||
1986 | .name = "db8500-esram12-ret", | ||
1987 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1988 | }, | ||
1989 | }, | ||
1990 | [DB8500_REGULATOR_SWITCH_ESRAM34] = { | ||
1991 | .supply_regulator = "db8500-vape", | ||
1992 | .constraints = { | ||
1993 | .name = "db8500-esram34", | ||
1994 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
1995 | }, | ||
1996 | }, | ||
1997 | [DB8500_REGULATOR_SWITCH_ESRAM34RET] = { | ||
1998 | .constraints = { | ||
1999 | .name = "db8500-esram34-ret", | ||
2000 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
2001 | }, | ||
2002 | }, | ||
2003 | }; | ||
2004 | |||
2005 | static struct mfd_cell db8500_prcmu_devs[] = { | ||
2006 | { | ||
2007 | .name = "db8500-prcmu-regulators", | ||
2008 | .mfd_data = &db8500_regulators, | ||
2009 | }, | ||
2010 | { | ||
2011 | .name = "cpufreq-u8500", | ||
2012 | }, | ||
2013 | }; | ||
2014 | |||
2015 | /** | ||
2016 | * prcmu_fw_init - arch init call for the Linux PRCMU fw init logic | ||
2017 | * | ||
2018 | */ | ||
2019 | static int __init db8500_prcmu_probe(struct platform_device *pdev) | ||
2020 | { | ||
2021 | int err = 0; | ||
2022 | |||
2023 | if (ux500_is_svp()) | ||
2024 | return -ENODEV; | ||
2025 | |||
2026 | /* Clean up the mailbox interrupts after pre-kernel code. */ | ||
2027 | writel(ALL_MBOX_BITS, (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); | ||
2028 | |||
2029 | err = request_threaded_irq(IRQ_DB8500_PRCMU1, prcmu_irq_handler, | ||
2030 | prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL); | ||
2031 | if (err < 0) { | ||
2032 | pr_err("prcmu: Failed to allocate IRQ_DB8500_PRCMU1.\n"); | ||
2033 | err = -EBUSY; | ||
2034 | goto no_irq_return; | ||
2035 | } | ||
2036 | |||
2037 | if (cpu_is_u8500v20_or_later()) | ||
2038 | prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); | ||
2039 | |||
2040 | err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs, | ||
2041 | ARRAY_SIZE(db8500_prcmu_devs), NULL, | ||
2042 | 0); | ||
2043 | |||
2044 | if (err) | ||
2045 | pr_err("prcmu: Failed to add subdevices\n"); | ||
2046 | else | ||
2047 | pr_info("DB8500 PRCMU initialized\n"); | ||
2048 | |||
2049 | no_irq_return: | ||
2050 | return err; | ||
2051 | } | ||
2052 | |||
2053 | static struct platform_driver db8500_prcmu_driver = { | ||
2054 | .driver = { | ||
2055 | .name = "db8500-prcmu", | ||
2056 | .owner = THIS_MODULE, | ||
2057 | }, | ||
2058 | }; | ||
2059 | |||
2060 | static int __init db8500_prcmu_init(void) | ||
2061 | { | ||
2062 | return platform_driver_probe(&db8500_prcmu_driver, db8500_prcmu_probe); | ||
2063 | } | ||
2064 | |||
2065 | arch_initcall(db8500_prcmu_init); | ||
2066 | |||
2067 | MODULE_AUTHOR("Mattias Nilsson <mattias.i.nilsson@stericsson.com>"); | ||
2068 | MODULE_DESCRIPTION("DB8500 PRCM Unit driver"); | ||
2069 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/net/tile/tilepro.c b/drivers/net/tile/tilepro.c index 1e980fdd9d77..1e2af96fc29c 100644 --- a/drivers/net/tile/tilepro.c +++ b/drivers/net/tile/tilepro.c | |||
@@ -1658,11 +1658,9 @@ static int tile_net_stop(struct net_device *dev) | |||
1658 | while (tile_net_lepp_free_comps(dev, true)) | 1658 | while (tile_net_lepp_free_comps(dev, true)) |
1659 | /* loop */; | 1659 | /* loop */; |
1660 | 1660 | ||
1661 | /* Wipe the EPP queue. */ | 1661 | /* Wipe the EPP queue, and wait till the stores hit the EPP. */ |
1662 | memset(priv->eq, 0, sizeof(lepp_queue_t)); | 1662 | memset(priv->eq, 0, sizeof(lepp_queue_t)); |
1663 | 1663 | mb(); | |
1664 | /* Evict the EPP queue. */ | ||
1665 | finv_buffer(priv->eq, EQ_SIZE); | ||
1666 | 1664 | ||
1667 | return 0; | 1665 | return 0; |
1668 | } | 1666 | } |
@@ -2398,7 +2396,7 @@ static void tile_net_cleanup(void) | |||
2398 | struct net_device *dev = tile_net_devs[i]; | 2396 | struct net_device *dev = tile_net_devs[i]; |
2399 | struct tile_net_priv *priv = netdev_priv(dev); | 2397 | struct tile_net_priv *priv = netdev_priv(dev); |
2400 | unregister_netdev(dev); | 2398 | unregister_netdev(dev); |
2401 | finv_buffer(priv->eq, EQ_SIZE); | 2399 | finv_buffer_remote(priv->eq, EQ_SIZE, 0); |
2402 | __free_pages(priv->eq_pages, EQ_ORDER); | 2400 | __free_pages(priv->eq_pages, EQ_ORDER); |
2403 | free_netdev(dev); | 2401 | free_netdev(dev); |
2404 | } | 2402 | } |
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index b9f29e0d4295..f0b13a0d1851 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -274,6 +274,13 @@ config REGULATOR_AB8500 | |||
274 | This driver supports the regulators found on the ST-Ericsson mixed | 274 | This driver supports the regulators found on the ST-Ericsson mixed |
275 | signal AB8500 PMIC | 275 | signal AB8500 PMIC |
276 | 276 | ||
277 | config REGULATOR_DB8500_PRCMU | ||
278 | bool "ST-Ericsson DB8500 Voltage Domain Regulators" | ||
279 | depends on MFD_DB8500_PRCMU | ||
280 | help | ||
281 | This driver supports the voltage domain regulators controlled by the | ||
282 | DB8500 PRCMU | ||
283 | |||
277 | config REGULATOR_TPS6586X | 284 | config REGULATOR_TPS6586X |
278 | tristate "TI TPS6586X Power regulators" | 285 | tristate "TI TPS6586X Power regulators" |
279 | depends on MFD_TPS6586X | 286 | depends on MFD_TPS6586X |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index d72a42756778..165ff5371e9e 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
@@ -41,5 +41,6 @@ obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o | |||
41 | obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o | 41 | obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o |
42 | obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o | 42 | obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o |
43 | obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o | 43 | obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o |
44 | obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o | ||
44 | 45 | ||
45 | ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG | 46 | ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG |
diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c new file mode 100644 index 000000000000..1089a961616e --- /dev/null +++ b/drivers/regulator/db8500-prcmu.c | |||
@@ -0,0 +1,558 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License Terms: GNU General Public License v2 | ||
5 | * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson | ||
6 | * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson | ||
7 | * | ||
8 | * Power domain regulators on DB8500 | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/err.h> | ||
14 | #include <linux/spinlock.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/mfd/core.h> | ||
17 | #include <linux/mfd/db8500-prcmu.h> | ||
18 | #include <linux/regulator/driver.h> | ||
19 | #include <linux/regulator/machine.h> | ||
20 | #include <linux/regulator/db8500-prcmu.h> | ||
21 | |||
22 | /* | ||
23 | * power state reference count | ||
24 | */ | ||
25 | static int power_state_active_cnt; /* will initialize to zero */ | ||
26 | static DEFINE_SPINLOCK(power_state_active_lock); | ||
27 | |||
28 | static void power_state_active_enable(void) | ||
29 | { | ||
30 | unsigned long flags; | ||
31 | |||
32 | spin_lock_irqsave(&power_state_active_lock, flags); | ||
33 | power_state_active_cnt++; | ||
34 | spin_unlock_irqrestore(&power_state_active_lock, flags); | ||
35 | } | ||
36 | |||
37 | static int power_state_active_disable(void) | ||
38 | { | ||
39 | int ret = 0; | ||
40 | unsigned long flags; | ||
41 | |||
42 | spin_lock_irqsave(&power_state_active_lock, flags); | ||
43 | if (power_state_active_cnt <= 0) { | ||
44 | pr_err("power state: unbalanced enable/disable calls\n"); | ||
45 | ret = -EINVAL; | ||
46 | goto out; | ||
47 | } | ||
48 | |||
49 | power_state_active_cnt--; | ||
50 | out: | ||
51 | spin_unlock_irqrestore(&power_state_active_lock, flags); | ||
52 | return ret; | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * Exported interface for CPUIdle only. This function is called when interrupts | ||
57 | * are turned off. Hence, no locking. | ||
58 | */ | ||
59 | int power_state_active_is_enabled(void) | ||
60 | { | ||
61 | return (power_state_active_cnt > 0); | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * struct db8500_regulator_info - db8500 regulator information | ||
66 | * @dev: device pointer | ||
67 | * @desc: regulator description | ||
68 | * @rdev: regulator device pointer | ||
69 | * @is_enabled: status of the regulator | ||
70 | * @epod_id: id for EPOD (power domain) | ||
71 | * @is_ramret: RAM retention switch for EPOD (power domain) | ||
72 | * @operating_point: operating point (only for vape, to be removed) | ||
73 | * | ||
74 | */ | ||
75 | struct db8500_regulator_info { | ||
76 | struct device *dev; | ||
77 | struct regulator_desc desc; | ||
78 | struct regulator_dev *rdev; | ||
79 | bool is_enabled; | ||
80 | u16 epod_id; | ||
81 | bool is_ramret; | ||
82 | bool exclude_from_power_state; | ||
83 | unsigned int operating_point; | ||
84 | }; | ||
85 | |||
86 | static int db8500_regulator_enable(struct regulator_dev *rdev) | ||
87 | { | ||
88 | struct db8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
89 | |||
90 | if (info == NULL) | ||
91 | return -EINVAL; | ||
92 | |||
93 | dev_vdbg(rdev_get_dev(rdev), "regulator-%s-enable\n", | ||
94 | info->desc.name); | ||
95 | |||
96 | info->is_enabled = true; | ||
97 | if (!info->exclude_from_power_state) | ||
98 | power_state_active_enable(); | ||
99 | |||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | static int db8500_regulator_disable(struct regulator_dev *rdev) | ||
104 | { | ||
105 | struct db8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
106 | int ret = 0; | ||
107 | |||
108 | if (info == NULL) | ||
109 | return -EINVAL; | ||
110 | |||
111 | dev_vdbg(rdev_get_dev(rdev), "regulator-%s-disable\n", | ||
112 | info->desc.name); | ||
113 | |||
114 | info->is_enabled = false; | ||
115 | if (!info->exclude_from_power_state) | ||
116 | ret = power_state_active_disable(); | ||
117 | |||
118 | return ret; | ||
119 | } | ||
120 | |||
121 | static int db8500_regulator_is_enabled(struct regulator_dev *rdev) | ||
122 | { | ||
123 | struct db8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
124 | |||
125 | if (info == NULL) | ||
126 | return -EINVAL; | ||
127 | |||
128 | dev_vdbg(rdev_get_dev(rdev), "regulator-%s-is_enabled (is_enabled):" | ||
129 | " %i\n", info->desc.name, info->is_enabled); | ||
130 | |||
131 | return info->is_enabled; | ||
132 | } | ||
133 | |||
134 | /* db8500 regulator operations */ | ||
135 | static struct regulator_ops db8500_regulator_ops = { | ||
136 | .enable = db8500_regulator_enable, | ||
137 | .disable = db8500_regulator_disable, | ||
138 | .is_enabled = db8500_regulator_is_enabled, | ||
139 | }; | ||
140 | |||
141 | /* | ||
142 | * EPOD control | ||
143 | */ | ||
144 | static bool epod_on[NUM_EPOD_ID]; | ||
145 | static bool epod_ramret[NUM_EPOD_ID]; | ||
146 | |||
147 | static int enable_epod(u16 epod_id, bool ramret) | ||
148 | { | ||
149 | int ret; | ||
150 | |||
151 | if (ramret) { | ||
152 | if (!epod_on[epod_id]) { | ||
153 | ret = prcmu_set_epod(epod_id, EPOD_STATE_RAMRET); | ||
154 | if (ret < 0) | ||
155 | return ret; | ||
156 | } | ||
157 | epod_ramret[epod_id] = true; | ||
158 | } else { | ||
159 | ret = prcmu_set_epod(epod_id, EPOD_STATE_ON); | ||
160 | if (ret < 0) | ||
161 | return ret; | ||
162 | epod_on[epod_id] = true; | ||
163 | } | ||
164 | |||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | static int disable_epod(u16 epod_id, bool ramret) | ||
169 | { | ||
170 | int ret; | ||
171 | |||
172 | if (ramret) { | ||
173 | if (!epod_on[epod_id]) { | ||
174 | ret = prcmu_set_epod(epod_id, EPOD_STATE_OFF); | ||
175 | if (ret < 0) | ||
176 | return ret; | ||
177 | } | ||
178 | epod_ramret[epod_id] = false; | ||
179 | } else { | ||
180 | if (epod_ramret[epod_id]) { | ||
181 | ret = prcmu_set_epod(epod_id, EPOD_STATE_RAMRET); | ||
182 | if (ret < 0) | ||
183 | return ret; | ||
184 | } else { | ||
185 | ret = prcmu_set_epod(epod_id, EPOD_STATE_OFF); | ||
186 | if (ret < 0) | ||
187 | return ret; | ||
188 | } | ||
189 | epod_on[epod_id] = false; | ||
190 | } | ||
191 | |||
192 | return 0; | ||
193 | } | ||
194 | |||
195 | /* | ||
196 | * Regulator switch | ||
197 | */ | ||
198 | static int db8500_regulator_switch_enable(struct regulator_dev *rdev) | ||
199 | { | ||
200 | struct db8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
201 | int ret; | ||
202 | |||
203 | if (info == NULL) | ||
204 | return -EINVAL; | ||
205 | |||
206 | dev_vdbg(rdev_get_dev(rdev), "regulator-switch-%s-enable\n", | ||
207 | info->desc.name); | ||
208 | |||
209 | ret = enable_epod(info->epod_id, info->is_ramret); | ||
210 | if (ret < 0) { | ||
211 | dev_err(rdev_get_dev(rdev), | ||
212 | "regulator-switch-%s-enable: prcmu call failed\n", | ||
213 | info->desc.name); | ||
214 | goto out; | ||
215 | } | ||
216 | |||
217 | info->is_enabled = true; | ||
218 | out: | ||
219 | return ret; | ||
220 | } | ||
221 | |||
222 | static int db8500_regulator_switch_disable(struct regulator_dev *rdev) | ||
223 | { | ||
224 | struct db8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
225 | int ret; | ||
226 | |||
227 | if (info == NULL) | ||
228 | return -EINVAL; | ||
229 | |||
230 | dev_vdbg(rdev_get_dev(rdev), "regulator-switch-%s-disable\n", | ||
231 | info->desc.name); | ||
232 | |||
233 | ret = disable_epod(info->epod_id, info->is_ramret); | ||
234 | if (ret < 0) { | ||
235 | dev_err(rdev_get_dev(rdev), | ||
236 | "regulator_switch-%s-disable: prcmu call failed\n", | ||
237 | info->desc.name); | ||
238 | goto out; | ||
239 | } | ||
240 | |||
241 | info->is_enabled = 0; | ||
242 | out: | ||
243 | return ret; | ||
244 | } | ||
245 | |||
246 | static int db8500_regulator_switch_is_enabled(struct regulator_dev *rdev) | ||
247 | { | ||
248 | struct db8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
249 | |||
250 | if (info == NULL) | ||
251 | return -EINVAL; | ||
252 | |||
253 | dev_vdbg(rdev_get_dev(rdev), | ||
254 | "regulator-switch-%s-is_enabled (is_enabled): %i\n", | ||
255 | info->desc.name, info->is_enabled); | ||
256 | |||
257 | return info->is_enabled; | ||
258 | } | ||
259 | |||
260 | static struct regulator_ops db8500_regulator_switch_ops = { | ||
261 | .enable = db8500_regulator_switch_enable, | ||
262 | .disable = db8500_regulator_switch_disable, | ||
263 | .is_enabled = db8500_regulator_switch_is_enabled, | ||
264 | }; | ||
265 | |||
266 | /* | ||
267 | * Regulator information | ||
268 | */ | ||
269 | static struct db8500_regulator_info | ||
270 | db8500_regulator_info[DB8500_NUM_REGULATORS] = { | ||
271 | [DB8500_REGULATOR_VAPE] = { | ||
272 | .desc = { | ||
273 | .name = "db8500-vape", | ||
274 | .id = DB8500_REGULATOR_VAPE, | ||
275 | .ops = &db8500_regulator_ops, | ||
276 | .type = REGULATOR_VOLTAGE, | ||
277 | .owner = THIS_MODULE, | ||
278 | }, | ||
279 | }, | ||
280 | [DB8500_REGULATOR_VARM] = { | ||
281 | .desc = { | ||
282 | .name = "db8500-varm", | ||
283 | .id = DB8500_REGULATOR_VARM, | ||
284 | .ops = &db8500_regulator_ops, | ||
285 | .type = REGULATOR_VOLTAGE, | ||
286 | .owner = THIS_MODULE, | ||
287 | }, | ||
288 | }, | ||
289 | [DB8500_REGULATOR_VMODEM] = { | ||
290 | .desc = { | ||
291 | .name = "db8500-vmodem", | ||
292 | .id = DB8500_REGULATOR_VMODEM, | ||
293 | .ops = &db8500_regulator_ops, | ||
294 | .type = REGULATOR_VOLTAGE, | ||
295 | .owner = THIS_MODULE, | ||
296 | }, | ||
297 | }, | ||
298 | [DB8500_REGULATOR_VPLL] = { | ||
299 | .desc = { | ||
300 | .name = "db8500-vpll", | ||
301 | .id = DB8500_REGULATOR_VPLL, | ||
302 | .ops = &db8500_regulator_ops, | ||
303 | .type = REGULATOR_VOLTAGE, | ||
304 | .owner = THIS_MODULE, | ||
305 | }, | ||
306 | }, | ||
307 | [DB8500_REGULATOR_VSMPS1] = { | ||
308 | .desc = { | ||
309 | .name = "db8500-vsmps1", | ||
310 | .id = DB8500_REGULATOR_VSMPS1, | ||
311 | .ops = &db8500_regulator_ops, | ||
312 | .type = REGULATOR_VOLTAGE, | ||
313 | .owner = THIS_MODULE, | ||
314 | }, | ||
315 | }, | ||
316 | [DB8500_REGULATOR_VSMPS2] = { | ||
317 | .desc = { | ||
318 | .name = "db8500-vsmps2", | ||
319 | .id = DB8500_REGULATOR_VSMPS2, | ||
320 | .ops = &db8500_regulator_ops, | ||
321 | .type = REGULATOR_VOLTAGE, | ||
322 | .owner = THIS_MODULE, | ||
323 | }, | ||
324 | .exclude_from_power_state = true, | ||
325 | }, | ||
326 | [DB8500_REGULATOR_VSMPS3] = { | ||
327 | .desc = { | ||
328 | .name = "db8500-vsmps3", | ||
329 | .id = DB8500_REGULATOR_VSMPS3, | ||
330 | .ops = &db8500_regulator_ops, | ||
331 | .type = REGULATOR_VOLTAGE, | ||
332 | .owner = THIS_MODULE, | ||
333 | }, | ||
334 | }, | ||
335 | [DB8500_REGULATOR_VRF1] = { | ||
336 | .desc = { | ||
337 | .name = "db8500-vrf1", | ||
338 | .id = DB8500_REGULATOR_VRF1, | ||
339 | .ops = &db8500_regulator_ops, | ||
340 | .type = REGULATOR_VOLTAGE, | ||
341 | .owner = THIS_MODULE, | ||
342 | }, | ||
343 | }, | ||
344 | [DB8500_REGULATOR_SWITCH_SVAMMDSP] = { | ||
345 | .desc = { | ||
346 | .name = "db8500-sva-mmdsp", | ||
347 | .id = DB8500_REGULATOR_SWITCH_SVAMMDSP, | ||
348 | .ops = &db8500_regulator_switch_ops, | ||
349 | .type = REGULATOR_VOLTAGE, | ||
350 | .owner = THIS_MODULE, | ||
351 | }, | ||
352 | .epod_id = EPOD_ID_SVAMMDSP, | ||
353 | }, | ||
354 | [DB8500_REGULATOR_SWITCH_SVAMMDSPRET] = { | ||
355 | .desc = { | ||
356 | .name = "db8500-sva-mmdsp-ret", | ||
357 | .id = DB8500_REGULATOR_SWITCH_SVAMMDSPRET, | ||
358 | .ops = &db8500_regulator_switch_ops, | ||
359 | .type = REGULATOR_VOLTAGE, | ||
360 | .owner = THIS_MODULE, | ||
361 | }, | ||
362 | .epod_id = EPOD_ID_SVAMMDSP, | ||
363 | .is_ramret = true, | ||
364 | }, | ||
365 | [DB8500_REGULATOR_SWITCH_SVAPIPE] = { | ||
366 | .desc = { | ||
367 | .name = "db8500-sva-pipe", | ||
368 | .id = DB8500_REGULATOR_SWITCH_SVAPIPE, | ||
369 | .ops = &db8500_regulator_switch_ops, | ||
370 | .type = REGULATOR_VOLTAGE, | ||
371 | .owner = THIS_MODULE, | ||
372 | }, | ||
373 | .epod_id = EPOD_ID_SVAPIPE, | ||
374 | }, | ||
375 | [DB8500_REGULATOR_SWITCH_SIAMMDSP] = { | ||
376 | .desc = { | ||
377 | .name = "db8500-sia-mmdsp", | ||
378 | .id = DB8500_REGULATOR_SWITCH_SIAMMDSP, | ||
379 | .ops = &db8500_regulator_switch_ops, | ||
380 | .type = REGULATOR_VOLTAGE, | ||
381 | .owner = THIS_MODULE, | ||
382 | }, | ||
383 | .epod_id = EPOD_ID_SIAMMDSP, | ||
384 | }, | ||
385 | [DB8500_REGULATOR_SWITCH_SIAMMDSPRET] = { | ||
386 | .desc = { | ||
387 | .name = "db8500-sia-mmdsp-ret", | ||
388 | .id = DB8500_REGULATOR_SWITCH_SIAMMDSPRET, | ||
389 | .ops = &db8500_regulator_switch_ops, | ||
390 | .type = REGULATOR_VOLTAGE, | ||
391 | .owner = THIS_MODULE, | ||
392 | }, | ||
393 | .epod_id = EPOD_ID_SIAMMDSP, | ||
394 | .is_ramret = true, | ||
395 | }, | ||
396 | [DB8500_REGULATOR_SWITCH_SIAPIPE] = { | ||
397 | .desc = { | ||
398 | .name = "db8500-sia-pipe", | ||
399 | .id = DB8500_REGULATOR_SWITCH_SIAPIPE, | ||
400 | .ops = &db8500_regulator_switch_ops, | ||
401 | .type = REGULATOR_VOLTAGE, | ||
402 | .owner = THIS_MODULE, | ||
403 | }, | ||
404 | .epod_id = EPOD_ID_SIAPIPE, | ||
405 | }, | ||
406 | [DB8500_REGULATOR_SWITCH_SGA] = { | ||
407 | .desc = { | ||
408 | .name = "db8500-sga", | ||
409 | .id = DB8500_REGULATOR_SWITCH_SGA, | ||
410 | .ops = &db8500_regulator_switch_ops, | ||
411 | .type = REGULATOR_VOLTAGE, | ||
412 | .owner = THIS_MODULE, | ||
413 | }, | ||
414 | .epod_id = EPOD_ID_SGA, | ||
415 | }, | ||
416 | [DB8500_REGULATOR_SWITCH_B2R2_MCDE] = { | ||
417 | .desc = { | ||
418 | .name = "db8500-b2r2-mcde", | ||
419 | .id = DB8500_REGULATOR_SWITCH_B2R2_MCDE, | ||
420 | .ops = &db8500_regulator_switch_ops, | ||
421 | .type = REGULATOR_VOLTAGE, | ||
422 | .owner = THIS_MODULE, | ||
423 | }, | ||
424 | .epod_id = EPOD_ID_B2R2_MCDE, | ||
425 | }, | ||
426 | [DB8500_REGULATOR_SWITCH_ESRAM12] = { | ||
427 | .desc = { | ||
428 | .name = "db8500-esram12", | ||
429 | .id = DB8500_REGULATOR_SWITCH_ESRAM12, | ||
430 | .ops = &db8500_regulator_switch_ops, | ||
431 | .type = REGULATOR_VOLTAGE, | ||
432 | .owner = THIS_MODULE, | ||
433 | }, | ||
434 | .epod_id = EPOD_ID_ESRAM12, | ||
435 | .is_enabled = true, | ||
436 | }, | ||
437 | [DB8500_REGULATOR_SWITCH_ESRAM12RET] = { | ||
438 | .desc = { | ||
439 | .name = "db8500-esram12-ret", | ||
440 | .id = DB8500_REGULATOR_SWITCH_ESRAM12RET, | ||
441 | .ops = &db8500_regulator_switch_ops, | ||
442 | .type = REGULATOR_VOLTAGE, | ||
443 | .owner = THIS_MODULE, | ||
444 | }, | ||
445 | .epod_id = EPOD_ID_ESRAM12, | ||
446 | .is_ramret = true, | ||
447 | }, | ||
448 | [DB8500_REGULATOR_SWITCH_ESRAM34] = { | ||
449 | .desc = { | ||
450 | .name = "db8500-esram34", | ||
451 | .id = DB8500_REGULATOR_SWITCH_ESRAM34, | ||
452 | .ops = &db8500_regulator_switch_ops, | ||
453 | .type = REGULATOR_VOLTAGE, | ||
454 | .owner = THIS_MODULE, | ||
455 | }, | ||
456 | .epod_id = EPOD_ID_ESRAM34, | ||
457 | .is_enabled = true, | ||
458 | }, | ||
459 | [DB8500_REGULATOR_SWITCH_ESRAM34RET] = { | ||
460 | .desc = { | ||
461 | .name = "db8500-esram34-ret", | ||
462 | .id = DB8500_REGULATOR_SWITCH_ESRAM34RET, | ||
463 | .ops = &db8500_regulator_switch_ops, | ||
464 | .type = REGULATOR_VOLTAGE, | ||
465 | .owner = THIS_MODULE, | ||
466 | }, | ||
467 | .epod_id = EPOD_ID_ESRAM34, | ||
468 | .is_ramret = true, | ||
469 | }, | ||
470 | }; | ||
471 | |||
472 | static int __devinit db8500_regulator_probe(struct platform_device *pdev) | ||
473 | { | ||
474 | struct regulator_init_data *db8500_init_data = mfd_get_data(pdev); | ||
475 | int i, err; | ||
476 | |||
477 | /* register all regulators */ | ||
478 | for (i = 0; i < ARRAY_SIZE(db8500_regulator_info); i++) { | ||
479 | struct db8500_regulator_info *info; | ||
480 | struct regulator_init_data *init_data = &db8500_init_data[i]; | ||
481 | |||
482 | /* assign per-regulator data */ | ||
483 | info = &db8500_regulator_info[i]; | ||
484 | info->dev = &pdev->dev; | ||
485 | |||
486 | /* register with the regulator framework */ | ||
487 | info->rdev = regulator_register(&info->desc, &pdev->dev, | ||
488 | init_data, info); | ||
489 | if (IS_ERR(info->rdev)) { | ||
490 | err = PTR_ERR(info->rdev); | ||
491 | dev_err(&pdev->dev, "failed to register %s: err %i\n", | ||
492 | info->desc.name, err); | ||
493 | |||
494 | /* if failing, unregister all earlier regulators */ | ||
495 | i--; | ||
496 | while (i >= 0) { | ||
497 | info = &db8500_regulator_info[i]; | ||
498 | regulator_unregister(info->rdev); | ||
499 | i--; | ||
500 | } | ||
501 | return err; | ||
502 | } | ||
503 | |||
504 | dev_dbg(rdev_get_dev(info->rdev), | ||
505 | "regulator-%s-probed\n", info->desc.name); | ||
506 | } | ||
507 | |||
508 | return 0; | ||
509 | } | ||
510 | |||
511 | static int __exit db8500_regulator_remove(struct platform_device *pdev) | ||
512 | { | ||
513 | int i; | ||
514 | |||
515 | for (i = 0; i < ARRAY_SIZE(db8500_regulator_info); i++) { | ||
516 | struct db8500_regulator_info *info; | ||
517 | info = &db8500_regulator_info[i]; | ||
518 | |||
519 | dev_vdbg(rdev_get_dev(info->rdev), | ||
520 | "regulator-%s-remove\n", info->desc.name); | ||
521 | |||
522 | regulator_unregister(info->rdev); | ||
523 | } | ||
524 | |||
525 | return 0; | ||
526 | } | ||
527 | |||
528 | static struct platform_driver db8500_regulator_driver = { | ||
529 | .driver = { | ||
530 | .name = "db8500-prcmu-regulators", | ||
531 | .owner = THIS_MODULE, | ||
532 | }, | ||
533 | .probe = db8500_regulator_probe, | ||
534 | .remove = __exit_p(db8500_regulator_remove), | ||
535 | }; | ||
536 | |||
537 | static int __init db8500_regulator_init(void) | ||
538 | { | ||
539 | int ret; | ||
540 | |||
541 | ret = platform_driver_register(&db8500_regulator_driver); | ||
542 | if (ret < 0) | ||
543 | return -ENODEV; | ||
544 | |||
545 | return 0; | ||
546 | } | ||
547 | |||
548 | static void __exit db8500_regulator_exit(void) | ||
549 | { | ||
550 | platform_driver_unregister(&db8500_regulator_driver); | ||
551 | } | ||
552 | |||
553 | arch_initcall(db8500_regulator_init); | ||
554 | module_exit(db8500_regulator_exit); | ||
555 | |||
556 | MODULE_AUTHOR("STMicroelectronics/ST-Ericsson"); | ||
557 | MODULE_DESCRIPTION("DB8500 regulator driver"); | ||
558 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 42891726ea72..b8f4e9e66cd5 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -992,4 +992,11 @@ config RTC_DRV_TEGRA | |||
992 | This drive can also be built as a module. If so, the module | 992 | This drive can also be built as a module. If so, the module |
993 | will be called rtc-tegra. | 993 | will be called rtc-tegra. |
994 | 994 | ||
995 | config RTC_DRV_TILE | ||
996 | tristate "Tilera hypervisor RTC support" | ||
997 | depends on TILE | ||
998 | help | ||
999 | Enable support for the Linux driver side of the Tilera | ||
1000 | hypervisor's real-time clock interface. | ||
1001 | |||
995 | endif # RTC_CLASS | 1002 | endif # RTC_CLASS |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index ca91c3c42e98..9574748d1c73 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
@@ -93,6 +93,7 @@ obj-$(CONFIG_RTC_DRV_STMP) += rtc-stmp3xxx.o | |||
93 | obj-$(CONFIG_RTC_DRV_SUN4V) += rtc-sun4v.o | 93 | obj-$(CONFIG_RTC_DRV_SUN4V) += rtc-sun4v.o |
94 | obj-$(CONFIG_RTC_DRV_TEGRA) += rtc-tegra.o | 94 | obj-$(CONFIG_RTC_DRV_TEGRA) += rtc-tegra.o |
95 | obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o | 95 | obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o |
96 | obj-$(CONFIG_RTC_DRV_TILE) += rtc-tile.o | ||
96 | obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o | 97 | obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o |
97 | obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o | 98 | obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o |
98 | obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o | 99 | obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o |
diff --git a/drivers/rtc/rtc-tile.c b/drivers/rtc/rtc-tile.c new file mode 100644 index 000000000000..eb65dafee66e --- /dev/null +++ b/drivers/rtc/rtc-tile.c | |||
@@ -0,0 +1,162 @@ | |||
1 | /* | ||
2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * Tilera-specific RTC driver. | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/device.h> | ||
19 | #include <linux/rtc.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | |||
22 | /* Platform device pointer. */ | ||
23 | static struct platform_device *tile_rtc_platform_device; | ||
24 | |||
25 | /* | ||
26 | * RTC read routine. Gets time info from RTC chip via hypervisor syscall. | ||
27 | */ | ||
28 | static int read_rtc_time(struct device *dev, struct rtc_time *tm) | ||
29 | { | ||
30 | HV_RTCTime hvtm = hv_get_rtc(); | ||
31 | |||
32 | tm->tm_sec = hvtm.tm_sec; | ||
33 | tm->tm_min = hvtm.tm_min; | ||
34 | tm->tm_hour = hvtm.tm_hour; | ||
35 | tm->tm_mday = hvtm.tm_mday; | ||
36 | tm->tm_mon = hvtm.tm_mon; | ||
37 | tm->tm_year = hvtm.tm_year; | ||
38 | tm->tm_wday = 0; | ||
39 | tm->tm_yday = 0; | ||
40 | tm->tm_isdst = 0; | ||
41 | |||
42 | if (rtc_valid_tm(tm) < 0) | ||
43 | dev_warn(dev, "Read invalid date/time from RTC\n"); | ||
44 | |||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | /* | ||
49 | * RTC write routine. Sends time info to hypervisor via syscall, to be | ||
50 | * written to RTC chip. | ||
51 | */ | ||
52 | static int set_rtc_time(struct device *dev, struct rtc_time *tm) | ||
53 | { | ||
54 | HV_RTCTime hvtm; | ||
55 | |||
56 | hvtm.tm_sec = tm->tm_sec; | ||
57 | hvtm.tm_min = tm->tm_min; | ||
58 | hvtm.tm_hour = tm->tm_hour; | ||
59 | hvtm.tm_mday = tm->tm_mday; | ||
60 | hvtm.tm_mon = tm->tm_mon; | ||
61 | hvtm.tm_year = tm->tm_year; | ||
62 | |||
63 | hv_set_rtc(hvtm); | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * RTC read/write ops. | ||
70 | */ | ||
71 | static const struct rtc_class_ops tile_rtc_ops = { | ||
72 | .read_time = read_rtc_time, | ||
73 | .set_time = set_rtc_time, | ||
74 | }; | ||
75 | |||
76 | /* | ||
77 | * Device probe routine. | ||
78 | */ | ||
79 | static int __devinit tile_rtc_probe(struct platform_device *dev) | ||
80 | { | ||
81 | struct rtc_device *rtc; | ||
82 | |||
83 | rtc = rtc_device_register("tile", | ||
84 | &dev->dev, &tile_rtc_ops, THIS_MODULE); | ||
85 | |||
86 | if (IS_ERR(rtc)) | ||
87 | return PTR_ERR(rtc); | ||
88 | |||
89 | platform_set_drvdata(dev, rtc); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | /* | ||
95 | * Device cleanup routine. | ||
96 | */ | ||
97 | static int __devexit tile_rtc_remove(struct platform_device *dev) | ||
98 | { | ||
99 | struct rtc_device *rtc = platform_get_drvdata(dev); | ||
100 | |||
101 | if (rtc) | ||
102 | rtc_device_unregister(rtc); | ||
103 | |||
104 | platform_set_drvdata(dev, NULL); | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static struct platform_driver tile_rtc_platform_driver = { | ||
110 | .driver = { | ||
111 | .name = "rtc-tile", | ||
112 | .owner = THIS_MODULE, | ||
113 | }, | ||
114 | .probe = tile_rtc_probe, | ||
115 | .remove = __devexit_p(tile_rtc_remove), | ||
116 | }; | ||
117 | |||
118 | /* | ||
119 | * Driver init routine. | ||
120 | */ | ||
121 | static int __init tile_rtc_driver_init(void) | ||
122 | { | ||
123 | int err; | ||
124 | |||
125 | err = platform_driver_register(&tile_rtc_platform_driver); | ||
126 | if (err) | ||
127 | return err; | ||
128 | |||
129 | tile_rtc_platform_device = platform_device_alloc("rtc-tile", 0); | ||
130 | if (tile_rtc_platform_device == NULL) { | ||
131 | err = -ENOMEM; | ||
132 | goto exit_driver_unregister; | ||
133 | } | ||
134 | |||
135 | err = platform_device_add(tile_rtc_platform_device); | ||
136 | if (err) | ||
137 | goto exit_device_put; | ||
138 | |||
139 | return 0; | ||
140 | |||
141 | exit_device_put: | ||
142 | platform_device_put(tile_rtc_platform_device); | ||
143 | |||
144 | exit_driver_unregister: | ||
145 | platform_driver_unregister(&tile_rtc_platform_driver); | ||
146 | return err; | ||
147 | } | ||
148 | |||
149 | /* | ||
150 | * Driver cleanup routine. | ||
151 | */ | ||
152 | static void __exit tile_rtc_driver_exit(void) | ||
153 | { | ||
154 | platform_driver_unregister(&tile_rtc_platform_driver); | ||
155 | } | ||
156 | |||
157 | module_init(tile_rtc_driver_init); | ||
158 | module_exit(tile_rtc_driver_exit); | ||
159 | |||
160 | MODULE_DESCRIPTION("Tilera-specific Real Time Clock Driver"); | ||
161 | MODULE_LICENSE("GPL"); | ||
162 | MODULE_ALIAS("platform:rtc-tile"); | ||
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 95019c747cc1..4778e2707168 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -636,7 +636,7 @@ static int sr_probe(struct device *dev) | |||
636 | disk->first_minor = minor; | 636 | disk->first_minor = minor; |
637 | sprintf(disk->disk_name, "sr%d", minor); | 637 | sprintf(disk->disk_name, "sr%d", minor); |
638 | disk->fops = &sr_bdops; | 638 | disk->fops = &sr_bdops; |
639 | disk->flags = GENHD_FL_CD; | 639 | disk->flags = GENHD_FL_CD | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; |
640 | disk->events = DISK_EVENT_MEDIA_CHANGE | DISK_EVENT_EJECT_REQUEST; | 640 | disk->events = DISK_EVENT_MEDIA_CHANGE | DISK_EVENT_EJECT_REQUEST; |
641 | 641 | ||
642 | blk_queue_rq_timeout(sdev->request_queue, SR_TIMEOUT); | 642 | blk_queue_rq_timeout(sdev->request_queue, SR_TIMEOUT); |
diff --git a/fs/9p/Kconfig b/fs/9p/Kconfig index 814ac4e213a8..0a93dc1cb4ac 100644 --- a/fs/9p/Kconfig +++ b/fs/9p/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config 9P_FS | 1 | config 9P_FS |
2 | tristate "Plan 9 Resource Sharing Support (9P2000) (Experimental)" | 2 | tristate "Plan 9 Resource Sharing Support (9P2000)" |
3 | depends on INET && NET_9P && EXPERIMENTAL | 3 | depends on INET && NET_9P |
4 | help | 4 | help |
5 | If you say Y here, you will get experimental support for | 5 | If you say Y here, you will get experimental support for |
6 | Plan 9 resource sharing via the 9P2000 protocol. | 6 | Plan 9 resource sharing via the 9P2000 protocol. |
@@ -10,7 +10,6 @@ config 9P_FS | |||
10 | If unsure, say N. | 10 | If unsure, say N. |
11 | 11 | ||
12 | if 9P_FS | 12 | if 9P_FS |
13 | |||
14 | config 9P_FSCACHE | 13 | config 9P_FSCACHE |
15 | bool "Enable 9P client caching support (EXPERIMENTAL)" | 14 | bool "Enable 9P client caching support (EXPERIMENTAL)" |
16 | depends on EXPERIMENTAL | 15 | depends on EXPERIMENTAL |
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 82a7c38ddad0..691c78f58bef 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -259,7 +259,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, | |||
259 | if (IS_ERR(inode_fid)) { | 259 | if (IS_ERR(inode_fid)) { |
260 | err = PTR_ERR(inode_fid); | 260 | err = PTR_ERR(inode_fid); |
261 | mutex_unlock(&v9inode->v_mutex); | 261 | mutex_unlock(&v9inode->v_mutex); |
262 | goto error; | 262 | goto err_clunk_old_fid; |
263 | } | 263 | } |
264 | v9inode->writeback_fid = (void *) inode_fid; | 264 | v9inode->writeback_fid = (void *) inode_fid; |
265 | } | 265 | } |
@@ -267,8 +267,8 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, | |||
267 | /* Since we are opening a file, assign the open fid to the file */ | 267 | /* Since we are opening a file, assign the open fid to the file */ |
268 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); | 268 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); |
269 | if (IS_ERR(filp)) { | 269 | if (IS_ERR(filp)) { |
270 | p9_client_clunk(ofid); | 270 | err = PTR_ERR(filp); |
271 | return PTR_ERR(filp); | 271 | goto err_clunk_old_fid; |
272 | } | 272 | } |
273 | filp->private_data = ofid; | 273 | filp->private_data = ofid; |
274 | #ifdef CONFIG_9P_FSCACHE | 274 | #ifdef CONFIG_9P_FSCACHE |
@@ -278,10 +278,11 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, | |||
278 | return 0; | 278 | return 0; |
279 | 279 | ||
280 | error: | 280 | error: |
281 | if (ofid) | ||
282 | p9_client_clunk(ofid); | ||
283 | if (fid) | 281 | if (fid) |
284 | p9_client_clunk(fid); | 282 | p9_client_clunk(fid); |
283 | err_clunk_old_fid: | ||
284 | if (ofid) | ||
285 | p9_client_clunk(ofid); | ||
285 | return err; | 286 | return err; |
286 | } | 287 | } |
287 | 288 | ||
diff --git a/fs/block_dev.c b/fs/block_dev.c index bf9c7a720371..1f2b19978333 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1238,6 +1238,8 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) | |||
1238 | res = __blkdev_get(bdev, mode, 0); | 1238 | res = __blkdev_get(bdev, mode, 0); |
1239 | 1239 | ||
1240 | if (whole) { | 1240 | if (whole) { |
1241 | struct gendisk *disk = whole->bd_disk; | ||
1242 | |||
1241 | /* finish claiming */ | 1243 | /* finish claiming */ |
1242 | mutex_lock(&bdev->bd_mutex); | 1244 | mutex_lock(&bdev->bd_mutex); |
1243 | spin_lock(&bdev_lock); | 1245 | spin_lock(&bdev_lock); |
@@ -1264,15 +1266,16 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) | |||
1264 | spin_unlock(&bdev_lock); | 1266 | spin_unlock(&bdev_lock); |
1265 | 1267 | ||
1266 | /* | 1268 | /* |
1267 | * Block event polling for write claims. Any write | 1269 | * Block event polling for write claims if requested. Any |
1268 | * holder makes the write_holder state stick until all | 1270 | * write holder makes the write_holder state stick until |
1269 | * are released. This is good enough and tracking | 1271 | * all are released. This is good enough and tracking |
1270 | * individual writeable reference is too fragile given | 1272 | * individual writeable reference is too fragile given the |
1271 | * the way @mode is used in blkdev_get/put(). | 1273 | * way @mode is used in blkdev_get/put(). |
1272 | */ | 1274 | */ |
1273 | if (!res && (mode & FMODE_WRITE) && !bdev->bd_write_holder) { | 1275 | if ((disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE) && |
1276 | !res && (mode & FMODE_WRITE) && !bdev->bd_write_holder) { | ||
1274 | bdev->bd_write_holder = true; | 1277 | bdev->bd_write_holder = true; |
1275 | disk_block_events(bdev->bd_disk); | 1278 | disk_block_events(disk); |
1276 | } | 1279 | } |
1277 | 1280 | ||
1278 | mutex_unlock(&bdev->bd_mutex); | 1281 | mutex_unlock(&bdev->bd_mutex); |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 38b8ab554924..33da49dc3cc6 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -848,7 +848,8 @@ get_more_pages: | |||
848 | op->payload_len = cpu_to_le32(len); | 848 | op->payload_len = cpu_to_le32(len); |
849 | req->r_request->hdr.data_len = cpu_to_le32(len); | 849 | req->r_request->hdr.data_len = cpu_to_le32(len); |
850 | 850 | ||
851 | ceph_osdc_start_request(&fsc->client->osdc, req, true); | 851 | rc = ceph_osdc_start_request(&fsc->client->osdc, req, true); |
852 | BUG_ON(rc); | ||
852 | req = NULL; | 853 | req = NULL; |
853 | 854 | ||
854 | /* continue? */ | 855 | /* continue? */ |
@@ -880,8 +881,6 @@ release_pvec_pages: | |||
880 | out: | 881 | out: |
881 | if (req) | 882 | if (req) |
882 | ceph_osdc_put_request(req); | 883 | ceph_osdc_put_request(req); |
883 | if (rc > 0) | ||
884 | rc = 0; /* vfs expects us to return 0 */ | ||
885 | ceph_put_snap_context(snapc); | 884 | ceph_put_snap_context(snapc); |
886 | dout("writepages done, rc = %d\n", rc); | 885 | dout("writepages done, rc = %d\n", rc); |
887 | return rc; | 886 | return rc; |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 2a5404c1c42f..1f72b00447c4 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -569,7 +569,8 @@ retry: | |||
569 | list_add_tail(&cap->session_caps, &session->s_caps); | 569 | list_add_tail(&cap->session_caps, &session->s_caps); |
570 | session->s_nr_caps++; | 570 | session->s_nr_caps++; |
571 | spin_unlock(&session->s_cap_lock); | 571 | spin_unlock(&session->s_cap_lock); |
572 | } | 572 | } else if (new_cap) |
573 | ceph_put_cap(mdsc, new_cap); | ||
573 | 574 | ||
574 | if (!ci->i_snap_realm) { | 575 | if (!ci->i_snap_realm) { |
575 | /* | 576 | /* |
@@ -2634,6 +2635,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, | |||
2634 | struct ceph_mds_session *session, | 2635 | struct ceph_mds_session *session, |
2635 | int *open_target_sessions) | 2636 | int *open_target_sessions) |
2636 | { | 2637 | { |
2638 | struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc; | ||
2637 | struct ceph_inode_info *ci = ceph_inode(inode); | 2639 | struct ceph_inode_info *ci = ceph_inode(inode); |
2638 | int mds = session->s_mds; | 2640 | int mds = session->s_mds; |
2639 | unsigned mseq = le32_to_cpu(ex->migrate_seq); | 2641 | unsigned mseq = le32_to_cpu(ex->migrate_seq); |
@@ -2670,6 +2672,19 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, | |||
2670 | * export targets, so that we get the matching IMPORT | 2672 | * export targets, so that we get the matching IMPORT |
2671 | */ | 2673 | */ |
2672 | *open_target_sessions = 1; | 2674 | *open_target_sessions = 1; |
2675 | |||
2676 | /* | ||
2677 | * we can't flush dirty caps that we've seen the | ||
2678 | * EXPORT but no IMPORT for | ||
2679 | */ | ||
2680 | spin_lock(&mdsc->cap_dirty_lock); | ||
2681 | if (!list_empty(&ci->i_dirty_item)) { | ||
2682 | dout(" moving %p to cap_dirty_migrating\n", | ||
2683 | inode); | ||
2684 | list_move(&ci->i_dirty_item, | ||
2685 | &mdsc->cap_dirty_migrating); | ||
2686 | } | ||
2687 | spin_unlock(&mdsc->cap_dirty_lock); | ||
2673 | } | 2688 | } |
2674 | __ceph_remove_cap(cap); | 2689 | __ceph_remove_cap(cap); |
2675 | } | 2690 | } |
@@ -2707,6 +2722,13 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, | |||
2707 | ci->i_cap_exporting_issued = 0; | 2722 | ci->i_cap_exporting_issued = 0; |
2708 | ci->i_cap_exporting_mseq = 0; | 2723 | ci->i_cap_exporting_mseq = 0; |
2709 | ci->i_cap_exporting_mds = -1; | 2724 | ci->i_cap_exporting_mds = -1; |
2725 | |||
2726 | spin_lock(&mdsc->cap_dirty_lock); | ||
2727 | if (!list_empty(&ci->i_dirty_item)) { | ||
2728 | dout(" moving %p back to cap_dirty\n", inode); | ||
2729 | list_move(&ci->i_dirty_item, &mdsc->cap_dirty); | ||
2730 | } | ||
2731 | spin_unlock(&mdsc->cap_dirty_lock); | ||
2710 | } else { | 2732 | } else { |
2711 | dout("handle_cap_import inode %p ci %p mds%d mseq %d\n", | 2733 | dout("handle_cap_import inode %p ci %p mds%d mseq %d\n", |
2712 | inode, ci, mds, mseq); | 2734 | inode, ci, mds, mseq); |
@@ -2910,38 +2932,16 @@ void ceph_check_delayed_caps(struct ceph_mds_client *mdsc) | |||
2910 | */ | 2932 | */ |
2911 | void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc) | 2933 | void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc) |
2912 | { | 2934 | { |
2913 | struct ceph_inode_info *ci, *nci = NULL; | 2935 | struct ceph_inode_info *ci; |
2914 | struct inode *inode, *ninode = NULL; | 2936 | struct inode *inode; |
2915 | struct list_head *p, *n; | ||
2916 | 2937 | ||
2917 | dout("flush_dirty_caps\n"); | 2938 | dout("flush_dirty_caps\n"); |
2918 | spin_lock(&mdsc->cap_dirty_lock); | 2939 | spin_lock(&mdsc->cap_dirty_lock); |
2919 | list_for_each_safe(p, n, &mdsc->cap_dirty) { | 2940 | while (!list_empty(&mdsc->cap_dirty)) { |
2920 | if (nci) { | 2941 | ci = list_first_entry(&mdsc->cap_dirty, struct ceph_inode_info, |
2921 | ci = nci; | 2942 | i_dirty_item); |
2922 | inode = ninode; | 2943 | inode = igrab(&ci->vfs_inode); |
2923 | ci->i_ceph_flags &= ~CEPH_I_NOFLUSH; | 2944 | dout("flush_dirty_caps %p\n", inode); |
2924 | dout("flush_dirty_caps inode %p (was next inode)\n", | ||
2925 | inode); | ||
2926 | } else { | ||
2927 | ci = list_entry(p, struct ceph_inode_info, | ||
2928 | i_dirty_item); | ||
2929 | inode = igrab(&ci->vfs_inode); | ||
2930 | BUG_ON(!inode); | ||
2931 | dout("flush_dirty_caps inode %p\n", inode); | ||
2932 | } | ||
2933 | if (n != &mdsc->cap_dirty) { | ||
2934 | nci = list_entry(n, struct ceph_inode_info, | ||
2935 | i_dirty_item); | ||
2936 | ninode = igrab(&nci->vfs_inode); | ||
2937 | BUG_ON(!ninode); | ||
2938 | nci->i_ceph_flags |= CEPH_I_NOFLUSH; | ||
2939 | dout("flush_dirty_caps next inode %p, noflush\n", | ||
2940 | ninode); | ||
2941 | } else { | ||
2942 | nci = NULL; | ||
2943 | ninode = NULL; | ||
2944 | } | ||
2945 | spin_unlock(&mdsc->cap_dirty_lock); | 2945 | spin_unlock(&mdsc->cap_dirty_lock); |
2946 | if (inode) { | 2946 | if (inode) { |
2947 | ceph_check_caps(ci, CHECK_CAPS_NODELAY|CHECK_CAPS_FLUSH, | 2947 | ceph_check_caps(ci, CHECK_CAPS_NODELAY|CHECK_CAPS_FLUSH, |
@@ -2951,6 +2951,7 @@ void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc) | |||
2951 | spin_lock(&mdsc->cap_dirty_lock); | 2951 | spin_lock(&mdsc->cap_dirty_lock); |
2952 | } | 2952 | } |
2953 | spin_unlock(&mdsc->cap_dirty_lock); | 2953 | spin_unlock(&mdsc->cap_dirty_lock); |
2954 | dout("flush_dirty_caps done\n"); | ||
2954 | } | 2955 | } |
2955 | 2956 | ||
2956 | /* | 2957 | /* |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 1a867a3601ae..33729e822bb9 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -360,7 +360,7 @@ more: | |||
360 | rinfo = &fi->last_readdir->r_reply_info; | 360 | rinfo = &fi->last_readdir->r_reply_info; |
361 | dout("readdir frag %x num %d off %d chunkoff %d\n", frag, | 361 | dout("readdir frag %x num %d off %d chunkoff %d\n", frag, |
362 | rinfo->dir_nr, off, fi->offset); | 362 | rinfo->dir_nr, off, fi->offset); |
363 | while (off - fi->offset >= 0 && off - fi->offset < rinfo->dir_nr) { | 363 | while (off >= fi->offset && off - fi->offset < rinfo->dir_nr) { |
364 | u64 pos = ceph_make_fpos(frag, off); | 364 | u64 pos = ceph_make_fpos(frag, off); |
365 | struct ceph_mds_reply_inode *in = | 365 | struct ceph_mds_reply_inode *in = |
366 | rinfo->dir_in[off - fi->offset].in; | 366 | rinfo->dir_in[off - fi->offset].in; |
@@ -1066,16 +1066,17 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size, | |||
1066 | struct inode *inode = file->f_dentry->d_inode; | 1066 | struct inode *inode = file->f_dentry->d_inode; |
1067 | struct ceph_inode_info *ci = ceph_inode(inode); | 1067 | struct ceph_inode_info *ci = ceph_inode(inode); |
1068 | int left; | 1068 | int left; |
1069 | const int bufsize = 1024; | ||
1069 | 1070 | ||
1070 | if (!ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT)) | 1071 | if (!ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT)) |
1071 | return -EISDIR; | 1072 | return -EISDIR; |
1072 | 1073 | ||
1073 | if (!cf->dir_info) { | 1074 | if (!cf->dir_info) { |
1074 | cf->dir_info = kmalloc(1024, GFP_NOFS); | 1075 | cf->dir_info = kmalloc(bufsize, GFP_NOFS); |
1075 | if (!cf->dir_info) | 1076 | if (!cf->dir_info) |
1076 | return -ENOMEM; | 1077 | return -ENOMEM; |
1077 | cf->dir_info_len = | 1078 | cf->dir_info_len = |
1078 | sprintf(cf->dir_info, | 1079 | snprintf(cf->dir_info, bufsize, |
1079 | "entries: %20lld\n" | 1080 | "entries: %20lld\n" |
1080 | " files: %20lld\n" | 1081 | " files: %20lld\n" |
1081 | " subdirs: %20lld\n" | 1082 | " subdirs: %20lld\n" |
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index e41056174bf8..a610d3d67488 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
@@ -86,6 +86,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, | |||
86 | static struct dentry *__fh_to_dentry(struct super_block *sb, | 86 | static struct dentry *__fh_to_dentry(struct super_block *sb, |
87 | struct ceph_nfs_fh *fh) | 87 | struct ceph_nfs_fh *fh) |
88 | { | 88 | { |
89 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; | ||
89 | struct inode *inode; | 90 | struct inode *inode; |
90 | struct dentry *dentry; | 91 | struct dentry *dentry; |
91 | struct ceph_vino vino; | 92 | struct ceph_vino vino; |
@@ -95,8 +96,24 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, | |||
95 | vino.ino = fh->ino; | 96 | vino.ino = fh->ino; |
96 | vino.snap = CEPH_NOSNAP; | 97 | vino.snap = CEPH_NOSNAP; |
97 | inode = ceph_find_inode(sb, vino); | 98 | inode = ceph_find_inode(sb, vino); |
98 | if (!inode) | 99 | if (!inode) { |
99 | return ERR_PTR(-ESTALE); | 100 | struct ceph_mds_request *req; |
101 | |||
102 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPINO, | ||
103 | USE_ANY_MDS); | ||
104 | if (IS_ERR(req)) | ||
105 | return ERR_CAST(req); | ||
106 | |||
107 | req->r_ino1 = vino; | ||
108 | req->r_num_caps = 1; | ||
109 | err = ceph_mdsc_do_request(mdsc, NULL, req); | ||
110 | inode = req->r_target_inode; | ||
111 | if (inode) | ||
112 | igrab(inode); | ||
113 | ceph_mdsc_put_request(req); | ||
114 | if (!inode) | ||
115 | return ERR_PTR(-ESTALE); | ||
116 | } | ||
100 | 117 | ||
101 | dentry = d_obtain_alias(inode); | 118 | dentry = d_obtain_alias(inode); |
102 | if (IS_ERR(dentry)) { | 119 | if (IS_ERR(dentry)) { |
@@ -148,8 +165,10 @@ static struct dentry *__cfh_to_dentry(struct super_block *sb, | |||
148 | snprintf(req->r_path2, 16, "%d", cfh->parent_name_hash); | 165 | snprintf(req->r_path2, 16, "%d", cfh->parent_name_hash); |
149 | req->r_num_caps = 1; | 166 | req->r_num_caps = 1; |
150 | err = ceph_mdsc_do_request(mdsc, NULL, req); | 167 | err = ceph_mdsc_do_request(mdsc, NULL, req); |
168 | inode = req->r_target_inode; | ||
169 | if (inode) | ||
170 | igrab(inode); | ||
151 | ceph_mdsc_put_request(req); | 171 | ceph_mdsc_put_request(req); |
152 | inode = ceph_find_inode(sb, vino); | ||
153 | if (!inode) | 172 | if (!inode) |
154 | return ERR_PTR(err ? err : -ESTALE); | 173 | return ERR_PTR(err ? err : -ESTALE); |
155 | } | 174 | } |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index d0fae4ce9ba5..79743d146be6 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -578,6 +578,7 @@ static void __register_request(struct ceph_mds_client *mdsc, | |||
578 | if (dir) { | 578 | if (dir) { |
579 | struct ceph_inode_info *ci = ceph_inode(dir); | 579 | struct ceph_inode_info *ci = ceph_inode(dir); |
580 | 580 | ||
581 | ihold(dir); | ||
581 | spin_lock(&ci->i_unsafe_lock); | 582 | spin_lock(&ci->i_unsafe_lock); |
582 | req->r_unsafe_dir = dir; | 583 | req->r_unsafe_dir = dir; |
583 | list_add_tail(&req->r_unsafe_dir_item, &ci->i_unsafe_dirops); | 584 | list_add_tail(&req->r_unsafe_dir_item, &ci->i_unsafe_dirops); |
@@ -598,6 +599,9 @@ static void __unregister_request(struct ceph_mds_client *mdsc, | |||
598 | spin_lock(&ci->i_unsafe_lock); | 599 | spin_lock(&ci->i_unsafe_lock); |
599 | list_del_init(&req->r_unsafe_dir_item); | 600 | list_del_init(&req->r_unsafe_dir_item); |
600 | spin_unlock(&ci->i_unsafe_lock); | 601 | spin_unlock(&ci->i_unsafe_lock); |
602 | |||
603 | iput(req->r_unsafe_dir); | ||
604 | req->r_unsafe_dir = NULL; | ||
601 | } | 605 | } |
602 | 606 | ||
603 | ceph_mdsc_put_request(req); | 607 | ceph_mdsc_put_request(req); |
@@ -2691,7 +2695,6 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
2691 | { | 2695 | { |
2692 | struct super_block *sb = mdsc->fsc->sb; | 2696 | struct super_block *sb = mdsc->fsc->sb; |
2693 | struct inode *inode; | 2697 | struct inode *inode; |
2694 | struct ceph_inode_info *ci; | ||
2695 | struct dentry *parent, *dentry; | 2698 | struct dentry *parent, *dentry; |
2696 | struct ceph_dentry_info *di; | 2699 | struct ceph_dentry_info *di; |
2697 | int mds = session->s_mds; | 2700 | int mds = session->s_mds; |
@@ -2728,7 +2731,6 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
2728 | dout("handle_lease no inode %llx\n", vino.ino); | 2731 | dout("handle_lease no inode %llx\n", vino.ino); |
2729 | goto release; | 2732 | goto release; |
2730 | } | 2733 | } |
2731 | ci = ceph_inode(inode); | ||
2732 | 2734 | ||
2733 | /* dentry */ | 2735 | /* dentry */ |
2734 | parent = d_find_alias(inode); | 2736 | parent = d_find_alias(inode); |
@@ -3002,6 +3004,7 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) | |||
3002 | spin_lock_init(&mdsc->snap_flush_lock); | 3004 | spin_lock_init(&mdsc->snap_flush_lock); |
3003 | mdsc->cap_flush_seq = 0; | 3005 | mdsc->cap_flush_seq = 0; |
3004 | INIT_LIST_HEAD(&mdsc->cap_dirty); | 3006 | INIT_LIST_HEAD(&mdsc->cap_dirty); |
3007 | INIT_LIST_HEAD(&mdsc->cap_dirty_migrating); | ||
3005 | mdsc->num_cap_flushing = 0; | 3008 | mdsc->num_cap_flushing = 0; |
3006 | spin_lock_init(&mdsc->cap_dirty_lock); | 3009 | spin_lock_init(&mdsc->cap_dirty_lock); |
3007 | init_waitqueue_head(&mdsc->cap_flushing_wq); | 3010 | init_waitqueue_head(&mdsc->cap_flushing_wq); |
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index 4e3a9cc0bba6..7d8a0d662d56 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h | |||
@@ -278,6 +278,7 @@ struct ceph_mds_client { | |||
278 | 278 | ||
279 | u64 cap_flush_seq; | 279 | u64 cap_flush_seq; |
280 | struct list_head cap_dirty; /* inodes with dirty caps */ | 280 | struct list_head cap_dirty; /* inodes with dirty caps */ |
281 | struct list_head cap_dirty_migrating; /* ...that are migration... */ | ||
281 | int num_cap_flushing; /* # caps we are flushing */ | 282 | int num_cap_flushing; /* # caps we are flushing */ |
282 | spinlock_t cap_dirty_lock; /* protects above items */ | 283 | spinlock_t cap_dirty_lock; /* protects above items */ |
283 | wait_queue_head_t cap_flushing_wq; | 284 | wait_queue_head_t cap_flushing_wq; |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index d545e97d99c3..8ed4d3433199 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -255,7 +255,11 @@ ssize_t part_discard_alignment_show(struct device *dev, | |||
255 | struct device_attribute *attr, char *buf) | 255 | struct device_attribute *attr, char *buf) |
256 | { | 256 | { |
257 | struct hd_struct *p = dev_to_part(dev); | 257 | struct hd_struct *p = dev_to_part(dev); |
258 | return sprintf(buf, "%u\n", p->discard_alignment); | 258 | struct gendisk *disk = dev_to_disk(dev); |
259 | |||
260 | return sprintf(buf, "%u\n", | ||
261 | queue_limit_discard_alignment(&disk->queue->limits, | ||
262 | p->start_sect)); | ||
259 | } | 263 | } |
260 | 264 | ||
261 | ssize_t part_stat_show(struct device *dev, | 265 | ssize_t part_stat_show(struct device *dev, |
@@ -449,8 +453,6 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, | |||
449 | p->start_sect = start; | 453 | p->start_sect = start; |
450 | p->alignment_offset = | 454 | p->alignment_offset = |
451 | queue_limit_alignment_offset(&disk->queue->limits, start); | 455 | queue_limit_alignment_offset(&disk->queue->limits, start); |
452 | p->discard_alignment = | ||
453 | queue_limit_discard_alignment(&disk->queue->limits, start); | ||
454 | p->nr_sects = len; | 456 | p->nr_sects = len; |
455 | p->partno = partno; | 457 | p->partno = partno; |
456 | p->policy = get_disk_ro(disk); | 458 | p->policy = get_disk_ro(disk); |
diff --git a/fs/splice.c b/fs/splice.c index 50a5d978da16..aa866d309695 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -162,6 +162,14 @@ static const struct pipe_buf_operations user_page_pipe_buf_ops = { | |||
162 | .get = generic_pipe_buf_get, | 162 | .get = generic_pipe_buf_get, |
163 | }; | 163 | }; |
164 | 164 | ||
165 | static void wakeup_pipe_readers(struct pipe_inode_info *pipe) | ||
166 | { | ||
167 | smp_mb(); | ||
168 | if (waitqueue_active(&pipe->wait)) | ||
169 | wake_up_interruptible(&pipe->wait); | ||
170 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); | ||
171 | } | ||
172 | |||
165 | /** | 173 | /** |
166 | * splice_to_pipe - fill passed data into a pipe | 174 | * splice_to_pipe - fill passed data into a pipe |
167 | * @pipe: pipe to fill | 175 | * @pipe: pipe to fill |
@@ -247,12 +255,8 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe, | |||
247 | 255 | ||
248 | pipe_unlock(pipe); | 256 | pipe_unlock(pipe); |
249 | 257 | ||
250 | if (do_wakeup) { | 258 | if (do_wakeup) |
251 | smp_mb(); | 259 | wakeup_pipe_readers(pipe); |
252 | if (waitqueue_active(&pipe->wait)) | ||
253 | wake_up_interruptible(&pipe->wait); | ||
254 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); | ||
255 | } | ||
256 | 260 | ||
257 | while (page_nr < spd_pages) | 261 | while (page_nr < spd_pages) |
258 | spd->spd_release(spd, page_nr++); | 262 | spd->spd_release(spd, page_nr++); |
@@ -1892,12 +1896,9 @@ retry: | |||
1892 | /* | 1896 | /* |
1893 | * If we put data in the output pipe, wakeup any potential readers. | 1897 | * If we put data in the output pipe, wakeup any potential readers. |
1894 | */ | 1898 | */ |
1895 | if (ret > 0) { | 1899 | if (ret > 0) |
1896 | smp_mb(); | 1900 | wakeup_pipe_readers(opipe); |
1897 | if (waitqueue_active(&opipe->wait)) | 1901 | |
1898 | wake_up_interruptible(&opipe->wait); | ||
1899 | kill_fasync(&opipe->fasync_readers, SIGIO, POLL_IN); | ||
1900 | } | ||
1901 | if (input_wakeup) | 1902 | if (input_wakeup) |
1902 | wakeup_pipe_writers(ipipe); | 1903 | wakeup_pipe_writers(ipipe); |
1903 | 1904 | ||
@@ -1976,12 +1977,8 @@ static int link_pipe(struct pipe_inode_info *ipipe, | |||
1976 | /* | 1977 | /* |
1977 | * If we put data in the output pipe, wakeup any potential readers. | 1978 | * If we put data in the output pipe, wakeup any potential readers. |
1978 | */ | 1979 | */ |
1979 | if (ret > 0) { | 1980 | if (ret > 0) |
1980 | smp_mb(); | 1981 | wakeup_pipe_readers(opipe); |
1981 | if (waitqueue_active(&opipe->wait)) | ||
1982 | wake_up_interruptible(&opipe->wait); | ||
1983 | kill_fasync(&opipe->fasync_readers, SIGIO, POLL_IN); | ||
1984 | } | ||
1985 | 1982 | ||
1986 | return ret; | 1983 | return ret; |
1987 | } | 1984 | } |
diff --git a/include/asm-generic/audit_change_attr.h b/include/asm-generic/audit_change_attr.h index bcbab3e4a3be..89b73e5d0fd0 100644 --- a/include/asm-generic/audit_change_attr.h +++ b/include/asm-generic/audit_change_attr.h | |||
@@ -1,4 +1,6 @@ | |||
1 | #ifdef __NR_chmod | ||
1 | __NR_chmod, | 2 | __NR_chmod, |
3 | #endif | ||
2 | __NR_fchmod, | 4 | __NR_fchmod, |
3 | #ifdef __NR_chown | 5 | #ifdef __NR_chown |
4 | __NR_chown, | 6 | __NR_chown, |
@@ -20,7 +22,9 @@ __NR_chown32, | |||
20 | __NR_fchown32, | 22 | __NR_fchown32, |
21 | __NR_lchown32, | 23 | __NR_lchown32, |
22 | #endif | 24 | #endif |
25 | #ifdef __NR_link | ||
23 | __NR_link, | 26 | __NR_link, |
27 | #endif | ||
24 | #ifdef __NR_linkat | 28 | #ifdef __NR_linkat |
25 | __NR_linkat, | 29 | __NR_linkat, |
26 | #endif | 30 | #endif |
diff --git a/include/asm-generic/audit_dir_write.h b/include/asm-generic/audit_dir_write.h index 6621bd82cbe8..7b61db4fe72b 100644 --- a/include/asm-generic/audit_dir_write.h +++ b/include/asm-generic/audit_dir_write.h | |||
@@ -1,13 +1,27 @@ | |||
1 | #ifdef __NR_rename | ||
1 | __NR_rename, | 2 | __NR_rename, |
3 | #endif | ||
4 | #ifdef __NR_mkdir | ||
2 | __NR_mkdir, | 5 | __NR_mkdir, |
6 | #endif | ||
7 | #ifdef __NR_rmdir | ||
3 | __NR_rmdir, | 8 | __NR_rmdir, |
9 | #endif | ||
4 | #ifdef __NR_creat | 10 | #ifdef __NR_creat |
5 | __NR_creat, | 11 | __NR_creat, |
6 | #endif | 12 | #endif |
13 | #ifdef __NR_link | ||
7 | __NR_link, | 14 | __NR_link, |
15 | #endif | ||
16 | #ifdef __NR_unlink | ||
8 | __NR_unlink, | 17 | __NR_unlink, |
18 | #endif | ||
19 | #ifdef __NR_symlink | ||
9 | __NR_symlink, | 20 | __NR_symlink, |
21 | #endif | ||
22 | #ifdef __NR_mknod | ||
10 | __NR_mknod, | 23 | __NR_mknod, |
24 | #endif | ||
11 | #ifdef __NR_mkdirat | 25 | #ifdef __NR_mkdirat |
12 | __NR_mkdirat, | 26 | __NR_mkdirat, |
13 | __NR_mknodat, | 27 | __NR_mknodat, |
diff --git a/include/asm-generic/audit_read.h b/include/asm-generic/audit_read.h index 0e87464d9847..3b249cb857dc 100644 --- a/include/asm-generic/audit_read.h +++ b/include/asm-generic/audit_read.h | |||
@@ -1,4 +1,6 @@ | |||
1 | #ifdef __NR_readlink | ||
1 | __NR_readlink, | 2 | __NR_readlink, |
3 | #endif | ||
2 | __NR_quotactl, | 4 | __NR_quotactl, |
3 | __NR_listxattr, | 5 | __NR_listxattr, |
4 | __NR_llistxattr, | 6 | __NR_llistxattr, |
@@ -6,3 +8,6 @@ __NR_flistxattr, | |||
6 | __NR_getxattr, | 8 | __NR_getxattr, |
7 | __NR_lgetxattr, | 9 | __NR_lgetxattr, |
8 | __NR_fgetxattr, | 10 | __NR_fgetxattr, |
11 | #ifdef __NR_readlinkat | ||
12 | __NR_readlinkat, | ||
13 | #endif | ||
diff --git a/include/asm-generic/audit_write.h b/include/asm-generic/audit_write.h index c5f1c2c920e2..e7020c57b13b 100644 --- a/include/asm-generic/audit_write.h +++ b/include/asm-generic/audit_write.h | |||
@@ -4,7 +4,9 @@ __NR_acct, | |||
4 | __NR_swapon, | 4 | __NR_swapon, |
5 | #endif | 5 | #endif |
6 | __NR_quotactl, | 6 | __NR_quotactl, |
7 | #ifdef __NR_truncate | ||
7 | __NR_truncate, | 8 | __NR_truncate, |
9 | #endif | ||
8 | #ifdef __NR_truncate64 | 10 | #ifdef __NR_truncate64 |
9 | __NR_truncate64, | 11 | __NR_truncate64, |
10 | #endif | 12 | #endif |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index 07c40d5149de..33d524704883 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
@@ -24,16 +24,24 @@ | |||
24 | #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) | 24 | #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #ifdef __SYSCALL_COMPAT | ||
28 | #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp) | ||
29 | #define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp) | ||
30 | #else | ||
31 | #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys) | ||
32 | #define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64) | ||
33 | #endif | ||
34 | |||
27 | #define __NR_io_setup 0 | 35 | #define __NR_io_setup 0 |
28 | __SYSCALL(__NR_io_setup, sys_io_setup) | 36 | __SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup) |
29 | #define __NR_io_destroy 1 | 37 | #define __NR_io_destroy 1 |
30 | __SYSCALL(__NR_io_destroy, sys_io_destroy) | 38 | __SYSCALL(__NR_io_destroy, sys_io_destroy) |
31 | #define __NR_io_submit 2 | 39 | #define __NR_io_submit 2 |
32 | __SYSCALL(__NR_io_submit, sys_io_submit) | 40 | __SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit) |
33 | #define __NR_io_cancel 3 | 41 | #define __NR_io_cancel 3 |
34 | __SYSCALL(__NR_io_cancel, sys_io_cancel) | 42 | __SYSCALL(__NR_io_cancel, sys_io_cancel) |
35 | #define __NR_io_getevents 4 | 43 | #define __NR_io_getevents 4 |
36 | __SYSCALL(__NR_io_getevents, sys_io_getevents) | 44 | __SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents) |
37 | 45 | ||
38 | /* fs/xattr.c */ | 46 | /* fs/xattr.c */ |
39 | #define __NR_setxattr 5 | 47 | #define __NR_setxattr 5 |
@@ -67,7 +75,7 @@ __SYSCALL(__NR_getcwd, sys_getcwd) | |||
67 | 75 | ||
68 | /* fs/cookies.c */ | 76 | /* fs/cookies.c */ |
69 | #define __NR_lookup_dcookie 18 | 77 | #define __NR_lookup_dcookie 18 |
70 | __SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie) | 78 | __SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie) |
71 | 79 | ||
72 | /* fs/eventfd.c */ | 80 | /* fs/eventfd.c */ |
73 | #define __NR_eventfd2 19 | 81 | #define __NR_eventfd2 19 |
@@ -79,7 +87,7 @@ __SYSCALL(__NR_epoll_create1, sys_epoll_create1) | |||
79 | #define __NR_epoll_ctl 21 | 87 | #define __NR_epoll_ctl 21 |
80 | __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) | 88 | __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) |
81 | #define __NR_epoll_pwait 22 | 89 | #define __NR_epoll_pwait 22 |
82 | __SYSCALL(__NR_epoll_pwait, sys_epoll_pwait) | 90 | __SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait) |
83 | 91 | ||
84 | /* fs/fcntl.c */ | 92 | /* fs/fcntl.c */ |
85 | #define __NR_dup 23 | 93 | #define __NR_dup 23 |
@@ -87,7 +95,7 @@ __SYSCALL(__NR_dup, sys_dup) | |||
87 | #define __NR_dup3 24 | 95 | #define __NR_dup3 24 |
88 | __SYSCALL(__NR_dup3, sys_dup3) | 96 | __SYSCALL(__NR_dup3, sys_dup3) |
89 | #define __NR3264_fcntl 25 | 97 | #define __NR3264_fcntl 25 |
90 | __SC_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl) | 98 | __SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64) |
91 | 99 | ||
92 | /* fs/inotify_user.c */ | 100 | /* fs/inotify_user.c */ |
93 | #define __NR_inotify_init1 26 | 101 | #define __NR_inotify_init1 26 |
@@ -99,7 +107,7 @@ __SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch) | |||
99 | 107 | ||
100 | /* fs/ioctl.c */ | 108 | /* fs/ioctl.c */ |
101 | #define __NR_ioctl 29 | 109 | #define __NR_ioctl 29 |
102 | __SYSCALL(__NR_ioctl, sys_ioctl) | 110 | __SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl) |
103 | 111 | ||
104 | /* fs/ioprio.c */ | 112 | /* fs/ioprio.c */ |
105 | #define __NR_ioprio_set 30 | 113 | #define __NR_ioprio_set 30 |
@@ -129,26 +137,30 @@ __SYSCALL(__NR_renameat, sys_renameat) | |||
129 | #define __NR_umount2 39 | 137 | #define __NR_umount2 39 |
130 | __SYSCALL(__NR_umount2, sys_umount) | 138 | __SYSCALL(__NR_umount2, sys_umount) |
131 | #define __NR_mount 40 | 139 | #define __NR_mount 40 |
132 | __SYSCALL(__NR_mount, sys_mount) | 140 | __SC_COMP(__NR_mount, sys_mount, compat_sys_mount) |
133 | #define __NR_pivot_root 41 | 141 | #define __NR_pivot_root 41 |
134 | __SYSCALL(__NR_pivot_root, sys_pivot_root) | 142 | __SYSCALL(__NR_pivot_root, sys_pivot_root) |
135 | 143 | ||
136 | /* fs/nfsctl.c */ | 144 | /* fs/nfsctl.c */ |
137 | #define __NR_nfsservctl 42 | 145 | #define __NR_nfsservctl 42 |
138 | __SYSCALL(__NR_nfsservctl, sys_nfsservctl) | 146 | __SC_COMP(__NR_nfsservctl, sys_nfsservctl, compat_sys_nfsservctl) |
139 | 147 | ||
140 | /* fs/open.c */ | 148 | /* fs/open.c */ |
141 | #define __NR3264_statfs 43 | 149 | #define __NR3264_statfs 43 |
142 | __SC_3264(__NR3264_statfs, sys_statfs64, sys_statfs) | 150 | __SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \ |
151 | compat_sys_statfs64) | ||
143 | #define __NR3264_fstatfs 44 | 152 | #define __NR3264_fstatfs 44 |
144 | __SC_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs) | 153 | __SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \ |
154 | compat_sys_fstatfs64) | ||
145 | #define __NR3264_truncate 45 | 155 | #define __NR3264_truncate 45 |
146 | __SC_3264(__NR3264_truncate, sys_truncate64, sys_truncate) | 156 | __SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \ |
157 | compat_sys_truncate64) | ||
147 | #define __NR3264_ftruncate 46 | 158 | #define __NR3264_ftruncate 46 |
148 | __SC_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate) | 159 | __SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \ |
160 | compat_sys_ftruncate64) | ||
149 | 161 | ||
150 | #define __NR_fallocate 47 | 162 | #define __NR_fallocate 47 |
151 | __SYSCALL(__NR_fallocate, sys_fallocate) | 163 | __SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate) |
152 | #define __NR_faccessat 48 | 164 | #define __NR_faccessat 48 |
153 | __SYSCALL(__NR_faccessat, sys_faccessat) | 165 | __SYSCALL(__NR_faccessat, sys_faccessat) |
154 | #define __NR_chdir 49 | 166 | #define __NR_chdir 49 |
@@ -166,7 +178,7 @@ __SYSCALL(__NR_fchownat, sys_fchownat) | |||
166 | #define __NR_fchown 55 | 178 | #define __NR_fchown 55 |
167 | __SYSCALL(__NR_fchown, sys_fchown) | 179 | __SYSCALL(__NR_fchown, sys_fchown) |
168 | #define __NR_openat 56 | 180 | #define __NR_openat 56 |
169 | __SYSCALL(__NR_openat, sys_openat) | 181 | __SC_COMP(__NR_openat, sys_openat, compat_sys_openat) |
170 | #define __NR_close 57 | 182 | #define __NR_close 57 |
171 | __SYSCALL(__NR_close, sys_close) | 183 | __SYSCALL(__NR_close, sys_close) |
172 | #define __NR_vhangup 58 | 184 | #define __NR_vhangup 58 |
@@ -182,7 +194,7 @@ __SYSCALL(__NR_quotactl, sys_quotactl) | |||
182 | 194 | ||
183 | /* fs/readdir.c */ | 195 | /* fs/readdir.c */ |
184 | #define __NR_getdents64 61 | 196 | #define __NR_getdents64 61 |
185 | __SYSCALL(__NR_getdents64, sys_getdents64) | 197 | __SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64) |
186 | 198 | ||
187 | /* fs/read_write.c */ | 199 | /* fs/read_write.c */ |
188 | #define __NR3264_lseek 62 | 200 | #define __NR3264_lseek 62 |
@@ -192,17 +204,17 @@ __SYSCALL(__NR_read, sys_read) | |||
192 | #define __NR_write 64 | 204 | #define __NR_write 64 |
193 | __SYSCALL(__NR_write, sys_write) | 205 | __SYSCALL(__NR_write, sys_write) |
194 | #define __NR_readv 65 | 206 | #define __NR_readv 65 |
195 | __SYSCALL(__NR_readv, sys_readv) | 207 | __SC_COMP(__NR_readv, sys_readv, compat_sys_readv) |
196 | #define __NR_writev 66 | 208 | #define __NR_writev 66 |
197 | __SYSCALL(__NR_writev, sys_writev) | 209 | __SC_COMP(__NR_writev, sys_writev, compat_sys_writev) |
198 | #define __NR_pread64 67 | 210 | #define __NR_pread64 67 |
199 | __SYSCALL(__NR_pread64, sys_pread64) | 211 | __SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64) |
200 | #define __NR_pwrite64 68 | 212 | #define __NR_pwrite64 68 |
201 | __SYSCALL(__NR_pwrite64, sys_pwrite64) | 213 | __SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64) |
202 | #define __NR_preadv 69 | 214 | #define __NR_preadv 69 |
203 | __SYSCALL(__NR_preadv, sys_preadv) | 215 | __SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv) |
204 | #define __NR_pwritev 70 | 216 | #define __NR_pwritev 70 |
205 | __SYSCALL(__NR_pwritev, sys_pwritev) | 217 | __SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev) |
206 | 218 | ||
207 | /* fs/sendfile.c */ | 219 | /* fs/sendfile.c */ |
208 | #define __NR3264_sendfile 71 | 220 | #define __NR3264_sendfile 71 |
@@ -210,17 +222,17 @@ __SC_3264(__NR3264_sendfile, sys_sendfile64, sys_sendfile) | |||
210 | 222 | ||
211 | /* fs/select.c */ | 223 | /* fs/select.c */ |
212 | #define __NR_pselect6 72 | 224 | #define __NR_pselect6 72 |
213 | __SYSCALL(__NR_pselect6, sys_pselect6) | 225 | __SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6) |
214 | #define __NR_ppoll 73 | 226 | #define __NR_ppoll 73 |
215 | __SYSCALL(__NR_ppoll, sys_ppoll) | 227 | __SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll) |
216 | 228 | ||
217 | /* fs/signalfd.c */ | 229 | /* fs/signalfd.c */ |
218 | #define __NR_signalfd4 74 | 230 | #define __NR_signalfd4 74 |
219 | __SYSCALL(__NR_signalfd4, sys_signalfd4) | 231 | __SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4) |
220 | 232 | ||
221 | /* fs/splice.c */ | 233 | /* fs/splice.c */ |
222 | #define __NR_vmsplice 75 | 234 | #define __NR_vmsplice 75 |
223 | __SYSCALL(__NR_vmsplice, sys_vmsplice) | 235 | __SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice) |
224 | #define __NR_splice 76 | 236 | #define __NR_splice 76 |
225 | __SYSCALL(__NR_splice, sys_splice) | 237 | __SYSCALL(__NR_splice, sys_splice) |
226 | #define __NR_tee 77 | 238 | #define __NR_tee 77 |
@@ -243,23 +255,27 @@ __SYSCALL(__NR_fsync, sys_fsync) | |||
243 | __SYSCALL(__NR_fdatasync, sys_fdatasync) | 255 | __SYSCALL(__NR_fdatasync, sys_fdatasync) |
244 | #ifdef __ARCH_WANT_SYNC_FILE_RANGE2 | 256 | #ifdef __ARCH_WANT_SYNC_FILE_RANGE2 |
245 | #define __NR_sync_file_range2 84 | 257 | #define __NR_sync_file_range2 84 |
246 | __SYSCALL(__NR_sync_file_range2, sys_sync_file_range2) | 258 | __SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \ |
259 | compat_sys_sync_file_range2) | ||
247 | #else | 260 | #else |
248 | #define __NR_sync_file_range 84 | 261 | #define __NR_sync_file_range 84 |
249 | __SYSCALL(__NR_sync_file_range, sys_sync_file_range) | 262 | __SC_COMP(__NR_sync_file_range, sys_sync_file_range, \ |
263 | compat_sys_sync_file_range) | ||
250 | #endif | 264 | #endif |
251 | 265 | ||
252 | /* fs/timerfd.c */ | 266 | /* fs/timerfd.c */ |
253 | #define __NR_timerfd_create 85 | 267 | #define __NR_timerfd_create 85 |
254 | __SYSCALL(__NR_timerfd_create, sys_timerfd_create) | 268 | __SYSCALL(__NR_timerfd_create, sys_timerfd_create) |
255 | #define __NR_timerfd_settime 86 | 269 | #define __NR_timerfd_settime 86 |
256 | __SYSCALL(__NR_timerfd_settime, sys_timerfd_settime) | 270 | __SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \ |
271 | compat_sys_timerfd_settime) | ||
257 | #define __NR_timerfd_gettime 87 | 272 | #define __NR_timerfd_gettime 87 |
258 | __SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime) | 273 | __SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \ |
274 | compat_sys_timerfd_gettime) | ||
259 | 275 | ||
260 | /* fs/utimes.c */ | 276 | /* fs/utimes.c */ |
261 | #define __NR_utimensat 88 | 277 | #define __NR_utimensat 88 |
262 | __SYSCALL(__NR_utimensat, sys_utimensat) | 278 | __SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat) |
263 | 279 | ||
264 | /* kernel/acct.c */ | 280 | /* kernel/acct.c */ |
265 | #define __NR_acct 89 | 281 | #define __NR_acct 89 |
@@ -281,7 +297,7 @@ __SYSCALL(__NR_exit, sys_exit) | |||
281 | #define __NR_exit_group 94 | 297 | #define __NR_exit_group 94 |
282 | __SYSCALL(__NR_exit_group, sys_exit_group) | 298 | __SYSCALL(__NR_exit_group, sys_exit_group) |
283 | #define __NR_waitid 95 | 299 | #define __NR_waitid 95 |
284 | __SYSCALL(__NR_waitid, sys_waitid) | 300 | __SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid) |
285 | 301 | ||
286 | /* kernel/fork.c */ | 302 | /* kernel/fork.c */ |
287 | #define __NR_set_tid_address 96 | 303 | #define __NR_set_tid_address 96 |
@@ -291,25 +307,27 @@ __SYSCALL(__NR_unshare, sys_unshare) | |||
291 | 307 | ||
292 | /* kernel/futex.c */ | 308 | /* kernel/futex.c */ |
293 | #define __NR_futex 98 | 309 | #define __NR_futex 98 |
294 | __SYSCALL(__NR_futex, sys_futex) | 310 | __SC_COMP(__NR_futex, sys_futex, compat_sys_futex) |
295 | #define __NR_set_robust_list 99 | 311 | #define __NR_set_robust_list 99 |
296 | __SYSCALL(__NR_set_robust_list, sys_set_robust_list) | 312 | __SC_COMP(__NR_set_robust_list, sys_set_robust_list, \ |
313 | compat_sys_set_robust_list) | ||
297 | #define __NR_get_robust_list 100 | 314 | #define __NR_get_robust_list 100 |
298 | __SYSCALL(__NR_get_robust_list, sys_get_robust_list) | 315 | __SC_COMP(__NR_get_robust_list, sys_get_robust_list, \ |
316 | compat_sys_get_robust_list) | ||
299 | 317 | ||
300 | /* kernel/hrtimer.c */ | 318 | /* kernel/hrtimer.c */ |
301 | #define __NR_nanosleep 101 | 319 | #define __NR_nanosleep 101 |
302 | __SYSCALL(__NR_nanosleep, sys_nanosleep) | 320 | __SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep) |
303 | 321 | ||
304 | /* kernel/itimer.c */ | 322 | /* kernel/itimer.c */ |
305 | #define __NR_getitimer 102 | 323 | #define __NR_getitimer 102 |
306 | __SYSCALL(__NR_getitimer, sys_getitimer) | 324 | __SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer) |
307 | #define __NR_setitimer 103 | 325 | #define __NR_setitimer 103 |
308 | __SYSCALL(__NR_setitimer, sys_setitimer) | 326 | __SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer) |
309 | 327 | ||
310 | /* kernel/kexec.c */ | 328 | /* kernel/kexec.c */ |
311 | #define __NR_kexec_load 104 | 329 | #define __NR_kexec_load 104 |
312 | __SYSCALL(__NR_kexec_load, sys_kexec_load) | 330 | __SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load) |
313 | 331 | ||
314 | /* kernel/module.c */ | 332 | /* kernel/module.c */ |
315 | #define __NR_init_module 105 | 333 | #define __NR_init_module 105 |
@@ -319,23 +337,24 @@ __SYSCALL(__NR_delete_module, sys_delete_module) | |||
319 | 337 | ||
320 | /* kernel/posix-timers.c */ | 338 | /* kernel/posix-timers.c */ |
321 | #define __NR_timer_create 107 | 339 | #define __NR_timer_create 107 |
322 | __SYSCALL(__NR_timer_create, sys_timer_create) | 340 | __SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create) |
323 | #define __NR_timer_gettime 108 | 341 | #define __NR_timer_gettime 108 |
324 | __SYSCALL(__NR_timer_gettime, sys_timer_gettime) | 342 | __SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime) |
325 | #define __NR_timer_getoverrun 109 | 343 | #define __NR_timer_getoverrun 109 |
326 | __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) | 344 | __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) |
327 | #define __NR_timer_settime 110 | 345 | #define __NR_timer_settime 110 |
328 | __SYSCALL(__NR_timer_settime, sys_timer_settime) | 346 | __SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime) |
329 | #define __NR_timer_delete 111 | 347 | #define __NR_timer_delete 111 |
330 | __SYSCALL(__NR_timer_delete, sys_timer_delete) | 348 | __SYSCALL(__NR_timer_delete, sys_timer_delete) |
331 | #define __NR_clock_settime 112 | 349 | #define __NR_clock_settime 112 |
332 | __SYSCALL(__NR_clock_settime, sys_clock_settime) | 350 | __SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime) |
333 | #define __NR_clock_gettime 113 | 351 | #define __NR_clock_gettime 113 |
334 | __SYSCALL(__NR_clock_gettime, sys_clock_gettime) | 352 | __SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime) |
335 | #define __NR_clock_getres 114 | 353 | #define __NR_clock_getres 114 |
336 | __SYSCALL(__NR_clock_getres, sys_clock_getres) | 354 | __SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres) |
337 | #define __NR_clock_nanosleep 115 | 355 | #define __NR_clock_nanosleep 115 |
338 | __SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep) | 356 | __SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \ |
357 | compat_sys_clock_nanosleep) | ||
339 | 358 | ||
340 | /* kernel/printk.c */ | 359 | /* kernel/printk.c */ |
341 | #define __NR_syslog 116 | 360 | #define __NR_syslog 116 |
@@ -355,9 +374,11 @@ __SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler) | |||
355 | #define __NR_sched_getparam 121 | 374 | #define __NR_sched_getparam 121 |
356 | __SYSCALL(__NR_sched_getparam, sys_sched_getparam) | 375 | __SYSCALL(__NR_sched_getparam, sys_sched_getparam) |
357 | #define __NR_sched_setaffinity 122 | 376 | #define __NR_sched_setaffinity 122 |
358 | __SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity) | 377 | __SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \ |
378 | compat_sys_sched_setaffinity) | ||
359 | #define __NR_sched_getaffinity 123 | 379 | #define __NR_sched_getaffinity 123 |
360 | __SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity) | 380 | __SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \ |
381 | compat_sys_sched_getaffinity) | ||
361 | #define __NR_sched_yield 124 | 382 | #define __NR_sched_yield 124 |
362 | __SYSCALL(__NR_sched_yield, sys_sched_yield) | 383 | __SYSCALL(__NR_sched_yield, sys_sched_yield) |
363 | #define __NR_sched_get_priority_max 125 | 384 | #define __NR_sched_get_priority_max 125 |
@@ -365,7 +386,8 @@ __SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max) | |||
365 | #define __NR_sched_get_priority_min 126 | 386 | #define __NR_sched_get_priority_min 126 |
366 | __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) | 387 | __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) |
367 | #define __NR_sched_rr_get_interval 127 | 388 | #define __NR_sched_rr_get_interval 127 |
368 | __SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval) | 389 | __SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \ |
390 | compat_sys_sched_rr_get_interval) | ||
369 | 391 | ||
370 | /* kernel/signal.c */ | 392 | /* kernel/signal.c */ |
371 | #define __NR_restart_syscall 128 | 393 | #define __NR_restart_syscall 128 |
@@ -377,21 +399,23 @@ __SYSCALL(__NR_tkill, sys_tkill) | |||
377 | #define __NR_tgkill 131 | 399 | #define __NR_tgkill 131 |
378 | __SYSCALL(__NR_tgkill, sys_tgkill) | 400 | __SYSCALL(__NR_tgkill, sys_tgkill) |
379 | #define __NR_sigaltstack 132 | 401 | #define __NR_sigaltstack 132 |
380 | __SYSCALL(__NR_sigaltstack, sys_sigaltstack) | 402 | __SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack) |
381 | #define __NR_rt_sigsuspend 133 | 403 | #define __NR_rt_sigsuspend 133 |
382 | __SYSCALL(__NR_rt_sigsuspend, sys_rt_sigsuspend) /* __ARCH_WANT_SYS_RT_SIGSUSPEND */ | 404 | __SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend) |
383 | #define __NR_rt_sigaction 134 | 405 | #define __NR_rt_sigaction 134 |
384 | __SYSCALL(__NR_rt_sigaction, sys_rt_sigaction) /* __ARCH_WANT_SYS_RT_SIGACTION */ | 406 | __SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction) |
385 | #define __NR_rt_sigprocmask 135 | 407 | #define __NR_rt_sigprocmask 135 |
386 | __SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask) | 408 | __SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask) |
387 | #define __NR_rt_sigpending 136 | 409 | #define __NR_rt_sigpending 136 |
388 | __SYSCALL(__NR_rt_sigpending, sys_rt_sigpending) | 410 | __SYSCALL(__NR_rt_sigpending, sys_rt_sigpending) |
389 | #define __NR_rt_sigtimedwait 137 | 411 | #define __NR_rt_sigtimedwait 137 |
390 | __SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait) | 412 | __SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \ |
413 | compat_sys_rt_sigtimedwait) | ||
391 | #define __NR_rt_sigqueueinfo 138 | 414 | #define __NR_rt_sigqueueinfo 138 |
392 | __SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo) | 415 | __SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \ |
416 | compat_sys_rt_sigqueueinfo) | ||
393 | #define __NR_rt_sigreturn 139 | 417 | #define __NR_rt_sigreturn 139 |
394 | __SYSCALL(__NR_rt_sigreturn, sys_rt_sigreturn) /* sys_rt_sigreturn_wrapper, */ | 418 | __SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn) |
395 | 419 | ||
396 | /* kernel/sys.c */ | 420 | /* kernel/sys.c */ |
397 | #define __NR_setpriority 140 | 421 | #define __NR_setpriority 140 |
@@ -421,7 +445,7 @@ __SYSCALL(__NR_setfsuid, sys_setfsuid) | |||
421 | #define __NR_setfsgid 152 | 445 | #define __NR_setfsgid 152 |
422 | __SYSCALL(__NR_setfsgid, sys_setfsgid) | 446 | __SYSCALL(__NR_setfsgid, sys_setfsgid) |
423 | #define __NR_times 153 | 447 | #define __NR_times 153 |
424 | __SYSCALL(__NR_times, sys_times) | 448 | __SC_COMP(__NR_times, sys_times, compat_sys_times) |
425 | #define __NR_setpgid 154 | 449 | #define __NR_setpgid 154 |
426 | __SYSCALL(__NR_setpgid, sys_setpgid) | 450 | __SYSCALL(__NR_setpgid, sys_setpgid) |
427 | #define __NR_getpgid 155 | 451 | #define __NR_getpgid 155 |
@@ -441,11 +465,11 @@ __SYSCALL(__NR_sethostname, sys_sethostname) | |||
441 | #define __NR_setdomainname 162 | 465 | #define __NR_setdomainname 162 |
442 | __SYSCALL(__NR_setdomainname, sys_setdomainname) | 466 | __SYSCALL(__NR_setdomainname, sys_setdomainname) |
443 | #define __NR_getrlimit 163 | 467 | #define __NR_getrlimit 163 |
444 | __SYSCALL(__NR_getrlimit, sys_getrlimit) | 468 | __SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit) |
445 | #define __NR_setrlimit 164 | 469 | #define __NR_setrlimit 164 |
446 | __SYSCALL(__NR_setrlimit, sys_setrlimit) | 470 | __SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit) |
447 | #define __NR_getrusage 165 | 471 | #define __NR_getrusage 165 |
448 | __SYSCALL(__NR_getrusage, sys_getrusage) | 472 | __SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage) |
449 | #define __NR_umask 166 | 473 | #define __NR_umask 166 |
450 | __SYSCALL(__NR_umask, sys_umask) | 474 | __SYSCALL(__NR_umask, sys_umask) |
451 | #define __NR_prctl 167 | 475 | #define __NR_prctl 167 |
@@ -455,11 +479,11 @@ __SYSCALL(__NR_getcpu, sys_getcpu) | |||
455 | 479 | ||
456 | /* kernel/time.c */ | 480 | /* kernel/time.c */ |
457 | #define __NR_gettimeofday 169 | 481 | #define __NR_gettimeofday 169 |
458 | __SYSCALL(__NR_gettimeofday, sys_gettimeofday) | 482 | __SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday) |
459 | #define __NR_settimeofday 170 | 483 | #define __NR_settimeofday 170 |
460 | __SYSCALL(__NR_settimeofday, sys_settimeofday) | 484 | __SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday) |
461 | #define __NR_adjtimex 171 | 485 | #define __NR_adjtimex 171 |
462 | __SYSCALL(__NR_adjtimex, sys_adjtimex) | 486 | __SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex) |
463 | 487 | ||
464 | /* kernel/timer.c */ | 488 | /* kernel/timer.c */ |
465 | #define __NR_getpid 172 | 489 | #define __NR_getpid 172 |
@@ -477,39 +501,40 @@ __SYSCALL(__NR_getegid, sys_getegid) | |||
477 | #define __NR_gettid 178 | 501 | #define __NR_gettid 178 |
478 | __SYSCALL(__NR_gettid, sys_gettid) | 502 | __SYSCALL(__NR_gettid, sys_gettid) |
479 | #define __NR_sysinfo 179 | 503 | #define __NR_sysinfo 179 |
480 | __SYSCALL(__NR_sysinfo, sys_sysinfo) | 504 | __SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo) |
481 | 505 | ||
482 | /* ipc/mqueue.c */ | 506 | /* ipc/mqueue.c */ |
483 | #define __NR_mq_open 180 | 507 | #define __NR_mq_open 180 |
484 | __SYSCALL(__NR_mq_open, sys_mq_open) | 508 | __SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open) |
485 | #define __NR_mq_unlink 181 | 509 | #define __NR_mq_unlink 181 |
486 | __SYSCALL(__NR_mq_unlink, sys_mq_unlink) | 510 | __SYSCALL(__NR_mq_unlink, sys_mq_unlink) |
487 | #define __NR_mq_timedsend 182 | 511 | #define __NR_mq_timedsend 182 |
488 | __SYSCALL(__NR_mq_timedsend, sys_mq_timedsend) | 512 | __SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend) |
489 | #define __NR_mq_timedreceive 183 | 513 | #define __NR_mq_timedreceive 183 |
490 | __SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive) | 514 | __SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \ |
515 | compat_sys_mq_timedreceive) | ||
491 | #define __NR_mq_notify 184 | 516 | #define __NR_mq_notify 184 |
492 | __SYSCALL(__NR_mq_notify, sys_mq_notify) | 517 | __SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify) |
493 | #define __NR_mq_getsetattr 185 | 518 | #define __NR_mq_getsetattr 185 |
494 | __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr) | 519 | __SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr) |
495 | 520 | ||
496 | /* ipc/msg.c */ | 521 | /* ipc/msg.c */ |
497 | #define __NR_msgget 186 | 522 | #define __NR_msgget 186 |
498 | __SYSCALL(__NR_msgget, sys_msgget) | 523 | __SYSCALL(__NR_msgget, sys_msgget) |
499 | #define __NR_msgctl 187 | 524 | #define __NR_msgctl 187 |
500 | __SYSCALL(__NR_msgctl, sys_msgctl) | 525 | __SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl) |
501 | #define __NR_msgrcv 188 | 526 | #define __NR_msgrcv 188 |
502 | __SYSCALL(__NR_msgrcv, sys_msgrcv) | 527 | __SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv) |
503 | #define __NR_msgsnd 189 | 528 | #define __NR_msgsnd 189 |
504 | __SYSCALL(__NR_msgsnd, sys_msgsnd) | 529 | __SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd) |
505 | 530 | ||
506 | /* ipc/sem.c */ | 531 | /* ipc/sem.c */ |
507 | #define __NR_semget 190 | 532 | #define __NR_semget 190 |
508 | __SYSCALL(__NR_semget, sys_semget) | 533 | __SYSCALL(__NR_semget, sys_semget) |
509 | #define __NR_semctl 191 | 534 | #define __NR_semctl 191 |
510 | __SYSCALL(__NR_semctl, sys_semctl) | 535 | __SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl) |
511 | #define __NR_semtimedop 192 | 536 | #define __NR_semtimedop 192 |
512 | __SYSCALL(__NR_semtimedop, sys_semtimedop) | 537 | __SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop) |
513 | #define __NR_semop 193 | 538 | #define __NR_semop 193 |
514 | __SYSCALL(__NR_semop, sys_semop) | 539 | __SYSCALL(__NR_semop, sys_semop) |
515 | 540 | ||
@@ -517,9 +542,9 @@ __SYSCALL(__NR_semop, sys_semop) | |||
517 | #define __NR_shmget 194 | 542 | #define __NR_shmget 194 |
518 | __SYSCALL(__NR_shmget, sys_shmget) | 543 | __SYSCALL(__NR_shmget, sys_shmget) |
519 | #define __NR_shmctl 195 | 544 | #define __NR_shmctl 195 |
520 | __SYSCALL(__NR_shmctl, sys_shmctl) | 545 | __SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl) |
521 | #define __NR_shmat 196 | 546 | #define __NR_shmat 196 |
522 | __SYSCALL(__NR_shmat, sys_shmat) | 547 | __SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat) |
523 | #define __NR_shmdt 197 | 548 | #define __NR_shmdt 197 |
524 | __SYSCALL(__NR_shmdt, sys_shmdt) | 549 | __SYSCALL(__NR_shmdt, sys_shmdt) |
525 | 550 | ||
@@ -543,21 +568,21 @@ __SYSCALL(__NR_getpeername, sys_getpeername) | |||
543 | #define __NR_sendto 206 | 568 | #define __NR_sendto 206 |
544 | __SYSCALL(__NR_sendto, sys_sendto) | 569 | __SYSCALL(__NR_sendto, sys_sendto) |
545 | #define __NR_recvfrom 207 | 570 | #define __NR_recvfrom 207 |
546 | __SYSCALL(__NR_recvfrom, sys_recvfrom) | 571 | __SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom) |
547 | #define __NR_setsockopt 208 | 572 | #define __NR_setsockopt 208 |
548 | __SYSCALL(__NR_setsockopt, sys_setsockopt) | 573 | __SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt) |
549 | #define __NR_getsockopt 209 | 574 | #define __NR_getsockopt 209 |
550 | __SYSCALL(__NR_getsockopt, sys_getsockopt) | 575 | __SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt) |
551 | #define __NR_shutdown 210 | 576 | #define __NR_shutdown 210 |
552 | __SYSCALL(__NR_shutdown, sys_shutdown) | 577 | __SYSCALL(__NR_shutdown, sys_shutdown) |
553 | #define __NR_sendmsg 211 | 578 | #define __NR_sendmsg 211 |
554 | __SYSCALL(__NR_sendmsg, sys_sendmsg) | 579 | __SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg) |
555 | #define __NR_recvmsg 212 | 580 | #define __NR_recvmsg 212 |
556 | __SYSCALL(__NR_recvmsg, sys_recvmsg) | 581 | __SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg) |
557 | 582 | ||
558 | /* mm/filemap.c */ | 583 | /* mm/filemap.c */ |
559 | #define __NR_readahead 213 | 584 | #define __NR_readahead 213 |
560 | __SYSCALL(__NR_readahead, sys_readahead) | 585 | __SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead) |
561 | 586 | ||
562 | /* mm/nommu.c, also with MMU */ | 587 | /* mm/nommu.c, also with MMU */ |
563 | #define __NR_brk 214 | 588 | #define __NR_brk 214 |
@@ -573,19 +598,19 @@ __SYSCALL(__NR_add_key, sys_add_key) | |||
573 | #define __NR_request_key 218 | 598 | #define __NR_request_key 218 |
574 | __SYSCALL(__NR_request_key, sys_request_key) | 599 | __SYSCALL(__NR_request_key, sys_request_key) |
575 | #define __NR_keyctl 219 | 600 | #define __NR_keyctl 219 |
576 | __SYSCALL(__NR_keyctl, sys_keyctl) | 601 | __SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl) |
577 | 602 | ||
578 | /* arch/example/kernel/sys_example.c */ | 603 | /* arch/example/kernel/sys_example.c */ |
579 | #define __NR_clone 220 | 604 | #define __NR_clone 220 |
580 | __SYSCALL(__NR_clone, sys_clone) /* .long sys_clone_wrapper */ | 605 | __SYSCALL(__NR_clone, sys_clone) |
581 | #define __NR_execve 221 | 606 | #define __NR_execve 221 |
582 | __SYSCALL(__NR_execve, sys_execve) /* .long sys_execve_wrapper */ | 607 | __SC_COMP(__NR_execve, sys_execve, compat_sys_execve) |
583 | 608 | ||
584 | #define __NR3264_mmap 222 | 609 | #define __NR3264_mmap 222 |
585 | __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) | 610 | __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) |
586 | /* mm/fadvise.c */ | 611 | /* mm/fadvise.c */ |
587 | #define __NR3264_fadvise64 223 | 612 | #define __NR3264_fadvise64 223 |
588 | __SYSCALL(__NR3264_fadvise64, sys_fadvise64_64) | 613 | __SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64) |
589 | 614 | ||
590 | /* mm/, CONFIG_MMU only */ | 615 | /* mm/, CONFIG_MMU only */ |
591 | #ifndef __ARCH_NOMMU | 616 | #ifndef __ARCH_NOMMU |
@@ -612,25 +637,26 @@ __SYSCALL(__NR_madvise, sys_madvise) | |||
612 | #define __NR_remap_file_pages 234 | 637 | #define __NR_remap_file_pages 234 |
613 | __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) | 638 | __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) |
614 | #define __NR_mbind 235 | 639 | #define __NR_mbind 235 |
615 | __SYSCALL(__NR_mbind, sys_mbind) | 640 | __SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind) |
616 | #define __NR_get_mempolicy 236 | 641 | #define __NR_get_mempolicy 236 |
617 | __SYSCALL(__NR_get_mempolicy, sys_get_mempolicy) | 642 | __SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy) |
618 | #define __NR_set_mempolicy 237 | 643 | #define __NR_set_mempolicy 237 |
619 | __SYSCALL(__NR_set_mempolicy, sys_set_mempolicy) | 644 | __SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy) |
620 | #define __NR_migrate_pages 238 | 645 | #define __NR_migrate_pages 238 |
621 | __SYSCALL(__NR_migrate_pages, sys_migrate_pages) | 646 | __SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages) |
622 | #define __NR_move_pages 239 | 647 | #define __NR_move_pages 239 |
623 | __SYSCALL(__NR_move_pages, sys_move_pages) | 648 | __SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages) |
624 | #endif | 649 | #endif |
625 | 650 | ||
626 | #define __NR_rt_tgsigqueueinfo 240 | 651 | #define __NR_rt_tgsigqueueinfo 240 |
627 | __SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) | 652 | __SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \ |
653 | compat_sys_rt_tgsigqueueinfo) | ||
628 | #define __NR_perf_event_open 241 | 654 | #define __NR_perf_event_open 241 |
629 | __SYSCALL(__NR_perf_event_open, sys_perf_event_open) | 655 | __SYSCALL(__NR_perf_event_open, sys_perf_event_open) |
630 | #define __NR_accept4 242 | 656 | #define __NR_accept4 242 |
631 | __SYSCALL(__NR_accept4, sys_accept4) | 657 | __SYSCALL(__NR_accept4, sys_accept4) |
632 | #define __NR_recvmmsg 243 | 658 | #define __NR_recvmmsg 243 |
633 | __SYSCALL(__NR_recvmmsg, sys_recvmmsg) | 659 | __SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg) |
634 | 660 | ||
635 | /* | 661 | /* |
636 | * Architectures may provide up to 16 syscalls of their own | 662 | * Architectures may provide up to 16 syscalls of their own |
@@ -639,19 +665,20 @@ __SYSCALL(__NR_recvmmsg, sys_recvmmsg) | |||
639 | #define __NR_arch_specific_syscall 244 | 665 | #define __NR_arch_specific_syscall 244 |
640 | 666 | ||
641 | #define __NR_wait4 260 | 667 | #define __NR_wait4 260 |
642 | __SYSCALL(__NR_wait4, sys_wait4) | 668 | __SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4) |
643 | #define __NR_prlimit64 261 | 669 | #define __NR_prlimit64 261 |
644 | __SYSCALL(__NR_prlimit64, sys_prlimit64) | 670 | __SYSCALL(__NR_prlimit64, sys_prlimit64) |
645 | #define __NR_fanotify_init 262 | 671 | #define __NR_fanotify_init 262 |
646 | __SYSCALL(__NR_fanotify_init, sys_fanotify_init) | 672 | __SYSCALL(__NR_fanotify_init, sys_fanotify_init) |
647 | #define __NR_fanotify_mark 263 | 673 | #define __NR_fanotify_mark 263 |
648 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) | 674 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) |
649 | #define __NR_name_to_handle_at 264 | 675 | #define __NR_name_to_handle_at 264 |
650 | __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) | 676 | __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) |
651 | #define __NR_open_by_handle_at 265 | 677 | #define __NR_open_by_handle_at 265 |
652 | __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) | 678 | __SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ |
679 | compat_sys_open_by_handle_at) | ||
653 | #define __NR_clock_adjtime 266 | 680 | #define __NR_clock_adjtime 266 |
654 | __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime) | 681 | __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) |
655 | #define __NR_syncfs 267 | 682 | #define __NR_syncfs 267 |
656 | __SYSCALL(__NR_syncfs, sys_syncfs) | 683 | __SYSCALL(__NR_syncfs, sys_syncfs) |
657 | 684 | ||
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index be50d9e70a7d..2a7cea53ca0d 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h | |||
@@ -151,7 +151,6 @@ enum rq_flag_bits { | |||
151 | __REQ_IO_STAT, /* account I/O stat */ | 151 | __REQ_IO_STAT, /* account I/O stat */ |
152 | __REQ_MIXED_MERGE, /* merge of different types, fail separately */ | 152 | __REQ_MIXED_MERGE, /* merge of different types, fail separately */ |
153 | __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */ | 153 | __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */ |
154 | __REQ_ON_PLUG, /* on plug list */ | ||
155 | __REQ_NR_BITS, /* stops here */ | 154 | __REQ_NR_BITS, /* stops here */ |
156 | }; | 155 | }; |
157 | 156 | ||
@@ -192,6 +191,5 @@ enum rq_flag_bits { | |||
192 | #define REQ_IO_STAT (1 << __REQ_IO_STAT) | 191 | #define REQ_IO_STAT (1 << __REQ_IO_STAT) |
193 | #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) | 192 | #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) |
194 | #define REQ_SECURE (1 << __REQ_SECURE) | 193 | #define REQ_SECURE (1 << __REQ_SECURE) |
195 | #define REQ_ON_PLUG (1 << __REQ_ON_PLUG) | ||
196 | 194 | ||
197 | #endif /* __LINUX_BLK_TYPES_H */ | 195 | #endif /* __LINUX_BLK_TYPES_H */ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2ad95fa1d130..ae9091a68480 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -257,7 +257,7 @@ struct queue_limits { | |||
257 | unsigned char misaligned; | 257 | unsigned char misaligned; |
258 | unsigned char discard_misaligned; | 258 | unsigned char discard_misaligned; |
259 | unsigned char cluster; | 259 | unsigned char cluster; |
260 | signed char discard_zeroes_data; | 260 | unsigned char discard_zeroes_data; |
261 | }; | 261 | }; |
262 | 262 | ||
263 | struct request_queue | 263 | struct request_queue |
@@ -364,6 +364,8 @@ struct request_queue | |||
364 | * for flush operations | 364 | * for flush operations |
365 | */ | 365 | */ |
366 | unsigned int flush_flags; | 366 | unsigned int flush_flags; |
367 | unsigned int flush_not_queueable:1; | ||
368 | unsigned int flush_queue_delayed:1; | ||
367 | unsigned int flush_pending_idx:1; | 369 | unsigned int flush_pending_idx:1; |
368 | unsigned int flush_running_idx:1; | 370 | unsigned int flush_running_idx:1; |
369 | unsigned long flush_pending_since; | 371 | unsigned long flush_pending_since; |
@@ -843,6 +845,7 @@ extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); | |||
843 | extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); | 845 | extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); |
844 | extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); | 846 | extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); |
845 | extern void blk_queue_flush(struct request_queue *q, unsigned int flush); | 847 | extern void blk_queue_flush(struct request_queue *q, unsigned int flush); |
848 | extern void blk_queue_flush_queueable(struct request_queue *q, bool queueable); | ||
846 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); | 849 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); |
847 | 850 | ||
848 | extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); | 851 | extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); |
@@ -1066,13 +1069,16 @@ static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector | |||
1066 | { | 1069 | { |
1067 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); | 1070 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); |
1068 | 1071 | ||
1072 | if (!lim->max_discard_sectors) | ||
1073 | return 0; | ||
1074 | |||
1069 | return (lim->discard_granularity + lim->discard_alignment - alignment) | 1075 | return (lim->discard_granularity + lim->discard_alignment - alignment) |
1070 | & (lim->discard_granularity - 1); | 1076 | & (lim->discard_granularity - 1); |
1071 | } | 1077 | } |
1072 | 1078 | ||
1073 | static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) | 1079 | static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) |
1074 | { | 1080 | { |
1075 | if (q->limits.discard_zeroes_data == 1) | 1081 | if (q->limits.max_discard_sectors && q->limits.discard_zeroes_data == 1) |
1076 | return 1; | 1082 | return 1; |
1077 | 1083 | ||
1078 | return 0; | 1084 | return 0; |
@@ -1111,6 +1117,11 @@ static inline unsigned int block_size(struct block_device *bdev) | |||
1111 | return bdev->bd_block_size; | 1117 | return bdev->bd_block_size; |
1112 | } | 1118 | } |
1113 | 1119 | ||
1120 | static inline bool queue_flush_queueable(struct request_queue *q) | ||
1121 | { | ||
1122 | return !q->flush_not_queueable; | ||
1123 | } | ||
1124 | |||
1114 | typedef struct {struct page *v;} Sector; | 1125 | typedef struct {struct page *v;} Sector; |
1115 | 1126 | ||
1116 | unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *); | 1127 | unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *); |
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h index b8e995fbd867..b8c60694b2b0 100644 --- a/include/linux/ceph/ceph_fs.h +++ b/include/linux/ceph/ceph_fs.h | |||
@@ -313,6 +313,7 @@ enum { | |||
313 | CEPH_MDS_OP_GETATTR = 0x00101, | 313 | CEPH_MDS_OP_GETATTR = 0x00101, |
314 | CEPH_MDS_OP_LOOKUPHASH = 0x00102, | 314 | CEPH_MDS_OP_LOOKUPHASH = 0x00102, |
315 | CEPH_MDS_OP_LOOKUPPARENT = 0x00103, | 315 | CEPH_MDS_OP_LOOKUPPARENT = 0x00103, |
316 | CEPH_MDS_OP_LOOKUPINO = 0x00104, | ||
316 | 317 | ||
317 | CEPH_MDS_OP_SETXATTR = 0x01105, | 318 | CEPH_MDS_OP_SETXATTR = 0x01105, |
318 | CEPH_MDS_OP_RMXATTR = 0x01106, | 319 | CEPH_MDS_OP_RMXATTR = 0x01106, |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 5778b559d59c..ddcb7db38e67 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <linux/sem.h> | 12 | #include <linux/sem.h> |
13 | #include <linux/socket.h> | 13 | #include <linux/socket.h> |
14 | #include <linux/if.h> | 14 | #include <linux/if.h> |
15 | #include <linux/fs.h> | ||
16 | #include <linux/aio_abi.h> /* for aio_context_t */ | ||
15 | 17 | ||
16 | #include <asm/compat.h> | 18 | #include <asm/compat.h> |
17 | #include <asm/siginfo.h> | 19 | #include <asm/siginfo.h> |
@@ -26,7 +28,7 @@ typedef __compat_gid32_t compat_gid_t; | |||
26 | struct compat_sel_arg_struct; | 28 | struct compat_sel_arg_struct; |
27 | struct rusage; | 29 | struct rusage; |
28 | 30 | ||
29 | struct compat_itimerspec { | 31 | struct compat_itimerspec { |
30 | struct compat_timespec it_interval; | 32 | struct compat_timespec it_interval; |
31 | struct compat_timespec it_value; | 33 | struct compat_timespec it_value; |
32 | }; | 34 | }; |
@@ -70,9 +72,9 @@ struct compat_timex { | |||
70 | compat_long_t stbcnt; | 72 | compat_long_t stbcnt; |
71 | compat_int_t tai; | 73 | compat_int_t tai; |
72 | 74 | ||
73 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 75 | compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; |
74 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 76 | compat_int_t:32; compat_int_t:32; compat_int_t:32; compat_int_t:32; |
75 | compat_int_t :32; compat_int_t :32; compat_int_t :32; | 77 | compat_int_t:32; compat_int_t:32; compat_int_t:32; |
76 | }; | 78 | }; |
77 | 79 | ||
78 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) | 80 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) |
@@ -81,8 +83,10 @@ typedef struct { | |||
81 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; | 83 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; |
82 | } compat_sigset_t; | 84 | } compat_sigset_t; |
83 | 85 | ||
84 | extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *); | 86 | extern int get_compat_timespec(struct timespec *, |
85 | extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *); | 87 | const struct compat_timespec __user *); |
88 | extern int put_compat_timespec(const struct timespec *, | ||
89 | struct compat_timespec __user *); | ||
86 | 90 | ||
87 | struct compat_iovec { | 91 | struct compat_iovec { |
88 | compat_uptr_t iov_base; | 92 | compat_uptr_t iov_base; |
@@ -113,7 +117,8 @@ struct compat_rusage { | |||
113 | compat_long_t ru_nivcsw; | 117 | compat_long_t ru_nivcsw; |
114 | }; | 118 | }; |
115 | 119 | ||
116 | extern int put_compat_rusage(const struct rusage *, struct compat_rusage __user *); | 120 | extern int put_compat_rusage(const struct rusage *, |
121 | struct compat_rusage __user *); | ||
117 | 122 | ||
118 | struct compat_siginfo; | 123 | struct compat_siginfo; |
119 | 124 | ||
@@ -166,8 +171,7 @@ struct compat_ifmap { | |||
166 | unsigned char port; | 171 | unsigned char port; |
167 | }; | 172 | }; |
168 | 173 | ||
169 | struct compat_if_settings | 174 | struct compat_if_settings { |
170 | { | ||
171 | unsigned int type; /* Type of physical device or protocol */ | 175 | unsigned int type; /* Type of physical device or protocol */ |
172 | unsigned int size; /* Size of the data allocated by the caller */ | 176 | unsigned int size; /* Size of the data allocated by the caller */ |
173 | compat_uptr_t ifs_ifsu; /* union of pointers */ | 177 | compat_uptr_t ifs_ifsu; /* union of pointers */ |
@@ -195,8 +199,8 @@ struct compat_ifreq { | |||
195 | }; | 199 | }; |
196 | 200 | ||
197 | struct compat_ifconf { | 201 | struct compat_ifconf { |
198 | compat_int_t ifc_len; /* size of buffer */ | 202 | compat_int_t ifc_len; /* size of buffer */ |
199 | compat_caddr_t ifcbuf; | 203 | compat_caddr_t ifcbuf; |
200 | }; | 204 | }; |
201 | 205 | ||
202 | struct compat_robust_list { | 206 | struct compat_robust_list { |
@@ -209,6 +213,18 @@ struct compat_robust_list_head { | |||
209 | compat_uptr_t list_op_pending; | 213 | compat_uptr_t list_op_pending; |
210 | }; | 214 | }; |
211 | 215 | ||
216 | struct compat_statfs; | ||
217 | struct compat_statfs64; | ||
218 | struct compat_old_linux_dirent; | ||
219 | struct compat_linux_dirent; | ||
220 | struct linux_dirent64; | ||
221 | struct compat_msghdr; | ||
222 | struct compat_mmsghdr; | ||
223 | struct compat_sysinfo; | ||
224 | struct compat_sysctl_args; | ||
225 | struct compat_kexec_segment; | ||
226 | struct compat_mq_attr; | ||
227 | |||
212 | extern void compat_exit_robust_list(struct task_struct *curr); | 228 | extern void compat_exit_robust_list(struct task_struct *curr); |
213 | 229 | ||
214 | asmlinkage long | 230 | asmlinkage long |
@@ -243,8 +259,8 @@ asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, | |||
243 | const struct compat_iovec __user *vec, | 259 | const struct compat_iovec __user *vec, |
244 | unsigned long vlen, u32 pos_low, u32 pos_high); | 260 | unsigned long vlen, u32 pos_low, u32 pos_high); |
245 | 261 | ||
246 | int compat_do_execve(char * filename, compat_uptr_t __user *argv, | 262 | int compat_do_execve(char *filename, compat_uptr_t __user *argv, |
247 | compat_uptr_t __user *envp, struct pt_regs * regs); | 263 | compat_uptr_t __user *envp, struct pt_regs *regs); |
248 | 264 | ||
249 | asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, | 265 | asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, |
250 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, | 266 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, |
@@ -331,12 +347,18 @@ asmlinkage long compat_sys_epoll_pwait(int epfd, | |||
331 | const compat_sigset_t __user *sigmask, | 347 | const compat_sigset_t __user *sigmask, |
332 | compat_size_t sigsetsize); | 348 | compat_size_t sigsetsize); |
333 | 349 | ||
334 | asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, | 350 | asmlinkage long compat_sys_utime(const char __user *filename, |
335 | struct compat_timespec __user *t, int flags); | 351 | struct compat_utimbuf __user *t); |
352 | asmlinkage long compat_sys_utimensat(unsigned int dfd, | ||
353 | const char __user *filename, | ||
354 | struct compat_timespec __user *t, | ||
355 | int flags); | ||
336 | 356 | ||
357 | asmlinkage long compat_sys_time(compat_time_t __user *tloc); | ||
358 | asmlinkage long compat_sys_stime(compat_time_t __user *tptr); | ||
337 | asmlinkage long compat_sys_signalfd(int ufd, | 359 | asmlinkage long compat_sys_signalfd(int ufd, |
338 | const compat_sigset_t __user *sigmask, | 360 | const compat_sigset_t __user *sigmask, |
339 | compat_size_t sigsetsize); | 361 | compat_size_t sigsetsize); |
340 | asmlinkage long compat_sys_timerfd_settime(int ufd, int flags, | 362 | asmlinkage long compat_sys_timerfd_settime(int ufd, int flags, |
341 | const struct compat_itimerspec __user *utmr, | 363 | const struct compat_itimerspec __user *utmr, |
342 | struct compat_itimerspec __user *otmr); | 364 | struct compat_itimerspec __user *otmr); |
@@ -348,16 +370,190 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page, | |||
348 | const int __user *nodes, | 370 | const int __user *nodes, |
349 | int __user *status, | 371 | int __user *status, |
350 | int flags); | 372 | int flags); |
351 | asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, | 373 | asmlinkage long compat_sys_futimesat(unsigned int dfd, |
374 | const char __user *filename, | ||
352 | struct compat_timeval __user *t); | 375 | struct compat_timeval __user *t); |
353 | asmlinkage long compat_sys_newfstatat(unsigned int dfd, const char __user * filename, | 376 | asmlinkage long compat_sys_utimes(const char __user *filename, |
377 | struct compat_timeval __user *t); | ||
378 | asmlinkage long compat_sys_newstat(const char __user *filename, | ||
379 | struct compat_stat __user *statbuf); | ||
380 | asmlinkage long compat_sys_newlstat(const char __user *filename, | ||
381 | struct compat_stat __user *statbuf); | ||
382 | asmlinkage long compat_sys_newfstatat(unsigned int dfd, | ||
383 | const char __user *filename, | ||
354 | struct compat_stat __user *statbuf, | 384 | struct compat_stat __user *statbuf, |
355 | int flag); | 385 | int flag); |
386 | asmlinkage long compat_sys_newfstat(unsigned int fd, | ||
387 | struct compat_stat __user *statbuf); | ||
388 | asmlinkage long compat_sys_statfs(const char __user *pathname, | ||
389 | struct compat_statfs __user *buf); | ||
390 | asmlinkage long compat_sys_fstatfs(unsigned int fd, | ||
391 | struct compat_statfs __user *buf); | ||
392 | asmlinkage long compat_sys_statfs64(const char __user *pathname, | ||
393 | compat_size_t sz, | ||
394 | struct compat_statfs64 __user *buf); | ||
395 | asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, | ||
396 | struct compat_statfs64 __user *buf); | ||
397 | asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd, | ||
398 | unsigned long arg); | ||
399 | asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd, | ||
400 | unsigned long arg); | ||
401 | asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p); | ||
402 | asmlinkage long compat_sys_io_getevents(aio_context_t ctx_id, | ||
403 | unsigned long min_nr, | ||
404 | unsigned long nr, | ||
405 | struct io_event __user *events, | ||
406 | struct compat_timespec __user *timeout); | ||
407 | asmlinkage long compat_sys_io_submit(aio_context_t ctx_id, int nr, | ||
408 | u32 __user *iocb); | ||
409 | asmlinkage long compat_sys_mount(const char __user *dev_name, | ||
410 | const char __user *dir_name, | ||
411 | const char __user *type, unsigned long flags, | ||
412 | const void __user *data); | ||
413 | asmlinkage long compat_sys_old_readdir(unsigned int fd, | ||
414 | struct compat_old_linux_dirent __user *, | ||
415 | unsigned int count); | ||
416 | asmlinkage long compat_sys_getdents(unsigned int fd, | ||
417 | struct compat_linux_dirent __user *dirent, | ||
418 | unsigned int count); | ||
419 | asmlinkage long compat_sys_getdents64(unsigned int fd, | ||
420 | struct linux_dirent64 __user *dirent, | ||
421 | unsigned int count); | ||
422 | asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, | ||
423 | unsigned int nr_segs, unsigned int flags); | ||
424 | asmlinkage long compat_sys_open(const char __user *filename, int flags, | ||
425 | int mode); | ||
356 | asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, | 426 | asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, |
357 | int flags, int mode); | 427 | int flags, int mode); |
428 | asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, | ||
429 | struct file_handle __user *handle, | ||
430 | int flags); | ||
431 | asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, | ||
432 | compat_ulong_t __user *outp, | ||
433 | compat_ulong_t __user *exp, | ||
434 | struct compat_timespec __user *tsp, | ||
435 | void __user *sig); | ||
436 | asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, | ||
437 | unsigned int nfds, | ||
438 | struct compat_timespec __user *tsp, | ||
439 | const compat_sigset_t __user *sigmask, | ||
440 | compat_size_t sigsetsize); | ||
441 | #if (defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)) && \ | ||
442 | !defined(CONFIG_NFSD_DEPRECATED) | ||
443 | union compat_nfsctl_res; | ||
444 | struct compat_nfsctl_arg; | ||
445 | asmlinkage long compat_sys_nfsservctl(int cmd, | ||
446 | struct compat_nfsctl_arg __user *arg, | ||
447 | union compat_nfsctl_res __user *res); | ||
448 | #else | ||
449 | asmlinkage long compat_sys_nfsservctl(int cmd, void *notused, void *notused2); | ||
450 | #endif | ||
451 | asmlinkage long compat_sys_signalfd4(int ufd, | ||
452 | const compat_sigset_t __user *sigmask, | ||
453 | compat_size_t sigsetsize, int flags); | ||
454 | asmlinkage long compat_sys_get_mempolicy(int __user *policy, | ||
455 | compat_ulong_t __user *nmask, | ||
456 | compat_ulong_t maxnode, | ||
457 | compat_ulong_t addr, | ||
458 | compat_ulong_t flags); | ||
459 | asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask, | ||
460 | compat_ulong_t maxnode); | ||
461 | asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len, | ||
462 | compat_ulong_t mode, | ||
463 | compat_ulong_t __user *nmask, | ||
464 | compat_ulong_t maxnode, compat_ulong_t flags); | ||
465 | |||
466 | asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, | ||
467 | char __user *optval, unsigned int optlen); | ||
468 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, | ||
469 | unsigned flags); | ||
470 | asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, | ||
471 | unsigned int flags); | ||
472 | asmlinkage long compat_sys_recv(int fd, void __user *buf, size_t len, | ||
473 | unsigned flags); | ||
474 | asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len, | ||
475 | unsigned flags, struct sockaddr __user *addr, | ||
476 | int __user *addrlen); | ||
477 | asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, | ||
478 | unsigned vlen, unsigned int flags, | ||
479 | struct compat_timespec __user *timeout); | ||
480 | asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, | ||
481 | struct compat_timespec __user *rmtp); | ||
482 | asmlinkage long compat_sys_getitimer(int which, | ||
483 | struct compat_itimerval __user *it); | ||
484 | asmlinkage long compat_sys_setitimer(int which, | ||
485 | struct compat_itimerval __user *in, | ||
486 | struct compat_itimerval __user *out); | ||
487 | asmlinkage long compat_sys_times(struct compat_tms __user *tbuf); | ||
488 | asmlinkage long compat_sys_setrlimit(unsigned int resource, | ||
489 | struct compat_rlimit __user *rlim); | ||
490 | asmlinkage long compat_sys_getrlimit(unsigned int resource, | ||
491 | struct compat_rlimit __user *rlim); | ||
492 | asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru); | ||
493 | asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, | ||
494 | unsigned int len, | ||
495 | compat_ulong_t __user *user_mask_ptr); | ||
496 | asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, | ||
497 | unsigned int len, | ||
498 | compat_ulong_t __user *user_mask_ptr); | ||
499 | asmlinkage long compat_sys_timer_create(clockid_t which_clock, | ||
500 | struct compat_sigevent __user *timer_event_spec, | ||
501 | timer_t __user *created_timer_id); | ||
502 | asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags, | ||
503 | struct compat_itimerspec __user *new, | ||
504 | struct compat_itimerspec __user *old); | ||
505 | asmlinkage long compat_sys_timer_gettime(timer_t timer_id, | ||
506 | struct compat_itimerspec __user *setting); | ||
507 | asmlinkage long compat_sys_clock_settime(clockid_t which_clock, | ||
508 | struct compat_timespec __user *tp); | ||
509 | asmlinkage long compat_sys_clock_gettime(clockid_t which_clock, | ||
510 | struct compat_timespec __user *tp); | ||
511 | asmlinkage long compat_sys_clock_adjtime(clockid_t which_clock, | ||
512 | struct compat_timex __user *tp); | ||
513 | asmlinkage long compat_sys_clock_getres(clockid_t which_clock, | ||
514 | struct compat_timespec __user *tp); | ||
515 | asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, | ||
516 | struct compat_timespec __user *rqtp, | ||
517 | struct compat_timespec __user *rmtp); | ||
518 | asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese, | ||
519 | struct compat_siginfo __user *uinfo, | ||
520 | struct compat_timespec __user *uts, compat_size_t sigsetsize); | ||
521 | asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, | ||
522 | compat_size_t sigsetsize); | ||
523 | asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info); | ||
524 | asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, | ||
525 | unsigned long arg); | ||
526 | asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, | ||
527 | struct compat_timespec __user *utime, u32 __user *uaddr2, | ||
528 | u32 val3); | ||
529 | asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, | ||
530 | char __user *optval, int __user *optlen); | ||
531 | asmlinkage long compat_sys_kexec_load(unsigned long entry, | ||
532 | unsigned long nr_segments, | ||
533 | struct compat_kexec_segment __user *, | ||
534 | unsigned long flags); | ||
535 | asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, | ||
536 | const struct compat_mq_attr __user *u_mqstat, | ||
537 | struct compat_mq_attr __user *u_omqstat); | ||
538 | asmlinkage long compat_sys_mq_notify(mqd_t mqdes, | ||
539 | const struct compat_sigevent __user *u_notification); | ||
540 | asmlinkage long compat_sys_mq_open(const char __user *u_name, | ||
541 | int oflag, compat_mode_t mode, | ||
542 | struct compat_mq_attr __user *u_attr); | ||
543 | asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes, | ||
544 | const char __user *u_msg_ptr, | ||
545 | size_t msg_len, unsigned int msg_prio, | ||
546 | const struct compat_timespec __user *u_abs_timeout); | ||
547 | asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, | ||
548 | char __user *u_msg_ptr, | ||
549 | size_t msg_len, unsigned int __user *u_msg_prio, | ||
550 | const struct compat_timespec __user *u_abs_timeout); | ||
551 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args); | ||
552 | asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args); | ||
358 | 553 | ||
359 | extern ssize_t compat_rw_copy_check_uvector(int type, | 554 | extern ssize_t compat_rw_copy_check_uvector(int type, |
360 | const struct compat_iovec __user *uvector, unsigned long nr_segs, | 555 | const struct compat_iovec __user *uvector, |
556 | unsigned long nr_segs, | ||
361 | unsigned long fast_segs, struct iovec *fast_pointer, | 557 | unsigned long fast_segs, struct iovec *fast_pointer, |
362 | struct iovec **ret_pointer); | 558 | struct iovec **ret_pointer); |
363 | 559 | ||
diff --git a/include/linux/drbd.h b/include/linux/drbd.h index cec467f5d676..9e5f5607eba3 100644 --- a/include/linux/drbd.h +++ b/include/linux/drbd.h | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | /* Although the Linux source code makes a difference between | 39 | /* Although the Linux source code makes a difference between |
40 | generic endianness and the bitfields' endianness, there is no | 40 | generic endianness and the bitfields' endianness, there is no |
41 | architecture as of Linux-2.6.24-rc4 where the bitfileds' endianness | 41 | architecture as of Linux-2.6.24-rc4 where the bitfields' endianness |
42 | does not match the generic endianness. */ | 42 | does not match the generic endianness. */ |
43 | 43 | ||
44 | #if __BYTE_ORDER == __LITTLE_ENDIAN | 44 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
@@ -53,7 +53,7 @@ | |||
53 | 53 | ||
54 | 54 | ||
55 | extern const char *drbd_buildtag(void); | 55 | extern const char *drbd_buildtag(void); |
56 | #define REL_VERSION "8.3.10" | 56 | #define REL_VERSION "8.3.11" |
57 | #define API_VERSION 88 | 57 | #define API_VERSION 88 |
58 | #define PRO_VERSION_MIN 86 | 58 | #define PRO_VERSION_MIN 86 |
59 | #define PRO_VERSION_MAX 96 | 59 | #define PRO_VERSION_MAX 96 |
@@ -195,7 +195,7 @@ enum drbd_conns { | |||
195 | C_WF_REPORT_PARAMS, /* we have a socket */ | 195 | C_WF_REPORT_PARAMS, /* we have a socket */ |
196 | C_CONNECTED, /* we have introduced each other */ | 196 | C_CONNECTED, /* we have introduced each other */ |
197 | C_STARTING_SYNC_S, /* starting full sync by admin request. */ | 197 | C_STARTING_SYNC_S, /* starting full sync by admin request. */ |
198 | C_STARTING_SYNC_T, /* stariing full sync by admin request. */ | 198 | C_STARTING_SYNC_T, /* starting full sync by admin request. */ |
199 | C_WF_BITMAP_S, | 199 | C_WF_BITMAP_S, |
200 | C_WF_BITMAP_T, | 200 | C_WF_BITMAP_T, |
201 | C_WF_SYNC_UUID, | 201 | C_WF_SYNC_UUID, |
@@ -236,7 +236,7 @@ union drbd_state { | |||
236 | * pointed out by Maxim Uvarov q<muvarov@ru.mvista.com> | 236 | * pointed out by Maxim Uvarov q<muvarov@ru.mvista.com> |
237 | * even though we transmit as "cpu_to_be32(state)", | 237 | * even though we transmit as "cpu_to_be32(state)", |
238 | * the offsets of the bitfields still need to be swapped | 238 | * the offsets of the bitfields still need to be swapped |
239 | * on different endianess. | 239 | * on different endianness. |
240 | */ | 240 | */ |
241 | struct { | 241 | struct { |
242 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 242 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
@@ -266,7 +266,7 @@ union drbd_state { | |||
266 | unsigned peer:2 ; /* 3/4 primary/secondary/unknown */ | 266 | unsigned peer:2 ; /* 3/4 primary/secondary/unknown */ |
267 | unsigned role:2 ; /* 3/4 primary/secondary/unknown */ | 267 | unsigned role:2 ; /* 3/4 primary/secondary/unknown */ |
268 | #else | 268 | #else |
269 | # error "this endianess is not supported" | 269 | # error "this endianness is not supported" |
270 | #endif | 270 | #endif |
271 | }; | 271 | }; |
272 | unsigned int i; | 272 | unsigned int i; |
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h index f14a165e82dc..069543190516 100644 --- a/include/linux/drbd_tag_magic.h +++ b/include/linux/drbd_tag_magic.h | |||
@@ -30,7 +30,7 @@ enum packet_types { | |||
30 | int tag_and_len ## member; | 30 | int tag_and_len ## member; |
31 | #include "linux/drbd_nl.h" | 31 | #include "linux/drbd_nl.h" |
32 | 32 | ||
33 | /* declate tag-list-sizes */ | 33 | /* declare tag-list-sizes */ |
34 | static const int tag_list_sizes[] = { | 34 | static const int tag_list_sizes[] = { |
35 | #define NL_PACKET(name, number, fields) 2 fields , | 35 | #define NL_PACKET(name, number, fields) 2 fields , |
36 | #define NL_INTEGER(pn, pr, member) + 4 + 4 | 36 | #define NL_INTEGER(pn, pr, member) + 4 + 4 |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index d764a426e9fd..b78956b3c2e7 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -100,7 +100,6 @@ struct hd_struct { | |||
100 | sector_t start_sect; | 100 | sector_t start_sect; |
101 | sector_t nr_sects; | 101 | sector_t nr_sects; |
102 | sector_t alignment_offset; | 102 | sector_t alignment_offset; |
103 | unsigned int discard_alignment; | ||
104 | struct device __dev; | 103 | struct device __dev; |
105 | struct kobject *holder_dir; | 104 | struct kobject *holder_dir; |
106 | int policy, partno; | 105 | int policy, partno; |
@@ -127,6 +126,7 @@ struct hd_struct { | |||
127 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 | 126 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 |
128 | #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ | 127 | #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ |
129 | #define GENHD_FL_NATIVE_CAPACITY 128 | 128 | #define GENHD_FL_NATIVE_CAPACITY 128 |
129 | #define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256 | ||
130 | 130 | ||
131 | enum { | 131 | enum { |
132 | DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */ | 132 | DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */ |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index f1e3ff5880a9..a6c652ef516d 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -409,7 +409,7 @@ void i2c_unlock_adapter(struct i2c_adapter *); | |||
409 | /* i2c adapter classes (bitmask) */ | 409 | /* i2c adapter classes (bitmask) */ |
410 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ | 410 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ |
411 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ | 411 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ |
412 | #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ | 412 | #define I2C_CLASS_SPD (1<<7) /* Memory modules */ |
413 | 413 | ||
414 | /* Internal numbers to terminate lists */ | 414 | /* Internal numbers to terminate lists */ |
415 | #define I2C_CLIENT_END 0xfffeU | 415 | #define I2C_CLIENT_END 0xfffeU |
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h index 6a4fab7c6e09..7a71ffad037c 100644 --- a/include/linux/lru_cache.h +++ b/include/linux/lru_cache.h | |||
@@ -139,9 +139,9 @@ write intent log information, three of which are mentioned here. | |||
139 | * .list is on one of three lists: | 139 | * .list is on one of three lists: |
140 | * in_use: currently in use (refcnt > 0, lc_number != LC_FREE) | 140 | * in_use: currently in use (refcnt > 0, lc_number != LC_FREE) |
141 | * lru: unused but ready to be reused or recycled | 141 | * lru: unused but ready to be reused or recycled |
142 | * (ts_refcnt == 0, lc_number != LC_FREE), | 142 | * (lc_refcnt == 0, lc_number != LC_FREE), |
143 | * free: unused but ready to be recycled | 143 | * free: unused but ready to be recycled |
144 | * (ts_refcnt == 0, lc_number == LC_FREE), | 144 | * (lc_refcnt == 0, lc_number == LC_FREE), |
145 | * | 145 | * |
146 | * an element is said to be "in the active set", | 146 | * an element is said to be "in the active set", |
147 | * if either on "in_use" or "lru", i.e. lc_number != LC_FREE. | 147 | * if either on "in_use" or "lru", i.e. lc_number != LC_FREE. |
@@ -160,8 +160,8 @@ struct lc_element { | |||
160 | struct hlist_node colision; | 160 | struct hlist_node colision; |
161 | struct list_head list; /* LRU list or free list */ | 161 | struct list_head list; /* LRU list or free list */ |
162 | unsigned refcnt; | 162 | unsigned refcnt; |
163 | /* back "pointer" into ts_cache->element[index], | 163 | /* back "pointer" into lc_cache->element[index], |
164 | * for paranoia, and for "ts_element_to_index" */ | 164 | * for paranoia, and for "lc_element_to_index" */ |
165 | unsigned lc_index; | 165 | unsigned lc_index; |
166 | /* if we want to track a larger set of objects, | 166 | /* if we want to track a larger set of objects, |
167 | * it needs to become arch independend u64 */ | 167 | * it needs to become arch independend u64 */ |
@@ -190,8 +190,8 @@ struct lru_cache { | |||
190 | /* Arbitrary limit on maximum tracked objects. Practical limit is much | 190 | /* Arbitrary limit on maximum tracked objects. Practical limit is much |
191 | * lower due to allocation failures, probably. For typical use cases, | 191 | * lower due to allocation failures, probably. For typical use cases, |
192 | * nr_elements should be a few thousand at most. | 192 | * nr_elements should be a few thousand at most. |
193 | * This also limits the maximum value of ts_element.ts_index, allowing the | 193 | * This also limits the maximum value of lc_element.lc_index, allowing the |
194 | * 8 high bits of .ts_index to be overloaded with flags in the future. */ | 194 | * 8 high bits of .lc_index to be overloaded with flags in the future. */ |
195 | #define LC_MAX_ACTIVE (1<<24) | 195 | #define LC_MAX_ACTIVE (1<<24) |
196 | 196 | ||
197 | /* statistics */ | 197 | /* statistics */ |
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h new file mode 100644 index 000000000000..f0977986402c --- /dev/null +++ b/include/linux/mfd/db5500-prcmu.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License Terms: GNU General Public License v2 | ||
5 | * | ||
6 | * U5500 PRCMU API. | ||
7 | */ | ||
8 | #ifndef __MACH_PRCMU_U5500_H | ||
9 | #define __MACH_PRCMU_U5500_H | ||
10 | |||
11 | #ifdef CONFIG_UX500_SOC_DB5500 | ||
12 | |||
13 | void db5500_prcmu_early_init(void); | ||
14 | |||
15 | int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
16 | int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
17 | |||
18 | #else /* !CONFIG_UX500_SOC_DB5500 */ | ||
19 | |||
20 | static inline void db5500_prcmu_early_init(void) | ||
21 | { | ||
22 | } | ||
23 | |||
24 | static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
25 | { | ||
26 | return -ENOSYS; | ||
27 | } | ||
28 | |||
29 | static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | ||
30 | { | ||
31 | return -ENOSYS; | ||
32 | } | ||
33 | |||
34 | #endif /* CONFIG_UX500_SOC_DB5500 */ | ||
35 | |||
36 | static inline int db5500_prcmu_config_abb_event_readout(u32 abb_events) | ||
37 | { | ||
38 | #ifdef CONFIG_MACH_U5500_SIMULATOR | ||
39 | return 0; | ||
40 | #else | ||
41 | return -1; | ||
42 | #endif | ||
43 | } | ||
44 | |||
45 | #endif /* __MACH_PRCMU_U5500_H */ | ||
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h new file mode 100644 index 000000000000..917dbcab701c --- /dev/null +++ b/include/linux/mfd/db8500-prcmu.h | |||
@@ -0,0 +1,978 @@ | |||
1 | /* | ||
2 | * Copyright (C) STMicroelectronics 2009 | ||
3 | * Copyright (C) ST-Ericsson SA 2010 | ||
4 | * | ||
5 | * License Terms: GNU General Public License v2 | ||
6 | * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.com> | ||
7 | * | ||
8 | * PRCMU f/w APIs | ||
9 | */ | ||
10 | #ifndef __MFD_DB8500_PRCMU_H | ||
11 | #define __MFD_DB8500_PRCMU_H | ||
12 | |||
13 | #include <linux/interrupt.h> | ||
14 | #include <linux/notifier.h> | ||
15 | |||
16 | /* This portion previously known as <mach/prcmu-fw-defs_v1.h> */ | ||
17 | |||
18 | /** | ||
19 | * enum state - ON/OFF state definition | ||
20 | * @OFF: State is ON | ||
21 | * @ON: State is OFF | ||
22 | * | ||
23 | */ | ||
24 | enum state { | ||
25 | OFF = 0x0, | ||
26 | ON = 0x1, | ||
27 | }; | ||
28 | |||
29 | /** | ||
30 | * enum ret_state - general purpose On/Off/Retention states | ||
31 | * | ||
32 | */ | ||
33 | enum ret_state { | ||
34 | OFFST = 0, | ||
35 | ONST = 1, | ||
36 | RETST = 2 | ||
37 | }; | ||
38 | |||
39 | /** | ||
40 | * enum clk_arm - ARM Cortex A9 clock schemes | ||
41 | * @A9_OFF: | ||
42 | * @A9_BOOT: | ||
43 | * @A9_OPPT1: | ||
44 | * @A9_OPPT2: | ||
45 | * @A9_EXTCLK: | ||
46 | */ | ||
47 | enum clk_arm { | ||
48 | A9_OFF, | ||
49 | A9_BOOT, | ||
50 | A9_OPPT1, | ||
51 | A9_OPPT2, | ||
52 | A9_EXTCLK | ||
53 | }; | ||
54 | |||
55 | /** | ||
56 | * enum clk_gen - GEN#0/GEN#1 clock schemes | ||
57 | * @GEN_OFF: | ||
58 | * @GEN_BOOT: | ||
59 | * @GEN_OPPT1: | ||
60 | */ | ||
61 | enum clk_gen { | ||
62 | GEN_OFF, | ||
63 | GEN_BOOT, | ||
64 | GEN_OPPT1, | ||
65 | }; | ||
66 | |||
67 | /* some information between arm and xp70 */ | ||
68 | |||
69 | /** | ||
70 | * enum romcode_write - Romcode message written by A9 AND read by XP70 | ||
71 | * @RDY_2_DS: Value set when ApDeepSleep state can be executed by XP70 | ||
72 | * @RDY_2_XP70_RST: Value set when 0x0F has been successfully polled by the | ||
73 | * romcode. The xp70 will go into self-reset | ||
74 | */ | ||
75 | enum romcode_write { | ||
76 | RDY_2_DS = 0x09, | ||
77 | RDY_2_XP70_RST = 0x10 | ||
78 | }; | ||
79 | |||
80 | /** | ||
81 | * enum romcode_read - Romcode message written by XP70 and read by A9 | ||
82 | * @INIT: Init value when romcode field is not used | ||
83 | * @FS_2_DS: Value set when power state is going from ApExecute to | ||
84 | * ApDeepSleep | ||
85 | * @END_DS: Value set when ApDeepSleep power state is reached coming from | ||
86 | * ApExecute state | ||
87 | * @DS_TO_FS: Value set when power state is going from ApDeepSleep to | ||
88 | * ApExecute | ||
89 | * @END_FS: Value set when ApExecute power state is reached coming from | ||
90 | * ApDeepSleep state | ||
91 | * @SWR: Value set when power state is going to ApReset | ||
92 | * @END_SWR: Value set when the xp70 finished executing ApReset actions and | ||
93 | * waits for romcode acknowledgment to go to self-reset | ||
94 | */ | ||
95 | enum romcode_read { | ||
96 | INIT = 0x00, | ||
97 | FS_2_DS = 0x0A, | ||
98 | END_DS = 0x0B, | ||
99 | DS_TO_FS = 0x0C, | ||
100 | END_FS = 0x0D, | ||
101 | SWR = 0x0E, | ||
102 | END_SWR = 0x0F | ||
103 | }; | ||
104 | |||
105 | /** | ||
106 | * enum ap_pwrst - current power states defined in PRCMU firmware | ||
107 | * @NO_PWRST: Current power state init | ||
108 | * @AP_BOOT: Current power state is apBoot | ||
109 | * @AP_EXECUTE: Current power state is apExecute | ||
110 | * @AP_DEEP_SLEEP: Current power state is apDeepSleep | ||
111 | * @AP_SLEEP: Current power state is apSleep | ||
112 | * @AP_IDLE: Current power state is apIdle | ||
113 | * @AP_RESET: Current power state is apReset | ||
114 | */ | ||
115 | enum ap_pwrst { | ||
116 | NO_PWRST = 0x00, | ||
117 | AP_BOOT = 0x01, | ||
118 | AP_EXECUTE = 0x02, | ||
119 | AP_DEEP_SLEEP = 0x03, | ||
120 | AP_SLEEP = 0x04, | ||
121 | AP_IDLE = 0x05, | ||
122 | AP_RESET = 0x06 | ||
123 | }; | ||
124 | |||
125 | /** | ||
126 | * enum ap_pwrst_trans - Transition states defined in PRCMU firmware | ||
127 | * @NO_TRANSITION: No power state transition | ||
128 | * @APEXECUTE_TO_APSLEEP: Power state transition from ApExecute to ApSleep | ||
129 | * @APIDLE_TO_APSLEEP: Power state transition from ApIdle to ApSleep | ||
130 | * @APBOOT_TO_APEXECUTE: Power state transition from ApBoot to ApExecute | ||
131 | * @APEXECUTE_TO_APDEEPSLEEP: Power state transition from ApExecute to | ||
132 | * ApDeepSleep | ||
133 | * @APEXECUTE_TO_APIDLE: Power state transition from ApExecute to ApIdle | ||
134 | */ | ||
135 | enum ap_pwrst_trans { | ||
136 | NO_TRANSITION = 0x00, | ||
137 | APEXECUTE_TO_APSLEEP = 0x01, | ||
138 | APIDLE_TO_APSLEEP = 0x02, /* To be removed */ | ||
139 | PRCMU_AP_SLEEP = 0x01, | ||
140 | APBOOT_TO_APEXECUTE = 0x03, | ||
141 | APEXECUTE_TO_APDEEPSLEEP = 0x04, /* To be removed */ | ||
142 | PRCMU_AP_DEEP_SLEEP = 0x04, | ||
143 | APEXECUTE_TO_APIDLE = 0x05, /* To be removed */ | ||
144 | PRCMU_AP_IDLE = 0x05, | ||
145 | PRCMU_AP_DEEP_IDLE = 0x07, | ||
146 | }; | ||
147 | |||
148 | /** | ||
149 | * enum ddr_pwrst - DDR power states definition | ||
150 | * @DDR_PWR_STATE_UNCHANGED: SDRAM and DDR controller state is unchanged | ||
151 | * @DDR_PWR_STATE_ON: | ||
152 | * @DDR_PWR_STATE_OFFLOWLAT: | ||
153 | * @DDR_PWR_STATE_OFFHIGHLAT: | ||
154 | */ | ||
155 | enum ddr_pwrst { | ||
156 | DDR_PWR_STATE_UNCHANGED = 0x00, | ||
157 | DDR_PWR_STATE_ON = 0x01, | ||
158 | DDR_PWR_STATE_OFFLOWLAT = 0x02, | ||
159 | DDR_PWR_STATE_OFFHIGHLAT = 0x03 | ||
160 | }; | ||
161 | |||
162 | /** | ||
163 | * enum arm_opp - ARM OPP states definition | ||
164 | * @ARM_OPP_INIT: | ||
165 | * @ARM_NO_CHANGE: The ARM operating point is unchanged | ||
166 | * @ARM_100_OPP: The new ARM operating point is arm100opp | ||
167 | * @ARM_50_OPP: The new ARM operating point is arm50opp | ||
168 | * @ARM_MAX_OPP: Operating point is "max" (more than 100) | ||
169 | * @ARM_MAX_FREQ100OPP: Set max opp if available, else 100 | ||
170 | * @ARM_EXTCLK: The new ARM operating point is armExtClk | ||
171 | */ | ||
172 | enum arm_opp { | ||
173 | ARM_OPP_INIT = 0x00, | ||
174 | ARM_NO_CHANGE = 0x01, | ||
175 | ARM_100_OPP = 0x02, | ||
176 | ARM_50_OPP = 0x03, | ||
177 | ARM_MAX_OPP = 0x04, | ||
178 | ARM_MAX_FREQ100OPP = 0x05, | ||
179 | ARM_EXTCLK = 0x07 | ||
180 | }; | ||
181 | |||
182 | /** | ||
183 | * enum ape_opp - APE OPP states definition | ||
184 | * @APE_OPP_INIT: | ||
185 | * @APE_NO_CHANGE: The APE operating point is unchanged | ||
186 | * @APE_100_OPP: The new APE operating point is ape100opp | ||
187 | * @APE_50_OPP: 50% | ||
188 | */ | ||
189 | enum ape_opp { | ||
190 | APE_OPP_INIT = 0x00, | ||
191 | APE_NO_CHANGE = 0x01, | ||
192 | APE_100_OPP = 0x02, | ||
193 | APE_50_OPP = 0x03 | ||
194 | }; | ||
195 | |||
196 | /** | ||
197 | * enum hw_acc_state - State definition for hardware accelerator | ||
198 | * @HW_NO_CHANGE: The hardware accelerator state must remain unchanged | ||
199 | * @HW_OFF: The hardware accelerator must be switched off | ||
200 | * @HW_OFF_RAMRET: The hardware accelerator must be switched off with its | ||
201 | * internal RAM in retention | ||
202 | * @HW_ON: The hwa hardware accelerator hwa must be switched on | ||
203 | * | ||
204 | * NOTE! Deprecated, to be removed when all users switched over to use the | ||
205 | * regulator API. | ||
206 | */ | ||
207 | enum hw_acc_state { | ||
208 | HW_NO_CHANGE = 0x00, | ||
209 | HW_OFF = 0x01, | ||
210 | HW_OFF_RAMRET = 0x02, | ||
211 | HW_ON = 0x04 | ||
212 | }; | ||
213 | |||
214 | /** | ||
215 | * enum mbox_2_arm_stat - Status messages definition for mbox_arm | ||
216 | * @BOOT_TO_EXECUTEOK: The apBoot to apExecute state transition has been | ||
217 | * completed | ||
218 | * @DEEPSLEEPOK: The apExecute to apDeepSleep state transition has been | ||
219 | * completed | ||
220 | * @SLEEPOK: The apExecute to apSleep state transition has been completed | ||
221 | * @IDLEOK: The apExecute to apIdle state transition has been completed | ||
222 | * @SOFTRESETOK: The A9 watchdog/ SoftReset state has been completed | ||
223 | * @SOFTRESETGO : The A9 watchdog/SoftReset state is on going | ||
224 | * @BOOT_TO_EXECUTE: The apBoot to apExecute state transition is on going | ||
225 | * @EXECUTE_TO_DEEPSLEEP: The apExecute to apDeepSleep state transition is on | ||
226 | * going | ||
227 | * @DEEPSLEEP_TO_EXECUTE: The apDeepSleep to apExecute state transition is on | ||
228 | * going | ||
229 | * @DEEPSLEEP_TO_EXECUTEOK: The apDeepSleep to apExecute state transition has | ||
230 | * been completed | ||
231 | * @EXECUTE_TO_SLEEP: The apExecute to apSleep state transition is on going | ||
232 | * @SLEEP_TO_EXECUTE: The apSleep to apExecute state transition is on going | ||
233 | * @SLEEP_TO_EXECUTEOK: The apSleep to apExecute state transition has been | ||
234 | * completed | ||
235 | * @EXECUTE_TO_IDLE: The apExecute to apIdle state transition is on going | ||
236 | * @IDLE_TO_EXECUTE: The apIdle to apExecute state transition is on going | ||
237 | * @IDLE_TO_EXECUTEOK: The apIdle to apExecute state transition has been | ||
238 | * completed | ||
239 | * @INIT_STATUS: Status init | ||
240 | */ | ||
241 | enum ap_pwrsttr_status { | ||
242 | BOOT_TO_EXECUTEOK = 0xFF, | ||
243 | DEEPSLEEPOK = 0xFE, | ||
244 | SLEEPOK = 0xFD, | ||
245 | IDLEOK = 0xFC, | ||
246 | SOFTRESETOK = 0xFB, | ||
247 | SOFTRESETGO = 0xFA, | ||
248 | BOOT_TO_EXECUTE = 0xF9, | ||
249 | EXECUTE_TO_DEEPSLEEP = 0xF8, | ||
250 | DEEPSLEEP_TO_EXECUTE = 0xF7, | ||
251 | DEEPSLEEP_TO_EXECUTEOK = 0xF6, | ||
252 | EXECUTE_TO_SLEEP = 0xF5, | ||
253 | SLEEP_TO_EXECUTE = 0xF4, | ||
254 | SLEEP_TO_EXECUTEOK = 0xF3, | ||
255 | EXECUTE_TO_IDLE = 0xF2, | ||
256 | IDLE_TO_EXECUTE = 0xF1, | ||
257 | IDLE_TO_EXECUTEOK = 0xF0, | ||
258 | RDYTODS_RETURNTOEXE = 0xEF, | ||
259 | NORDYTODS_RETURNTOEXE = 0xEE, | ||
260 | EXETOSLEEP_RETURNTOEXE = 0xED, | ||
261 | EXETOIDLE_RETURNTOEXE = 0xEC, | ||
262 | INIT_STATUS = 0xEB, | ||
263 | |||
264 | /*error messages */ | ||
265 | INITERROR = 0x00, | ||
266 | PLLARMLOCKP_ER = 0x01, | ||
267 | PLLDDRLOCKP_ER = 0x02, | ||
268 | PLLSOCLOCKP_ER = 0x03, | ||
269 | PLLSOCK1LOCKP_ER = 0x04, | ||
270 | ARMWFI_ER = 0x05, | ||
271 | SYSCLKOK_ER = 0x06, | ||
272 | I2C_NACK_DATA_ER = 0x07, | ||
273 | BOOT_ER = 0x08, | ||
274 | I2C_STATUS_ALWAYS_1 = 0x0A, | ||
275 | I2C_NACK_REG_ADDR_ER = 0x0B, | ||
276 | I2C_NACK_DATA0123_ER = 0x1B, | ||
277 | I2C_NACK_ADDR_ER = 0x1F, | ||
278 | CURAPPWRSTISNOT_BOOT = 0x20, | ||
279 | CURAPPWRSTISNOT_EXECUTE = 0x21, | ||
280 | CURAPPWRSTISNOT_SLEEPMODE = 0x22, | ||
281 | CURAPPWRSTISNOT_CORRECTFORIT10 = 0x23, | ||
282 | FIFO4500WUISNOT_WUPEVENT = 0x24, | ||
283 | PLL32KLOCKP_ER = 0x29, | ||
284 | DDRDEEPSLEEPOK_ER = 0x2A, | ||
285 | ROMCODEREADY_ER = 0x50, | ||
286 | WUPBEFOREDS = 0x51, | ||
287 | DDRCONFIG_ER = 0x52, | ||
288 | WUPBEFORESLEEP = 0x53, | ||
289 | WUPBEFOREIDLE = 0x54 | ||
290 | }; /* earlier called as mbox_2_arm_stat */ | ||
291 | |||
292 | /** | ||
293 | * enum dvfs_stat - DVFS status messages definition | ||
294 | * @DVFS_GO: A state transition DVFS is on going | ||
295 | * @DVFS_ARM100OPPOK: The state transition DVFS has been completed for 100OPP | ||
296 | * @DVFS_ARM50OPPOK: The state transition DVFS has been completed for 50OPP | ||
297 | * @DVFS_ARMEXTCLKOK: The state transition DVFS has been completed for EXTCLK | ||
298 | * @DVFS_NOCHGTCLKOK: The state transition DVFS has been completed for | ||
299 | * NOCHGCLK | ||
300 | * @DVFS_INITSTATUS: Value init | ||
301 | */ | ||
302 | enum dvfs_stat { | ||
303 | DVFS_GO = 0xFF, | ||
304 | DVFS_ARM100OPPOK = 0xFE, | ||
305 | DVFS_ARM50OPPOK = 0xFD, | ||
306 | DVFS_ARMEXTCLKOK = 0xFC, | ||
307 | DVFS_NOCHGTCLKOK = 0xFB, | ||
308 | DVFS_INITSTATUS = 0x00 | ||
309 | }; | ||
310 | |||
311 | /** | ||
312 | * enum sva_mmdsp_stat - SVA MMDSP status messages | ||
313 | * @SVA_MMDSP_GO: SVAMMDSP interrupt has happened | ||
314 | * @SVA_MMDSP_INIT: Status init | ||
315 | */ | ||
316 | enum sva_mmdsp_stat { | ||
317 | SVA_MMDSP_GO = 0xFF, | ||
318 | SVA_MMDSP_INIT = 0x00 | ||
319 | }; | ||
320 | |||
321 | /** | ||
322 | * enum sia_mmdsp_stat - SIA MMDSP status messages | ||
323 | * @SIA_MMDSP_GO: SIAMMDSP interrupt has happened | ||
324 | * @SIA_MMDSP_INIT: Status init | ||
325 | */ | ||
326 | enum sia_mmdsp_stat { | ||
327 | SIA_MMDSP_GO = 0xFF, | ||
328 | SIA_MMDSP_INIT = 0x00 | ||
329 | }; | ||
330 | |||
331 | /** | ||
332 | * enum mbox_to_arm_err - Error messages definition | ||
333 | * @INIT_ERR: Init value | ||
334 | * @PLLARMLOCKP_ERR: PLLARM has not been correctly locked in given time | ||
335 | * @PLLDDRLOCKP_ERR: PLLDDR has not been correctly locked in the given time | ||
336 | * @PLLSOC0LOCKP_ERR: PLLSOC0 has not been correctly locked in the given time | ||
337 | * @PLLSOC1LOCKP_ERR: PLLSOC1 has not been correctly locked in the given time | ||
338 | * @ARMWFI_ERR: The ARM WFI has not been correctly executed in the given time | ||
339 | * @SYSCLKOK_ERR: The SYSCLK is not available in the given time | ||
340 | * @BOOT_ERR: Romcode has not validated the XP70 self reset in the given time | ||
341 | * @ROMCODESAVECONTEXT: The Romcode didn.t correctly save it secure context | ||
342 | * @VARMHIGHSPEEDVALTO_ERR: The ARM high speed supply value transfered | ||
343 | * through I2C has not been correctly executed in the given time | ||
344 | * @VARMHIGHSPEEDACCESS_ERR: The command value of VarmHighSpeedVal transfered | ||
345 | * through I2C has not been correctly executed in the given time | ||
346 | * @VARMLOWSPEEDVALTO_ERR:The ARM low speed supply value transfered through | ||
347 | * I2C has not been correctly executed in the given time | ||
348 | * @VARMLOWSPEEDACCESS_ERR: The command value of VarmLowSpeedVal transfered | ||
349 | * through I2C has not been correctly executed in the given time | ||
350 | * @VARMRETENTIONVALTO_ERR: The ARM retention supply value transfered through | ||
351 | * I2C has not been correctly executed in the given time | ||
352 | * @VARMRETENTIONACCESS_ERR: The command value of VarmRetentionVal transfered | ||
353 | * through I2C has not been correctly executed in the given time | ||
354 | * @VAPEHIGHSPEEDVALTO_ERR: The APE highspeed supply value transfered through | ||
355 | * I2C has not been correctly executed in the given time | ||
356 | * @VSAFEHPVALTO_ERR: The SAFE high power supply value transfered through I2C | ||
357 | * has not been correctly executed in the given time | ||
358 | * @VMODSEL1VALTO_ERR: The MODEM sel1 supply value transfered through I2C has | ||
359 | * not been correctly executed in the given time | ||
360 | * @VMODSEL2VALTO_ERR: The MODEM sel2 supply value transfered through I2C has | ||
361 | * not been correctly executed in the given time | ||
362 | * @VARMOFFACCESS_ERR: The command value of Varm ON/OFF transfered through | ||
363 | * I2C has not been correctly executed in the given time | ||
364 | * @VAPEOFFACCESS_ERR: The command value of Vape ON/OFF transfered through | ||
365 | * I2C has not been correctly executed in the given time | ||
366 | * @VARMRETACCES_ERR: The command value of Varm retention ON/OFF transfered | ||
367 | * through I2C has not been correctly executed in the given time | ||
368 | * @CURAPPWRSTISNOTBOOT:Generated when Arm want to do power state transition | ||
369 | * ApBoot to ApExecute but the power current state is not Apboot | ||
370 | * @CURAPPWRSTISNOTEXECUTE: Generated when Arm want to do power state | ||
371 | * transition from ApExecute to others power state but the | ||
372 | * power current state is not ApExecute | ||
373 | * @CURAPPWRSTISNOTSLEEPMODE: Generated when wake up events are transmitted | ||
374 | * but the power current state is not ApDeepSleep/ApSleep/ApIdle | ||
375 | * @CURAPPWRSTISNOTCORRECTDBG: Generated when wake up events are transmitted | ||
376 | * but the power current state is not correct | ||
377 | * @ARMREGU1VALTO_ERR:The ArmRegu1 value transferred through I2C has not | ||
378 | * been correctly executed in the given time | ||
379 | * @ARMREGU2VALTO_ERR: The ArmRegu2 value transferred through I2C has not | ||
380 | * been correctly executed in the given time | ||
381 | * @VAPEREGUVALTO_ERR: The VApeRegu value transfered through I2C has not | ||
382 | * been correctly executed in the given time | ||
383 | * @VSMPS3REGUVALTO_ERR: The VSmps3Regu value transfered through I2C has not | ||
384 | * been correctly executed in the given time | ||
385 | * @VMODREGUVALTO_ERR: The VModemRegu value transfered through I2C has not | ||
386 | * been correctly executed in the given time | ||
387 | */ | ||
388 | enum mbox_to_arm_err { | ||
389 | INIT_ERR = 0x00, | ||
390 | PLLARMLOCKP_ERR = 0x01, | ||
391 | PLLDDRLOCKP_ERR = 0x02, | ||
392 | PLLSOC0LOCKP_ERR = 0x03, | ||
393 | PLLSOC1LOCKP_ERR = 0x04, | ||
394 | ARMWFI_ERR = 0x05, | ||
395 | SYSCLKOK_ERR = 0x06, | ||
396 | BOOT_ERR = 0x07, | ||
397 | ROMCODESAVECONTEXT = 0x08, | ||
398 | VARMHIGHSPEEDVALTO_ERR = 0x10, | ||
399 | VARMHIGHSPEEDACCESS_ERR = 0x11, | ||
400 | VARMLOWSPEEDVALTO_ERR = 0x12, | ||
401 | VARMLOWSPEEDACCESS_ERR = 0x13, | ||
402 | VARMRETENTIONVALTO_ERR = 0x14, | ||
403 | VARMRETENTIONACCESS_ERR = 0x15, | ||
404 | VAPEHIGHSPEEDVALTO_ERR = 0x16, | ||
405 | VSAFEHPVALTO_ERR = 0x17, | ||
406 | VMODSEL1VALTO_ERR = 0x18, | ||
407 | VMODSEL2VALTO_ERR = 0x19, | ||
408 | VARMOFFACCESS_ERR = 0x1A, | ||
409 | VAPEOFFACCESS_ERR = 0x1B, | ||
410 | VARMRETACCES_ERR = 0x1C, | ||
411 | CURAPPWRSTISNOTBOOT = 0x20, | ||
412 | CURAPPWRSTISNOTEXECUTE = 0x21, | ||
413 | CURAPPWRSTISNOTSLEEPMODE = 0x22, | ||
414 | CURAPPWRSTISNOTCORRECTDBG = 0x23, | ||
415 | ARMREGU1VALTO_ERR = 0x24, | ||
416 | ARMREGU2VALTO_ERR = 0x25, | ||
417 | VAPEREGUVALTO_ERR = 0x26, | ||
418 | VSMPS3REGUVALTO_ERR = 0x27, | ||
419 | VMODREGUVALTO_ERR = 0x28 | ||
420 | }; | ||
421 | |||
422 | enum hw_acc { | ||
423 | SVAMMDSP = 0, | ||
424 | SVAPIPE = 1, | ||
425 | SIAMMDSP = 2, | ||
426 | SIAPIPE = 3, | ||
427 | SGA = 4, | ||
428 | B2R2MCDE = 5, | ||
429 | ESRAM12 = 6, | ||
430 | ESRAM34 = 7, | ||
431 | }; | ||
432 | |||
433 | enum cs_pwrmgt { | ||
434 | PWRDNCS0 = 0, | ||
435 | WKUPCS0 = 1, | ||
436 | PWRDNCS1 = 2, | ||
437 | WKUPCS1 = 3 | ||
438 | }; | ||
439 | |||
440 | /* Defs related to autonomous power management */ | ||
441 | |||
442 | /** | ||
443 | * enum sia_sva_pwr_policy - Power policy | ||
444 | * @NO_CHGT: No change | ||
445 | * @DSPOFF_HWPOFF: | ||
446 | * @DSPOFFRAMRET_HWPOFF: | ||
447 | * @DSPCLKOFF_HWPOFF: | ||
448 | * @DSPCLKOFF_HWPCLKOFF: | ||
449 | * | ||
450 | */ | ||
451 | enum sia_sva_pwr_policy { | ||
452 | NO_CHGT = 0x0, | ||
453 | DSPOFF_HWPOFF = 0x1, | ||
454 | DSPOFFRAMRET_HWPOFF = 0x2, | ||
455 | DSPCLKOFF_HWPOFF = 0x3, | ||
456 | DSPCLKOFF_HWPCLKOFF = 0x4, | ||
457 | }; | ||
458 | |||
459 | /** | ||
460 | * enum auto_enable - Auto Power enable | ||
461 | * @AUTO_OFF: | ||
462 | * @AUTO_ON: | ||
463 | * | ||
464 | */ | ||
465 | enum auto_enable { | ||
466 | AUTO_OFF = 0x0, | ||
467 | AUTO_ON = 0x1, | ||
468 | }; | ||
469 | |||
470 | /* End of file previously known as prcmu-fw-defs_v1.h */ | ||
471 | |||
472 | /* PRCMU Wakeup defines */ | ||
473 | enum prcmu_wakeup_index { | ||
474 | PRCMU_WAKEUP_INDEX_RTC, | ||
475 | PRCMU_WAKEUP_INDEX_RTT0, | ||
476 | PRCMU_WAKEUP_INDEX_RTT1, | ||
477 | PRCMU_WAKEUP_INDEX_HSI0, | ||
478 | PRCMU_WAKEUP_INDEX_HSI1, | ||
479 | PRCMU_WAKEUP_INDEX_USB, | ||
480 | PRCMU_WAKEUP_INDEX_ABB, | ||
481 | PRCMU_WAKEUP_INDEX_ABB_FIFO, | ||
482 | PRCMU_WAKEUP_INDEX_ARM, | ||
483 | NUM_PRCMU_WAKEUP_INDICES | ||
484 | }; | ||
485 | #define PRCMU_WAKEUP(_name) (BIT(PRCMU_WAKEUP_INDEX_##_name)) | ||
486 | |||
487 | /* PRCMU QoS APE OPP class */ | ||
488 | #define PRCMU_QOS_APE_OPP 1 | ||
489 | #define PRCMU_QOS_DDR_OPP 2 | ||
490 | #define PRCMU_QOS_DEFAULT_VALUE -1 | ||
491 | |||
492 | /** | ||
493 | * enum hw_acc_dev - enum for hw accelerators | ||
494 | * @HW_ACC_SVAMMDSP: for SVAMMDSP | ||
495 | * @HW_ACC_SVAPIPE: for SVAPIPE | ||
496 | * @HW_ACC_SIAMMDSP: for SIAMMDSP | ||
497 | * @HW_ACC_SIAPIPE: for SIAPIPE | ||
498 | * @HW_ACC_SGA: for SGA | ||
499 | * @HW_ACC_B2R2: for B2R2 | ||
500 | * @HW_ACC_MCDE: for MCDE | ||
501 | * @HW_ACC_ESRAM1: for ESRAM1 | ||
502 | * @HW_ACC_ESRAM2: for ESRAM2 | ||
503 | * @HW_ACC_ESRAM3: for ESRAM3 | ||
504 | * @HW_ACC_ESRAM4: for ESRAM4 | ||
505 | * @NUM_HW_ACC: number of hardware accelerators | ||
506 | * | ||
507 | * Different hw accelerators which can be turned ON/ | ||
508 | * OFF or put into retention (MMDSPs and ESRAMs). | ||
509 | * Used with EPOD API. | ||
510 | * | ||
511 | * NOTE! Deprecated, to be removed when all users switched over to use the | ||
512 | * regulator API. | ||
513 | */ | ||
514 | enum hw_acc_dev { | ||
515 | HW_ACC_SVAMMDSP, | ||
516 | HW_ACC_SVAPIPE, | ||
517 | HW_ACC_SIAMMDSP, | ||
518 | HW_ACC_SIAPIPE, | ||
519 | HW_ACC_SGA, | ||
520 | HW_ACC_B2R2, | ||
521 | HW_ACC_MCDE, | ||
522 | HW_ACC_ESRAM1, | ||
523 | HW_ACC_ESRAM2, | ||
524 | HW_ACC_ESRAM3, | ||
525 | HW_ACC_ESRAM4, | ||
526 | NUM_HW_ACC | ||
527 | }; | ||
528 | |||
529 | /* | ||
530 | * Ids for all EPODs (power domains) | ||
531 | * - EPOD_ID_SVAMMDSP: power domain for SVA MMDSP | ||
532 | * - EPOD_ID_SVAPIPE: power domain for SVA pipe | ||
533 | * - EPOD_ID_SIAMMDSP: power domain for SIA MMDSP | ||
534 | * - EPOD_ID_SIAPIPE: power domain for SIA pipe | ||
535 | * - EPOD_ID_SGA: power domain for SGA | ||
536 | * - EPOD_ID_B2R2_MCDE: power domain for B2R2 and MCDE | ||
537 | * - EPOD_ID_ESRAM12: power domain for ESRAM 1 and 2 | ||
538 | * - EPOD_ID_ESRAM34: power domain for ESRAM 3 and 4 | ||
539 | * - NUM_EPOD_ID: number of power domains | ||
540 | */ | ||
541 | #define EPOD_ID_SVAMMDSP 0 | ||
542 | #define EPOD_ID_SVAPIPE 1 | ||
543 | #define EPOD_ID_SIAMMDSP 2 | ||
544 | #define EPOD_ID_SIAPIPE 3 | ||
545 | #define EPOD_ID_SGA 4 | ||
546 | #define EPOD_ID_B2R2_MCDE 5 | ||
547 | #define EPOD_ID_ESRAM12 6 | ||
548 | #define EPOD_ID_ESRAM34 7 | ||
549 | #define NUM_EPOD_ID 8 | ||
550 | |||
551 | /* | ||
552 | * state definition for EPOD (power domain) | ||
553 | * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged | ||
554 | * - EPOD_STATE_OFF: The EPOD is switched off | ||
555 | * - EPOD_STATE_RAMRET: The EPOD is switched off with its internal RAM in | ||
556 | * retention | ||
557 | * - EPOD_STATE_ON_CLK_OFF: The EPOD is switched on, clock is still off | ||
558 | * - EPOD_STATE_ON: Same as above, but with clock enabled | ||
559 | */ | ||
560 | #define EPOD_STATE_NO_CHANGE 0x00 | ||
561 | #define EPOD_STATE_OFF 0x01 | ||
562 | #define EPOD_STATE_RAMRET 0x02 | ||
563 | #define EPOD_STATE_ON_CLK_OFF 0x03 | ||
564 | #define EPOD_STATE_ON 0x04 | ||
565 | |||
566 | /* | ||
567 | * CLKOUT sources | ||
568 | */ | ||
569 | #define PRCMU_CLKSRC_CLK38M 0x00 | ||
570 | #define PRCMU_CLKSRC_ACLK 0x01 | ||
571 | #define PRCMU_CLKSRC_SYSCLK 0x02 | ||
572 | #define PRCMU_CLKSRC_LCDCLK 0x03 | ||
573 | #define PRCMU_CLKSRC_SDMMCCLK 0x04 | ||
574 | #define PRCMU_CLKSRC_TVCLK 0x05 | ||
575 | #define PRCMU_CLKSRC_TIMCLK 0x06 | ||
576 | #define PRCMU_CLKSRC_CLK009 0x07 | ||
577 | /* These are only valid for CLKOUT1: */ | ||
578 | #define PRCMU_CLKSRC_SIAMMDSPCLK 0x40 | ||
579 | #define PRCMU_CLKSRC_I2CCLK 0x41 | ||
580 | #define PRCMU_CLKSRC_MSP02CLK 0x42 | ||
581 | #define PRCMU_CLKSRC_ARMPLL_OBSCLK 0x43 | ||
582 | #define PRCMU_CLKSRC_HSIRXCLK 0x44 | ||
583 | #define PRCMU_CLKSRC_HSITXCLK 0x45 | ||
584 | #define PRCMU_CLKSRC_ARMCLKFIX 0x46 | ||
585 | #define PRCMU_CLKSRC_HDMICLK 0x47 | ||
586 | |||
587 | /* | ||
588 | * Definitions for autonomous power management configuration. | ||
589 | */ | ||
590 | |||
591 | #define PRCMU_AUTO_PM_OFF 0 | ||
592 | #define PRCMU_AUTO_PM_ON 1 | ||
593 | |||
594 | #define PRCMU_AUTO_PM_POWER_ON_HSEM BIT(0) | ||
595 | #define PRCMU_AUTO_PM_POWER_ON_ABB_FIFO_IT BIT(1) | ||
596 | |||
597 | enum prcmu_auto_pm_policy { | ||
598 | PRCMU_AUTO_PM_POLICY_NO_CHANGE, | ||
599 | PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF, | ||
600 | PRCMU_AUTO_PM_POLICY_DSP_OFF_RAMRET_HWP_OFF, | ||
601 | PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_OFF, | ||
602 | PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_CLK_OFF, | ||
603 | }; | ||
604 | |||
605 | /** | ||
606 | * struct prcmu_auto_pm_config - Autonomous power management configuration. | ||
607 | * @sia_auto_pm_enable: SIA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON}) | ||
608 | * @sia_power_on: SIA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask) | ||
609 | * @sia_policy: SIA power policy. (enum prcmu_auto_pm_policy) | ||
610 | * @sva_auto_pm_enable: SVA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON}) | ||
611 | * @sva_power_on: SVA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask) | ||
612 | * @sva_policy: SVA power policy. (enum prcmu_auto_pm_policy) | ||
613 | */ | ||
614 | struct prcmu_auto_pm_config { | ||
615 | u8 sia_auto_pm_enable; | ||
616 | u8 sia_power_on; | ||
617 | u8 sia_policy; | ||
618 | u8 sva_auto_pm_enable; | ||
619 | u8 sva_power_on; | ||
620 | u8 sva_policy; | ||
621 | }; | ||
622 | |||
623 | /** | ||
624 | * enum ddr_opp - DDR OPP states definition | ||
625 | * @DDR_100_OPP: The new DDR operating point is ddr100opp | ||
626 | * @DDR_50_OPP: The new DDR operating point is ddr50opp | ||
627 | * @DDR_25_OPP: The new DDR operating point is ddr25opp | ||
628 | */ | ||
629 | enum ddr_opp { | ||
630 | DDR_100_OPP = 0x00, | ||
631 | DDR_50_OPP = 0x01, | ||
632 | DDR_25_OPP = 0x02, | ||
633 | }; | ||
634 | |||
635 | /* | ||
636 | * Clock identifiers. | ||
637 | */ | ||
638 | enum prcmu_clock { | ||
639 | PRCMU_SGACLK, | ||
640 | PRCMU_UARTCLK, | ||
641 | PRCMU_MSP02CLK, | ||
642 | PRCMU_MSP1CLK, | ||
643 | PRCMU_I2CCLK, | ||
644 | PRCMU_SDMMCCLK, | ||
645 | PRCMU_SLIMCLK, | ||
646 | PRCMU_PER1CLK, | ||
647 | PRCMU_PER2CLK, | ||
648 | PRCMU_PER3CLK, | ||
649 | PRCMU_PER5CLK, | ||
650 | PRCMU_PER6CLK, | ||
651 | PRCMU_PER7CLK, | ||
652 | PRCMU_LCDCLK, | ||
653 | PRCMU_BMLCLK, | ||
654 | PRCMU_HSITXCLK, | ||
655 | PRCMU_HSIRXCLK, | ||
656 | PRCMU_HDMICLK, | ||
657 | PRCMU_APEATCLK, | ||
658 | PRCMU_APETRACECLK, | ||
659 | PRCMU_MCDECLK, | ||
660 | PRCMU_IPI2CCLK, | ||
661 | PRCMU_DSIALTCLK, | ||
662 | PRCMU_DMACLK, | ||
663 | PRCMU_B2R2CLK, | ||
664 | PRCMU_TVCLK, | ||
665 | PRCMU_SSPCLK, | ||
666 | PRCMU_RNGCLK, | ||
667 | PRCMU_UICCCLK, | ||
668 | PRCMU_NUM_REG_CLOCKS, | ||
669 | PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS, | ||
670 | PRCMU_TIMCLK, | ||
671 | }; | ||
672 | |||
673 | /* | ||
674 | * Definitions for controlling ESRAM0 in deep sleep. | ||
675 | */ | ||
676 | #define ESRAM0_DEEP_SLEEP_STATE_OFF 1 | ||
677 | #define ESRAM0_DEEP_SLEEP_STATE_RET 2 | ||
678 | |||
679 | #ifdef CONFIG_MFD_DB8500_PRCMU | ||
680 | void __init prcmu_early_init(void); | ||
681 | int prcmu_set_display_clocks(void); | ||
682 | int prcmu_disable_dsipll(void); | ||
683 | int prcmu_enable_dsipll(void); | ||
684 | #else | ||
685 | static inline void __init prcmu_early_init(void) {} | ||
686 | #endif | ||
687 | |||
688 | #ifdef CONFIG_MFD_DB8500_PRCMU | ||
689 | |||
690 | int prcmu_set_rc_a2p(enum romcode_write); | ||
691 | enum romcode_read prcmu_get_rc_p2a(void); | ||
692 | enum ap_pwrst prcmu_get_xp70_current_state(void); | ||
693 | int prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); | ||
694 | |||
695 | void prcmu_enable_wakeups(u32 wakeups); | ||
696 | static inline void prcmu_disable_wakeups(void) | ||
697 | { | ||
698 | prcmu_enable_wakeups(0); | ||
699 | } | ||
700 | |||
701 | void prcmu_config_abb_event_readout(u32 abb_events); | ||
702 | void prcmu_get_abb_event_buffer(void __iomem **buf); | ||
703 | int prcmu_set_arm_opp(u8 opp); | ||
704 | int prcmu_get_arm_opp(void); | ||
705 | bool prcmu_has_arm_maxopp(void); | ||
706 | bool prcmu_is_u8400(void); | ||
707 | int prcmu_set_ape_opp(u8 opp); | ||
708 | int prcmu_get_ape_opp(void); | ||
709 | int prcmu_request_ape_opp_100_voltage(bool enable); | ||
710 | int prcmu_release_usb_wakeup_state(void); | ||
711 | int prcmu_set_ddr_opp(u8 opp); | ||
712 | int prcmu_get_ddr_opp(void); | ||
713 | unsigned long prcmu_qos_get_cpufreq_opp_delay(void); | ||
714 | void prcmu_qos_set_cpufreq_opp_delay(unsigned long); | ||
715 | /* NOTE! Use regulator framework instead */ | ||
716 | int prcmu_set_hwacc(u16 hw_acc_dev, u8 state); | ||
717 | int prcmu_set_epod(u16 epod_id, u8 epod_state); | ||
718 | void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, | ||
719 | struct prcmu_auto_pm_config *idle); | ||
720 | bool prcmu_is_auto_pm_enabled(void); | ||
721 | |||
722 | int prcmu_config_clkout(u8 clkout, u8 source, u8 div); | ||
723 | int prcmu_request_clock(u8 clock, bool enable); | ||
724 | int prcmu_set_clock_divider(u8 clock, u8 divider); | ||
725 | int prcmu_config_esram0_deep_sleep(u8 state); | ||
726 | int prcmu_config_hotdog(u8 threshold); | ||
727 | int prcmu_config_hotmon(u8 low, u8 high); | ||
728 | int prcmu_start_temp_sense(u16 cycles32k); | ||
729 | int prcmu_stop_temp_sense(void); | ||
730 | int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
731 | int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
732 | |||
733 | void prcmu_ac_wake_req(void); | ||
734 | void prcmu_ac_sleep_req(void); | ||
735 | void prcmu_system_reset(u16 reset_code); | ||
736 | void prcmu_modem_reset(void); | ||
737 | bool prcmu_is_ac_wake_requested(void); | ||
738 | void prcmu_enable_spi2(void); | ||
739 | void prcmu_disable_spi2(void); | ||
740 | |||
741 | #else /* !CONFIG_MFD_DB8500_PRCMU */ | ||
742 | |||
743 | static inline int prcmu_set_rc_a2p(enum romcode_write code) | ||
744 | { | ||
745 | return 0; | ||
746 | } | ||
747 | |||
748 | static inline enum romcode_read prcmu_get_rc_p2a(void) | ||
749 | { | ||
750 | return INIT; | ||
751 | } | ||
752 | |||
753 | static inline enum ap_pwrst prcmu_get_xp70_current_state(void) | ||
754 | { | ||
755 | return AP_EXECUTE; | ||
756 | } | ||
757 | |||
758 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, | ||
759 | bool keep_ap_pll) | ||
760 | { | ||
761 | return 0; | ||
762 | } | ||
763 | |||
764 | static inline void prcmu_enable_wakeups(u32 wakeups) {} | ||
765 | |||
766 | static inline void prcmu_disable_wakeups(void) {} | ||
767 | |||
768 | static inline void prcmu_config_abb_event_readout(u32 abb_events) {} | ||
769 | |||
770 | static inline int prcmu_set_arm_opp(u8 opp) | ||
771 | { | ||
772 | return 0; | ||
773 | } | ||
774 | |||
775 | static inline int prcmu_get_arm_opp(void) | ||
776 | { | ||
777 | return ARM_100_OPP; | ||
778 | } | ||
779 | |||
780 | static bool prcmu_has_arm_maxopp(void) | ||
781 | { | ||
782 | return false; | ||
783 | } | ||
784 | |||
785 | static bool prcmu_is_u8400(void) | ||
786 | { | ||
787 | return false; | ||
788 | } | ||
789 | |||
790 | static inline int prcmu_set_ape_opp(u8 opp) | ||
791 | { | ||
792 | return 0; | ||
793 | } | ||
794 | |||
795 | static inline int prcmu_get_ape_opp(void) | ||
796 | { | ||
797 | return APE_100_OPP; | ||
798 | } | ||
799 | |||
800 | static inline int prcmu_request_ape_opp_100_voltage(bool enable) | ||
801 | { | ||
802 | return 0; | ||
803 | } | ||
804 | |||
805 | static inline int prcmu_release_usb_wakeup_state(void) | ||
806 | { | ||
807 | return 0; | ||
808 | } | ||
809 | |||
810 | static inline int prcmu_set_ddr_opp(u8 opp) | ||
811 | { | ||
812 | return 0; | ||
813 | } | ||
814 | |||
815 | static inline int prcmu_get_ddr_opp(void) | ||
816 | { | ||
817 | return DDR_100_OPP; | ||
818 | } | ||
819 | |||
820 | static inline unsigned long prcmu_qos_get_cpufreq_opp_delay(void) | ||
821 | { | ||
822 | return 0; | ||
823 | } | ||
824 | |||
825 | static inline void prcmu_qos_set_cpufreq_opp_delay(unsigned long n) {} | ||
826 | |||
827 | static inline int prcmu_set_hwacc(u16 hw_acc_dev, u8 state) | ||
828 | { | ||
829 | return 0; | ||
830 | } | ||
831 | |||
832 | static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, | ||
833 | struct prcmu_auto_pm_config *idle) | ||
834 | { | ||
835 | } | ||
836 | |||
837 | static inline bool prcmu_is_auto_pm_enabled(void) | ||
838 | { | ||
839 | return false; | ||
840 | } | ||
841 | |||
842 | static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div) | ||
843 | { | ||
844 | return 0; | ||
845 | } | ||
846 | |||
847 | static inline int prcmu_request_clock(u8 clock, bool enable) | ||
848 | { | ||
849 | return 0; | ||
850 | } | ||
851 | |||
852 | static inline int prcmu_set_clock_divider(u8 clock, u8 divider) | ||
853 | { | ||
854 | return 0; | ||
855 | } | ||
856 | |||
857 | int prcmu_config_esram0_deep_sleep(u8 state) | ||
858 | { | ||
859 | return 0; | ||
860 | } | ||
861 | |||
862 | static inline int prcmu_config_hotdog(u8 threshold) | ||
863 | { | ||
864 | return 0; | ||
865 | } | ||
866 | |||
867 | static inline int prcmu_config_hotmon(u8 low, u8 high) | ||
868 | { | ||
869 | return 0; | ||
870 | } | ||
871 | |||
872 | static inline int prcmu_start_temp_sense(u16 cycles32k) | ||
873 | { | ||
874 | return 0; | ||
875 | } | ||
876 | |||
877 | static inline int prcmu_stop_temp_sense(void) | ||
878 | { | ||
879 | return 0; | ||
880 | } | ||
881 | |||
882 | static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
883 | { | ||
884 | return -ENOSYS; | ||
885 | } | ||
886 | |||
887 | static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | ||
888 | { | ||
889 | return -ENOSYS; | ||
890 | } | ||
891 | |||
892 | static inline void prcmu_ac_wake_req(void) {} | ||
893 | |||
894 | static inline void prcmu_ac_sleep_req(void) {} | ||
895 | |||
896 | static inline void prcmu_system_reset(u16 reset_code) {} | ||
897 | |||
898 | static inline void prcmu_modem_reset(void) {} | ||
899 | |||
900 | static inline bool prcmu_is_ac_wake_requested(void) | ||
901 | { | ||
902 | return false; | ||
903 | } | ||
904 | |||
905 | #ifndef CONFIG_UX500_SOC_DB5500 | ||
906 | static inline int prcmu_set_display_clocks(void) | ||
907 | { | ||
908 | return 0; | ||
909 | } | ||
910 | |||
911 | static inline int prcmu_disable_dsipll(void) | ||
912 | { | ||
913 | return 0; | ||
914 | } | ||
915 | |||
916 | static inline int prcmu_enable_dsipll(void) | ||
917 | { | ||
918 | return 0; | ||
919 | } | ||
920 | #endif | ||
921 | |||
922 | static inline int prcmu_enable_spi2(void) | ||
923 | { | ||
924 | return 0; | ||
925 | } | ||
926 | |||
927 | static inline int prcmu_disable_spi2(void) | ||
928 | { | ||
929 | return 0; | ||
930 | } | ||
931 | |||
932 | #endif /* !CONFIG_MFD_DB8500_PRCMU */ | ||
933 | |||
934 | #ifdef CONFIG_UX500_PRCMU_QOS_POWER | ||
935 | int prcmu_qos_requirement(int pm_qos_class); | ||
936 | int prcmu_qos_add_requirement(int pm_qos_class, char *name, s32 value); | ||
937 | int prcmu_qos_update_requirement(int pm_qos_class, char *name, s32 new_value); | ||
938 | void prcmu_qos_remove_requirement(int pm_qos_class, char *name); | ||
939 | int prcmu_qos_add_notifier(int prcmu_qos_class, | ||
940 | struct notifier_block *notifier); | ||
941 | int prcmu_qos_remove_notifier(int prcmu_qos_class, | ||
942 | struct notifier_block *notifier); | ||
943 | #else | ||
944 | static inline int prcmu_qos_requirement(int prcmu_qos_class) | ||
945 | { | ||
946 | return 0; | ||
947 | } | ||
948 | |||
949 | static inline int prcmu_qos_add_requirement(int prcmu_qos_class, | ||
950 | char *name, s32 value) | ||
951 | { | ||
952 | return 0; | ||
953 | } | ||
954 | |||
955 | static inline int prcmu_qos_update_requirement(int prcmu_qos_class, | ||
956 | char *name, s32 new_value) | ||
957 | { | ||
958 | return 0; | ||
959 | } | ||
960 | |||
961 | static inline void prcmu_qos_remove_requirement(int prcmu_qos_class, char *name) | ||
962 | { | ||
963 | } | ||
964 | |||
965 | static inline int prcmu_qos_add_notifier(int prcmu_qos_class, | ||
966 | struct notifier_block *notifier) | ||
967 | { | ||
968 | return 0; | ||
969 | } | ||
970 | static inline int prcmu_qos_remove_notifier(int prcmu_qos_class, | ||
971 | struct notifier_block *notifier) | ||
972 | { | ||
973 | return 0; | ||
974 | } | ||
975 | |||
976 | #endif | ||
977 | |||
978 | #endif /* __MFD_DB8500_PRCMU_H */ | ||
diff --git a/include/linux/regulator/db8500-prcmu.h b/include/linux/regulator/db8500-prcmu.h new file mode 100644 index 000000000000..612062313b68 --- /dev/null +++ b/include/linux/regulator/db8500-prcmu.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License Terms: GNU General Public License v2 | ||
5 | * | ||
6 | * Author: Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson | ||
7 | * | ||
8 | * Interface to power domain regulators on DB8500 | ||
9 | */ | ||
10 | |||
11 | #ifndef __REGULATOR_H__ | ||
12 | #define __REGULATOR_H__ | ||
13 | |||
14 | /* Number of DB8500 regulators and regulator enumeration */ | ||
15 | enum db8500_regulator_id { | ||
16 | DB8500_REGULATOR_VAPE, | ||
17 | DB8500_REGULATOR_VARM, | ||
18 | DB8500_REGULATOR_VMODEM, | ||
19 | DB8500_REGULATOR_VPLL, | ||
20 | DB8500_REGULATOR_VSMPS1, | ||
21 | DB8500_REGULATOR_VSMPS2, | ||
22 | DB8500_REGULATOR_VSMPS3, | ||
23 | DB8500_REGULATOR_VRF1, | ||
24 | DB8500_REGULATOR_SWITCH_SVAMMDSP, | ||
25 | DB8500_REGULATOR_SWITCH_SVAMMDSPRET, | ||
26 | DB8500_REGULATOR_SWITCH_SVAPIPE, | ||
27 | DB8500_REGULATOR_SWITCH_SIAMMDSP, | ||
28 | DB8500_REGULATOR_SWITCH_SIAMMDSPRET, | ||
29 | DB8500_REGULATOR_SWITCH_SIAPIPE, | ||
30 | DB8500_REGULATOR_SWITCH_SGA, | ||
31 | DB8500_REGULATOR_SWITCH_B2R2_MCDE, | ||
32 | DB8500_REGULATOR_SWITCH_ESRAM12, | ||
33 | DB8500_REGULATOR_SWITCH_ESRAM12RET, | ||
34 | DB8500_REGULATOR_SWITCH_ESRAM34, | ||
35 | DB8500_REGULATOR_SWITCH_ESRAM34RET, | ||
36 | DB8500_NUM_REGULATORS | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * Exported interface for CPUIdle only. This function is called with all | ||
41 | * interrupts turned off. | ||
42 | */ | ||
43 | int power_state_active_is_enabled(void); | ||
44 | |||
45 | #endif | ||
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index d2df55b0c213..008711e8e78f 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
@@ -241,10 +241,10 @@ enum p9_open_mode_t { | |||
241 | 241 | ||
242 | /** | 242 | /** |
243 | * enum p9_perm_t - 9P permissions | 243 | * enum p9_perm_t - 9P permissions |
244 | * @P9_DMDIR: mode bite for directories | 244 | * @P9_DMDIR: mode bit for directories |
245 | * @P9_DMAPPEND: mode bit for is append-only | 245 | * @P9_DMAPPEND: mode bit for is append-only |
246 | * @P9_DMEXCL: mode bit for excluse use (only one open handle allowed) | 246 | * @P9_DMEXCL: mode bit for excluse use (only one open handle allowed) |
247 | * @P9_DMMOUNT: mode bite for mount points | 247 | * @P9_DMMOUNT: mode bit for mount points |
248 | * @P9_DMAUTH: mode bit for authentication file | 248 | * @P9_DMAUTH: mode bit for authentication file |
249 | * @P9_DMTMP: mode bit for non-backed-up files | 249 | * @P9_DMTMP: mode bit for non-backed-up files |
250 | * @P9_DMSYMLINK: mode bit for symbolic links (9P2000.u) | 250 | * @P9_DMSYMLINK: mode bit for symbolic links (9P2000.u) |
@@ -362,7 +362,7 @@ struct p9_qid { | |||
362 | }; | 362 | }; |
363 | 363 | ||
364 | /** | 364 | /** |
365 | * struct p9_stat - file system metadata information | 365 | * struct p9_wstat - file system metadata information |
366 | * @size: length prefix for this stat structure instance | 366 | * @size: length prefix for this stat structure instance |
367 | * @type: the type of the server (equivalent to a major number) | 367 | * @type: the type of the server (equivalent to a major number) |
368 | * @dev: the sub-type of the server (equivalent to a minor number) | 368 | * @dev: the sub-type of the server (equivalent to a minor number) |
@@ -687,10 +687,10 @@ struct p9_rwstat { | |||
687 | * @size: prefixed length of the structure | 687 | * @size: prefixed length of the structure |
688 | * @id: protocol operating identifier of type &p9_msg_t | 688 | * @id: protocol operating identifier of type &p9_msg_t |
689 | * @tag: transaction id of the request | 689 | * @tag: transaction id of the request |
690 | * @offset: used by marshalling routines to track currentposition in buffer | 690 | * @offset: used by marshalling routines to track current position in buffer |
691 | * @capacity: used by marshalling routines to track total malloc'd capacity | 691 | * @capacity: used by marshalling routines to track total malloc'd capacity |
692 | * @pubuf: Payload user buffer given by the caller | 692 | * @pubuf: Payload user buffer given by the caller |
693 | * @pubuf: Payload kernel buffer given by the caller | 693 | * @pkbuf: Payload kernel buffer given by the caller |
694 | * @pbuf_size: pubuf/pkbuf(only one will be !NULL) size to be read/write. | 694 | * @pbuf_size: pubuf/pkbuf(only one will be !NULL) size to be read/write. |
695 | * @private: For transport layer's use. | 695 | * @private: For transport layer's use. |
696 | * @sdata: payload | 696 | * @sdata: payload |
@@ -714,7 +714,7 @@ struct p9_fcall { | |||
714 | size_t pbuf_size; | 714 | size_t pbuf_size; |
715 | void *private; | 715 | void *private; |
716 | 716 | ||
717 | uint8_t *sdata; | 717 | u8 *sdata; |
718 | }; | 718 | }; |
719 | 719 | ||
720 | struct p9_idpool; | 720 | struct p9_idpool; |
@@ -728,7 +728,6 @@ void p9_idpool_put(int id, struct p9_idpool *p); | |||
728 | int p9_idpool_check(int id, struct p9_idpool *p); | 728 | int p9_idpool_check(int id, struct p9_idpool *p); |
729 | 729 | ||
730 | int p9_error_init(void); | 730 | int p9_error_init(void); |
731 | int p9_errstr2errno(char *, int); | ||
732 | int p9_trans_fd_init(void); | 731 | int p9_trans_fd_init(void); |
733 | void p9_trans_fd_exit(void); | 732 | void p9_trans_fd_exit(void); |
734 | #endif /* NET_9P_H */ | 733 | #endif /* NET_9P_H */ |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index 051a99f79769..d26d5e98a173 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
@@ -60,7 +60,7 @@ enum p9_trans_status { | |||
60 | }; | 60 | }; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * enum p9_req_status_t - virtio request status | 63 | * enum p9_req_status_t - status of a request |
64 | * @REQ_STATUS_IDLE: request slot unused | 64 | * @REQ_STATUS_IDLE: request slot unused |
65 | * @REQ_STATUS_ALLOC: request has been allocated but not sent | 65 | * @REQ_STATUS_ALLOC: request has been allocated but not sent |
66 | * @REQ_STATUS_UNSENT: request waiting to be sent | 66 | * @REQ_STATUS_UNSENT: request waiting to be sent |
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index 8f08c736c4c3..d8549fb9c742 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h | |||
@@ -41,6 +41,7 @@ | |||
41 | * @pref: Preferences of this transport | 41 | * @pref: Preferences of this transport |
42 | * @def: set if this transport should be considered the default | 42 | * @def: set if this transport should be considered the default |
43 | * @create: member function to create a new connection on this transport | 43 | * @create: member function to create a new connection on this transport |
44 | * @close: member function to discard a connection on this transport | ||
44 | * @request: member function to issue a request to the transport | 45 | * @request: member function to issue a request to the transport |
45 | * @cancel: member function to cancel a request (if it hasn't been sent) | 46 | * @cancel: member function to cancel a request (if it hasn't been sent) |
46 | * | 47 | * |
@@ -48,7 +49,7 @@ | |||
48 | * transport module with the 9P core network module and used by the client | 49 | * transport module with the 9P core network module and used by the client |
49 | * to instantiate a new connection on a transport. | 50 | * to instantiate a new connection on a transport. |
50 | * | 51 | * |
51 | * BUGS: the transport module list isn't protected. | 52 | * The transport module list is protected by v9fs_trans_lock. |
52 | */ | 53 | */ |
53 | 54 | ||
54 | struct p9_trans_module { | 55 | struct p9_trans_module { |
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index 61e523af3c46..3d5d6db864fe 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h | |||
@@ -45,6 +45,19 @@ typedef uint64_t blkif_sector_t; | |||
45 | #define BLKIF_OP_WRITE_BARRIER 2 | 45 | #define BLKIF_OP_WRITE_BARRIER 2 |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Recognised if "feature-flush-cache" is present in backend xenbus | ||
49 | * info. A flush will ask the underlying storage hardware to flush its | ||
50 | * non-volatile caches as appropriate. The "feature-flush-cache" node | ||
51 | * contains a boolean indicating whether flush requests are likely to | ||
52 | * succeed or fail. Either way, a flush request may fail at any time | ||
53 | * with BLKIF_RSP_EOPNOTSUPP if it is unsupported by the underlying | ||
54 | * block-device hardware. The boolean simply indicates whether or not it | ||
55 | * is worthwhile for the frontend to attempt flushes. If a backend does | ||
56 | * not recognise BLKIF_OP_WRITE_FLUSH_CACHE, it should *not* create the | ||
57 | * "feature-flush-cache" node! | ||
58 | */ | ||
59 | #define BLKIF_OP_FLUSH_DISKCACHE 3 | ||
60 | /* | ||
48 | * Maximum scatter/gather segments per request. | 61 | * Maximum scatter/gather segments per request. |
49 | * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE. | 62 | * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE. |
50 | * NB. This could be 12 if the ring indexes weren't stored in the same page. | 63 | * NB. This could be 12 if the ring indexes weren't stored in the same page. |
diff --git a/kernel/compat.c b/kernel/compat.c index 9214dcd087b7..fc9eb093acd5 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -293,6 +293,8 @@ asmlinkage long compat_sys_times(struct compat_tms __user *tbuf) | |||
293 | return compat_jiffies_to_clock_t(jiffies); | 293 | return compat_jiffies_to_clock_t(jiffies); |
294 | } | 294 | } |
295 | 295 | ||
296 | #ifdef __ARCH_WANT_SYS_SIGPENDING | ||
297 | |||
296 | /* | 298 | /* |
297 | * Assumption: old_sigset_t and compat_old_sigset_t are both | 299 | * Assumption: old_sigset_t and compat_old_sigset_t are both |
298 | * types that can be passed to put_user()/get_user(). | 300 | * types that can be passed to put_user()/get_user(). |
@@ -312,6 +314,10 @@ asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set) | |||
312 | return ret; | 314 | return ret; |
313 | } | 315 | } |
314 | 316 | ||
317 | #endif | ||
318 | |||
319 | #ifdef __ARCH_WANT_SYS_SIGPROCMASK | ||
320 | |||
315 | asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set, | 321 | asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set, |
316 | compat_old_sigset_t __user *oset) | 322 | compat_old_sigset_t __user *oset) |
317 | { | 323 | { |
@@ -333,6 +339,8 @@ asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set, | |||
333 | return ret; | 339 | return ret; |
334 | } | 340 | } |
335 | 341 | ||
342 | #endif | ||
343 | |||
336 | asmlinkage long compat_sys_setrlimit(unsigned int resource, | 344 | asmlinkage long compat_sys_setrlimit(unsigned int resource, |
337 | struct compat_rlimit __user *rlim) | 345 | struct compat_rlimit __user *rlim) |
338 | { | 346 | { |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index c541ee527ecb..a9205e32a059 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -748,7 +748,7 @@ static inline void retrigger_next_event(void *arg) { } | |||
748 | */ | 748 | */ |
749 | void clock_was_set(void) | 749 | void clock_was_set(void) |
750 | { | 750 | { |
751 | #ifdef CONFIG_HIGHRES_TIMERS | 751 | #ifdef CONFIG_HIGH_RES_TIMERS |
752 | /* Retrigger the CPU local events everywhere */ | 752 | /* Retrigger the CPU local events everywhere */ |
753 | on_each_cpu(retrigger_next_event, NULL, 1); | 753 | on_each_cpu(retrigger_next_event, NULL, 1); |
754 | #endif | 754 | #endif |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 4bffd62c2f13..4fc92445a29c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -1506,7 +1506,7 @@ static struct ctl_table fs_table[] = { | |||
1506 | 1506 | ||
1507 | static struct ctl_table debug_table[] = { | 1507 | static struct ctl_table debug_table[] = { |
1508 | #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \ | 1508 | #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \ |
1509 | defined(CONFIG_S390) | 1509 | defined(CONFIG_S390) || defined(CONFIG_TILE) |
1510 | { | 1510 | { |
1511 | .procname = "exception-trace", | 1511 | .procname = "exception-trace", |
1512 | .data = &show_unhandled_signals, | 1512 | .data = &show_unhandled_signals, |
diff --git a/lib/audit.c b/lib/audit.c index 8e7dc1c63aa9..76bbed4a20e5 100644 --- a/lib/audit.c +++ b/lib/audit.c | |||
@@ -36,8 +36,10 @@ int audit_classify_arch(int arch) | |||
36 | int audit_classify_syscall(int abi, unsigned syscall) | 36 | int audit_classify_syscall(int abi, unsigned syscall) |
37 | { | 37 | { |
38 | switch(syscall) { | 38 | switch(syscall) { |
39 | #ifdef __NR_open | ||
39 | case __NR_open: | 40 | case __NR_open: |
40 | return 2; | 41 | return 2; |
42 | #endif | ||
41 | #ifdef __NR_openat | 43 | #ifdef __NR_openat |
42 | case __NR_openat: | 44 | case __NR_openat: |
43 | return 3; | 45 | return 3; |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index befc87531e4f..f032e6e1e09a 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -63,10 +63,10 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v) | |||
63 | unsigned long background_thresh; | 63 | unsigned long background_thresh; |
64 | unsigned long dirty_thresh; | 64 | unsigned long dirty_thresh; |
65 | unsigned long bdi_thresh; | 65 | unsigned long bdi_thresh; |
66 | unsigned long nr_dirty, nr_io, nr_more_io, nr_wb; | 66 | unsigned long nr_dirty, nr_io, nr_more_io; |
67 | struct inode *inode; | 67 | struct inode *inode; |
68 | 68 | ||
69 | nr_wb = nr_dirty = nr_io = nr_more_io = 0; | 69 | nr_dirty = nr_io = nr_more_io = 0; |
70 | spin_lock(&inode_wb_list_lock); | 70 | spin_lock(&inode_wb_list_lock); |
71 | list_for_each_entry(inode, &wb->b_dirty, i_wb_list) | 71 | list_for_each_entry(inode, &wb->b_dirty, i_wb_list) |
72 | nr_dirty++; | 72 | nr_dirty++; |
diff --git a/net/9p/Kconfig b/net/9p/Kconfig index 7ed75c7bd5d1..d9ea09b11cf8 100644 --- a/net/9p/Kconfig +++ b/net/9p/Kconfig | |||
@@ -3,8 +3,8 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig NET_9P | 5 | menuconfig NET_9P |
6 | depends on NET && EXPERIMENTAL | 6 | depends on NET |
7 | tristate "Plan 9 Resource Sharing Support (9P2000) (Experimental)" | 7 | tristate "Plan 9 Resource Sharing Support (9P2000)" |
8 | help | 8 | help |
9 | If you say Y here, you will get experimental support for | 9 | If you say Y here, you will get experimental support for |
10 | Plan 9 resource sharing via the 9P2000 protocol. | 10 | Plan 9 resource sharing via the 9P2000 protocol. |
@@ -16,8 +16,8 @@ menuconfig NET_9P | |||
16 | if NET_9P | 16 | if NET_9P |
17 | 17 | ||
18 | config NET_9P_VIRTIO | 18 | config NET_9P_VIRTIO |
19 | depends on EXPERIMENTAL && VIRTIO | 19 | depends on VIRTIO |
20 | tristate "9P Virtio Transport (Experimental)" | 20 | tristate "9P Virtio Transport" |
21 | help | 21 | help |
22 | This builds support for a transports between | 22 | This builds support for a transports between |
23 | guest partitions and a host partition. | 23 | guest partitions and a host partition. |
diff --git a/net/9p/client.c b/net/9p/client.c index ceab943dfc49..9e3b0e640da1 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -92,9 +92,6 @@ static int get_protocol_version(const substring_t *name) | |||
92 | return version; | 92 | return version; |
93 | } | 93 | } |
94 | 94 | ||
95 | static struct p9_req_t * | ||
96 | p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...); | ||
97 | |||
98 | /** | 95 | /** |
99 | * parse_options - parse mount options into client structure | 96 | * parse_options - parse mount options into client structure |
100 | * @opts: options string passed from mount | 97 | * @opts: options string passed from mount |
@@ -307,12 +304,13 @@ static int p9_tag_init(struct p9_client *c) | |||
307 | c->tagpool = p9_idpool_create(); | 304 | c->tagpool = p9_idpool_create(); |
308 | if (IS_ERR(c->tagpool)) { | 305 | if (IS_ERR(c->tagpool)) { |
309 | err = PTR_ERR(c->tagpool); | 306 | err = PTR_ERR(c->tagpool); |
310 | c->tagpool = NULL; | ||
311 | goto error; | 307 | goto error; |
312 | } | 308 | } |
313 | 309 | err = p9_idpool_get(c->tagpool); /* reserve tag 0 */ | |
314 | p9_idpool_get(c->tagpool); /* reserve tag 0 */ | 310 | if (err < 0) { |
315 | 311 | p9_idpool_destroy(c->tagpool); | |
312 | goto error; | ||
313 | } | ||
316 | c->max_tag = 0; | 314 | c->max_tag = 0; |
317 | error: | 315 | error: |
318 | return err; | 316 | return err; |
@@ -518,12 +516,15 @@ out_err: | |||
518 | return err; | 516 | return err; |
519 | } | 517 | } |
520 | 518 | ||
519 | static struct p9_req_t * | ||
520 | p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...); | ||
521 | |||
521 | /** | 522 | /** |
522 | * p9_client_flush - flush (cancel) a request | 523 | * p9_client_flush - flush (cancel) a request |
523 | * @c: client state | 524 | * @c: client state |
524 | * @oldreq: request to cancel | 525 | * @oldreq: request to cancel |
525 | * | 526 | * |
526 | * This sents a flush for a particular requests and links | 527 | * This sents a flush for a particular request and links |
527 | * the flush request to the original request. The current | 528 | * the flush request to the original request. The current |
528 | * code only supports a single flush request although the protocol | 529 | * code only supports a single flush request although the protocol |
529 | * allows for multiple flush requests to be sent for a single request. | 530 | * allows for multiple flush requests to be sent for a single request. |
@@ -789,11 +790,13 @@ struct p9_client *p9_client_create(const char *dev_name, char *options) | |||
789 | spin_lock_init(&clnt->lock); | 790 | spin_lock_init(&clnt->lock); |
790 | INIT_LIST_HEAD(&clnt->fidlist); | 791 | INIT_LIST_HEAD(&clnt->fidlist); |
791 | 792 | ||
792 | p9_tag_init(clnt); | 793 | err = p9_tag_init(clnt); |
794 | if (err < 0) | ||
795 | goto free_client; | ||
793 | 796 | ||
794 | err = parse_opts(options, clnt); | 797 | err = parse_opts(options, clnt); |
795 | if (err < 0) | 798 | if (err < 0) |
796 | goto free_client; | 799 | goto destroy_tagpool; |
797 | 800 | ||
798 | if (!clnt->trans_mod) | 801 | if (!clnt->trans_mod) |
799 | clnt->trans_mod = v9fs_get_default_trans(); | 802 | clnt->trans_mod = v9fs_get_default_trans(); |
@@ -802,13 +805,12 @@ struct p9_client *p9_client_create(const char *dev_name, char *options) | |||
802 | err = -EPROTONOSUPPORT; | 805 | err = -EPROTONOSUPPORT; |
803 | P9_DPRINTK(P9_DEBUG_ERROR, | 806 | P9_DPRINTK(P9_DEBUG_ERROR, |
804 | "No transport defined or default transport\n"); | 807 | "No transport defined or default transport\n"); |
805 | goto free_client; | 808 | goto destroy_tagpool; |
806 | } | 809 | } |
807 | 810 | ||
808 | clnt->fidpool = p9_idpool_create(); | 811 | clnt->fidpool = p9_idpool_create(); |
809 | if (IS_ERR(clnt->fidpool)) { | 812 | if (IS_ERR(clnt->fidpool)) { |
810 | err = PTR_ERR(clnt->fidpool); | 813 | err = PTR_ERR(clnt->fidpool); |
811 | clnt->fidpool = NULL; | ||
812 | goto put_trans; | 814 | goto put_trans; |
813 | } | 815 | } |
814 | 816 | ||
@@ -834,6 +836,8 @@ destroy_fidpool: | |||
834 | p9_idpool_destroy(clnt->fidpool); | 836 | p9_idpool_destroy(clnt->fidpool); |
835 | put_trans: | 837 | put_trans: |
836 | v9fs_put_trans(clnt->trans_mod); | 838 | v9fs_put_trans(clnt->trans_mod); |
839 | destroy_tagpool: | ||
840 | p9_idpool_destroy(clnt->tagpool); | ||
837 | free_client: | 841 | free_client: |
838 | kfree(clnt); | 842 | kfree(clnt); |
839 | return ERR_PTR(err); | 843 | return ERR_PTR(err); |
@@ -1298,7 +1302,7 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset, | |||
1298 | if (count < rsize) | 1302 | if (count < rsize) |
1299 | rsize = count; | 1303 | rsize = count; |
1300 | 1304 | ||
1301 | /* Don't bother zerocopy form small IO (< 1024) */ | 1305 | /* Don't bother zerocopy for small IO (< 1024) */ |
1302 | if (((clnt->trans_mod->pref & P9_TRANS_PREF_PAYLOAD_MASK) == | 1306 | if (((clnt->trans_mod->pref & P9_TRANS_PREF_PAYLOAD_MASK) == |
1303 | P9_TRANS_PREF_PAYLOAD_SEP) && (rsize > 1024)) { | 1307 | P9_TRANS_PREF_PAYLOAD_SEP) && (rsize > 1024)) { |
1304 | req = p9_client_rpc(clnt, P9_TREAD, "dqE", fid->fid, offset, | 1308 | req = p9_client_rpc(clnt, P9_TREAD, "dqE", fid->fid, offset, |
diff --git a/net/9p/mod.c b/net/9p/mod.c index cf8a4128cd5c..72c398275051 100644 --- a/net/9p/mod.c +++ b/net/9p/mod.c | |||
@@ -139,7 +139,7 @@ void v9fs_put_trans(struct p9_trans_module *m) | |||
139 | } | 139 | } |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * v9fs_init - Initialize module | 142 | * init_p9 - Initialize module |
143 | * | 143 | * |
144 | */ | 144 | */ |
145 | static int __init init_p9(void) | 145 | static int __init init_p9(void) |
@@ -154,7 +154,7 @@ static int __init init_p9(void) | |||
154 | } | 154 | } |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * v9fs_init - shutdown module | 157 | * exit_p9 - shutdown module |
158 | * | 158 | * |
159 | */ | 159 | */ |
160 | 160 | ||
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 4a9084395d35..fdfdb5747f63 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
@@ -916,8 +916,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args) | |||
916 | sin_server.sin_family = AF_INET; | 916 | sin_server.sin_family = AF_INET; |
917 | sin_server.sin_addr.s_addr = in_aton(addr); | 917 | sin_server.sin_addr.s_addr = in_aton(addr); |
918 | sin_server.sin_port = htons(opts.port); | 918 | sin_server.sin_port = htons(opts.port); |
919 | err = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket); | 919 | err = __sock_create(read_pnet(¤t->nsproxy->net_ns), PF_INET, |
920 | 920 | SOCK_STREAM, IPPROTO_TCP, &csocket, 1); | |
921 | if (err) { | 921 | if (err) { |
922 | P9_EPRINTK(KERN_ERR, "p9_trans_tcp: problem creating socket\n"); | 922 | P9_EPRINTK(KERN_ERR, "p9_trans_tcp: problem creating socket\n"); |
923 | return err; | 923 | return err; |
@@ -954,7 +954,8 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args) | |||
954 | 954 | ||
955 | sun_server.sun_family = PF_UNIX; | 955 | sun_server.sun_family = PF_UNIX; |
956 | strcpy(sun_server.sun_path, addr); | 956 | strcpy(sun_server.sun_path, addr); |
957 | err = sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket); | 957 | err = __sock_create(read_pnet(¤t->nsproxy->net_ns), PF_UNIX, |
958 | SOCK_STREAM, 0, &csocket, 1); | ||
958 | if (err < 0) { | 959 | if (err < 0) { |
959 | P9_EPRINTK(KERN_ERR, "p9_trans_unix: problem creating socket\n"); | 960 | P9_EPRINTK(KERN_ERR, "p9_trans_unix: problem creating socket\n"); |
960 | return err; | 961 | return err; |
diff --git a/net/9p/util.c b/net/9p/util.c index da6af81e59d9..9c1c9348ac35 100644 --- a/net/9p/util.c +++ b/net/9p/util.c | |||
@@ -93,7 +93,7 @@ int p9_idpool_get(struct p9_idpool *p) | |||
93 | 93 | ||
94 | retry: | 94 | retry: |
95 | if (idr_pre_get(&p->pool, GFP_NOFS) == 0) | 95 | if (idr_pre_get(&p->pool, GFP_NOFS) == 0) |
96 | return 0; | 96 | return -1; |
97 | 97 | ||
98 | spin_lock_irqsave(&p->lock, flags); | 98 | spin_lock_irqsave(&p->lock, flags); |
99 | 99 | ||
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index e15a82ccc05f..78b55f49de7c 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -76,7 +76,8 @@ const char *ceph_pr_addr(const struct sockaddr_storage *ss) | |||
76 | break; | 76 | break; |
77 | 77 | ||
78 | default: | 78 | default: |
79 | sprintf(s, "(unknown sockaddr family %d)", (int)ss->ss_family); | 79 | snprintf(s, MAX_ADDR_STR_LEN, "(unknown sockaddr family %d)", |
80 | (int)ss->ss_family); | ||
80 | } | 81 | } |
81 | 82 | ||
82 | return s; | 83 | return s; |
@@ -598,7 +599,7 @@ static void prepare_write_keepalive(struct ceph_connection *con) | |||
598 | * Connection negotiation. | 599 | * Connection negotiation. |
599 | */ | 600 | */ |
600 | 601 | ||
601 | static void prepare_connect_authorizer(struct ceph_connection *con) | 602 | static int prepare_connect_authorizer(struct ceph_connection *con) |
602 | { | 603 | { |
603 | void *auth_buf; | 604 | void *auth_buf; |
604 | int auth_len = 0; | 605 | int auth_len = 0; |
@@ -612,13 +613,20 @@ static void prepare_connect_authorizer(struct ceph_connection *con) | |||
612 | con->auth_retry); | 613 | con->auth_retry); |
613 | mutex_lock(&con->mutex); | 614 | mutex_lock(&con->mutex); |
614 | 615 | ||
616 | if (test_bit(CLOSED, &con->state) || | ||
617 | test_bit(OPENING, &con->state)) | ||
618 | return -EAGAIN; | ||
619 | |||
615 | con->out_connect.authorizer_protocol = cpu_to_le32(auth_protocol); | 620 | con->out_connect.authorizer_protocol = cpu_to_le32(auth_protocol); |
616 | con->out_connect.authorizer_len = cpu_to_le32(auth_len); | 621 | con->out_connect.authorizer_len = cpu_to_le32(auth_len); |
617 | 622 | ||
618 | con->out_kvec[con->out_kvec_left].iov_base = auth_buf; | 623 | if (auth_len) { |
619 | con->out_kvec[con->out_kvec_left].iov_len = auth_len; | 624 | con->out_kvec[con->out_kvec_left].iov_base = auth_buf; |
620 | con->out_kvec_left++; | 625 | con->out_kvec[con->out_kvec_left].iov_len = auth_len; |
621 | con->out_kvec_bytes += auth_len; | 626 | con->out_kvec_left++; |
627 | con->out_kvec_bytes += auth_len; | ||
628 | } | ||
629 | return 0; | ||
622 | } | 630 | } |
623 | 631 | ||
624 | /* | 632 | /* |
@@ -640,9 +648,9 @@ static void prepare_write_banner(struct ceph_messenger *msgr, | |||
640 | set_bit(WRITE_PENDING, &con->state); | 648 | set_bit(WRITE_PENDING, &con->state); |
641 | } | 649 | } |
642 | 650 | ||
643 | static void prepare_write_connect(struct ceph_messenger *msgr, | 651 | static int prepare_write_connect(struct ceph_messenger *msgr, |
644 | struct ceph_connection *con, | 652 | struct ceph_connection *con, |
645 | int after_banner) | 653 | int after_banner) |
646 | { | 654 | { |
647 | unsigned global_seq = get_global_seq(con->msgr, 0); | 655 | unsigned global_seq = get_global_seq(con->msgr, 0); |
648 | int proto; | 656 | int proto; |
@@ -683,7 +691,7 @@ static void prepare_write_connect(struct ceph_messenger *msgr, | |||
683 | con->out_more = 0; | 691 | con->out_more = 0; |
684 | set_bit(WRITE_PENDING, &con->state); | 692 | set_bit(WRITE_PENDING, &con->state); |
685 | 693 | ||
686 | prepare_connect_authorizer(con); | 694 | return prepare_connect_authorizer(con); |
687 | } | 695 | } |
688 | 696 | ||
689 | 697 | ||
@@ -1065,8 +1073,10 @@ static void addr_set_port(struct sockaddr_storage *ss, int p) | |||
1065 | switch (ss->ss_family) { | 1073 | switch (ss->ss_family) { |
1066 | case AF_INET: | 1074 | case AF_INET: |
1067 | ((struct sockaddr_in *)ss)->sin_port = htons(p); | 1075 | ((struct sockaddr_in *)ss)->sin_port = htons(p); |
1076 | break; | ||
1068 | case AF_INET6: | 1077 | case AF_INET6: |
1069 | ((struct sockaddr_in6 *)ss)->sin6_port = htons(p); | 1078 | ((struct sockaddr_in6 *)ss)->sin6_port = htons(p); |
1079 | break; | ||
1070 | } | 1080 | } |
1071 | } | 1081 | } |
1072 | 1082 | ||
@@ -1216,6 +1226,7 @@ static int process_connect(struct ceph_connection *con) | |||
1216 | u64 sup_feat = con->msgr->supported_features; | 1226 | u64 sup_feat = con->msgr->supported_features; |
1217 | u64 req_feat = con->msgr->required_features; | 1227 | u64 req_feat = con->msgr->required_features; |
1218 | u64 server_feat = le64_to_cpu(con->in_reply.features); | 1228 | u64 server_feat = le64_to_cpu(con->in_reply.features); |
1229 | int ret; | ||
1219 | 1230 | ||
1220 | dout("process_connect on %p tag %d\n", con, (int)con->in_tag); | 1231 | dout("process_connect on %p tag %d\n", con, (int)con->in_tag); |
1221 | 1232 | ||
@@ -1250,7 +1261,9 @@ static int process_connect(struct ceph_connection *con) | |||
1250 | return -1; | 1261 | return -1; |
1251 | } | 1262 | } |
1252 | con->auth_retry = 1; | 1263 | con->auth_retry = 1; |
1253 | prepare_write_connect(con->msgr, con, 0); | 1264 | ret = prepare_write_connect(con->msgr, con, 0); |
1265 | if (ret < 0) | ||
1266 | return ret; | ||
1254 | prepare_read_connect(con); | 1267 | prepare_read_connect(con); |
1255 | break; | 1268 | break; |
1256 | 1269 | ||
@@ -1277,6 +1290,9 @@ static int process_connect(struct ceph_connection *con) | |||
1277 | if (con->ops->peer_reset) | 1290 | if (con->ops->peer_reset) |
1278 | con->ops->peer_reset(con); | 1291 | con->ops->peer_reset(con); |
1279 | mutex_lock(&con->mutex); | 1292 | mutex_lock(&con->mutex); |
1293 | if (test_bit(CLOSED, &con->state) || | ||
1294 | test_bit(OPENING, &con->state)) | ||
1295 | return -EAGAIN; | ||
1280 | break; | 1296 | break; |
1281 | 1297 | ||
1282 | case CEPH_MSGR_TAG_RETRY_SESSION: | 1298 | case CEPH_MSGR_TAG_RETRY_SESSION: |
@@ -1341,7 +1357,9 @@ static int process_connect(struct ceph_connection *con) | |||
1341 | * to WAIT. This shouldn't happen if we are the | 1357 | * to WAIT. This shouldn't happen if we are the |
1342 | * client. | 1358 | * client. |
1343 | */ | 1359 | */ |
1344 | pr_err("process_connect peer connecting WAIT\n"); | 1360 | pr_err("process_connect got WAIT as client\n"); |
1361 | con->error_msg = "protocol error, got WAIT as client"; | ||
1362 | return -1; | ||
1345 | 1363 | ||
1346 | default: | 1364 | default: |
1347 | pr_err("connect protocol error, will retry\n"); | 1365 | pr_err("connect protocol error, will retry\n"); |
@@ -1810,6 +1828,17 @@ static int try_read(struct ceph_connection *con) | |||
1810 | more: | 1828 | more: |
1811 | dout("try_read tag %d in_base_pos %d\n", (int)con->in_tag, | 1829 | dout("try_read tag %d in_base_pos %d\n", (int)con->in_tag, |
1812 | con->in_base_pos); | 1830 | con->in_base_pos); |
1831 | |||
1832 | /* | ||
1833 | * process_connect and process_message drop and re-take | ||
1834 | * con->mutex. make sure we handle a racing close or reopen. | ||
1835 | */ | ||
1836 | if (test_bit(CLOSED, &con->state) || | ||
1837 | test_bit(OPENING, &con->state)) { | ||
1838 | ret = -EAGAIN; | ||
1839 | goto out; | ||
1840 | } | ||
1841 | |||
1813 | if (test_bit(CONNECTING, &con->state)) { | 1842 | if (test_bit(CONNECTING, &con->state)) { |
1814 | if (!test_bit(NEGOTIATING, &con->state)) { | 1843 | if (!test_bit(NEGOTIATING, &con->state)) { |
1815 | dout("try_read connecting\n"); | 1844 | dout("try_read connecting\n"); |
@@ -1938,8 +1967,10 @@ static void con_work(struct work_struct *work) | |||
1938 | { | 1967 | { |
1939 | struct ceph_connection *con = container_of(work, struct ceph_connection, | 1968 | struct ceph_connection *con = container_of(work, struct ceph_connection, |
1940 | work.work); | 1969 | work.work); |
1970 | int ret; | ||
1941 | 1971 | ||
1942 | mutex_lock(&con->mutex); | 1972 | mutex_lock(&con->mutex); |
1973 | restart: | ||
1943 | if (test_and_clear_bit(BACKOFF, &con->state)) { | 1974 | if (test_and_clear_bit(BACKOFF, &con->state)) { |
1944 | dout("con_work %p backing off\n", con); | 1975 | dout("con_work %p backing off\n", con); |
1945 | if (queue_delayed_work(ceph_msgr_wq, &con->work, | 1976 | if (queue_delayed_work(ceph_msgr_wq, &con->work, |
@@ -1969,18 +2000,31 @@ static void con_work(struct work_struct *work) | |||
1969 | con_close_socket(con); | 2000 | con_close_socket(con); |
1970 | } | 2001 | } |
1971 | 2002 | ||
1972 | if (test_and_clear_bit(SOCK_CLOSED, &con->state) || | 2003 | if (test_and_clear_bit(SOCK_CLOSED, &con->state)) |
1973 | try_read(con) < 0 || | 2004 | goto fault; |
1974 | try_write(con) < 0) { | 2005 | |
1975 | mutex_unlock(&con->mutex); | 2006 | ret = try_read(con); |
1976 | ceph_fault(con); /* error/fault path */ | 2007 | if (ret == -EAGAIN) |
1977 | goto done_unlocked; | 2008 | goto restart; |
1978 | } | 2009 | if (ret < 0) |
2010 | goto fault; | ||
2011 | |||
2012 | ret = try_write(con); | ||
2013 | if (ret == -EAGAIN) | ||
2014 | goto restart; | ||
2015 | if (ret < 0) | ||
2016 | goto fault; | ||
1979 | 2017 | ||
1980 | done: | 2018 | done: |
1981 | mutex_unlock(&con->mutex); | 2019 | mutex_unlock(&con->mutex); |
1982 | done_unlocked: | 2020 | done_unlocked: |
1983 | con->ops->put(con); | 2021 | con->ops->put(con); |
2022 | return; | ||
2023 | |||
2024 | fault: | ||
2025 | mutex_unlock(&con->mutex); | ||
2026 | ceph_fault(con); /* error/fault path */ | ||
2027 | goto done_unlocked; | ||
1984 | } | 2028 | } |
1985 | 2029 | ||
1986 | 2030 | ||
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 6b5dda1cb5df..6ea2b892f44b 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -124,7 +124,7 @@ static void calc_layout(struct ceph_osd_client *osdc, | |||
124 | ceph_calc_raw_layout(osdc, layout, vino.snap, off, | 124 | ceph_calc_raw_layout(osdc, layout, vino.snap, off, |
125 | plen, &bno, req, op); | 125 | plen, &bno, req, op); |
126 | 126 | ||
127 | sprintf(req->r_oid, "%llx.%08llx", vino.ino, bno); | 127 | snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, bno); |
128 | req->r_oid_len = strlen(req->r_oid); | 128 | req->r_oid_len = strlen(req->r_oid); |
129 | } | 129 | } |
130 | 130 | ||
@@ -1421,6 +1421,15 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) | |||
1421 | done: | 1421 | done: |
1422 | downgrade_write(&osdc->map_sem); | 1422 | downgrade_write(&osdc->map_sem); |
1423 | ceph_monc_got_osdmap(&osdc->client->monc, osdc->osdmap->epoch); | 1423 | ceph_monc_got_osdmap(&osdc->client->monc, osdc->osdmap->epoch); |
1424 | |||
1425 | /* | ||
1426 | * subscribe to subsequent osdmap updates if full to ensure | ||
1427 | * we find out when we are no longer full and stop returning | ||
1428 | * ENOSPC. | ||
1429 | */ | ||
1430 | if (ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL)) | ||
1431 | ceph_monc_request_next_osdmap(&osdc->client->monc); | ||
1432 | |||
1424 | send_queued(osdc); | 1433 | send_queued(osdc); |
1425 | up_read(&osdc->map_sem); | 1434 | up_read(&osdc->map_sem); |
1426 | wake_up_all(&osdc->client->auth_wq); | 1435 | wake_up_all(&osdc->client->auth_wq); |
@@ -1677,8 +1686,14 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, | |||
1677 | */ | 1686 | */ |
1678 | if (req->r_sent == 0) { | 1687 | if (req->r_sent == 0) { |
1679 | rc = __map_request(osdc, req); | 1688 | rc = __map_request(osdc, req); |
1680 | if (rc < 0) | 1689 | if (rc < 0) { |
1690 | if (nofail) { | ||
1691 | dout("osdc_start_request failed map, " | ||
1692 | " will retry %lld\n", req->r_tid); | ||
1693 | rc = 0; | ||
1694 | } | ||
1681 | goto out_unlock; | 1695 | goto out_unlock; |
1696 | } | ||
1682 | if (req->r_osd == NULL) { | 1697 | if (req->r_osd == NULL) { |
1683 | dout("send_request %p no up osds in pg\n", req); | 1698 | dout("send_request %p no up osds in pg\n", req); |
1684 | ceph_monc_request_next_osdmap(&osdc->client->monc); | 1699 | ceph_monc_request_next_osdmap(&osdc->client->monc); |
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 71603ac3dff5..e97c3588c3ec 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -765,7 +765,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
765 | } | 765 | } |
766 | 766 | ||
767 | map->epoch++; | 767 | map->epoch++; |
768 | map->modified = map->modified; | 768 | map->modified = modified; |
769 | if (newcrush) { | 769 | if (newcrush) { |
770 | if (map->crush) | 770 | if (map->crush) |
771 | crush_destroy(map->crush); | 771 | crush_destroy(map->crush); |
@@ -830,15 +830,20 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
830 | map->osd_addr[osd] = addr; | 830 | map->osd_addr[osd] = addr; |
831 | } | 831 | } |
832 | 832 | ||
833 | /* new_down */ | 833 | /* new_state */ |
834 | ceph_decode_32_safe(p, end, len, bad); | 834 | ceph_decode_32_safe(p, end, len, bad); |
835 | while (len--) { | 835 | while (len--) { |
836 | u32 osd; | 836 | u32 osd; |
837 | u8 xorstate; | ||
837 | ceph_decode_32_safe(p, end, osd, bad); | 838 | ceph_decode_32_safe(p, end, osd, bad); |
839 | xorstate = **(u8 **)p; | ||
838 | (*p)++; /* clean flag */ | 840 | (*p)++; /* clean flag */ |
839 | pr_info("osd%d down\n", osd); | 841 | if (xorstate == 0) |
842 | xorstate = CEPH_OSD_UP; | ||
843 | if (xorstate & CEPH_OSD_UP) | ||
844 | pr_info("osd%d down\n", osd); | ||
840 | if (osd < map->max_osd) | 845 | if (osd < map->max_osd) |
841 | map->osd_state[osd] &= ~CEPH_OSD_UP; | 846 | map->osd_state[osd] ^= xorstate; |
842 | } | 847 | } |
843 | 848 | ||
844 | /* new_weight */ | 849 | /* new_weight */ |
diff --git a/scripts/checkversion.pl b/scripts/checkversion.pl index b444e89a0095..5e490a8ceca5 100755 --- a/scripts/checkversion.pl +++ b/scripts/checkversion.pl | |||
@@ -12,6 +12,7 @@ $| = 1; | |||
12 | my $debugging; | 12 | my $debugging; |
13 | 13 | ||
14 | foreach my $file (@ARGV) { | 14 | foreach my $file (@ARGV) { |
15 | next if $file =~ "include/linux/version\.h"; | ||
15 | # Open this file. | 16 | # Open this file. |
16 | open( my $f, '<', $file ) | 17 | open( my $f, '<', $file ) |
17 | or die "Can't open $file: $!\n"; | 18 | or die "Can't open $file: $!\n"; |
diff --git a/scripts/export_report.pl b/scripts/export_report.pl index 04dce7c15f83..8f79b701de87 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl | |||
@@ -25,11 +25,12 @@ sub alphabetically { | |||
25 | sub print_depends_on { | 25 | sub print_depends_on { |
26 | my ($href) = @_; | 26 | my ($href) = @_; |
27 | print "\n"; | 27 | print "\n"; |
28 | while (my ($mod, $list) = each %$href) { | 28 | for my $mod (sort keys %$href) { |
29 | my $list = $href->{$mod}; | ||
29 | print "\t$mod:\n"; | 30 | print "\t$mod:\n"; |
30 | foreach my $sym (sort numerically @{$list}) { | 31 | foreach my $sym (sort numerically @{$list}) { |
31 | my ($symbol, $no) = split /\s+/, $sym; | 32 | my ($symbol, $no) = split /\s+/, $sym; |
32 | printf("\t\t%-25s\t%-25d\n", $symbol, $no); | 33 | printf("\t\t%-25s\n", $symbol); |
33 | } | 34 | } |
34 | print "\n"; | 35 | print "\n"; |
35 | } | 36 | } |
@@ -49,8 +50,14 @@ sub usage { | |||
49 | } | 50 | } |
50 | 51 | ||
51 | sub collectcfiles { | 52 | sub collectcfiles { |
52 | my @file | 53 | my @file; |
53 | = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`; | 54 | while (<.tmp_versions/*.mod>) { |
55 | open my $fh, '<', $_ or die "cannot open $_: $!\n"; | ||
56 | push (@file, | ||
57 | grep s/\.ko/.mod.c/, # change the suffix | ||
58 | grep m/.+\.ko/, # find the .ko path | ||
59 | <$fh>); # lines in opened file | ||
60 | } | ||
54 | chomp @file; | 61 | chomp @file; |
55 | return @file; | 62 | return @file; |
56 | } | 63 | } |
@@ -95,6 +102,8 @@ close($module_symvers); | |||
95 | # | 102 | # |
96 | # collect the usage count of each symbol. | 103 | # collect the usage count of each symbol. |
97 | # | 104 | # |
105 | my $modversion_warnings = 0; | ||
106 | |||
98 | foreach my $thismod (@allcfiles) { | 107 | foreach my $thismod (@allcfiles) { |
99 | my $module; | 108 | my $module; |
100 | 109 | ||
@@ -125,7 +134,8 @@ foreach my $thismod (@allcfiles) { | |||
125 | } | 134 | } |
126 | } | 135 | } |
127 | if ($state != 2) { | 136 | if ($state != 2) { |
128 | print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n"; | 137 | warn "WARNING:$thismod is not built with CONFIG_MODVERSIONS enabled\n"; |
138 | $modversion_warnings++; | ||
129 | } | 139 | } |
130 | close($module); | 140 | close($module); |
131 | } | 141 | } |
@@ -159,8 +169,12 @@ printf("SECTION 2:\n\tThis section reports export-symbol-usage of in-kernel | |||
159 | modules. Each module lists the modules, and the symbols from that module that | 169 | modules. Each module lists the modules, and the symbols from that module that |
160 | it uses. Each listed symbol reports the number of modules using it\n"); | 170 | it uses. Each listed symbol reports the number of modules using it\n"); |
161 | 171 | ||
172 | print "\nNOTE: Got $modversion_warnings CONFIG_MODVERSIONS warnings\n\n" | ||
173 | if $modversion_warnings; | ||
174 | |||
162 | print "~"x80 , "\n"; | 175 | print "~"x80 , "\n"; |
163 | while (my ($thismod, $list) = each %MODULE) { | 176 | for my $thismod (sort keys %MODULE) { |
177 | my $list = $MODULE{$thismod}; | ||
164 | my %depends; | 178 | my %depends; |
165 | $thismod =~ s/\.mod\.c/.ko/; | 179 | $thismod =~ s/\.mod\.c/.ko/; |
166 | print "\t\t\t$thismod\n"; | 180 | print "\t\t\t$thismod\n"; |
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index a834b935f536..006960ebbce9 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
@@ -26,9 +26,9 @@ RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ | |||
26 | else echo rpm; fi) | 26 | else echo rpm; fi) |
27 | 27 | ||
28 | # Remove hyphens since they have special meaning in RPM filenames | 28 | # Remove hyphens since they have special meaning in RPM filenames |
29 | KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE)) | 29 | KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) |
30 | MKSPEC := $(srctree)/scripts/package/mkspec | 30 | MKSPEC := $(srctree)/scripts/package/mkspec |
31 | PREV := set -e; cd ..; | 31 | PREV := set -e; cd -P ..; |
32 | 32 | ||
33 | # rpm-pkg | 33 | # rpm-pkg |
34 | # --------------------------------------------------------------------------- | 34 | # --------------------------------------------------------------------------- |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index e1c1d5b8ca70..4bf17ddf7c7f 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -22,7 +22,7 @@ if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then | |||
22 | fi | 22 | fi |
23 | 23 | ||
24 | PROVIDES="$PROVIDES kernel-$KERNELRELEASE" | 24 | PROVIDES="$PROVIDES kernel-$KERNELRELEASE" |
25 | __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-//g"` | 25 | __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"` |
26 | 26 | ||
27 | echo "Name: kernel" | 27 | echo "Name: kernel" |
28 | echo "Summary: The Linux Kernel" | 28 | echo "Summary: The Linux Kernel" |
@@ -47,6 +47,18 @@ echo "" | |||
47 | echo "%description" | 47 | echo "%description" |
48 | echo "The Linux Kernel, the operating system core itself" | 48 | echo "The Linux Kernel, the operating system core itself" |
49 | echo "" | 49 | echo "" |
50 | echo "%package headers" | ||
51 | echo "Summary: Header files for the Linux kernel for use by glibc" | ||
52 | echo "Group: Development/System" | ||
53 | echo "Obsoletes: kernel-headers" | ||
54 | echo "Provides: kernel-headers = %{version}" | ||
55 | echo "%description headers" | ||
56 | echo "Kernel-headers includes the C header files that specify the interface" | ||
57 | echo "between the Linux kernel and userspace libraries and programs. The" | ||
58 | echo "header files define structures and constants that are needed for" | ||
59 | echo "building most standard programs and are also needed for rebuilding the" | ||
60 | echo "glibc package." | ||
61 | echo "" | ||
50 | 62 | ||
51 | if ! $PREBUILT; then | 63 | if ! $PREBUILT; then |
52 | echo "%prep" | 64 | echo "%prep" |
@@ -83,6 +95,7 @@ echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | |||
83 | echo "%endif" | 95 | echo "%endif" |
84 | echo "%endif" | 96 | echo "%endif" |
85 | 97 | ||
98 | echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install' | ||
86 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | 99 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" |
87 | 100 | ||
88 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" | 101 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" |
@@ -105,3 +118,7 @@ echo "/lib/modules/$KERNELRELEASE" | |||
105 | echo "/lib/firmware" | 118 | echo "/lib/firmware" |
106 | echo "/boot/*" | 119 | echo "/boot/*" |
107 | echo "" | 120 | echo "" |
121 | echo "%files headers" | ||
122 | echo '%defattr (-, root, root)' | ||
123 | echo "/usr/include" | ||
124 | echo "" | ||
diff --git a/scripts/patch-kernel b/scripts/patch-kernel index 46a59cae3a0a..20fb25c23382 100755 --- a/scripts/patch-kernel +++ b/scripts/patch-kernel | |||
@@ -250,7 +250,7 @@ while : # incrementing SUBLEVEL (s in v.p.s) | |||
250 | do | 250 | do |
251 | CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" | 251 | CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" |
252 | EXTRAVER= | 252 | EXTRAVER= |
253 | if [ $STOPFULLVERSION = $CURRENTFULLVERSION ]; then | 253 | if [ x$STOPFULLVERSION = x$CURRENTFULLVERSION ]; then |
254 | echo "Stopping at $CURRENTFULLVERSION base as requested." | 254 | echo "Stopping at $CURRENTFULLVERSION base as requested." |
255 | break | 255 | break |
256 | fi | 256 | fi |