diff options
278 files changed, 6591 insertions, 2968 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index 6e9c4050a41b..8d556707bb68 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -227,6 +227,8 @@ kref.txt | |||
227 | - docs on adding reference counters (krefs) to kernel objects. | 227 | - docs on adding reference counters (krefs) to kernel objects. |
228 | laptop-mode.txt | 228 | laptop-mode.txt |
229 | - how to conserve battery power using laptop-mode. | 229 | - how to conserve battery power using laptop-mode. |
230 | laptops/ | ||
231 | - directory with laptop related info and laptop driver documentation. | ||
230 | ldm.txt | 232 | ldm.txt |
231 | - a brief description of LDM (Windows Dynamic Disks). | 233 | - a brief description of LDM (Windows Dynamic Disks). |
232 | leds-class.txt | 234 | leds-class.txt |
@@ -351,10 +353,6 @@ sh/ | |||
351 | - directory with info on porting Linux to a new architecture. | 353 | - directory with info on porting Linux to a new architecture. |
352 | smart-config.txt | 354 | smart-config.txt |
353 | - description of the Smart Config makefile feature. | 355 | - description of the Smart Config makefile feature. |
354 | sony-laptop.txt | ||
355 | - Sony Notebook Control Driver (SNC) Readme. | ||
356 | sonypi.txt | ||
357 | - info on Linux Sony Programmable I/O Device support. | ||
358 | sound/ | 356 | sound/ |
359 | - directory with info on sound card support. | 357 | - directory with info on sound card support. |
360 | sparc/ | 358 | sparc/ |
@@ -385,8 +383,6 @@ sysrq.txt | |||
385 | - info on the magic SysRq key. | 383 | - info on the magic SysRq key. |
386 | telephony/ | 384 | telephony/ |
387 | - directory with info on telephony (e.g. voice over IP) support. | 385 | - directory with info on telephony (e.g. voice over IP) support. |
388 | thinkpad-acpi.txt | ||
389 | - information on the (IBM and Lenovo) ThinkPad ACPI Extras driver. | ||
390 | time_interpolators.txt | 386 | time_interpolators.txt |
391 | - info on time interpolators. | 387 | - info on time interpolators. |
392 | tipar.txt | 388 | tipar.txt |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index ce9503c892b5..4d3aa519eadf 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -111,15 +111,6 @@ Who: Christoph Hellwig <hch@lst.de> | |||
111 | 111 | ||
112 | --------------------------- | 112 | --------------------------- |
113 | 113 | ||
114 | What: CONFIG_FORCED_INLINING | ||
115 | When: June 2006 | ||
116 | Why: Config option is there to see if gcc is good enough. (in january | ||
117 | 2006). If it is, the behavior should just be the default. If it's not, | ||
118 | the option should just go away entirely. | ||
119 | Who: Arjan van de Ven | ||
120 | |||
121 | --------------------------- | ||
122 | |||
123 | What: eepro100 network driver | 114 | What: eepro100 network driver |
124 | When: January 2007 | 115 | When: January 2007 |
125 | Why: replaced by the e100 driver | 116 | Why: replaced by the e100 driver |
@@ -304,3 +295,14 @@ Why: The support code for the old firmware hurts code readability/maintainabilit | |||
304 | and slightly hurts runtime performance. Bugfixes for the old firmware | 295 | and slightly hurts runtime performance. Bugfixes for the old firmware |
305 | are not provided by Broadcom anymore. | 296 | are not provided by Broadcom anymore. |
306 | Who: Michael Buesch <mb@bu3sch.de> | 297 | Who: Michael Buesch <mb@bu3sch.de> |
298 | |||
299 | --------------------------- | ||
300 | |||
301 | What: Solaris/SunOS syscall and binary support on Sparc | ||
302 | When: 2.6.26 | ||
303 | Why: Largely unmaintained and almost entirely unused. File system | ||
304 | layering used to divert library and dynamic linker searches to | ||
305 | /usr/gnemul is extremely buggy and unfixable. Making it work | ||
306 | is largely pointless as without a lot of work only the most | ||
307 | trivial of Solaris binaries can work with the emulation code. | ||
308 | Who: David S. Miller <davem@davemloft.net> | ||
diff --git a/Documentation/laptops/00-INDEX b/Documentation/laptops/00-INDEX new file mode 100644 index 000000000000..729c2c062e10 --- /dev/null +++ b/Documentation/laptops/00-INDEX | |||
@@ -0,0 +1,10 @@ | |||
1 | 00-INDEX | ||
2 | - This file | ||
3 | acer-wmi.txt | ||
4 | - information on the Acer Laptop WMI Extras driver. | ||
5 | sony-laptop.txt | ||
6 | - Sony Notebook Control Driver (SNC) Readme. | ||
7 | sonypi.txt | ||
8 | - info on Linux Sony Programmable I/O Device support. | ||
9 | thinkpad-acpi.txt | ||
10 | - information on the (IBM and Lenovo) ThinkPad ACPI Extras driver. | ||
diff --git a/Documentation/laptops/acer-wmi.txt b/Documentation/laptops/acer-wmi.txt new file mode 100644 index 000000000000..b06696329cff --- /dev/null +++ b/Documentation/laptops/acer-wmi.txt | |||
@@ -0,0 +1,202 @@ | |||
1 | Acer Laptop WMI Extras Driver | ||
2 | http://code.google.com/p/aceracpi | ||
3 | Version 0.1 | ||
4 | 9th February 2008 | ||
5 | |||
6 | Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk> | ||
7 | |||
8 | acer-wmi is a driver to allow you to control various parts of your Acer laptop | ||
9 | hardware under Linux which are exposed via ACPI-WMI. | ||
10 | |||
11 | This driver completely replaces the old out-of-tree acer_acpi, which I am | ||
12 | currently maintaining for bug fixes only on pre-2.6.25 kernels. All development | ||
13 | work is now focused solely on acer-wmi. | ||
14 | |||
15 | Disclaimer | ||
16 | ********** | ||
17 | |||
18 | Acer and Wistron have provided nothing towards the development acer_acpi or | ||
19 | acer-wmi. All information we have has been through the efforts of the developers | ||
20 | and the users to discover as much as possible about the hardware. | ||
21 | |||
22 | As such, I do warn that this could break your hardware - this is extremely | ||
23 | unlikely of course, but please bear this in mind. | ||
24 | |||
25 | Background | ||
26 | ********** | ||
27 | |||
28 | acer-wmi is derived from acer_acpi, originally developed by Mark | ||
29 | Smith in 2005, then taken over by Carlos Corbacho in 2007, in order to activate | ||
30 | the wireless LAN card under a 64-bit version of Linux, as acerhk[1] (the | ||
31 | previous solution to the problem) relied on making 32 bit BIOS calls which are | ||
32 | not possible in kernel space from a 64 bit OS. | ||
33 | |||
34 | [1] acerhk: http://www.cakey.de/acerhk/ | ||
35 | |||
36 | Supported Hardware | ||
37 | ****************** | ||
38 | |||
39 | Please see the website for the current list of known working hardare: | ||
40 | |||
41 | http://code.google.com/p/aceracpi/wiki/SupportedHardware | ||
42 | |||
43 | If your laptop is not listed, or listed as unknown, and works with acer-wmi, | ||
44 | please contact me with a copy of the DSDT. | ||
45 | |||
46 | If your Acer laptop doesn't work with acer-wmi, I would also like to see the | ||
47 | DSDT. | ||
48 | |||
49 | To send me the DSDT, as root/sudo: | ||
50 | |||
51 | cat /sys/firmware/acpi/DSDT > dsdt | ||
52 | |||
53 | And send me the resulting 'dsdt' file. | ||
54 | |||
55 | Usage | ||
56 | ***** | ||
57 | |||
58 | On Acer laptops, acer-wmi should already be autoloaded based on DMI matching. | ||
59 | For non-Acer laptops, until WMI based autoloading support is added, you will | ||
60 | need to manually load acer-wmi. | ||
61 | |||
62 | acer-wmi creates /sys/devices/platform/acer-wmi, and fills it with various | ||
63 | files whose usage is detailed below, which enables you to control some of the | ||
64 | following (varies between models): | ||
65 | |||
66 | * the wireless LAN card radio | ||
67 | * inbuilt Bluetooth adapter | ||
68 | * inbuilt 3G card | ||
69 | * mail LED of your laptop | ||
70 | * brightness of the LCD panel | ||
71 | |||
72 | Wireless | ||
73 | ******** | ||
74 | |||
75 | With regards to wireless, all acer-wmi does is enable the radio on the card. It | ||
76 | is not responsible for the wireless LED - once the radio is enabled, this is | ||
77 | down to the wireless driver for your card. So the behaviour of the wireless LED, | ||
78 | once you enable the radio, will depend on your hardware and driver combination. | ||
79 | |||
80 | e.g. With the BCM4318 on the Acer Aspire 5020 series: | ||
81 | |||
82 | ndiswrapper: Light blinks on when transmitting | ||
83 | bcm43xx/b43: Solid light, blinks off when transmitting | ||
84 | |||
85 | Wireless radio control is unconditionally enabled - all Acer laptops that support | ||
86 | acer-wmi come with built-in wireless. However, should you feel so inclined to | ||
87 | ever wish to remove the card, or swap it out at some point, please get in touch | ||
88 | with me, as we may well be able to gain some data on wireless card detection. | ||
89 | |||
90 | To read the status of the wireless radio (0=off, 1=on): | ||
91 | cat /sys/devices/platform/acer-wmi/wireless | ||
92 | |||
93 | To enable the wireless radio: | ||
94 | echo 1 > /sys/devices/platform/acer-wmi/wireless | ||
95 | |||
96 | To disable the wireless radio: | ||
97 | echo 0 > /sys/devices/platform/acer-wmi/wireless | ||
98 | |||
99 | To set the state of the wireless radio when loading acer-wmi, pass: | ||
100 | wireless=X (where X is 0 or 1) | ||
101 | |||
102 | Bluetooth | ||
103 | ********* | ||
104 | |||
105 | For bluetooth, this is an internal USB dongle, so once enabled, you will get | ||
106 | a USB device connection event, and a new USB device appears. When you disable | ||
107 | bluetooth, you get the reverse - a USB device disconnect event, followed by the | ||
108 | device disappearing again. | ||
109 | |||
110 | Bluetooth is autodetected by acer-wmi, so if you do not have a bluetooth module | ||
111 | installed in your laptop, this file won't exist (please be aware that it is | ||
112 | quite common for Acer not to fit bluetooth to their laptops - so just because | ||
113 | you have a bluetooth button on the laptop, doesn't mean that bluetooth is | ||
114 | installed). | ||
115 | |||
116 | For the adventurously minded - if you want to buy an internal bluetooth | ||
117 | module off the internet that is compatible with your laptop and fit it, then | ||
118 | it will work just fine with acer-wmi. | ||
119 | |||
120 | To read the status of the bluetooth module (0=off, 1=on): | ||
121 | cat /sys/devices/platform/acer-wmi/wireless | ||
122 | |||
123 | To enable the bluetooth module: | ||
124 | echo 1 > /sys/devices/platform/acer-wmi/bluetooth | ||
125 | |||
126 | To disable the bluetooth module: | ||
127 | echo 0 > /sys/devices/platform/acer-wmi/bluetooth | ||
128 | |||
129 | To set the state of the bluetooth module when loading acer-wmi, pass: | ||
130 | bluetooth=X (where X is 0 or 1) | ||
131 | |||
132 | 3G | ||
133 | ** | ||
134 | |||
135 | 3G is currently not autodetected, so the 'threeg' file is always created under | ||
136 | sysfs. So far, no-one in possession of an Acer laptop with 3G built-in appears to | ||
137 | have tried Linux, or reported back, so we don't have any information on this. | ||
138 | |||
139 | If you have an Acer laptop that does have a 3G card in, please contact me so we | ||
140 | can properly detect these, and find out a bit more about them. | ||
141 | |||
142 | To read the status of the 3G card (0=off, 1=on): | ||
143 | cat /sys/devices/platform/acer-wmi/threeg | ||
144 | |||
145 | To enable the 3G card: | ||
146 | echo 1 > /sys/devices/platform/acer-wmi/threeg | ||
147 | |||
148 | To disable the 3G card: | ||
149 | echo 0 > /sys/devices/platform/acer-wmi/threeg | ||
150 | |||
151 | To set the state of the 3G card when loading acer-wmi, pass: | ||
152 | threeg=X (where X is 0 or 1) | ||
153 | |||
154 | Mail LED | ||
155 | ******** | ||
156 | |||
157 | This can be found in most older Acer laptops supported by acer-wmi, and many | ||
158 | newer ones - it is built into the 'mail' button, and blinks when active. | ||
159 | |||
160 | On newer (WMID) laptops though, we have no way of detecting the mail LED. If | ||
161 | your laptop identifies itself in dmesg as a WMID model, then please try loading | ||
162 | acer_acpi with: | ||
163 | |||
164 | force_series=2490 | ||
165 | |||
166 | This will use a known alternative method of reading/ writing the mail LED. If | ||
167 | it works, please report back to me with the DMI data from your laptop so this | ||
168 | can be added to acer-wmi. | ||
169 | |||
170 | The LED is exposed through the LED subsystem, and can be found in: | ||
171 | |||
172 | /sys/devices/platform/acer-wmi/leds/acer-mail:green/ | ||
173 | |||
174 | The mail LED is autodetected, so if you don't have one, the LED device won't | ||
175 | be registered. | ||
176 | |||
177 | If you have a mail LED that is not green, please report this to me. | ||
178 | |||
179 | Backlight | ||
180 | ********* | ||
181 | |||
182 | The backlight brightness control is available on all acer-wmi supported | ||
183 | hardware. The maximum brightness level is usually 15, but on some newer laptops | ||
184 | it's 10 (this is again autodetected). | ||
185 | |||
186 | The backlight is exposed through the backlight subsystem, and can be found in: | ||
187 | |||
188 | /sys/devices/platform/acer-wmi/backlight/acer-wmi/ | ||
189 | |||
190 | Credits | ||
191 | ******* | ||
192 | |||
193 | Olaf Tauber, who did the real hard work when he developed acerhk | ||
194 | http://www.informatik.hu-berlin.de/~tauber/acerhk | ||
195 | All the authors of laptop ACPI modules in the kernel, whose work | ||
196 | was an inspiration in the early days of acer_acpi | ||
197 | Mathieu Segaud, who solved the problem with having to modprobe the driver | ||
198 | twice in acer_acpi 0.2. | ||
199 | Jim Ramsay, who added support for the WMID interface | ||
200 | Mark Smith, who started the original acer_acpi | ||
201 | |||
202 | And the many people who have used both acer_acpi and acer-wmi. | ||
diff --git a/Documentation/sony-laptop.txt b/Documentation/laptops/sony-laptop.txt index 7a5c1a81905c..8b2bc1572d98 100644 --- a/Documentation/sony-laptop.txt +++ b/Documentation/laptops/sony-laptop.txt | |||
@@ -114,4 +114,3 @@ Bugs/Limitations: | |||
114 | sonypi driver (through /dev/sonypi) does not try to use the | 114 | sonypi driver (through /dev/sonypi) does not try to use the |
115 | sony-laptop driver. In the future, spicctrl could try sonypi first, | 115 | sony-laptop driver. In the future, spicctrl could try sonypi first, |
116 | and if it isn't present, try sony-laptop instead. | 116 | and if it isn't present, try sony-laptop instead. |
117 | |||
diff --git a/Documentation/sonypi.txt b/Documentation/laptops/sonypi.txt index 4857acfc50f1..4857acfc50f1 100644 --- a/Documentation/sonypi.txt +++ b/Documentation/laptops/sonypi.txt | |||
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index 6c2477754a2a..6c2477754a2a 100644 --- a/Documentation/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt | |||
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index 8984a5396271..dc8801d4e944 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt | |||
@@ -41,6 +41,7 @@ show up in /proc/sys/kernel: | |||
41 | - pid_max | 41 | - pid_max |
42 | - powersave-nap [ PPC only ] | 42 | - powersave-nap [ PPC only ] |
43 | - printk | 43 | - printk |
44 | - randomize_va_space | ||
44 | - real-root-dev ==> Documentation/initrd.txt | 45 | - real-root-dev ==> Documentation/initrd.txt |
45 | - reboot-cmd [ SPARC only ] | 46 | - reboot-cmd [ SPARC only ] |
46 | - rtsig-max | 47 | - rtsig-max |
@@ -280,6 +281,34 @@ send before ratelimiting kicks in. | |||
280 | 281 | ||
281 | ============================================================== | 282 | ============================================================== |
282 | 283 | ||
284 | randomize-va-space: | ||
285 | |||
286 | This option can be used to select the type of process address | ||
287 | space randomization that is used in the system, for architectures | ||
288 | that support this feature. | ||
289 | |||
290 | 0 - Turn the process address space randomization off by default. | ||
291 | |||
292 | 1 - Make the addresses of mmap base, stack and VDSO page randomized. | ||
293 | This, among other things, implies that shared libraries will be | ||
294 | loaded to random addresses. Also for PIE-linked binaries, the location | ||
295 | of code start is randomized. | ||
296 | |||
297 | With heap randomization, the situation is a little bit more | ||
298 | complicated. | ||
299 | There a few legacy applications out there (such as some ancient | ||
300 | versions of libc.so.5 from 1996) that assume that brk area starts | ||
301 | just after the end of the code+bss. These applications break when | ||
302 | start of the brk area is randomized. There are however no known | ||
303 | non-legacy applications that would be broken this way, so for most | ||
304 | systems it is safe to choose full randomization. However there is | ||
305 | a CONFIG_COMPAT_BRK option for systems with ancient and/or broken | ||
306 | binaries, that makes heap non-randomized, but keeps all other | ||
307 | parts of process address space randomized if randomize_va_space | ||
308 | sysctl is turned on. | ||
309 | |||
310 | ============================================================== | ||
311 | |||
283 | reboot-cmd: (Sparc only) | 312 | reboot-cmd: (Sparc only) |
284 | 313 | ||
285 | ??? This seems to be a way to give an argument to the Sparc | 314 | ??? This seems to be a way to give an argument to the Sparc |
diff --git a/MAINTAINERS b/MAINTAINERS index 0d6f5119a6da..c40f0ae96552 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2682,7 +2682,6 @@ MOTOROLA IMX MMC/SD HOST CONTROLLER INTERFACE DRIVER | |||
2682 | P: Pavel Pisa | 2682 | P: Pavel Pisa |
2683 | M: ppisa@pikron.com | 2683 | M: ppisa@pikron.com |
2684 | L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) | 2684 | L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) |
2685 | W: http://mmc.drzeus.cx/wiki/Controllers/Freescale/SDHC | ||
2686 | S: Maintained | 2685 | S: Maintained |
2687 | 2686 | ||
2688 | MOUSE AND MISC DEVICES [GENERAL] | 2687 | MOUSE AND MISC DEVICES [GENERAL] |
@@ -3627,6 +3626,13 @@ L: linux-acpi@vger.kernel.org | |||
3627 | W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers | 3626 | W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers |
3628 | S: Maintained | 3627 | S: Maintained |
3629 | 3628 | ||
3629 | SONY MEMORYSTICK CARD SUPPORT | ||
3630 | P: Alex Dubov | ||
3631 | M: oakad@yahoo.com | ||
3632 | L: linux-kernel@vger.kernel.org | ||
3633 | W: http://tifmxx.berlios.de/ | ||
3634 | S: Maintained | ||
3635 | |||
3630 | SOUND | 3636 | SOUND |
3631 | P: Jaroslav Kysela | 3637 | P: Jaroslav Kysela |
3632 | M: perex@perex.cz | 3638 | M: perex@perex.cz |
@@ -3709,7 +3715,6 @@ SECURE DIGITAL HOST CONTROLLER INTERFACE DRIVER | |||
3709 | P: Pierre Ossman | 3715 | P: Pierre Ossman |
3710 | M: drzeus-sdhci@drzeus.cx | 3716 | M: drzeus-sdhci@drzeus.cx |
3711 | L: sdhci-devel@list.drzeus.cx | 3717 | L: sdhci-devel@list.drzeus.cx |
3712 | W: http://mmc.drzeus.cx/wiki/Linux/Drivers/sdhci | ||
3713 | S: Maintained | 3718 | S: Maintained |
3714 | 3719 | ||
3715 | SKGE, SKY2 10/100/1000 GIGABIT ETHERNET DRIVERS | 3720 | SKGE, SKY2 10/100/1000 GIGABIT ETHERNET DRIVERS |
@@ -4279,7 +4284,6 @@ W83L51xD SD/MMC CARD INTERFACE DRIVER | |||
4279 | P: Pierre Ossman | 4284 | P: Pierre Ossman |
4280 | M: drzeus-wbsd@drzeus.cx | 4285 | M: drzeus-wbsd@drzeus.cx |
4281 | L: linux-kernel@vger.kernel.org | 4286 | L: linux-kernel@vger.kernel.org |
4282 | W: http://projects.drzeus.cx/wbsd | ||
4283 | S: Maintained | 4287 | S: Maintained |
4284 | 4288 | ||
4285 | WATCHDOG DEVICE DRIVERS | 4289 | WATCHDOG DEVICE DRIVERS |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 5b7dcd5a0e75..002703b8c0b0 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config ALPHA | 5 | config ALPHA |
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | select HAVE_IDE | ||
8 | select HAVE_OPROFILE | 9 | select HAVE_OPROFILE |
9 | help | 10 | help |
10 | The Alpha is a 64-bit general-purpose processor designed and | 11 | The Alpha is a 64-bit general-purpose processor designed and |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 4127af93c5f3..9619c43783ff 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -222,6 +222,7 @@ config ARCH_CLPS7500 | |||
222 | select TIMER_ACORN | 222 | select TIMER_ACORN |
223 | select ISA | 223 | select ISA |
224 | select NO_IOPORT | 224 | select NO_IOPORT |
225 | select HAVE_IDE | ||
225 | help | 226 | help |
226 | Support for the Cirrus Logic PS7500FE system-on-a-chip. | 227 | Support for the Cirrus Logic PS7500FE system-on-a-chip. |
227 | 228 | ||
@@ -234,6 +235,7 @@ config ARCH_CO285 | |||
234 | bool "Co-EBSA285" | 235 | bool "Co-EBSA285" |
235 | select FOOTBRIDGE | 236 | select FOOTBRIDGE |
236 | select FOOTBRIDGE_ADDIN | 237 | select FOOTBRIDGE_ADDIN |
238 | select HAVE_IDE | ||
237 | help | 239 | help |
238 | Support for Intel's EBSA285 companion chip. | 240 | Support for Intel's EBSA285 companion chip. |
239 | 241 | ||
@@ -258,6 +260,7 @@ config ARCH_EP93XX | |||
258 | config ARCH_FOOTBRIDGE | 260 | config ARCH_FOOTBRIDGE |
259 | bool "FootBridge" | 261 | bool "FootBridge" |
260 | select FOOTBRIDGE | 262 | select FOOTBRIDGE |
263 | select HAVE_IDE | ||
261 | help | 264 | help |
262 | Support for systems based on the DC21285 companion chip | 265 | Support for systems based on the DC21285 companion chip |
263 | ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. | 266 | ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. |
@@ -296,6 +299,7 @@ config ARCH_IOP32X | |||
296 | depends on MMU | 299 | depends on MMU |
297 | select PLAT_IOP | 300 | select PLAT_IOP |
298 | select PCI | 301 | select PCI |
302 | select HAVE_IDE | ||
299 | help | 303 | help |
300 | Support for Intel's 80219 and IOP32X (XScale) family of | 304 | Support for Intel's 80219 and IOP32X (XScale) family of |
301 | processors. | 305 | processors. |
@@ -305,12 +309,14 @@ config ARCH_IOP33X | |||
305 | depends on MMU | 309 | depends on MMU |
306 | select PLAT_IOP | 310 | select PLAT_IOP |
307 | select PCI | 311 | select PCI |
312 | select HAVE_IDE | ||
308 | help | 313 | help |
309 | Support for Intel's IOP33X (XScale) family of processors. | 314 | Support for Intel's IOP33X (XScale) family of processors. |
310 | 315 | ||
311 | config ARCH_IXP23XX | 316 | config ARCH_IXP23XX |
312 | bool "IXP23XX-based" | 317 | bool "IXP23XX-based" |
313 | depends on MMU | 318 | depends on MMU |
319 | select HAVE_IDE | ||
314 | select PCI | 320 | select PCI |
315 | help | 321 | help |
316 | Support for Intel's IXP23xx (XScale) family of processors. | 322 | Support for Intel's IXP23xx (XScale) family of processors. |
@@ -328,12 +334,14 @@ config ARCH_IXP4XX | |||
328 | select GENERIC_GPIO | 334 | select GENERIC_GPIO |
329 | select GENERIC_TIME | 335 | select GENERIC_TIME |
330 | select GENERIC_CLOCKEVENTS | 336 | select GENERIC_CLOCKEVENTS |
337 | select HAVE_IDE | ||
331 | help | 338 | help |
332 | Support for Intel's IXP4XX (XScale) family of processors. | 339 | Support for Intel's IXP4XX (XScale) family of processors. |
333 | 340 | ||
334 | config ARCH_L7200 | 341 | config ARCH_L7200 |
335 | bool "LinkUp-L7200" | 342 | bool "LinkUp-L7200" |
336 | select FIQ | 343 | select FIQ |
344 | select HAVE_IDE | ||
337 | help | 345 | help |
338 | Say Y here if you intend to run this kernel on a LinkUp Systems | 346 | Say Y here if you intend to run this kernel on a LinkUp Systems |
339 | L7200 Software Development Board which uses an ARM720T processor. | 347 | L7200 Software Development Board which uses an ARM720T processor. |
@@ -388,6 +396,7 @@ config ARCH_PXA | |||
388 | depends on MMU | 396 | depends on MMU |
389 | select ARCH_MTD_XIP | 397 | select ARCH_MTD_XIP |
390 | select GENERIC_GPIO | 398 | select GENERIC_GPIO |
399 | select HAVE_IDE | ||
391 | select HAVE_GPIO_LIB | 400 | select HAVE_GPIO_LIB |
392 | select GENERIC_TIME | 401 | select GENERIC_TIME |
393 | select GENERIC_CLOCKEVENTS | 402 | select GENERIC_CLOCKEVENTS |
@@ -403,6 +412,7 @@ config ARCH_RPC | |||
403 | select ARCH_MAY_HAVE_PC_FDC | 412 | select ARCH_MAY_HAVE_PC_FDC |
404 | select ISA_DMA_API | 413 | select ISA_DMA_API |
405 | select NO_IOPORT | 414 | select NO_IOPORT |
415 | select HAVE_IDE | ||
406 | help | 416 | help |
407 | On the Acorn Risc-PC, Linux can support the internal IDE disk and | 417 | On the Acorn Risc-PC, Linux can support the internal IDE disk and |
408 | CD-ROM interface, serial and parallel port, and the floppy drive. | 418 | CD-ROM interface, serial and parallel port, and the floppy drive. |
@@ -414,12 +424,14 @@ config ARCH_SA1100 | |||
414 | select ARCH_MTD_XIP | 424 | select ARCH_MTD_XIP |
415 | select GENERIC_GPIO | 425 | select GENERIC_GPIO |
416 | select GENERIC_TIME | 426 | select GENERIC_TIME |
427 | select HAVE_IDE | ||
417 | help | 428 | help |
418 | Support for StrongARM 11x0 based boards. | 429 | Support for StrongARM 11x0 based boards. |
419 | 430 | ||
420 | config ARCH_S3C2410 | 431 | config ARCH_S3C2410 |
421 | bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443" | 432 | bool "Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2443" |
422 | select GENERIC_GPIO | 433 | select GENERIC_GPIO |
434 | select HAVE_IDE | ||
423 | help | 435 | help |
424 | Samsung S3C2410X CPU based systems, such as the Simtec Electronics | 436 | Samsung S3C2410X CPU based systems, such as the Simtec Electronics |
425 | BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or | 437 | BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or |
@@ -427,6 +439,7 @@ config ARCH_S3C2410 | |||
427 | 439 | ||
428 | config ARCH_SHARK | 440 | config ARCH_SHARK |
429 | bool "Shark" | 441 | bool "Shark" |
442 | select HAVE_IDE | ||
430 | select ISA | 443 | select ISA |
431 | select ISA_DMA | 444 | select ISA_DMA |
432 | select PCI | 445 | select PCI |
@@ -436,6 +449,7 @@ config ARCH_SHARK | |||
436 | 449 | ||
437 | config ARCH_LH7A40X | 450 | config ARCH_LH7A40X |
438 | bool "Sharp LH7A40X" | 451 | bool "Sharp LH7A40X" |
452 | select HAVE_IDE | ||
439 | help | 453 | help |
440 | Say Y here for systems based on one of the Sharp LH7A40X | 454 | Say Y here for systems based on one of the Sharp LH7A40X |
441 | System on a Chip processors. These CPUs include an ARM922T | 455 | System on a Chip processors. These CPUs include an ARM922T |
@@ -1093,12 +1107,7 @@ source "drivers/block/Kconfig" | |||
1093 | 1107 | ||
1094 | source "drivers/misc/Kconfig" | 1108 | source "drivers/misc/Kconfig" |
1095 | 1109 | ||
1096 | if PCMCIA || ARCH_CLPS7500 || ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX \ | ||
1097 | || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \ | ||
1098 | || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE \ | ||
1099 | || ARCH_IXP23XX | ||
1100 | source "drivers/ide/Kconfig" | 1110 | source "drivers/ide/Kconfig" |
1101 | endif | ||
1102 | 1111 | ||
1103 | source "drivers/scsi/Kconfig" | 1112 | source "drivers/scsi/Kconfig" |
1104 | 1113 | ||
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index 28e0caf4156c..c75d7089f982 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig | |||
@@ -10,6 +10,7 @@ config AVR32 | |||
10 | # With EMBEDDED=n, we get lots of stuff automatically selected | 10 | # With EMBEDDED=n, we get lots of stuff automatically selected |
11 | # that we usually don't need on AVR32. | 11 | # that we usually don't need on AVR32. |
12 | select EMBEDDED | 12 | select EMBEDDED |
13 | select HAVE_IDE | ||
13 | select HAVE_OPROFILE | 14 | select HAVE_OPROFILE |
14 | select HAVE_KPROBES | 15 | select HAVE_KPROBES |
15 | help | 16 | help |
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 368bc7fe167e..589c6aca4803 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -24,6 +24,7 @@ config RWSEM_XCHGADD_ALGORITHM | |||
24 | config BLACKFIN | 24 | config BLACKFIN |
25 | bool | 25 | bool |
26 | default y | 26 | default y |
27 | select HAVE_IDE | ||
27 | select HAVE_OPROFILE | 28 | select HAVE_OPROFILE |
28 | 29 | ||
29 | config ZONE_DMA | 30 | config ZONE_DMA |
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 8456bc8efb7c..9389d38f222f 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -54,6 +54,7 @@ config FORCE_MAX_ZONEORDER | |||
54 | config CRIS | 54 | config CRIS |
55 | bool | 55 | bool |
56 | default y | 56 | default y |
57 | select HAVE_IDE | ||
57 | 58 | ||
58 | config HZ | 59 | config HZ |
59 | int | 60 | int |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 9e561ede0925..a5aac1b07562 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config FRV | 5 | config FRV |
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | select HAVE_IDE | ||
8 | 9 | ||
9 | config ZONE_DMA | 10 | config ZONE_DMA |
10 | bool | 11 | bool |
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index f69e5ea38558..085dc6ec152b 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "uClinux/h8300 (w/o MMU) Kernel Configuration" | |||
8 | config H8300 | 8 | config H8300 |
9 | bool | 9 | bool |
10 | default y | 10 | default y |
11 | select HAVE_IDE | ||
11 | 12 | ||
12 | config MMU | 13 | config MMU |
13 | bool | 14 | bool |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index b0de1132dfc0..2d4fcd01bc91 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -15,6 +15,7 @@ config IA64 | |||
15 | select ACPI if (!IA64_HP_SIM) | 15 | select ACPI if (!IA64_HP_SIM) |
16 | select PM if (!IA64_HP_SIM) | 16 | select PM if (!IA64_HP_SIM) |
17 | select ARCH_SUPPORTS_MSI | 17 | select ARCH_SUPPORTS_MSI |
18 | select HAVE_IDE | ||
18 | select HAVE_OPROFILE | 19 | select HAVE_OPROFILE |
19 | select HAVE_KPROBES | 20 | select HAVE_KPROBES |
20 | default y | 21 | default y |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 488e48a5deea..8fd7e825192b 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -43,8 +43,7 @@ | |||
43 | #define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \ | 43 | #define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \ |
44 | (((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg)) | 44 | (((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg)) |
45 | 45 | ||
46 | static int | 46 | int raw_pci_read(unsigned int seg, unsigned int bus, unsigned int devfn, |
47 | pci_sal_read (unsigned int seg, unsigned int bus, unsigned int devfn, | ||
48 | int reg, int len, u32 *value) | 47 | int reg, int len, u32 *value) |
49 | { | 48 | { |
50 | u64 addr, data = 0; | 49 | u64 addr, data = 0; |
@@ -68,8 +67,7 @@ pci_sal_read (unsigned int seg, unsigned int bus, unsigned int devfn, | |||
68 | return 0; | 67 | return 0; |
69 | } | 68 | } |
70 | 69 | ||
71 | static int | 70 | int raw_pci_write(unsigned int seg, unsigned int bus, unsigned int devfn, |
72 | pci_sal_write (unsigned int seg, unsigned int bus, unsigned int devfn, | ||
73 | int reg, int len, u32 value) | 71 | int reg, int len, u32 value) |
74 | { | 72 | { |
75 | u64 addr; | 73 | u64 addr; |
@@ -91,24 +89,17 @@ pci_sal_write (unsigned int seg, unsigned int bus, unsigned int devfn, | |||
91 | return 0; | 89 | return 0; |
92 | } | 90 | } |
93 | 91 | ||
94 | static struct pci_raw_ops pci_sal_ops = { | 92 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, |
95 | .read = pci_sal_read, | 93 | int size, u32 *value) |
96 | .write = pci_sal_write | ||
97 | }; | ||
98 | |||
99 | struct pci_raw_ops *raw_pci_ops = &pci_sal_ops; | ||
100 | |||
101 | static int | ||
102 | pci_read (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | ||
103 | { | 94 | { |
104 | return raw_pci_ops->read(pci_domain_nr(bus), bus->number, | 95 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
105 | devfn, where, size, value); | 96 | devfn, where, size, value); |
106 | } | 97 | } |
107 | 98 | ||
108 | static int | 99 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, |
109 | pci_write (struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) | 100 | int size, u32 value) |
110 | { | 101 | { |
111 | return raw_pci_ops->write(pci_domain_nr(bus), bus->number, | 102 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
112 | devfn, where, size, value); | 103 | devfn, where, size, value); |
113 | } | 104 | } |
114 | 105 | ||
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c index e1a3e19d3d9c..999f14f986e2 100644 --- a/arch/ia64/sn/pci/tioce_provider.c +++ b/arch/ia64/sn/pci/tioce_provider.c | |||
@@ -752,13 +752,13 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
752 | * Determine the secondary bus number of the port2 logical PPB. | 752 | * Determine the secondary bus number of the port2 logical PPB. |
753 | * This is used to decide whether a given pci device resides on | 753 | * This is used to decide whether a given pci device resides on |
754 | * port1 or port2. Note: We don't have enough plumbing set up | 754 | * port1 or port2. Note: We don't have enough plumbing set up |
755 | * here to use pci_read_config_xxx() so use the raw_pci_ops vector. | 755 | * here to use pci_read_config_xxx() so use raw_pci_read(). |
756 | */ | 756 | */ |
757 | 757 | ||
758 | seg = tioce_common->ce_pcibus.bs_persist_segment; | 758 | seg = tioce_common->ce_pcibus.bs_persist_segment; |
759 | bus = tioce_common->ce_pcibus.bs_persist_busnum; | 759 | bus = tioce_common->ce_pcibus.bs_persist_busnum; |
760 | 760 | ||
761 | raw_pci_ops->read(seg, bus, PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1,&tmp); | 761 | raw_pci_read(seg, bus, PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1,&tmp); |
762 | tioce_kern->ce_port1_secondary = (u8) tmp; | 762 | tioce_kern->ce_port1_secondary = (u8) tmp; |
763 | 763 | ||
764 | /* | 764 | /* |
@@ -799,11 +799,11 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
799 | 799 | ||
800 | /* mem base/limit */ | 800 | /* mem base/limit */ |
801 | 801 | ||
802 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 802 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
803 | PCI_MEMORY_BASE, 2, &tmp); | 803 | PCI_MEMORY_BASE, 2, &tmp); |
804 | base = (u64)tmp << 16; | 804 | base = (u64)tmp << 16; |
805 | 805 | ||
806 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 806 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
807 | PCI_MEMORY_LIMIT, 2, &tmp); | 807 | PCI_MEMORY_LIMIT, 2, &tmp); |
808 | limit = (u64)tmp << 16; | 808 | limit = (u64)tmp << 16; |
809 | limit |= 0xfffffUL; | 809 | limit |= 0xfffffUL; |
@@ -817,21 +817,21 @@ tioce_kern_init(struct tioce_common *tioce_common) | |||
817 | * attributes. | 817 | * attributes. |
818 | */ | 818 | */ |
819 | 819 | ||
820 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 820 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
821 | PCI_PREF_MEMORY_BASE, 2, &tmp); | 821 | PCI_PREF_MEMORY_BASE, 2, &tmp); |
822 | base = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; | 822 | base = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; |
823 | 823 | ||
824 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 824 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
825 | PCI_PREF_BASE_UPPER32, 4, &tmp); | 825 | PCI_PREF_BASE_UPPER32, 4, &tmp); |
826 | base |= (u64)tmp << 32; | 826 | base |= (u64)tmp << 32; |
827 | 827 | ||
828 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 828 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
829 | PCI_PREF_MEMORY_LIMIT, 2, &tmp); | 829 | PCI_PREF_MEMORY_LIMIT, 2, &tmp); |
830 | 830 | ||
831 | limit = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; | 831 | limit = ((u64)tmp & PCI_PREF_RANGE_MASK) << 16; |
832 | limit |= 0xfffffUL; | 832 | limit |= 0xfffffUL; |
833 | 833 | ||
834 | raw_pci_ops->read(seg, bus, PCI_DEVFN(dev, 0), | 834 | raw_pci_read(seg, bus, PCI_DEVFN(dev, 0), |
835 | PCI_PREF_LIMIT_UPPER32, 4, &tmp); | 835 | PCI_PREF_LIMIT_UPPER32, 4, &tmp); |
836 | limit |= (u64)tmp << 32; | 836 | limit |= (u64)tmp << 32; |
837 | 837 | ||
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index d4679ab55b96..de153de2ea9f 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "Linux/M32R Kernel Configuration" | |||
8 | config M32R | 8 | config M32R |
9 | bool | 9 | bool |
10 | default y | 10 | default y |
11 | select HAVE_IDE | ||
11 | select HAVE_OPROFILE | 12 | select HAVE_OPROFILE |
12 | 13 | ||
13 | config SBUS | 14 | config SBUS |
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 2b0ed89cd173..65db2261b9ea 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config M68K | 5 | config M68K |
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | select HAVE_IDE | ||
8 | 9 | ||
9 | config MMU | 10 | config MMU |
10 | bool | 11 | bool |
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig index 548a7b321633..07eb4c4bab82 100644 --- a/arch/m68knommu/Kconfig +++ b/arch/m68knommu/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "uClinux/68k (w/o MMU) Kernel Configuration" | |||
8 | config M68K | 8 | config M68K |
9 | bool | 9 | bool |
10 | default y | 10 | default y |
11 | select HAVE_IDE | ||
11 | 12 | ||
12 | config MMU | 13 | config MMU |
13 | bool | 14 | bool |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ec78a5762e9e..ade230d445d9 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config MIPS | 1 | config MIPS |
2 | bool | 2 | bool |
3 | default y | 3 | default y |
4 | select HAVE_IDE | ||
4 | select HAVE_OPROFILE | 5 | select HAVE_OPROFILE |
5 | # Horrible source of confusion. Die, die, die ... | 6 | # Horrible source of confusion. Die, die, die ... |
6 | select EMBEDDED | 7 | select EMBEDDED |
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index d929ac84f25a..bc7a19da6245 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -7,6 +7,7 @@ mainmenu "Linux/PA-RISC Kernel Configuration" | |||
7 | 7 | ||
8 | config PARISC | 8 | config PARISC |
9 | def_bool y | 9 | def_bool y |
10 | select HAVE_IDE | ||
10 | select HAVE_OPROFILE | 11 | select HAVE_OPROFILE |
11 | help | 12 | help |
12 | The PA-RISC microprocessor is designed by Hewlett-Packard and used | 13 | The PA-RISC microprocessor is designed by Hewlett-Packard and used |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 26b963c33c88..485513c9f1af 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -87,6 +87,7 @@ config ARCH_NO_VIRT_TO_BUS | |||
87 | config PPC | 87 | config PPC |
88 | bool | 88 | bool |
89 | default y | 89 | default y |
90 | select HAVE_IDE | ||
90 | select HAVE_OPROFILE | 91 | select HAVE_OPROFILE |
91 | select HAVE_KPROBES | 92 | select HAVE_KPROBES |
92 | 93 | ||
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index 531156f8919c..abc877faf123 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig | |||
@@ -42,6 +42,7 @@ config GENERIC_CALIBRATE_DELAY | |||
42 | config PPC | 42 | config PPC |
43 | bool | 43 | bool |
44 | default y | 44 | default y |
45 | select HAVE_IDE | ||
45 | select HAVE_OPROFILE | 46 | select HAVE_OPROFILE |
46 | select HAVE_KPROBES | 47 | select HAVE_KPROBES |
47 | 48 | ||
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index ece7b99da895..39921f3a9685 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -1,12 +1,13 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.23 | 3 | # Linux kernel version: 2.6.24 |
4 | # Mon Oct 22 12:10:44 2007 | 4 | # Sat Feb 9 12:13:01 2008 |
5 | # | 5 | # |
6 | CONFIG_MMU=y | 6 | CONFIG_MMU=y |
7 | CONFIG_ZONE_DMA=y | 7 | CONFIG_ZONE_DMA=y |
8 | CONFIG_LOCKDEP_SUPPORT=y | 8 | CONFIG_LOCKDEP_SUPPORT=y |
9 | CONFIG_STACKTRACE_SUPPORT=y | 9 | CONFIG_STACKTRACE_SUPPORT=y |
10 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y | ||
10 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
11 | # CONFIG_ARCH_HAS_ILOG2_U32 is not set | 12 | # CONFIG_ARCH_HAS_ILOG2_U32 is not set |
12 | # CONFIG_ARCH_HAS_ILOG2_U64 is not set | 13 | # CONFIG_ARCH_HAS_ILOG2_U64 is not set |
@@ -15,6 +16,7 @@ CONFIG_GENERIC_TIME=y | |||
15 | CONFIG_GENERIC_BUG=y | 16 | CONFIG_GENERIC_BUG=y |
16 | CONFIG_NO_IOMEM=y | 17 | CONFIG_NO_IOMEM=y |
17 | CONFIG_NO_DMA=y | 18 | CONFIG_NO_DMA=y |
19 | CONFIG_GENERIC_LOCKBREAK=y | ||
18 | CONFIG_S390=y | 20 | CONFIG_S390=y |
19 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 21 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
20 | 22 | ||
@@ -32,7 +34,6 @@ CONFIG_SYSVIPC_SYSCTL=y | |||
32 | CONFIG_POSIX_MQUEUE=y | 34 | CONFIG_POSIX_MQUEUE=y |
33 | # CONFIG_BSD_PROCESS_ACCT is not set | 35 | # CONFIG_BSD_PROCESS_ACCT is not set |
34 | # CONFIG_TASKSTATS is not set | 36 | # CONFIG_TASKSTATS is not set |
35 | # CONFIG_USER_NS is not set | ||
36 | CONFIG_AUDIT=y | 37 | CONFIG_AUDIT=y |
37 | # CONFIG_AUDITSYSCALL is not set | 38 | # CONFIG_AUDITSYSCALL is not set |
38 | CONFIG_IKCONFIG=y | 39 | CONFIG_IKCONFIG=y |
@@ -41,13 +42,19 @@ CONFIG_LOG_BUF_SHIFT=17 | |||
41 | CONFIG_CGROUPS=y | 42 | CONFIG_CGROUPS=y |
42 | # CONFIG_CGROUP_DEBUG is not set | 43 | # CONFIG_CGROUP_DEBUG is not set |
43 | CONFIG_CGROUP_NS=y | 44 | CONFIG_CGROUP_NS=y |
44 | CONFIG_CGROUP_CPUACCT=y | ||
45 | # CONFIG_CPUSETS is not set | 45 | # CONFIG_CPUSETS is not set |
46 | CONFIG_FAIR_GROUP_SCHED=y | 46 | CONFIG_FAIR_GROUP_SCHED=y |
47 | CONFIG_FAIR_USER_SCHED=y | 47 | CONFIG_FAIR_USER_SCHED=y |
48 | # CONFIG_FAIR_CGROUP_SCHED is not set | 48 | # CONFIG_FAIR_CGROUP_SCHED is not set |
49 | # CONFIG_CGROUP_CPUACCT is not set | ||
50 | # CONFIG_RESOURCE_COUNTERS is not set | ||
49 | CONFIG_SYSFS_DEPRECATED=y | 51 | CONFIG_SYSFS_DEPRECATED=y |
50 | # CONFIG_RELAY is not set | 52 | # CONFIG_RELAY is not set |
53 | CONFIG_NAMESPACES=y | ||
54 | CONFIG_UTS_NS=y | ||
55 | CONFIG_IPC_NS=y | ||
56 | # CONFIG_USER_NS is not set | ||
57 | # CONFIG_PID_NS is not set | ||
51 | CONFIG_BLK_DEV_INITRD=y | 58 | CONFIG_BLK_DEV_INITRD=y |
52 | CONFIG_INITRAMFS_SOURCE="" | 59 | CONFIG_INITRAMFS_SOURCE="" |
53 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 60 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set |
@@ -61,17 +68,26 @@ CONFIG_HOTPLUG=y | |||
61 | CONFIG_PRINTK=y | 68 | CONFIG_PRINTK=y |
62 | CONFIG_BUG=y | 69 | CONFIG_BUG=y |
63 | CONFIG_ELF_CORE=y | 70 | CONFIG_ELF_CORE=y |
71 | # CONFIG_COMPAT_BRK is not set | ||
64 | CONFIG_BASE_FULL=y | 72 | CONFIG_BASE_FULL=y |
65 | CONFIG_FUTEX=y | 73 | CONFIG_FUTEX=y |
66 | CONFIG_ANON_INODES=y | 74 | CONFIG_ANON_INODES=y |
67 | CONFIG_EPOLL=y | 75 | CONFIG_EPOLL=y |
68 | CONFIG_SIGNALFD=y | 76 | CONFIG_SIGNALFD=y |
77 | CONFIG_TIMERFD=y | ||
69 | CONFIG_EVENTFD=y | 78 | CONFIG_EVENTFD=y |
70 | CONFIG_SHMEM=y | 79 | CONFIG_SHMEM=y |
71 | CONFIG_VM_EVENT_COUNTERS=y | 80 | CONFIG_VM_EVENT_COUNTERS=y |
72 | CONFIG_SLAB=y | 81 | CONFIG_SLAB=y |
73 | # CONFIG_SLUB is not set | 82 | # CONFIG_SLUB is not set |
74 | # CONFIG_SLOB is not set | 83 | # CONFIG_SLOB is not set |
84 | # CONFIG_PROFILING is not set | ||
85 | # CONFIG_MARKERS is not set | ||
86 | CONFIG_HAVE_OPROFILE=y | ||
87 | CONFIG_KPROBES=y | ||
88 | CONFIG_HAVE_KPROBES=y | ||
89 | CONFIG_PROC_PAGE_MONITOR=y | ||
90 | CONFIG_SLABINFO=y | ||
75 | CONFIG_RT_MUTEXES=y | 91 | CONFIG_RT_MUTEXES=y |
76 | # CONFIG_TINY_SHMEM is not set | 92 | # CONFIG_TINY_SHMEM is not set |
77 | CONFIG_BASE_SMALL=0 | 93 | CONFIG_BASE_SMALL=0 |
@@ -99,6 +115,8 @@ CONFIG_DEFAULT_DEADLINE=y | |||
99 | # CONFIG_DEFAULT_CFQ is not set | 115 | # CONFIG_DEFAULT_CFQ is not set |
100 | # CONFIG_DEFAULT_NOOP is not set | 116 | # CONFIG_DEFAULT_NOOP is not set |
101 | CONFIG_DEFAULT_IOSCHED="deadline" | 117 | CONFIG_DEFAULT_IOSCHED="deadline" |
118 | CONFIG_CLASSIC_RCU=y | ||
119 | # CONFIG_PREEMPT_RCU is not set | ||
102 | 120 | ||
103 | # | 121 | # |
104 | # Base setup | 122 | # Base setup |
@@ -137,7 +155,7 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y | |||
137 | # CONFIG_PREEMPT_NONE is not set | 155 | # CONFIG_PREEMPT_NONE is not set |
138 | # CONFIG_PREEMPT_VOLUNTARY is not set | 156 | # CONFIG_PREEMPT_VOLUNTARY is not set |
139 | CONFIG_PREEMPT=y | 157 | CONFIG_PREEMPT=y |
140 | CONFIG_PREEMPT_BKL=y | 158 | # CONFIG_RCU_TRACE is not set |
141 | CONFIG_SELECT_MEMORY_MODEL=y | 159 | CONFIG_SELECT_MEMORY_MODEL=y |
142 | CONFIG_FLATMEM_MANUAL=y | 160 | CONFIG_FLATMEM_MANUAL=y |
143 | # CONFIG_DISCONTIGMEM_MANUAL is not set | 161 | # CONFIG_DISCONTIGMEM_MANUAL is not set |
@@ -151,7 +169,6 @@ CONFIG_RESOURCES_64BIT=y | |||
151 | CONFIG_ZONE_DMA_FLAG=1 | 169 | CONFIG_ZONE_DMA_FLAG=1 |
152 | CONFIG_BOUNCE=y | 170 | CONFIG_BOUNCE=y |
153 | CONFIG_VIRT_TO_BUS=y | 171 | CONFIG_VIRT_TO_BUS=y |
154 | CONFIG_HOLES_IN_ZONE=y | ||
155 | 172 | ||
156 | # | 173 | # |
157 | # I/O subsystem configuration | 174 | # I/O subsystem configuration |
@@ -180,6 +197,7 @@ CONFIG_HZ_100=y | |||
180 | # CONFIG_HZ_300 is not set | 197 | # CONFIG_HZ_300 is not set |
181 | # CONFIG_HZ_1000 is not set | 198 | # CONFIG_HZ_1000 is not set |
182 | CONFIG_HZ=100 | 199 | CONFIG_HZ=100 |
200 | # CONFIG_SCHED_HRTICK is not set | ||
183 | CONFIG_NO_IDLE_HZ=y | 201 | CONFIG_NO_IDLE_HZ=y |
184 | CONFIG_NO_IDLE_HZ_INIT=y | 202 | CONFIG_NO_IDLE_HZ_INIT=y |
185 | CONFIG_S390_HYPFS_FS=y | 203 | CONFIG_S390_HYPFS_FS=y |
@@ -201,6 +219,7 @@ CONFIG_XFRM=y | |||
201 | # CONFIG_XFRM_USER is not set | 219 | # CONFIG_XFRM_USER is not set |
202 | # CONFIG_XFRM_SUB_POLICY is not set | 220 | # CONFIG_XFRM_SUB_POLICY is not set |
203 | # CONFIG_XFRM_MIGRATE is not set | 221 | # CONFIG_XFRM_MIGRATE is not set |
222 | # CONFIG_XFRM_STATISTICS is not set | ||
204 | CONFIG_NET_KEY=y | 223 | CONFIG_NET_KEY=y |
205 | # CONFIG_NET_KEY_MIGRATE is not set | 224 | # CONFIG_NET_KEY_MIGRATE is not set |
206 | CONFIG_IUCV=m | 225 | CONFIG_IUCV=m |
@@ -251,6 +270,7 @@ CONFIG_IPV6_SIT=y | |||
251 | # CONFIG_NETWORK_SECMARK is not set | 270 | # CONFIG_NETWORK_SECMARK is not set |
252 | CONFIG_NETFILTER=y | 271 | CONFIG_NETFILTER=y |
253 | # CONFIG_NETFILTER_DEBUG is not set | 272 | # CONFIG_NETFILTER_DEBUG is not set |
273 | CONFIG_NETFILTER_ADVANCED=y | ||
254 | 274 | ||
255 | # | 275 | # |
256 | # Core Netfilter Configuration | 276 | # Core Netfilter Configuration |
@@ -258,7 +278,6 @@ CONFIG_NETFILTER=y | |||
258 | CONFIG_NETFILTER_NETLINK=m | 278 | CONFIG_NETFILTER_NETLINK=m |
259 | CONFIG_NETFILTER_NETLINK_QUEUE=m | 279 | CONFIG_NETFILTER_NETLINK_QUEUE=m |
260 | CONFIG_NETFILTER_NETLINK_LOG=m | 280 | CONFIG_NETFILTER_NETLINK_LOG=m |
261 | CONFIG_NF_CONNTRACK_ENABLED=m | ||
262 | CONFIG_NF_CONNTRACK=m | 281 | CONFIG_NF_CONNTRACK=m |
263 | # CONFIG_NF_CT_ACCT is not set | 282 | # CONFIG_NF_CT_ACCT is not set |
264 | # CONFIG_NF_CONNTRACK_MARK is not set | 283 | # CONFIG_NF_CONNTRACK_MARK is not set |
@@ -286,7 +305,7 @@ CONFIG_NF_CONNTRACK=m | |||
286 | # CONFIG_IP_NF_ARPTABLES is not set | 305 | # CONFIG_IP_NF_ARPTABLES is not set |
287 | 306 | ||
288 | # | 307 | # |
289 | # IPv6: Netfilter Configuration (EXPERIMENTAL) | 308 | # IPv6: Netfilter Configuration |
290 | # | 309 | # |
291 | # CONFIG_NF_CONNTRACK_IPV6 is not set | 310 | # CONFIG_NF_CONNTRACK_IPV6 is not set |
292 | # CONFIG_IP6_NF_QUEUE is not set | 311 | # CONFIG_IP6_NF_QUEUE is not set |
@@ -343,6 +362,7 @@ CONFIG_NET_CLS_U32=m | |||
343 | CONFIG_CLS_U32_MARK=y | 362 | CONFIG_CLS_U32_MARK=y |
344 | CONFIG_NET_CLS_RSVP=m | 363 | CONFIG_NET_CLS_RSVP=m |
345 | CONFIG_NET_CLS_RSVP6=m | 364 | CONFIG_NET_CLS_RSVP6=m |
365 | CONFIG_NET_CLS_FLOW=m | ||
346 | # CONFIG_NET_EMATCH is not set | 366 | # CONFIG_NET_EMATCH is not set |
347 | CONFIG_NET_CLS_ACT=y | 367 | CONFIG_NET_CLS_ACT=y |
348 | CONFIG_NET_ACT_POLICE=y | 368 | CONFIG_NET_ACT_POLICE=y |
@@ -351,7 +371,6 @@ CONFIG_NET_ACT_POLICE=y | |||
351 | CONFIG_NET_ACT_NAT=m | 371 | CONFIG_NET_ACT_NAT=m |
352 | # CONFIG_NET_ACT_PEDIT is not set | 372 | # CONFIG_NET_ACT_PEDIT is not set |
353 | # CONFIG_NET_ACT_SIMP is not set | 373 | # CONFIG_NET_ACT_SIMP is not set |
354 | CONFIG_NET_CLS_POLICE=y | ||
355 | # CONFIG_NET_CLS_IND is not set | 374 | # CONFIG_NET_CLS_IND is not set |
356 | CONFIG_NET_SCH_FIFO=y | 375 | CONFIG_NET_SCH_FIFO=y |
357 | 376 | ||
@@ -360,6 +379,15 @@ CONFIG_NET_SCH_FIFO=y | |||
360 | # | 379 | # |
361 | # CONFIG_NET_PKTGEN is not set | 380 | # CONFIG_NET_PKTGEN is not set |
362 | # CONFIG_NET_TCPPROBE is not set | 381 | # CONFIG_NET_TCPPROBE is not set |
382 | CONFIG_CAN=m | ||
383 | CONFIG_CAN_RAW=m | ||
384 | CONFIG_CAN_BCM=m | ||
385 | |||
386 | # | ||
387 | # CAN Device Drivers | ||
388 | # | ||
389 | CONFIG_CAN_VCAN=m | ||
390 | # CONFIG_CAN_DEBUG_DEVICES is not set | ||
363 | # CONFIG_AF_RXRPC is not set | 391 | # CONFIG_AF_RXRPC is not set |
364 | # CONFIG_RFKILL is not set | 392 | # CONFIG_RFKILL is not set |
365 | # CONFIG_NET_9P is not set | 393 | # CONFIG_NET_9P is not set |
@@ -389,7 +417,7 @@ CONFIG_BLK_DEV_NBD=m | |||
389 | CONFIG_BLK_DEV_RAM=y | 417 | CONFIG_BLK_DEV_RAM=y |
390 | CONFIG_BLK_DEV_RAM_COUNT=16 | 418 | CONFIG_BLK_DEV_RAM_COUNT=16 |
391 | CONFIG_BLK_DEV_RAM_SIZE=4096 | 419 | CONFIG_BLK_DEV_RAM_SIZE=4096 |
392 | CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | 420 | CONFIG_BLK_DEV_XIP=y |
393 | # CONFIG_CDROM_PKTCDVD is not set | 421 | # CONFIG_CDROM_PKTCDVD is not set |
394 | # CONFIG_ATA_OVER_ETH is not set | 422 | # CONFIG_ATA_OVER_ETH is not set |
395 | 423 | ||
@@ -406,6 +434,7 @@ CONFIG_DASD_DIAG=y | |||
406 | CONFIG_DASD_EER=y | 434 | CONFIG_DASD_EER=y |
407 | CONFIG_MISC_DEVICES=y | 435 | CONFIG_MISC_DEVICES=y |
408 | # CONFIG_EEPROM_93CX6 is not set | 436 | # CONFIG_EEPROM_93CX6 is not set |
437 | # CONFIG_ENCLOSURE_SERVICES is not set | ||
409 | 438 | ||
410 | # | 439 | # |
411 | # SCSI device support | 440 | # SCSI device support |
@@ -487,6 +516,7 @@ CONFIG_NET_ETHERNET=y | |||
487 | # CONFIG_IBM_NEW_EMAC_TAH is not set | 516 | # CONFIG_IBM_NEW_EMAC_TAH is not set |
488 | # CONFIG_IBM_NEW_EMAC_EMAC4 is not set | 517 | # CONFIG_IBM_NEW_EMAC_EMAC4 is not set |
489 | CONFIG_NETDEV_1000=y | 518 | CONFIG_NETDEV_1000=y |
519 | # CONFIG_E1000E_ENABLED is not set | ||
490 | CONFIG_NETDEV_10000=y | 520 | CONFIG_NETDEV_10000=y |
491 | # CONFIG_TR is not set | 521 | # CONFIG_TR is not set |
492 | # CONFIG_WAN is not set | 522 | # CONFIG_WAN is not set |
@@ -508,7 +538,6 @@ CONFIG_QETH=y | |||
508 | CONFIG_CCWGROUP=y | 538 | CONFIG_CCWGROUP=y |
509 | # CONFIG_PPP is not set | 539 | # CONFIG_PPP is not set |
510 | # CONFIG_SLIP is not set | 540 | # CONFIG_SLIP is not set |
511 | # CONFIG_SHAPER is not set | ||
512 | # CONFIG_NETCONSOLE is not set | 541 | # CONFIG_NETCONSOLE is not set |
513 | # CONFIG_NETPOLL is not set | 542 | # CONFIG_NETPOLL is not set |
514 | # CONFIG_NET_POLL_CONTROLLER is not set | 543 | # CONFIG_NET_POLL_CONTROLLER is not set |
@@ -558,6 +587,7 @@ CONFIG_S390_TAPE_34XX=m | |||
558 | CONFIG_MONWRITER=m | 587 | CONFIG_MONWRITER=m |
559 | CONFIG_S390_VMUR=m | 588 | CONFIG_S390_VMUR=m |
560 | # CONFIG_POWER_SUPPLY is not set | 589 | # CONFIG_POWER_SUPPLY is not set |
590 | # CONFIG_THERMAL is not set | ||
561 | # CONFIG_WATCHDOG is not set | 591 | # CONFIG_WATCHDOG is not set |
562 | 592 | ||
563 | # | 593 | # |
@@ -584,12 +614,10 @@ CONFIG_FS_POSIX_ACL=y | |||
584 | # CONFIG_XFS_FS is not set | 614 | # CONFIG_XFS_FS is not set |
585 | # CONFIG_GFS2_FS is not set | 615 | # CONFIG_GFS2_FS is not set |
586 | # CONFIG_OCFS2_FS is not set | 616 | # CONFIG_OCFS2_FS is not set |
587 | # CONFIG_MINIX_FS is not set | 617 | CONFIG_DNOTIFY=y |
588 | # CONFIG_ROMFS_FS is not set | ||
589 | CONFIG_INOTIFY=y | 618 | CONFIG_INOTIFY=y |
590 | CONFIG_INOTIFY_USER=y | 619 | CONFIG_INOTIFY_USER=y |
591 | # CONFIG_QUOTA is not set | 620 | # CONFIG_QUOTA is not set |
592 | CONFIG_DNOTIFY=y | ||
593 | # CONFIG_AUTOFS_FS is not set | 621 | # CONFIG_AUTOFS_FS is not set |
594 | # CONFIG_AUTOFS4_FS is not set | 622 | # CONFIG_AUTOFS4_FS is not set |
595 | # CONFIG_FUSE_FS is not set | 623 | # CONFIG_FUSE_FS is not set |
@@ -632,8 +660,10 @@ CONFIG_CONFIGFS_FS=m | |||
632 | # CONFIG_EFS_FS is not set | 660 | # CONFIG_EFS_FS is not set |
633 | # CONFIG_CRAMFS is not set | 661 | # CONFIG_CRAMFS is not set |
634 | # CONFIG_VXFS_FS is not set | 662 | # CONFIG_VXFS_FS is not set |
663 | # CONFIG_MINIX_FS is not set | ||
635 | # CONFIG_HPFS_FS is not set | 664 | # CONFIG_HPFS_FS is not set |
636 | # CONFIG_QNX4FS_FS is not set | 665 | # CONFIG_QNX4FS_FS is not set |
666 | # CONFIG_ROMFS_FS is not set | ||
637 | # CONFIG_SYSV_FS is not set | 667 | # CONFIG_SYSV_FS is not set |
638 | # CONFIG_UFS_FS is not set | 668 | # CONFIG_UFS_FS is not set |
639 | CONFIG_NETWORK_FILESYSTEMS=y | 669 | CONFIG_NETWORK_FILESYSTEMS=y |
@@ -686,16 +716,13 @@ CONFIG_MSDOS_PARTITION=y | |||
686 | # CONFIG_NLS is not set | 716 | # CONFIG_NLS is not set |
687 | CONFIG_DLM=m | 717 | CONFIG_DLM=m |
688 | # CONFIG_DLM_DEBUG is not set | 718 | # CONFIG_DLM_DEBUG is not set |
689 | CONFIG_INSTRUMENTATION=y | ||
690 | # CONFIG_PROFILING is not set | ||
691 | CONFIG_KPROBES=y | ||
692 | # CONFIG_MARKERS is not set | ||
693 | 719 | ||
694 | # | 720 | # |
695 | # Kernel hacking | 721 | # Kernel hacking |
696 | # | 722 | # |
697 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | 723 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y |
698 | # CONFIG_PRINTK_TIME is not set | 724 | # CONFIG_PRINTK_TIME is not set |
725 | CONFIG_ENABLE_WARN_DEPRECATED=y | ||
699 | CONFIG_ENABLE_MUST_CHECK=y | 726 | CONFIG_ENABLE_MUST_CHECK=y |
700 | CONFIG_MAGIC_SYSRQ=y | 727 | CONFIG_MAGIC_SYSRQ=y |
701 | # CONFIG_UNUSED_SYMBOLS is not set | 728 | # CONFIG_UNUSED_SYMBOLS is not set |
@@ -721,12 +748,18 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
721 | # CONFIG_DEBUG_INFO is not set | 748 | # CONFIG_DEBUG_INFO is not set |
722 | # CONFIG_DEBUG_VM is not set | 749 | # CONFIG_DEBUG_VM is not set |
723 | # CONFIG_DEBUG_LIST is not set | 750 | # CONFIG_DEBUG_LIST is not set |
751 | # CONFIG_DEBUG_SG is not set | ||
724 | # CONFIG_FRAME_POINTER is not set | 752 | # CONFIG_FRAME_POINTER is not set |
725 | CONFIG_FORCED_INLINING=y | 753 | CONFIG_FORCED_INLINING=y |
726 | # CONFIG_RCU_TORTURE_TEST is not set | 754 | # CONFIG_RCU_TORTURE_TEST is not set |
755 | # CONFIG_KPROBES_SANITY_TEST is not set | ||
756 | # CONFIG_BACKTRACE_SELF_TEST is not set | ||
727 | # CONFIG_LKDTM is not set | 757 | # CONFIG_LKDTM is not set |
728 | # CONFIG_FAULT_INJECTION is not set | 758 | # CONFIG_FAULT_INJECTION is not set |
759 | # CONFIG_LATENCYTOP is not set | ||
729 | CONFIG_SAMPLES=y | 760 | CONFIG_SAMPLES=y |
761 | # CONFIG_SAMPLE_KOBJECT is not set | ||
762 | # CONFIG_DEBUG_PAGEALLOC is not set | ||
730 | 763 | ||
731 | # | 764 | # |
732 | # Security options | 765 | # Security options |
@@ -738,6 +771,7 @@ CONFIG_CRYPTO=y | |||
738 | CONFIG_CRYPTO_ALGAPI=y | 771 | CONFIG_CRYPTO_ALGAPI=y |
739 | CONFIG_CRYPTO_AEAD=m | 772 | CONFIG_CRYPTO_AEAD=m |
740 | CONFIG_CRYPTO_BLKCIPHER=y | 773 | CONFIG_CRYPTO_BLKCIPHER=y |
774 | CONFIG_CRYPTO_SEQIV=m | ||
741 | CONFIG_CRYPTO_HASH=m | 775 | CONFIG_CRYPTO_HASH=m |
742 | CONFIG_CRYPTO_MANAGER=y | 776 | CONFIG_CRYPTO_MANAGER=y |
743 | CONFIG_CRYPTO_HMAC=m | 777 | CONFIG_CRYPTO_HMAC=m |
@@ -745,17 +779,20 @@ CONFIG_CRYPTO_HMAC=m | |||
745 | # CONFIG_CRYPTO_NULL is not set | 779 | # CONFIG_CRYPTO_NULL is not set |
746 | # CONFIG_CRYPTO_MD4 is not set | 780 | # CONFIG_CRYPTO_MD4 is not set |
747 | CONFIG_CRYPTO_MD5=m | 781 | CONFIG_CRYPTO_MD5=m |
748 | # CONFIG_CRYPTO_SHA1 is not set | 782 | CONFIG_CRYPTO_SHA1=m |
749 | # CONFIG_CRYPTO_SHA256 is not set | 783 | # CONFIG_CRYPTO_SHA256 is not set |
750 | # CONFIG_CRYPTO_SHA512 is not set | 784 | # CONFIG_CRYPTO_SHA512 is not set |
751 | # CONFIG_CRYPTO_WP512 is not set | 785 | # CONFIG_CRYPTO_WP512 is not set |
752 | # CONFIG_CRYPTO_TGR192 is not set | 786 | # CONFIG_CRYPTO_TGR192 is not set |
753 | # CONFIG_CRYPTO_GF128MUL is not set | 787 | CONFIG_CRYPTO_GF128MUL=m |
754 | CONFIG_CRYPTO_ECB=m | 788 | CONFIG_CRYPTO_ECB=m |
755 | CONFIG_CRYPTO_CBC=y | 789 | CONFIG_CRYPTO_CBC=y |
756 | CONFIG_CRYPTO_PCBC=m | 790 | CONFIG_CRYPTO_PCBC=m |
757 | # CONFIG_CRYPTO_LRW is not set | 791 | # CONFIG_CRYPTO_LRW is not set |
758 | # CONFIG_CRYPTO_XTS is not set | 792 | # CONFIG_CRYPTO_XTS is not set |
793 | CONFIG_CRYPTO_CTR=m | ||
794 | CONFIG_CRYPTO_GCM=m | ||
795 | CONFIG_CRYPTO_CCM=m | ||
759 | # CONFIG_CRYPTO_CRYPTD is not set | 796 | # CONFIG_CRYPTO_CRYPTD is not set |
760 | # CONFIG_CRYPTO_DES is not set | 797 | # CONFIG_CRYPTO_DES is not set |
761 | CONFIG_CRYPTO_FCRYPT=m | 798 | CONFIG_CRYPTO_FCRYPT=m |
@@ -770,20 +807,22 @@ CONFIG_CRYPTO_FCRYPT=m | |||
770 | # CONFIG_CRYPTO_KHAZAD is not set | 807 | # CONFIG_CRYPTO_KHAZAD is not set |
771 | # CONFIG_CRYPTO_ANUBIS is not set | 808 | # CONFIG_CRYPTO_ANUBIS is not set |
772 | CONFIG_CRYPTO_SEED=m | 809 | CONFIG_CRYPTO_SEED=m |
810 | CONFIG_CRYPTO_SALSA20=m | ||
773 | # CONFIG_CRYPTO_DEFLATE is not set | 811 | # CONFIG_CRYPTO_DEFLATE is not set |
774 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | 812 | # CONFIG_CRYPTO_MICHAEL_MIC is not set |
775 | # CONFIG_CRYPTO_CRC32C is not set | 813 | # CONFIG_CRYPTO_CRC32C is not set |
776 | CONFIG_CRYPTO_CAMELLIA=m | 814 | CONFIG_CRYPTO_CAMELLIA=m |
777 | # CONFIG_CRYPTO_TEST is not set | 815 | # CONFIG_CRYPTO_TEST is not set |
778 | CONFIG_CRYPTO_AUTHENC=m | 816 | CONFIG_CRYPTO_AUTHENC=m |
817 | CONFIG_CRYPTO_LZO=m | ||
779 | CONFIG_CRYPTO_HW=y | 818 | CONFIG_CRYPTO_HW=y |
819 | CONFIG_ZCRYPT=m | ||
820 | # CONFIG_ZCRYPT_MONOLITHIC is not set | ||
780 | # CONFIG_CRYPTO_SHA1_S390 is not set | 821 | # CONFIG_CRYPTO_SHA1_S390 is not set |
781 | # CONFIG_CRYPTO_SHA256_S390 is not set | 822 | # CONFIG_CRYPTO_SHA256_S390 is not set |
782 | # CONFIG_CRYPTO_DES_S390 is not set | 823 | # CONFIG_CRYPTO_DES_S390 is not set |
783 | # CONFIG_CRYPTO_AES_S390 is not set | 824 | # CONFIG_CRYPTO_AES_S390 is not set |
784 | CONFIG_S390_PRNG=m | 825 | CONFIG_S390_PRNG=m |
785 | CONFIG_ZCRYPT=m | ||
786 | # CONFIG_ZCRYPT_MONOLITHIC is not set | ||
787 | 826 | ||
788 | # | 827 | # |
789 | # Library routines | 828 | # Library routines |
@@ -794,5 +833,7 @@ CONFIG_BITREVERSE=m | |||
794 | # CONFIG_CRC_ITU_T is not set | 833 | # CONFIG_CRC_ITU_T is not set |
795 | CONFIG_CRC32=m | 834 | CONFIG_CRC32=m |
796 | CONFIG_CRC7=m | 835 | CONFIG_CRC7=m |
797 | # CONFIG_LIBCRC32C is not set | 836 | CONFIG_LIBCRC32C=m |
837 | CONFIG_LZO_COMPRESS=m | ||
838 | CONFIG_LZO_DECOMPRESS=m | ||
798 | CONFIG_PLIST=y | 839 | CONFIG_PLIST=y |
diff --git a/arch/s390/kernel/binfmt_elf32.c b/arch/s390/kernel/binfmt_elf32.c index f1e40ca00d8d..3e1c315b736d 100644 --- a/arch/s390/kernel/binfmt_elf32.c +++ b/arch/s390/kernel/binfmt_elf32.c | |||
@@ -134,6 +134,7 @@ static inline int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | #include <asm/processor.h> | 136 | #include <asm/processor.h> |
137 | #include <asm/pgalloc.h> | ||
137 | #include <linux/module.h> | 138 | #include <linux/module.h> |
138 | #include <linux/elfcore.h> | 139 | #include <linux/elfcore.h> |
139 | #include <linux/binfmts.h> | 140 | #include <linux/binfmts.h> |
@@ -183,6 +184,16 @@ struct elf_prpsinfo32 | |||
183 | #undef start_thread | 184 | #undef start_thread |
184 | #define start_thread start_thread31 | 185 | #define start_thread start_thread31 |
185 | 186 | ||
187 | static inline void start_thread31(struct pt_regs *regs, unsigned long new_psw, | ||
188 | unsigned long new_stackp) | ||
189 | { | ||
190 | set_fs(USER_DS); | ||
191 | regs->psw.mask = psw_user32_bits; | ||
192 | regs->psw.addr = new_psw; | ||
193 | regs->gprs[15] = new_stackp; | ||
194 | crst_table_downgrade(current->mm, 1UL << 31); | ||
195 | } | ||
196 | |||
186 | MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries," | 197 | MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries," |
187 | " Copyright 2000 IBM Corporation"); | 198 | " Copyright 2000 IBM Corporation"); |
188 | MODULE_AUTHOR("Gerhard Tonn <ton@de.ibm.com>"); | 199 | MODULE_AUTHOR("Gerhard Tonn <ton@de.ibm.com>"); |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 062c3d4c0394..743d54f0b8db 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1712,3 +1712,23 @@ sys_fallocate_wrapper: | |||
1712 | sllg %r5,%r6,32 # get high word of 64bit loff_t | 1712 | sllg %r5,%r6,32 # get high word of 64bit loff_t |
1713 | l %r5,164(%r15) # get low word of 64bit loff_t | 1713 | l %r5,164(%r15) # get low word of 64bit loff_t |
1714 | jg sys_fallocate | 1714 | jg sys_fallocate |
1715 | |||
1716 | .globl sys_timerfd_create_wrapper | ||
1717 | sys_timerfd_create_wrapper: | ||
1718 | lgfr %r2,%r2 # int | ||
1719 | lgfr %r3,%r3 # int | ||
1720 | jg sys_timerfd_create | ||
1721 | |||
1722 | .globl compat_sys_timerfd_settime_wrapper | ||
1723 | compat_sys_timerfd_settime_wrapper: | ||
1724 | lgfr %r2,%r2 # int | ||
1725 | lgfr %r3,%r3 # int | ||
1726 | llgtr %r4,%r4 # struct compat_itimerspec * | ||
1727 | llgtr %r5,%r5 # struct compat_itimerspec * | ||
1728 | jg compat_sys_timerfd_settime | ||
1729 | |||
1730 | .globl compat_sys_timerfd_gettime_wrapper | ||
1731 | compat_sys_timerfd_gettime_wrapper: | ||
1732 | lgfr %r2,%r2 # int | ||
1733 | llgtr %r3,%r3 # struct compat_itimerspec * | ||
1734 | jg compat_sys_timerfd_gettime | ||
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 0e7aca039307..a6a4729e0e94 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/vmalloc.h> | 30 | #include <linux/vmalloc.h> |
31 | #include <linux/user.h> | 31 | #include <linux/user.h> |
32 | #include <linux/a.out.h> | ||
33 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
34 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
35 | #include <linux/reboot.h> | 34 | #include <linux/reboot.h> |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index f9f8779022a0..290e504061a3 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/ptrace.h> | 24 | #include <linux/ptrace.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/user.h> | 26 | #include <linux/user.h> |
27 | #include <linux/a.out.h> | ||
28 | #include <linux/tty.h> | 27 | #include <linux/tty.h> |
29 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
30 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 25eac7802fc4..c87ec687d4c6 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -327,3 +327,6 @@ SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ | |||
327 | SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) | 327 | SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) |
328 | NI_SYSCALL /* 317 old sys_timer_fd */ | 328 | NI_SYSCALL /* 317 old sys_timer_fd */ |
329 | SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) | 329 | SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) |
330 | SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper) | ||
331 | SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime_wrapper) /* 320 */ | ||
332 | SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime_wrapper) | ||
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index a4d29025ddbd..60f728aeaf12 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -60,6 +60,7 @@ int sysctl_userprocess_debug = 0; | |||
60 | extern pgm_check_handler_t do_protection_exception; | 60 | extern pgm_check_handler_t do_protection_exception; |
61 | extern pgm_check_handler_t do_dat_exception; | 61 | extern pgm_check_handler_t do_dat_exception; |
62 | extern pgm_check_handler_t do_monitor_call; | 62 | extern pgm_check_handler_t do_monitor_call; |
63 | extern pgm_check_handler_t do_asce_exception; | ||
63 | 64 | ||
64 | #define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; }) | 65 | #define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; }) |
65 | 66 | ||
@@ -730,7 +731,7 @@ void __init trap_init(void) | |||
730 | pgm_check_table[0x12] = &translation_exception; | 731 | pgm_check_table[0x12] = &translation_exception; |
731 | pgm_check_table[0x13] = &special_op_exception; | 732 | pgm_check_table[0x13] = &special_op_exception; |
732 | #ifdef CONFIG_64BIT | 733 | #ifdef CONFIG_64BIT |
733 | pgm_check_table[0x38] = &do_dat_exception; | 734 | pgm_check_table[0x38] = &do_asce_exception; |
734 | pgm_check_table[0x39] = &do_dat_exception; | 735 | pgm_check_table[0x39] = &do_dat_exception; |
735 | pgm_check_table[0x3A] = &do_dat_exception; | 736 | pgm_check_table[0x3A] = &do_dat_exception; |
736 | pgm_check_table[0x3B] = &do_dat_exception; | 737 | pgm_check_table[0x3B] = &do_dat_exception; |
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 2456b52ed068..ed13d429a487 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/system.h> | 32 | #include <asm/system.h> |
33 | #include <asm/pgtable.h> | 33 | #include <asm/pgtable.h> |
34 | #include <asm/s390_ext.h> | 34 | #include <asm/s390_ext.h> |
35 | #include <asm/mmu_context.h> | ||
35 | 36 | ||
36 | #ifndef CONFIG_64BIT | 37 | #ifndef CONFIG_64BIT |
37 | #define __FAIL_ADDR_MASK 0x7ffff000 | 38 | #define __FAIL_ADDR_MASK 0x7ffff000 |
@@ -444,6 +445,45 @@ void __kprobes do_dat_exception(struct pt_regs *regs, unsigned long error_code) | |||
444 | do_exception(regs, error_code & 0xff, 0); | 445 | do_exception(regs, error_code & 0xff, 0); |
445 | } | 446 | } |
446 | 447 | ||
448 | #ifdef CONFIG_64BIT | ||
449 | void __kprobes do_asce_exception(struct pt_regs *regs, unsigned long error_code) | ||
450 | { | ||
451 | struct mm_struct *mm; | ||
452 | struct vm_area_struct *vma; | ||
453 | unsigned long address; | ||
454 | int space; | ||
455 | |||
456 | mm = current->mm; | ||
457 | address = S390_lowcore.trans_exc_code & __FAIL_ADDR_MASK; | ||
458 | space = check_space(current); | ||
459 | |||
460 | if (unlikely(space == 0 || in_atomic() || !mm)) | ||
461 | goto no_context; | ||
462 | |||
463 | local_irq_enable(); | ||
464 | |||
465 | down_read(&mm->mmap_sem); | ||
466 | vma = find_vma(mm, address); | ||
467 | up_read(&mm->mmap_sem); | ||
468 | |||
469 | if (vma) { | ||
470 | update_mm(mm, current); | ||
471 | return; | ||
472 | } | ||
473 | |||
474 | /* User mode accesses just cause a SIGSEGV */ | ||
475 | if (regs->psw.mask & PSW_MASK_PSTATE) { | ||
476 | current->thread.prot_addr = address; | ||
477 | current->thread.trap_no = error_code; | ||
478 | do_sigsegv(regs, error_code, SEGV_MAPERR, address); | ||
479 | return; | ||
480 | } | ||
481 | |||
482 | no_context: | ||
483 | do_no_context(regs, error_code, address); | ||
484 | } | ||
485 | #endif | ||
486 | |||
447 | #ifdef CONFIG_PFAULT | 487 | #ifdef CONFIG_PFAULT |
448 | /* | 488 | /* |
449 | * 'pfault' pseudo page faults routines. | 489 | * 'pfault' pseudo page faults routines. |
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 983ec6ec0e7c..8053245fe259 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -112,6 +112,7 @@ void __init paging_init(void) | |||
112 | init_mm.pgd = swapper_pg_dir; | 112 | init_mm.pgd = swapper_pg_dir; |
113 | S390_lowcore.kernel_asce = __pa(init_mm.pgd) & PAGE_MASK; | 113 | S390_lowcore.kernel_asce = __pa(init_mm.pgd) & PAGE_MASK; |
114 | #ifdef CONFIG_64BIT | 114 | #ifdef CONFIG_64BIT |
115 | /* A three level page table (4TB) is enough for the kernel space. */ | ||
115 | S390_lowcore.kernel_asce |= _ASCE_TYPE_REGION3 | _ASCE_TABLE_LENGTH; | 116 | S390_lowcore.kernel_asce |= _ASCE_TYPE_REGION3 | _ASCE_TABLE_LENGTH; |
116 | pgd_type = _REGION3_ENTRY_EMPTY; | 117 | pgd_type = _REGION3_ENTRY_EMPTY; |
117 | #else | 118 | #else |
@@ -184,7 +185,7 @@ void kernel_map_pages(struct page *page, int numpages, int enable) | |||
184 | pmd = pmd_offset(pud, address); | 185 | pmd = pmd_offset(pud, address); |
185 | pte = pte_offset_kernel(pmd, address); | 186 | pte = pte_offset_kernel(pmd, address); |
186 | if (!enable) { | 187 | if (!enable) { |
187 | ptep_invalidate(address, pte); | 188 | ptep_invalidate(&init_mm, address, pte); |
188 | continue; | 189 | continue; |
189 | } | 190 | } |
190 | *pte = mk_pte_phys(address, __pgprot(_PAGE_TYPE_RW)); | 191 | *pte = mk_pte_phys(address, __pgprot(_PAGE_TYPE_RW)); |
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c index 356257c171de..5932a824547a 100644 --- a/arch/s390/mm/mmap.c +++ b/arch/s390/mm/mmap.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/personality.h> | 27 | #include <linux/personality.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <asm/pgalloc.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * Top of mmap area (just below the process stack). | 33 | * Top of mmap area (just below the process stack). |
@@ -62,6 +63,8 @@ static inline int mmap_is_legacy(void) | |||
62 | current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY; | 63 | current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY; |
63 | } | 64 | } |
64 | 65 | ||
66 | #ifndef CONFIG_64BIT | ||
67 | |||
65 | /* | 68 | /* |
66 | * This function, called very early during the creation of a new | 69 | * This function, called very early during the creation of a new |
67 | * process VM image, sets up which VM layout function to use: | 70 | * process VM image, sets up which VM layout function to use: |
@@ -84,3 +87,65 @@ void arch_pick_mmap_layout(struct mm_struct *mm) | |||
84 | } | 87 | } |
85 | EXPORT_SYMBOL_GPL(arch_pick_mmap_layout); | 88 | EXPORT_SYMBOL_GPL(arch_pick_mmap_layout); |
86 | 89 | ||
90 | #else | ||
91 | |||
92 | static unsigned long | ||
93 | s390_get_unmapped_area(struct file *filp, unsigned long addr, | ||
94 | unsigned long len, unsigned long pgoff, unsigned long flags) | ||
95 | { | ||
96 | struct mm_struct *mm = current->mm; | ||
97 | int rc; | ||
98 | |||
99 | addr = arch_get_unmapped_area(filp, addr, len, pgoff, flags); | ||
100 | if (addr & ~PAGE_MASK) | ||
101 | return addr; | ||
102 | if (unlikely(mm->context.asce_limit < addr + len)) { | ||
103 | rc = crst_table_upgrade(mm, addr + len); | ||
104 | if (rc) | ||
105 | return (unsigned long) rc; | ||
106 | } | ||
107 | return addr; | ||
108 | } | ||
109 | |||
110 | static unsigned long | ||
111 | s390_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | ||
112 | const unsigned long len, const unsigned long pgoff, | ||
113 | const unsigned long flags) | ||
114 | { | ||
115 | struct mm_struct *mm = current->mm; | ||
116 | unsigned long addr = addr0; | ||
117 | int rc; | ||
118 | |||
119 | addr = arch_get_unmapped_area_topdown(filp, addr, len, pgoff, flags); | ||
120 | if (addr & ~PAGE_MASK) | ||
121 | return addr; | ||
122 | if (unlikely(mm->context.asce_limit < addr + len)) { | ||
123 | rc = crst_table_upgrade(mm, addr + len); | ||
124 | if (rc) | ||
125 | return (unsigned long) rc; | ||
126 | } | ||
127 | return addr; | ||
128 | } | ||
129 | /* | ||
130 | * This function, called very early during the creation of a new | ||
131 | * process VM image, sets up which VM layout function to use: | ||
132 | */ | ||
133 | void arch_pick_mmap_layout(struct mm_struct *mm) | ||
134 | { | ||
135 | /* | ||
136 | * Fall back to the standard layout if the personality | ||
137 | * bit is set, or if the expected stack growth is unlimited: | ||
138 | */ | ||
139 | if (mmap_is_legacy()) { | ||
140 | mm->mmap_base = TASK_UNMAPPED_BASE; | ||
141 | mm->get_unmapped_area = s390_get_unmapped_area; | ||
142 | mm->unmap_area = arch_unmap_area; | ||
143 | } else { | ||
144 | mm->mmap_base = mmap_base(); | ||
145 | mm->get_unmapped_area = s390_get_unmapped_area_topdown; | ||
146 | mm->unmap_area = arch_unmap_area_topdown; | ||
147 | } | ||
148 | } | ||
149 | EXPORT_SYMBOL_GPL(arch_pick_mmap_layout); | ||
150 | |||
151 | #endif | ||
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 019f518cd5a0..fd072013f88c 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -23,11 +23,18 @@ | |||
23 | #include <asm/pgalloc.h> | 23 | #include <asm/pgalloc.h> |
24 | #include <asm/tlb.h> | 24 | #include <asm/tlb.h> |
25 | #include <asm/tlbflush.h> | 25 | #include <asm/tlbflush.h> |
26 | #include <asm/mmu_context.h> | ||
26 | 27 | ||
27 | #ifndef CONFIG_64BIT | 28 | #ifndef CONFIG_64BIT |
28 | #define ALLOC_ORDER 1 | 29 | #define ALLOC_ORDER 1 |
30 | #define TABLES_PER_PAGE 4 | ||
31 | #define FRAG_MASK 15UL | ||
32 | #define SECOND_HALVES 10UL | ||
29 | #else | 33 | #else |
30 | #define ALLOC_ORDER 2 | 34 | #define ALLOC_ORDER 2 |
35 | #define TABLES_PER_PAGE 2 | ||
36 | #define FRAG_MASK 3UL | ||
37 | #define SECOND_HALVES 2UL | ||
31 | #endif | 38 | #endif |
32 | 39 | ||
33 | unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec) | 40 | unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec) |
@@ -45,52 +52,179 @@ unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec) | |||
45 | } | 52 | } |
46 | page->index = page_to_phys(shadow); | 53 | page->index = page_to_phys(shadow); |
47 | } | 54 | } |
55 | spin_lock(&mm->page_table_lock); | ||
56 | list_add(&page->lru, &mm->context.crst_list); | ||
57 | spin_unlock(&mm->page_table_lock); | ||
48 | return (unsigned long *) page_to_phys(page); | 58 | return (unsigned long *) page_to_phys(page); |
49 | } | 59 | } |
50 | 60 | ||
51 | void crst_table_free(unsigned long *table) | 61 | void crst_table_free(struct mm_struct *mm, unsigned long *table) |
52 | { | 62 | { |
53 | unsigned long *shadow = get_shadow_table(table); | 63 | unsigned long *shadow = get_shadow_table(table); |
64 | struct page *page = virt_to_page(table); | ||
54 | 65 | ||
66 | spin_lock(&mm->page_table_lock); | ||
67 | list_del(&page->lru); | ||
68 | spin_unlock(&mm->page_table_lock); | ||
55 | if (shadow) | 69 | if (shadow) |
56 | free_pages((unsigned long) shadow, ALLOC_ORDER); | 70 | free_pages((unsigned long) shadow, ALLOC_ORDER); |
57 | free_pages((unsigned long) table, ALLOC_ORDER); | 71 | free_pages((unsigned long) table, ALLOC_ORDER); |
58 | } | 72 | } |
59 | 73 | ||
74 | #ifdef CONFIG_64BIT | ||
75 | int crst_table_upgrade(struct mm_struct *mm, unsigned long limit) | ||
76 | { | ||
77 | unsigned long *table, *pgd; | ||
78 | unsigned long entry; | ||
79 | |||
80 | BUG_ON(limit > (1UL << 53)); | ||
81 | repeat: | ||
82 | table = crst_table_alloc(mm, mm->context.noexec); | ||
83 | if (!table) | ||
84 | return -ENOMEM; | ||
85 | spin_lock(&mm->page_table_lock); | ||
86 | if (mm->context.asce_limit < limit) { | ||
87 | pgd = (unsigned long *) mm->pgd; | ||
88 | if (mm->context.asce_limit <= (1UL << 31)) { | ||
89 | entry = _REGION3_ENTRY_EMPTY; | ||
90 | mm->context.asce_limit = 1UL << 42; | ||
91 | mm->context.asce_bits = _ASCE_TABLE_LENGTH | | ||
92 | _ASCE_USER_BITS | | ||
93 | _ASCE_TYPE_REGION3; | ||
94 | } else { | ||
95 | entry = _REGION2_ENTRY_EMPTY; | ||
96 | mm->context.asce_limit = 1UL << 53; | ||
97 | mm->context.asce_bits = _ASCE_TABLE_LENGTH | | ||
98 | _ASCE_USER_BITS | | ||
99 | _ASCE_TYPE_REGION2; | ||
100 | } | ||
101 | crst_table_init(table, entry); | ||
102 | pgd_populate(mm, (pgd_t *) table, (pud_t *) pgd); | ||
103 | mm->pgd = (pgd_t *) table; | ||
104 | table = NULL; | ||
105 | } | ||
106 | spin_unlock(&mm->page_table_lock); | ||
107 | if (table) | ||
108 | crst_table_free(mm, table); | ||
109 | if (mm->context.asce_limit < limit) | ||
110 | goto repeat; | ||
111 | update_mm(mm, current); | ||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | void crst_table_downgrade(struct mm_struct *mm, unsigned long limit) | ||
116 | { | ||
117 | pgd_t *pgd; | ||
118 | |||
119 | if (mm->context.asce_limit <= limit) | ||
120 | return; | ||
121 | __tlb_flush_mm(mm); | ||
122 | while (mm->context.asce_limit > limit) { | ||
123 | pgd = mm->pgd; | ||
124 | switch (pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) { | ||
125 | case _REGION_ENTRY_TYPE_R2: | ||
126 | mm->context.asce_limit = 1UL << 42; | ||
127 | mm->context.asce_bits = _ASCE_TABLE_LENGTH | | ||
128 | _ASCE_USER_BITS | | ||
129 | _ASCE_TYPE_REGION3; | ||
130 | break; | ||
131 | case _REGION_ENTRY_TYPE_R3: | ||
132 | mm->context.asce_limit = 1UL << 31; | ||
133 | mm->context.asce_bits = _ASCE_TABLE_LENGTH | | ||
134 | _ASCE_USER_BITS | | ||
135 | _ASCE_TYPE_SEGMENT; | ||
136 | break; | ||
137 | default: | ||
138 | BUG(); | ||
139 | } | ||
140 | mm->pgd = (pgd_t *) (pgd_val(*pgd) & _REGION_ENTRY_ORIGIN); | ||
141 | crst_table_free(mm, (unsigned long *) pgd); | ||
142 | } | ||
143 | update_mm(mm, current); | ||
144 | } | ||
145 | #endif | ||
146 | |||
60 | /* | 147 | /* |
61 | * page table entry allocation/free routines. | 148 | * page table entry allocation/free routines. |
62 | */ | 149 | */ |
63 | unsigned long *page_table_alloc(int noexec) | 150 | unsigned long *page_table_alloc(struct mm_struct *mm) |
64 | { | 151 | { |
65 | struct page *page = alloc_page(GFP_KERNEL); | 152 | struct page *page; |
66 | unsigned long *table; | 153 | unsigned long *table; |
154 | unsigned long bits; | ||
67 | 155 | ||
68 | if (!page) | 156 | bits = mm->context.noexec ? 3UL : 1UL; |
69 | return NULL; | 157 | spin_lock(&mm->page_table_lock); |
70 | page->index = 0; | 158 | page = NULL; |
71 | if (noexec) { | 159 | if (!list_empty(&mm->context.pgtable_list)) { |
72 | struct page *shadow = alloc_page(GFP_KERNEL); | 160 | page = list_first_entry(&mm->context.pgtable_list, |
73 | if (!shadow) { | 161 | struct page, lru); |
74 | __free_page(page); | 162 | if ((page->flags & FRAG_MASK) == ((1UL << TABLES_PER_PAGE) - 1)) |
163 | page = NULL; | ||
164 | } | ||
165 | if (!page) { | ||
166 | spin_unlock(&mm->page_table_lock); | ||
167 | page = alloc_page(GFP_KERNEL|__GFP_REPEAT); | ||
168 | if (!page) | ||
75 | return NULL; | 169 | return NULL; |
76 | } | 170 | pgtable_page_ctor(page); |
77 | table = (unsigned long *) page_to_phys(shadow); | 171 | page->flags &= ~FRAG_MASK; |
172 | table = (unsigned long *) page_to_phys(page); | ||
78 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); | 173 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); |
79 | page->index = (addr_t) table; | 174 | spin_lock(&mm->page_table_lock); |
175 | list_add(&page->lru, &mm->context.pgtable_list); | ||
80 | } | 176 | } |
81 | pgtable_page_ctor(page); | ||
82 | table = (unsigned long *) page_to_phys(page); | 177 | table = (unsigned long *) page_to_phys(page); |
83 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); | 178 | while (page->flags & bits) { |
179 | table += 256; | ||
180 | bits <<= 1; | ||
181 | } | ||
182 | page->flags |= bits; | ||
183 | if ((page->flags & FRAG_MASK) == ((1UL << TABLES_PER_PAGE) - 1)) | ||
184 | list_move_tail(&page->lru, &mm->context.pgtable_list); | ||
185 | spin_unlock(&mm->page_table_lock); | ||
84 | return table; | 186 | return table; |
85 | } | 187 | } |
86 | 188 | ||
87 | void page_table_free(unsigned long *table) | 189 | void page_table_free(struct mm_struct *mm, unsigned long *table) |
88 | { | 190 | { |
89 | unsigned long *shadow = get_shadow_pte(table); | 191 | struct page *page; |
192 | unsigned long bits; | ||
90 | 193 | ||
91 | pgtable_page_dtor(virt_to_page(table)); | 194 | bits = mm->context.noexec ? 3UL : 1UL; |
92 | if (shadow) | 195 | bits <<= (__pa(table) & (PAGE_SIZE - 1)) / 256 / sizeof(unsigned long); |
93 | free_page((unsigned long) shadow); | 196 | page = pfn_to_page(__pa(table) >> PAGE_SHIFT); |
94 | free_page((unsigned long) table); | 197 | spin_lock(&mm->page_table_lock); |
198 | page->flags ^= bits; | ||
199 | if (page->flags & FRAG_MASK) { | ||
200 | /* Page now has some free pgtable fragments. */ | ||
201 | list_move(&page->lru, &mm->context.pgtable_list); | ||
202 | page = NULL; | ||
203 | } else | ||
204 | /* All fragments of the 4K page have been freed. */ | ||
205 | list_del(&page->lru); | ||
206 | spin_unlock(&mm->page_table_lock); | ||
207 | if (page) { | ||
208 | pgtable_page_dtor(page); | ||
209 | __free_page(page); | ||
210 | } | ||
211 | } | ||
95 | 212 | ||
213 | void disable_noexec(struct mm_struct *mm, struct task_struct *tsk) | ||
214 | { | ||
215 | struct page *page; | ||
216 | |||
217 | spin_lock(&mm->page_table_lock); | ||
218 | /* Free shadow region and segment tables. */ | ||
219 | list_for_each_entry(page, &mm->context.crst_list, lru) | ||
220 | if (page->index) { | ||
221 | free_pages((unsigned long) page->index, ALLOC_ORDER); | ||
222 | page->index = 0; | ||
223 | } | ||
224 | /* "Free" second halves of page tables. */ | ||
225 | list_for_each_entry(page, &mm->context.pgtable_list, lru) | ||
226 | page->flags &= ~SECOND_HALVES; | ||
227 | spin_unlock(&mm->page_table_lock); | ||
228 | mm->context.noexec = 0; | ||
229 | update_mm(mm, tsk); | ||
96 | } | 230 | } |
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c index 7c1287ccf788..35d90a4720fd 100644 --- a/arch/s390/mm/vmem.c +++ b/arch/s390/mm/vmem.c | |||
@@ -69,7 +69,19 @@ static void __ref *vmem_alloc_pages(unsigned int order) | |||
69 | return alloc_bootmem_pages((1 << order) * PAGE_SIZE); | 69 | return alloc_bootmem_pages((1 << order) * PAGE_SIZE); |
70 | } | 70 | } |
71 | 71 | ||
72 | #define vmem_pud_alloc() ({ BUG(); ((pud_t *) NULL); }) | 72 | static inline pud_t *vmem_pud_alloc(void) |
73 | { | ||
74 | pud_t *pud = NULL; | ||
75 | |||
76 | #ifdef CONFIG_64BIT | ||
77 | pud = vmem_alloc_pages(2); | ||
78 | if (!pud) | ||
79 | return NULL; | ||
80 | pud_val(*pud) = _REGION3_ENTRY_EMPTY; | ||
81 | memcpy(pud + 1, pud, (PTRS_PER_PUD - 1)*sizeof(pud_t)); | ||
82 | #endif | ||
83 | return pud; | ||
84 | } | ||
73 | 85 | ||
74 | static inline pmd_t *vmem_pmd_alloc(void) | 86 | static inline pmd_t *vmem_pmd_alloc(void) |
75 | { | 87 | { |
@@ -84,13 +96,18 @@ static inline pmd_t *vmem_pmd_alloc(void) | |||
84 | return pmd; | 96 | return pmd; |
85 | } | 97 | } |
86 | 98 | ||
87 | static inline pte_t *vmem_pte_alloc(void) | 99 | static pte_t __init_refok *vmem_pte_alloc(void) |
88 | { | 100 | { |
89 | pte_t *pte = vmem_alloc_pages(0); | 101 | pte_t *pte; |
90 | 102 | ||
103 | if (slab_is_available()) | ||
104 | pte = (pte_t *) page_table_alloc(&init_mm); | ||
105 | else | ||
106 | pte = alloc_bootmem(PTRS_PER_PTE * sizeof(pte_t)); | ||
91 | if (!pte) | 107 | if (!pte) |
92 | return NULL; | 108 | return NULL; |
93 | clear_table((unsigned long *) pte, _PAGE_TYPE_EMPTY, PAGE_SIZE); | 109 | clear_table((unsigned long *) pte, _PAGE_TYPE_EMPTY, |
110 | PTRS_PER_PTE * sizeof(pte_t)); | ||
94 | return pte; | 111 | return pte; |
95 | } | 112 | } |
96 | 113 | ||
@@ -360,6 +377,9 @@ void __init vmem_map_init(void) | |||
360 | { | 377 | { |
361 | int i; | 378 | int i; |
362 | 379 | ||
380 | INIT_LIST_HEAD(&init_mm.context.crst_list); | ||
381 | INIT_LIST_HEAD(&init_mm.context.pgtable_list); | ||
382 | init_mm.context.noexec = 0; | ||
363 | NODE_DATA(0)->node_mem_map = VMEM_MAP; | 383 | NODE_DATA(0)->node_mem_map = VMEM_MAP; |
364 | for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) | 384 | for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) |
365 | vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size); | 385 | vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size); |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 6e035d1cf789..d87d4bf88803 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "Linux/SuperH Kernel Configuration" | |||
8 | config SUPERH | 8 | config SUPERH |
9 | def_bool y | 9 | def_bool y |
10 | select EMBEDDED | 10 | select EMBEDDED |
11 | select HAVE_IDE | ||
11 | select HAVE_OPROFILE | 12 | select HAVE_OPROFILE |
12 | help | 13 | help |
13 | The SuperH is a RISC processor targeted for use in embedded systems | 14 | The SuperH is a RISC processor targeted for use in embedded systems |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 7c674a3503b6..c40343c54920 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -69,6 +69,7 @@ config NR_CPUS | |||
69 | config SPARC | 69 | config SPARC |
70 | bool | 70 | bool |
71 | default y | 71 | default y |
72 | select HAVE_IDE | ||
72 | select HAVE_OPROFILE | 73 | select HAVE_OPROFILE |
73 | 74 | ||
74 | # Identify this as a Sparc32 build | 75 | # Identify this as a Sparc32 build |
diff --git a/arch/sparc/kernel/errtbls.c b/arch/sparc/kernel/errtbls.c index bb36f6eadfee..ed14df7116e9 100644 --- a/arch/sparc/kernel/errtbls.c +++ b/arch/sparc/kernel/errtbls.c | |||
@@ -1,21 +1,18 @@ | |||
1 | /* $Id: errtbls.c,v 1.2 1995/11/25 00:57:55 davem Exp $ | 1 | /* errtbls.c: Error number conversion tables. |
2 | * errtbls.c: Error number conversion tables between various syscall | ||
3 | * OS semantics. | ||
4 | * | 2 | * |
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | 3 | * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) |
6 | * | 4 | * |
7 | * Based upon preliminary work which is: | 5 | * Based upon preliminary work which is: |
8 | * | 6 | * |
9 | * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) | 7 | * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu) |
10 | */ | 8 | */ |
11 | 9 | ||
12 | #include <asm/bsderrno.h> /* NetBSD (bsd4.4) errnos */ | ||
13 | #include <asm/solerrno.h> /* Solaris errnos */ | 10 | #include <asm/solerrno.h> /* Solaris errnos */ |
14 | 11 | ||
15 | /* Here are tables which convert between Linux/SunOS error number | 12 | /* Here is the table which converts between Linux error number values |
16 | * values to the equivalent in other OSs. Note that since the Linux | 13 | * to the equivalent under Solaris. Note that since the Linux ones |
17 | * ones have been set up to match exactly those of SunOS, no | 14 | * have been set up to match exactly those of SunOS, no translation |
18 | * translation table is needed for that OS. | 15 | * table is needed for that OS. |
19 | */ | 16 | */ |
20 | 17 | ||
21 | int solaris_errno[] = { | 18 | int solaris_errno[] = { |
@@ -145,132 +142,3 @@ int solaris_errno[] = { | |||
145 | SOL_ELIBMAX, | 142 | SOL_ELIBMAX, |
146 | SOL_ELIBSCN, | 143 | SOL_ELIBSCN, |
147 | }; | 144 | }; |
148 | |||
149 | int netbsd_errno[] = { | ||
150 | 0, | ||
151 | BSD_EPERM, | ||
152 | BSD_ENOENT, | ||
153 | BSD_ESRCH, | ||
154 | BSD_EINTR, | ||
155 | BSD_EIO, | ||
156 | BSD_ENXIO, | ||
157 | BSD_E2BIG, | ||
158 | BSD_ENOEXEC, | ||
159 | BSD_EBADF, | ||
160 | BSD_ECHILD, | ||
161 | BSD_EAGAIN, | ||
162 | BSD_ENOMEM, | ||
163 | BSD_EACCES, | ||
164 | BSD_EFAULT, | ||
165 | BSD_NOTBLK, | ||
166 | BSD_EBUSY, | ||
167 | BSD_EEXIST, | ||
168 | BSD_EXDEV, | ||
169 | BSD_ENODEV, | ||
170 | BSD_ENOTDIR, | ||
171 | BSD_EISDIR, | ||
172 | BSD_EINVAL, | ||
173 | BSD_ENFILE, | ||
174 | BSD_EMFILE, | ||
175 | BSD_ENOTTY, | ||
176 | BSD_ETXTBSY, | ||
177 | BSD_EFBIG, | ||
178 | BSD_ENOSPC, | ||
179 | BSD_ESPIPE, | ||
180 | BSD_EROFS, | ||
181 | BSD_EMLINK, | ||
182 | BSD_EPIPE, | ||
183 | BSD_EDOM, | ||
184 | BSD_ERANGE, | ||
185 | BSD_EWOULDBLOCK, | ||
186 | BSD_EINPROGRESS, | ||
187 | BSD_EALREADY, | ||
188 | BSD_ENOTSOCK, | ||
189 | BSD_EDESTADDRREQ, | ||
190 | BSD_EMSGSIZE, | ||
191 | BSD_EPROTOTYPE, | ||
192 | BSD_ENOPROTOOPT, | ||
193 | BSD_EPROTONOSUPPORT, | ||
194 | BSD_ESOCKTNOSUPPORT, | ||
195 | BSD_EOPNOTSUPP, | ||
196 | BSD_EPFNOSUPPORT, | ||
197 | BSD_EAFNOSUPPORT, | ||
198 | BSD_EADDRINUSE, | ||
199 | BSD_EADDRNOTAVAIL, | ||
200 | BSD_ENETDOWN, | ||
201 | BSD_ENETUNREACH, | ||
202 | BSD_ENETRESET, | ||
203 | BSD_ECONNABORTED, | ||
204 | BSD_ECONNRESET, | ||
205 | BSD_ENOBUFS, | ||
206 | BSD_EISCONN, | ||
207 | BSD_ENOTONN, | ||
208 | BSD_ESHUTDOWN, | ||
209 | BSD_ETOOMANYREFS, | ||
210 | BSD_ETIMEDOUT, | ||
211 | BSD_ECONNREFUSED, | ||
212 | BSD_ELOOP, | ||
213 | BSD_ENAMETOOLONG, | ||
214 | BSD_EHOSTDOWN, | ||
215 | BSD_EHOSTUNREACH, | ||
216 | BSD_ENOTEMPTY, | ||
217 | BSD_EPROCLIM, | ||
218 | BSD_EUSERS, | ||
219 | BSD_EDQUOT, | ||
220 | BSD_ESTALE, | ||
221 | BSD_EREMOTE, | ||
222 | BSD_ENOSTR, | ||
223 | BSD_ETIME, | ||
224 | BSD_ENOSR, | ||
225 | BSD_ENOMSG, | ||
226 | BSD_EBADMSG, | ||
227 | BSD_IDRM, | ||
228 | BSD_EDEADLK, | ||
229 | BSD_ENOLCK, | ||
230 | BSD_ENONET, | ||
231 | BSD_ERREMOTE, | ||
232 | BSD_ENOLINK, | ||
233 | BSD_EADV, | ||
234 | BSD_ESRMNT, | ||
235 | BSD_ECOMM, | ||
236 | BSD_EPROTO, | ||
237 | BSD_EMULTIHOP, | ||
238 | BSD_EINVAL, /* EDOTDOT XXX??? */ | ||
239 | BSD_REMCHG, | ||
240 | BSD_NOSYS, | ||
241 | BSD_STRPIPE, | ||
242 | BSD_EOVERFLOW, | ||
243 | BSD_EBADFD, | ||
244 | BSD_ECHRNG, | ||
245 | BSD_EL2NSYNC, | ||
246 | BSD_EL3HLT, | ||
247 | BSD_EL3RST, | ||
248 | BSD_NRNG, | ||
249 | BSD_EUNATCH, | ||
250 | BSD_ENOCSI, | ||
251 | BSD_EL2HLT, | ||
252 | BSD_EBADE, | ||
253 | BSD_EBADR, | ||
254 | BSD_EXFULL, | ||
255 | BSD_ENOANO, | ||
256 | BSD_EBADRQC, | ||
257 | BSD_EBADSLT, | ||
258 | BSD_EDEADLOCK, | ||
259 | BSD_EBFONT, | ||
260 | BSD_ELIBEXEC, | ||
261 | BSD_ENODATA, | ||
262 | BSD_ELIBBAD, | ||
263 | BSD_ENOPKG, | ||
264 | BSD_ELIBACC, | ||
265 | BSD_ENOTUNIQ, | ||
266 | BSD_ERESTART, | ||
267 | BSD_EUCLEAN, | ||
268 | BSD_ENOTNAM, | ||
269 | BSD_ENAVAIL, | ||
270 | BSD_EISNAM, | ||
271 | BSD_EREMOTEIO, | ||
272 | BSD_EILSEQ, | ||
273 | BSD_ELIBMAX, | ||
274 | BSD_ELIBSCN, | ||
275 | }; | ||
276 | |||
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c index 3ea000d15e3a..cc4c235c4f59 100644 --- a/arch/sparc/kernel/of_device.c +++ b/arch/sparc/kernel/of_device.c | |||
@@ -584,30 +584,3 @@ static int __init of_debug(char *str) | |||
584 | } | 584 | } |
585 | 585 | ||
586 | __setup("of_debug=", of_debug); | 586 | __setup("of_debug=", of_debug); |
587 | |||
588 | struct of_device* of_platform_device_create(struct device_node *np, | ||
589 | const char *bus_id, | ||
590 | struct device *parent, | ||
591 | struct bus_type *bus) | ||
592 | { | ||
593 | struct of_device *dev; | ||
594 | |||
595 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
596 | if (!dev) | ||
597 | return NULL; | ||
598 | |||
599 | dev->dev.parent = parent; | ||
600 | dev->dev.bus = bus; | ||
601 | dev->dev.release = of_release_dev; | ||
602 | |||
603 | strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE); | ||
604 | |||
605 | if (of_device_register(dev) != 0) { | ||
606 | kfree(dev); | ||
607 | return NULL; | ||
608 | } | ||
609 | |||
610 | return dev; | ||
611 | } | ||
612 | |||
613 | EXPORT_SYMBOL(of_platform_device_create); | ||
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index 216147d6e61f..b1002c607196 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S | |||
@@ -89,6 +89,10 @@ SECTIONS | |||
89 | .data.cacheline_aligned : { | 89 | .data.cacheline_aligned : { |
90 | *(.data.cacheline_aligned) | 90 | *(.data.cacheline_aligned) |
91 | } | 91 | } |
92 | . = ALIGN(32); | ||
93 | .data.read_mostly : { | ||
94 | *(.data.read_mostly) | ||
95 | } | ||
92 | 96 | ||
93 | __bss_start = .; | 97 | __bss_start = .; |
94 | .sbss : { | 98 | .sbss : { |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index b810f2b7526a..3af378ddb6ae 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -14,6 +14,7 @@ config SPARC | |||
14 | config SPARC64 | 14 | config SPARC64 |
15 | bool | 15 | bool |
16 | default y | 16 | default y |
17 | select HAVE_IDE | ||
17 | help | 18 | help |
18 | SPARC is a family of RISC microprocessors designed and marketed by | 19 | SPARC is a family of RISC microprocessors designed and marketed by |
19 | Sun Microsystems, incorporated. This port covers the newer 64-bit | 20 | Sun Microsystems, incorporated. This port covers the newer 64-bit |
@@ -40,6 +41,10 @@ config MMU | |||
40 | bool | 41 | bool |
41 | default y | 42 | default y |
42 | 43 | ||
44 | config IOMMU_HELPER | ||
45 | bool | ||
46 | default y | ||
47 | |||
43 | config QUICKLIST | 48 | config QUICKLIST |
44 | bool | 49 | bool |
45 | default y | 50 | default y |
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c index 5623a4d59dff..d3276ebcfb47 100644 --- a/arch/sparc64/kernel/iommu.c +++ b/arch/sparc64/kernel/iommu.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* iommu.c: Generic sparc64 IOMMU support. | 1 | /* iommu.c: Generic sparc64 IOMMU support. |
2 | * | 2 | * |
3 | * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net) | 3 | * Copyright (C) 1999, 2007, 2008 David S. Miller (davem@davemloft.net) |
4 | * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) | 4 | * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) |
5 | */ | 5 | */ |
6 | 6 | ||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/device.h> | 10 | #include <linux/device.h> |
11 | #include <linux/dma-mapping.h> | 11 | #include <linux/dma-mapping.h> |
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <linux/iommu-helper.h> | ||
13 | 14 | ||
14 | #ifdef CONFIG_PCI | 15 | #ifdef CONFIG_PCI |
15 | #include <linux/pci.h> | 16 | #include <linux/pci.h> |
@@ -41,7 +42,7 @@ | |||
41 | "i" (ASI_PHYS_BYPASS_EC_E)) | 42 | "i" (ASI_PHYS_BYPASS_EC_E)) |
42 | 43 | ||
43 | /* Must be invoked under the IOMMU lock. */ | 44 | /* Must be invoked under the IOMMU lock. */ |
44 | static void __iommu_flushall(struct iommu *iommu) | 45 | static void iommu_flushall(struct iommu *iommu) |
45 | { | 46 | { |
46 | if (iommu->iommu_flushinv) { | 47 | if (iommu->iommu_flushinv) { |
47 | iommu_write(iommu->iommu_flushinv, ~(u64)0); | 48 | iommu_write(iommu->iommu_flushinv, ~(u64)0); |
@@ -83,54 +84,91 @@ static inline void iopte_make_dummy(struct iommu *iommu, iopte_t *iopte) | |||
83 | iopte_val(*iopte) = val; | 84 | iopte_val(*iopte) = val; |
84 | } | 85 | } |
85 | 86 | ||
86 | /* Based largely upon the ppc64 iommu allocator. */ | 87 | /* Based almost entirely upon the ppc64 iommu allocator. If you use the 'handle' |
87 | static long arena_alloc(struct iommu *iommu, unsigned long npages) | 88 | * facility it must all be done in one pass while under the iommu lock. |
89 | * | ||
90 | * On sun4u platforms, we only flush the IOMMU once every time we've passed | ||
91 | * over the entire page table doing allocations. Therefore we only ever advance | ||
92 | * the hint and cannot backtrack it. | ||
93 | */ | ||
94 | unsigned long iommu_range_alloc(struct device *dev, | ||
95 | struct iommu *iommu, | ||
96 | unsigned long npages, | ||
97 | unsigned long *handle) | ||
88 | { | 98 | { |
99 | unsigned long n, end, start, limit, boundary_size; | ||
89 | struct iommu_arena *arena = &iommu->arena; | 100 | struct iommu_arena *arena = &iommu->arena; |
90 | unsigned long n, i, start, end, limit; | 101 | int pass = 0; |
91 | int pass; | 102 | |
103 | /* This allocator was derived from x86_64's bit string search */ | ||
104 | |||
105 | /* Sanity check */ | ||
106 | if (unlikely(npages == 0)) { | ||
107 | if (printk_ratelimit()) | ||
108 | WARN_ON(1); | ||
109 | return DMA_ERROR_CODE; | ||
110 | } | ||
111 | |||
112 | if (handle && *handle) | ||
113 | start = *handle; | ||
114 | else | ||
115 | start = arena->hint; | ||
92 | 116 | ||
93 | limit = arena->limit; | 117 | limit = arena->limit; |
94 | start = arena->hint; | ||
95 | pass = 0; | ||
96 | 118 | ||
97 | again: | 119 | /* The case below can happen if we have a small segment appended |
98 | n = find_next_zero_bit(arena->map, limit, start); | 120 | * to a large, or when the previous alloc was at the very end of |
99 | end = n + npages; | 121 | * the available space. If so, go back to the beginning and flush. |
100 | if (unlikely(end >= limit)) { | 122 | */ |
123 | if (start >= limit) { | ||
124 | start = 0; | ||
125 | if (iommu->flush_all) | ||
126 | iommu->flush_all(iommu); | ||
127 | } | ||
128 | |||
129 | again: | ||
130 | |||
131 | if (dev) | ||
132 | boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, | ||
133 | 1 << IO_PAGE_SHIFT); | ||
134 | else | ||
135 | boundary_size = ALIGN(1UL << 32, 1 << IO_PAGE_SHIFT); | ||
136 | |||
137 | n = iommu_area_alloc(arena->map, limit, start, npages, 0, | ||
138 | boundary_size >> IO_PAGE_SHIFT, 0); | ||
139 | if (n == -1) { | ||
101 | if (likely(pass < 1)) { | 140 | if (likely(pass < 1)) { |
102 | limit = start; | 141 | /* First failure, rescan from the beginning. */ |
103 | start = 0; | 142 | start = 0; |
104 | __iommu_flushall(iommu); | 143 | if (iommu->flush_all) |
144 | iommu->flush_all(iommu); | ||
105 | pass++; | 145 | pass++; |
106 | goto again; | 146 | goto again; |
107 | } else { | 147 | } else { |
108 | /* Scanned the whole thing, give up. */ | 148 | /* Second failure, give up */ |
109 | return -1; | 149 | return DMA_ERROR_CODE; |
110 | } | ||
111 | } | ||
112 | |||
113 | for (i = n; i < end; i++) { | ||
114 | if (test_bit(i, arena->map)) { | ||
115 | start = i + 1; | ||
116 | goto again; | ||
117 | } | 150 | } |
118 | } | 151 | } |
119 | 152 | ||
120 | for (i = n; i < end; i++) | 153 | end = n + npages; |
121 | __set_bit(i, arena->map); | ||
122 | 154 | ||
123 | arena->hint = end; | 155 | arena->hint = end; |
124 | 156 | ||
157 | /* Update handle for SG allocations */ | ||
158 | if (handle) | ||
159 | *handle = end; | ||
160 | |||
125 | return n; | 161 | return n; |
126 | } | 162 | } |
127 | 163 | ||
128 | static void arena_free(struct iommu_arena *arena, unsigned long base, unsigned long npages) | 164 | void iommu_range_free(struct iommu *iommu, dma_addr_t dma_addr, unsigned long npages) |
129 | { | 165 | { |
130 | unsigned long i; | 166 | struct iommu_arena *arena = &iommu->arena; |
167 | unsigned long entry; | ||
131 | 168 | ||
132 | for (i = base; i < (base + npages); i++) | 169 | entry = (dma_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT; |
133 | __clear_bit(i, arena->map); | 170 | |
171 | iommu_area_free(arena->map, entry, npages); | ||
134 | } | 172 | } |
135 | 173 | ||
136 | int iommu_table_init(struct iommu *iommu, int tsbsize, | 174 | int iommu_table_init(struct iommu *iommu, int tsbsize, |
@@ -156,6 +194,9 @@ int iommu_table_init(struct iommu *iommu, int tsbsize, | |||
156 | } | 194 | } |
157 | iommu->arena.limit = num_tsb_entries; | 195 | iommu->arena.limit = num_tsb_entries; |
158 | 196 | ||
197 | if (tlb_type != hypervisor) | ||
198 | iommu->flush_all = iommu_flushall; | ||
199 | |||
159 | /* Allocate and initialize the dummy page which we | 200 | /* Allocate and initialize the dummy page which we |
160 | * set inactive IO PTEs to point to. | 201 | * set inactive IO PTEs to point to. |
161 | */ | 202 | */ |
@@ -192,22 +233,18 @@ out_free_map: | |||
192 | return -ENOMEM; | 233 | return -ENOMEM; |
193 | } | 234 | } |
194 | 235 | ||
195 | static inline iopte_t *alloc_npages(struct iommu *iommu, unsigned long npages) | 236 | static inline iopte_t *alloc_npages(struct device *dev, struct iommu *iommu, |
237 | unsigned long npages) | ||
196 | { | 238 | { |
197 | long entry; | 239 | unsigned long entry; |
198 | 240 | ||
199 | entry = arena_alloc(iommu, npages); | 241 | entry = iommu_range_alloc(dev, iommu, npages, NULL); |
200 | if (unlikely(entry < 0)) | 242 | if (unlikely(entry == DMA_ERROR_CODE)) |
201 | return NULL; | 243 | return NULL; |
202 | 244 | ||
203 | return iommu->page_table + entry; | 245 | return iommu->page_table + entry; |
204 | } | 246 | } |
205 | 247 | ||
206 | static inline void free_npages(struct iommu *iommu, dma_addr_t base, unsigned long npages) | ||
207 | { | ||
208 | arena_free(&iommu->arena, base >> IO_PAGE_SHIFT, npages); | ||
209 | } | ||
210 | |||
211 | static int iommu_alloc_ctx(struct iommu *iommu) | 248 | static int iommu_alloc_ctx(struct iommu *iommu) |
212 | { | 249 | { |
213 | int lowest = iommu->ctx_lowest_free; | 250 | int lowest = iommu->ctx_lowest_free; |
@@ -258,7 +295,7 @@ static void *dma_4u_alloc_coherent(struct device *dev, size_t size, | |||
258 | iommu = dev->archdata.iommu; | 295 | iommu = dev->archdata.iommu; |
259 | 296 | ||
260 | spin_lock_irqsave(&iommu->lock, flags); | 297 | spin_lock_irqsave(&iommu->lock, flags); |
261 | iopte = alloc_npages(iommu, size >> IO_PAGE_SHIFT); | 298 | iopte = alloc_npages(dev, iommu, size >> IO_PAGE_SHIFT); |
262 | spin_unlock_irqrestore(&iommu->lock, flags); | 299 | spin_unlock_irqrestore(&iommu->lock, flags); |
263 | 300 | ||
264 | if (unlikely(iopte == NULL)) { | 301 | if (unlikely(iopte == NULL)) { |
@@ -296,7 +333,7 @@ static void dma_4u_free_coherent(struct device *dev, size_t size, | |||
296 | 333 | ||
297 | spin_lock_irqsave(&iommu->lock, flags); | 334 | spin_lock_irqsave(&iommu->lock, flags); |
298 | 335 | ||
299 | free_npages(iommu, dvma - iommu->page_table_map_base, npages); | 336 | iommu_range_free(iommu, dvma, npages); |
300 | 337 | ||
301 | spin_unlock_irqrestore(&iommu->lock, flags); | 338 | spin_unlock_irqrestore(&iommu->lock, flags); |
302 | 339 | ||
@@ -327,7 +364,7 @@ static dma_addr_t dma_4u_map_single(struct device *dev, void *ptr, size_t sz, | |||
327 | npages >>= IO_PAGE_SHIFT; | 364 | npages >>= IO_PAGE_SHIFT; |
328 | 365 | ||
329 | spin_lock_irqsave(&iommu->lock, flags); | 366 | spin_lock_irqsave(&iommu->lock, flags); |
330 | base = alloc_npages(iommu, npages); | 367 | base = alloc_npages(dev, iommu, npages); |
331 | ctx = 0; | 368 | ctx = 0; |
332 | if (iommu->iommu_ctxflush) | 369 | if (iommu->iommu_ctxflush) |
333 | ctx = iommu_alloc_ctx(iommu); | 370 | ctx = iommu_alloc_ctx(iommu); |
@@ -465,7 +502,7 @@ static void dma_4u_unmap_single(struct device *dev, dma_addr_t bus_addr, | |||
465 | for (i = 0; i < npages; i++) | 502 | for (i = 0; i < npages; i++) |
466 | iopte_make_dummy(iommu, base + i); | 503 | iopte_make_dummy(iommu, base + i); |
467 | 504 | ||
468 | free_npages(iommu, bus_addr - iommu->page_table_map_base, npages); | 505 | iommu_range_free(iommu, bus_addr, npages); |
469 | 506 | ||
470 | iommu_free_ctx(iommu, ctx); | 507 | iommu_free_ctx(iommu, ctx); |
471 | 508 | ||
@@ -475,124 +512,209 @@ static void dma_4u_unmap_single(struct device *dev, dma_addr_t bus_addr, | |||
475 | static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, | 512 | static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist, |
476 | int nelems, enum dma_data_direction direction) | 513 | int nelems, enum dma_data_direction direction) |
477 | { | 514 | { |
478 | unsigned long flags, ctx, i, npages, iopte_protection; | 515 | struct scatterlist *s, *outs, *segstart; |
479 | struct scatterlist *sg; | 516 | unsigned long flags, handle, prot, ctx; |
517 | dma_addr_t dma_next = 0, dma_addr; | ||
518 | unsigned int max_seg_size; | ||
519 | int outcount, incount, i; | ||
480 | struct strbuf *strbuf; | 520 | struct strbuf *strbuf; |
481 | struct iommu *iommu; | 521 | struct iommu *iommu; |
482 | iopte_t *base; | 522 | |
483 | u32 dma_base; | 523 | BUG_ON(direction == DMA_NONE); |
484 | |||
485 | /* Fast path single entry scatterlists. */ | ||
486 | if (nelems == 1) { | ||
487 | sglist->dma_address = | ||
488 | dma_4u_map_single(dev, sg_virt(sglist), | ||
489 | sglist->length, direction); | ||
490 | if (unlikely(sglist->dma_address == DMA_ERROR_CODE)) | ||
491 | return 0; | ||
492 | sglist->dma_length = sglist->length; | ||
493 | return 1; | ||
494 | } | ||
495 | 524 | ||
496 | iommu = dev->archdata.iommu; | 525 | iommu = dev->archdata.iommu; |
497 | strbuf = dev->archdata.stc; | 526 | strbuf = dev->archdata.stc; |
498 | 527 | if (nelems == 0 || !iommu) | |
499 | if (unlikely(direction == DMA_NONE)) | 528 | return 0; |
500 | goto bad_no_ctx; | ||
501 | |||
502 | npages = calc_npages(sglist, nelems); | ||
503 | 529 | ||
504 | spin_lock_irqsave(&iommu->lock, flags); | 530 | spin_lock_irqsave(&iommu->lock, flags); |
505 | 531 | ||
506 | base = alloc_npages(iommu, npages); | ||
507 | ctx = 0; | 532 | ctx = 0; |
508 | if (iommu->iommu_ctxflush) | 533 | if (iommu->iommu_ctxflush) |
509 | ctx = iommu_alloc_ctx(iommu); | 534 | ctx = iommu_alloc_ctx(iommu); |
510 | 535 | ||
511 | spin_unlock_irqrestore(&iommu->lock, flags); | ||
512 | |||
513 | if (base == NULL) | ||
514 | goto bad; | ||
515 | |||
516 | dma_base = iommu->page_table_map_base + | ||
517 | ((base - iommu->page_table) << IO_PAGE_SHIFT); | ||
518 | |||
519 | if (strbuf->strbuf_enabled) | 536 | if (strbuf->strbuf_enabled) |
520 | iopte_protection = IOPTE_STREAMING(ctx); | 537 | prot = IOPTE_STREAMING(ctx); |
521 | else | 538 | else |
522 | iopte_protection = IOPTE_CONSISTENT(ctx); | 539 | prot = IOPTE_CONSISTENT(ctx); |
523 | if (direction != DMA_TO_DEVICE) | 540 | if (direction != DMA_TO_DEVICE) |
524 | iopte_protection |= IOPTE_WRITE; | 541 | prot |= IOPTE_WRITE; |
525 | 542 | ||
526 | for_each_sg(sglist, sg, nelems, i) { | 543 | outs = s = segstart = &sglist[0]; |
527 | unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg); | 544 | outcount = 1; |
528 | unsigned long slen = sg->length; | 545 | incount = nelems; |
529 | unsigned long this_npages; | 546 | handle = 0; |
547 | |||
548 | /* Init first segment length for backout at failure */ | ||
549 | outs->dma_length = 0; | ||
550 | |||
551 | max_seg_size = dma_get_max_seg_size(dev); | ||
552 | for_each_sg(sglist, s, nelems, i) { | ||
553 | unsigned long paddr, npages, entry, slen; | ||
554 | iopte_t *base; | ||
555 | |||
556 | slen = s->length; | ||
557 | /* Sanity check */ | ||
558 | if (slen == 0) { | ||
559 | dma_next = 0; | ||
560 | continue; | ||
561 | } | ||
562 | /* Allocate iommu entries for that segment */ | ||
563 | paddr = (unsigned long) SG_ENT_PHYS_ADDRESS(s); | ||
564 | npages = iommu_num_pages(paddr, slen); | ||
565 | entry = iommu_range_alloc(dev, iommu, npages, &handle); | ||
566 | |||
567 | /* Handle failure */ | ||
568 | if (unlikely(entry == DMA_ERROR_CODE)) { | ||
569 | if (printk_ratelimit()) | ||
570 | printk(KERN_INFO "iommu_alloc failed, iommu %p paddr %lx" | ||
571 | " npages %lx\n", iommu, paddr, npages); | ||
572 | goto iommu_map_failed; | ||
573 | } | ||
530 | 574 | ||
531 | this_npages = iommu_num_pages(paddr, slen); | 575 | base = iommu->page_table + entry; |
532 | 576 | ||
533 | sg->dma_address = dma_base | (paddr & ~IO_PAGE_MASK); | 577 | /* Convert entry to a dma_addr_t */ |
534 | sg->dma_length = slen; | 578 | dma_addr = iommu->page_table_map_base + |
579 | (entry << IO_PAGE_SHIFT); | ||
580 | dma_addr |= (s->offset & ~IO_PAGE_MASK); | ||
535 | 581 | ||
582 | /* Insert into HW table */ | ||
536 | paddr &= IO_PAGE_MASK; | 583 | paddr &= IO_PAGE_MASK; |
537 | while (this_npages--) { | 584 | while (npages--) { |
538 | iopte_val(*base) = iopte_protection | paddr; | 585 | iopte_val(*base) = prot | paddr; |
539 | |||
540 | base++; | 586 | base++; |
541 | paddr += IO_PAGE_SIZE; | 587 | paddr += IO_PAGE_SIZE; |
542 | dma_base += IO_PAGE_SIZE; | ||
543 | } | 588 | } |
589 | |||
590 | /* If we are in an open segment, try merging */ | ||
591 | if (segstart != s) { | ||
592 | /* We cannot merge if: | ||
593 | * - allocated dma_addr isn't contiguous to previous allocation | ||
594 | */ | ||
595 | if ((dma_addr != dma_next) || | ||
596 | (outs->dma_length + s->length > max_seg_size)) { | ||
597 | /* Can't merge: create a new segment */ | ||
598 | segstart = s; | ||
599 | outcount++; | ||
600 | outs = sg_next(outs); | ||
601 | } else { | ||
602 | outs->dma_length += s->length; | ||
603 | } | ||
604 | } | ||
605 | |||
606 | if (segstart == s) { | ||
607 | /* This is a new segment, fill entries */ | ||
608 | outs->dma_address = dma_addr; | ||
609 | outs->dma_length = slen; | ||
610 | } | ||
611 | |||
612 | /* Calculate next page pointer for contiguous check */ | ||
613 | dma_next = dma_addr + slen; | ||
544 | } | 614 | } |
545 | 615 | ||
546 | return nelems; | 616 | spin_unlock_irqrestore(&iommu->lock, flags); |
617 | |||
618 | if (outcount < incount) { | ||
619 | outs = sg_next(outs); | ||
620 | outs->dma_address = DMA_ERROR_CODE; | ||
621 | outs->dma_length = 0; | ||
622 | } | ||
623 | |||
624 | return outcount; | ||
625 | |||
626 | iommu_map_failed: | ||
627 | for_each_sg(sglist, s, nelems, i) { | ||
628 | if (s->dma_length != 0) { | ||
629 | unsigned long vaddr, npages, entry, i; | ||
630 | iopte_t *base; | ||
631 | |||
632 | vaddr = s->dma_address & IO_PAGE_MASK; | ||
633 | npages = iommu_num_pages(s->dma_address, s->dma_length); | ||
634 | iommu_range_free(iommu, vaddr, npages); | ||
635 | |||
636 | entry = (vaddr - iommu->page_table_map_base) | ||
637 | >> IO_PAGE_SHIFT; | ||
638 | base = iommu->page_table + entry; | ||
639 | |||
640 | for (i = 0; i < npages; i++) | ||
641 | iopte_make_dummy(iommu, base + i); | ||
642 | |||
643 | s->dma_address = DMA_ERROR_CODE; | ||
644 | s->dma_length = 0; | ||
645 | } | ||
646 | if (s == outs) | ||
647 | break; | ||
648 | } | ||
649 | spin_unlock_irqrestore(&iommu->lock, flags); | ||
547 | 650 | ||
548 | bad: | ||
549 | iommu_free_ctx(iommu, ctx); | ||
550 | bad_no_ctx: | ||
551 | if (printk_ratelimit()) | ||
552 | WARN_ON(1); | ||
553 | return 0; | 651 | return 0; |
554 | } | 652 | } |
555 | 653 | ||
654 | /* If contexts are being used, they are the same in all of the mappings | ||
655 | * we make for a particular SG. | ||
656 | */ | ||
657 | static unsigned long fetch_sg_ctx(struct iommu *iommu, struct scatterlist *sg) | ||
658 | { | ||
659 | unsigned long ctx = 0; | ||
660 | |||
661 | if (iommu->iommu_ctxflush) { | ||
662 | iopte_t *base; | ||
663 | u32 bus_addr; | ||
664 | |||
665 | bus_addr = sg->dma_address & IO_PAGE_MASK; | ||
666 | base = iommu->page_table + | ||
667 | ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); | ||
668 | |||
669 | ctx = (iopte_val(*base) & IOPTE_CONTEXT) >> 47UL; | ||
670 | } | ||
671 | return ctx; | ||
672 | } | ||
673 | |||
556 | static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist, | 674 | static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist, |
557 | int nelems, enum dma_data_direction direction) | 675 | int nelems, enum dma_data_direction direction) |
558 | { | 676 | { |
559 | unsigned long flags, ctx, i, npages; | 677 | unsigned long flags, ctx; |
678 | struct scatterlist *sg; | ||
560 | struct strbuf *strbuf; | 679 | struct strbuf *strbuf; |
561 | struct iommu *iommu; | 680 | struct iommu *iommu; |
562 | iopte_t *base; | ||
563 | u32 bus_addr; | ||
564 | 681 | ||
565 | if (unlikely(direction == DMA_NONE)) { | 682 | BUG_ON(direction == DMA_NONE); |
566 | if (printk_ratelimit()) | ||
567 | WARN_ON(1); | ||
568 | } | ||
569 | 683 | ||
570 | iommu = dev->archdata.iommu; | 684 | iommu = dev->archdata.iommu; |
571 | strbuf = dev->archdata.stc; | 685 | strbuf = dev->archdata.stc; |
572 | 686 | ||
573 | bus_addr = sglist->dma_address & IO_PAGE_MASK; | 687 | ctx = fetch_sg_ctx(iommu, sglist); |
574 | 688 | ||
575 | npages = calc_npages(sglist, nelems); | 689 | spin_lock_irqsave(&iommu->lock, flags); |
576 | 690 | ||
577 | base = iommu->page_table + | 691 | sg = sglist; |
578 | ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); | 692 | while (nelems--) { |
693 | dma_addr_t dma_handle = sg->dma_address; | ||
694 | unsigned int len = sg->dma_length; | ||
695 | unsigned long npages, entry; | ||
696 | iopte_t *base; | ||
697 | int i; | ||
579 | 698 | ||
580 | spin_lock_irqsave(&iommu->lock, flags); | 699 | if (!len) |
700 | break; | ||
701 | npages = iommu_num_pages(dma_handle, len); | ||
702 | iommu_range_free(iommu, dma_handle, npages); | ||
581 | 703 | ||
582 | /* Record the context, if any. */ | 704 | entry = ((dma_handle - iommu->page_table_map_base) |
583 | ctx = 0; | 705 | >> IO_PAGE_SHIFT); |
584 | if (iommu->iommu_ctxflush) | 706 | base = iommu->page_table + entry; |
585 | ctx = (iopte_val(*base) & IOPTE_CONTEXT) >> 47UL; | ||
586 | 707 | ||
587 | /* Step 1: Kick data out of streaming buffers if necessary. */ | 708 | dma_handle &= IO_PAGE_MASK; |
588 | if (strbuf->strbuf_enabled) | 709 | if (strbuf->strbuf_enabled) |
589 | strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction); | 710 | strbuf_flush(strbuf, iommu, dma_handle, ctx, |
711 | npages, direction); | ||
590 | 712 | ||
591 | /* Step 2: Clear out the TSB entries. */ | 713 | for (i = 0; i < npages; i++) |
592 | for (i = 0; i < npages; i++) | 714 | iopte_make_dummy(iommu, base + i); |
593 | iopte_make_dummy(iommu, base + i); | ||
594 | 715 | ||
595 | free_npages(iommu, bus_addr - iommu->page_table_map_base, npages); | 716 | sg = sg_next(sg); |
717 | } | ||
596 | 718 | ||
597 | iommu_free_ctx(iommu, ctx); | 719 | iommu_free_ctx(iommu, ctx); |
598 | 720 | ||
diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc64/kernel/iommu_common.h index 4b5cafa2877a..0713bd58499c 100644 --- a/arch/sparc64/kernel/iommu_common.h +++ b/arch/sparc64/kernel/iommu_common.h | |||
@@ -1,9 +1,11 @@ | |||
1 | /* $Id: iommu_common.h,v 1.5 2001/12/11 09:41:01 davem Exp $ | 1 | /* iommu_common.h: UltraSparc SBUS/PCI common iommu declarations. |
2 | * iommu_common.h: UltraSparc SBUS/PCI common iommu declarations. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1999 David S. Miller (davem@redhat.com) | 3 | * Copyright (C) 1999, 2008 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | 5 | ||
6 | #ifndef _IOMMU_COMMON_H | ||
7 | #define _IOMMU_COMMON_H | ||
8 | |||
7 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
8 | #include <linux/types.h> | 10 | #include <linux/types.h> |
9 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
@@ -56,21 +58,12 @@ static inline unsigned long calc_npages(struct scatterlist *sglist, int nelems) | |||
56 | return npages; | 58 | return npages; |
57 | } | 59 | } |
58 | 60 | ||
59 | /* You are _strongly_ advised to enable the following debugging code | 61 | extern unsigned long iommu_range_alloc(struct device *dev, |
60 | * any time you make changes to the sg code below, run it for a while | 62 | struct iommu *iommu, |
61 | * with filesystems mounted read-only before buying the farm... -DaveM | 63 | unsigned long npages, |
62 | */ | 64 | unsigned long *handle); |
63 | #undef VERIFY_SG | 65 | extern void iommu_range_free(struct iommu *iommu, |
64 | 66 | dma_addr_t dma_addr, | |
65 | #ifdef VERIFY_SG | 67 | unsigned long npages); |
66 | extern void verify_sglist(struct scatterlist *sg, int nents, iopte_t *iopte, int npages); | ||
67 | #endif | ||
68 | |||
69 | /* Two addresses are "virtually contiguous" if and only if: | ||
70 | * 1) They are equal, or... | ||
71 | * 2) They are both on a page boundary | ||
72 | */ | ||
73 | #define VCONTIG(__X, __Y) (((__X) == (__Y)) || \ | ||
74 | (((__X) | (__Y)) << (64UL - PAGE_SHIFT)) == 0UL) | ||
75 | 68 | ||
76 | extern unsigned long prepare_sg(struct device *dev, struct scatterlist *sg, int nents); | 69 | #endif /* _IOMMU_COMMON_H */ |
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index d94f901d321e..34fc3ddd5002 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c | |||
@@ -480,8 +480,117 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | |||
480 | return 0; | 480 | return 0; |
481 | } | 481 | } |
482 | 482 | ||
483 | /* architecture specific initialization */ | 483 | /* Called with kretprobe_lock held. The value stored in the return |
484 | int arch_init_kprobes(void) | 484 | * address register is actually 2 instructions before where the |
485 | * callee will return to. Sequences usually look something like this | ||
486 | * | ||
487 | * call some_function <--- return register points here | ||
488 | * nop <--- call delay slot | ||
489 | * whatever <--- where callee returns to | ||
490 | * | ||
491 | * To keep trampoline_probe_handler logic simpler, we normalize the | ||
492 | * value kept in ri->ret_addr so we don't need to keep adjusting it | ||
493 | * back and forth. | ||
494 | */ | ||
495 | void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, | ||
496 | struct pt_regs *regs) | ||
497 | { | ||
498 | ri->ret_addr = (kprobe_opcode_t *)(regs->u_regs[UREG_RETPC] + 8); | ||
499 | |||
500 | /* Replace the return addr with trampoline addr */ | ||
501 | regs->u_regs[UREG_RETPC] = | ||
502 | ((unsigned long)kretprobe_trampoline) - 8; | ||
503 | } | ||
504 | |||
505 | /* | ||
506 | * Called when the probe at kretprobe trampoline is hit | ||
507 | */ | ||
508 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | ||
509 | { | ||
510 | struct kretprobe_instance *ri = NULL; | ||
511 | struct hlist_head *head, empty_rp; | ||
512 | struct hlist_node *node, *tmp; | ||
513 | unsigned long flags, orig_ret_address = 0; | ||
514 | unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; | ||
515 | |||
516 | INIT_HLIST_HEAD(&empty_rp); | ||
517 | spin_lock_irqsave(&kretprobe_lock, flags); | ||
518 | head = kretprobe_inst_table_head(current); | ||
519 | |||
520 | /* | ||
521 | * It is possible to have multiple instances associated with a given | ||
522 | * task either because an multiple functions in the call path | ||
523 | * have a return probe installed on them, and/or more then one return | ||
524 | * return probe was registered for a target function. | ||
525 | * | ||
526 | * We can handle this because: | ||
527 | * - instances are always inserted at the head of the list | ||
528 | * - when multiple return probes are registered for the same | ||
529 | * function, the first instance's ret_addr will point to the | ||
530 | * real return address, and all the rest will point to | ||
531 | * kretprobe_trampoline | ||
532 | */ | ||
533 | hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { | ||
534 | if (ri->task != current) | ||
535 | /* another task is sharing our hash bucket */ | ||
536 | continue; | ||
537 | |||
538 | if (ri->rp && ri->rp->handler) | ||
539 | ri->rp->handler(ri, regs); | ||
540 | |||
541 | orig_ret_address = (unsigned long)ri->ret_addr; | ||
542 | recycle_rp_inst(ri, &empty_rp); | ||
543 | |||
544 | if (orig_ret_address != trampoline_address) | ||
545 | /* | ||
546 | * This is the real return address. Any other | ||
547 | * instances associated with this task are for | ||
548 | * other calls deeper on the call stack | ||
549 | */ | ||
550 | break; | ||
551 | } | ||
552 | |||
553 | kretprobe_assert(ri, orig_ret_address, trampoline_address); | ||
554 | regs->tpc = orig_ret_address; | ||
555 | regs->tnpc = orig_ret_address + 4; | ||
556 | |||
557 | reset_current_kprobe(); | ||
558 | spin_unlock_irqrestore(&kretprobe_lock, flags); | ||
559 | preempt_enable_no_resched(); | ||
560 | |||
561 | hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { | ||
562 | hlist_del(&ri->hlist); | ||
563 | kfree(ri); | ||
564 | } | ||
565 | /* | ||
566 | * By returning a non-zero value, we are telling | ||
567 | * kprobe_handler() that we don't want the post_handler | ||
568 | * to run (and have re-enabled preemption) | ||
569 | */ | ||
570 | return 1; | ||
571 | } | ||
572 | |||
573 | void kretprobe_trampoline_holder(void) | ||
574 | { | ||
575 | asm volatile(".global kretprobe_trampoline\n" | ||
576 | "kretprobe_trampoline:\n" | ||
577 | "\tnop\n" | ||
578 | "\tnop\n"); | ||
579 | } | ||
580 | static struct kprobe trampoline_p = { | ||
581 | .addr = (kprobe_opcode_t *) &kretprobe_trampoline, | ||
582 | .pre_handler = trampoline_probe_handler | ||
583 | }; | ||
584 | |||
585 | int __init arch_init_kprobes(void) | ||
485 | { | 586 | { |
587 | return register_kprobe(&trampoline_p); | ||
588 | } | ||
589 | |||
590 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) | ||
591 | { | ||
592 | if (p->addr == (kprobe_opcode_t *)&kretprobe_trampoline) | ||
593 | return 1; | ||
594 | |||
486 | return 0; | 595 | return 0; |
487 | } | 596 | } |
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index fc5c0cc793b8..0fd9db95b896 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
@@ -868,29 +868,3 @@ static int __init of_debug(char *str) | |||
868 | } | 868 | } |
869 | 869 | ||
870 | __setup("of_debug=", of_debug); | 870 | __setup("of_debug=", of_debug); |
871 | |||
872 | struct of_device* of_platform_device_create(struct device_node *np, | ||
873 | const char *bus_id, | ||
874 | struct device *parent, | ||
875 | struct bus_type *bus) | ||
876 | { | ||
877 | struct of_device *dev; | ||
878 | |||
879 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
880 | if (!dev) | ||
881 | return NULL; | ||
882 | |||
883 | dev->dev.parent = parent; | ||
884 | dev->dev.bus = bus; | ||
885 | dev->dev.release = of_release_dev; | ||
886 | |||
887 | strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE); | ||
888 | |||
889 | if (of_device_register(dev) != 0) { | ||
890 | kfree(dev); | ||
891 | return NULL; | ||
892 | } | ||
893 | |||
894 | return dev; | ||
895 | } | ||
896 | EXPORT_SYMBOL(of_platform_device_create); | ||
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 61baf8dc095e..ddca6c6c0b49 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* pci_sun4v.c: SUN4V specific PCI controller support. | 1 | /* pci_sun4v.c: SUN4V specific PCI controller support. |
2 | * | 2 | * |
3 | * Copyright (C) 2006, 2007 David S. Miller (davem@davemloft.net) | 3 | * Copyright (C) 2006, 2007, 2008 David S. Miller (davem@davemloft.net) |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
@@ -89,6 +89,17 @@ static long iommu_batch_flush(struct iommu_batch *p) | |||
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void iommu_batch_new_entry(unsigned long entry) | ||
93 | { | ||
94 | struct iommu_batch *p = &__get_cpu_var(iommu_batch); | ||
95 | |||
96 | if (p->entry + p->npages == entry) | ||
97 | return; | ||
98 | if (p->entry != ~0UL) | ||
99 | iommu_batch_flush(p); | ||
100 | p->entry = entry; | ||
101 | } | ||
102 | |||
92 | /* Interrupts must be disabled. */ | 103 | /* Interrupts must be disabled. */ |
93 | static inline long iommu_batch_add(u64 phys_page) | 104 | static inline long iommu_batch_add(u64 phys_page) |
94 | { | 105 | { |
@@ -113,54 +124,6 @@ static inline long iommu_batch_end(void) | |||
113 | return iommu_batch_flush(p); | 124 | return iommu_batch_flush(p); |
114 | } | 125 | } |
115 | 126 | ||
116 | static long arena_alloc(struct iommu_arena *arena, unsigned long npages) | ||
117 | { | ||
118 | unsigned long n, i, start, end, limit; | ||
119 | int pass; | ||
120 | |||
121 | limit = arena->limit; | ||
122 | start = arena->hint; | ||
123 | pass = 0; | ||
124 | |||
125 | again: | ||
126 | n = find_next_zero_bit(arena->map, limit, start); | ||
127 | end = n + npages; | ||
128 | if (unlikely(end >= limit)) { | ||
129 | if (likely(pass < 1)) { | ||
130 | limit = start; | ||
131 | start = 0; | ||
132 | pass++; | ||
133 | goto again; | ||
134 | } else { | ||
135 | /* Scanned the whole thing, give up. */ | ||
136 | return -1; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | for (i = n; i < end; i++) { | ||
141 | if (test_bit(i, arena->map)) { | ||
142 | start = i + 1; | ||
143 | goto again; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | for (i = n; i < end; i++) | ||
148 | __set_bit(i, arena->map); | ||
149 | |||
150 | arena->hint = end; | ||
151 | |||
152 | return n; | ||
153 | } | ||
154 | |||
155 | static void arena_free(struct iommu_arena *arena, unsigned long base, | ||
156 | unsigned long npages) | ||
157 | { | ||
158 | unsigned long i; | ||
159 | |||
160 | for (i = base; i < (base + npages); i++) | ||
161 | __clear_bit(i, arena->map); | ||
162 | } | ||
163 | |||
164 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | 127 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, |
165 | dma_addr_t *dma_addrp, gfp_t gfp) | 128 | dma_addr_t *dma_addrp, gfp_t gfp) |
166 | { | 129 | { |
@@ -185,11 +148,11 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | |||
185 | iommu = dev->archdata.iommu; | 148 | iommu = dev->archdata.iommu; |
186 | 149 | ||
187 | spin_lock_irqsave(&iommu->lock, flags); | 150 | spin_lock_irqsave(&iommu->lock, flags); |
188 | entry = arena_alloc(&iommu->arena, npages); | 151 | entry = iommu_range_alloc(dev, iommu, npages, NULL); |
189 | spin_unlock_irqrestore(&iommu->lock, flags); | 152 | spin_unlock_irqrestore(&iommu->lock, flags); |
190 | 153 | ||
191 | if (unlikely(entry < 0L)) | 154 | if (unlikely(entry == DMA_ERROR_CODE)) |
192 | goto arena_alloc_fail; | 155 | goto range_alloc_fail; |
193 | 156 | ||
194 | *dma_addrp = (iommu->page_table_map_base + | 157 | *dma_addrp = (iommu->page_table_map_base + |
195 | (entry << IO_PAGE_SHIFT)); | 158 | (entry << IO_PAGE_SHIFT)); |
@@ -219,10 +182,10 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | |||
219 | iommu_map_fail: | 182 | iommu_map_fail: |
220 | /* Interrupts are disabled. */ | 183 | /* Interrupts are disabled. */ |
221 | spin_lock(&iommu->lock); | 184 | spin_lock(&iommu->lock); |
222 | arena_free(&iommu->arena, entry, npages); | 185 | iommu_range_free(iommu, *dma_addrp, npages); |
223 | spin_unlock_irqrestore(&iommu->lock, flags); | 186 | spin_unlock_irqrestore(&iommu->lock, flags); |
224 | 187 | ||
225 | arena_alloc_fail: | 188 | range_alloc_fail: |
226 | free_pages(first_page, order); | 189 | free_pages(first_page, order); |
227 | return NULL; | 190 | return NULL; |
228 | } | 191 | } |
@@ -243,7 +206,7 @@ static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu, | |||
243 | 206 | ||
244 | spin_lock_irqsave(&iommu->lock, flags); | 207 | spin_lock_irqsave(&iommu->lock, flags); |
245 | 208 | ||
246 | arena_free(&iommu->arena, entry, npages); | 209 | iommu_range_free(iommu, dvma, npages); |
247 | 210 | ||
248 | do { | 211 | do { |
249 | unsigned long num; | 212 | unsigned long num; |
@@ -281,10 +244,10 @@ static dma_addr_t dma_4v_map_single(struct device *dev, void *ptr, size_t sz, | |||
281 | npages >>= IO_PAGE_SHIFT; | 244 | npages >>= IO_PAGE_SHIFT; |
282 | 245 | ||
283 | spin_lock_irqsave(&iommu->lock, flags); | 246 | spin_lock_irqsave(&iommu->lock, flags); |
284 | entry = arena_alloc(&iommu->arena, npages); | 247 | entry = iommu_range_alloc(dev, iommu, npages, NULL); |
285 | spin_unlock_irqrestore(&iommu->lock, flags); | 248 | spin_unlock_irqrestore(&iommu->lock, flags); |
286 | 249 | ||
287 | if (unlikely(entry < 0L)) | 250 | if (unlikely(entry == DMA_ERROR_CODE)) |
288 | goto bad; | 251 | goto bad; |
289 | 252 | ||
290 | bus_addr = (iommu->page_table_map_base + | 253 | bus_addr = (iommu->page_table_map_base + |
@@ -319,7 +282,7 @@ bad: | |||
319 | iommu_map_fail: | 282 | iommu_map_fail: |
320 | /* Interrupts are disabled. */ | 283 | /* Interrupts are disabled. */ |
321 | spin_lock(&iommu->lock); | 284 | spin_lock(&iommu->lock); |
322 | arena_free(&iommu->arena, entry, npages); | 285 | iommu_range_free(iommu, bus_addr, npages); |
323 | spin_unlock_irqrestore(&iommu->lock, flags); | 286 | spin_unlock_irqrestore(&iommu->lock, flags); |
324 | 287 | ||
325 | return DMA_ERROR_CODE; | 288 | return DMA_ERROR_CODE; |
@@ -350,9 +313,9 @@ static void dma_4v_unmap_single(struct device *dev, dma_addr_t bus_addr, | |||
350 | 313 | ||
351 | spin_lock_irqsave(&iommu->lock, flags); | 314 | spin_lock_irqsave(&iommu->lock, flags); |
352 | 315 | ||
353 | entry = (bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT; | 316 | iommu_range_free(iommu, bus_addr, npages); |
354 | arena_free(&iommu->arena, entry, npages); | ||
355 | 317 | ||
318 | entry = (bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT; | ||
356 | do { | 319 | do { |
357 | unsigned long num; | 320 | unsigned long num; |
358 | 321 | ||
@@ -368,88 +331,131 @@ static void dma_4v_unmap_single(struct device *dev, dma_addr_t bus_addr, | |||
368 | static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, | 331 | static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, |
369 | int nelems, enum dma_data_direction direction) | 332 | int nelems, enum dma_data_direction direction) |
370 | { | 333 | { |
371 | unsigned long flags, npages, i, prot; | 334 | struct scatterlist *s, *outs, *segstart; |
372 | struct scatterlist *sg; | 335 | unsigned long flags, handle, prot; |
336 | dma_addr_t dma_next = 0, dma_addr; | ||
337 | unsigned int max_seg_size; | ||
338 | int outcount, incount, i; | ||
373 | struct iommu *iommu; | 339 | struct iommu *iommu; |
374 | long entry, err; | 340 | long err; |
375 | u32 dma_base; | 341 | |
376 | 342 | BUG_ON(direction == DMA_NONE); | |
377 | /* Fast path single entry scatterlists. */ | ||
378 | if (nelems == 1) { | ||
379 | sglist->dma_address = | ||
380 | dma_4v_map_single(dev, sg_virt(sglist), | ||
381 | sglist->length, direction); | ||
382 | if (unlikely(sglist->dma_address == DMA_ERROR_CODE)) | ||
383 | return 0; | ||
384 | sglist->dma_length = sglist->length; | ||
385 | return 1; | ||
386 | } | ||
387 | 343 | ||
388 | iommu = dev->archdata.iommu; | 344 | iommu = dev->archdata.iommu; |
345 | if (nelems == 0 || !iommu) | ||
346 | return 0; | ||
389 | 347 | ||
390 | if (unlikely(direction == DMA_NONE)) | 348 | prot = HV_PCI_MAP_ATTR_READ; |
391 | goto bad; | 349 | if (direction != DMA_TO_DEVICE) |
392 | 350 | prot |= HV_PCI_MAP_ATTR_WRITE; | |
393 | npages = calc_npages(sglist, nelems); | ||
394 | 351 | ||
395 | spin_lock_irqsave(&iommu->lock, flags); | 352 | outs = s = segstart = &sglist[0]; |
396 | entry = arena_alloc(&iommu->arena, npages); | 353 | outcount = 1; |
397 | spin_unlock_irqrestore(&iommu->lock, flags); | 354 | incount = nelems; |
355 | handle = 0; | ||
398 | 356 | ||
399 | if (unlikely(entry < 0L)) | 357 | /* Init first segment length for backout at failure */ |
400 | goto bad; | 358 | outs->dma_length = 0; |
401 | 359 | ||
402 | dma_base = iommu->page_table_map_base + | 360 | spin_lock_irqsave(&iommu->lock, flags); |
403 | (entry << IO_PAGE_SHIFT); | ||
404 | 361 | ||
405 | prot = HV_PCI_MAP_ATTR_READ; | 362 | iommu_batch_start(dev, prot, ~0UL); |
406 | if (direction != DMA_TO_DEVICE) | ||
407 | prot |= HV_PCI_MAP_ATTR_WRITE; | ||
408 | 363 | ||
409 | local_irq_save(flags); | 364 | max_seg_size = dma_get_max_seg_size(dev); |
365 | for_each_sg(sglist, s, nelems, i) { | ||
366 | unsigned long paddr, npages, entry, slen; | ||
410 | 367 | ||
411 | iommu_batch_start(dev, prot, entry); | 368 | slen = s->length; |
369 | /* Sanity check */ | ||
370 | if (slen == 0) { | ||
371 | dma_next = 0; | ||
372 | continue; | ||
373 | } | ||
374 | /* Allocate iommu entries for that segment */ | ||
375 | paddr = (unsigned long) SG_ENT_PHYS_ADDRESS(s); | ||
376 | npages = iommu_num_pages(paddr, slen); | ||
377 | entry = iommu_range_alloc(dev, iommu, npages, &handle); | ||
412 | 378 | ||
413 | for_each_sg(sglist, sg, nelems, i) { | 379 | /* Handle failure */ |
414 | unsigned long paddr = SG_ENT_PHYS_ADDRESS(sg); | 380 | if (unlikely(entry == DMA_ERROR_CODE)) { |
415 | unsigned long slen = sg->length; | 381 | if (printk_ratelimit()) |
416 | unsigned long this_npages; | 382 | printk(KERN_INFO "iommu_alloc failed, iommu %p paddr %lx" |
383 | " npages %lx\n", iommu, paddr, npages); | ||
384 | goto iommu_map_failed; | ||
385 | } | ||
417 | 386 | ||
418 | this_npages = iommu_num_pages(paddr, slen); | 387 | iommu_batch_new_entry(entry); |
419 | 388 | ||
420 | sg->dma_address = dma_base | (paddr & ~IO_PAGE_MASK); | 389 | /* Convert entry to a dma_addr_t */ |
421 | sg->dma_length = slen; | 390 | dma_addr = iommu->page_table_map_base + |
391 | (entry << IO_PAGE_SHIFT); | ||
392 | dma_addr |= (s->offset & ~IO_PAGE_MASK); | ||
422 | 393 | ||
394 | /* Insert into HW table */ | ||
423 | paddr &= IO_PAGE_MASK; | 395 | paddr &= IO_PAGE_MASK; |
424 | while (this_npages--) { | 396 | while (npages--) { |
425 | err = iommu_batch_add(paddr); | 397 | err = iommu_batch_add(paddr); |
426 | if (unlikely(err < 0L)) { | 398 | if (unlikely(err < 0L)) |
427 | local_irq_restore(flags); | ||
428 | goto iommu_map_failed; | 399 | goto iommu_map_failed; |
400 | paddr += IO_PAGE_SIZE; | ||
401 | } | ||
402 | |||
403 | /* If we are in an open segment, try merging */ | ||
404 | if (segstart != s) { | ||
405 | /* We cannot merge if: | ||
406 | * - allocated dma_addr isn't contiguous to previous allocation | ||
407 | */ | ||
408 | if ((dma_addr != dma_next) || | ||
409 | (outs->dma_length + s->length > max_seg_size)) { | ||
410 | /* Can't merge: create a new segment */ | ||
411 | segstart = s; | ||
412 | outcount++; | ||
413 | outs = sg_next(outs); | ||
414 | } else { | ||
415 | outs->dma_length += s->length; | ||
429 | } | 416 | } |
417 | } | ||
430 | 418 | ||
431 | paddr += IO_PAGE_SIZE; | 419 | if (segstart == s) { |
432 | dma_base += IO_PAGE_SIZE; | 420 | /* This is a new segment, fill entries */ |
421 | outs->dma_address = dma_addr; | ||
422 | outs->dma_length = slen; | ||
433 | } | 423 | } |
424 | |||
425 | /* Calculate next page pointer for contiguous check */ | ||
426 | dma_next = dma_addr + slen; | ||
434 | } | 427 | } |
435 | 428 | ||
436 | err = iommu_batch_end(); | 429 | err = iommu_batch_end(); |
437 | 430 | ||
438 | local_irq_restore(flags); | ||
439 | |||
440 | if (unlikely(err < 0L)) | 431 | if (unlikely(err < 0L)) |
441 | goto iommu_map_failed; | 432 | goto iommu_map_failed; |
442 | 433 | ||
443 | return nelems; | 434 | spin_unlock_irqrestore(&iommu->lock, flags); |
444 | 435 | ||
445 | bad: | 436 | if (outcount < incount) { |
446 | if (printk_ratelimit()) | 437 | outs = sg_next(outs); |
447 | WARN_ON(1); | 438 | outs->dma_address = DMA_ERROR_CODE; |
448 | return 0; | 439 | outs->dma_length = 0; |
440 | } | ||
441 | |||
442 | return outcount; | ||
449 | 443 | ||
450 | iommu_map_failed: | 444 | iommu_map_failed: |
451 | spin_lock_irqsave(&iommu->lock, flags); | 445 | for_each_sg(sglist, s, nelems, i) { |
452 | arena_free(&iommu->arena, entry, npages); | 446 | if (s->dma_length != 0) { |
447 | unsigned long vaddr, npages; | ||
448 | |||
449 | vaddr = s->dma_address & IO_PAGE_MASK; | ||
450 | npages = iommu_num_pages(s->dma_address, s->dma_length); | ||
451 | iommu_range_free(iommu, vaddr, npages); | ||
452 | /* XXX demap? XXX */ | ||
453 | s->dma_address = DMA_ERROR_CODE; | ||
454 | s->dma_length = 0; | ||
455 | } | ||
456 | if (s == outs) | ||
457 | break; | ||
458 | } | ||
453 | spin_unlock_irqrestore(&iommu->lock, flags); | 459 | spin_unlock_irqrestore(&iommu->lock, flags); |
454 | 460 | ||
455 | return 0; | 461 | return 0; |
@@ -458,39 +464,43 @@ iommu_map_failed: | |||
458 | static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, | 464 | static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, |
459 | int nelems, enum dma_data_direction direction) | 465 | int nelems, enum dma_data_direction direction) |
460 | { | 466 | { |
461 | unsigned long flags, npages; | ||
462 | struct pci_pbm_info *pbm; | 467 | struct pci_pbm_info *pbm; |
463 | u32 devhandle, bus_addr; | 468 | struct scatterlist *sg; |
464 | struct iommu *iommu; | 469 | struct iommu *iommu; |
465 | long entry; | 470 | unsigned long flags; |
471 | u32 devhandle; | ||
466 | 472 | ||
467 | if (unlikely(direction == DMA_NONE)) { | 473 | BUG_ON(direction == DMA_NONE); |
468 | if (printk_ratelimit()) | ||
469 | WARN_ON(1); | ||
470 | } | ||
471 | 474 | ||
472 | iommu = dev->archdata.iommu; | 475 | iommu = dev->archdata.iommu; |
473 | pbm = dev->archdata.host_controller; | 476 | pbm = dev->archdata.host_controller; |
474 | devhandle = pbm->devhandle; | 477 | devhandle = pbm->devhandle; |
475 | 478 | ||
476 | bus_addr = sglist->dma_address & IO_PAGE_MASK; | ||
477 | |||
478 | npages = calc_npages(sglist, nelems); | ||
479 | |||
480 | entry = ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT); | ||
481 | |||
482 | spin_lock_irqsave(&iommu->lock, flags); | 479 | spin_lock_irqsave(&iommu->lock, flags); |
483 | 480 | ||
484 | arena_free(&iommu->arena, entry, npages); | 481 | sg = sglist; |
485 | 482 | while (nelems--) { | |
486 | do { | 483 | dma_addr_t dma_handle = sg->dma_address; |
487 | unsigned long num; | 484 | unsigned int len = sg->dma_length; |
485 | unsigned long npages, entry; | ||
486 | |||
487 | if (!len) | ||
488 | break; | ||
489 | npages = iommu_num_pages(dma_handle, len); | ||
490 | iommu_range_free(iommu, dma_handle, npages); | ||
491 | |||
492 | entry = ((dma_handle - iommu->page_table_map_base) >> IO_PAGE_SHIFT); | ||
493 | while (npages) { | ||
494 | unsigned long num; | ||
495 | |||
496 | num = pci_sun4v_iommu_demap(devhandle, HV_PCI_TSBID(0, entry), | ||
497 | npages); | ||
498 | entry += num; | ||
499 | npages -= num; | ||
500 | } | ||
488 | 501 | ||
489 | num = pci_sun4v_iommu_demap(devhandle, HV_PCI_TSBID(0, entry), | 502 | sg = sg_next(sg); |
490 | npages); | 503 | } |
491 | entry += num; | ||
492 | npages -= num; | ||
493 | } while (npages != 0); | ||
494 | 504 | ||
495 | spin_unlock_irqrestore(&iommu->lock, flags); | 505 | spin_unlock_irqrestore(&iommu->lock, flags); |
496 | } | 506 | } |
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig index 7b6d3716efca..4379f43505ef 100644 --- a/arch/v850/Kconfig +++ b/arch/v850/Kconfig | |||
@@ -78,6 +78,7 @@ config MCA | |||
78 | config V850 | 78 | config V850 |
79 | bool | 79 | bool |
80 | default y | 80 | default y |
81 | select HAVE_IDE | ||
81 | 82 | ||
82 | menu "Processor type and features" | 83 | menu "Processor type and features" |
83 | 84 | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 65a70b777c12..aaed1a3b92d6 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -18,6 +18,7 @@ config X86_64 | |||
18 | ### Arch settings | 18 | ### Arch settings |
19 | config X86 | 19 | config X86 |
20 | def_bool y | 20 | def_bool y |
21 | select HAVE_IDE | ||
21 | select HAVE_OPROFILE | 22 | select HAVE_OPROFILE |
22 | select HAVE_KPROBES | 23 | select HAVE_KPROBES |
23 | 24 | ||
@@ -102,6 +103,9 @@ config ARCH_HAS_ILOG2_U32 | |||
102 | config ARCH_HAS_ILOG2_U64 | 103 | config ARCH_HAS_ILOG2_U64 |
103 | def_bool n | 104 | def_bool n |
104 | 105 | ||
106 | config ARCH_HAS_CPU_IDLE_WAIT | ||
107 | def_bool y | ||
108 | |||
105 | config GENERIC_CALIBRATE_DELAY | 109 | config GENERIC_CALIBRATE_DELAY |
106 | def_bool y | 110 | def_bool y |
107 | 111 | ||
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index fa555148823d..864affc9a7b0 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -34,13 +34,9 @@ config DEBUG_STACK_USAGE | |||
34 | 34 | ||
35 | This option will slow down process creation somewhat. | 35 | This option will slow down process creation somewhat. |
36 | 36 | ||
37 | comment "Page alloc debug is incompatible with Software Suspend on i386" | ||
38 | depends on DEBUG_KERNEL && HIBERNATION | ||
39 | depends on X86_32 | ||
40 | |||
41 | config DEBUG_PAGEALLOC | 37 | config DEBUG_PAGEALLOC |
42 | bool "Debug page memory allocations" | 38 | bool "Debug page memory allocations" |
43 | depends on DEBUG_KERNEL && X86_32 | 39 | depends on DEBUG_KERNEL |
44 | help | 40 | help |
45 | Unmap pages from the kernel linear mapping after free_pages(). | 41 | Unmap pages from the kernel linear mapping after free_pages(). |
46 | This results in a large slowdown, but helps to find certain types | 42 | This results in a large slowdown, but helps to find certain types |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 364865b1b08d..204af43535c5 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -191,8 +191,10 @@ drivers-$(CONFIG_PCI) += arch/x86/pci/ | |||
191 | # must be linked after kernel/ | 191 | # must be linked after kernel/ |
192 | drivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/ | 192 | drivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/ |
193 | 193 | ||
194 | ifeq ($(CONFIG_X86_32),y) | 194 | # suspend and hibernation support |
195 | drivers-$(CONFIG_PM) += arch/x86/power/ | 195 | drivers-$(CONFIG_PM) += arch/x86/power/ |
196 | |||
197 | ifeq ($(CONFIG_X86_32),y) | ||
196 | drivers-$(CONFIG_FB) += arch/x86/video/ | 198 | drivers-$(CONFIG_FB) += arch/x86/video/ |
197 | endif | 199 | endif |
198 | 200 | ||
diff --git a/arch/x86/boot/.gitignore b/arch/x86/boot/.gitignore index 18465143cfa2..b1bdc4c6f9f2 100644 --- a/arch/x86/boot/.gitignore +++ b/arch/x86/boot/.gitignore | |||
@@ -3,3 +3,5 @@ bzImage | |||
3 | setup | 3 | setup |
4 | setup.bin | 4 | setup.bin |
5 | setup.elf | 5 | setup.elf |
6 | cpustr.h | ||
7 | mkcpustr | ||
diff --git a/arch/x86/boot/printf.c b/arch/x86/boot/printf.c index 1a09f9309d3c..7e7e890699be 100644 --- a/arch/x86/boot/printf.c +++ b/arch/x86/boot/printf.c | |||
@@ -33,8 +33,8 @@ static int skip_atoi(const char **s) | |||
33 | #define PLUS 4 /* show plus */ | 33 | #define PLUS 4 /* show plus */ |
34 | #define SPACE 8 /* space if plus */ | 34 | #define SPACE 8 /* space if plus */ |
35 | #define LEFT 16 /* left justified */ | 35 | #define LEFT 16 /* left justified */ |
36 | #define SPECIAL 32 /* 0x */ | 36 | #define SMALL 32 /* Must be 32 == 0x20 */ |
37 | #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ | 37 | #define SPECIAL 64 /* 0x */ |
38 | 38 | ||
39 | #define do_div(n,base) ({ \ | 39 | #define do_div(n,base) ({ \ |
40 | int __res; \ | 40 | int __res; \ |
@@ -45,12 +45,16 @@ __res; }) | |||
45 | static char *number(char *str, long num, int base, int size, int precision, | 45 | static char *number(char *str, long num, int base, int size, int precision, |
46 | int type) | 46 | int type) |
47 | { | 47 | { |
48 | char c, sign, tmp[66]; | 48 | /* we are called with base 8, 10 or 16, only, thus don't need "G..." */ |
49 | const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz"; | 49 | static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */ |
50 | |||
51 | char tmp[66]; | ||
52 | char c, sign, locase; | ||
50 | int i; | 53 | int i; |
51 | 54 | ||
52 | if (type & LARGE) | 55 | /* locase = 0 or 0x20. ORing digits or letters with 'locase' |
53 | digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | 56 | * produces same digits or (maybe lowercased) letters */ |
57 | locase = (type & SMALL); | ||
54 | if (type & LEFT) | 58 | if (type & LEFT) |
55 | type &= ~ZEROPAD; | 59 | type &= ~ZEROPAD; |
56 | if (base < 2 || base > 36) | 60 | if (base < 2 || base > 36) |
@@ -81,7 +85,7 @@ static char *number(char *str, long num, int base, int size, int precision, | |||
81 | tmp[i++] = '0'; | 85 | tmp[i++] = '0'; |
82 | else | 86 | else |
83 | while (num != 0) | 87 | while (num != 0) |
84 | tmp[i++] = digits[do_div(num, base)]; | 88 | tmp[i++] = (digits[do_div(num, base)] | locase); |
85 | if (i > precision) | 89 | if (i > precision) |
86 | precision = i; | 90 | precision = i; |
87 | size -= precision; | 91 | size -= precision; |
@@ -95,7 +99,7 @@ static char *number(char *str, long num, int base, int size, int precision, | |||
95 | *str++ = '0'; | 99 | *str++ = '0'; |
96 | else if (base == 16) { | 100 | else if (base == 16) { |
97 | *str++ = '0'; | 101 | *str++ = '0'; |
98 | *str++ = digits[33]; | 102 | *str++ = ('X' | locase); |
99 | } | 103 | } |
100 | } | 104 | } |
101 | if (!(type & LEFT)) | 105 | if (!(type & LEFT)) |
@@ -244,9 +248,9 @@ int vsprintf(char *buf, const char *fmt, va_list args) | |||
244 | base = 8; | 248 | base = 8; |
245 | break; | 249 | break; |
246 | 250 | ||
247 | case 'X': | ||
248 | flags |= LARGE; | ||
249 | case 'x': | 251 | case 'x': |
252 | flags |= SMALL; | ||
253 | case 'X': | ||
250 | base = 16; | 254 | base = 16; |
251 | break; | 255 | break; |
252 | 256 | ||
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig index 77562e7cdab6..3df340b54e57 100644 --- a/arch/x86/configs/i386_defconfig +++ b/arch/x86/configs/i386_defconfig | |||
@@ -1421,7 +1421,6 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
1421 | # CONFIG_DEBUG_VM is not set | 1421 | # CONFIG_DEBUG_VM is not set |
1422 | # CONFIG_DEBUG_LIST is not set | 1422 | # CONFIG_DEBUG_LIST is not set |
1423 | # CONFIG_FRAME_POINTER is not set | 1423 | # CONFIG_FRAME_POINTER is not set |
1424 | # CONFIG_FORCED_INLINING is not set | ||
1425 | # CONFIG_RCU_TORTURE_TEST is not set | 1424 | # CONFIG_RCU_TORTURE_TEST is not set |
1426 | # CONFIG_LKDTM is not set | 1425 | # CONFIG_LKDTM is not set |
1427 | # CONFIG_FAULT_INJECTION is not set | 1426 | # CONFIG_FAULT_INJECTION is not set |
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig index 9e2b0ef851de..eef98cb00c62 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig | |||
@@ -1346,7 +1346,6 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
1346 | # CONFIG_DEBUG_VM is not set | 1346 | # CONFIG_DEBUG_VM is not set |
1347 | # CONFIG_DEBUG_LIST is not set | 1347 | # CONFIG_DEBUG_LIST is not set |
1348 | # CONFIG_FRAME_POINTER is not set | 1348 | # CONFIG_FRAME_POINTER is not set |
1349 | # CONFIG_FORCED_INLINING is not set | ||
1350 | # CONFIG_RCU_TORTURE_TEST is not set | 1349 | # CONFIG_RCU_TORTURE_TEST is not set |
1351 | # CONFIG_LKDTM is not set | 1350 | # CONFIG_LKDTM is not set |
1352 | # CONFIG_FAULT_INJECTION is not set | 1351 | # CONFIG_FAULT_INJECTION is not set |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 21dc1a061bf1..76ec0f8f138a 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -84,8 +84,6 @@ ifeq ($(CONFIG_X86_64),y) | |||
84 | obj-y += genapic_64.o genapic_flat_64.o | 84 | obj-y += genapic_64.o genapic_flat_64.o |
85 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o | 85 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o |
86 | obj-$(CONFIG_AUDIT) += audit_64.o | 86 | obj-$(CONFIG_AUDIT) += audit_64.o |
87 | obj-$(CONFIG_PM) += suspend_64.o | ||
88 | obj-$(CONFIG_HIBERNATION) += suspend_asm_64.o | ||
89 | 87 | ||
90 | obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o | 88 | obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o |
91 | obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o | 89 | obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o |
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 24885be5c48c..9b7e01daa1ca 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
@@ -118,7 +118,7 @@ static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev) | |||
118 | 118 | ||
119 | static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) | 119 | static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) |
120 | { | 120 | { |
121 | return sysfs_remove_group(&sys_dev->kobj, &thermal_throttle_attr_group); | 121 | sysfs_remove_group(&sys_dev->kobj, &thermal_throttle_attr_group); |
122 | } | 122 | } |
123 | 123 | ||
124 | /* Mutex protecting device creation against CPU hotplug */ | 124 | /* Mutex protecting device creation against CPU hotplug */ |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index be5c31d04884..824e21b80aad 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -409,7 +409,8 @@ restore_nocheck_notrace: | |||
409 | RESTORE_REGS | 409 | RESTORE_REGS |
410 | addl $4, %esp # skip orig_eax/error_code | 410 | addl $4, %esp # skip orig_eax/error_code |
411 | CFI_ADJUST_CFA_OFFSET -4 | 411 | CFI_ADJUST_CFA_OFFSET -4 |
412 | 1: INTERRUPT_RETURN | 412 | ENTRY(irq_return) |
413 | INTERRUPT_RETURN | ||
413 | .section .fixup,"ax" | 414 | .section .fixup,"ax" |
414 | iret_exc: | 415 | iret_exc: |
415 | pushl $0 # no error code | 416 | pushl $0 # no error code |
@@ -418,7 +419,7 @@ iret_exc: | |||
418 | .previous | 419 | .previous |
419 | .section __ex_table,"a" | 420 | .section __ex_table,"a" |
420 | .align 4 | 421 | .align 4 |
421 | .long 1b,iret_exc | 422 | .long irq_return,iret_exc |
422 | .previous | 423 | .previous |
423 | 424 | ||
424 | CFI_RESTORE_STATE | 425 | CFI_RESTORE_STATE |
@@ -865,20 +866,16 @@ nmi_espfix_stack: | |||
865 | RESTORE_REGS | 866 | RESTORE_REGS |
866 | lss 12+4(%esp), %esp # back to espfix stack | 867 | lss 12+4(%esp), %esp # back to espfix stack |
867 | CFI_ADJUST_CFA_OFFSET -24 | 868 | CFI_ADJUST_CFA_OFFSET -24 |
868 | 1: INTERRUPT_RETURN | 869 | jmp irq_return |
869 | CFI_ENDPROC | 870 | CFI_ENDPROC |
870 | .section __ex_table,"a" | ||
871 | .align 4 | ||
872 | .long 1b,iret_exc | ||
873 | .previous | ||
874 | KPROBE_END(nmi) | 871 | KPROBE_END(nmi) |
875 | 872 | ||
876 | #ifdef CONFIG_PARAVIRT | 873 | #ifdef CONFIG_PARAVIRT |
877 | ENTRY(native_iret) | 874 | ENTRY(native_iret) |
878 | 1: iret | 875 | iret |
879 | .section __ex_table,"a" | 876 | .section __ex_table,"a" |
880 | .align 4 | 877 | .align 4 |
881 | .long 1b,iret_exc | 878 | .long native_iret, iret_exc |
882 | .previous | 879 | .previous |
883 | END(native_iret) | 880 | END(native_iret) |
884 | 881 | ||
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index c7341e81941c..6be39a387c5a 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -581,16 +581,24 @@ retint_restore_args: /* return to kernel space */ | |||
581 | */ | 581 | */ |
582 | TRACE_IRQS_IRETQ | 582 | TRACE_IRQS_IRETQ |
583 | restore_args: | 583 | restore_args: |
584 | RESTORE_ARGS 0,8,0 | 584 | RESTORE_ARGS 0,8,0 |
585 | #ifdef CONFIG_PARAVIRT | 585 | |
586 | ENTRY(irq_return) | ||
586 | INTERRUPT_RETURN | 587 | INTERRUPT_RETURN |
587 | #endif | 588 | |
589 | .section __ex_table, "a" | ||
590 | .quad irq_return, bad_iret | ||
591 | .previous | ||
592 | |||
593 | #ifdef CONFIG_PARAVIRT | ||
588 | ENTRY(native_iret) | 594 | ENTRY(native_iret) |
589 | iretq | 595 | iretq |
590 | 596 | ||
591 | .section __ex_table,"a" | 597 | .section __ex_table,"a" |
592 | .quad native_iret, bad_iret | 598 | .quad native_iret, bad_iret |
593 | .previous | 599 | .previous |
600 | #endif | ||
601 | |||
594 | .section .fixup,"ax" | 602 | .section .fixup,"ax" |
595 | bad_iret: | 603 | bad_iret: |
596 | /* | 604 | /* |
@@ -804,7 +812,7 @@ paranoid_swapgs\trace: | |||
804 | SWAPGS_UNSAFE_STACK | 812 | SWAPGS_UNSAFE_STACK |
805 | paranoid_restore\trace: | 813 | paranoid_restore\trace: |
806 | RESTORE_ALL 8 | 814 | RESTORE_ALL 8 |
807 | INTERRUPT_RETURN | 815 | jmp irq_return |
808 | paranoid_userspace\trace: | 816 | paranoid_userspace\trace: |
809 | GET_THREAD_INFO(%rcx) | 817 | GET_THREAD_INFO(%rcx) |
810 | movl threadinfo_flags(%rcx),%ebx | 818 | movl threadinfo_flags(%rcx),%ebx |
@@ -919,7 +927,7 @@ error_kernelspace: | |||
919 | iret run with kernel gs again, so don't set the user space flag. | 927 | iret run with kernel gs again, so don't set the user space flag. |
920 | B stepping K8s sometimes report an truncated RIP for IRET | 928 | B stepping K8s sometimes report an truncated RIP for IRET |
921 | exceptions returning to compat mode. Check for these here too. */ | 929 | exceptions returning to compat mode. Check for these here too. */ |
922 | leaq native_iret(%rip),%rbp | 930 | leaq irq_return(%rip),%rbp |
923 | cmpq %rbp,RIP(%rsp) | 931 | cmpq %rbp,RIP(%rsp) |
924 | je error_swapgs | 932 | je error_swapgs |
925 | movl %ebp,%ebp /* zero extend */ | 933 | movl %ebp,%ebp /* zero extend */ |
diff --git a/arch/x86/kernel/geode_32.c b/arch/x86/kernel/geode_32.c index 9c7f7d395968..9dad6ca6cd70 100644 --- a/arch/x86/kernel/geode_32.c +++ b/arch/x86/kernel/geode_32.c | |||
@@ -163,14 +163,11 @@ EXPORT_SYMBOL_GPL(geode_gpio_setup_event); | |||
163 | 163 | ||
164 | static int __init geode_southbridge_init(void) | 164 | static int __init geode_southbridge_init(void) |
165 | { | 165 | { |
166 | int timers; | ||
167 | |||
168 | if (!is_geode()) | 166 | if (!is_geode()) |
169 | return -ENODEV; | 167 | return -ENODEV; |
170 | 168 | ||
171 | init_lbars(); | 169 | init_lbars(); |
172 | timers = geode_mfgpt_detect(); | 170 | (void) mfgpt_timer_setup(); |
173 | printk(KERN_INFO "geode: %d MFGPT timers available.\n", timers); | ||
174 | return 0; | 171 | return 0; |
175 | } | 172 | } |
176 | 173 | ||
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index 5d8c5730686b..74ef4a41f224 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -19,6 +19,10 @@ | |||
19 | #include <asm/thread_info.h> | 19 | #include <asm/thread_info.h> |
20 | #include <asm/asm-offsets.h> | 20 | #include <asm/asm-offsets.h> |
21 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
22 | #include <asm/processor-flags.h> | ||
23 | |||
24 | /* Physical address */ | ||
25 | #define pa(X) ((X) - __PAGE_OFFSET) | ||
22 | 26 | ||
23 | /* | 27 | /* |
24 | * References to members of the new_cpu_data structure. | 28 | * References to members of the new_cpu_data structure. |
@@ -80,10 +84,6 @@ INIT_MAP_BEYOND_END = BOOTBITMAP_SIZE + (PAGE_TABLE_SIZE + ALLOCATOR_SLOP)*PAGE_ | |||
80 | */ | 84 | */ |
81 | .section .text.head,"ax",@progbits | 85 | .section .text.head,"ax",@progbits |
82 | ENTRY(startup_32) | 86 | ENTRY(startup_32) |
83 | /* check to see if KEEP_SEGMENTS flag is meaningful */ | ||
84 | cmpw $0x207, BP_version(%esi) | ||
85 | jb 1f | ||
86 | |||
87 | /* test KEEP_SEGMENTS flag to see if the bootloader is asking | 87 | /* test KEEP_SEGMENTS flag to see if the bootloader is asking |
88 | us to not reload segments */ | 88 | us to not reload segments */ |
89 | testb $(1<<6), BP_loadflags(%esi) | 89 | testb $(1<<6), BP_loadflags(%esi) |
@@ -92,7 +92,7 @@ ENTRY(startup_32) | |||
92 | /* | 92 | /* |
93 | * Set segments to known values. | 93 | * Set segments to known values. |
94 | */ | 94 | */ |
95 | 1: lgdt boot_gdt_descr - __PAGE_OFFSET | 95 | lgdt pa(boot_gdt_descr) |
96 | movl $(__BOOT_DS),%eax | 96 | movl $(__BOOT_DS),%eax |
97 | movl %eax,%ds | 97 | movl %eax,%ds |
98 | movl %eax,%es | 98 | movl %eax,%es |
@@ -105,8 +105,8 @@ ENTRY(startup_32) | |||
105 | */ | 105 | */ |
106 | cld | 106 | cld |
107 | xorl %eax,%eax | 107 | xorl %eax,%eax |
108 | movl $__bss_start - __PAGE_OFFSET,%edi | 108 | movl $pa(__bss_start),%edi |
109 | movl $__bss_stop - __PAGE_OFFSET,%ecx | 109 | movl $pa(__bss_stop),%ecx |
110 | subl %edi,%ecx | 110 | subl %edi,%ecx |
111 | shrl $2,%ecx | 111 | shrl $2,%ecx |
112 | rep ; stosl | 112 | rep ; stosl |
@@ -118,31 +118,32 @@ ENTRY(startup_32) | |||
118 | * (kexec on panic case). Hence copy out the parameters before initializing | 118 | * (kexec on panic case). Hence copy out the parameters before initializing |
119 | * page tables. | 119 | * page tables. |
120 | */ | 120 | */ |
121 | movl $(boot_params - __PAGE_OFFSET),%edi | 121 | movl $pa(boot_params),%edi |
122 | movl $(PARAM_SIZE/4),%ecx | 122 | movl $(PARAM_SIZE/4),%ecx |
123 | cld | 123 | cld |
124 | rep | 124 | rep |
125 | movsl | 125 | movsl |
126 | movl boot_params - __PAGE_OFFSET + NEW_CL_POINTER,%esi | 126 | movl pa(boot_params) + NEW_CL_POINTER,%esi |
127 | andl %esi,%esi | 127 | andl %esi,%esi |
128 | jz 1f # No comand line | 128 | jz 1f # No comand line |
129 | movl $(boot_command_line - __PAGE_OFFSET),%edi | 129 | movl $pa(boot_command_line),%edi |
130 | movl $(COMMAND_LINE_SIZE/4),%ecx | 130 | movl $(COMMAND_LINE_SIZE/4),%ecx |
131 | rep | 131 | rep |
132 | movsl | 132 | movsl |
133 | 1: | 133 | 1: |
134 | 134 | ||
135 | #ifdef CONFIG_PARAVIRT | 135 | #ifdef CONFIG_PARAVIRT |
136 | cmpw $0x207, (boot_params + BP_version - __PAGE_OFFSET) | 136 | /* This is can only trip for a broken bootloader... */ |
137 | cmpw $0x207, pa(boot_params + BP_version) | ||
137 | jb default_entry | 138 | jb default_entry |
138 | 139 | ||
139 | /* Paravirt-compatible boot parameters. Look to see what architecture | 140 | /* Paravirt-compatible boot parameters. Look to see what architecture |
140 | we're booting under. */ | 141 | we're booting under. */ |
141 | movl (boot_params + BP_hardware_subarch - __PAGE_OFFSET), %eax | 142 | movl pa(boot_params + BP_hardware_subarch), %eax |
142 | cmpl $num_subarch_entries, %eax | 143 | cmpl $num_subarch_entries, %eax |
143 | jae bad_subarch | 144 | jae bad_subarch |
144 | 145 | ||
145 | movl subarch_entries - __PAGE_OFFSET(,%eax,4), %eax | 146 | movl pa(subarch_entries)(,%eax,4), %eax |
146 | subl $__PAGE_OFFSET, %eax | 147 | subl $__PAGE_OFFSET, %eax |
147 | jmp *%eax | 148 | jmp *%eax |
148 | 149 | ||
@@ -170,17 +171,68 @@ num_subarch_entries = (. - subarch_entries) / 4 | |||
170 | * Mappings are created both at virtual address 0 (identity mapping) | 171 | * Mappings are created both at virtual address 0 (identity mapping) |
171 | * and PAGE_OFFSET for up to _end+sizeof(page tables)+INIT_MAP_BEYOND_END. | 172 | * and PAGE_OFFSET for up to _end+sizeof(page tables)+INIT_MAP_BEYOND_END. |
172 | * | 173 | * |
173 | * Warning: don't use %esi or the stack in this code. However, %esp | 174 | * Note that the stack is not yet set up! |
174 | * can be used as a GPR if you really need it... | ||
175 | */ | 175 | */ |
176 | page_pde_offset = (__PAGE_OFFSET >> 20); | 176 | #define PTE_ATTR 0x007 /* PRESENT+RW+USER */ |
177 | #define PDE_ATTR 0x067 /* PRESENT+RW+USER+DIRTY+ACCESSED */ | ||
178 | #define PGD_ATTR 0x001 /* PRESENT (no other attributes) */ | ||
177 | 179 | ||
178 | default_entry: | 180 | default_entry: |
179 | movl $(pg0 - __PAGE_OFFSET), %edi | 181 | #ifdef CONFIG_X86_PAE |
180 | movl $(swapper_pg_dir - __PAGE_OFFSET), %edx | 182 | |
181 | movl $0x007, %eax /* 0x007 = PRESENT+RW+USER */ | 183 | /* |
184 | * In PAE mode swapper_pg_dir is statically defined to contain enough | ||
185 | * entries to cover the VMSPLIT option (that is the top 1, 2 or 3 | ||
186 | * entries). The identity mapping is handled by pointing two PGD | ||
187 | * entries to the first kernel PMD. | ||
188 | * | ||
189 | * Note the upper half of each PMD or PTE are always zero at | ||
190 | * this stage. | ||
191 | */ | ||
192 | |||
193 | #define KPMDS ((0x100000000-__PAGE_OFFSET) >> 30) /* Number of kernel PMDs */ | ||
194 | |||
195 | xorl %ebx,%ebx /* %ebx is kept at zero */ | ||
196 | |||
197 | movl $pa(pg0), %edi | ||
198 | movl $pa(swapper_pg_pmd), %edx | ||
199 | movl $PTE_ATTR, %eax | ||
200 | 10: | ||
201 | leal PDE_ATTR(%edi),%ecx /* Create PMD entry */ | ||
202 | movl %ecx,(%edx) /* Store PMD entry */ | ||
203 | /* Upper half already zero */ | ||
204 | addl $8,%edx | ||
205 | movl $512,%ecx | ||
206 | 11: | ||
207 | stosl | ||
208 | xchgl %eax,%ebx | ||
209 | stosl | ||
210 | xchgl %eax,%ebx | ||
211 | addl $0x1000,%eax | ||
212 | loop 11b | ||
213 | |||
214 | /* | ||
215 | * End condition: we must map up to and including INIT_MAP_BEYOND_END | ||
216 | * bytes beyond the end of our own page tables. | ||
217 | */ | ||
218 | leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp | ||
219 | cmpl %ebp,%eax | ||
220 | jb 10b | ||
221 | 1: | ||
222 | movl %edi,pa(init_pg_tables_end) | ||
223 | |||
224 | /* Do early initialization of the fixmap area */ | ||
225 | movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax | ||
226 | movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8) | ||
227 | #else /* Not PAE */ | ||
228 | |||
229 | page_pde_offset = (__PAGE_OFFSET >> 20); | ||
230 | |||
231 | movl $pa(pg0), %edi | ||
232 | movl $pa(swapper_pg_dir), %edx | ||
233 | movl $PTE_ATTR, %eax | ||
182 | 10: | 234 | 10: |
183 | leal 0x007(%edi),%ecx /* Create PDE entry */ | 235 | leal PDE_ATTR(%edi),%ecx /* Create PDE entry */ |
184 | movl %ecx,(%edx) /* Store identity PDE entry */ | 236 | movl %ecx,(%edx) /* Store identity PDE entry */ |
185 | movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ | 237 | movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ |
186 | addl $4,%edx | 238 | addl $4,%edx |
@@ -189,19 +241,20 @@ default_entry: | |||
189 | stosl | 241 | stosl |
190 | addl $0x1000,%eax | 242 | addl $0x1000,%eax |
191 | loop 11b | 243 | loop 11b |
192 | /* End condition: we must map up to and including INIT_MAP_BEYOND_END */ | 244 | /* |
193 | /* bytes beyond the end of our own page tables; the +0x007 is the attribute bits */ | 245 | * End condition: we must map up to and including INIT_MAP_BEYOND_END |
194 | leal (INIT_MAP_BEYOND_END+0x007)(%edi),%ebp | 246 | * bytes beyond the end of our own page tables; the +0x007 is |
247 | * the attribute bits | ||
248 | */ | ||
249 | leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp | ||
195 | cmpl %ebp,%eax | 250 | cmpl %ebp,%eax |
196 | jb 10b | 251 | jb 10b |
197 | movl %edi,(init_pg_tables_end - __PAGE_OFFSET) | 252 | movl %edi,pa(init_pg_tables_end) |
198 | |||
199 | /* Do an early initialization of the fixmap area */ | ||
200 | movl $(swapper_pg_dir - __PAGE_OFFSET), %edx | ||
201 | movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax | ||
202 | addl $0x67, %eax /* 0x67 == _PAGE_TABLE */ | ||
203 | movl %eax, 4092(%edx) | ||
204 | 253 | ||
254 | /* Do early initialization of the fixmap area */ | ||
255 | movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax | ||
256 | movl %eax,pa(swapper_pg_dir+0xffc) | ||
257 | #endif | ||
205 | jmp 3f | 258 | jmp 3f |
206 | /* | 259 | /* |
207 | * Non-boot CPU entry point; entered from trampoline.S | 260 | * Non-boot CPU entry point; entered from trampoline.S |
@@ -241,7 +294,7 @@ ENTRY(startup_32_smp) | |||
241 | * NOTE! We have to correct for the fact that we're | 294 | * NOTE! We have to correct for the fact that we're |
242 | * not yet offset PAGE_OFFSET.. | 295 | * not yet offset PAGE_OFFSET.. |
243 | */ | 296 | */ |
244 | #define cr4_bits mmu_cr4_features-__PAGE_OFFSET | 297 | #define cr4_bits pa(mmu_cr4_features) |
245 | movl cr4_bits,%edx | 298 | movl cr4_bits,%edx |
246 | andl %edx,%edx | 299 | andl %edx,%edx |
247 | jz 6f | 300 | jz 6f |
@@ -276,10 +329,10 @@ ENTRY(startup_32_smp) | |||
276 | /* | 329 | /* |
277 | * Enable paging | 330 | * Enable paging |
278 | */ | 331 | */ |
279 | movl $swapper_pg_dir-__PAGE_OFFSET,%eax | 332 | movl $pa(swapper_pg_dir),%eax |
280 | movl %eax,%cr3 /* set the page table pointer.. */ | 333 | movl %eax,%cr3 /* set the page table pointer.. */ |
281 | movl %cr0,%eax | 334 | movl %cr0,%eax |
282 | orl $0x80000000,%eax | 335 | orl $X86_CR0_PG,%eax |
283 | movl %eax,%cr0 /* ..and set paging (PG) bit */ | 336 | movl %eax,%cr0 /* ..and set paging (PG) bit */ |
284 | ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */ | 337 | ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */ |
285 | 1: | 338 | 1: |
@@ -552,16 +605,44 @@ ENTRY(_stext) | |||
552 | */ | 605 | */ |
553 | .section ".bss.page_aligned","wa" | 606 | .section ".bss.page_aligned","wa" |
554 | .align PAGE_SIZE_asm | 607 | .align PAGE_SIZE_asm |
608 | #ifdef CONFIG_X86_PAE | ||
609 | ENTRY(swapper_pg_pmd) | ||
610 | .fill 1024*KPMDS,4,0 | ||
611 | #else | ||
555 | ENTRY(swapper_pg_dir) | 612 | ENTRY(swapper_pg_dir) |
556 | .fill 1024,4,0 | 613 | .fill 1024,4,0 |
557 | ENTRY(swapper_pg_pmd) | 614 | #endif |
615 | ENTRY(swapper_pg_fixmap) | ||
558 | .fill 1024,4,0 | 616 | .fill 1024,4,0 |
559 | ENTRY(empty_zero_page) | 617 | ENTRY(empty_zero_page) |
560 | .fill 4096,1,0 | 618 | .fill 4096,1,0 |
561 | |||
562 | /* | 619 | /* |
563 | * This starts the data section. | 620 | * This starts the data section. |
564 | */ | 621 | */ |
622 | #ifdef CONFIG_X86_PAE | ||
623 | .section ".data.page_aligned","wa" | ||
624 | /* Page-aligned for the benefit of paravirt? */ | ||
625 | .align PAGE_SIZE_asm | ||
626 | ENTRY(swapper_pg_dir) | ||
627 | .long pa(swapper_pg_pmd+PGD_ATTR),0 /* low identity map */ | ||
628 | # if KPMDS == 3 | ||
629 | .long pa(swapper_pg_pmd+PGD_ATTR),0 | ||
630 | .long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 | ||
631 | .long pa(swapper_pg_pmd+PGD_ATTR+0x2000),0 | ||
632 | # elif KPMDS == 2 | ||
633 | .long 0,0 | ||
634 | .long pa(swapper_pg_pmd+PGD_ATTR),0 | ||
635 | .long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 | ||
636 | # elif KPMDS == 1 | ||
637 | .long 0,0 | ||
638 | .long 0,0 | ||
639 | .long pa(swapper_pg_pmd+PGD_ATTR),0 | ||
640 | # else | ||
641 | # error "Kernel PMDs should be 1, 2 or 3" | ||
642 | # endif | ||
643 | .align PAGE_SIZE_asm /* needs to be page-sized too */ | ||
644 | #endif | ||
645 | |||
565 | .data | 646 | .data |
566 | ENTRY(stack_start) | 647 | ENTRY(stack_start) |
567 | .long init_thread_union+THREAD_SIZE | 648 | .long init_thread_union+THREAD_SIZE |
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c index 219f86eb6123..027fc067b399 100644 --- a/arch/x86/kernel/mfgpt_32.c +++ b/arch/x86/kernel/mfgpt_32.c | |||
@@ -12,48 +12,37 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * We are using the 32Khz input clock - its the only one that has the | 15 | * We are using the 32.768kHz input clock - it's the only one that has the |
16 | * ranges we find desirable. The following table lists the suitable | 16 | * ranges we find desirable. The following table lists the suitable |
17 | * divisors and the associated hz, minimum interval | 17 | * divisors and the associated Hz, minimum interval and the maximum interval: |
18 | * and the maximum interval: | ||
19 | * | 18 | * |
20 | * Divisor Hz Min Delta (S) Max Delta (S) | 19 | * Divisor Hz Min Delta (s) Max Delta (s) |
21 | * 1 32000 .0005 2.048 | 20 | * 1 32768 .00048828125 2.000 |
22 | * 2 16000 .001 4.096 | 21 | * 2 16384 .0009765625 4.000 |
23 | * 4 8000 .002 8.192 | 22 | * 4 8192 .001953125 8.000 |
24 | * 8 4000 .004 16.384 | 23 | * 8 4096 .00390625 16.000 |
25 | * 16 2000 .008 32.768 | 24 | * 16 2048 .0078125 32.000 |
26 | * 32 1000 .016 65.536 | 25 | * 32 1024 .015625 64.000 |
27 | * 64 500 .032 131.072 | 26 | * 64 512 .03125 128.000 |
28 | * 128 250 .064 262.144 | 27 | * 128 256 .0625 256.000 |
29 | * 256 125 .128 524.288 | 28 | * 256 128 .125 512.000 |
30 | */ | 29 | */ |
31 | 30 | ||
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
34 | #include <linux/module.h> | ||
35 | #include <asm/geode.h> | 33 | #include <asm/geode.h> |
36 | 34 | ||
37 | #define F_AVAIL 0x01 | ||
38 | |||
39 | static struct mfgpt_timer_t { | 35 | static struct mfgpt_timer_t { |
40 | int flags; | 36 | unsigned int avail:1; |
41 | struct module *owner; | ||
42 | } mfgpt_timers[MFGPT_MAX_TIMERS]; | 37 | } mfgpt_timers[MFGPT_MAX_TIMERS]; |
43 | 38 | ||
44 | /* Selected from the table above */ | 39 | /* Selected from the table above */ |
45 | 40 | ||
46 | #define MFGPT_DIVISOR 16 | 41 | #define MFGPT_DIVISOR 16 |
47 | #define MFGPT_SCALE 4 /* divisor = 2^(scale) */ | 42 | #define MFGPT_SCALE 4 /* divisor = 2^(scale) */ |
48 | #define MFGPT_HZ (32000 / MFGPT_DIVISOR) | 43 | #define MFGPT_HZ (32768 / MFGPT_DIVISOR) |
49 | #define MFGPT_PERIODIC (MFGPT_HZ / HZ) | 44 | #define MFGPT_PERIODIC (MFGPT_HZ / HZ) |
50 | 45 | ||
51 | #ifdef CONFIG_GEODE_MFGPT_TIMER | ||
52 | static int __init mfgpt_timer_setup(void); | ||
53 | #else | ||
54 | #define mfgpt_timer_setup() (0) | ||
55 | #endif | ||
56 | |||
57 | /* Allow for disabling of MFGPTs */ | 46 | /* Allow for disabling of MFGPTs */ |
58 | static int disable; | 47 | static int disable; |
59 | static int __init mfgpt_disable(char *s) | 48 | static int __init mfgpt_disable(char *s) |
@@ -85,28 +74,37 @@ __setup("mfgptfix", mfgpt_fix); | |||
85 | * In other cases (such as with VSAless OpenFirmware), the system firmware | 74 | * In other cases (such as with VSAless OpenFirmware), the system firmware |
86 | * leaves timers available for us to use. | 75 | * leaves timers available for us to use. |
87 | */ | 76 | */ |
88 | int __init geode_mfgpt_detect(void) | 77 | |
78 | |||
79 | static int timers = -1; | ||
80 | |||
81 | static void geode_mfgpt_detect(void) | ||
89 | { | 82 | { |
90 | int count = 0, i; | 83 | int i; |
91 | u16 val; | 84 | u16 val; |
92 | 85 | ||
86 | timers = 0; | ||
87 | |||
93 | if (disable) { | 88 | if (disable) { |
94 | printk(KERN_INFO "geode-mfgpt: Skipping MFGPT setup\n"); | 89 | printk(KERN_INFO "geode-mfgpt: MFGPT support is disabled\n"); |
95 | return 0; | 90 | goto done; |
91 | } | ||
92 | |||
93 | if (!geode_get_dev_base(GEODE_DEV_MFGPT)) { | ||
94 | printk(KERN_INFO "geode-mfgpt: MFGPT LBAR is not set up\n"); | ||
95 | goto done; | ||
96 | } | 96 | } |
97 | 97 | ||
98 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { | 98 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { |
99 | val = geode_mfgpt_read(i, MFGPT_REG_SETUP); | 99 | val = geode_mfgpt_read(i, MFGPT_REG_SETUP); |
100 | if (!(val & MFGPT_SETUP_SETUP)) { | 100 | if (!(val & MFGPT_SETUP_SETUP)) { |
101 | mfgpt_timers[i].flags = F_AVAIL; | 101 | mfgpt_timers[i].avail = 1; |
102 | count++; | 102 | timers++; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | /* set up clock event device, if desired */ | 106 | done: |
107 | i = mfgpt_timer_setup(); | 107 | printk(KERN_INFO "geode-mfgpt: %d MFGPT timers available.\n", timers); |
108 | |||
109 | return count; | ||
110 | } | 108 | } |
111 | 109 | ||
112 | int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable) | 110 | int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable) |
@@ -183,36 +181,41 @@ int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable) | |||
183 | return 0; | 181 | return 0; |
184 | } | 182 | } |
185 | 183 | ||
186 | static int mfgpt_get(int timer, struct module *owner) | 184 | static int mfgpt_get(int timer) |
187 | { | 185 | { |
188 | mfgpt_timers[timer].flags &= ~F_AVAIL; | 186 | mfgpt_timers[timer].avail = 0; |
189 | mfgpt_timers[timer].owner = owner; | ||
190 | printk(KERN_INFO "geode-mfgpt: Registered timer %d\n", timer); | 187 | printk(KERN_INFO "geode-mfgpt: Registered timer %d\n", timer); |
191 | return timer; | 188 | return timer; |
192 | } | 189 | } |
193 | 190 | ||
194 | int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner) | 191 | int geode_mfgpt_alloc_timer(int timer, int domain) |
195 | { | 192 | { |
196 | int i; | 193 | int i; |
197 | 194 | ||
198 | if (!geode_get_dev_base(GEODE_DEV_MFGPT)) | 195 | if (timers == -1) { |
199 | return -ENODEV; | 196 | /* timers haven't been detected yet */ |
197 | geode_mfgpt_detect(); | ||
198 | } | ||
199 | |||
200 | if (!timers) | ||
201 | return -1; | ||
202 | |||
200 | if (timer >= MFGPT_MAX_TIMERS) | 203 | if (timer >= MFGPT_MAX_TIMERS) |
201 | return -EIO; | 204 | return -1; |
202 | 205 | ||
203 | if (timer < 0) { | 206 | if (timer < 0) { |
204 | /* Try to find an available timer */ | 207 | /* Try to find an available timer */ |
205 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { | 208 | for (i = 0; i < MFGPT_MAX_TIMERS; i++) { |
206 | if (mfgpt_timers[i].flags & F_AVAIL) | 209 | if (mfgpt_timers[i].avail) |
207 | return mfgpt_get(i, owner); | 210 | return mfgpt_get(i); |
208 | 211 | ||
209 | if (i == 5 && domain == MFGPT_DOMAIN_WORKING) | 212 | if (i == 5 && domain == MFGPT_DOMAIN_WORKING) |
210 | break; | 213 | break; |
211 | } | 214 | } |
212 | } else { | 215 | } else { |
213 | /* If they requested a specific timer, try to honor that */ | 216 | /* If they requested a specific timer, try to honor that */ |
214 | if (mfgpt_timers[timer].flags & F_AVAIL) | 217 | if (mfgpt_timers[timer].avail) |
215 | return mfgpt_get(timer, owner); | 218 | return mfgpt_get(timer); |
216 | } | 219 | } |
217 | 220 | ||
218 | /* No timers available - too bad */ | 221 | /* No timers available - too bad */ |
@@ -244,10 +247,11 @@ static int __init mfgpt_setup(char *str) | |||
244 | } | 247 | } |
245 | __setup("mfgpt_irq=", mfgpt_setup); | 248 | __setup("mfgpt_irq=", mfgpt_setup); |
246 | 249 | ||
247 | static inline void mfgpt_disable_timer(u16 clock) | 250 | static void mfgpt_disable_timer(u16 clock) |
248 | { | 251 | { |
249 | u16 val = geode_mfgpt_read(clock, MFGPT_REG_SETUP); | 252 | /* avoid races by clearing CMP1 and CMP2 unconditionally */ |
250 | geode_mfgpt_write(clock, MFGPT_REG_SETUP, val & ~MFGPT_SETUP_CNTEN); | 253 | geode_mfgpt_write(clock, MFGPT_REG_SETUP, (u16) ~MFGPT_SETUP_CNTEN | |
254 | MFGPT_SETUP_CMP1 | MFGPT_SETUP_CMP2); | ||
251 | } | 255 | } |
252 | 256 | ||
253 | static int mfgpt_next_event(unsigned long, struct clock_event_device *); | 257 | static int mfgpt_next_event(unsigned long, struct clock_event_device *); |
@@ -263,7 +267,7 @@ static struct clock_event_device mfgpt_clockevent = { | |||
263 | .shift = 32 | 267 | .shift = 32 |
264 | }; | 268 | }; |
265 | 269 | ||
266 | static inline void mfgpt_start_timer(u16 clock, u16 delta) | 270 | static void mfgpt_start_timer(u16 delta) |
267 | { | 271 | { |
268 | geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_CMP2, (u16) delta); | 272 | geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_CMP2, (u16) delta); |
269 | geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0); | 273 | geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0); |
@@ -278,21 +282,25 @@ static void mfgpt_set_mode(enum clock_event_mode mode, | |||
278 | mfgpt_disable_timer(mfgpt_event_clock); | 282 | mfgpt_disable_timer(mfgpt_event_clock); |
279 | 283 | ||
280 | if (mode == CLOCK_EVT_MODE_PERIODIC) | 284 | if (mode == CLOCK_EVT_MODE_PERIODIC) |
281 | mfgpt_start_timer(mfgpt_event_clock, MFGPT_PERIODIC); | 285 | mfgpt_start_timer(MFGPT_PERIODIC); |
282 | 286 | ||
283 | mfgpt_tick_mode = mode; | 287 | mfgpt_tick_mode = mode; |
284 | } | 288 | } |
285 | 289 | ||
286 | static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt) | 290 | static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt) |
287 | { | 291 | { |
288 | mfgpt_start_timer(mfgpt_event_clock, delta); | 292 | mfgpt_start_timer(delta); |
289 | return 0; | 293 | return 0; |
290 | } | 294 | } |
291 | 295 | ||
292 | /* Assume (foolishly?), that this interrupt was due to our tick */ | ||
293 | |||
294 | static irqreturn_t mfgpt_tick(int irq, void *dev_id) | 296 | static irqreturn_t mfgpt_tick(int irq, void *dev_id) |
295 | { | 297 | { |
298 | u16 val = geode_mfgpt_read(mfgpt_event_clock, MFGPT_REG_SETUP); | ||
299 | |||
300 | /* See if the interrupt was for us */ | ||
301 | if (!(val & (MFGPT_SETUP_SETUP | MFGPT_SETUP_CMP2 | MFGPT_SETUP_CMP1))) | ||
302 | return IRQ_NONE; | ||
303 | |||
296 | /* Turn off the clock (and clear the event) */ | 304 | /* Turn off the clock (and clear the event) */ |
297 | mfgpt_disable_timer(mfgpt_event_clock); | 305 | mfgpt_disable_timer(mfgpt_event_clock); |
298 | 306 | ||
@@ -320,13 +328,12 @@ static struct irqaction mfgptirq = { | |||
320 | .name = "mfgpt-timer" | 328 | .name = "mfgpt-timer" |
321 | }; | 329 | }; |
322 | 330 | ||
323 | static int __init mfgpt_timer_setup(void) | 331 | int __init mfgpt_timer_setup(void) |
324 | { | 332 | { |
325 | int timer, ret; | 333 | int timer, ret; |
326 | u16 val; | 334 | u16 val; |
327 | 335 | ||
328 | timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING, | 336 | timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); |
329 | THIS_MODULE); | ||
330 | if (timer < 0) { | 337 | if (timer < 0) { |
331 | printk(KERN_ERR | 338 | printk(KERN_ERR |
332 | "mfgpt-timer: Could not allocate a MFPGT timer\n"); | 339 | "mfgpt-timer: Could not allocate a MFPGT timer\n"); |
@@ -363,7 +370,7 @@ static int __init mfgpt_timer_setup(void) | |||
363 | &mfgpt_clockevent); | 370 | &mfgpt_clockevent); |
364 | 371 | ||
365 | printk(KERN_INFO | 372 | printk(KERN_INFO |
366 | "mfgpt-timer: registering the MFGT timer as a clock event.\n"); | 373 | "mfgpt-timer: registering the MFGPT timer as a clock event.\n"); |
367 | clockevents_register_device(&mfgpt_clockevent); | 374 | clockevents_register_device(&mfgpt_clockevent); |
368 | 375 | ||
369 | return 0; | 376 | return 0; |
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index 6ba33ca8715a..1941482d4ca3 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
@@ -27,7 +27,7 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) | |||
27 | pci_write_config_byte(dev, 0xf4, config|0x2); | 27 | pci_write_config_byte(dev, 0xf4, config|0x2); |
28 | 28 | ||
29 | /* read xTPR register */ | 29 | /* read xTPR register */ |
30 | raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word); | 30 | raw_pci_read(0, 0, 0x40, 0x4c, 2, &word); |
31 | 31 | ||
32 | if (!(word & (1 << 13))) { | 32 | if (!(word & (1 << 13))) { |
33 | dev_info(&dev->dev, "Intel E7520/7320/7525 detected; " | 33 | dev_info(&dev->dev, "Intel E7520/7320/7525 detected; " |
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index d1d8c347cc0b..691ab4cb167b 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c | |||
@@ -154,7 +154,11 @@ struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; | |||
154 | struct cpuinfo_x86 boot_cpu_data __read_mostly = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; | 154 | struct cpuinfo_x86 boot_cpu_data __read_mostly = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; |
155 | EXPORT_SYMBOL(boot_cpu_data); | 155 | EXPORT_SYMBOL(boot_cpu_data); |
156 | 156 | ||
157 | #ifndef CONFIG_X86_PAE | ||
157 | unsigned long mmu_cr4_features; | 158 | unsigned long mmu_cr4_features; |
159 | #else | ||
160 | unsigned long mmu_cr4_features = X86_CR4_PAE; | ||
161 | #endif | ||
158 | 162 | ||
159 | /* for MCA, but anyone else can use it if they want */ | 163 | /* for MCA, but anyone else can use it if they want */ |
160 | unsigned int machine_id; | 164 | unsigned int machine_id; |
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c index e6757aaa202b..a40051b71d9b 100644 --- a/arch/x86/kernel/topology.c +++ b/arch/x86/kernel/topology.c | |||
@@ -53,7 +53,7 @@ EXPORT_SYMBOL(arch_register_cpu); | |||
53 | 53 | ||
54 | void arch_unregister_cpu(int num) | 54 | void arch_unregister_cpu(int num) |
55 | { | 55 | { |
56 | return unregister_cpu(&per_cpu(cpu_devices, num).cpu); | 56 | unregister_cpu(&per_cpu(cpu_devices, num).cpu); |
57 | } | 57 | } |
58 | EXPORT_SYMBOL(arch_unregister_cpu); | 58 | EXPORT_SYMBOL(arch_unregister_cpu); |
59 | #else | 59 | #else |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index d1bc04006d16..8106bba41ecb 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/pgalloc.h> | 46 | #include <asm/pgalloc.h> |
47 | #include <asm/sections.h> | 47 | #include <asm/sections.h> |
48 | #include <asm/paravirt.h> | 48 | #include <asm/paravirt.h> |
49 | #include <asm/setup.h> | ||
49 | 50 | ||
50 | unsigned int __VMALLOC_RESERVE = 128 << 20; | 51 | unsigned int __VMALLOC_RESERVE = 128 << 20; |
51 | 52 | ||
@@ -328,44 +329,38 @@ pteval_t __PAGE_KERNEL_EXEC = _PAGE_KERNEL_EXEC; | |||
328 | 329 | ||
329 | void __init native_pagetable_setup_start(pgd_t *base) | 330 | void __init native_pagetable_setup_start(pgd_t *base) |
330 | { | 331 | { |
331 | #ifdef CONFIG_X86_PAE | 332 | unsigned long pfn, va; |
332 | int i; | 333 | pgd_t *pgd; |
334 | pud_t *pud; | ||
335 | pmd_t *pmd; | ||
336 | pte_t *pte; | ||
333 | 337 | ||
334 | /* | 338 | /* |
335 | * Init entries of the first-level page table to the | 339 | * Remove any mappings which extend past the end of physical |
336 | * zero page, if they haven't already been set up. | 340 | * memory from the boot time page table: |
337 | * | ||
338 | * In a normal native boot, we'll be running on a | ||
339 | * pagetable rooted in swapper_pg_dir, but not in PAE | ||
340 | * mode, so this will end up clobbering the mappings | ||
341 | * for the lower 24Mbytes of the address space, | ||
342 | * without affecting the kernel address space. | ||
343 | */ | 341 | */ |
344 | for (i = 0; i < USER_PTRS_PER_PGD; i++) | 342 | for (pfn = max_low_pfn + 1; pfn < 1<<(32-PAGE_SHIFT); pfn++) { |
345 | set_pgd(&base[i], | 343 | va = PAGE_OFFSET + (pfn<<PAGE_SHIFT); |
346 | __pgd(__pa(empty_zero_page) | _PAGE_PRESENT)); | 344 | pgd = base + pgd_index(va); |
347 | 345 | if (!pgd_present(*pgd)) | |
348 | /* Make sure kernel address space is empty so that a pagetable | 346 | break; |
349 | will be allocated for it. */ | 347 | |
350 | memset(&base[USER_PTRS_PER_PGD], 0, | 348 | pud = pud_offset(pgd, va); |
351 | KERNEL_PGD_PTRS * sizeof(pgd_t)); | 349 | pmd = pmd_offset(pud, va); |
352 | #else | 350 | if (!pmd_present(*pmd)) |
351 | break; | ||
352 | |||
353 | pte = pte_offset_kernel(pmd, va); | ||
354 | if (!pte_present(*pte)) | ||
355 | break; | ||
356 | |||
357 | pte_clear(NULL, va, pte); | ||
358 | } | ||
353 | paravirt_alloc_pd(&init_mm, __pa(base) >> PAGE_SHIFT); | 359 | paravirt_alloc_pd(&init_mm, __pa(base) >> PAGE_SHIFT); |
354 | #endif | ||
355 | } | 360 | } |
356 | 361 | ||
357 | void __init native_pagetable_setup_done(pgd_t *base) | 362 | void __init native_pagetable_setup_done(pgd_t *base) |
358 | { | 363 | { |
359 | #ifdef CONFIG_X86_PAE | ||
360 | /* | ||
361 | * Add low memory identity-mappings - SMP needs it when | ||
362 | * starting up on an AP from real-mode. In the non-PAE | ||
363 | * case we already have these mappings through head.S. | ||
364 | * All user-space mappings are explicitly cleared after | ||
365 | * SMP startup. | ||
366 | */ | ||
367 | set_pgd(&base[0], base[USER_PTRS_PER_PGD]); | ||
368 | #endif | ||
369 | } | 364 | } |
370 | 365 | ||
371 | /* | 366 | /* |
@@ -374,9 +369,8 @@ void __init native_pagetable_setup_done(pgd_t *base) | |||
374 | * the boot process. | 369 | * the boot process. |
375 | * | 370 | * |
376 | * If we're booting on native hardware, this will be a pagetable | 371 | * If we're booting on native hardware, this will be a pagetable |
377 | * constructed in arch/i386/kernel/head.S, and not running in PAE mode | 372 | * constructed in arch/x86/kernel/head_32.S. The root of the |
378 | * (even if we'll end up running in PAE). The root of the pagetable | 373 | * pagetable will be swapper_pg_dir. |
379 | * will be swapper_pg_dir. | ||
380 | * | 374 | * |
381 | * If we're booting paravirtualized under a hypervisor, then there are | 375 | * If we're booting paravirtualized under a hypervisor, then there are |
382 | * more options: we may already be running PAE, and the pagetable may | 376 | * more options: we may already be running PAE, and the pagetable may |
@@ -537,14 +531,6 @@ void __init paging_init(void) | |||
537 | 531 | ||
538 | load_cr3(swapper_pg_dir); | 532 | load_cr3(swapper_pg_dir); |
539 | 533 | ||
540 | #ifdef CONFIG_X86_PAE | ||
541 | /* | ||
542 | * We will bail out later - printk doesn't work right now so | ||
543 | * the user would just see a hanging kernel. | ||
544 | */ | ||
545 | if (cpu_has_pae) | ||
546 | set_in_cr4(X86_CR4_PAE); | ||
547 | #endif | ||
548 | __flush_tlb_all(); | 534 | __flush_tlb_all(); |
549 | 535 | ||
550 | kmap_init(); | 536 | kmap_init(); |
@@ -675,13 +661,11 @@ void __init mem_init(void) | |||
675 | BUG_ON((unsigned long)high_memory > VMALLOC_START); | 661 | BUG_ON((unsigned long)high_memory > VMALLOC_START); |
676 | #endif /* double-sanity-check paranoia */ | 662 | #endif /* double-sanity-check paranoia */ |
677 | 663 | ||
678 | #ifdef CONFIG_X86_PAE | ||
679 | if (!cpu_has_pae) | ||
680 | panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!"); | ||
681 | #endif | ||
682 | if (boot_cpu_data.wp_works_ok < 0) | 664 | if (boot_cpu_data.wp_works_ok < 0) |
683 | test_wp_bit(); | 665 | test_wp_bit(); |
684 | 666 | ||
667 | cpa_init(); | ||
668 | |||
685 | /* | 669 | /* |
686 | * Subtle. SMP is doing it's boot stuff late (because it has to | 670 | * Subtle. SMP is doing it's boot stuff late (because it has to |
687 | * fork idle threads) - but it also needs low mappings for the | 671 | * fork idle threads) - but it also needs low mappings for the |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 5fe880fc305d..b59fc238151f 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -528,13 +528,15 @@ void __init mem_init(void) | |||
528 | reservedpages << (PAGE_SHIFT-10), | 528 | reservedpages << (PAGE_SHIFT-10), |
529 | datasize >> 10, | 529 | datasize >> 10, |
530 | initsize >> 10); | 530 | initsize >> 10); |
531 | |||
532 | cpa_init(); | ||
531 | } | 533 | } |
532 | 534 | ||
533 | void free_init_pages(char *what, unsigned long begin, unsigned long end) | 535 | void free_init_pages(char *what, unsigned long begin, unsigned long end) |
534 | { | 536 | { |
535 | unsigned long addr; | 537 | unsigned long addr = begin; |
536 | 538 | ||
537 | if (begin >= end) | 539 | if (addr >= end) |
538 | return; | 540 | return; |
539 | 541 | ||
540 | /* | 542 | /* |
@@ -549,7 +551,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
549 | #else | 551 | #else |
550 | printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10); | 552 | printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10); |
551 | 553 | ||
552 | for (addr = begin; addr < end; addr += PAGE_SIZE) { | 554 | for (; addr < end; addr += PAGE_SIZE) { |
553 | ClearPageReserved(virt_to_page(addr)); | 555 | ClearPageReserved(virt_to_page(addr)); |
554 | init_page_count(virt_to_page(addr)); | 556 | init_page_count(virt_to_page(addr)); |
555 | memset((void *)(addr & ~(PAGE_SIZE-1)), | 557 | memset((void *)(addr & ~(PAGE_SIZE-1)), |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index ee6648fe6b15..a4897a85268a 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -260,41 +260,46 @@ static int __init early_ioremap_debug_setup(char *str) | |||
260 | early_param("early_ioremap_debug", early_ioremap_debug_setup); | 260 | early_param("early_ioremap_debug", early_ioremap_debug_setup); |
261 | 261 | ||
262 | static __initdata int after_paging_init; | 262 | static __initdata int after_paging_init; |
263 | static __initdata unsigned long bm_pte[1024] | 263 | static __initdata pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)] |
264 | __attribute__((aligned(PAGE_SIZE))); | 264 | __attribute__((aligned(PAGE_SIZE))); |
265 | 265 | ||
266 | static inline unsigned long * __init early_ioremap_pgd(unsigned long addr) | 266 | static inline pmd_t * __init early_ioremap_pmd(unsigned long addr) |
267 | { | 267 | { |
268 | return (unsigned long *)swapper_pg_dir + ((addr >> 22) & 1023); | 268 | pgd_t *pgd = &swapper_pg_dir[pgd_index(addr)]; |
269 | pud_t *pud = pud_offset(pgd, addr); | ||
270 | pmd_t *pmd = pmd_offset(pud, addr); | ||
271 | |||
272 | return pmd; | ||
269 | } | 273 | } |
270 | 274 | ||
271 | static inline unsigned long * __init early_ioremap_pte(unsigned long addr) | 275 | static inline pte_t * __init early_ioremap_pte(unsigned long addr) |
272 | { | 276 | { |
273 | return bm_pte + ((addr >> PAGE_SHIFT) & 1023); | 277 | return &bm_pte[pte_index(addr)]; |
274 | } | 278 | } |
275 | 279 | ||
276 | void __init early_ioremap_init(void) | 280 | void __init early_ioremap_init(void) |
277 | { | 281 | { |
278 | unsigned long *pgd; | 282 | pmd_t *pmd; |
279 | 283 | ||
280 | if (early_ioremap_debug) | 284 | if (early_ioremap_debug) |
281 | printk(KERN_INFO "early_ioremap_init()\n"); | 285 | printk(KERN_INFO "early_ioremap_init()\n"); |
282 | 286 | ||
283 | pgd = early_ioremap_pgd(fix_to_virt(FIX_BTMAP_BEGIN)); | 287 | pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)); |
284 | *pgd = __pa(bm_pte) | _PAGE_TABLE; | ||
285 | memset(bm_pte, 0, sizeof(bm_pte)); | 288 | memset(bm_pte, 0, sizeof(bm_pte)); |
289 | pmd_populate_kernel(&init_mm, pmd, bm_pte); | ||
290 | |||
286 | /* | 291 | /* |
287 | * The boot-ioremap range spans multiple pgds, for which | 292 | * The boot-ioremap range spans multiple pmds, for which |
288 | * we are not prepared: | 293 | * we are not prepared: |
289 | */ | 294 | */ |
290 | if (pgd != early_ioremap_pgd(fix_to_virt(FIX_BTMAP_END))) { | 295 | if (pmd != early_ioremap_pmd(fix_to_virt(FIX_BTMAP_END))) { |
291 | WARN_ON(1); | 296 | WARN_ON(1); |
292 | printk(KERN_WARNING "pgd %p != %p\n", | 297 | printk(KERN_WARNING "pmd %p != %p\n", |
293 | pgd, early_ioremap_pgd(fix_to_virt(FIX_BTMAP_END))); | 298 | pmd, early_ioremap_pmd(fix_to_virt(FIX_BTMAP_END))); |
294 | printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_BEGIN): %08lx\n", | 299 | printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_BEGIN): %08lx\n", |
295 | fix_to_virt(FIX_BTMAP_BEGIN)); | 300 | fix_to_virt(FIX_BTMAP_BEGIN)); |
296 | printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_END): %08lx\n", | 301 | printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_END): %08lx\n", |
297 | fix_to_virt(FIX_BTMAP_END)); | 302 | fix_to_virt(FIX_BTMAP_END)); |
298 | 303 | ||
299 | printk(KERN_WARNING "FIX_BTMAP_END: %d\n", FIX_BTMAP_END); | 304 | printk(KERN_WARNING "FIX_BTMAP_END: %d\n", FIX_BTMAP_END); |
300 | printk(KERN_WARNING "FIX_BTMAP_BEGIN: %d\n", | 305 | printk(KERN_WARNING "FIX_BTMAP_BEGIN: %d\n", |
@@ -304,28 +309,29 @@ void __init early_ioremap_init(void) | |||
304 | 309 | ||
305 | void __init early_ioremap_clear(void) | 310 | void __init early_ioremap_clear(void) |
306 | { | 311 | { |
307 | unsigned long *pgd; | 312 | pmd_t *pmd; |
308 | 313 | ||
309 | if (early_ioremap_debug) | 314 | if (early_ioremap_debug) |
310 | printk(KERN_INFO "early_ioremap_clear()\n"); | 315 | printk(KERN_INFO "early_ioremap_clear()\n"); |
311 | 316 | ||
312 | pgd = early_ioremap_pgd(fix_to_virt(FIX_BTMAP_BEGIN)); | 317 | pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)); |
313 | *pgd = 0; | 318 | pmd_clear(pmd); |
314 | paravirt_release_pt(__pa(pgd) >> PAGE_SHIFT); | 319 | paravirt_release_pt(__pa(bm_pte) >> PAGE_SHIFT); |
315 | __flush_tlb_all(); | 320 | __flush_tlb_all(); |
316 | } | 321 | } |
317 | 322 | ||
318 | void __init early_ioremap_reset(void) | 323 | void __init early_ioremap_reset(void) |
319 | { | 324 | { |
320 | enum fixed_addresses idx; | 325 | enum fixed_addresses idx; |
321 | unsigned long *pte, phys, addr; | 326 | unsigned long addr, phys; |
327 | pte_t *pte; | ||
322 | 328 | ||
323 | after_paging_init = 1; | 329 | after_paging_init = 1; |
324 | for (idx = FIX_BTMAP_BEGIN; idx >= FIX_BTMAP_END; idx--) { | 330 | for (idx = FIX_BTMAP_BEGIN; idx >= FIX_BTMAP_END; idx--) { |
325 | addr = fix_to_virt(idx); | 331 | addr = fix_to_virt(idx); |
326 | pte = early_ioremap_pte(addr); | 332 | pte = early_ioremap_pte(addr); |
327 | if (*pte & _PAGE_PRESENT) { | 333 | if (pte_present(*pte)) { |
328 | phys = *pte & PAGE_MASK; | 334 | phys = pte_val(*pte) & PAGE_MASK; |
329 | set_fixmap(idx, phys); | 335 | set_fixmap(idx, phys); |
330 | } | 336 | } |
331 | } | 337 | } |
@@ -334,7 +340,8 @@ void __init early_ioremap_reset(void) | |||
334 | static void __init __early_set_fixmap(enum fixed_addresses idx, | 340 | static void __init __early_set_fixmap(enum fixed_addresses idx, |
335 | unsigned long phys, pgprot_t flags) | 341 | unsigned long phys, pgprot_t flags) |
336 | { | 342 | { |
337 | unsigned long *pte, addr = __fix_to_virt(idx); | 343 | unsigned long addr = __fix_to_virt(idx); |
344 | pte_t *pte; | ||
338 | 345 | ||
339 | if (idx >= __end_of_fixed_addresses) { | 346 | if (idx >= __end_of_fixed_addresses) { |
340 | BUG(); | 347 | BUG(); |
@@ -342,9 +349,9 @@ static void __init __early_set_fixmap(enum fixed_addresses idx, | |||
342 | } | 349 | } |
343 | pte = early_ioremap_pte(addr); | 350 | pte = early_ioremap_pte(addr); |
344 | if (pgprot_val(flags)) | 351 | if (pgprot_val(flags)) |
345 | *pte = (phys & PAGE_MASK) | pgprot_val(flags); | 352 | set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags)); |
346 | else | 353 | else |
347 | *pte = 0; | 354 | pte_clear(NULL, addr, pte); |
348 | __flush_tlb_one(addr); | 355 | __flush_tlb_one(addr); |
349 | } | 356 | } |
350 | 357 | ||
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 8493c855582b..440210a2277d 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
11 | #include <linux/interrupt.h> | ||
11 | 12 | ||
12 | #include <asm/e820.h> | 13 | #include <asm/e820.h> |
13 | #include <asm/processor.h> | 14 | #include <asm/processor.h> |
@@ -191,7 +192,7 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address) | |||
191 | * or when the present bit is not set. Otherwise we would return a | 192 | * or when the present bit is not set. Otherwise we would return a |
192 | * pointer to a nonexisting mapping. | 193 | * pointer to a nonexisting mapping. |
193 | */ | 194 | */ |
194 | pte_t *lookup_address(unsigned long address, int *level) | 195 | pte_t *lookup_address(unsigned long address, unsigned int *level) |
195 | { | 196 | { |
196 | pgd_t *pgd = pgd_offset_k(address); | 197 | pgd_t *pgd = pgd_offset_k(address); |
197 | pud_t *pud; | 198 | pud_t *pud; |
@@ -252,10 +253,11 @@ static int | |||
252 | try_preserve_large_page(pte_t *kpte, unsigned long address, | 253 | try_preserve_large_page(pte_t *kpte, unsigned long address, |
253 | struct cpa_data *cpa) | 254 | struct cpa_data *cpa) |
254 | { | 255 | { |
255 | unsigned long nextpage_addr, numpages, pmask, psize, flags; | 256 | unsigned long nextpage_addr, numpages, pmask, psize, flags, addr; |
256 | pte_t new_pte, old_pte, *tmp; | 257 | pte_t new_pte, old_pte, *tmp; |
257 | pgprot_t old_prot, new_prot; | 258 | pgprot_t old_prot, new_prot; |
258 | int level, do_split = 1; | 259 | int i, do_split = 1; |
260 | unsigned int level; | ||
259 | 261 | ||
260 | spin_lock_irqsave(&pgd_lock, flags); | 262 | spin_lock_irqsave(&pgd_lock, flags); |
261 | /* | 263 | /* |
@@ -302,6 +304,19 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
302 | new_prot = static_protections(new_prot, address); | 304 | new_prot = static_protections(new_prot, address); |
303 | 305 | ||
304 | /* | 306 | /* |
307 | * We need to check the full range, whether | ||
308 | * static_protection() requires a different pgprot for one of | ||
309 | * the pages in the range we try to preserve: | ||
310 | */ | ||
311 | addr = address + PAGE_SIZE; | ||
312 | for (i = 1; i < cpa->numpages; i++, addr += PAGE_SIZE) { | ||
313 | pgprot_t chk_prot = static_protections(new_prot, addr); | ||
314 | |||
315 | if (pgprot_val(chk_prot) != pgprot_val(new_prot)) | ||
316 | goto out_unlock; | ||
317 | } | ||
318 | |||
319 | /* | ||
305 | * If there are no changes, return. maxpages has been updated | 320 | * If there are no changes, return. maxpages has been updated |
306 | * above: | 321 | * above: |
307 | */ | 322 | */ |
@@ -335,23 +350,103 @@ out_unlock: | |||
335 | return do_split; | 350 | return do_split; |
336 | } | 351 | } |
337 | 352 | ||
353 | static LIST_HEAD(page_pool); | ||
354 | static unsigned long pool_size, pool_pages, pool_low; | ||
355 | static unsigned long pool_used, pool_failed, pool_refill; | ||
356 | |||
357 | static void cpa_fill_pool(void) | ||
358 | { | ||
359 | struct page *p; | ||
360 | gfp_t gfp = GFP_KERNEL; | ||
361 | |||
362 | /* Do not allocate from interrupt context */ | ||
363 | if (in_irq() || irqs_disabled()) | ||
364 | return; | ||
365 | /* | ||
366 | * Check unlocked. I does not matter when we have one more | ||
367 | * page in the pool. The bit lock avoids recursive pool | ||
368 | * allocations: | ||
369 | */ | ||
370 | if (pool_pages >= pool_size || test_and_set_bit_lock(0, &pool_refill)) | ||
371 | return; | ||
372 | |||
373 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
374 | /* | ||
375 | * We could do: | ||
376 | * gfp = in_atomic() ? GFP_ATOMIC : GFP_KERNEL; | ||
377 | * but this fails on !PREEMPT kernels | ||
378 | */ | ||
379 | gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; | ||
380 | #endif | ||
381 | |||
382 | while (pool_pages < pool_size) { | ||
383 | p = alloc_pages(gfp, 0); | ||
384 | if (!p) { | ||
385 | pool_failed++; | ||
386 | break; | ||
387 | } | ||
388 | spin_lock_irq(&pgd_lock); | ||
389 | list_add(&p->lru, &page_pool); | ||
390 | pool_pages++; | ||
391 | spin_unlock_irq(&pgd_lock); | ||
392 | } | ||
393 | clear_bit_unlock(0, &pool_refill); | ||
394 | } | ||
395 | |||
396 | #define SHIFT_MB (20 - PAGE_SHIFT) | ||
397 | #define ROUND_MB_GB ((1 << 10) - 1) | ||
398 | #define SHIFT_MB_GB 10 | ||
399 | #define POOL_PAGES_PER_GB 16 | ||
400 | |||
401 | void __init cpa_init(void) | ||
402 | { | ||
403 | struct sysinfo si; | ||
404 | unsigned long gb; | ||
405 | |||
406 | si_meminfo(&si); | ||
407 | /* | ||
408 | * Calculate the number of pool pages: | ||
409 | * | ||
410 | * Convert totalram (nr of pages) to MiB and round to the next | ||
411 | * GiB. Shift MiB to Gib and multiply the result by | ||
412 | * POOL_PAGES_PER_GB: | ||
413 | */ | ||
414 | gb = ((si.totalram >> SHIFT_MB) + ROUND_MB_GB) >> SHIFT_MB_GB; | ||
415 | pool_size = POOL_PAGES_PER_GB * gb; | ||
416 | pool_low = pool_size; | ||
417 | |||
418 | cpa_fill_pool(); | ||
419 | printk(KERN_DEBUG | ||
420 | "CPA: page pool initialized %lu of %lu pages preallocated\n", | ||
421 | pool_pages, pool_size); | ||
422 | } | ||
423 | |||
338 | static int split_large_page(pte_t *kpte, unsigned long address) | 424 | static int split_large_page(pte_t *kpte, unsigned long address) |
339 | { | 425 | { |
340 | unsigned long flags, pfn, pfninc = 1; | 426 | unsigned long flags, pfn, pfninc = 1; |
341 | gfp_t gfp_flags = GFP_KERNEL; | ||
342 | unsigned int i, level; | 427 | unsigned int i, level; |
343 | pte_t *pbase, *tmp; | 428 | pte_t *pbase, *tmp; |
344 | pgprot_t ref_prot; | 429 | pgprot_t ref_prot; |
345 | struct page *base; | 430 | struct page *base; |
346 | 431 | ||
347 | #ifdef CONFIG_DEBUG_PAGEALLOC | 432 | /* |
348 | gfp_flags = GFP_ATOMIC | __GFP_NOWARN; | 433 | * Get a page from the pool. The pool list is protected by the |
349 | #endif | 434 | * pgd_lock, which we have to take anyway for the split |
350 | base = alloc_pages(gfp_flags, 0); | 435 | * operation: |
351 | if (!base) | 436 | */ |
437 | spin_lock_irqsave(&pgd_lock, flags); | ||
438 | if (list_empty(&page_pool)) { | ||
439 | spin_unlock_irqrestore(&pgd_lock, flags); | ||
352 | return -ENOMEM; | 440 | return -ENOMEM; |
441 | } | ||
442 | |||
443 | base = list_first_entry(&page_pool, struct page, lru); | ||
444 | list_del(&base->lru); | ||
445 | pool_pages--; | ||
446 | |||
447 | if (pool_pages < pool_low) | ||
448 | pool_low = pool_pages; | ||
353 | 449 | ||
354 | spin_lock_irqsave(&pgd_lock, flags); | ||
355 | /* | 450 | /* |
356 | * Check for races, another CPU might have split this page | 451 | * Check for races, another CPU might have split this page |
357 | * up for us already: | 452 | * up for us already: |
@@ -396,17 +491,24 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
396 | base = NULL; | 491 | base = NULL; |
397 | 492 | ||
398 | out_unlock: | 493 | out_unlock: |
494 | /* | ||
495 | * If we dropped out via the lookup_address check under | ||
496 | * pgd_lock then stick the page back into the pool: | ||
497 | */ | ||
498 | if (base) { | ||
499 | list_add(&base->lru, &page_pool); | ||
500 | pool_pages++; | ||
501 | } else | ||
502 | pool_used++; | ||
399 | spin_unlock_irqrestore(&pgd_lock, flags); | 503 | spin_unlock_irqrestore(&pgd_lock, flags); |
400 | 504 | ||
401 | if (base) | ||
402 | __free_pages(base, 0); | ||
403 | |||
404 | return 0; | 505 | return 0; |
405 | } | 506 | } |
406 | 507 | ||
407 | static int __change_page_attr(unsigned long address, struct cpa_data *cpa) | 508 | static int __change_page_attr(unsigned long address, struct cpa_data *cpa) |
408 | { | 509 | { |
409 | int level, do_split, err; | 510 | int do_split, err; |
511 | unsigned int level; | ||
410 | struct page *kpte_page; | 512 | struct page *kpte_page; |
411 | pte_t *kpte; | 513 | pte_t *kpte; |
412 | 514 | ||
@@ -598,7 +700,7 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages, | |||
598 | * Check whether we really changed something: | 700 | * Check whether we really changed something: |
599 | */ | 701 | */ |
600 | if (!cpa.flushtlb) | 702 | if (!cpa.flushtlb) |
601 | return ret; | 703 | goto out; |
602 | 704 | ||
603 | /* | 705 | /* |
604 | * No need to flush, when we did not set any of the caching | 706 | * No need to flush, when we did not set any of the caching |
@@ -617,6 +719,8 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages, | |||
617 | else | 719 | else |
618 | cpa_flush_all(cache); | 720 | cpa_flush_all(cache); |
619 | 721 | ||
722 | out: | ||
723 | cpa_fill_pool(); | ||
620 | return ret; | 724 | return ret; |
621 | } | 725 | } |
622 | 726 | ||
@@ -770,6 +874,12 @@ void kernel_map_pages(struct page *page, int numpages, int enable) | |||
770 | * but that can deadlock->flush only current cpu: | 874 | * but that can deadlock->flush only current cpu: |
771 | */ | 875 | */ |
772 | __flush_tlb_all(); | 876 | __flush_tlb_all(); |
877 | |||
878 | /* | ||
879 | * Try to refill the page pool here. We can do this only after | ||
880 | * the tlb flush. | ||
881 | */ | ||
882 | cpa_fill_pool(); | ||
773 | } | 883 | } |
774 | #endif | 884 | #endif |
775 | 885 | ||
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 52deabc72a6f..b7c67a187b6b 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -26,16 +26,37 @@ int pcibios_last_bus = -1; | |||
26 | unsigned long pirq_table_addr; | 26 | unsigned long pirq_table_addr; |
27 | struct pci_bus *pci_root_bus; | 27 | struct pci_bus *pci_root_bus; |
28 | struct pci_raw_ops *raw_pci_ops; | 28 | struct pci_raw_ops *raw_pci_ops; |
29 | struct pci_raw_ops *raw_pci_ext_ops; | ||
30 | |||
31 | int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, | ||
32 | int reg, int len, u32 *val) | ||
33 | { | ||
34 | if (reg < 256 && raw_pci_ops) | ||
35 | return raw_pci_ops->read(domain, bus, devfn, reg, len, val); | ||
36 | if (raw_pci_ext_ops) | ||
37 | return raw_pci_ext_ops->read(domain, bus, devfn, reg, len, val); | ||
38 | return -EINVAL; | ||
39 | } | ||
40 | |||
41 | int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, | ||
42 | int reg, int len, u32 val) | ||
43 | { | ||
44 | if (reg < 256 && raw_pci_ops) | ||
45 | return raw_pci_ops->write(domain, bus, devfn, reg, len, val); | ||
46 | if (raw_pci_ext_ops) | ||
47 | return raw_pci_ext_ops->write(domain, bus, devfn, reg, len, val); | ||
48 | return -EINVAL; | ||
49 | } | ||
29 | 50 | ||
30 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | 51 | static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) |
31 | { | 52 | { |
32 | return raw_pci_ops->read(pci_domain_nr(bus), bus->number, | 53 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
33 | devfn, where, size, value); | 54 | devfn, where, size, value); |
34 | } | 55 | } |
35 | 56 | ||
36 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) | 57 | static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) |
37 | { | 58 | { |
38 | return raw_pci_ops->write(pci_domain_nr(bus), bus->number, | 59 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
39 | devfn, where, size, value); | 60 | devfn, where, size, value); |
40 | } | 61 | } |
41 | 62 | ||
diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c index 431c9a51b157..42f3e4cad179 100644 --- a/arch/x86/pci/direct.c +++ b/arch/x86/pci/direct.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #define PCI_CONF1_ADDRESS(bus, devfn, reg) \ | 14 | #define PCI_CONF1_ADDRESS(bus, devfn, reg) \ |
15 | (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) | 15 | (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) |
16 | 16 | ||
17 | int pci_conf1_read(unsigned int seg, unsigned int bus, | 17 | static int pci_conf1_read(unsigned int seg, unsigned int bus, |
18 | unsigned int devfn, int reg, int len, u32 *value) | 18 | unsigned int devfn, int reg, int len, u32 *value) |
19 | { | 19 | { |
20 | unsigned long flags; | 20 | unsigned long flags; |
@@ -45,7 +45,7 @@ int pci_conf1_read(unsigned int seg, unsigned int bus, | |||
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
47 | 47 | ||
48 | int pci_conf1_write(unsigned int seg, unsigned int bus, | 48 | static int pci_conf1_write(unsigned int seg, unsigned int bus, |
49 | unsigned int devfn, int reg, int len, u32 value) | 49 | unsigned int devfn, int reg, int len, u32 value) |
50 | { | 50 | { |
51 | unsigned long flags; | 51 | unsigned long flags; |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index 74d30ff33c49..a5ef5f551373 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -215,7 +215,8 @@ static int quirk_aspm_offset[MAX_PCIEROOT << 3]; | |||
215 | 215 | ||
216 | static int quirk_pcie_aspm_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | 216 | static int quirk_pcie_aspm_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) |
217 | { | 217 | { |
218 | return raw_pci_ops->read(0, bus->number, devfn, where, size, value); | 218 | return raw_pci_read(pci_domain_nr(bus), bus->number, |
219 | devfn, where, size, value); | ||
219 | } | 220 | } |
220 | 221 | ||
221 | /* | 222 | /* |
@@ -231,7 +232,8 @@ static int quirk_pcie_aspm_write(struct pci_bus *bus, unsigned int devfn, int wh | |||
231 | if ((offset) && (where == offset)) | 232 | if ((offset) && (where == offset)) |
232 | value = value & 0xfffffffc; | 233 | value = value & 0xfffffffc; |
233 | 234 | ||
234 | return raw_pci_ops->write(0, bus->number, devfn, where, size, value); | 235 | return raw_pci_write(pci_domain_nr(bus), bus->number, |
236 | devfn, where, size, value); | ||
235 | } | 237 | } |
236 | 238 | ||
237 | static struct pci_ops quirk_pcie_aspm_ops = { | 239 | static struct pci_ops quirk_pcie_aspm_ops = { |
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c index 5565d7016b75..e041ced0ce13 100644 --- a/arch/x86/pci/legacy.c +++ b/arch/x86/pci/legacy.c | |||
@@ -22,7 +22,7 @@ static void __devinit pcibios_fixup_peer_bridges(void) | |||
22 | if (pci_find_bus(0, n)) | 22 | if (pci_find_bus(0, n)) |
23 | continue; | 23 | continue; |
24 | for (devfn = 0; devfn < 256; devfn += 8) { | 24 | for (devfn = 0; devfn < 256; devfn += 8) { |
25 | if (!raw_pci_ops->read(0, n, devfn, PCI_VENDOR_ID, 2, &l) && | 25 | if (!raw_pci_read(0, n, devfn, PCI_VENDOR_ID, 2, &l) && |
26 | l != 0x0000 && l != 0xffff) { | 26 | l != 0x0000 && l != 0xffff) { |
27 | DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); | 27 | DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); |
28 | printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); | 28 | printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); |
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 4df637e34f81..8d54df4dfaad 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c | |||
@@ -22,46 +22,13 @@ | |||
22 | #define MMCONFIG_APER_MIN (2 * 1024*1024) | 22 | #define MMCONFIG_APER_MIN (2 * 1024*1024) |
23 | #define MMCONFIG_APER_MAX (256 * 1024*1024) | 23 | #define MMCONFIG_APER_MAX (256 * 1024*1024) |
24 | 24 | ||
25 | DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS); | ||
26 | |||
27 | /* Indicate if the mmcfg resources have been placed into the resource table. */ | 25 | /* Indicate if the mmcfg resources have been placed into the resource table. */ |
28 | static int __initdata pci_mmcfg_resources_inserted; | 26 | static int __initdata pci_mmcfg_resources_inserted; |
29 | 27 | ||
30 | /* K8 systems have some devices (typically in the builtin northbridge) | ||
31 | that are only accessible using type1 | ||
32 | Normally this can be expressed in the MCFG by not listing them | ||
33 | and assigning suitable _SEGs, but this isn't implemented in some BIOS. | ||
34 | Instead try to discover all devices on bus 0 that are unreachable using MM | ||
35 | and fallback for them. */ | ||
36 | static void __init unreachable_devices(void) | ||
37 | { | ||
38 | int i, bus; | ||
39 | /* Use the max bus number from ACPI here? */ | ||
40 | for (bus = 0; bus < PCI_MMCFG_MAX_CHECK_BUS; bus++) { | ||
41 | for (i = 0; i < 32; i++) { | ||
42 | unsigned int devfn = PCI_DEVFN(i, 0); | ||
43 | u32 val1, val2; | ||
44 | |||
45 | pci_conf1_read(0, bus, devfn, 0, 4, &val1); | ||
46 | if (val1 == 0xffffffff) | ||
47 | continue; | ||
48 | |||
49 | if (pci_mmcfg_arch_reachable(0, bus, devfn)) { | ||
50 | raw_pci_ops->read(0, bus, devfn, 0, 4, &val2); | ||
51 | if (val1 == val2) | ||
52 | continue; | ||
53 | } | ||
54 | set_bit(i + 32 * bus, pci_mmcfg_fallback_slots); | ||
55 | printk(KERN_NOTICE "PCI: No mmconfig possible on device" | ||
56 | " %02x:%02x\n", bus, i); | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | |||
61 | static const char __init *pci_mmcfg_e7520(void) | 28 | static const char __init *pci_mmcfg_e7520(void) |
62 | { | 29 | { |
63 | u32 win; | 30 | u32 win; |
64 | pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win); | 31 | pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win); |
65 | 32 | ||
66 | win = win & 0xf000; | 33 | win = win & 0xf000; |
67 | if(win == 0x0000 || win == 0xf000) | 34 | if(win == 0x0000 || win == 0xf000) |
@@ -86,7 +53,7 @@ static const char __init *pci_mmcfg_intel_945(void) | |||
86 | 53 | ||
87 | pci_mmcfg_config_num = 1; | 54 | pci_mmcfg_config_num = 1; |
88 | 55 | ||
89 | pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar); | 56 | pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar); |
90 | 57 | ||
91 | /* Enable bit */ | 58 | /* Enable bit */ |
92 | if (!(pciexbar & 1)) | 59 | if (!(pciexbar & 1)) |
@@ -151,7 +118,7 @@ static int __init pci_mmcfg_check_hostbridge(void) | |||
151 | int i; | 118 | int i; |
152 | const char *name; | 119 | const char *name; |
153 | 120 | ||
154 | pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0, 4, &l); | 121 | pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0, 4, &l); |
155 | vendor = l & 0xffff; | 122 | vendor = l & 0xffff; |
156 | device = (l >> 16) & 0xffff; | 123 | device = (l >> 16) & 0xffff; |
157 | 124 | ||
@@ -270,8 +237,6 @@ void __init pci_mmcfg_init(int type) | |||
270 | return; | 237 | return; |
271 | 238 | ||
272 | if (pci_mmcfg_arch_init()) { | 239 | if (pci_mmcfg_arch_init()) { |
273 | if (type == 1) | ||
274 | unreachable_devices(); | ||
275 | if (known_bridge) | 240 | if (known_bridge) |
276 | pci_mmcfg_insert_resources(IORESOURCE_BUSY); | 241 | pci_mmcfg_insert_resources(IORESOURCE_BUSY); |
277 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; | 242 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; |
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c index 1bf5816d34c8..081816ada057 100644 --- a/arch/x86/pci/mmconfig_32.c +++ b/arch/x86/pci/mmconfig_32.c | |||
@@ -30,10 +30,6 @@ static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn) | |||
30 | struct acpi_mcfg_allocation *cfg; | 30 | struct acpi_mcfg_allocation *cfg; |
31 | int cfg_num; | 31 | int cfg_num; |
32 | 32 | ||
33 | if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS && | ||
34 | test_bit(PCI_SLOT(devfn) + 32*bus, pci_mmcfg_fallback_slots)) | ||
35 | return 0; | ||
36 | |||
37 | for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) { | 33 | for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) { |
38 | cfg = &pci_mmcfg_config[cfg_num]; | 34 | cfg = &pci_mmcfg_config[cfg_num]; |
39 | if (cfg->pci_segment == seg && | 35 | if (cfg->pci_segment == seg && |
@@ -68,13 +64,13 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus, | |||
68 | u32 base; | 64 | u32 base; |
69 | 65 | ||
70 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) { | 66 | if ((bus > 255) || (devfn > 255) || (reg > 4095)) { |
71 | *value = -1; | 67 | err: *value = -1; |
72 | return -EINVAL; | 68 | return -EINVAL; |
73 | } | 69 | } |
74 | 70 | ||
75 | base = get_base_addr(seg, bus, devfn); | 71 | base = get_base_addr(seg, bus, devfn); |
76 | if (!base) | 72 | if (!base) |
77 | return pci_conf1_read(seg,bus,devfn,reg,len,value); | 73 | goto err; |
78 | 74 | ||
79 | spin_lock_irqsave(&pci_config_lock, flags); | 75 | spin_lock_irqsave(&pci_config_lock, flags); |
80 | 76 | ||
@@ -107,7 +103,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | |||
107 | 103 | ||
108 | base = get_base_addr(seg, bus, devfn); | 104 | base = get_base_addr(seg, bus, devfn); |
109 | if (!base) | 105 | if (!base) |
110 | return pci_conf1_write(seg,bus,devfn,reg,len,value); | 106 | return -EINVAL; |
111 | 107 | ||
112 | spin_lock_irqsave(&pci_config_lock, flags); | 108 | spin_lock_irqsave(&pci_config_lock, flags); |
113 | 109 | ||
@@ -134,15 +130,9 @@ static struct pci_raw_ops pci_mmcfg = { | |||
134 | .write = pci_mmcfg_write, | 130 | .write = pci_mmcfg_write, |
135 | }; | 131 | }; |
136 | 132 | ||
137 | int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, | ||
138 | unsigned int devfn) | ||
139 | { | ||
140 | return get_base_addr(seg, bus, devfn) != 0; | ||
141 | } | ||
142 | |||
143 | int __init pci_mmcfg_arch_init(void) | 133 | int __init pci_mmcfg_arch_init(void) |
144 | { | 134 | { |
145 | printk(KERN_INFO "PCI: Using MMCONFIG\n"); | 135 | printk(KERN_INFO "PCI: Using MMCONFIG for extended config space\n"); |
146 | raw_pci_ops = &pci_mmcfg; | 136 | raw_pci_ext_ops = &pci_mmcfg; |
147 | return 1; | 137 | return 1; |
148 | } | 138 | } |
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c index 4095e4d66a1d..9207fd49233c 100644 --- a/arch/x86/pci/mmconfig_64.c +++ b/arch/x86/pci/mmconfig_64.c | |||
@@ -40,9 +40,7 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus) | |||
40 | static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) | 40 | static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) |
41 | { | 41 | { |
42 | char __iomem *addr; | 42 | char __iomem *addr; |
43 | if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS && | 43 | |
44 | test_bit(32*bus + PCI_SLOT(devfn), pci_mmcfg_fallback_slots)) | ||
45 | return NULL; | ||
46 | addr = get_virt(seg, bus); | 44 | addr = get_virt(seg, bus); |
47 | if (!addr) | 45 | if (!addr) |
48 | return NULL; | 46 | return NULL; |
@@ -56,13 +54,13 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus, | |||
56 | 54 | ||
57 | /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ | 55 | /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ |
58 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { | 56 | if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { |
59 | *value = -1; | 57 | err: *value = -1; |
60 | return -EINVAL; | 58 | return -EINVAL; |
61 | } | 59 | } |
62 | 60 | ||
63 | addr = pci_dev_base(seg, bus, devfn); | 61 | addr = pci_dev_base(seg, bus, devfn); |
64 | if (!addr) | 62 | if (!addr) |
65 | return pci_conf1_read(seg,bus,devfn,reg,len,value); | 63 | goto err; |
66 | 64 | ||
67 | switch (len) { | 65 | switch (len) { |
68 | case 1: | 66 | case 1: |
@@ -90,7 +88,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus, | |||
90 | 88 | ||
91 | addr = pci_dev_base(seg, bus, devfn); | 89 | addr = pci_dev_base(seg, bus, devfn); |
92 | if (!addr) | 90 | if (!addr) |
93 | return pci_conf1_write(seg,bus,devfn,reg,len,value); | 91 | return -EINVAL; |
94 | 92 | ||
95 | switch (len) { | 93 | switch (len) { |
96 | case 1: | 94 | case 1: |
@@ -126,12 +124,6 @@ static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg) | |||
126 | return addr; | 124 | return addr; |
127 | } | 125 | } |
128 | 126 | ||
129 | int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, | ||
130 | unsigned int devfn) | ||
131 | { | ||
132 | return pci_dev_base(seg, bus, devfn) != NULL; | ||
133 | } | ||
134 | |||
135 | int __init pci_mmcfg_arch_init(void) | 127 | int __init pci_mmcfg_arch_init(void) |
136 | { | 128 | { |
137 | int i; | 129 | int i; |
@@ -152,6 +144,6 @@ int __init pci_mmcfg_arch_init(void) | |||
152 | return 0; | 144 | return 0; |
153 | } | 145 | } |
154 | } | 146 | } |
155 | raw_pci_ops = &pci_mmcfg; | 147 | raw_pci_ext_ops = &pci_mmcfg; |
156 | return 1; | 148 | return 1; |
157 | } | 149 | } |
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h index ac56d3916c50..3431518d921a 100644 --- a/arch/x86/pci/pci.h +++ b/arch/x86/pci/pci.h | |||
@@ -85,10 +85,17 @@ extern spinlock_t pci_config_lock; | |||
85 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); | 85 | extern int (*pcibios_enable_irq)(struct pci_dev *dev); |
86 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); | 86 | extern void (*pcibios_disable_irq)(struct pci_dev *dev); |
87 | 87 | ||
88 | extern int pci_conf1_write(unsigned int seg, unsigned int bus, | 88 | struct pci_raw_ops { |
89 | unsigned int devfn, int reg, int len, u32 value); | 89 | int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn, |
90 | extern int pci_conf1_read(unsigned int seg, unsigned int bus, | 90 | int reg, int len, u32 *val); |
91 | unsigned int devfn, int reg, int len, u32 *value); | 91 | int (*write)(unsigned int domain, unsigned int bus, unsigned int devfn, |
92 | int reg, int len, u32 val); | ||
93 | }; | ||
94 | |||
95 | extern struct pci_raw_ops *raw_pci_ops; | ||
96 | extern struct pci_raw_ops *raw_pci_ext_ops; | ||
97 | |||
98 | extern struct pci_raw_ops pci_direct_conf1; | ||
92 | 99 | ||
93 | extern int pci_direct_probe(void); | 100 | extern int pci_direct_probe(void); |
94 | extern void pci_direct_init(int type); | 101 | extern void pci_direct_init(int type); |
@@ -98,13 +105,6 @@ extern void pcibios_sort(void); | |||
98 | 105 | ||
99 | /* pci-mmconfig.c */ | 106 | /* pci-mmconfig.c */ |
100 | 107 | ||
101 | /* Verify the first 16 busses. We assume that systems with more busses | ||
102 | get MCFG right. */ | ||
103 | #define PCI_MMCFG_MAX_CHECK_BUS 16 | ||
104 | extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS); | ||
105 | |||
106 | extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, | ||
107 | unsigned int devfn); | ||
108 | extern int __init pci_mmcfg_arch_init(void); | 108 | extern int __init pci_mmcfg_arch_init(void); |
109 | 109 | ||
110 | /* | 110 | /* |
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c index 8ecb1c722594..c2df4e97eed6 100644 --- a/arch/x86/pci/visws.c +++ b/arch/x86/pci/visws.c | |||
@@ -13,9 +13,6 @@ | |||
13 | 13 | ||
14 | #include "pci.h" | 14 | #include "pci.h" |
15 | 15 | ||
16 | |||
17 | extern struct pci_raw_ops pci_direct_conf1; | ||
18 | |||
19 | static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; } | 16 | static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; } |
20 | static void pci_visws_disable_irq(struct pci_dev *dev) { } | 17 | static void pci_visws_disable_irq(struct pci_dev *dev) { } |
21 | 18 | ||
diff --git a/arch/x86/power/Makefile b/arch/x86/power/Makefile index d764ec950065..9ff4d5b55ad1 100644 --- a/arch/x86/power/Makefile +++ b/arch/x86/power/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | obj-$(CONFIG_PM) += cpu.o | 1 | obj-$(CONFIG_PM_SLEEP) += cpu_$(BITS).o |
2 | obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o | 2 | obj-$(CONFIG_HIBERNATION) += hibernate_$(BITS).o hibernate_asm_$(BITS).o |
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu_32.c index efcf620d1439..7f9c6da04a4c 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu_32.c | |||
@@ -40,7 +40,7 @@ static void __save_processor_state(struct saved_context *ctxt) | |||
40 | savesegment(ss, ctxt->ss); | 40 | savesegment(ss, ctxt->ss); |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * control registers | 43 | * control registers |
44 | */ | 44 | */ |
45 | ctxt->cr0 = read_cr0(); | 45 | ctxt->cr0 = read_cr0(); |
46 | ctxt->cr2 = read_cr2(); | 46 | ctxt->cr2 = read_cr2(); |
diff --git a/arch/x86/kernel/suspend_64.c b/arch/x86/power/cpu_64.c index 7ac7130022f1..66bdfb591fd8 100644 --- a/arch/x86/kernel/suspend_64.c +++ b/arch/x86/power/cpu_64.c | |||
@@ -1,8 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * Suspend support specific for i386. | 2 | * Suspend and hibernation support for x86-64 |
3 | * | 3 | * |
4 | * Distribute under GPLv2 | 4 | * Distribute under GPLv2 |
5 | * | 5 | * |
6 | * Copyright (c) 2007 Rafael J. Wysocki <rjw@sisk.pl> | ||
6 | * Copyright (c) 2002 Pavel Machek <pavel@suse.cz> | 7 | * Copyright (c) 2002 Pavel Machek <pavel@suse.cz> |
7 | * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> | 8 | * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> |
8 | */ | 9 | */ |
@@ -14,9 +15,6 @@ | |||
14 | #include <asm/pgtable.h> | 15 | #include <asm/pgtable.h> |
15 | #include <asm/mtrr.h> | 16 | #include <asm/mtrr.h> |
16 | 17 | ||
17 | /* References to section boundaries */ | ||
18 | extern const void __nosave_begin, __nosave_end; | ||
19 | |||
20 | static void fix_processor_context(void); | 18 | static void fix_processor_context(void); |
21 | 19 | ||
22 | struct saved_context saved_context; | 20 | struct saved_context saved_context; |
@@ -63,7 +61,7 @@ static void __save_processor_state(struct saved_context *ctxt) | |||
63 | mtrr_save_fixed_ranges(NULL); | 61 | mtrr_save_fixed_ranges(NULL); |
64 | 62 | ||
65 | /* | 63 | /* |
66 | * control registers | 64 | * control registers |
67 | */ | 65 | */ |
68 | rdmsrl(MSR_EFER, ctxt->efer); | 66 | rdmsrl(MSR_EFER, ctxt->efer); |
69 | ctxt->cr0 = read_cr0(); | 67 | ctxt->cr0 = read_cr0(); |
@@ -166,155 +164,3 @@ static void fix_processor_context(void) | |||
166 | loaddebug(¤t->thread, 7); | 164 | loaddebug(¤t->thread, 7); |
167 | } | 165 | } |
168 | } | 166 | } |
169 | |||
170 | #ifdef CONFIG_HIBERNATION | ||
171 | /* Defined in arch/x86_64/kernel/suspend_asm.S */ | ||
172 | extern int restore_image(void); | ||
173 | |||
174 | /* | ||
175 | * Address to jump to in the last phase of restore in order to get to the image | ||
176 | * kernel's text (this value is passed in the image header). | ||
177 | */ | ||
178 | unsigned long restore_jump_address; | ||
179 | |||
180 | /* | ||
181 | * Value of the cr3 register from before the hibernation (this value is passed | ||
182 | * in the image header). | ||
183 | */ | ||
184 | unsigned long restore_cr3; | ||
185 | |||
186 | pgd_t *temp_level4_pgt; | ||
187 | |||
188 | void *relocated_restore_code; | ||
189 | |||
190 | static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) | ||
191 | { | ||
192 | long i, j; | ||
193 | |||
194 | i = pud_index(address); | ||
195 | pud = pud + i; | ||
196 | for (; i < PTRS_PER_PUD; pud++, i++) { | ||
197 | unsigned long paddr; | ||
198 | pmd_t *pmd; | ||
199 | |||
200 | paddr = address + i*PUD_SIZE; | ||
201 | if (paddr >= end) | ||
202 | break; | ||
203 | |||
204 | pmd = (pmd_t *)get_safe_page(GFP_ATOMIC); | ||
205 | if (!pmd) | ||
206 | return -ENOMEM; | ||
207 | set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE)); | ||
208 | for (j = 0; j < PTRS_PER_PMD; pmd++, j++, paddr += PMD_SIZE) { | ||
209 | unsigned long pe; | ||
210 | |||
211 | if (paddr >= end) | ||
212 | break; | ||
213 | pe = __PAGE_KERNEL_LARGE_EXEC | paddr; | ||
214 | pe &= __supported_pte_mask; | ||
215 | set_pmd(pmd, __pmd(pe)); | ||
216 | } | ||
217 | } | ||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static int set_up_temporary_mappings(void) | ||
222 | { | ||
223 | unsigned long start, end, next; | ||
224 | int error; | ||
225 | |||
226 | temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC); | ||
227 | if (!temp_level4_pgt) | ||
228 | return -ENOMEM; | ||
229 | |||
230 | /* It is safe to reuse the original kernel mapping */ | ||
231 | set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map), | ||
232 | init_level4_pgt[pgd_index(__START_KERNEL_map)]); | ||
233 | |||
234 | /* Set up the direct mapping from scratch */ | ||
235 | start = (unsigned long)pfn_to_kaddr(0); | ||
236 | end = (unsigned long)pfn_to_kaddr(end_pfn); | ||
237 | |||
238 | for (; start < end; start = next) { | ||
239 | pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC); | ||
240 | if (!pud) | ||
241 | return -ENOMEM; | ||
242 | next = start + PGDIR_SIZE; | ||
243 | if (next > end) | ||
244 | next = end; | ||
245 | if ((error = res_phys_pud_init(pud, __pa(start), __pa(next)))) | ||
246 | return error; | ||
247 | set_pgd(temp_level4_pgt + pgd_index(start), | ||
248 | mk_kernel_pgd(__pa(pud))); | ||
249 | } | ||
250 | return 0; | ||
251 | } | ||
252 | |||
253 | int swsusp_arch_resume(void) | ||
254 | { | ||
255 | int error; | ||
256 | |||
257 | /* We have got enough memory and from now on we cannot recover */ | ||
258 | if ((error = set_up_temporary_mappings())) | ||
259 | return error; | ||
260 | |||
261 | relocated_restore_code = (void *)get_safe_page(GFP_ATOMIC); | ||
262 | if (!relocated_restore_code) | ||
263 | return -ENOMEM; | ||
264 | memcpy(relocated_restore_code, &core_restore_code, | ||
265 | &restore_registers - &core_restore_code); | ||
266 | |||
267 | restore_image(); | ||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | /* | ||
272 | * pfn_is_nosave - check if given pfn is in the 'nosave' section | ||
273 | */ | ||
274 | |||
275 | int pfn_is_nosave(unsigned long pfn) | ||
276 | { | ||
277 | unsigned long nosave_begin_pfn = __pa_symbol(&__nosave_begin) >> PAGE_SHIFT; | ||
278 | unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT; | ||
279 | return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn); | ||
280 | } | ||
281 | |||
282 | struct restore_data_record { | ||
283 | unsigned long jump_address; | ||
284 | unsigned long cr3; | ||
285 | unsigned long magic; | ||
286 | }; | ||
287 | |||
288 | #define RESTORE_MAGIC 0x0123456789ABCDEFUL | ||
289 | |||
290 | /** | ||
291 | * arch_hibernation_header_save - populate the architecture specific part | ||
292 | * of a hibernation image header | ||
293 | * @addr: address to save the data at | ||
294 | */ | ||
295 | int arch_hibernation_header_save(void *addr, unsigned int max_size) | ||
296 | { | ||
297 | struct restore_data_record *rdr = addr; | ||
298 | |||
299 | if (max_size < sizeof(struct restore_data_record)) | ||
300 | return -EOVERFLOW; | ||
301 | rdr->jump_address = restore_jump_address; | ||
302 | rdr->cr3 = restore_cr3; | ||
303 | rdr->magic = RESTORE_MAGIC; | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * arch_hibernation_header_restore - read the architecture specific data | ||
309 | * from the hibernation image header | ||
310 | * @addr: address to read the data from | ||
311 | */ | ||
312 | int arch_hibernation_header_restore(void *addr) | ||
313 | { | ||
314 | struct restore_data_record *rdr = addr; | ||
315 | |||
316 | restore_jump_address = rdr->jump_address; | ||
317 | restore_cr3 = rdr->cr3; | ||
318 | return (rdr->magic == RESTORE_MAGIC) ? 0 : -EINVAL; | ||
319 | } | ||
320 | #endif /* CONFIG_HIBERNATION */ | ||
diff --git a/arch/x86/power/suspend.c b/arch/x86/power/hibernate_32.c index a0020b913f31..f2b6e3f11bfc 100644 --- a/arch/x86/power/suspend.c +++ b/arch/x86/power/hibernate_32.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Suspend support specific for i386 - temporary page tables | 2 | * Hibernation support specific for i386 - temporary page tables |
3 | * | 3 | * |
4 | * Distribute under GPLv2 | 4 | * Distribute under GPLv2 |
5 | * | 5 | * |
@@ -13,7 +13,7 @@ | |||
13 | #include <asm/page.h> | 13 | #include <asm/page.h> |
14 | #include <asm/pgtable.h> | 14 | #include <asm/pgtable.h> |
15 | 15 | ||
16 | /* Defined in arch/i386/power/swsusp.S */ | 16 | /* Defined in hibernate_asm_32.S */ |
17 | extern int restore_image(void); | 17 | extern int restore_image(void); |
18 | 18 | ||
19 | /* References to section boundaries */ | 19 | /* References to section boundaries */ |
@@ -23,7 +23,7 @@ extern const void __nosave_begin, __nosave_end; | |||
23 | pgd_t *resume_pg_dir; | 23 | pgd_t *resume_pg_dir; |
24 | 24 | ||
25 | /* The following three functions are based on the analogous code in | 25 | /* The following three functions are based on the analogous code in |
26 | * arch/i386/mm/init.c | 26 | * arch/x86/mm/init_32.c |
27 | */ | 27 | */ |
28 | 28 | ||
29 | /* | 29 | /* |
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c new file mode 100644 index 000000000000..b542355e0e34 --- /dev/null +++ b/arch/x86/power/hibernate_64.c | |||
@@ -0,0 +1,169 @@ | |||
1 | /* | ||
2 | * Hibernation support for x86-64 | ||
3 | * | ||
4 | * Distribute under GPLv2 | ||
5 | * | ||
6 | * Copyright (c) 2007 Rafael J. Wysocki <rjw@sisk.pl> | ||
7 | * Copyright (c) 2002 Pavel Machek <pavel@suse.cz> | ||
8 | * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> | ||
9 | */ | ||
10 | |||
11 | #include <linux/smp.h> | ||
12 | #include <linux/suspend.h> | ||
13 | #include <asm/proto.h> | ||
14 | #include <asm/page.h> | ||
15 | #include <asm/pgtable.h> | ||
16 | #include <asm/mtrr.h> | ||
17 | |||
18 | /* References to section boundaries */ | ||
19 | extern const void __nosave_begin, __nosave_end; | ||
20 | |||
21 | /* Defined in hibernate_asm_64.S */ | ||
22 | extern int restore_image(void); | ||
23 | |||
24 | /* | ||
25 | * Address to jump to in the last phase of restore in order to get to the image | ||
26 | * kernel's text (this value is passed in the image header). | ||
27 | */ | ||
28 | unsigned long restore_jump_address; | ||
29 | |||
30 | /* | ||
31 | * Value of the cr3 register from before the hibernation (this value is passed | ||
32 | * in the image header). | ||
33 | */ | ||
34 | unsigned long restore_cr3; | ||
35 | |||
36 | pgd_t *temp_level4_pgt; | ||
37 | |||
38 | void *relocated_restore_code; | ||
39 | |||
40 | static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) | ||
41 | { | ||
42 | long i, j; | ||
43 | |||
44 | i = pud_index(address); | ||
45 | pud = pud + i; | ||
46 | for (; i < PTRS_PER_PUD; pud++, i++) { | ||
47 | unsigned long paddr; | ||
48 | pmd_t *pmd; | ||
49 | |||
50 | paddr = address + i*PUD_SIZE; | ||
51 | if (paddr >= end) | ||
52 | break; | ||
53 | |||
54 | pmd = (pmd_t *)get_safe_page(GFP_ATOMIC); | ||
55 | if (!pmd) | ||
56 | return -ENOMEM; | ||
57 | set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE)); | ||
58 | for (j = 0; j < PTRS_PER_PMD; pmd++, j++, paddr += PMD_SIZE) { | ||
59 | unsigned long pe; | ||
60 | |||
61 | if (paddr >= end) | ||
62 | break; | ||
63 | pe = __PAGE_KERNEL_LARGE_EXEC | paddr; | ||
64 | pe &= __supported_pte_mask; | ||
65 | set_pmd(pmd, __pmd(pe)); | ||
66 | } | ||
67 | } | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static int set_up_temporary_mappings(void) | ||
72 | { | ||
73 | unsigned long start, end, next; | ||
74 | int error; | ||
75 | |||
76 | temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC); | ||
77 | if (!temp_level4_pgt) | ||
78 | return -ENOMEM; | ||
79 | |||
80 | /* It is safe to reuse the original kernel mapping */ | ||
81 | set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map), | ||
82 | init_level4_pgt[pgd_index(__START_KERNEL_map)]); | ||
83 | |||
84 | /* Set up the direct mapping from scratch */ | ||
85 | start = (unsigned long)pfn_to_kaddr(0); | ||
86 | end = (unsigned long)pfn_to_kaddr(end_pfn); | ||
87 | |||
88 | for (; start < end; start = next) { | ||
89 | pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC); | ||
90 | if (!pud) | ||
91 | return -ENOMEM; | ||
92 | next = start + PGDIR_SIZE; | ||
93 | if (next > end) | ||
94 | next = end; | ||
95 | if ((error = res_phys_pud_init(pud, __pa(start), __pa(next)))) | ||
96 | return error; | ||
97 | set_pgd(temp_level4_pgt + pgd_index(start), | ||
98 | mk_kernel_pgd(__pa(pud))); | ||
99 | } | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | int swsusp_arch_resume(void) | ||
104 | { | ||
105 | int error; | ||
106 | |||
107 | /* We have got enough memory and from now on we cannot recover */ | ||
108 | if ((error = set_up_temporary_mappings())) | ||
109 | return error; | ||
110 | |||
111 | relocated_restore_code = (void *)get_safe_page(GFP_ATOMIC); | ||
112 | if (!relocated_restore_code) | ||
113 | return -ENOMEM; | ||
114 | memcpy(relocated_restore_code, &core_restore_code, | ||
115 | &restore_registers - &core_restore_code); | ||
116 | |||
117 | restore_image(); | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * pfn_is_nosave - check if given pfn is in the 'nosave' section | ||
123 | */ | ||
124 | |||
125 | int pfn_is_nosave(unsigned long pfn) | ||
126 | { | ||
127 | unsigned long nosave_begin_pfn = __pa_symbol(&__nosave_begin) >> PAGE_SHIFT; | ||
128 | unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT; | ||
129 | return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn); | ||
130 | } | ||
131 | |||
132 | struct restore_data_record { | ||
133 | unsigned long jump_address; | ||
134 | unsigned long cr3; | ||
135 | unsigned long magic; | ||
136 | }; | ||
137 | |||
138 | #define RESTORE_MAGIC 0x0123456789ABCDEFUL | ||
139 | |||
140 | /** | ||
141 | * arch_hibernation_header_save - populate the architecture specific part | ||
142 | * of a hibernation image header | ||
143 | * @addr: address to save the data at | ||
144 | */ | ||
145 | int arch_hibernation_header_save(void *addr, unsigned int max_size) | ||
146 | { | ||
147 | struct restore_data_record *rdr = addr; | ||
148 | |||
149 | if (max_size < sizeof(struct restore_data_record)) | ||
150 | return -EOVERFLOW; | ||
151 | rdr->jump_address = restore_jump_address; | ||
152 | rdr->cr3 = restore_cr3; | ||
153 | rdr->magic = RESTORE_MAGIC; | ||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | /** | ||
158 | * arch_hibernation_header_restore - read the architecture specific data | ||
159 | * from the hibernation image header | ||
160 | * @addr: address to read the data from | ||
161 | */ | ||
162 | int arch_hibernation_header_restore(void *addr) | ||
163 | { | ||
164 | struct restore_data_record *rdr = addr; | ||
165 | |||
166 | restore_jump_address = rdr->jump_address; | ||
167 | restore_cr3 = rdr->cr3; | ||
168 | return (rdr->magic == RESTORE_MAGIC) ? 0 : -EINVAL; | ||
169 | } | ||
diff --git a/arch/x86/power/swsusp.S b/arch/x86/power/hibernate_asm_32.S index 53662e05b393..b95aa6cfe3cb 100644 --- a/arch/x86/power/swsusp.S +++ b/arch/x86/power/hibernate_asm_32.S | |||
@@ -1,7 +1,6 @@ | |||
1 | .text | 1 | .text |
2 | 2 | ||
3 | /* Originally gcc generated, modified by hand | 3 | /* |
4 | * | ||
5 | * This may not use any stack, nor any variable that is not "NoSave": | 4 | * This may not use any stack, nor any variable that is not "NoSave": |
6 | * | 5 | * |
7 | * Its rewriting one kernel image with another. What is stack in "old" | 6 | * Its rewriting one kernel image with another. What is stack in "old" |
diff --git a/arch/x86/kernel/suspend_asm_64.S b/arch/x86/power/hibernate_asm_64.S index aeb9a4d7681e..1deb3244b99b 100644 --- a/arch/x86/kernel/suspend_asm_64.S +++ b/arch/x86/power/hibernate_asm_64.S | |||
@@ -1,7 +1,12 @@ | |||
1 | /* Copyright 2004,2005 Pavel Machek <pavel@suse.cz>, Andi Kleen <ak@suse.de>, Rafael J. Wysocki <rjw@sisk.pl> | 1 | /* |
2 | * Hibernation support for x86-64 | ||
2 | * | 3 | * |
3 | * Distribute under GPLv2. | 4 | * Distribute under GPLv2. |
4 | * | 5 | * |
6 | * Copyright 2007 Rafael J. Wysocki <rjw@sisk.pl> | ||
7 | * Copyright 2005 Andi Kleen <ak@suse.de> | ||
8 | * Copyright 2004 Pavel Machek <pavel@suse.cz> | ||
9 | * | ||
5 | * swsusp_arch_resume must not use any stack or any nonlocal variables while | 10 | * swsusp_arch_resume must not use any stack or any nonlocal variables while |
6 | * copying pages: | 11 | * copying pages: |
7 | * | 12 | * |
@@ -9,7 +14,7 @@ | |||
9 | * image could very well be data page in "new" image, and overwriting | 14 | * image could very well be data page in "new" image, and overwriting |
10 | * your own stack under you is bad idea. | 15 | * your own stack under you is bad idea. |
11 | */ | 16 | */ |
12 | 17 | ||
13 | .text | 18 | .text |
14 | #include <linux/linkage.h> | 19 | #include <linux/linkage.h> |
15 | #include <asm/segment.h> | 20 | #include <asm/segment.h> |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 45aa771e73a9..0144395448ae 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | xmaddr_t arbitrary_virt_to_machine(unsigned long address) | 59 | xmaddr_t arbitrary_virt_to_machine(unsigned long address) |
60 | { | 60 | { |
61 | int level; | 61 | unsigned int level; |
62 | pte_t *pte = lookup_address(address, &level); | 62 | pte_t *pte = lookup_address(address, &level); |
63 | unsigned offset = address & PAGE_MASK; | 63 | unsigned offset = address & PAGE_MASK; |
64 | 64 | ||
@@ -71,7 +71,7 @@ void make_lowmem_page_readonly(void *vaddr) | |||
71 | { | 71 | { |
72 | pte_t *pte, ptev; | 72 | pte_t *pte, ptev; |
73 | unsigned long address = (unsigned long)vaddr; | 73 | unsigned long address = (unsigned long)vaddr; |
74 | int level; | 74 | unsigned int level; |
75 | 75 | ||
76 | pte = lookup_address(address, &level); | 76 | pte = lookup_address(address, &level); |
77 | BUG_ON(pte == NULL); | 77 | BUG_ON(pte == NULL); |
@@ -86,7 +86,7 @@ void make_lowmem_page_readwrite(void *vaddr) | |||
86 | { | 86 | { |
87 | pte_t *pte, ptev; | 87 | pte_t *pte, ptev; |
88 | unsigned long address = (unsigned long)vaddr; | 88 | unsigned long address = (unsigned long)vaddr; |
89 | int level; | 89 | unsigned int level; |
90 | 90 | ||
91 | pte = lookup_address(address, &level); | 91 | pte = lookup_address(address, &level); |
92 | BUG_ON(pte == NULL); | 92 | BUG_ON(pte == NULL); |
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index b3721fd6877b..c39e1a5aa241 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c | |||
@@ -217,17 +217,17 @@ unsigned long long xen_sched_clock(void) | |||
217 | /* Get the CPU speed from Xen */ | 217 | /* Get the CPU speed from Xen */ |
218 | unsigned long xen_cpu_khz(void) | 218 | unsigned long xen_cpu_khz(void) |
219 | { | 219 | { |
220 | u64 cpu_khz = 1000000ULL << 32; | 220 | u64 xen_khz = 1000000ULL << 32; |
221 | const struct vcpu_time_info *info = | 221 | const struct vcpu_time_info *info = |
222 | &HYPERVISOR_shared_info->vcpu_info[0].time; | 222 | &HYPERVISOR_shared_info->vcpu_info[0].time; |
223 | 223 | ||
224 | do_div(cpu_khz, info->tsc_to_system_mul); | 224 | do_div(xen_khz, info->tsc_to_system_mul); |
225 | if (info->tsc_shift < 0) | 225 | if (info->tsc_shift < 0) |
226 | cpu_khz <<= -info->tsc_shift; | 226 | xen_khz <<= -info->tsc_shift; |
227 | else | 227 | else |
228 | cpu_khz >>= info->tsc_shift; | 228 | xen_khz >>= info->tsc_shift; |
229 | 229 | ||
230 | return cpu_khz; | 230 | return xen_khz; |
231 | } | 231 | } |
232 | 232 | ||
233 | /* | 233 | /* |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index fd36764d7fb7..9fc8551a1cf6 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -14,6 +14,7 @@ config ZONE_DMA | |||
14 | config XTENSA | 14 | config XTENSA |
15 | bool | 15 | bool |
16 | default y | 16 | default y |
17 | select HAVE_IDE | ||
17 | help | 18 | help |
18 | Xtensa processors are 32-bit RISC machines designed by Tensilica | 19 | Xtensa processors are 32-bit RISC machines designed by Tensilica |
19 | primarily for embedded systems. These processors are both | 20 | primarily for embedded systems. These processors are both |
diff --git a/drivers/Kconfig b/drivers/Kconfig index b86877bdc7ac..3a0e3549739f 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -80,6 +80,8 @@ source "drivers/usb/Kconfig" | |||
80 | 80 | ||
81 | source "drivers/mmc/Kconfig" | 81 | source "drivers/mmc/Kconfig" |
82 | 82 | ||
83 | source "drivers/memstick/Kconfig" | ||
84 | |||
83 | source "drivers/leds/Kconfig" | 85 | source "drivers/leds/Kconfig" |
84 | 86 | ||
85 | source "drivers/infiniband/Kconfig" | 87 | source "drivers/infiniband/Kconfig" |
diff --git a/drivers/Makefile b/drivers/Makefile index 30ba97ec5eb5..e5e394a7e6c0 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -78,6 +78,7 @@ obj-y += lguest/ | |||
78 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ | 78 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ |
79 | obj-$(CONFIG_CPU_IDLE) += cpuidle/ | 79 | obj-$(CONFIG_CPU_IDLE) += cpuidle/ |
80 | obj-$(CONFIG_MMC) += mmc/ | 80 | obj-$(CONFIG_MMC) += mmc/ |
81 | obj-$(CONFIG_MEMSTICK) += memstick/ | ||
81 | obj-$(CONFIG_NEW_LEDS) += leds/ | 82 | obj-$(CONFIG_NEW_LEDS) += leds/ |
82 | obj-$(CONFIG_INFINIBAND) += infiniband/ | 83 | obj-$(CONFIG_INFINIBAND) += infiniband/ |
83 | obj-$(CONFIG_SGI_SN) += sn/ | 84 | obj-$(CONFIG_SGI_SN) += sn/ |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index f29812a86533..40b0fcae4c78 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -60,5 +60,5 @@ obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o | |||
60 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o | 60 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o |
61 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o | 61 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o |
62 | obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o | 62 | obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o |
63 | obj-$(CONFIG_ACPI_SBS) += sbs.o | ||
64 | obj-$(CONFIG_ACPI_SBS) += sbshc.o | 63 | obj-$(CONFIG_ACPI_SBS) += sbshc.o |
64 | obj-$(CONFIG_ACPI_SBS) += sbs.o | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 8b0d4b7d188a..ce3c0a2cbac4 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/pm.h> | 31 | #include <linux/pm.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
34 | #include <linux/acpi.h> | ||
34 | #ifdef CONFIG_X86 | 35 | #ifdef CONFIG_X86 |
35 | #include <asm/mpspec.h> | 36 | #include <asm/mpspec.h> |
36 | #endif | 37 | #endif |
@@ -39,9 +40,6 @@ | |||
39 | 40 | ||
40 | #define _COMPONENT ACPI_BUS_COMPONENT | 41 | #define _COMPONENT ACPI_BUS_COMPONENT |
41 | ACPI_MODULE_NAME("bus"); | 42 | ACPI_MODULE_NAME("bus"); |
42 | #ifdef CONFIG_X86 | ||
43 | extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); | ||
44 | #endif | ||
45 | 43 | ||
46 | struct acpi_device *acpi_root; | 44 | struct acpi_device *acpi_root; |
47 | struct proc_dir_entry *acpi_root_dir; | 45 | struct proc_dir_entry *acpi_root_dir; |
@@ -653,8 +651,6 @@ void __init acpi_early_init(void) | |||
653 | 651 | ||
654 | #ifdef CONFIG_X86 | 652 | #ifdef CONFIG_X86 |
655 | if (!acpi_ioapic) { | 653 | if (!acpi_ioapic) { |
656 | extern u8 acpi_sci_flags; | ||
657 | |||
658 | /* compatible (0) means level (3) */ | 654 | /* compatible (0) means level (3) */ |
659 | if (!(acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)) { | 655 | if (!(acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)) { |
660 | acpi_sci_flags &= ~ACPI_MADT_TRIGGER_MASK; | 656 | acpi_sci_flags &= ~ACPI_MADT_TRIGGER_MASK; |
@@ -664,7 +660,6 @@ void __init acpi_early_init(void) | |||
664 | acpi_pic_sci_set_trigger(acpi_gbl_FADT.sci_interrupt, | 660 | acpi_pic_sci_set_trigger(acpi_gbl_FADT.sci_interrupt, |
665 | (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2); | 661 | (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2); |
666 | } else { | 662 | } else { |
667 | extern int acpi_sci_override_gsi; | ||
668 | /* | 663 | /* |
669 | * now that acpi_gbl_FADT is initialized, | 664 | * now that acpi_gbl_FADT is initialized, |
670 | * update it with result from INT_SRC_OVR parsing | 665 | * update it with result from INT_SRC_OVR parsing |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index a14501c98f40..34b3386dedca 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -200,15 +200,6 @@ acpi_status __init acpi_os_initialize(void) | |||
200 | 200 | ||
201 | acpi_status acpi_os_initialize1(void) | 201 | acpi_status acpi_os_initialize1(void) |
202 | { | 202 | { |
203 | /* | ||
204 | * Initialize PCI configuration space access, as we'll need to access | ||
205 | * it while walking the namespace (bus 0 and root bridges w/ _BBNs). | ||
206 | */ | ||
207 | if (!raw_pci_ops) { | ||
208 | printk(KERN_ERR PREFIX | ||
209 | "Access to PCI configuration space unavailable\n"); | ||
210 | return AE_NULL_ENTRY; | ||
211 | } | ||
212 | kacpid_wq = create_singlethread_workqueue("kacpid"); | 203 | kacpid_wq = create_singlethread_workqueue("kacpid"); |
213 | kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); | 204 | kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); |
214 | BUG_ON(!kacpid_wq); | 205 | BUG_ON(!kacpid_wq); |
@@ -653,11 +644,9 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
653 | return AE_ERROR; | 644 | return AE_ERROR; |
654 | } | 645 | } |
655 | 646 | ||
656 | BUG_ON(!raw_pci_ops); | 647 | result = raw_pci_read(pci_id->segment, pci_id->bus, |
657 | 648 | PCI_DEVFN(pci_id->device, pci_id->function), | |
658 | result = raw_pci_ops->read(pci_id->segment, pci_id->bus, | 649 | reg, size, value); |
659 | PCI_DEVFN(pci_id->device, pci_id->function), | ||
660 | reg, size, value); | ||
661 | 650 | ||
662 | return (result ? AE_ERROR : AE_OK); | 651 | return (result ? AE_ERROR : AE_OK); |
663 | } | 652 | } |
@@ -682,11 +671,9 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
682 | return AE_ERROR; | 671 | return AE_ERROR; |
683 | } | 672 | } |
684 | 673 | ||
685 | BUG_ON(!raw_pci_ops); | 674 | result = raw_pci_write(pci_id->segment, pci_id->bus, |
686 | 675 | PCI_DEVFN(pci_id->device, pci_id->function), | |
687 | result = raw_pci_ops->write(pci_id->segment, pci_id->bus, | 676 | reg, size, value); |
688 | PCI_DEVFN(pci_id->device, pci_id->function), | ||
689 | reg, size, value); | ||
690 | 677 | ||
691 | return (result ? AE_ERROR : AE_OK); | 678 | return (result ? AE_ERROR : AE_OK); |
692 | } | 679 | } |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 1194105cc3ca..585ae3c9c8ea 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -827,7 +827,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
827 | #endif | 827 | #endif |
828 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", | 828 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", |
829 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 829 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
830 | battery->name, sbs->battery->present ? "present" : "absent"); | 830 | battery->name, battery->present ? "present" : "absent"); |
831 | return result; | 831 | return result; |
832 | } | 832 | } |
833 | 833 | ||
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index ae9a90438e2f..a2cf3008ce6c 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -117,6 +117,11 @@ static int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol, | |||
117 | int ret = -EFAULT, i; | 117 | int ret = -EFAULT, i; |
118 | u8 temp, sz = 0; | 118 | u8 temp, sz = 0; |
119 | 119 | ||
120 | if (!hc) { | ||
121 | printk(KERN_ERR PREFIX "host controller is not configured\n"); | ||
122 | return ret; | ||
123 | } | ||
124 | |||
120 | mutex_lock(&hc->lock); | 125 | mutex_lock(&hc->lock); |
121 | if (smb_hc_read(hc, ACPI_SMB_PROTOCOL, &temp)) | 126 | if (smb_hc_read(hc, ACPI_SMB_PROTOCOL, &temp)) |
122 | goto end; | 127 | goto end; |
@@ -292,6 +297,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device, int type) | |||
292 | hc = acpi_driver_data(device); | 297 | hc = acpi_driver_data(device); |
293 | acpi_ec_remove_query_handler(hc->ec, hc->query_bit); | 298 | acpi_ec_remove_query_handler(hc->ec, hc->query_bit); |
294 | kfree(hc); | 299 | kfree(hc); |
300 | acpi_driver_data(device) = NULL; | ||
295 | return 0; | 301 | return 0; |
296 | } | 302 | } |
297 | 303 | ||
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index a70c1c29a7aa..c452e2d355ee 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -657,7 +657,6 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq) | |||
657 | if ((cmd = ub_get_cmd(lun)) == NULL) | 657 | if ((cmd = ub_get_cmd(lun)) == NULL) |
658 | return -1; | 658 | return -1; |
659 | memset(cmd, 0, sizeof(struct ub_scsi_cmd)); | 659 | memset(cmd, 0, sizeof(struct ub_scsi_cmd)); |
660 | sg_init_table(cmd->sgv, UB_MAX_REQ_SG); | ||
661 | 660 | ||
662 | blkdev_dequeue_request(rq); | 661 | blkdev_dequeue_request(rq); |
663 | 662 | ||
@@ -668,6 +667,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq) | |||
668 | /* | 667 | /* |
669 | * get scatterlist from block layer | 668 | * get scatterlist from block layer |
670 | */ | 669 | */ |
670 | sg_init_table(&urq->sgv[0], UB_MAX_REQ_SG); | ||
671 | n_elem = blk_rq_map_sg(lun->disk->queue, rq, &urq->sgv[0]); | 671 | n_elem = blk_rq_map_sg(lun->disk->queue, rq, &urq->sgv[0]); |
672 | if (n_elem < 0) { | 672 | if (n_elem < 0) { |
673 | /* Impossible, because blk_rq_map_sg should not hit ENOMEM. */ | 673 | /* Impossible, because blk_rq_map_sg should not hit ENOMEM. */ |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index f01ac9a07bf5..47c6be84fc84 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -875,7 +875,7 @@ config SONYPI | |||
875 | Device which can be found in many (all ?) Sony Vaio laptops. | 875 | Device which can be found in many (all ?) Sony Vaio laptops. |
876 | 876 | ||
877 | If you have one of those laptops, read | 877 | If you have one of those laptops, read |
878 | <file:Documentation/sonypi.txt>, and say Y or M here. | 878 | <file:Documentation/laptops/sonypi.txt>, and say Y or M here. |
879 | 879 | ||
880 | To compile this driver as a module, choose M here: the | 880 | To compile this driver as a module, choose M here: the |
881 | module will be called sonypi. | 881 | module will be called sonypi. |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 2c4b2d47973e..60f71e6345e3 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -27,6 +27,17 @@ static void (*pm_idle_old)(void); | |||
27 | 27 | ||
28 | static int enabled_devices; | 28 | static int enabled_devices; |
29 | 29 | ||
30 | #if defined(CONFIG_ARCH_HAS_CPU_IDLE_WAIT) | ||
31 | static void cpuidle_kick_cpus(void) | ||
32 | { | ||
33 | cpu_idle_wait(); | ||
34 | } | ||
35 | #elif defined(CONFIG_SMP) | ||
36 | # error "Arch needs cpu_idle_wait() equivalent here" | ||
37 | #else /* !CONFIG_ARCH_HAS_CPU_IDLE_WAIT && !CONFIG_SMP */ | ||
38 | static void cpuidle_kick_cpus(void) {} | ||
39 | #endif | ||
40 | |||
30 | /** | 41 | /** |
31 | * cpuidle_idle_call - the main idle loop | 42 | * cpuidle_idle_call - the main idle loop |
32 | * | 43 | * |
@@ -83,7 +94,7 @@ void cpuidle_uninstall_idle_handler(void) | |||
83 | { | 94 | { |
84 | if (enabled_devices && (pm_idle != pm_idle_old)) { | 95 | if (enabled_devices && (pm_idle != pm_idle_old)) { |
85 | pm_idle = pm_idle_old; | 96 | pm_idle = pm_idle_old; |
86 | cpu_idle_wait(); | 97 | cpuidle_kick_cpus(); |
87 | } | 98 | } |
88 | } | 99 | } |
89 | 100 | ||
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index ab8fb257528e..043c34ad0a05 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -4,10 +4,14 @@ | |||
4 | # Andre Hedrick <andre@linux-ide.org> | 4 | # Andre Hedrick <andre@linux-ide.org> |
5 | # | 5 | # |
6 | 6 | ||
7 | # Select HAVE_IDE if IDE is supported | ||
8 | config HAVE_IDE | ||
9 | def_bool n | ||
10 | |||
7 | menuconfig IDE | 11 | menuconfig IDE |
8 | tristate "ATA/ATAPI/MFM/RLL support" | 12 | tristate "ATA/ATAPI/MFM/RLL support" |
13 | depends on HAVE_IDE | ||
9 | depends on BLOCK | 14 | depends on BLOCK |
10 | depends on HAS_IOMEM | ||
11 | ---help--- | 15 | ---help--- |
12 | If you say Y here, your kernel will be able to manage low cost mass | 16 | If you say Y here, your kernel will be able to manage low cost mass |
13 | storage units such as ATA/(E)IDE and ATAPI units. The most common | 17 | storage units such as ATA/(E)IDE and ATAPI units. The most common |
diff --git a/drivers/isdn/hisax/avm_a1p.c b/drivers/isdn/hisax/avm_a1p.c index c87fa3f9b298..3039c6d68fc4 100644 --- a/drivers/isdn/hisax/avm_a1p.c +++ b/drivers/isdn/hisax/avm_a1p.c | |||
@@ -213,8 +213,7 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
215 | 215 | ||
216 | int | 216 | int __devinit setup_avm_a1_pcmcia(struct IsdnCard *card) |
217 | setup_avm_a1_pcmcia(struct IsdnCard *card) | ||
218 | { | 217 | { |
219 | u_char model, vers; | 218 | u_char model, vers; |
220 | struct IsdnCardState *cs = card->cs; | 219 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index 97097ef3491e..a0ee43c04dd5 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c | |||
@@ -847,7 +847,7 @@ static int init_card(struct IsdnCardState *cs) | |||
847 | return 3; | 847 | return 3; |
848 | } | 848 | } |
849 | 849 | ||
850 | static int hisax_cs_setup_card(struct IsdnCard *card) | 850 | static int __devinit hisax_cs_setup_card(struct IsdnCard *card) |
851 | { | 851 | { |
852 | int ret; | 852 | int ret; |
853 | 853 | ||
@@ -1166,7 +1166,10 @@ outf_cs: | |||
1166 | return 0; | 1166 | return 0; |
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | static int checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner) | 1169 | /* Used from an exported function but calls __devinit functions. |
1170 | * Tell modpost not to warn (__ref) | ||
1171 | */ | ||
1172 | static int __ref checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner) | ||
1170 | { | 1173 | { |
1171 | int ret; | 1174 | int ret; |
1172 | struct IsdnCard *card = cards + cardnr; | 1175 | struct IsdnCard *card = cards + cardnr; |
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c index 4fd09d21a27f..05482d2688e3 100644 --- a/drivers/isdn/hisax/hfc_sx.c +++ b/drivers/isdn/hisax/hfc_sx.c | |||
@@ -1330,8 +1330,7 @@ hfcsx_bh(struct work_struct *work) | |||
1330 | /********************************/ | 1330 | /********************************/ |
1331 | /* called for card init message */ | 1331 | /* called for card init message */ |
1332 | /********************************/ | 1332 | /********************************/ |
1333 | static void __devinit | 1333 | static void inithfcsx(struct IsdnCardState *cs) |
1334 | inithfcsx(struct IsdnCardState *cs) | ||
1335 | { | 1334 | { |
1336 | cs->setstack_d = setstack_hfcsx; | 1335 | cs->setstack_d = setstack_hfcsx; |
1337 | cs->BC_Send_Data = &hfcsx_send_data; | 1336 | cs->BC_Send_Data = &hfcsx_send_data; |
diff --git a/drivers/isdn/hisax/isac.c b/drivers/isdn/hisax/isac.c index 4e9f23803dae..07b1673122b8 100644 --- a/drivers/isdn/hisax/isac.c +++ b/drivers/isdn/hisax/isac.c | |||
@@ -27,8 +27,7 @@ static char *ISACVer[] __devinitdata = | |||
27 | {"2086/2186 V1.1", "2085 B1", "2085 B2", | 27 | {"2086/2186 V1.1", "2085 B1", "2085 B2", |
28 | "2085 V2.3"}; | 28 | "2085 V2.3"}; |
29 | 29 | ||
30 | void | 30 | void __devinit ISACVersion(struct IsdnCardState *cs, char *s) |
31 | ISACVersion(struct IsdnCardState *cs, char *s) | ||
32 | { | 31 | { |
33 | int val; | 32 | int val; |
34 | 33 | ||
@@ -616,8 +615,7 @@ dbusy_timer_handler(struct IsdnCardState *cs) | |||
616 | } | 615 | } |
617 | } | 616 | } |
618 | 617 | ||
619 | void __devinit | 618 | void initisac(struct IsdnCardState *cs) |
620 | initisac(struct IsdnCardState *cs) | ||
621 | { | 619 | { |
622 | cs->setstack_d = setstack_isac; | 620 | cs->setstack_d = setstack_isac; |
623 | cs->DC_Close = DC_Close_isac; | 621 | cs->DC_Close = DC_Close_isac; |
@@ -648,8 +646,7 @@ initisac(struct IsdnCardState *cs) | |||
648 | cs->writeisac(cs, ISAC_MASK, 0x0); | 646 | cs->writeisac(cs, ISAC_MASK, 0x0); |
649 | } | 647 | } |
650 | 648 | ||
651 | void __devinit | 649 | void clear_pending_isac_ints(struct IsdnCardState *cs) |
652 | clear_pending_isac_ints(struct IsdnCardState *cs) | ||
653 | { | 650 | { |
654 | int val, eval; | 651 | int val, eval; |
655 | 652 | ||
diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c index c547a6665052..bfeb9b6aa043 100644 --- a/drivers/isdn/hisax/isar.c +++ b/drivers/isdn/hisax/isar.c | |||
@@ -1894,8 +1894,7 @@ isar_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) { | |||
1894 | return(0); | 1894 | return(0); |
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | void __devinit | 1897 | void initisar(struct IsdnCardState *cs) |
1898 | initisar(struct IsdnCardState *cs) | ||
1899 | { | 1898 | { |
1900 | cs->bcs[0].BC_SetStack = setstack_isar; | 1899 | cs->bcs[0].BC_SetStack = setstack_isar; |
1901 | cs->bcs[1].BC_SetStack = setstack_isar; | 1900 | cs->bcs[1].BC_SetStack = setstack_isar; |
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index 74b4cf2a6c41..275f23c2deb4 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -178,8 +178,8 @@ static void release_pte(pte_t pte) | |||
178 | 178 | ||
179 | static void check_gpte(struct lg_cpu *cpu, pte_t gpte) | 179 | static void check_gpte(struct lg_cpu *cpu, pte_t gpte) |
180 | { | 180 | { |
181 | if ((pte_flags(gpte) & (_PAGE_PWT|_PAGE_PSE)) | 181 | if ((pte_flags(gpte) & _PAGE_PSE) || |
182 | || pte_pfn(gpte) >= cpu->lg->pfn_limit) | 182 | pte_pfn(gpte) >= cpu->lg->pfn_limit) |
183 | kill_guest(cpu, "bad page table entry"); | 183 | kill_guest(cpu, "bad page table entry"); |
184 | } | 184 | } |
185 | 185 | ||
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index abbd38c1ebba..0f7a0bd86ff4 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig | |||
@@ -13,7 +13,8 @@ config VIDEO_EM28XX | |||
13 | module will be called em28xx | 13 | module will be called em28xx |
14 | 14 | ||
15 | config VIDEO_EM28XX_ALSA | 15 | config VIDEO_EM28XX_ALSA |
16 | depends on VIDEO_EM28XX | 16 | depends on VIDEO_EM28XX && SND |
17 | select SND_PCM | ||
17 | tristate "Empia EM28xx ALSA audio module" | 18 | tristate "Empia EM28xx ALSA audio module" |
18 | ---help--- | 19 | ---help--- |
19 | This is an ALSA driver for some Empia 28xx based TV cards. | 20 | This is an ALSA driver for some Empia 28xx based TV cards. |
diff --git a/drivers/memstick/Kconfig b/drivers/memstick/Kconfig new file mode 100644 index 000000000000..1093fdb07297 --- /dev/null +++ b/drivers/memstick/Kconfig | |||
@@ -0,0 +1,26 @@ | |||
1 | # | ||
2 | # MemoryStick subsystem configuration | ||
3 | # | ||
4 | |||
5 | menuconfig MEMSTICK | ||
6 | tristate "Sony MemoryStick card support (EXPERIMENTAL)" | ||
7 | help | ||
8 | Sony MemoryStick is a proprietary storage/extension card protocol. | ||
9 | |||
10 | If you want MemoryStick support, you should say Y here and also | ||
11 | to the specific driver for your MMC interface. | ||
12 | |||
13 | if MEMSTICK | ||
14 | |||
15 | config MEMSTICK_DEBUG | ||
16 | bool "MemoryStick debugging" | ||
17 | help | ||
18 | This is an option for use by developers; most people should | ||
19 | say N here. This enables MemoryStick core and driver debugging. | ||
20 | |||
21 | |||
22 | source "drivers/memstick/core/Kconfig" | ||
23 | |||
24 | source "drivers/memstick/host/Kconfig" | ||
25 | |||
26 | endif # MEMSTICK | ||
diff --git a/drivers/memstick/Makefile b/drivers/memstick/Makefile new file mode 100644 index 000000000000..dc160fb43515 --- /dev/null +++ b/drivers/memstick/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # Makefile for the kernel MemoryStick device drivers. | ||
3 | # | ||
4 | |||
5 | ifeq ($(CONFIG_MEMSTICK_DEBUG),y) | ||
6 | EXTRA_CFLAGS += -DDEBUG | ||
7 | endif | ||
8 | |||
9 | obj-$(CONFIG_MEMSTICK) += core/ | ||
10 | obj-$(CONFIG_MEMSTICK) += host/ | ||
11 | |||
diff --git a/drivers/memstick/core/Kconfig b/drivers/memstick/core/Kconfig new file mode 100644 index 000000000000..95f1814b5368 --- /dev/null +++ b/drivers/memstick/core/Kconfig | |||
@@ -0,0 +1,26 @@ | |||
1 | # | ||
2 | # MemoryStick core configuration | ||
3 | # | ||
4 | |||
5 | comment "MemoryStick drivers" | ||
6 | |||
7 | config MEMSTICK_UNSAFE_RESUME | ||
8 | bool "Allow unsafe resume (DANGEROUS)" | ||
9 | help | ||
10 | If you say Y here, the MemoryStick layer will assume that all | ||
11 | cards stayed in their respective slots during the suspend. The | ||
12 | normal behaviour is to remove them at suspend and | ||
13 | redetecting them at resume. Breaking this assumption will | ||
14 | in most cases result in data corruption. | ||
15 | |||
16 | This option is usually just for embedded systems which use | ||
17 | a MemoryStick card for rootfs. Most people should say N here. | ||
18 | |||
19 | config MSPRO_BLOCK | ||
20 | tristate "MemoryStick Pro block device driver" | ||
21 | depends on BLOCK | ||
22 | help | ||
23 | Say Y here to enable the MemoryStick Pro block device driver | ||
24 | support. This provides a block device driver, which you can use | ||
25 | to mount the filesystem. Almost everyone wishing MemoryStick | ||
26 | support should say Y or M here. | ||
diff --git a/drivers/memstick/core/Makefile b/drivers/memstick/core/Makefile new file mode 100644 index 000000000000..8b2b5293877e --- /dev/null +++ b/drivers/memstick/core/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # Makefile for the kernel MemoryStick core. | ||
3 | # | ||
4 | |||
5 | ifeq ($(CONFIG_MEMSTICK_DEBUG),y) | ||
6 | EXTRA_CFLAGS += -DDEBUG | ||
7 | endif | ||
8 | |||
9 | obj-$(CONFIG_MEMSTICK) += memstick.o | ||
10 | |||
11 | obj-$(CONFIG_MSPRO_BLOCK) += mspro_block.o | ||
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c new file mode 100644 index 000000000000..bba467fe4bce --- /dev/null +++ b/drivers/memstick/core/memstick.c | |||
@@ -0,0 +1,614 @@ | |||
1 | /* | ||
2 | * Sony MemoryStick support | ||
3 | * | ||
4 | * Copyright (C) 2007 Alex Dubov <oakad@yahoo.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Special thanks to Carlos Corbacho for providing various MemoryStick cards | ||
11 | * that made this driver possible. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/memstick.h> | ||
16 | #include <linux/idr.h> | ||
17 | #include <linux/fs.h> | ||
18 | #include <linux/delay.h> | ||
19 | |||
20 | #define DRIVER_NAME "memstick" | ||
21 | #define DRIVER_VERSION "0.2" | ||
22 | |||
23 | static unsigned int cmd_retries = 3; | ||
24 | module_param(cmd_retries, uint, 0644); | ||
25 | |||
26 | static struct workqueue_struct *workqueue; | ||
27 | static DEFINE_IDR(memstick_host_idr); | ||
28 | static DEFINE_SPINLOCK(memstick_host_lock); | ||
29 | |||
30 | static int memstick_dev_match(struct memstick_dev *card, | ||
31 | struct memstick_device_id *id) | ||
32 | { | ||
33 | if (id->match_flags & MEMSTICK_MATCH_ALL) { | ||
34 | if ((id->type == card->id.type) | ||
35 | && (id->category == card->id.category) | ||
36 | && (id->class == card->id.class)) | ||
37 | return 1; | ||
38 | } | ||
39 | |||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | static int memstick_bus_match(struct device *dev, struct device_driver *drv) | ||
44 | { | ||
45 | struct memstick_dev *card = container_of(dev, struct memstick_dev, | ||
46 | dev); | ||
47 | struct memstick_driver *ms_drv = container_of(drv, | ||
48 | struct memstick_driver, | ||
49 | driver); | ||
50 | struct memstick_device_id *ids = ms_drv->id_table; | ||
51 | |||
52 | if (ids) { | ||
53 | while (ids->match_flags) { | ||
54 | if (memstick_dev_match(card, ids)) | ||
55 | return 1; | ||
56 | ++ids; | ||
57 | } | ||
58 | } | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | static int memstick_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
63 | { | ||
64 | struct memstick_dev *card = container_of(dev, struct memstick_dev, | ||
65 | dev); | ||
66 | |||
67 | if (add_uevent_var(env, "MEMSTICK_TYPE=%02X", card->id.type)) | ||
68 | return -ENOMEM; | ||
69 | |||
70 | if (add_uevent_var(env, "MEMSTICK_CATEGORY=%02X", card->id.category)) | ||
71 | return -ENOMEM; | ||
72 | |||
73 | if (add_uevent_var(env, "MEMSTICK_CLASS=%02X", card->id.class)) | ||
74 | return -ENOMEM; | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | static int memstick_device_probe(struct device *dev) | ||
80 | { | ||
81 | struct memstick_dev *card = container_of(dev, struct memstick_dev, | ||
82 | dev); | ||
83 | struct memstick_driver *drv = container_of(dev->driver, | ||
84 | struct memstick_driver, | ||
85 | driver); | ||
86 | int rc = -ENODEV; | ||
87 | |||
88 | if (dev->driver && drv->probe) { | ||
89 | rc = drv->probe(card); | ||
90 | if (!rc) | ||
91 | get_device(dev); | ||
92 | } | ||
93 | return rc; | ||
94 | } | ||
95 | |||
96 | static int memstick_device_remove(struct device *dev) | ||
97 | { | ||
98 | struct memstick_dev *card = container_of(dev, struct memstick_dev, | ||
99 | dev); | ||
100 | struct memstick_driver *drv = container_of(dev->driver, | ||
101 | struct memstick_driver, | ||
102 | driver); | ||
103 | |||
104 | if (dev->driver && drv->remove) { | ||
105 | drv->remove(card); | ||
106 | card->dev.driver = NULL; | ||
107 | } | ||
108 | |||
109 | put_device(dev); | ||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | #ifdef CONFIG_PM | ||
114 | |||
115 | static int memstick_device_suspend(struct device *dev, pm_message_t state) | ||
116 | { | ||
117 | struct memstick_dev *card = container_of(dev, struct memstick_dev, | ||
118 | dev); | ||
119 | struct memstick_driver *drv = container_of(dev->driver, | ||
120 | struct memstick_driver, | ||
121 | driver); | ||
122 | |||
123 | if (dev->driver && drv->suspend) | ||
124 | return drv->suspend(card, state); | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static int memstick_device_resume(struct device *dev) | ||
129 | { | ||
130 | struct memstick_dev *card = container_of(dev, struct memstick_dev, | ||
131 | dev); | ||
132 | struct memstick_driver *drv = container_of(dev->driver, | ||
133 | struct memstick_driver, | ||
134 | driver); | ||
135 | |||
136 | if (dev->driver && drv->resume) | ||
137 | return drv->resume(card); | ||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | #else | ||
142 | |||
143 | #define memstick_device_suspend NULL | ||
144 | #define memstick_device_resume NULL | ||
145 | |||
146 | #endif /* CONFIG_PM */ | ||
147 | |||
148 | #define MEMSTICK_ATTR(name, format) \ | ||
149 | static ssize_t name##_show(struct device *dev, struct device_attribute *attr, \ | ||
150 | char *buf) \ | ||
151 | { \ | ||
152 | struct memstick_dev *card = container_of(dev, struct memstick_dev, \ | ||
153 | dev); \ | ||
154 | return sprintf(buf, format, card->id.name); \ | ||
155 | } | ||
156 | |||
157 | MEMSTICK_ATTR(type, "%02X"); | ||
158 | MEMSTICK_ATTR(category, "%02X"); | ||
159 | MEMSTICK_ATTR(class, "%02X"); | ||
160 | |||
161 | #define MEMSTICK_ATTR_RO(name) __ATTR(name, S_IRUGO, name##_show, NULL) | ||
162 | |||
163 | static struct device_attribute memstick_dev_attrs[] = { | ||
164 | MEMSTICK_ATTR_RO(type), | ||
165 | MEMSTICK_ATTR_RO(category), | ||
166 | MEMSTICK_ATTR_RO(class), | ||
167 | __ATTR_NULL | ||
168 | }; | ||
169 | |||
170 | static struct bus_type memstick_bus_type = { | ||
171 | .name = "memstick", | ||
172 | .dev_attrs = memstick_dev_attrs, | ||
173 | .match = memstick_bus_match, | ||
174 | .uevent = memstick_uevent, | ||
175 | .probe = memstick_device_probe, | ||
176 | .remove = memstick_device_remove, | ||
177 | .suspend = memstick_device_suspend, | ||
178 | .resume = memstick_device_resume | ||
179 | }; | ||
180 | |||
181 | static void memstick_free(struct class_device *cdev) | ||
182 | { | ||
183 | struct memstick_host *host = container_of(cdev, struct memstick_host, | ||
184 | cdev); | ||
185 | kfree(host); | ||
186 | } | ||
187 | |||
188 | static struct class memstick_host_class = { | ||
189 | .name = "memstick_host", | ||
190 | .release = memstick_free | ||
191 | }; | ||
192 | |||
193 | static void memstick_free_card(struct device *dev) | ||
194 | { | ||
195 | struct memstick_dev *card = container_of(dev, struct memstick_dev, | ||
196 | dev); | ||
197 | kfree(card); | ||
198 | } | ||
199 | |||
200 | static int memstick_dummy_check(struct memstick_dev *card) | ||
201 | { | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | /** | ||
206 | * memstick_detect_change - schedule media detection on memstick host | ||
207 | * @host - host to use | ||
208 | */ | ||
209 | void memstick_detect_change(struct memstick_host *host) | ||
210 | { | ||
211 | queue_work(workqueue, &host->media_checker); | ||
212 | } | ||
213 | EXPORT_SYMBOL(memstick_detect_change); | ||
214 | |||
215 | /** | ||
216 | * memstick_next_req - called by host driver to obtain next request to process | ||
217 | * @host - host to use | ||
218 | * @mrq - pointer to stick the request to | ||
219 | * | ||
220 | * Host calls this function from idle state (*mrq == NULL) or after finishing | ||
221 | * previous request (*mrq should point to it). If previous request was | ||
222 | * unsuccessful, it is retried for predetermined number of times. Return value | ||
223 | * of 0 means that new request was assigned to the host. | ||
224 | */ | ||
225 | int memstick_next_req(struct memstick_host *host, struct memstick_request **mrq) | ||
226 | { | ||
227 | int rc = -ENXIO; | ||
228 | |||
229 | if ((*mrq) && (*mrq)->error && host->retries) { | ||
230 | (*mrq)->error = rc; | ||
231 | host->retries--; | ||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | if (host->card && host->card->next_request) | ||
236 | rc = host->card->next_request(host->card, mrq); | ||
237 | |||
238 | if (!rc) | ||
239 | host->retries = cmd_retries; | ||
240 | else | ||
241 | *mrq = NULL; | ||
242 | |||
243 | return rc; | ||
244 | } | ||
245 | EXPORT_SYMBOL(memstick_next_req); | ||
246 | |||
247 | /** | ||
248 | * memstick_new_req - notify the host that some requests are pending | ||
249 | * @host - host to use | ||
250 | */ | ||
251 | void memstick_new_req(struct memstick_host *host) | ||
252 | { | ||
253 | host->retries = cmd_retries; | ||
254 | host->request(host); | ||
255 | } | ||
256 | EXPORT_SYMBOL(memstick_new_req); | ||
257 | |||
258 | /** | ||
259 | * memstick_init_req_sg - set request fields needed for bulk data transfer | ||
260 | * @mrq - request to use | ||
261 | * @tpc - memstick Transport Protocol Command | ||
262 | * @sg - TPC argument | ||
263 | */ | ||
264 | void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, | ||
265 | struct scatterlist *sg) | ||
266 | { | ||
267 | mrq->tpc = tpc; | ||
268 | if (tpc & 8) | ||
269 | mrq->data_dir = WRITE; | ||
270 | else | ||
271 | mrq->data_dir = READ; | ||
272 | |||
273 | mrq->sg = *sg; | ||
274 | mrq->io_type = MEMSTICK_IO_SG; | ||
275 | |||
276 | if (tpc == MS_TPC_SET_CMD || tpc == MS_TPC_EX_SET_CMD) | ||
277 | mrq->need_card_int = 1; | ||
278 | else | ||
279 | mrq->need_card_int = 0; | ||
280 | |||
281 | mrq->get_int_reg = 0; | ||
282 | } | ||
283 | EXPORT_SYMBOL(memstick_init_req_sg); | ||
284 | |||
285 | /** | ||
286 | * memstick_init_req - set request fields needed for short data transfer | ||
287 | * @mrq - request to use | ||
288 | * @tpc - memstick Transport Protocol Command | ||
289 | * @buf - TPC argument buffer | ||
290 | * @length - TPC argument size | ||
291 | * | ||
292 | * The intended use of this function (transfer of data items several bytes | ||
293 | * in size) allows us to just copy the value between request structure and | ||
294 | * user supplied buffer. | ||
295 | */ | ||
296 | void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, | ||
297 | void *buf, size_t length) | ||
298 | { | ||
299 | mrq->tpc = tpc; | ||
300 | if (tpc & 8) | ||
301 | mrq->data_dir = WRITE; | ||
302 | else | ||
303 | mrq->data_dir = READ; | ||
304 | |||
305 | mrq->data_len = length > sizeof(mrq->data) ? sizeof(mrq->data) : length; | ||
306 | if (mrq->data_dir == WRITE) | ||
307 | memcpy(mrq->data, buf, mrq->data_len); | ||
308 | |||
309 | mrq->io_type = MEMSTICK_IO_VAL; | ||
310 | |||
311 | if (tpc == MS_TPC_SET_CMD || tpc == MS_TPC_EX_SET_CMD) | ||
312 | mrq->need_card_int = 1; | ||
313 | else | ||
314 | mrq->need_card_int = 0; | ||
315 | |||
316 | mrq->get_int_reg = 0; | ||
317 | } | ||
318 | EXPORT_SYMBOL(memstick_init_req); | ||
319 | |||
320 | /* | ||
321 | * Functions prefixed with "h_" are protocol callbacks. They can be called from | ||
322 | * interrupt context. Return value of 0 means that request processing is still | ||
323 | * ongoing, while special error value of -EAGAIN means that current request is | ||
324 | * finished (and request processor should come back some time later). | ||
325 | */ | ||
326 | |||
327 | static int h_memstick_read_dev_id(struct memstick_dev *card, | ||
328 | struct memstick_request **mrq) | ||
329 | { | ||
330 | struct ms_id_register id_reg; | ||
331 | |||
332 | if (!(*mrq)) { | ||
333 | memstick_init_req(&card->current_mrq, MS_TPC_READ_REG, NULL, | ||
334 | sizeof(struct ms_id_register)); | ||
335 | *mrq = &card->current_mrq; | ||
336 | return 0; | ||
337 | } else { | ||
338 | if (!(*mrq)->error) { | ||
339 | memcpy(&id_reg, (*mrq)->data, sizeof(id_reg)); | ||
340 | card->id.match_flags = MEMSTICK_MATCH_ALL; | ||
341 | card->id.type = id_reg.type; | ||
342 | card->id.category = id_reg.category; | ||
343 | card->id.class = id_reg.class; | ||
344 | } | ||
345 | complete(&card->mrq_complete); | ||
346 | return -EAGAIN; | ||
347 | } | ||
348 | } | ||
349 | |||
350 | static int h_memstick_set_rw_addr(struct memstick_dev *card, | ||
351 | struct memstick_request **mrq) | ||
352 | { | ||
353 | if (!(*mrq)) { | ||
354 | memstick_init_req(&card->current_mrq, MS_TPC_SET_RW_REG_ADRS, | ||
355 | (char *)&card->reg_addr, | ||
356 | sizeof(card->reg_addr)); | ||
357 | *mrq = &card->current_mrq; | ||
358 | return 0; | ||
359 | } else { | ||
360 | complete(&card->mrq_complete); | ||
361 | return -EAGAIN; | ||
362 | } | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * memstick_set_rw_addr - issue SET_RW_REG_ADDR request and wait for it to | ||
367 | * complete | ||
368 | * @card - media device to use | ||
369 | */ | ||
370 | int memstick_set_rw_addr(struct memstick_dev *card) | ||
371 | { | ||
372 | card->next_request = h_memstick_set_rw_addr; | ||
373 | memstick_new_req(card->host); | ||
374 | wait_for_completion(&card->mrq_complete); | ||
375 | |||
376 | return card->current_mrq.error; | ||
377 | } | ||
378 | EXPORT_SYMBOL(memstick_set_rw_addr); | ||
379 | |||
380 | static struct memstick_dev *memstick_alloc_card(struct memstick_host *host) | ||
381 | { | ||
382 | struct memstick_dev *card = kzalloc(sizeof(struct memstick_dev), | ||
383 | GFP_KERNEL); | ||
384 | struct memstick_dev *old_card = host->card; | ||
385 | struct ms_id_register id_reg; | ||
386 | |||
387 | if (card) { | ||
388 | card->host = host; | ||
389 | snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), | ||
390 | "%s", host->cdev.class_id); | ||
391 | card->dev.parent = host->cdev.dev; | ||
392 | card->dev.bus = &memstick_bus_type; | ||
393 | card->dev.release = memstick_free_card; | ||
394 | card->check = memstick_dummy_check; | ||
395 | |||
396 | card->reg_addr.r_offset = offsetof(struct ms_register, id); | ||
397 | card->reg_addr.r_length = sizeof(id_reg); | ||
398 | card->reg_addr.w_offset = offsetof(struct ms_register, id); | ||
399 | card->reg_addr.w_length = sizeof(id_reg); | ||
400 | |||
401 | init_completion(&card->mrq_complete); | ||
402 | |||
403 | host->card = card; | ||
404 | if (memstick_set_rw_addr(card)) | ||
405 | goto err_out; | ||
406 | |||
407 | card->next_request = h_memstick_read_dev_id; | ||
408 | memstick_new_req(host); | ||
409 | wait_for_completion(&card->mrq_complete); | ||
410 | |||
411 | if (card->current_mrq.error) | ||
412 | goto err_out; | ||
413 | } | ||
414 | host->card = old_card; | ||
415 | return card; | ||
416 | err_out: | ||
417 | host->card = old_card; | ||
418 | kfree(card); | ||
419 | return NULL; | ||
420 | } | ||
421 | |||
422 | static void memstick_power_on(struct memstick_host *host) | ||
423 | { | ||
424 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | ||
425 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); | ||
426 | msleep(1); | ||
427 | } | ||
428 | |||
429 | static void memstick_check(struct work_struct *work) | ||
430 | { | ||
431 | struct memstick_host *host = container_of(work, struct memstick_host, | ||
432 | media_checker); | ||
433 | struct memstick_dev *card; | ||
434 | |||
435 | dev_dbg(host->cdev.dev, "memstick_check started\n"); | ||
436 | mutex_lock(&host->lock); | ||
437 | if (!host->card) | ||
438 | memstick_power_on(host); | ||
439 | |||
440 | card = memstick_alloc_card(host); | ||
441 | |||
442 | if (!card) { | ||
443 | if (host->card) { | ||
444 | device_unregister(&host->card->dev); | ||
445 | host->card = NULL; | ||
446 | } | ||
447 | } else { | ||
448 | dev_dbg(host->cdev.dev, "new card %02x, %02x, %02x\n", | ||
449 | card->id.type, card->id.category, card->id.class); | ||
450 | if (host->card) { | ||
451 | if (memstick_set_rw_addr(host->card) | ||
452 | || !memstick_dev_match(host->card, &card->id) | ||
453 | || !(host->card->check(host->card))) { | ||
454 | device_unregister(&host->card->dev); | ||
455 | host->card = NULL; | ||
456 | } | ||
457 | } | ||
458 | |||
459 | if (!host->card) { | ||
460 | host->card = card; | ||
461 | if (device_register(&card->dev)) { | ||
462 | kfree(host->card); | ||
463 | host->card = NULL; | ||
464 | } | ||
465 | } else | ||
466 | kfree(card); | ||
467 | } | ||
468 | |||
469 | if (!host->card) | ||
470 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); | ||
471 | |||
472 | mutex_unlock(&host->lock); | ||
473 | dev_dbg(host->cdev.dev, "memstick_check finished\n"); | ||
474 | } | ||
475 | |||
476 | /** | ||
477 | * memstick_alloc_host - allocate a memstick_host structure | ||
478 | * @extra: size of the user private data to allocate | ||
479 | * @dev: parent device of the host | ||
480 | */ | ||
481 | struct memstick_host *memstick_alloc_host(unsigned int extra, | ||
482 | struct device *dev) | ||
483 | { | ||
484 | struct memstick_host *host; | ||
485 | |||
486 | host = kzalloc(sizeof(struct memstick_host) + extra, GFP_KERNEL); | ||
487 | if (host) { | ||
488 | mutex_init(&host->lock); | ||
489 | INIT_WORK(&host->media_checker, memstick_check); | ||
490 | host->cdev.class = &memstick_host_class; | ||
491 | host->cdev.dev = dev; | ||
492 | class_device_initialize(&host->cdev); | ||
493 | } | ||
494 | return host; | ||
495 | } | ||
496 | EXPORT_SYMBOL(memstick_alloc_host); | ||
497 | |||
498 | /** | ||
499 | * memstick_add_host - start request processing on memstick host | ||
500 | * @host - host to use | ||
501 | */ | ||
502 | int memstick_add_host(struct memstick_host *host) | ||
503 | { | ||
504 | int rc; | ||
505 | |||
506 | if (!idr_pre_get(&memstick_host_idr, GFP_KERNEL)) | ||
507 | return -ENOMEM; | ||
508 | |||
509 | spin_lock(&memstick_host_lock); | ||
510 | rc = idr_get_new(&memstick_host_idr, host, &host->id); | ||
511 | spin_unlock(&memstick_host_lock); | ||
512 | if (rc) | ||
513 | return rc; | ||
514 | |||
515 | snprintf(host->cdev.class_id, BUS_ID_SIZE, | ||
516 | "memstick%u", host->id); | ||
517 | |||
518 | rc = class_device_add(&host->cdev); | ||
519 | if (rc) { | ||
520 | spin_lock(&memstick_host_lock); | ||
521 | idr_remove(&memstick_host_idr, host->id); | ||
522 | spin_unlock(&memstick_host_lock); | ||
523 | return rc; | ||
524 | } | ||
525 | |||
526 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); | ||
527 | memstick_detect_change(host); | ||
528 | return 0; | ||
529 | } | ||
530 | EXPORT_SYMBOL(memstick_add_host); | ||
531 | |||
532 | /** | ||
533 | * memstick_remove_host - stop request processing on memstick host | ||
534 | * @host - host to use | ||
535 | */ | ||
536 | void memstick_remove_host(struct memstick_host *host) | ||
537 | { | ||
538 | flush_workqueue(workqueue); | ||
539 | mutex_lock(&host->lock); | ||
540 | if (host->card) | ||
541 | device_unregister(&host->card->dev); | ||
542 | host->card = NULL; | ||
543 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); | ||
544 | mutex_unlock(&host->lock); | ||
545 | |||
546 | spin_lock(&memstick_host_lock); | ||
547 | idr_remove(&memstick_host_idr, host->id); | ||
548 | spin_unlock(&memstick_host_lock); | ||
549 | class_device_del(&host->cdev); | ||
550 | } | ||
551 | EXPORT_SYMBOL(memstick_remove_host); | ||
552 | |||
553 | /** | ||
554 | * memstick_free_host - free memstick host | ||
555 | * @host - host to use | ||
556 | */ | ||
557 | void memstick_free_host(struct memstick_host *host) | ||
558 | { | ||
559 | mutex_destroy(&host->lock); | ||
560 | class_device_put(&host->cdev); | ||
561 | } | ||
562 | EXPORT_SYMBOL(memstick_free_host); | ||
563 | |||
564 | int memstick_register_driver(struct memstick_driver *drv) | ||
565 | { | ||
566 | drv->driver.bus = &memstick_bus_type; | ||
567 | |||
568 | return driver_register(&drv->driver); | ||
569 | } | ||
570 | EXPORT_SYMBOL(memstick_register_driver); | ||
571 | |||
572 | void memstick_unregister_driver(struct memstick_driver *drv) | ||
573 | { | ||
574 | driver_unregister(&drv->driver); | ||
575 | } | ||
576 | EXPORT_SYMBOL(memstick_unregister_driver); | ||
577 | |||
578 | |||
579 | static int __init memstick_init(void) | ||
580 | { | ||
581 | int rc; | ||
582 | |||
583 | workqueue = create_freezeable_workqueue("kmemstick"); | ||
584 | if (!workqueue) | ||
585 | return -ENOMEM; | ||
586 | |||
587 | rc = bus_register(&memstick_bus_type); | ||
588 | if (!rc) | ||
589 | rc = class_register(&memstick_host_class); | ||
590 | |||
591 | if (!rc) | ||
592 | return 0; | ||
593 | |||
594 | bus_unregister(&memstick_bus_type); | ||
595 | destroy_workqueue(workqueue); | ||
596 | |||
597 | return rc; | ||
598 | } | ||
599 | |||
600 | static void __exit memstick_exit(void) | ||
601 | { | ||
602 | class_unregister(&memstick_host_class); | ||
603 | bus_unregister(&memstick_bus_type); | ||
604 | destroy_workqueue(workqueue); | ||
605 | idr_destroy(&memstick_host_idr); | ||
606 | } | ||
607 | |||
608 | module_init(memstick_init); | ||
609 | module_exit(memstick_exit); | ||
610 | |||
611 | MODULE_AUTHOR("Alex Dubov"); | ||
612 | MODULE_LICENSE("GPL"); | ||
613 | MODULE_DESCRIPTION("Sony MemoryStick core driver"); | ||
614 | MODULE_VERSION(DRIVER_VERSION); | ||
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c new file mode 100644 index 000000000000..423ad8cf4bb9 --- /dev/null +++ b/drivers/memstick/core/mspro_block.c | |||
@@ -0,0 +1,1351 @@ | |||
1 | /* | ||
2 | * Sony MemoryStick Pro storage support | ||
3 | * | ||
4 | * Copyright (C) 2007 Alex Dubov <oakad@yahoo.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Special thanks to Carlos Corbacho for providing various MemoryStick cards | ||
11 | * that made this driver possible. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/blkdev.h> | ||
16 | #include <linux/idr.h> | ||
17 | #include <linux/hdreg.h> | ||
18 | #include <linux/kthread.h> | ||
19 | #include <linux/memstick.h> | ||
20 | |||
21 | #define DRIVER_NAME "mspro_block" | ||
22 | #define DRIVER_VERSION "0.2" | ||
23 | |||
24 | static int major; | ||
25 | module_param(major, int, 0644); | ||
26 | |||
27 | #define MSPRO_BLOCK_MAX_SEGS 32 | ||
28 | #define MSPRO_BLOCK_MAX_PAGES ((2 << 16) - 1) | ||
29 | |||
30 | #define MSPRO_BLOCK_SIGNATURE 0xa5c3 | ||
31 | #define MSPRO_BLOCK_MAX_ATTRIBUTES 41 | ||
32 | |||
33 | enum { | ||
34 | MSPRO_BLOCK_ID_SYSINFO = 0x10, | ||
35 | MSPRO_BLOCK_ID_MODELNAME = 0x15, | ||
36 | MSPRO_BLOCK_ID_MBR = 0x20, | ||
37 | MSPRO_BLOCK_ID_PBR16 = 0x21, | ||
38 | MSPRO_BLOCK_ID_PBR32 = 0x22, | ||
39 | MSPRO_BLOCK_ID_SPECFILEVALUES1 = 0x25, | ||
40 | MSPRO_BLOCK_ID_SPECFILEVALUES2 = 0x26, | ||
41 | MSPRO_BLOCK_ID_DEVINFO = 0x30 | ||
42 | }; | ||
43 | |||
44 | struct mspro_sys_attr { | ||
45 | size_t size; | ||
46 | void *data; | ||
47 | unsigned char id; | ||
48 | char name[32]; | ||
49 | struct device_attribute dev_attr; | ||
50 | }; | ||
51 | |||
52 | struct mspro_attr_entry { | ||
53 | unsigned int address; | ||
54 | unsigned int size; | ||
55 | unsigned char id; | ||
56 | unsigned char reserved[3]; | ||
57 | } __attribute__((packed)); | ||
58 | |||
59 | struct mspro_attribute { | ||
60 | unsigned short signature; | ||
61 | unsigned short version; | ||
62 | unsigned char count; | ||
63 | unsigned char reserved[11]; | ||
64 | struct mspro_attr_entry entries[]; | ||
65 | } __attribute__((packed)); | ||
66 | |||
67 | struct mspro_sys_info { | ||
68 | unsigned char class; | ||
69 | unsigned char reserved0; | ||
70 | unsigned short block_size; | ||
71 | unsigned short block_count; | ||
72 | unsigned short user_block_count; | ||
73 | unsigned short page_size; | ||
74 | unsigned char reserved1[2]; | ||
75 | unsigned char assembly_date[8]; | ||
76 | unsigned int serial_number; | ||
77 | unsigned char assembly_maker_code; | ||
78 | unsigned char assembly_model_code[3]; | ||
79 | unsigned short memory_maker_code; | ||
80 | unsigned short memory_model_code; | ||
81 | unsigned char reserved2[4]; | ||
82 | unsigned char vcc; | ||
83 | unsigned char vpp; | ||
84 | unsigned short controller_number; | ||
85 | unsigned short controller_function; | ||
86 | unsigned short start_sector; | ||
87 | unsigned short unit_size; | ||
88 | unsigned char ms_sub_class; | ||
89 | unsigned char reserved3[4]; | ||
90 | unsigned char interface_type; | ||
91 | unsigned short controller_code; | ||
92 | unsigned char format_type; | ||
93 | unsigned char reserved4; | ||
94 | unsigned char device_type; | ||
95 | unsigned char reserved5[7]; | ||
96 | unsigned char mspro_id[16]; | ||
97 | unsigned char reserved6[16]; | ||
98 | } __attribute__((packed)); | ||
99 | |||
100 | struct mspro_mbr { | ||
101 | unsigned char boot_partition; | ||
102 | unsigned char start_head; | ||
103 | unsigned char start_sector; | ||
104 | unsigned char start_cylinder; | ||
105 | unsigned char partition_type; | ||
106 | unsigned char end_head; | ||
107 | unsigned char end_sector; | ||
108 | unsigned char end_cylinder; | ||
109 | unsigned int start_sectors; | ||
110 | unsigned int sectors_per_partition; | ||
111 | } __attribute__((packed)); | ||
112 | |||
113 | struct mspro_devinfo { | ||
114 | unsigned short cylinders; | ||
115 | unsigned short heads; | ||
116 | unsigned short bytes_per_track; | ||
117 | unsigned short bytes_per_sector; | ||
118 | unsigned short sectors_per_track; | ||
119 | unsigned char reserved[6]; | ||
120 | } __attribute__((packed)); | ||
121 | |||
122 | struct mspro_block_data { | ||
123 | struct memstick_dev *card; | ||
124 | unsigned int usage_count; | ||
125 | struct gendisk *disk; | ||
126 | struct request_queue *queue; | ||
127 | spinlock_t q_lock; | ||
128 | wait_queue_head_t q_wait; | ||
129 | struct task_struct *q_thread; | ||
130 | |||
131 | unsigned short page_size; | ||
132 | unsigned short cylinders; | ||
133 | unsigned short heads; | ||
134 | unsigned short sectors_per_track; | ||
135 | |||
136 | unsigned char system; | ||
137 | unsigned char read_only:1, | ||
138 | active:1, | ||
139 | has_request:1, | ||
140 | data_dir:1; | ||
141 | unsigned char transfer_cmd; | ||
142 | |||
143 | int (*mrq_handler)(struct memstick_dev *card, | ||
144 | struct memstick_request **mrq); | ||
145 | |||
146 | struct attribute_group attr_group; | ||
147 | |||
148 | struct scatterlist req_sg[MSPRO_BLOCK_MAX_SEGS]; | ||
149 | unsigned int seg_count; | ||
150 | unsigned int current_seg; | ||
151 | unsigned short current_page; | ||
152 | }; | ||
153 | |||
154 | static DEFINE_IDR(mspro_block_disk_idr); | ||
155 | static DEFINE_MUTEX(mspro_block_disk_lock); | ||
156 | |||
157 | /*** Block device ***/ | ||
158 | |||
159 | static int mspro_block_bd_open(struct inode *inode, struct file *filp) | ||
160 | { | ||
161 | struct gendisk *disk = inode->i_bdev->bd_disk; | ||
162 | struct mspro_block_data *msb = disk->private_data; | ||
163 | int rc = -ENXIO; | ||
164 | |||
165 | mutex_lock(&mspro_block_disk_lock); | ||
166 | |||
167 | if (msb && msb->card) { | ||
168 | msb->usage_count++; | ||
169 | if ((filp->f_mode & FMODE_WRITE) && msb->read_only) | ||
170 | rc = -EROFS; | ||
171 | else | ||
172 | rc = 0; | ||
173 | } | ||
174 | |||
175 | mutex_unlock(&mspro_block_disk_lock); | ||
176 | |||
177 | return rc; | ||
178 | } | ||
179 | |||
180 | |||
181 | static int mspro_block_disk_release(struct gendisk *disk) | ||
182 | { | ||
183 | struct mspro_block_data *msb = disk->private_data; | ||
184 | int disk_id = disk->first_minor >> MEMSTICK_PART_SHIFT; | ||
185 | |||
186 | mutex_lock(&mspro_block_disk_lock); | ||
187 | |||
188 | if (msb->usage_count) { | ||
189 | msb->usage_count--; | ||
190 | if (!msb->usage_count) { | ||
191 | kfree(msb); | ||
192 | disk->private_data = NULL; | ||
193 | idr_remove(&mspro_block_disk_idr, disk_id); | ||
194 | put_disk(disk); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | mutex_unlock(&mspro_block_disk_lock); | ||
199 | |||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static int mspro_block_bd_release(struct inode *inode, struct file *filp) | ||
204 | { | ||
205 | struct gendisk *disk = inode->i_bdev->bd_disk; | ||
206 | return mspro_block_disk_release(disk); | ||
207 | } | ||
208 | |||
209 | static int mspro_block_bd_getgeo(struct block_device *bdev, | ||
210 | struct hd_geometry *geo) | ||
211 | { | ||
212 | struct mspro_block_data *msb = bdev->bd_disk->private_data; | ||
213 | |||
214 | geo->heads = msb->heads; | ||
215 | geo->sectors = msb->sectors_per_track; | ||
216 | geo->cylinders = msb->cylinders; | ||
217 | |||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static struct block_device_operations ms_block_bdops = { | ||
222 | .open = mspro_block_bd_open, | ||
223 | .release = mspro_block_bd_release, | ||
224 | .getgeo = mspro_block_bd_getgeo, | ||
225 | .owner = THIS_MODULE | ||
226 | }; | ||
227 | |||
228 | /*** Information ***/ | ||
229 | |||
230 | static struct mspro_sys_attr *mspro_from_sysfs_attr(struct attribute *attr) | ||
231 | { | ||
232 | struct device_attribute *dev_attr | ||
233 | = container_of(attr, struct device_attribute, attr); | ||
234 | return container_of(dev_attr, struct mspro_sys_attr, dev_attr); | ||
235 | } | ||
236 | |||
237 | static const char *mspro_block_attr_name(unsigned char tag) | ||
238 | { | ||
239 | switch (tag) { | ||
240 | case MSPRO_BLOCK_ID_SYSINFO: | ||
241 | return "attr_sysinfo"; | ||
242 | case MSPRO_BLOCK_ID_MODELNAME: | ||
243 | return "attr_modelname"; | ||
244 | case MSPRO_BLOCK_ID_MBR: | ||
245 | return "attr_mbr"; | ||
246 | case MSPRO_BLOCK_ID_PBR16: | ||
247 | return "attr_pbr16"; | ||
248 | case MSPRO_BLOCK_ID_PBR32: | ||
249 | return "attr_pbr32"; | ||
250 | case MSPRO_BLOCK_ID_SPECFILEVALUES1: | ||
251 | return "attr_specfilevalues1"; | ||
252 | case MSPRO_BLOCK_ID_SPECFILEVALUES2: | ||
253 | return "attr_specfilevalues2"; | ||
254 | case MSPRO_BLOCK_ID_DEVINFO: | ||
255 | return "attr_devinfo"; | ||
256 | default: | ||
257 | return NULL; | ||
258 | }; | ||
259 | } | ||
260 | |||
261 | typedef ssize_t (*sysfs_show_t)(struct device *dev, | ||
262 | struct device_attribute *attr, | ||
263 | char *buffer); | ||
264 | |||
265 | static ssize_t mspro_block_attr_show_default(struct device *dev, | ||
266 | struct device_attribute *attr, | ||
267 | char *buffer) | ||
268 | { | ||
269 | struct mspro_sys_attr *s_attr = container_of(attr, | ||
270 | struct mspro_sys_attr, | ||
271 | dev_attr); | ||
272 | |||
273 | ssize_t cnt, rc = 0; | ||
274 | |||
275 | for (cnt = 0; cnt < s_attr->size; cnt++) { | ||
276 | if (cnt && !(cnt % 16)) { | ||
277 | if (PAGE_SIZE - rc) | ||
278 | buffer[rc++] = '\n'; | ||
279 | } | ||
280 | |||
281 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "%02x ", | ||
282 | ((unsigned char *)s_attr->data)[cnt]); | ||
283 | } | ||
284 | return rc; | ||
285 | } | ||
286 | |||
287 | static ssize_t mspro_block_attr_show_sysinfo(struct device *dev, | ||
288 | struct device_attribute *attr, | ||
289 | char *buffer) | ||
290 | { | ||
291 | struct mspro_sys_attr *x_attr = container_of(attr, | ||
292 | struct mspro_sys_attr, | ||
293 | dev_attr); | ||
294 | struct mspro_sys_info *x_sys = x_attr->data; | ||
295 | ssize_t rc = 0; | ||
296 | |||
297 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "class: %x\n", | ||
298 | x_sys->class); | ||
299 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "block size: %x\n", | ||
300 | be16_to_cpu(x_sys->block_size)); | ||
301 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "block count: %x\n", | ||
302 | be16_to_cpu(x_sys->block_count)); | ||
303 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "user block count: %x\n", | ||
304 | be16_to_cpu(x_sys->user_block_count)); | ||
305 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "page size: %x\n", | ||
306 | be16_to_cpu(x_sys->page_size)); | ||
307 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "assembly date: " | ||
308 | "%d %04u-%02u-%02u %02u:%02u:%02u\n", | ||
309 | x_sys->assembly_date[0], | ||
310 | be16_to_cpu(*(unsigned short *) | ||
311 | &x_sys->assembly_date[1]), | ||
312 | x_sys->assembly_date[3], x_sys->assembly_date[4], | ||
313 | x_sys->assembly_date[5], x_sys->assembly_date[6], | ||
314 | x_sys->assembly_date[7]); | ||
315 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "serial number: %x\n", | ||
316 | be32_to_cpu(x_sys->serial_number)); | ||
317 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, | ||
318 | "assembly maker code: %x\n", | ||
319 | x_sys->assembly_maker_code); | ||
320 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "assembly model code: " | ||
321 | "%02x%02x%02x\n", x_sys->assembly_model_code[0], | ||
322 | x_sys->assembly_model_code[1], | ||
323 | x_sys->assembly_model_code[2]); | ||
324 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "memory maker code: %x\n", | ||
325 | be16_to_cpu(x_sys->memory_maker_code)); | ||
326 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "memory model code: %x\n", | ||
327 | be16_to_cpu(x_sys->memory_model_code)); | ||
328 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "vcc: %x\n", | ||
329 | x_sys->vcc); | ||
330 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "vpp: %x\n", | ||
331 | x_sys->vpp); | ||
332 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "controller number: %x\n", | ||
333 | be16_to_cpu(x_sys->controller_number)); | ||
334 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, | ||
335 | "controller function: %x\n", | ||
336 | be16_to_cpu(x_sys->controller_function)); | ||
337 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "start sector: %x\n", | ||
338 | be16_to_cpu(x_sys->start_sector)); | ||
339 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "unit size: %x\n", | ||
340 | be16_to_cpu(x_sys->unit_size)); | ||
341 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "sub class: %x\n", | ||
342 | x_sys->ms_sub_class); | ||
343 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "interface type: %x\n", | ||
344 | x_sys->interface_type); | ||
345 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "controller code: %x\n", | ||
346 | be16_to_cpu(x_sys->controller_code)); | ||
347 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "format type: %x\n", | ||
348 | x_sys->format_type); | ||
349 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "device type: %x\n", | ||
350 | x_sys->device_type); | ||
351 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "mspro id: %s\n", | ||
352 | x_sys->mspro_id); | ||
353 | return rc; | ||
354 | } | ||
355 | |||
356 | static ssize_t mspro_block_attr_show_modelname(struct device *dev, | ||
357 | struct device_attribute *attr, | ||
358 | char *buffer) | ||
359 | { | ||
360 | struct mspro_sys_attr *s_attr = container_of(attr, | ||
361 | struct mspro_sys_attr, | ||
362 | dev_attr); | ||
363 | |||
364 | return scnprintf(buffer, PAGE_SIZE, "%s", (char *)s_attr->data); | ||
365 | } | ||
366 | |||
367 | static ssize_t mspro_block_attr_show_mbr(struct device *dev, | ||
368 | struct device_attribute *attr, | ||
369 | char *buffer) | ||
370 | { | ||
371 | struct mspro_sys_attr *x_attr = container_of(attr, | ||
372 | struct mspro_sys_attr, | ||
373 | dev_attr); | ||
374 | struct mspro_mbr *x_mbr = x_attr->data; | ||
375 | ssize_t rc = 0; | ||
376 | |||
377 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "boot partition: %x\n", | ||
378 | x_mbr->boot_partition); | ||
379 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "start head: %x\n", | ||
380 | x_mbr->start_head); | ||
381 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "start sector: %x\n", | ||
382 | x_mbr->start_sector); | ||
383 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "start cylinder: %x\n", | ||
384 | x_mbr->start_cylinder); | ||
385 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "partition type: %x\n", | ||
386 | x_mbr->partition_type); | ||
387 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "end head: %x\n", | ||
388 | x_mbr->end_head); | ||
389 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "end sector: %x\n", | ||
390 | x_mbr->end_sector); | ||
391 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "end cylinder: %x\n", | ||
392 | x_mbr->end_cylinder); | ||
393 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "start sectors: %x\n", | ||
394 | x_mbr->start_sectors); | ||
395 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, | ||
396 | "sectors per partition: %x\n", | ||
397 | x_mbr->sectors_per_partition); | ||
398 | return rc; | ||
399 | } | ||
400 | |||
401 | static ssize_t mspro_block_attr_show_devinfo(struct device *dev, | ||
402 | struct device_attribute *attr, | ||
403 | char *buffer) | ||
404 | { | ||
405 | struct mspro_sys_attr *x_attr = container_of(attr, | ||
406 | struct mspro_sys_attr, | ||
407 | dev_attr); | ||
408 | struct mspro_devinfo *x_devinfo = x_attr->data; | ||
409 | ssize_t rc = 0; | ||
410 | |||
411 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "cylinders: %x\n", | ||
412 | be16_to_cpu(x_devinfo->cylinders)); | ||
413 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "heads: %x\n", | ||
414 | be16_to_cpu(x_devinfo->heads)); | ||
415 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "bytes per track: %x\n", | ||
416 | be16_to_cpu(x_devinfo->bytes_per_track)); | ||
417 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "bytes per sector: %x\n", | ||
418 | be16_to_cpu(x_devinfo->bytes_per_sector)); | ||
419 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "sectors per track: %x\n", | ||
420 | be16_to_cpu(x_devinfo->sectors_per_track)); | ||
421 | return rc; | ||
422 | } | ||
423 | |||
424 | static sysfs_show_t mspro_block_attr_show(unsigned char tag) | ||
425 | { | ||
426 | switch (tag) { | ||
427 | case MSPRO_BLOCK_ID_SYSINFO: | ||
428 | return mspro_block_attr_show_sysinfo; | ||
429 | case MSPRO_BLOCK_ID_MODELNAME: | ||
430 | return mspro_block_attr_show_modelname; | ||
431 | case MSPRO_BLOCK_ID_MBR: | ||
432 | return mspro_block_attr_show_mbr; | ||
433 | case MSPRO_BLOCK_ID_DEVINFO: | ||
434 | return mspro_block_attr_show_devinfo; | ||
435 | default: | ||
436 | return mspro_block_attr_show_default; | ||
437 | } | ||
438 | } | ||
439 | |||
440 | /*** Protocol handlers ***/ | ||
441 | |||
442 | /* | ||
443 | * Functions prefixed with "h_" are protocol callbacks. They can be called from | ||
444 | * interrupt context. Return value of 0 means that request processing is still | ||
445 | * ongoing, while special error value of -EAGAIN means that current request is | ||
446 | * finished (and request processor should come back some time later). | ||
447 | */ | ||
448 | |||
449 | static int h_mspro_block_req_init(struct memstick_dev *card, | ||
450 | struct memstick_request **mrq) | ||
451 | { | ||
452 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
453 | |||
454 | *mrq = &card->current_mrq; | ||
455 | card->next_request = msb->mrq_handler; | ||
456 | return 0; | ||
457 | } | ||
458 | |||
459 | static int h_mspro_block_default(struct memstick_dev *card, | ||
460 | struct memstick_request **mrq) | ||
461 | { | ||
462 | complete(&card->mrq_complete); | ||
463 | if (!(*mrq)->error) | ||
464 | return -EAGAIN; | ||
465 | else | ||
466 | return (*mrq)->error; | ||
467 | } | ||
468 | |||
469 | static int h_mspro_block_get_ro(struct memstick_dev *card, | ||
470 | struct memstick_request **mrq) | ||
471 | { | ||
472 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
473 | |||
474 | if ((*mrq)->error) { | ||
475 | complete(&card->mrq_complete); | ||
476 | return (*mrq)->error; | ||
477 | } | ||
478 | |||
479 | if ((*mrq)->data[offsetof(struct ms_status_register, status0)] | ||
480 | & MEMSTICK_STATUS0_WP) | ||
481 | msb->read_only = 1; | ||
482 | else | ||
483 | msb->read_only = 0; | ||
484 | |||
485 | complete(&card->mrq_complete); | ||
486 | return -EAGAIN; | ||
487 | } | ||
488 | |||
489 | static int h_mspro_block_wait_for_ced(struct memstick_dev *card, | ||
490 | struct memstick_request **mrq) | ||
491 | { | ||
492 | if ((*mrq)->error) { | ||
493 | complete(&card->mrq_complete); | ||
494 | return (*mrq)->error; | ||
495 | } | ||
496 | |||
497 | dev_dbg(&card->dev, "wait for ced: value %x\n", (*mrq)->data[0]); | ||
498 | |||
499 | if ((*mrq)->data[0] & (MEMSTICK_INT_CMDNAK | MEMSTICK_INT_ERR)) { | ||
500 | card->current_mrq.error = -EFAULT; | ||
501 | complete(&card->mrq_complete); | ||
502 | return card->current_mrq.error; | ||
503 | } | ||
504 | |||
505 | if (!((*mrq)->data[0] & MEMSTICK_INT_CED)) | ||
506 | return 0; | ||
507 | else { | ||
508 | card->current_mrq.error = 0; | ||
509 | complete(&card->mrq_complete); | ||
510 | return -EAGAIN; | ||
511 | } | ||
512 | } | ||
513 | |||
514 | static int h_mspro_block_transfer_data(struct memstick_dev *card, | ||
515 | struct memstick_request **mrq) | ||
516 | { | ||
517 | struct memstick_host *host = card->host; | ||
518 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
519 | unsigned char t_val = 0; | ||
520 | struct scatterlist t_sg = { 0 }; | ||
521 | size_t t_offset; | ||
522 | |||
523 | if ((*mrq)->error) { | ||
524 | complete(&card->mrq_complete); | ||
525 | return (*mrq)->error; | ||
526 | } | ||
527 | |||
528 | switch ((*mrq)->tpc) { | ||
529 | case MS_TPC_WRITE_REG: | ||
530 | memstick_init_req(*mrq, MS_TPC_SET_CMD, &msb->transfer_cmd, 1); | ||
531 | (*mrq)->get_int_reg = 1; | ||
532 | return 0; | ||
533 | case MS_TPC_SET_CMD: | ||
534 | t_val = (*mrq)->int_reg; | ||
535 | memstick_init_req(*mrq, MS_TPC_GET_INT, NULL, 1); | ||
536 | if (host->caps & MEMSTICK_CAP_AUTO_GET_INT) | ||
537 | goto has_int_reg; | ||
538 | return 0; | ||
539 | case MS_TPC_GET_INT: | ||
540 | t_val = (*mrq)->data[0]; | ||
541 | has_int_reg: | ||
542 | if (t_val & (MEMSTICK_INT_CMDNAK | MEMSTICK_INT_ERR)) { | ||
543 | t_val = MSPRO_CMD_STOP; | ||
544 | memstick_init_req(*mrq, MS_TPC_SET_CMD, &t_val, 1); | ||
545 | card->next_request = h_mspro_block_default; | ||
546 | return 0; | ||
547 | } | ||
548 | |||
549 | if (msb->current_page | ||
550 | == (msb->req_sg[msb->current_seg].length | ||
551 | / msb->page_size)) { | ||
552 | msb->current_page = 0; | ||
553 | msb->current_seg++; | ||
554 | |||
555 | if (msb->current_seg == msb->seg_count) { | ||
556 | if (t_val & MEMSTICK_INT_CED) { | ||
557 | complete(&card->mrq_complete); | ||
558 | return -EAGAIN; | ||
559 | } else { | ||
560 | card->next_request | ||
561 | = h_mspro_block_wait_for_ced; | ||
562 | memstick_init_req(*mrq, MS_TPC_GET_INT, | ||
563 | NULL, 1); | ||
564 | return 0; | ||
565 | } | ||
566 | } | ||
567 | } | ||
568 | |||
569 | if (!(t_val & MEMSTICK_INT_BREQ)) { | ||
570 | memstick_init_req(*mrq, MS_TPC_GET_INT, NULL, 1); | ||
571 | return 0; | ||
572 | } | ||
573 | |||
574 | t_offset = msb->req_sg[msb->current_seg].offset; | ||
575 | t_offset += msb->current_page * msb->page_size; | ||
576 | |||
577 | sg_set_page(&t_sg, | ||
578 | nth_page(sg_page(&(msb->req_sg[msb->current_seg])), | ||
579 | t_offset >> PAGE_SHIFT), | ||
580 | msb->page_size, offset_in_page(t_offset)); | ||
581 | |||
582 | memstick_init_req_sg(*mrq, msb->data_dir == READ | ||
583 | ? MS_TPC_READ_LONG_DATA | ||
584 | : MS_TPC_WRITE_LONG_DATA, | ||
585 | &t_sg); | ||
586 | (*mrq)->get_int_reg = 1; | ||
587 | return 0; | ||
588 | case MS_TPC_READ_LONG_DATA: | ||
589 | case MS_TPC_WRITE_LONG_DATA: | ||
590 | msb->current_page++; | ||
591 | if (host->caps & MEMSTICK_CAP_AUTO_GET_INT) { | ||
592 | t_val = (*mrq)->int_reg; | ||
593 | goto has_int_reg; | ||
594 | } else { | ||
595 | memstick_init_req(*mrq, MS_TPC_GET_INT, NULL, 1); | ||
596 | return 0; | ||
597 | } | ||
598 | |||
599 | default: | ||
600 | BUG(); | ||
601 | } | ||
602 | } | ||
603 | |||
604 | /*** Data transfer ***/ | ||
605 | |||
606 | static void mspro_block_process_request(struct memstick_dev *card, | ||
607 | struct request *req) | ||
608 | { | ||
609 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
610 | struct mspro_param_register param; | ||
611 | int rc, chunk, cnt; | ||
612 | unsigned short page_count; | ||
613 | sector_t t_sec; | ||
614 | unsigned long flags; | ||
615 | |||
616 | do { | ||
617 | page_count = 0; | ||
618 | msb->current_seg = 0; | ||
619 | msb->seg_count = blk_rq_map_sg(req->q, req, msb->req_sg); | ||
620 | |||
621 | if (msb->seg_count) { | ||
622 | msb->current_page = 0; | ||
623 | for (rc = 0; rc < msb->seg_count; rc++) | ||
624 | page_count += msb->req_sg[rc].length | ||
625 | / msb->page_size; | ||
626 | |||
627 | t_sec = req->sector; | ||
628 | sector_div(t_sec, msb->page_size >> 9); | ||
629 | param.system = msb->system; | ||
630 | param.data_count = cpu_to_be16(page_count); | ||
631 | param.data_address = cpu_to_be32((uint32_t)t_sec); | ||
632 | param.cmd_param = 0; | ||
633 | |||
634 | msb->data_dir = rq_data_dir(req); | ||
635 | msb->transfer_cmd = msb->data_dir == READ | ||
636 | ? MSPRO_CMD_READ_DATA | ||
637 | : MSPRO_CMD_WRITE_DATA; | ||
638 | |||
639 | dev_dbg(&card->dev, "data transfer: cmd %x, " | ||
640 | "lba %x, count %x\n", msb->transfer_cmd, | ||
641 | be32_to_cpu(param.data_address), | ||
642 | page_count); | ||
643 | |||
644 | card->next_request = h_mspro_block_req_init; | ||
645 | msb->mrq_handler = h_mspro_block_transfer_data; | ||
646 | memstick_init_req(&card->current_mrq, MS_TPC_WRITE_REG, | ||
647 | ¶m, sizeof(param)); | ||
648 | memstick_new_req(card->host); | ||
649 | wait_for_completion(&card->mrq_complete); | ||
650 | rc = card->current_mrq.error; | ||
651 | |||
652 | if (rc || (card->current_mrq.tpc == MSPRO_CMD_STOP)) { | ||
653 | for (cnt = 0; cnt < msb->current_seg; cnt++) | ||
654 | page_count += msb->req_sg[cnt].length | ||
655 | / msb->page_size; | ||
656 | |||
657 | if (msb->current_page) | ||
658 | page_count += msb->current_page - 1; | ||
659 | |||
660 | if (page_count && (msb->data_dir == READ)) | ||
661 | rc = msb->page_size * page_count; | ||
662 | else | ||
663 | rc = -EIO; | ||
664 | } else | ||
665 | rc = msb->page_size * page_count; | ||
666 | } else | ||
667 | rc = -EFAULT; | ||
668 | |||
669 | spin_lock_irqsave(&msb->q_lock, flags); | ||
670 | if (rc >= 0) | ||
671 | chunk = __blk_end_request(req, 0, rc); | ||
672 | else | ||
673 | chunk = __blk_end_request(req, rc, 0); | ||
674 | |||
675 | dev_dbg(&card->dev, "end chunk %d, %d\n", rc, chunk); | ||
676 | spin_unlock_irqrestore(&msb->q_lock, flags); | ||
677 | } while (chunk); | ||
678 | } | ||
679 | |||
680 | static int mspro_block_has_request(struct mspro_block_data *msb) | ||
681 | { | ||
682 | int rc = 0; | ||
683 | unsigned long flags; | ||
684 | |||
685 | spin_lock_irqsave(&msb->q_lock, flags); | ||
686 | if (kthread_should_stop() || msb->has_request) | ||
687 | rc = 1; | ||
688 | spin_unlock_irqrestore(&msb->q_lock, flags); | ||
689 | return rc; | ||
690 | } | ||
691 | |||
692 | static int mspro_block_queue_thread(void *data) | ||
693 | { | ||
694 | struct memstick_dev *card = data; | ||
695 | struct memstick_host *host = card->host; | ||
696 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
697 | struct request *req; | ||
698 | unsigned long flags; | ||
699 | |||
700 | while (1) { | ||
701 | wait_event(msb->q_wait, mspro_block_has_request(msb)); | ||
702 | dev_dbg(&card->dev, "thread iter\n"); | ||
703 | |||
704 | spin_lock_irqsave(&msb->q_lock, flags); | ||
705 | req = elv_next_request(msb->queue); | ||
706 | dev_dbg(&card->dev, "next req %p\n", req); | ||
707 | if (!req) { | ||
708 | msb->has_request = 0; | ||
709 | if (kthread_should_stop()) { | ||
710 | spin_unlock_irqrestore(&msb->q_lock, flags); | ||
711 | break; | ||
712 | } | ||
713 | } else | ||
714 | msb->has_request = 1; | ||
715 | spin_unlock_irqrestore(&msb->q_lock, flags); | ||
716 | |||
717 | if (req) { | ||
718 | mutex_lock(&host->lock); | ||
719 | mspro_block_process_request(card, req); | ||
720 | mutex_unlock(&host->lock); | ||
721 | } | ||
722 | } | ||
723 | dev_dbg(&card->dev, "thread finished\n"); | ||
724 | return 0; | ||
725 | } | ||
726 | |||
727 | static void mspro_block_request(struct request_queue *q) | ||
728 | { | ||
729 | struct memstick_dev *card = q->queuedata; | ||
730 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
731 | struct request *req = NULL; | ||
732 | |||
733 | if (msb->q_thread) { | ||
734 | msb->has_request = 1; | ||
735 | wake_up_all(&msb->q_wait); | ||
736 | } else { | ||
737 | while ((req = elv_next_request(q)) != NULL) | ||
738 | end_queued_request(req, -ENODEV); | ||
739 | } | ||
740 | } | ||
741 | |||
742 | /*** Initialization ***/ | ||
743 | |||
744 | static int mspro_block_wait_for_ced(struct memstick_dev *card) | ||
745 | { | ||
746 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
747 | |||
748 | card->next_request = h_mspro_block_req_init; | ||
749 | msb->mrq_handler = h_mspro_block_wait_for_ced; | ||
750 | memstick_init_req(&card->current_mrq, MS_TPC_GET_INT, NULL, 1); | ||
751 | memstick_new_req(card->host); | ||
752 | wait_for_completion(&card->mrq_complete); | ||
753 | return card->current_mrq.error; | ||
754 | } | ||
755 | |||
756 | static int mspro_block_switch_to_parallel(struct memstick_dev *card) | ||
757 | { | ||
758 | struct memstick_host *host = card->host; | ||
759 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
760 | struct mspro_param_register param = { | ||
761 | .system = 0, | ||
762 | .data_count = 0, | ||
763 | .data_address = 0, | ||
764 | .cmd_param = 0 | ||
765 | }; | ||
766 | |||
767 | card->next_request = h_mspro_block_req_init; | ||
768 | msb->mrq_handler = h_mspro_block_default; | ||
769 | memstick_init_req(&card->current_mrq, MS_TPC_WRITE_REG, ¶m, | ||
770 | sizeof(param)); | ||
771 | memstick_new_req(host); | ||
772 | wait_for_completion(&card->mrq_complete); | ||
773 | if (card->current_mrq.error) | ||
774 | return card->current_mrq.error; | ||
775 | |||
776 | msb->system = 0; | ||
777 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PARALLEL); | ||
778 | |||
779 | card->next_request = h_mspro_block_req_init; | ||
780 | msb->mrq_handler = h_mspro_block_default; | ||
781 | memstick_init_req(&card->current_mrq, MS_TPC_GET_INT, NULL, 1); | ||
782 | memstick_new_req(card->host); | ||
783 | wait_for_completion(&card->mrq_complete); | ||
784 | |||
785 | if (card->current_mrq.error) { | ||
786 | msb->system = 0x80; | ||
787 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); | ||
788 | return -EFAULT; | ||
789 | } | ||
790 | |||
791 | return 0; | ||
792 | } | ||
793 | |||
794 | /* Memory allocated for attributes by this function should be freed by | ||
795 | * mspro_block_data_clear, no matter if the initialization process succeded | ||
796 | * or failed. | ||
797 | */ | ||
798 | static int mspro_block_read_attributes(struct memstick_dev *card) | ||
799 | { | ||
800 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
801 | struct mspro_param_register param = { | ||
802 | .system = msb->system, | ||
803 | .data_count = cpu_to_be16(1), | ||
804 | .data_address = 0, | ||
805 | .cmd_param = 0 | ||
806 | }; | ||
807 | struct mspro_attribute *attr = NULL; | ||
808 | struct mspro_sys_attr *s_attr = NULL; | ||
809 | unsigned char *buffer = NULL; | ||
810 | int cnt, rc, attr_count; | ||
811 | unsigned int addr; | ||
812 | unsigned short page_count; | ||
813 | |||
814 | attr = kmalloc(msb->page_size, GFP_KERNEL); | ||
815 | if (!attr) | ||
816 | return -ENOMEM; | ||
817 | |||
818 | sg_init_one(&msb->req_sg[0], attr, msb->page_size); | ||
819 | msb->seg_count = 1; | ||
820 | msb->current_seg = 0; | ||
821 | msb->current_page = 0; | ||
822 | msb->data_dir = READ; | ||
823 | msb->transfer_cmd = MSPRO_CMD_READ_ATRB; | ||
824 | |||
825 | card->next_request = h_mspro_block_req_init; | ||
826 | msb->mrq_handler = h_mspro_block_transfer_data; | ||
827 | memstick_init_req(&card->current_mrq, MS_TPC_WRITE_REG, ¶m, | ||
828 | sizeof(param)); | ||
829 | memstick_new_req(card->host); | ||
830 | wait_for_completion(&card->mrq_complete); | ||
831 | if (card->current_mrq.error) { | ||
832 | rc = card->current_mrq.error; | ||
833 | goto out_free_attr; | ||
834 | } | ||
835 | |||
836 | if (be16_to_cpu(attr->signature) != MSPRO_BLOCK_SIGNATURE) { | ||
837 | printk(KERN_ERR "%s: unrecognized device signature %x\n", | ||
838 | card->dev.bus_id, be16_to_cpu(attr->signature)); | ||
839 | rc = -ENODEV; | ||
840 | goto out_free_attr; | ||
841 | } | ||
842 | |||
843 | if (attr->count > MSPRO_BLOCK_MAX_ATTRIBUTES) { | ||
844 | printk(KERN_WARNING "%s: way too many attribute entries\n", | ||
845 | card->dev.bus_id); | ||
846 | attr_count = MSPRO_BLOCK_MAX_ATTRIBUTES; | ||
847 | } else | ||
848 | attr_count = attr->count; | ||
849 | |||
850 | msb->attr_group.attrs = kzalloc((attr_count + 1) | ||
851 | * sizeof(struct attribute), | ||
852 | GFP_KERNEL); | ||
853 | if (!msb->attr_group.attrs) { | ||
854 | rc = -ENOMEM; | ||
855 | goto out_free_attr; | ||
856 | } | ||
857 | msb->attr_group.name = "media_attributes"; | ||
858 | |||
859 | buffer = kmalloc(msb->page_size, GFP_KERNEL); | ||
860 | if (!buffer) { | ||
861 | rc = -ENOMEM; | ||
862 | goto out_free_attr; | ||
863 | } | ||
864 | memcpy(buffer, (char *)attr, msb->page_size); | ||
865 | page_count = 1; | ||
866 | |||
867 | for (cnt = 0; cnt < attr_count; ++cnt) { | ||
868 | s_attr = kzalloc(sizeof(struct mspro_sys_attr), GFP_KERNEL); | ||
869 | if (!s_attr) { | ||
870 | rc = -ENOMEM; | ||
871 | goto out_free_buffer; | ||
872 | } | ||
873 | |||
874 | msb->attr_group.attrs[cnt] = &s_attr->dev_attr.attr; | ||
875 | addr = be32_to_cpu(attr->entries[cnt].address); | ||
876 | rc = be32_to_cpu(attr->entries[cnt].size); | ||
877 | dev_dbg(&card->dev, "adding attribute %d: id %x, address %x, " | ||
878 | "size %x\n", cnt, attr->entries[cnt].id, addr, rc); | ||
879 | s_attr->id = attr->entries[cnt].id; | ||
880 | if (mspro_block_attr_name(s_attr->id)) | ||
881 | snprintf(s_attr->name, sizeof(s_attr->name), "%s", | ||
882 | mspro_block_attr_name(attr->entries[cnt].id)); | ||
883 | else | ||
884 | snprintf(s_attr->name, sizeof(s_attr->name), | ||
885 | "attr_x%02x", attr->entries[cnt].id); | ||
886 | |||
887 | s_attr->dev_attr.attr.name = s_attr->name; | ||
888 | s_attr->dev_attr.attr.mode = S_IRUGO; | ||
889 | s_attr->dev_attr.attr.owner = THIS_MODULE; | ||
890 | s_attr->dev_attr.show = mspro_block_attr_show(s_attr->id); | ||
891 | |||
892 | if (!rc) | ||
893 | continue; | ||
894 | |||
895 | s_attr->size = rc; | ||
896 | s_attr->data = kmalloc(rc, GFP_KERNEL); | ||
897 | if (!s_attr->data) { | ||
898 | rc = -ENOMEM; | ||
899 | goto out_free_buffer; | ||
900 | } | ||
901 | |||
902 | if (((addr / msb->page_size) | ||
903 | == be32_to_cpu(param.data_address)) | ||
904 | && (((addr + rc - 1) / msb->page_size) | ||
905 | == be32_to_cpu(param.data_address))) { | ||
906 | memcpy(s_attr->data, buffer + addr % msb->page_size, | ||
907 | rc); | ||
908 | continue; | ||
909 | } | ||
910 | |||
911 | if (page_count <= (rc / msb->page_size)) { | ||
912 | kfree(buffer); | ||
913 | page_count = (rc / msb->page_size) + 1; | ||
914 | buffer = kmalloc(page_count * msb->page_size, | ||
915 | GFP_KERNEL); | ||
916 | if (!buffer) { | ||
917 | rc = -ENOMEM; | ||
918 | goto out_free_attr; | ||
919 | } | ||
920 | } | ||
921 | |||
922 | param.system = msb->system; | ||
923 | param.data_count = cpu_to_be16((rc / msb->page_size) + 1); | ||
924 | param.data_address = cpu_to_be32(addr / msb->page_size); | ||
925 | param.cmd_param = 0; | ||
926 | |||
927 | sg_init_one(&msb->req_sg[0], buffer, | ||
928 | be16_to_cpu(param.data_count) * msb->page_size); | ||
929 | msb->seg_count = 1; | ||
930 | msb->current_seg = 0; | ||
931 | msb->current_page = 0; | ||
932 | msb->data_dir = READ; | ||
933 | msb->transfer_cmd = MSPRO_CMD_READ_ATRB; | ||
934 | |||
935 | dev_dbg(&card->dev, "reading attribute pages %x, %x\n", | ||
936 | be32_to_cpu(param.data_address), | ||
937 | be16_to_cpu(param.data_count)); | ||
938 | |||
939 | card->next_request = h_mspro_block_req_init; | ||
940 | msb->mrq_handler = h_mspro_block_transfer_data; | ||
941 | memstick_init_req(&card->current_mrq, MS_TPC_WRITE_REG, | ||
942 | (char *)¶m, sizeof(param)); | ||
943 | memstick_new_req(card->host); | ||
944 | wait_for_completion(&card->mrq_complete); | ||
945 | if (card->current_mrq.error) { | ||
946 | rc = card->current_mrq.error; | ||
947 | goto out_free_buffer; | ||
948 | } | ||
949 | |||
950 | memcpy(s_attr->data, buffer + addr % msb->page_size, rc); | ||
951 | } | ||
952 | |||
953 | rc = 0; | ||
954 | out_free_buffer: | ||
955 | kfree(buffer); | ||
956 | out_free_attr: | ||
957 | kfree(attr); | ||
958 | return rc; | ||
959 | } | ||
960 | |||
961 | static int mspro_block_init_card(struct memstick_dev *card) | ||
962 | { | ||
963 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
964 | struct memstick_host *host = card->host; | ||
965 | int rc = 0; | ||
966 | |||
967 | msb->system = 0x80; | ||
968 | card->reg_addr.r_offset = offsetof(struct mspro_register, status); | ||
969 | card->reg_addr.r_length = sizeof(struct ms_status_register); | ||
970 | card->reg_addr.w_offset = offsetof(struct mspro_register, param); | ||
971 | card->reg_addr.w_length = sizeof(struct mspro_param_register); | ||
972 | |||
973 | if (memstick_set_rw_addr(card)) | ||
974 | return -EIO; | ||
975 | |||
976 | if (host->caps & MEMSTICK_CAP_PARALLEL) { | ||
977 | if (mspro_block_switch_to_parallel(card)) | ||
978 | printk(KERN_WARNING "%s: could not switch to " | ||
979 | "parallel interface\n", card->dev.bus_id); | ||
980 | } | ||
981 | |||
982 | rc = mspro_block_wait_for_ced(card); | ||
983 | if (rc) | ||
984 | return rc; | ||
985 | dev_dbg(&card->dev, "card activated\n"); | ||
986 | |||
987 | card->next_request = h_mspro_block_req_init; | ||
988 | msb->mrq_handler = h_mspro_block_get_ro; | ||
989 | memstick_init_req(&card->current_mrq, MS_TPC_READ_REG, NULL, | ||
990 | sizeof(struct ms_status_register)); | ||
991 | memstick_new_req(card->host); | ||
992 | wait_for_completion(&card->mrq_complete); | ||
993 | if (card->current_mrq.error) | ||
994 | return card->current_mrq.error; | ||
995 | |||
996 | dev_dbg(&card->dev, "card r/w status %d\n", msb->read_only ? 0 : 1); | ||
997 | |||
998 | msb->page_size = 512; | ||
999 | rc = mspro_block_read_attributes(card); | ||
1000 | if (rc) | ||
1001 | return rc; | ||
1002 | |||
1003 | dev_dbg(&card->dev, "attributes loaded\n"); | ||
1004 | return 0; | ||
1005 | |||
1006 | } | ||
1007 | |||
1008 | static int mspro_block_init_disk(struct memstick_dev *card) | ||
1009 | { | ||
1010 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
1011 | struct memstick_host *host = card->host; | ||
1012 | struct mspro_devinfo *dev_info = NULL; | ||
1013 | struct mspro_sys_info *sys_info = NULL; | ||
1014 | struct mspro_sys_attr *s_attr = NULL; | ||
1015 | int rc, disk_id; | ||
1016 | u64 limit = BLK_BOUNCE_HIGH; | ||
1017 | unsigned long capacity; | ||
1018 | |||
1019 | if (host->cdev.dev->dma_mask && *(host->cdev.dev->dma_mask)) | ||
1020 | limit = *(host->cdev.dev->dma_mask); | ||
1021 | |||
1022 | for (rc = 0; msb->attr_group.attrs[rc]; ++rc) { | ||
1023 | s_attr = mspro_from_sysfs_attr(msb->attr_group.attrs[rc]); | ||
1024 | |||
1025 | if (s_attr->id == MSPRO_BLOCK_ID_DEVINFO) | ||
1026 | dev_info = s_attr->data; | ||
1027 | else if (s_attr->id == MSPRO_BLOCK_ID_SYSINFO) | ||
1028 | sys_info = s_attr->data; | ||
1029 | } | ||
1030 | |||
1031 | if (!dev_info || !sys_info) | ||
1032 | return -ENODEV; | ||
1033 | |||
1034 | msb->cylinders = be16_to_cpu(dev_info->cylinders); | ||
1035 | msb->heads = be16_to_cpu(dev_info->heads); | ||
1036 | msb->sectors_per_track = be16_to_cpu(dev_info->sectors_per_track); | ||
1037 | |||
1038 | msb->page_size = be16_to_cpu(sys_info->unit_size); | ||
1039 | |||
1040 | if (!idr_pre_get(&mspro_block_disk_idr, GFP_KERNEL)) | ||
1041 | return -ENOMEM; | ||
1042 | |||
1043 | mutex_lock(&mspro_block_disk_lock); | ||
1044 | rc = idr_get_new(&mspro_block_disk_idr, card, &disk_id); | ||
1045 | mutex_unlock(&mspro_block_disk_lock); | ||
1046 | |||
1047 | if (rc) | ||
1048 | return rc; | ||
1049 | |||
1050 | if ((disk_id << MEMSTICK_PART_SHIFT) > 255) { | ||
1051 | rc = -ENOSPC; | ||
1052 | goto out_release_id; | ||
1053 | } | ||
1054 | |||
1055 | msb->disk = alloc_disk(1 << MEMSTICK_PART_SHIFT); | ||
1056 | if (!msb->disk) { | ||
1057 | rc = -ENOMEM; | ||
1058 | goto out_release_id; | ||
1059 | } | ||
1060 | |||
1061 | spin_lock_init(&msb->q_lock); | ||
1062 | init_waitqueue_head(&msb->q_wait); | ||
1063 | |||
1064 | msb->queue = blk_init_queue(mspro_block_request, &msb->q_lock); | ||
1065 | if (!msb->queue) { | ||
1066 | rc = -ENOMEM; | ||
1067 | goto out_put_disk; | ||
1068 | } | ||
1069 | |||
1070 | msb->queue->queuedata = card; | ||
1071 | |||
1072 | blk_queue_bounce_limit(msb->queue, limit); | ||
1073 | blk_queue_max_sectors(msb->queue, MSPRO_BLOCK_MAX_PAGES); | ||
1074 | blk_queue_max_phys_segments(msb->queue, MSPRO_BLOCK_MAX_SEGS); | ||
1075 | blk_queue_max_hw_segments(msb->queue, MSPRO_BLOCK_MAX_SEGS); | ||
1076 | blk_queue_max_segment_size(msb->queue, | ||
1077 | MSPRO_BLOCK_MAX_PAGES * msb->page_size); | ||
1078 | |||
1079 | msb->disk->major = major; | ||
1080 | msb->disk->first_minor = disk_id << MEMSTICK_PART_SHIFT; | ||
1081 | msb->disk->fops = &ms_block_bdops; | ||
1082 | msb->usage_count = 1; | ||
1083 | msb->disk->private_data = msb; | ||
1084 | msb->disk->queue = msb->queue; | ||
1085 | msb->disk->driverfs_dev = &card->dev; | ||
1086 | |||
1087 | sprintf(msb->disk->disk_name, "mspblk%d", disk_id); | ||
1088 | |||
1089 | blk_queue_hardsect_size(msb->queue, msb->page_size); | ||
1090 | |||
1091 | capacity = be16_to_cpu(sys_info->user_block_count); | ||
1092 | capacity *= be16_to_cpu(sys_info->block_size); | ||
1093 | capacity *= msb->page_size >> 9; | ||
1094 | set_capacity(msb->disk, capacity); | ||
1095 | dev_dbg(&card->dev, "capacity set %ld\n", capacity); | ||
1096 | msb->q_thread = kthread_run(mspro_block_queue_thread, card, | ||
1097 | DRIVER_NAME"d"); | ||
1098 | if (IS_ERR(msb->q_thread)) | ||
1099 | goto out_put_disk; | ||
1100 | |||
1101 | mutex_unlock(&host->lock); | ||
1102 | add_disk(msb->disk); | ||
1103 | mutex_lock(&host->lock); | ||
1104 | msb->active = 1; | ||
1105 | return 0; | ||
1106 | |||
1107 | out_put_disk: | ||
1108 | put_disk(msb->disk); | ||
1109 | out_release_id: | ||
1110 | mutex_lock(&mspro_block_disk_lock); | ||
1111 | idr_remove(&mspro_block_disk_idr, disk_id); | ||
1112 | mutex_unlock(&mspro_block_disk_lock); | ||
1113 | return rc; | ||
1114 | } | ||
1115 | |||
1116 | static void mspro_block_data_clear(struct mspro_block_data *msb) | ||
1117 | { | ||
1118 | int cnt; | ||
1119 | struct mspro_sys_attr *s_attr; | ||
1120 | |||
1121 | if (msb->attr_group.attrs) { | ||
1122 | for (cnt = 0; msb->attr_group.attrs[cnt]; ++cnt) { | ||
1123 | s_attr = mspro_from_sysfs_attr(msb->attr_group | ||
1124 | .attrs[cnt]); | ||
1125 | kfree(s_attr->data); | ||
1126 | kfree(s_attr); | ||
1127 | } | ||
1128 | kfree(msb->attr_group.attrs); | ||
1129 | } | ||
1130 | |||
1131 | msb->card = NULL; | ||
1132 | } | ||
1133 | |||
1134 | static int mspro_block_check_card(struct memstick_dev *card) | ||
1135 | { | ||
1136 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
1137 | |||
1138 | return (msb->active == 1); | ||
1139 | } | ||
1140 | |||
1141 | static int mspro_block_probe(struct memstick_dev *card) | ||
1142 | { | ||
1143 | struct mspro_block_data *msb; | ||
1144 | int rc = 0; | ||
1145 | |||
1146 | msb = kzalloc(sizeof(struct mspro_block_data), GFP_KERNEL); | ||
1147 | if (!msb) | ||
1148 | return -ENOMEM; | ||
1149 | memstick_set_drvdata(card, msb); | ||
1150 | msb->card = card; | ||
1151 | |||
1152 | rc = mspro_block_init_card(card); | ||
1153 | |||
1154 | if (rc) | ||
1155 | goto out_free; | ||
1156 | |||
1157 | rc = sysfs_create_group(&card->dev.kobj, &msb->attr_group); | ||
1158 | if (rc) | ||
1159 | goto out_free; | ||
1160 | |||
1161 | rc = mspro_block_init_disk(card); | ||
1162 | if (!rc) { | ||
1163 | card->check = mspro_block_check_card; | ||
1164 | return 0; | ||
1165 | } | ||
1166 | |||
1167 | sysfs_remove_group(&card->dev.kobj, &msb->attr_group); | ||
1168 | out_free: | ||
1169 | memstick_set_drvdata(card, NULL); | ||
1170 | mspro_block_data_clear(msb); | ||
1171 | kfree(msb); | ||
1172 | return rc; | ||
1173 | } | ||
1174 | |||
1175 | static void mspro_block_remove(struct memstick_dev *card) | ||
1176 | { | ||
1177 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
1178 | struct task_struct *q_thread = NULL; | ||
1179 | unsigned long flags; | ||
1180 | |||
1181 | del_gendisk(msb->disk); | ||
1182 | dev_dbg(&card->dev, "mspro block remove\n"); | ||
1183 | spin_lock_irqsave(&msb->q_lock, flags); | ||
1184 | q_thread = msb->q_thread; | ||
1185 | msb->q_thread = NULL; | ||
1186 | msb->active = 0; | ||
1187 | spin_unlock_irqrestore(&msb->q_lock, flags); | ||
1188 | |||
1189 | if (q_thread) { | ||
1190 | mutex_unlock(&card->host->lock); | ||
1191 | kthread_stop(q_thread); | ||
1192 | mutex_lock(&card->host->lock); | ||
1193 | } | ||
1194 | |||
1195 | dev_dbg(&card->dev, "queue thread stopped\n"); | ||
1196 | |||
1197 | blk_cleanup_queue(msb->queue); | ||
1198 | |||
1199 | sysfs_remove_group(&card->dev.kobj, &msb->attr_group); | ||
1200 | |||
1201 | mutex_lock(&mspro_block_disk_lock); | ||
1202 | mspro_block_data_clear(msb); | ||
1203 | mutex_unlock(&mspro_block_disk_lock); | ||
1204 | |||
1205 | mspro_block_disk_release(msb->disk); | ||
1206 | memstick_set_drvdata(card, NULL); | ||
1207 | } | ||
1208 | |||
1209 | #ifdef CONFIG_PM | ||
1210 | |||
1211 | static int mspro_block_suspend(struct memstick_dev *card, pm_message_t state) | ||
1212 | { | ||
1213 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
1214 | struct task_struct *q_thread = NULL; | ||
1215 | unsigned long flags; | ||
1216 | |||
1217 | spin_lock_irqsave(&msb->q_lock, flags); | ||
1218 | q_thread = msb->q_thread; | ||
1219 | msb->q_thread = NULL; | ||
1220 | msb->active = 0; | ||
1221 | blk_stop_queue(msb->queue); | ||
1222 | spin_unlock_irqrestore(&msb->q_lock, flags); | ||
1223 | |||
1224 | if (q_thread) | ||
1225 | kthread_stop(q_thread); | ||
1226 | |||
1227 | return 0; | ||
1228 | } | ||
1229 | |||
1230 | static int mspro_block_resume(struct memstick_dev *card) | ||
1231 | { | ||
1232 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
1233 | unsigned long flags; | ||
1234 | int rc = 0; | ||
1235 | |||
1236 | #ifdef CONFIG_MEMSTICK_UNSAFE_RESUME | ||
1237 | |||
1238 | struct mspro_block_data *new_msb; | ||
1239 | struct memstick_host *host = card->host; | ||
1240 | struct mspro_sys_attr *s_attr, *r_attr; | ||
1241 | unsigned char cnt; | ||
1242 | |||
1243 | mutex_lock(&host->lock); | ||
1244 | new_msb = kzalloc(sizeof(struct mspro_block_data), GFP_KERNEL); | ||
1245 | if (!new_msb) { | ||
1246 | rc = -ENOMEM; | ||
1247 | goto out_unlock; | ||
1248 | } | ||
1249 | |||
1250 | new_msb->card = card; | ||
1251 | memstick_set_drvdata(card, new_msb); | ||
1252 | if (mspro_block_init_card(card)) | ||
1253 | goto out_free; | ||
1254 | |||
1255 | for (cnt = 0; new_msb->attr_group.attrs[cnt] | ||
1256 | && msb->attr_group.attrs[cnt]; ++cnt) { | ||
1257 | s_attr = mspro_from_sysfs_attr(new_msb->attr_group.attrs[cnt]); | ||
1258 | r_attr = mspro_from_sysfs_attr(msb->attr_group.attrs[cnt]); | ||
1259 | |||
1260 | if (s_attr->id == MSPRO_BLOCK_ID_SYSINFO | ||
1261 | && r_attr->id == s_attr->id) { | ||
1262 | if (memcmp(s_attr->data, r_attr->data, s_attr->size)) | ||
1263 | break; | ||
1264 | |||
1265 | memstick_set_drvdata(card, msb); | ||
1266 | msb->q_thread = kthread_run(mspro_block_queue_thread, | ||
1267 | card, DRIVER_NAME"d"); | ||
1268 | if (IS_ERR(msb->q_thread)) | ||
1269 | msb->q_thread = NULL; | ||
1270 | else | ||
1271 | msb->active = 1; | ||
1272 | |||
1273 | break; | ||
1274 | } | ||
1275 | } | ||
1276 | |||
1277 | out_free: | ||
1278 | memstick_set_drvdata(card, msb); | ||
1279 | mspro_block_data_clear(new_msb); | ||
1280 | kfree(new_msb); | ||
1281 | out_unlock: | ||
1282 | mutex_unlock(&host->lock); | ||
1283 | |||
1284 | #endif /* CONFIG_MEMSTICK_UNSAFE_RESUME */ | ||
1285 | |||
1286 | spin_lock_irqsave(&msb->q_lock, flags); | ||
1287 | blk_start_queue(msb->queue); | ||
1288 | spin_unlock_irqrestore(&msb->q_lock, flags); | ||
1289 | return rc; | ||
1290 | } | ||
1291 | |||
1292 | #else | ||
1293 | |||
1294 | #define mspro_block_suspend NULL | ||
1295 | #define mspro_block_resume NULL | ||
1296 | |||
1297 | #endif /* CONFIG_PM */ | ||
1298 | |||
1299 | static struct memstick_device_id mspro_block_id_tbl[] = { | ||
1300 | {MEMSTICK_MATCH_ALL, MEMSTICK_TYPE_PRO, MEMSTICK_CATEGORY_STORAGE_DUO, | ||
1301 | MEMSTICK_CLASS_GENERIC_DUO}, | ||
1302 | {} | ||
1303 | }; | ||
1304 | |||
1305 | |||
1306 | static struct memstick_driver mspro_block_driver = { | ||
1307 | .driver = { | ||
1308 | .name = DRIVER_NAME, | ||
1309 | .owner = THIS_MODULE | ||
1310 | }, | ||
1311 | .id_table = mspro_block_id_tbl, | ||
1312 | .probe = mspro_block_probe, | ||
1313 | .remove = mspro_block_remove, | ||
1314 | .suspend = mspro_block_suspend, | ||
1315 | .resume = mspro_block_resume | ||
1316 | }; | ||
1317 | |||
1318 | static int __init mspro_block_init(void) | ||
1319 | { | ||
1320 | int rc = -ENOMEM; | ||
1321 | |||
1322 | rc = register_blkdev(major, DRIVER_NAME); | ||
1323 | if (rc < 0) { | ||
1324 | printk(KERN_ERR DRIVER_NAME ": failed to register " | ||
1325 | "major %d, error %d\n", major, rc); | ||
1326 | return rc; | ||
1327 | } | ||
1328 | if (!major) | ||
1329 | major = rc; | ||
1330 | |||
1331 | rc = memstick_register_driver(&mspro_block_driver); | ||
1332 | if (rc) | ||
1333 | unregister_blkdev(major, DRIVER_NAME); | ||
1334 | return rc; | ||
1335 | } | ||
1336 | |||
1337 | static void __exit mspro_block_exit(void) | ||
1338 | { | ||
1339 | memstick_unregister_driver(&mspro_block_driver); | ||
1340 | unregister_blkdev(major, DRIVER_NAME); | ||
1341 | idr_destroy(&mspro_block_disk_idr); | ||
1342 | } | ||
1343 | |||
1344 | module_init(mspro_block_init); | ||
1345 | module_exit(mspro_block_exit); | ||
1346 | |||
1347 | MODULE_LICENSE("GPL"); | ||
1348 | MODULE_AUTHOR("Alex Dubov"); | ||
1349 | MODULE_DESCRIPTION("Sony MemoryStickPro block device driver"); | ||
1350 | MODULE_DEVICE_TABLE(memstick, mspro_block_id_tbl); | ||
1351 | MODULE_VERSION(DRIVER_VERSION); | ||
diff --git a/drivers/memstick/host/Kconfig b/drivers/memstick/host/Kconfig new file mode 100644 index 000000000000..c002fcc3c879 --- /dev/null +++ b/drivers/memstick/host/Kconfig | |||
@@ -0,0 +1,22 @@ | |||
1 | # | ||
2 | # MemoryStick host controller drivers | ||
3 | # | ||
4 | |||
5 | comment "MemoryStick Host Controller Drivers" | ||
6 | |||
7 | config MEMSTICK_TIFM_MS | ||
8 | tristate "TI Flash Media MemoryStick Interface support (EXPERIMENTAL)" | ||
9 | depends on EXPERIMENTAL && PCI | ||
10 | select TIFM_CORE | ||
11 | help | ||
12 | Say Y here if you want to be able to access MemoryStick cards with | ||
13 | the Texas Instruments(R) Flash Media card reader, found in many | ||
14 | laptops. | ||
15 | This option 'selects' (turns on, enables) 'TIFM_CORE', but you | ||
16 | probably also need appropriate card reader host adapter, such as | ||
17 | 'Misc devices: TI Flash Media PCI74xx/PCI76xx host adapter support | ||
18 | (TIFM_7XX1)'. | ||
19 | |||
20 | To compile this driver as a module, choose M here: the | ||
21 | module will be called tifm_ms. | ||
22 | |||
diff --git a/drivers/memstick/host/Makefile b/drivers/memstick/host/Makefile new file mode 100644 index 000000000000..ee666380efa1 --- /dev/null +++ b/drivers/memstick/host/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # | ||
2 | # Makefile for MemoryStick host controller drivers | ||
3 | # | ||
4 | |||
5 | ifeq ($(CONFIG_MEMSTICK_DEBUG),y) | ||
6 | EXTRA_CFLAGS += -DDEBUG | ||
7 | endif | ||
8 | |||
9 | obj-$(CONFIG_MEMSTICK_TIFM_MS) += tifm_ms.o | ||
10 | |||
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c new file mode 100644 index 000000000000..f55b71a4337d --- /dev/null +++ b/drivers/memstick/host/tifm_ms.c | |||
@@ -0,0 +1,685 @@ | |||
1 | /* | ||
2 | * TI FlashMedia driver | ||
3 | * | ||
4 | * Copyright (C) 2007 Alex Dubov <oakad@yahoo.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Special thanks to Carlos Corbacho for providing various MemoryStick cards | ||
11 | * that made this driver possible. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/tifm.h> | ||
16 | #include <linux/memstick.h> | ||
17 | #include <linux/highmem.h> | ||
18 | #include <linux/scatterlist.h> | ||
19 | #include <linux/log2.h> | ||
20 | #include <asm/io.h> | ||
21 | |||
22 | #define DRIVER_NAME "tifm_ms" | ||
23 | #define DRIVER_VERSION "0.1" | ||
24 | |||
25 | static int no_dma; | ||
26 | module_param(no_dma, bool, 0644); | ||
27 | |||
28 | #define TIFM_MS_TIMEOUT 0x00100 | ||
29 | #define TIFM_MS_BADCRC 0x00200 | ||
30 | #define TIFM_MS_EOTPC 0x01000 | ||
31 | #define TIFM_MS_INT 0x02000 | ||
32 | |||
33 | /* The meaning of the bit majority in this constant is unknown. */ | ||
34 | #define TIFM_MS_SERIAL 0x04010 | ||
35 | |||
36 | #define TIFM_MS_SYS_LATCH 0x00100 | ||
37 | #define TIFM_MS_SYS_NOT_RDY 0x00800 | ||
38 | #define TIFM_MS_SYS_DATA 0x10000 | ||
39 | |||
40 | /* Hardware flags */ | ||
41 | enum { | ||
42 | CMD_READY = 0x0001, | ||
43 | FIFO_READY = 0x0002, | ||
44 | CARD_READY = 0x0004, | ||
45 | DATA_CARRY = 0x0008 | ||
46 | }; | ||
47 | |||
48 | struct tifm_ms { | ||
49 | struct tifm_dev *dev; | ||
50 | unsigned short eject:1, | ||
51 | no_dma:1; | ||
52 | unsigned short cmd_flags; | ||
53 | unsigned int mode_mask; | ||
54 | unsigned int block_pos; | ||
55 | unsigned long timeout_jiffies; | ||
56 | |||
57 | struct timer_list timer; | ||
58 | struct memstick_request *req; | ||
59 | unsigned int io_word; | ||
60 | }; | ||
61 | |||
62 | static void tifm_ms_read_fifo(struct tifm_ms *host, unsigned int fifo_offset, | ||
63 | struct page *pg, unsigned int page_off, | ||
64 | unsigned int length) | ||
65 | { | ||
66 | struct tifm_dev *sock = host->dev; | ||
67 | unsigned int cnt = 0, off = 0; | ||
68 | unsigned char *buf = kmap_atomic(pg, KM_BIO_DST_IRQ) + page_off; | ||
69 | |||
70 | if (host->cmd_flags & DATA_CARRY) { | ||
71 | while ((fifo_offset & 3) && length) { | ||
72 | buf[off++] = host->io_word & 0xff; | ||
73 | host->io_word >>= 8; | ||
74 | length--; | ||
75 | fifo_offset++; | ||
76 | } | ||
77 | if (!(fifo_offset & 3)) | ||
78 | host->cmd_flags &= ~DATA_CARRY; | ||
79 | if (!length) | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | do { | ||
84 | host->io_word = readl(sock->addr + SOCK_FIFO_ACCESS | ||
85 | + fifo_offset); | ||
86 | cnt = 4; | ||
87 | while (length && cnt) { | ||
88 | buf[off++] = (host->io_word >> 8) & 0xff; | ||
89 | cnt--; | ||
90 | length--; | ||
91 | } | ||
92 | fifo_offset += 4 - cnt; | ||
93 | } while (length); | ||
94 | |||
95 | if (cnt) | ||
96 | host->cmd_flags |= DATA_CARRY; | ||
97 | |||
98 | kunmap_atomic(buf - page_off, KM_BIO_DST_IRQ); | ||
99 | } | ||
100 | |||
101 | static void tifm_ms_write_fifo(struct tifm_ms *host, unsigned int fifo_offset, | ||
102 | struct page *pg, unsigned int page_off, | ||
103 | unsigned int length) | ||
104 | { | ||
105 | struct tifm_dev *sock = host->dev; | ||
106 | unsigned int cnt = 0, off = 0; | ||
107 | unsigned char *buf = kmap_atomic(pg, KM_BIO_SRC_IRQ) + page_off; | ||
108 | |||
109 | if (host->cmd_flags & DATA_CARRY) { | ||
110 | while (fifo_offset & 3) { | ||
111 | host->io_word |= buf[off++] << (8 * (fifo_offset & 3)); | ||
112 | length--; | ||
113 | fifo_offset++; | ||
114 | } | ||
115 | if (!(fifo_offset & 3)) { | ||
116 | writel(host->io_word, sock->addr + SOCK_FIFO_ACCESS | ||
117 | + fifo_offset - 4); | ||
118 | |||
119 | host->cmd_flags &= ~DATA_CARRY; | ||
120 | } | ||
121 | if (!length) | ||
122 | return; | ||
123 | } | ||
124 | |||
125 | do { | ||
126 | cnt = 4; | ||
127 | host->io_word = 0; | ||
128 | while (length && cnt) { | ||
129 | host->io_word |= buf[off++] << (4 - cnt); | ||
130 | cnt--; | ||
131 | length--; | ||
132 | } | ||
133 | fifo_offset += 4 - cnt; | ||
134 | if (!cnt) | ||
135 | writel(host->io_word, sock->addr + SOCK_FIFO_ACCESS | ||
136 | + fifo_offset - 4); | ||
137 | |||
138 | } while (length); | ||
139 | |||
140 | if (cnt) | ||
141 | host->cmd_flags |= DATA_CARRY; | ||
142 | |||
143 | kunmap_atomic(buf - page_off, KM_BIO_SRC_IRQ); | ||
144 | } | ||
145 | |||
146 | static void tifm_ms_move_block(struct tifm_ms *host, unsigned int length) | ||
147 | { | ||
148 | unsigned int t_size; | ||
149 | unsigned int off = host->req->sg.offset + host->block_pos; | ||
150 | unsigned int p_off, p_cnt; | ||
151 | struct page *pg; | ||
152 | unsigned long flags; | ||
153 | |||
154 | dev_dbg(&host->dev->dev, "moving block\n"); | ||
155 | local_irq_save(flags); | ||
156 | t_size = length; | ||
157 | while (t_size) { | ||
158 | pg = nth_page(sg_page(&host->req->sg), off >> PAGE_SHIFT); | ||
159 | p_off = offset_in_page(off); | ||
160 | p_cnt = PAGE_SIZE - p_off; | ||
161 | p_cnt = min(p_cnt, t_size); | ||
162 | |||
163 | if (host->req->data_dir == WRITE) | ||
164 | tifm_ms_write_fifo(host, length - t_size, | ||
165 | pg, p_off, p_cnt); | ||
166 | else | ||
167 | tifm_ms_read_fifo(host, length - t_size, | ||
168 | pg, p_off, p_cnt); | ||
169 | |||
170 | t_size -= p_cnt; | ||
171 | } | ||
172 | local_irq_restore(flags); | ||
173 | } | ||
174 | |||
175 | static int tifm_ms_transfer_data(struct tifm_ms *host, int skip) | ||
176 | { | ||
177 | struct tifm_dev *sock = host->dev; | ||
178 | unsigned int length = host->req->sg.length - host->block_pos; | ||
179 | |||
180 | if (!length) | ||
181 | return 1; | ||
182 | |||
183 | if (length > TIFM_FIFO_SIZE) | ||
184 | length = TIFM_FIFO_SIZE; | ||
185 | |||
186 | if (!skip) { | ||
187 | tifm_ms_move_block(host, length); | ||
188 | host->block_pos += length; | ||
189 | } | ||
190 | |||
191 | if ((host->req->data_dir == READ) | ||
192 | && (host->block_pos == host->req->sg.length)) | ||
193 | return 1; | ||
194 | |||
195 | writel(ilog2(length) - 2, sock->addr + SOCK_FIFO_PAGE_SIZE); | ||
196 | if (host->req->data_dir == WRITE) | ||
197 | writel((1 << 8) | TIFM_DMA_TX, sock->addr + SOCK_DMA_CONTROL); | ||
198 | else | ||
199 | writel((1 << 8), sock->addr + SOCK_DMA_CONTROL); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static int tifm_ms_issue_cmd(struct tifm_ms *host) | ||
205 | { | ||
206 | struct tifm_dev *sock = host->dev; | ||
207 | unsigned char *data; | ||
208 | unsigned int data_len = 0, cmd = 0, cmd_mask = 0, cnt, tval = 0; | ||
209 | |||
210 | host->cmd_flags = 0; | ||
211 | |||
212 | if (host->req->io_type == MEMSTICK_IO_SG) { | ||
213 | if (!host->no_dma) { | ||
214 | if (1 != tifm_map_sg(sock, &host->req->sg, 1, | ||
215 | host->req->data_dir == READ | ||
216 | ? PCI_DMA_FROMDEVICE | ||
217 | : PCI_DMA_TODEVICE)) { | ||
218 | host->req->error = -ENOMEM; | ||
219 | return host->req->error; | ||
220 | } | ||
221 | data_len = sg_dma_len(&host->req->sg); | ||
222 | } else | ||
223 | data_len = host->req->sg.length; | ||
224 | |||
225 | writel(TIFM_FIFO_INT_SETALL, | ||
226 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | ||
227 | writel(TIFM_FIFO_ENABLE, | ||
228 | sock->addr + SOCK_FIFO_CONTROL); | ||
229 | writel(TIFM_FIFO_INTMASK, | ||
230 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); | ||
231 | |||
232 | if (!host->no_dma) { | ||
233 | writel(ilog2(data_len) - 2, | ||
234 | sock->addr + SOCK_FIFO_PAGE_SIZE); | ||
235 | writel(sg_dma_address(&host->req->sg), | ||
236 | sock->addr + SOCK_DMA_ADDRESS); | ||
237 | if (host->req->data_dir == WRITE) | ||
238 | writel((1 << 8) | TIFM_DMA_TX | TIFM_DMA_EN, | ||
239 | sock->addr + SOCK_DMA_CONTROL); | ||
240 | else | ||
241 | writel((1 << 8) | TIFM_DMA_EN, | ||
242 | sock->addr + SOCK_DMA_CONTROL); | ||
243 | } else { | ||
244 | tifm_ms_transfer_data(host, | ||
245 | host->req->data_dir == READ); | ||
246 | } | ||
247 | |||
248 | cmd_mask = readl(sock->addr + SOCK_MS_SYSTEM); | ||
249 | cmd_mask |= TIFM_MS_SYS_DATA | TIFM_MS_SYS_NOT_RDY; | ||
250 | writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); | ||
251 | } else if (host->req->io_type == MEMSTICK_IO_VAL) { | ||
252 | data = host->req->data; | ||
253 | data_len = host->req->data_len; | ||
254 | |||
255 | cmd_mask = host->mode_mask | 0x2607; /* unknown constant */ | ||
256 | |||
257 | if (host->req->data_dir == WRITE) { | ||
258 | cmd_mask |= TIFM_MS_SYS_LATCH; | ||
259 | writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); | ||
260 | for (cnt = 0; (data_len - cnt) >= 4; cnt += 4) { | ||
261 | writel(TIFM_MS_SYS_LATCH | ||
262 | | readl(sock->addr + SOCK_MS_SYSTEM), | ||
263 | sock->addr + SOCK_MS_SYSTEM); | ||
264 | __raw_writel(*(unsigned int *)(data + cnt), | ||
265 | sock->addr + SOCK_MS_DATA); | ||
266 | dev_dbg(&sock->dev, "writing %x\n", | ||
267 | *(int *)(data + cnt)); | ||
268 | } | ||
269 | switch (data_len - cnt) { | ||
270 | case 3: | ||
271 | tval |= data[cnt + 2] << 16; | ||
272 | case 2: | ||
273 | tval |= data[cnt + 1] << 8; | ||
274 | case 1: | ||
275 | tval |= data[cnt]; | ||
276 | writel(TIFM_MS_SYS_LATCH | ||
277 | | readl(sock->addr + SOCK_MS_SYSTEM), | ||
278 | sock->addr + SOCK_MS_SYSTEM); | ||
279 | writel(tval, sock->addr + SOCK_MS_DATA); | ||
280 | dev_dbg(&sock->dev, "writing %x\n", tval); | ||
281 | } | ||
282 | |||
283 | writel(TIFM_MS_SYS_LATCH | ||
284 | | readl(sock->addr + SOCK_MS_SYSTEM), | ||
285 | sock + SOCK_MS_SYSTEM); | ||
286 | writel(0, sock->addr + SOCK_MS_DATA); | ||
287 | dev_dbg(&sock->dev, "writing %x\n", 0); | ||
288 | |||
289 | } else | ||
290 | writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); | ||
291 | |||
292 | cmd_mask = readl(sock->addr + SOCK_MS_SYSTEM); | ||
293 | cmd_mask &= ~TIFM_MS_SYS_DATA; | ||
294 | cmd_mask |= TIFM_MS_SYS_NOT_RDY; | ||
295 | dev_dbg(&sock->dev, "mask %x\n", cmd_mask); | ||
296 | writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); | ||
297 | } else | ||
298 | BUG(); | ||
299 | |||
300 | mod_timer(&host->timer, jiffies + host->timeout_jiffies); | ||
301 | writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL), | ||
302 | sock->addr + SOCK_CONTROL); | ||
303 | host->req->error = 0; | ||
304 | |||
305 | cmd = (host->req->tpc & 0xf) << 12; | ||
306 | cmd |= data_len; | ||
307 | writel(cmd, sock->addr + SOCK_MS_COMMAND); | ||
308 | |||
309 | dev_dbg(&sock->dev, "executing TPC %x, %x\n", cmd, cmd_mask); | ||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | static void tifm_ms_complete_cmd(struct tifm_ms *host) | ||
314 | { | ||
315 | struct tifm_dev *sock = host->dev; | ||
316 | struct memstick_host *msh = tifm_get_drvdata(sock); | ||
317 | unsigned int tval = 0, data_len; | ||
318 | unsigned char *data; | ||
319 | int rc; | ||
320 | |||
321 | del_timer(&host->timer); | ||
322 | if (host->req->io_type == MEMSTICK_IO_SG) { | ||
323 | if (!host->no_dma) | ||
324 | tifm_unmap_sg(sock, &host->req->sg, 1, | ||
325 | host->req->data_dir == READ | ||
326 | ? PCI_DMA_FROMDEVICE | ||
327 | : PCI_DMA_TODEVICE); | ||
328 | } else if (host->req->io_type == MEMSTICK_IO_VAL) { | ||
329 | writel(~TIFM_MS_SYS_DATA & readl(sock->addr + SOCK_MS_SYSTEM), | ||
330 | sock->addr + SOCK_MS_SYSTEM); | ||
331 | |||
332 | data = host->req->data; | ||
333 | data_len = host->req->data_len; | ||
334 | |||
335 | if (host->req->data_dir == READ) { | ||
336 | for (rc = 0; (data_len - rc) >= 4; rc += 4) | ||
337 | *(int *)(data + rc) | ||
338 | = __raw_readl(sock->addr | ||
339 | + SOCK_MS_DATA); | ||
340 | |||
341 | if (data_len - rc) | ||
342 | tval = readl(sock->addr + SOCK_MS_DATA); | ||
343 | switch (data_len - rc) { | ||
344 | case 3: | ||
345 | data[rc + 2] = (tval >> 16) & 0xff; | ||
346 | case 2: | ||
347 | data[rc + 1] = (tval >> 8) & 0xff; | ||
348 | case 1: | ||
349 | data[rc] = tval & 0xff; | ||
350 | } | ||
351 | readl(sock->addr + SOCK_MS_DATA); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL), | ||
356 | sock->addr + SOCK_CONTROL); | ||
357 | |||
358 | do { | ||
359 | rc = memstick_next_req(msh, &host->req); | ||
360 | } while (!rc && tifm_ms_issue_cmd(host)); | ||
361 | } | ||
362 | |||
363 | static int tifm_ms_check_status(struct tifm_ms *host) | ||
364 | { | ||
365 | if (!host->req->error) { | ||
366 | if (!(host->cmd_flags & CMD_READY)) | ||
367 | return 1; | ||
368 | if ((host->req->io_type == MEMSTICK_IO_SG) | ||
369 | && !(host->cmd_flags & FIFO_READY)) | ||
370 | return 1; | ||
371 | if (host->req->need_card_int | ||
372 | && !(host->cmd_flags & CARD_READY)) | ||
373 | return 1; | ||
374 | } | ||
375 | return 0; | ||
376 | } | ||
377 | |||
378 | /* Called from interrupt handler */ | ||
379 | static void tifm_ms_data_event(struct tifm_dev *sock) | ||
380 | { | ||
381 | struct tifm_ms *host; | ||
382 | unsigned int fifo_status = 0; | ||
383 | int rc = 1; | ||
384 | |||
385 | spin_lock(&sock->lock); | ||
386 | host = memstick_priv((struct memstick_host *)tifm_get_drvdata(sock)); | ||
387 | fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS); | ||
388 | dev_dbg(&sock->dev, "data event: fifo_status %x, flags %x\n", | ||
389 | fifo_status, host->cmd_flags); | ||
390 | |||
391 | if (host->req) { | ||
392 | if (fifo_status & TIFM_FIFO_READY) { | ||
393 | if (!host->no_dma || tifm_ms_transfer_data(host, 0)) { | ||
394 | host->cmd_flags |= FIFO_READY; | ||
395 | rc = tifm_ms_check_status(host); | ||
396 | } | ||
397 | } | ||
398 | } | ||
399 | |||
400 | writel(fifo_status, sock->addr + SOCK_DMA_FIFO_STATUS); | ||
401 | if (!rc) | ||
402 | tifm_ms_complete_cmd(host); | ||
403 | |||
404 | spin_unlock(&sock->lock); | ||
405 | } | ||
406 | |||
407 | |||
408 | /* Called from interrupt handler */ | ||
409 | static void tifm_ms_card_event(struct tifm_dev *sock) | ||
410 | { | ||
411 | struct tifm_ms *host; | ||
412 | unsigned int host_status = 0; | ||
413 | int rc = 1; | ||
414 | |||
415 | spin_lock(&sock->lock); | ||
416 | host = memstick_priv((struct memstick_host *)tifm_get_drvdata(sock)); | ||
417 | host_status = readl(sock->addr + SOCK_MS_STATUS); | ||
418 | dev_dbg(&sock->dev, "host event: host_status %x, flags %x\n", | ||
419 | host_status, host->cmd_flags); | ||
420 | |||
421 | if (host->req) { | ||
422 | if (host_status & TIFM_MS_TIMEOUT) | ||
423 | host->req->error = -ETIME; | ||
424 | else if (host_status & TIFM_MS_BADCRC) | ||
425 | host->req->error = -EILSEQ; | ||
426 | |||
427 | if (host->req->error) { | ||
428 | writel(TIFM_FIFO_INT_SETALL, | ||
429 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | ||
430 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); | ||
431 | } | ||
432 | |||
433 | if (host_status & TIFM_MS_EOTPC) | ||
434 | host->cmd_flags |= CMD_READY; | ||
435 | if (host_status & TIFM_MS_INT) | ||
436 | host->cmd_flags |= CARD_READY; | ||
437 | |||
438 | rc = tifm_ms_check_status(host); | ||
439 | |||
440 | } | ||
441 | |||
442 | writel(TIFM_MS_SYS_NOT_RDY | readl(sock->addr + SOCK_MS_SYSTEM), | ||
443 | sock->addr + SOCK_MS_SYSTEM); | ||
444 | writel((~TIFM_MS_SYS_DATA) & readl(sock->addr + SOCK_MS_SYSTEM), | ||
445 | sock->addr + SOCK_MS_SYSTEM); | ||
446 | |||
447 | if (!rc) | ||
448 | tifm_ms_complete_cmd(host); | ||
449 | |||
450 | spin_unlock(&sock->lock); | ||
451 | return; | ||
452 | } | ||
453 | |||
454 | static void tifm_ms_request(struct memstick_host *msh) | ||
455 | { | ||
456 | struct tifm_ms *host = memstick_priv(msh); | ||
457 | struct tifm_dev *sock = host->dev; | ||
458 | unsigned long flags; | ||
459 | int rc; | ||
460 | |||
461 | spin_lock_irqsave(&sock->lock, flags); | ||
462 | if (host->req) { | ||
463 | printk(KERN_ERR "%s : unfinished request detected\n", | ||
464 | sock->dev.bus_id); | ||
465 | spin_unlock_irqrestore(&sock->lock, flags); | ||
466 | tifm_eject(host->dev); | ||
467 | return; | ||
468 | } | ||
469 | |||
470 | if (host->eject) { | ||
471 | do { | ||
472 | rc = memstick_next_req(msh, &host->req); | ||
473 | if (!rc) | ||
474 | host->req->error = -ETIME; | ||
475 | } while (!rc); | ||
476 | spin_unlock_irqrestore(&sock->lock, flags); | ||
477 | return; | ||
478 | } | ||
479 | |||
480 | do { | ||
481 | rc = memstick_next_req(msh, &host->req); | ||
482 | } while (!rc && tifm_ms_issue_cmd(host)); | ||
483 | |||
484 | spin_unlock_irqrestore(&sock->lock, flags); | ||
485 | return; | ||
486 | } | ||
487 | |||
488 | static void tifm_ms_set_param(struct memstick_host *msh, | ||
489 | enum memstick_param param, | ||
490 | int value) | ||
491 | { | ||
492 | struct tifm_ms *host = memstick_priv(msh); | ||
493 | struct tifm_dev *sock = host->dev; | ||
494 | unsigned long flags; | ||
495 | |||
496 | spin_lock_irqsave(&sock->lock, flags); | ||
497 | |||
498 | switch (param) { | ||
499 | case MEMSTICK_POWER: | ||
500 | /* this is set by card detection mechanism */ | ||
501 | break; | ||
502 | case MEMSTICK_INTERFACE: | ||
503 | if (value == MEMSTICK_SERIAL) { | ||
504 | host->mode_mask = TIFM_MS_SERIAL; | ||
505 | writel((~TIFM_CTRL_FAST_CLK) | ||
506 | & readl(sock->addr + SOCK_CONTROL), | ||
507 | sock->addr + SOCK_CONTROL); | ||
508 | } else if (value == MEMSTICK_PARALLEL) { | ||
509 | host->mode_mask = 0; | ||
510 | writel(TIFM_CTRL_FAST_CLK | ||
511 | | readl(sock->addr + SOCK_CONTROL), | ||
512 | sock->addr + SOCK_CONTROL); | ||
513 | } | ||
514 | break; | ||
515 | }; | ||
516 | |||
517 | spin_unlock_irqrestore(&sock->lock, flags); | ||
518 | } | ||
519 | |||
520 | static void tifm_ms_abort(unsigned long data) | ||
521 | { | ||
522 | struct tifm_ms *host = (struct tifm_ms *)data; | ||
523 | |||
524 | dev_dbg(&host->dev->dev, "status %x\n", | ||
525 | readl(host->dev->addr + SOCK_MS_STATUS)); | ||
526 | printk(KERN_ERR | ||
527 | "%s : card failed to respond for a long period of time " | ||
528 | "(%x, %x)\n", | ||
529 | host->dev->dev.bus_id, host->req ? host->req->tpc : 0, | ||
530 | host->cmd_flags); | ||
531 | |||
532 | tifm_eject(host->dev); | ||
533 | } | ||
534 | |||
535 | static int tifm_ms_initialize_host(struct tifm_ms *host) | ||
536 | { | ||
537 | struct tifm_dev *sock = host->dev; | ||
538 | struct memstick_host *msh = tifm_get_drvdata(sock); | ||
539 | |||
540 | host->mode_mask = TIFM_MS_SERIAL; | ||
541 | writel(0x8000, sock->addr + SOCK_MS_SYSTEM); | ||
542 | writel(0x0200 | TIFM_MS_SYS_NOT_RDY, sock->addr + SOCK_MS_SYSTEM); | ||
543 | writel(0xffffffff, sock->addr + SOCK_MS_STATUS); | ||
544 | if (tifm_has_ms_pif(sock)) | ||
545 | msh->caps |= MEMSTICK_CAP_PARALLEL; | ||
546 | |||
547 | return 0; | ||
548 | } | ||
549 | |||
550 | static int tifm_ms_probe(struct tifm_dev *sock) | ||
551 | { | ||
552 | struct memstick_host *msh; | ||
553 | struct tifm_ms *host; | ||
554 | int rc = -EIO; | ||
555 | |||
556 | if (!(TIFM_SOCK_STATE_OCCUPIED | ||
557 | & readl(sock->addr + SOCK_PRESENT_STATE))) { | ||
558 | printk(KERN_WARNING "%s : card gone, unexpectedly\n", | ||
559 | sock->dev.bus_id); | ||
560 | return rc; | ||
561 | } | ||
562 | |||
563 | msh = memstick_alloc_host(sizeof(struct tifm_ms), &sock->dev); | ||
564 | if (!msh) | ||
565 | return -ENOMEM; | ||
566 | |||
567 | host = memstick_priv(msh); | ||
568 | tifm_set_drvdata(sock, msh); | ||
569 | host->dev = sock; | ||
570 | host->timeout_jiffies = msecs_to_jiffies(1000); | ||
571 | host->no_dma = no_dma; | ||
572 | |||
573 | setup_timer(&host->timer, tifm_ms_abort, (unsigned long)host); | ||
574 | |||
575 | msh->request = tifm_ms_request; | ||
576 | msh->set_param = tifm_ms_set_param; | ||
577 | sock->card_event = tifm_ms_card_event; | ||
578 | sock->data_event = tifm_ms_data_event; | ||
579 | rc = tifm_ms_initialize_host(host); | ||
580 | |||
581 | if (!rc) | ||
582 | rc = memstick_add_host(msh); | ||
583 | if (!rc) | ||
584 | return 0; | ||
585 | |||
586 | memstick_free_host(msh); | ||
587 | return rc; | ||
588 | } | ||
589 | |||
590 | static void tifm_ms_remove(struct tifm_dev *sock) | ||
591 | { | ||
592 | struct memstick_host *msh = tifm_get_drvdata(sock); | ||
593 | struct tifm_ms *host = memstick_priv(msh); | ||
594 | int rc = 0; | ||
595 | unsigned long flags; | ||
596 | |||
597 | spin_lock_irqsave(&sock->lock, flags); | ||
598 | host->eject = 1; | ||
599 | if (host->req) { | ||
600 | del_timer(&host->timer); | ||
601 | writel(TIFM_FIFO_INT_SETALL, | ||
602 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | ||
603 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); | ||
604 | if ((host->req->io_type == MEMSTICK_IO_SG) && !host->no_dma) | ||
605 | tifm_unmap_sg(sock, &host->req->sg, 1, | ||
606 | host->req->data_dir == READ | ||
607 | ? PCI_DMA_TODEVICE | ||
608 | : PCI_DMA_FROMDEVICE); | ||
609 | host->req->error = -ETIME; | ||
610 | |||
611 | do { | ||
612 | rc = memstick_next_req(msh, &host->req); | ||
613 | if (!rc) | ||
614 | host->req->error = -ETIME; | ||
615 | } while (!rc); | ||
616 | } | ||
617 | spin_unlock_irqrestore(&sock->lock, flags); | ||
618 | |||
619 | memstick_remove_host(msh); | ||
620 | |||
621 | writel(0x0200 | TIFM_MS_SYS_NOT_RDY, sock->addr + SOCK_MS_SYSTEM); | ||
622 | writel(0xffffffff, sock->addr + SOCK_MS_STATUS); | ||
623 | |||
624 | memstick_free_host(msh); | ||
625 | } | ||
626 | |||
627 | #ifdef CONFIG_PM | ||
628 | |||
629 | static int tifm_ms_suspend(struct tifm_dev *sock, pm_message_t state) | ||
630 | { | ||
631 | return 0; | ||
632 | } | ||
633 | |||
634 | static int tifm_ms_resume(struct tifm_dev *sock) | ||
635 | { | ||
636 | struct memstick_host *msh = tifm_get_drvdata(sock); | ||
637 | struct tifm_ms *host = memstick_priv(msh); | ||
638 | |||
639 | tifm_ms_initialize_host(host); | ||
640 | memstick_detect_change(msh); | ||
641 | |||
642 | return 0; | ||
643 | } | ||
644 | |||
645 | #else | ||
646 | |||
647 | #define tifm_ms_suspend NULL | ||
648 | #define tifm_ms_resume NULL | ||
649 | |||
650 | #endif /* CONFIG_PM */ | ||
651 | |||
652 | static struct tifm_device_id tifm_ms_id_tbl[] = { | ||
653 | { TIFM_TYPE_MS }, { 0 } | ||
654 | }; | ||
655 | |||
656 | static struct tifm_driver tifm_ms_driver = { | ||
657 | .driver = { | ||
658 | .name = DRIVER_NAME, | ||
659 | .owner = THIS_MODULE | ||
660 | }, | ||
661 | .id_table = tifm_ms_id_tbl, | ||
662 | .probe = tifm_ms_probe, | ||
663 | .remove = tifm_ms_remove, | ||
664 | .suspend = tifm_ms_suspend, | ||
665 | .resume = tifm_ms_resume | ||
666 | }; | ||
667 | |||
668 | static int __init tifm_ms_init(void) | ||
669 | { | ||
670 | return tifm_register_driver(&tifm_ms_driver); | ||
671 | } | ||
672 | |||
673 | static void __exit tifm_ms_exit(void) | ||
674 | { | ||
675 | tifm_unregister_driver(&tifm_ms_driver); | ||
676 | } | ||
677 | |||
678 | MODULE_AUTHOR("Alex Dubov"); | ||
679 | MODULE_DESCRIPTION("TI FlashMedia MemoryStick driver"); | ||
680 | MODULE_LICENSE("GPL"); | ||
681 | MODULE_DEVICE_TABLE(tifm, tifm_ms_id_tbl); | ||
682 | MODULE_VERSION(DRIVER_VERSION); | ||
683 | |||
684 | module_init(tifm_ms_init); | ||
685 | module_exit(tifm_ms_exit); | ||
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index c143a86c2ea6..1abc95ca9dfa 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -114,6 +114,9 @@ config ACER_WMI | |||
114 | wireless radio and bluetooth control, and on some laptops, | 114 | wireless radio and bluetooth control, and on some laptops, |
115 | exposes the mail LED and LCD backlight. | 115 | exposes the mail LED and LCD backlight. |
116 | 116 | ||
117 | For more information about this driver see | ||
118 | <file:Documentation/laptops/acer-wmi.txt> | ||
119 | |||
117 | If you have an ACPI-WMI compatible Acer/ Wistron laptop, say Y or M | 120 | If you have an ACPI-WMI compatible Acer/ Wistron laptop, say Y or M |
118 | here. | 121 | here. |
119 | 122 | ||
@@ -152,8 +155,9 @@ config FUJITSU_LAPTOP | |||
152 | If you have a Fujitsu laptop, say Y or M here. | 155 | If you have a Fujitsu laptop, say Y or M here. |
153 | 156 | ||
154 | config TC1100_WMI | 157 | config TC1100_WMI |
155 | tristate "HP Compaq TC1100 Tablet WMI Extras" | 158 | tristate "HP Compaq TC1100 Tablet WMI Extras (EXPERIMENTAL)" |
156 | depends on X86 && !X86_64 | 159 | depends on X86 && !X86_64 |
160 | depends on EXPERIMENTAL | ||
157 | depends on ACPI | 161 | depends on ACPI |
158 | select ACPI_WMI | 162 | select ACPI_WMI |
159 | ---help--- | 163 | ---help--- |
@@ -192,7 +196,7 @@ config SONY_LAPTOP | |||
192 | screen brightness control, Fn keys and allows powering on/off some | 196 | screen brightness control, Fn keys and allows powering on/off some |
193 | devices. | 197 | devices. |
194 | 198 | ||
195 | Read <file:Documentation/sony-laptop.txt> for more information. | 199 | Read <file:Documentation/laptops/sony-laptop.txt> for more information. |
196 | 200 | ||
197 | config SONYPI_COMPAT | 201 | config SONYPI_COMPAT |
198 | bool "Sonypi compatibility" | 202 | bool "Sonypi compatibility" |
@@ -211,8 +215,9 @@ config THINKPAD_ACPI | |||
211 | This is a driver for the IBM and Lenovo ThinkPad laptops. It adds | 215 | This is a driver for the IBM and Lenovo ThinkPad laptops. It adds |
212 | support for Fn-Fx key combinations, Bluetooth control, video | 216 | support for Fn-Fx key combinations, Bluetooth control, video |
213 | output switching, ThinkLight control, UltraBay eject and more. | 217 | output switching, ThinkLight control, UltraBay eject and more. |
214 | For more information about this driver see | 218 | For more information about this driver see |
215 | <file:Documentation/thinkpad-acpi.txt> and <http://ibm-acpi.sf.net/> . | 219 | <file:Documentation/laptops/thinkpad-acpi.txt> and |
220 | <http://ibm-acpi.sf.net/> . | ||
216 | 221 | ||
217 | This driver was formerly known as ibm-acpi. | 222 | This driver was formerly known as ibm-acpi. |
218 | 223 | ||
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c index a4d677504250..d7aea93081f2 100644 --- a/drivers/misc/acer-wmi.c +++ b/drivers/misc/acer-wmi.c | |||
@@ -428,11 +428,9 @@ static acpi_status AMW0_set_u32(u32 value, u32 cap, struct wmi_interface *iface) | |||
428 | if (value > max_brightness) | 428 | if (value > max_brightness) |
429 | return AE_BAD_PARAMETER; | 429 | return AE_BAD_PARAMETER; |
430 | switch (quirks->brightness) { | 430 | switch (quirks->brightness) { |
431 | case 1: | ||
432 | return ec_write(0x83, value); | ||
433 | default: | 431 | default: |
434 | return AE_BAD_ADDRESS; | 432 | return ec_write(0x83, value); |
435 | break; | 433 | break; |
436 | } | 434 | } |
437 | default: | 435 | default: |
438 | return AE_BAD_ADDRESS; | 436 | return AE_BAD_ADDRESS; |
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index 54380da343a5..63a089b29545 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c | |||
@@ -302,6 +302,21 @@ static int tifm_7xx1_resume(struct pci_dev *dev) | |||
302 | 302 | ||
303 | #endif /* CONFIG_PM */ | 303 | #endif /* CONFIG_PM */ |
304 | 304 | ||
305 | static int tifm_7xx1_dummy_has_ms_pif(struct tifm_adapter *fm, | ||
306 | struct tifm_dev *sock) | ||
307 | { | ||
308 | return 0; | ||
309 | } | ||
310 | |||
311 | static int tifm_7xx1_has_ms_pif(struct tifm_adapter *fm, struct tifm_dev *sock) | ||
312 | { | ||
313 | if (((fm->num_sockets == 4) && (sock->socket_id == 2)) | ||
314 | || ((fm->num_sockets == 2) && (sock->socket_id == 0))) | ||
315 | return 1; | ||
316 | |||
317 | return 0; | ||
318 | } | ||
319 | |||
305 | static int tifm_7xx1_probe(struct pci_dev *dev, | 320 | static int tifm_7xx1_probe(struct pci_dev *dev, |
306 | const struct pci_device_id *dev_id) | 321 | const struct pci_device_id *dev_id) |
307 | { | 322 | { |
@@ -336,6 +351,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev, | |||
336 | 351 | ||
337 | INIT_WORK(&fm->media_switcher, tifm_7xx1_switch_media); | 352 | INIT_WORK(&fm->media_switcher, tifm_7xx1_switch_media); |
338 | fm->eject = tifm_7xx1_eject; | 353 | fm->eject = tifm_7xx1_eject; |
354 | fm->has_ms_pif = tifm_7xx1_has_ms_pif; | ||
339 | pci_set_drvdata(dev, fm); | 355 | pci_set_drvdata(dev, fm); |
340 | 356 | ||
341 | fm->addr = ioremap(pci_resource_start(dev, 0), | 357 | fm->addr = ioremap(pci_resource_start(dev, 0), |
@@ -377,6 +393,7 @@ static void tifm_7xx1_remove(struct pci_dev *dev) | |||
377 | int cnt; | 393 | int cnt; |
378 | 394 | ||
379 | fm->eject = tifm_7xx1_dummy_eject; | 395 | fm->eject = tifm_7xx1_dummy_eject; |
396 | fm->has_ms_pif = tifm_7xx1_dummy_has_ms_pif; | ||
380 | writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); | 397 | writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); |
381 | mmiowb(); | 398 | mmiowb(); |
382 | free_irq(dev->irq, fm); | 399 | free_irq(dev->irq, fm); |
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c index 97544052e768..82dc72a1484f 100644 --- a/drivers/misc/tifm_core.c +++ b/drivers/misc/tifm_core.c | |||
@@ -284,6 +284,13 @@ void tifm_eject(struct tifm_dev *sock) | |||
284 | } | 284 | } |
285 | EXPORT_SYMBOL(tifm_eject); | 285 | EXPORT_SYMBOL(tifm_eject); |
286 | 286 | ||
287 | int tifm_has_ms_pif(struct tifm_dev *sock) | ||
288 | { | ||
289 | struct tifm_adapter *fm = dev_get_drvdata(sock->dev.parent); | ||
290 | return fm->has_ms_pif(fm, sock); | ||
291 | } | ||
292 | EXPORT_SYMBOL(tifm_has_ms_pif); | ||
293 | |||
287 | int tifm_map_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents, | 294 | int tifm_map_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents, |
288 | int direction) | 295 | int direction) |
289 | { | 296 | { |
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 5fef6783c716..3b3cd0e74715 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
@@ -25,8 +25,8 @@ config MMC_PXA | |||
25 | If unsure, say N. | 25 | If unsure, say N. |
26 | 26 | ||
27 | config MMC_SDHCI | 27 | config MMC_SDHCI |
28 | tristate "Secure Digital Host Controller Interface support (EXPERIMENTAL)" | 28 | tristate "Secure Digital Host Controller Interface support" |
29 | depends on PCI && EXPERIMENTAL | 29 | depends on PCI |
30 | help | 30 | help |
31 | This select the generic Secure Digital Host Controller Interface. | 31 | This select the generic Secure Digital Host Controller Interface. |
32 | It is used by manufacturers such as Texas Instruments(R), Ricoh(R) | 32 | It is used by manufacturers such as Texas Instruments(R), Ricoh(R) |
@@ -118,8 +118,8 @@ config MMC_TIFM_SD | |||
118 | module will be called tifm_sd. | 118 | module will be called tifm_sd. |
119 | 119 | ||
120 | config MMC_SPI | 120 | config MMC_SPI |
121 | tristate "MMC/SD over SPI (EXPERIMENTAL)" | 121 | tristate "MMC/SD over SPI" |
122 | depends on MMC && SPI_MASTER && !HIGHMEM && EXPERIMENTAL | 122 | depends on MMC && SPI_MASTER && !HIGHMEM |
123 | select CRC7 | 123 | select CRC7 |
124 | select CRC_ITU_T | 124 | select CRC_ITU_T |
125 | help | 125 | help |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index b1edcefdd4f9..21acecc9fe3a 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -70,10 +70,11 @@ | |||
70 | 70 | ||
71 | #include <asm/io.h> | 71 | #include <asm/io.h> |
72 | #include <asm/irq.h> | 72 | #include <asm/irq.h> |
73 | #include <asm/gpio.h> | ||
74 | |||
73 | #include <asm/mach/mmc.h> | 75 | #include <asm/mach/mmc.h> |
74 | #include <asm/arch/board.h> | 76 | #include <asm/arch/board.h> |
75 | #include <asm/arch/cpu.h> | 77 | #include <asm/arch/cpu.h> |
76 | #include <asm/arch/gpio.h> | ||
77 | #include <asm/arch/at91_mci.h> | 78 | #include <asm/arch/at91_mci.h> |
78 | 79 | ||
79 | #define DRIVER_NAME "at91_mci" | 80 | #define DRIVER_NAME "at91_mci" |
@@ -659,11 +660,11 @@ static void at91_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
659 | if (host->board->vcc_pin) { | 660 | if (host->board->vcc_pin) { |
660 | switch (ios->power_mode) { | 661 | switch (ios->power_mode) { |
661 | case MMC_POWER_OFF: | 662 | case MMC_POWER_OFF: |
662 | at91_set_gpio_value(host->board->vcc_pin, 0); | 663 | gpio_set_value(host->board->vcc_pin, 0); |
663 | break; | 664 | break; |
664 | case MMC_POWER_UP: | 665 | case MMC_POWER_UP: |
665 | case MMC_POWER_ON: | 666 | case MMC_POWER_ON: |
666 | at91_set_gpio_value(host->board->vcc_pin, 1); | 667 | gpio_set_value(host->board->vcc_pin, 1); |
667 | break; | 668 | break; |
668 | } | 669 | } |
669 | } | 670 | } |
@@ -768,7 +769,7 @@ static irqreturn_t at91_mci_irq(int irq, void *devid) | |||
768 | static irqreturn_t at91_mmc_det_irq(int irq, void *_host) | 769 | static irqreturn_t at91_mmc_det_irq(int irq, void *_host) |
769 | { | 770 | { |
770 | struct at91mci_host *host = _host; | 771 | struct at91mci_host *host = _host; |
771 | int present = !at91_get_gpio_value(irq); | 772 | int present = !gpio_get_value(irq_to_gpio(irq)); |
772 | 773 | ||
773 | /* | 774 | /* |
774 | * we expect this irq on both insert and remove, | 775 | * we expect this irq on both insert and remove, |
@@ -793,7 +794,7 @@ static int at91_mci_get_ro(struct mmc_host *mmc) | |||
793 | struct at91mci_host *host = mmc_priv(mmc); | 794 | struct at91mci_host *host = mmc_priv(mmc); |
794 | 795 | ||
795 | if (host->board->wp_pin) { | 796 | if (host->board->wp_pin) { |
796 | read_only = at91_get_gpio_value(host->board->wp_pin); | 797 | read_only = gpio_get_value(host->board->wp_pin); |
797 | printk(KERN_WARNING "%s: card is %s\n", mmc_hostname(mmc), | 798 | printk(KERN_WARNING "%s: card is %s\n", mmc_hostname(mmc), |
798 | (read_only ? "read-only" : "read-write") ); | 799 | (read_only ? "read-only" : "read-write") ); |
799 | } | 800 | } |
@@ -820,8 +821,6 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
820 | struct resource *res; | 821 | struct resource *res; |
821 | int ret; | 822 | int ret; |
822 | 823 | ||
823 | pr_debug("Probe MCI devices\n"); | ||
824 | |||
825 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 824 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
826 | if (!res) | 825 | if (!res) |
827 | return -ENXIO; | 826 | return -ENXIO; |
@@ -831,9 +830,9 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
831 | 830 | ||
832 | mmc = mmc_alloc_host(sizeof(struct at91mci_host), &pdev->dev); | 831 | mmc = mmc_alloc_host(sizeof(struct at91mci_host), &pdev->dev); |
833 | if (!mmc) { | 832 | if (!mmc) { |
834 | pr_debug("Failed to allocate mmc host\n"); | 833 | ret = -ENOMEM; |
835 | release_mem_region(res->start, res->end - res->start + 1); | 834 | dev_dbg(&pdev->dev, "couldn't allocate mmc host\n"); |
836 | return -ENOMEM; | 835 | goto fail6; |
837 | } | 836 | } |
838 | 837 | ||
839 | mmc->ops = &at91_mci_ops; | 838 | mmc->ops = &at91_mci_ops; |
@@ -853,19 +852,44 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
853 | if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) | 852 | if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) |
854 | mmc->caps |= MMC_CAP_4_BIT_DATA; | 853 | mmc->caps |= MMC_CAP_4_BIT_DATA; |
855 | else | 854 | else |
856 | printk("AT91 MMC: 4 wire bus mode not supported" | 855 | dev_warn(&pdev->dev, "4 wire bus mode not supported" |
857 | " - using 1 wire\n"); | 856 | " - using 1 wire\n"); |
858 | } | 857 | } |
859 | 858 | ||
860 | /* | 859 | /* |
860 | * Reserve GPIOs ... board init code makes sure these pins are set | ||
861 | * up as GPIOs with the right direction (input, except for vcc) | ||
862 | */ | ||
863 | if (host->board->det_pin) { | ||
864 | ret = gpio_request(host->board->det_pin, "mmc_detect"); | ||
865 | if (ret < 0) { | ||
866 | dev_dbg(&pdev->dev, "couldn't claim card detect pin\n"); | ||
867 | goto fail5; | ||
868 | } | ||
869 | } | ||
870 | if (host->board->wp_pin) { | ||
871 | ret = gpio_request(host->board->wp_pin, "mmc_wp"); | ||
872 | if (ret < 0) { | ||
873 | dev_dbg(&pdev->dev, "couldn't claim wp sense pin\n"); | ||
874 | goto fail4; | ||
875 | } | ||
876 | } | ||
877 | if (host->board->vcc_pin) { | ||
878 | ret = gpio_request(host->board->vcc_pin, "mmc_vcc"); | ||
879 | if (ret < 0) { | ||
880 | dev_dbg(&pdev->dev, "couldn't claim vcc switch pin\n"); | ||
881 | goto fail3; | ||
882 | } | ||
883 | } | ||
884 | |||
885 | /* | ||
861 | * Get Clock | 886 | * Get Clock |
862 | */ | 887 | */ |
863 | host->mci_clk = clk_get(&pdev->dev, "mci_clk"); | 888 | host->mci_clk = clk_get(&pdev->dev, "mci_clk"); |
864 | if (IS_ERR(host->mci_clk)) { | 889 | if (IS_ERR(host->mci_clk)) { |
865 | printk(KERN_ERR "AT91 MMC: no clock defined.\n"); | 890 | ret = -ENODEV; |
866 | mmc_free_host(mmc); | 891 | dev_dbg(&pdev->dev, "no mci_clk?\n"); |
867 | release_mem_region(res->start, res->end - res->start + 1); | 892 | goto fail2; |
868 | return -ENODEV; | ||
869 | } | 893 | } |
870 | 894 | ||
871 | /* | 895 | /* |
@@ -873,10 +897,8 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
873 | */ | 897 | */ |
874 | host->baseaddr = ioremap(res->start, res->end - res->start + 1); | 898 | host->baseaddr = ioremap(res->start, res->end - res->start + 1); |
875 | if (!host->baseaddr) { | 899 | if (!host->baseaddr) { |
876 | clk_put(host->mci_clk); | 900 | ret = -ENOMEM; |
877 | mmc_free_host(mmc); | 901 | goto fail1; |
878 | release_mem_region(res->start, res->end - res->start + 1); | ||
879 | return -ENOMEM; | ||
880 | } | 902 | } |
881 | 903 | ||
882 | /* | 904 | /* |
@@ -890,15 +912,11 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
890 | * Allocate the MCI interrupt | 912 | * Allocate the MCI interrupt |
891 | */ | 913 | */ |
892 | host->irq = platform_get_irq(pdev, 0); | 914 | host->irq = platform_get_irq(pdev, 0); |
893 | ret = request_irq(host->irq, at91_mci_irq, IRQF_SHARED, DRIVER_NAME, host); | 915 | ret = request_irq(host->irq, at91_mci_irq, IRQF_SHARED, |
916 | mmc_hostname(mmc), host); | ||
894 | if (ret) { | 917 | if (ret) { |
895 | printk(KERN_ERR "AT91 MMC: Failed to request MCI interrupt\n"); | 918 | dev_dbg(&pdev->dev, "request MCI interrupt failed\n"); |
896 | clk_disable(host->mci_clk); | 919 | goto fail0; |
897 | clk_put(host->mci_clk); | ||
898 | mmc_free_host(mmc); | ||
899 | iounmap(host->baseaddr); | ||
900 | release_mem_region(res->start, res->end - res->start + 1); | ||
901 | return ret; | ||
902 | } | 920 | } |
903 | 921 | ||
904 | platform_set_drvdata(pdev, mmc); | 922 | platform_set_drvdata(pdev, mmc); |
@@ -907,8 +925,7 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
907 | * Add host to MMC layer | 925 | * Add host to MMC layer |
908 | */ | 926 | */ |
909 | if (host->board->det_pin) { | 927 | if (host->board->det_pin) { |
910 | host->present = !at91_get_gpio_value(host->board->det_pin); | 928 | host->present = !gpio_get_value(host->board->det_pin); |
911 | device_init_wakeup(&pdev->dev, 1); | ||
912 | } | 929 | } |
913 | else | 930 | else |
914 | host->present = -1; | 931 | host->present = -1; |
@@ -919,15 +936,38 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
919 | * monitor card insertion/removal if we can | 936 | * monitor card insertion/removal if we can |
920 | */ | 937 | */ |
921 | if (host->board->det_pin) { | 938 | if (host->board->det_pin) { |
922 | ret = request_irq(host->board->det_pin, at91_mmc_det_irq, | 939 | ret = request_irq(gpio_to_irq(host->board->det_pin), |
923 | 0, DRIVER_NAME, host); | 940 | at91_mmc_det_irq, 0, mmc_hostname(mmc), host); |
924 | if (ret) | 941 | if (ret) |
925 | printk(KERN_ERR "AT91 MMC: Couldn't allocate MMC detect irq\n"); | 942 | dev_warn(&pdev->dev, "request MMC detect irq failed\n"); |
943 | else | ||
944 | device_init_wakeup(&pdev->dev, 1); | ||
926 | } | 945 | } |
927 | 946 | ||
928 | pr_debug("Added MCI driver\n"); | 947 | pr_debug("Added MCI driver\n"); |
929 | 948 | ||
930 | return 0; | 949 | return 0; |
950 | |||
951 | fail0: | ||
952 | clk_disable(host->mci_clk); | ||
953 | iounmap(host->baseaddr); | ||
954 | fail1: | ||
955 | clk_put(host->mci_clk); | ||
956 | fail2: | ||
957 | if (host->board->vcc_pin) | ||
958 | gpio_free(host->board->vcc_pin); | ||
959 | fail3: | ||
960 | if (host->board->wp_pin) | ||
961 | gpio_free(host->board->wp_pin); | ||
962 | fail4: | ||
963 | if (host->board->det_pin) | ||
964 | gpio_free(host->board->det_pin); | ||
965 | fail5: | ||
966 | mmc_free_host(mmc); | ||
967 | fail6: | ||
968 | release_mem_region(res->start, res->end - res->start + 1); | ||
969 | dev_err(&pdev->dev, "probe failed, err %d\n", ret); | ||
970 | return ret; | ||
931 | } | 971 | } |
932 | 972 | ||
933 | /* | 973 | /* |
@@ -945,9 +985,10 @@ static int __exit at91_mci_remove(struct platform_device *pdev) | |||
945 | host = mmc_priv(mmc); | 985 | host = mmc_priv(mmc); |
946 | 986 | ||
947 | if (host->board->det_pin) { | 987 | if (host->board->det_pin) { |
988 | if (device_can_wakeup(&pdev->dev)) | ||
989 | free_irq(gpio_to_irq(host->board->det_pin), host); | ||
948 | device_init_wakeup(&pdev->dev, 0); | 990 | device_init_wakeup(&pdev->dev, 0); |
949 | free_irq(host->board->det_pin, host); | 991 | gpio_free(host->board->det_pin); |
950 | cancel_delayed_work(&host->mmc->detect); | ||
951 | } | 992 | } |
952 | 993 | ||
953 | at91_mci_disable(host); | 994 | at91_mci_disable(host); |
@@ -957,6 +998,11 @@ static int __exit at91_mci_remove(struct platform_device *pdev) | |||
957 | clk_disable(host->mci_clk); /* Disable the peripheral clock */ | 998 | clk_disable(host->mci_clk); /* Disable the peripheral clock */ |
958 | clk_put(host->mci_clk); | 999 | clk_put(host->mci_clk); |
959 | 1000 | ||
1001 | if (host->board->vcc_pin) | ||
1002 | gpio_free(host->board->vcc_pin); | ||
1003 | if (host->board->wp_pin) | ||
1004 | gpio_free(host->board->wp_pin); | ||
1005 | |||
960 | iounmap(host->baseaddr); | 1006 | iounmap(host->baseaddr); |
961 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1007 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
962 | release_mem_region(res->start, res->end - res->start + 1); | 1008 | release_mem_region(res->start, res->end - res->start + 1); |
diff --git a/drivers/mmc/host/ricoh_mmc.c b/drivers/mmc/host/ricoh_mmc.c index 1e8704533bc5..a16d7609e4ee 100644 --- a/drivers/mmc/host/ricoh_mmc.c +++ b/drivers/mmc/host/ricoh_mmc.c | |||
@@ -41,10 +41,91 @@ static const struct pci_device_id pci_ids[] __devinitdata = { | |||
41 | 41 | ||
42 | MODULE_DEVICE_TABLE(pci, pci_ids); | 42 | MODULE_DEVICE_TABLE(pci, pci_ids); |
43 | 43 | ||
44 | static int ricoh_mmc_disable(struct pci_dev *fw_dev) | ||
45 | { | ||
46 | u8 write_enable; | ||
47 | u8 write_target; | ||
48 | u8 disable; | ||
49 | |||
50 | if (fw_dev->device == PCI_DEVICE_ID_RICOH_RL5C476) { | ||
51 | /* via RL5C476 */ | ||
52 | |||
53 | pci_read_config_byte(fw_dev, 0xB7, &disable); | ||
54 | if (disable & 0x02) { | ||
55 | printk(KERN_INFO DRIVER_NAME | ||
56 | ": Controller already disabled. " \ | ||
57 | "Nothing to do.\n"); | ||
58 | return -ENODEV; | ||
59 | } | ||
60 | |||
61 | pci_read_config_byte(fw_dev, 0x8E, &write_enable); | ||
62 | pci_write_config_byte(fw_dev, 0x8E, 0xAA); | ||
63 | pci_read_config_byte(fw_dev, 0x8D, &write_target); | ||
64 | pci_write_config_byte(fw_dev, 0x8D, 0xB7); | ||
65 | pci_write_config_byte(fw_dev, 0xB7, disable | 0x02); | ||
66 | pci_write_config_byte(fw_dev, 0x8E, write_enable); | ||
67 | pci_write_config_byte(fw_dev, 0x8D, write_target); | ||
68 | } else { | ||
69 | /* via R5C832 */ | ||
70 | |||
71 | pci_read_config_byte(fw_dev, 0xCB, &disable); | ||
72 | if (disable & 0x02) { | ||
73 | printk(KERN_INFO DRIVER_NAME | ||
74 | ": Controller already disabled. " \ | ||
75 | "Nothing to do.\n"); | ||
76 | return -ENODEV; | ||
77 | } | ||
78 | |||
79 | pci_read_config_byte(fw_dev, 0xCA, &write_enable); | ||
80 | pci_write_config_byte(fw_dev, 0xCA, 0x57); | ||
81 | pci_write_config_byte(fw_dev, 0xCB, disable | 0x02); | ||
82 | pci_write_config_byte(fw_dev, 0xCA, write_enable); | ||
83 | } | ||
84 | |||
85 | printk(KERN_INFO DRIVER_NAME | ||
86 | ": Controller is now disabled.\n"); | ||
87 | |||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | static int ricoh_mmc_enable(struct pci_dev *fw_dev) | ||
92 | { | ||
93 | u8 write_enable; | ||
94 | u8 write_target; | ||
95 | u8 disable; | ||
96 | |||
97 | if (fw_dev->device == PCI_DEVICE_ID_RICOH_RL5C476) { | ||
98 | /* via RL5C476 */ | ||
99 | |||
100 | pci_read_config_byte(fw_dev, 0x8E, &write_enable); | ||
101 | pci_write_config_byte(fw_dev, 0x8E, 0xAA); | ||
102 | pci_read_config_byte(fw_dev, 0x8D, &write_target); | ||
103 | pci_write_config_byte(fw_dev, 0x8D, 0xB7); | ||
104 | pci_read_config_byte(fw_dev, 0xB7, &disable); | ||
105 | pci_write_config_byte(fw_dev, 0xB7, disable & ~0x02); | ||
106 | pci_write_config_byte(fw_dev, 0x8E, write_enable); | ||
107 | pci_write_config_byte(fw_dev, 0x8D, write_target); | ||
108 | } else { | ||
109 | /* via R5C832 */ | ||
110 | |||
111 | pci_read_config_byte(fw_dev, 0xCA, &write_enable); | ||
112 | pci_read_config_byte(fw_dev, 0xCB, &disable); | ||
113 | pci_write_config_byte(fw_dev, 0xCA, 0x57); | ||
114 | pci_write_config_byte(fw_dev, 0xCB, disable & ~0x02); | ||
115 | pci_write_config_byte(fw_dev, 0xCA, write_enable); | ||
116 | } | ||
117 | |||
118 | printk(KERN_INFO DRIVER_NAME | ||
119 | ": Controller is now re-enabled.\n"); | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
44 | static int __devinit ricoh_mmc_probe(struct pci_dev *pdev, | 124 | static int __devinit ricoh_mmc_probe(struct pci_dev *pdev, |
45 | const struct pci_device_id *ent) | 125 | const struct pci_device_id *ent) |
46 | { | 126 | { |
47 | u8 rev; | 127 | u8 rev; |
128 | u8 ctrlfound = 0; | ||
48 | 129 | ||
49 | struct pci_dev *fw_dev = NULL; | 130 | struct pci_dev *fw_dev = NULL; |
50 | 131 | ||
@@ -58,34 +139,38 @@ static int __devinit ricoh_mmc_probe(struct pci_dev *pdev, | |||
58 | pci_name(pdev), (int)pdev->vendor, (int)pdev->device, | 139 | pci_name(pdev), (int)pdev->vendor, (int)pdev->device, |
59 | (int)rev); | 140 | (int)rev); |
60 | 141 | ||
61 | while ((fw_dev = pci_get_device(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, fw_dev))) { | 142 | while ((fw_dev = |
143 | pci_get_device(PCI_VENDOR_ID_RICOH, | ||
144 | PCI_DEVICE_ID_RICOH_RL5C476, fw_dev))) { | ||
62 | if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && | 145 | if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && |
63 | pdev->bus == fw_dev->bus) { | 146 | pdev->bus == fw_dev->bus) { |
64 | u8 write_enable; | 147 | if (ricoh_mmc_disable(fw_dev) != 0) |
65 | u8 disable; | ||
66 | |||
67 | pci_read_config_byte(fw_dev, 0xCB, &disable); | ||
68 | if (disable & 0x02) { | ||
69 | printk(KERN_INFO DRIVER_NAME | ||
70 | ": Controller already disabled. Nothing to do.\n"); | ||
71 | return -ENODEV; | 148 | return -ENODEV; |
72 | } | ||
73 | |||
74 | pci_read_config_byte(fw_dev, 0xCA, &write_enable); | ||
75 | pci_write_config_byte(fw_dev, 0xCA, 0x57); | ||
76 | pci_write_config_byte(fw_dev, 0xCB, disable | 0x02); | ||
77 | pci_write_config_byte(fw_dev, 0xCA, write_enable); | ||
78 | 149 | ||
79 | pci_set_drvdata(pdev, fw_dev); | 150 | pci_set_drvdata(pdev, fw_dev); |
80 | 151 | ||
81 | printk(KERN_INFO DRIVER_NAME | 152 | ++ctrlfound; |
82 | ": Controller is now disabled.\n"); | ||
83 | |||
84 | break; | 153 | break; |
85 | } | 154 | } |
86 | } | 155 | } |
87 | 156 | ||
88 | if (pci_get_drvdata(pdev) == NULL) { | 157 | fw_dev = NULL; |
158 | |||
159 | while (!ctrlfound && | ||
160 | (fw_dev = pci_get_device(PCI_VENDOR_ID_RICOH, | ||
161 | PCI_DEVICE_ID_RICOH_R5C832, fw_dev))) { | ||
162 | if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && | ||
163 | pdev->bus == fw_dev->bus) { | ||
164 | if (ricoh_mmc_disable(fw_dev) != 0) | ||
165 | return -ENODEV; | ||
166 | |||
167 | pci_set_drvdata(pdev, fw_dev); | ||
168 | |||
169 | ++ctrlfound; | ||
170 | } | ||
171 | } | ||
172 | |||
173 | if (!ctrlfound) { | ||
89 | printk(KERN_WARNING DRIVER_NAME | 174 | printk(KERN_WARNING DRIVER_NAME |
90 | ": Main firewire function not found. Cannot disable controller.\n"); | 175 | ": Main firewire function not found. Cannot disable controller.\n"); |
91 | return -ENODEV; | 176 | return -ENODEV; |
@@ -96,30 +181,51 @@ static int __devinit ricoh_mmc_probe(struct pci_dev *pdev, | |||
96 | 181 | ||
97 | static void __devexit ricoh_mmc_remove(struct pci_dev *pdev) | 182 | static void __devexit ricoh_mmc_remove(struct pci_dev *pdev) |
98 | { | 183 | { |
99 | u8 write_enable; | ||
100 | u8 disable; | ||
101 | struct pci_dev *fw_dev = NULL; | 184 | struct pci_dev *fw_dev = NULL; |
102 | 185 | ||
103 | fw_dev = pci_get_drvdata(pdev); | 186 | fw_dev = pci_get_drvdata(pdev); |
104 | BUG_ON(fw_dev == NULL); | 187 | BUG_ON(fw_dev == NULL); |
105 | 188 | ||
106 | pci_read_config_byte(fw_dev, 0xCA, &write_enable); | 189 | ricoh_mmc_enable(fw_dev); |
107 | pci_read_config_byte(fw_dev, 0xCB, &disable); | ||
108 | pci_write_config_byte(fw_dev, 0xCA, 0x57); | ||
109 | pci_write_config_byte(fw_dev, 0xCB, disable & ~0x02); | ||
110 | pci_write_config_byte(fw_dev, 0xCA, write_enable); | ||
111 | |||
112 | printk(KERN_INFO DRIVER_NAME | ||
113 | ": Controller is now re-enabled.\n"); | ||
114 | 190 | ||
115 | pci_set_drvdata(pdev, NULL); | 191 | pci_set_drvdata(pdev, NULL); |
116 | } | 192 | } |
117 | 193 | ||
194 | static int ricoh_mmc_suspend(struct pci_dev *pdev, pm_message_t state) | ||
195 | { | ||
196 | struct pci_dev *fw_dev = NULL; | ||
197 | |||
198 | fw_dev = pci_get_drvdata(pdev); | ||
199 | BUG_ON(fw_dev == NULL); | ||
200 | |||
201 | printk(KERN_INFO DRIVER_NAME ": Suspending.\n"); | ||
202 | |||
203 | ricoh_mmc_enable(fw_dev); | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | static int ricoh_mmc_resume(struct pci_dev *pdev) | ||
209 | { | ||
210 | struct pci_dev *fw_dev = NULL; | ||
211 | |||
212 | fw_dev = pci_get_drvdata(pdev); | ||
213 | BUG_ON(fw_dev == NULL); | ||
214 | |||
215 | printk(KERN_INFO DRIVER_NAME ": Resuming.\n"); | ||
216 | |||
217 | ricoh_mmc_disable(fw_dev); | ||
218 | |||
219 | return 0; | ||
220 | } | ||
221 | |||
118 | static struct pci_driver ricoh_mmc_driver = { | 222 | static struct pci_driver ricoh_mmc_driver = { |
119 | .name = DRIVER_NAME, | 223 | .name = DRIVER_NAME, |
120 | .id_table = pci_ids, | 224 | .id_table = pci_ids, |
121 | .probe = ricoh_mmc_probe, | 225 | .probe = ricoh_mmc_probe, |
122 | .remove = __devexit_p(ricoh_mmc_remove), | 226 | .remove = __devexit_p(ricoh_mmc_remove), |
227 | .suspend = ricoh_mmc_suspend, | ||
228 | .resume = ricoh_mmc_resume, | ||
123 | }; | 229 | }; |
124 | 230 | ||
125 | /*****************************************************************************\ | 231 | /*****************************************************************************\ |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 785bbdcf4a58..4b673aa2dc3c 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -30,6 +30,10 @@ | |||
30 | 30 | ||
31 | static unsigned int debug_quirks = 0; | 31 | static unsigned int debug_quirks = 0; |
32 | 32 | ||
33 | /* For multi controllers in one platform case */ | ||
34 | static u16 chip_index = 0; | ||
35 | static spinlock_t index_lock; | ||
36 | |||
33 | /* | 37 | /* |
34 | * Different quirks to handle when the hardware deviates from a strict | 38 | * Different quirks to handle when the hardware deviates from a strict |
35 | * interpretation of the SDHCI specification. | 39 | * interpretation of the SDHCI specification. |
@@ -1320,7 +1324,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1320 | 1324 | ||
1321 | DBG("slot %d at 0x%08lx, irq %d\n", slot, host->addr, host->irq); | 1325 | DBG("slot %d at 0x%08lx, irq %d\n", slot, host->addr, host->irq); |
1322 | 1326 | ||
1323 | snprintf(host->slot_descr, 20, "sdhci:slot%d", slot); | 1327 | snprintf(host->slot_descr, 20, "sdhc%d:slot%d", chip->index, slot); |
1324 | 1328 | ||
1325 | ret = pci_request_region(pdev, host->bar, host->slot_descr); | 1329 | ret = pci_request_region(pdev, host->bar, host->slot_descr); |
1326 | if (ret) | 1330 | if (ret) |
@@ -1585,6 +1589,11 @@ static int __devinit sdhci_probe(struct pci_dev *pdev, | |||
1585 | chip->num_slots = slots; | 1589 | chip->num_slots = slots; |
1586 | pci_set_drvdata(pdev, chip); | 1590 | pci_set_drvdata(pdev, chip); |
1587 | 1591 | ||
1592 | /* Add for multi controller case */ | ||
1593 | spin_lock(&index_lock); | ||
1594 | chip->index = chip_index++; | ||
1595 | spin_unlock(&index_lock); | ||
1596 | |||
1588 | for (i = 0;i < slots;i++) { | 1597 | for (i = 0;i < slots;i++) { |
1589 | ret = sdhci_probe_slot(pdev, i); | 1598 | ret = sdhci_probe_slot(pdev, i); |
1590 | if (ret) { | 1599 | if (ret) { |
@@ -1645,6 +1654,8 @@ static int __init sdhci_drv_init(void) | |||
1645 | ": Secure Digital Host Controller Interface driver\n"); | 1654 | ": Secure Digital Host Controller Interface driver\n"); |
1646 | printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); | 1655 | printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); |
1647 | 1656 | ||
1657 | spin_lock_init(&index_lock); | ||
1658 | |||
1648 | return pci_register_driver(&sdhci_driver); | 1659 | return pci_register_driver(&sdhci_driver); |
1649 | } | 1660 | } |
1650 | 1661 | ||
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index e4d77b038bfa..d5a38f1b755a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -208,6 +208,7 @@ struct sdhci_chip { | |||
208 | 208 | ||
209 | unsigned long quirks; | 209 | unsigned long quirks; |
210 | 210 | ||
211 | int index; /* Index for chip0, chip1 ...*/ | ||
211 | int num_slots; /* Slots on controller */ | 212 | int num_slots; /* Slots on controller */ |
212 | struct sdhci_host *hosts[0]; /* Pointers to hosts */ | 213 | struct sdhci_host *hosts[0]; /* Pointers to hosts */ |
213 | }; | 214 | }; |
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c index 19e1594421a4..8dab69657b19 100644 --- a/drivers/mtd/nand/cs553x_nand.c +++ b/drivers/mtd/nand/cs553x_nand.c | |||
@@ -13,9 +13,12 @@ | |||
13 | * Overview: | 13 | * Overview: |
14 | * This is a device driver for the NAND flash controller found on | 14 | * This is a device driver for the NAND flash controller found on |
15 | * the AMD CS5535/CS5536 companion chipsets for the Geode processor. | 15 | * the AMD CS5535/CS5536 companion chipsets for the Geode processor. |
16 | * mtd-id for command line partitioning is cs553x_nand_cs[0-3] | ||
17 | * where 0-3 reflects the chip select for NAND. | ||
16 | * | 18 | * |
17 | */ | 19 | */ |
18 | 20 | ||
21 | #include <linux/kernel.h> | ||
19 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
20 | #include <linux/init.h> | 23 | #include <linux/init.h> |
21 | #include <linux/module.h> | 24 | #include <linux/module.h> |
@@ -244,6 +247,8 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr) | |||
244 | goto out_ior; | 247 | goto out_ior; |
245 | } | 248 | } |
246 | 249 | ||
250 | new_mtd->name = kasprintf(GFP_KERNEL, "cs553x_nand_cs%d", cs); | ||
251 | |||
247 | cs553x_mtd[cs] = new_mtd; | 252 | cs553x_mtd[cs] = new_mtd; |
248 | goto out; | 253 | goto out; |
249 | 254 | ||
@@ -272,12 +277,21 @@ static int is_geode(void) | |||
272 | return 0; | 277 | return 0; |
273 | } | 278 | } |
274 | 279 | ||
280 | |||
281 | #ifdef CONFIG_MTD_PARTITIONS | ||
282 | const char *part_probes[] = { "cmdlinepart", NULL }; | ||
283 | #endif | ||
284 | |||
285 | |||
275 | static int __init cs553x_init(void) | 286 | static int __init cs553x_init(void) |
276 | { | 287 | { |
277 | int err = -ENXIO; | 288 | int err = -ENXIO; |
278 | int i; | 289 | int i; |
279 | uint64_t val; | 290 | uint64_t val; |
280 | 291 | ||
292 | int mtd_parts_nb = 0; | ||
293 | struct mtd_partition *mtd_parts = NULL; | ||
294 | |||
281 | /* If the CPU isn't a Geode GX or LX, abort */ | 295 | /* If the CPU isn't a Geode GX or LX, abort */ |
282 | if (!is_geode()) | 296 | if (!is_geode()) |
283 | return -ENXIO; | 297 | return -ENXIO; |
@@ -290,7 +304,7 @@ static int __init cs553x_init(void) | |||
290 | 304 | ||
291 | /* If it doesn't have the NAND controller enabled, abort */ | 305 | /* If it doesn't have the NAND controller enabled, abort */ |
292 | rdmsrl(MSR_DIVIL_BALL_OPTS, val); | 306 | rdmsrl(MSR_DIVIL_BALL_OPTS, val); |
293 | if (val & 1) { | 307 | if (val & PIN_OPT_IDE) { |
294 | printk(KERN_INFO "CS553x NAND controller: Flash I/O not enabled in MSR_DIVIL_BALL_OPTS.\n"); | 308 | printk(KERN_INFO "CS553x NAND controller: Flash I/O not enabled in MSR_DIVIL_BALL_OPTS.\n"); |
295 | return -ENXIO; | 309 | return -ENXIO; |
296 | } | 310 | } |
@@ -306,9 +320,19 @@ static int __init cs553x_init(void) | |||
306 | do mtdconcat etc. if we want to. */ | 320 | do mtdconcat etc. if we want to. */ |
307 | for (i = 0; i < NR_CS553X_CONTROLLERS; i++) { | 321 | for (i = 0; i < NR_CS553X_CONTROLLERS; i++) { |
308 | if (cs553x_mtd[i]) { | 322 | if (cs553x_mtd[i]) { |
309 | add_mtd_device(cs553x_mtd[i]); | ||
310 | 323 | ||
311 | /* If any devices registered, return success. Else the last error. */ | 324 | /* If any devices registered, return success. Else the last error. */ |
325 | #ifdef CONFIG_MTD_PARTITIONS | ||
326 | mtd_parts_nb = parse_mtd_partitions(cs553x_mtd[i], part_probes, &mtd_parts, 0); | ||
327 | if (mtd_parts_nb > 0) { | ||
328 | printk(KERN_NOTICE "Using command line partition definition\n"); | ||
329 | add_mtd_partitions(cs553x_mtd[i], mtd_parts, mtd_parts_nb); | ||
330 | } else { | ||
331 | add_mtd_device(cs553x_mtd[i]); | ||
332 | } | ||
333 | #else | ||
334 | add_mtd_device(cs553x_mtd[i]); | ||
335 | #endif | ||
312 | err = 0; | 336 | err = 0; |
313 | } | 337 | } |
314 | } | 338 | } |
@@ -328,13 +352,14 @@ static void __exit cs553x_cleanup(void) | |||
328 | void __iomem *mmio_base; | 352 | void __iomem *mmio_base; |
329 | 353 | ||
330 | if (!mtd) | 354 | if (!mtd) |
331 | break; | 355 | continue; |
332 | 356 | ||
333 | this = cs553x_mtd[i]->priv; | 357 | this = cs553x_mtd[i]->priv; |
334 | mmio_base = this->IO_ADDR_R; | 358 | mmio_base = this->IO_ADDR_R; |
335 | 359 | ||
336 | /* Release resources, unregister device */ | 360 | /* Release resources, unregister device */ |
337 | nand_release(cs553x_mtd[i]); | 361 | nand_release(cs553x_mtd[i]); |
362 | kfree(cs553x_mtd[i]->name); | ||
338 | cs553x_mtd[i] = NULL; | 363 | cs553x_mtd[i] = NULL; |
339 | 364 | ||
340 | /* unmap physical address */ | 365 | /* unmap physical address */ |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 8b552c6dd2e7..471c7f3e8a4a 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -64,7 +64,7 @@ | |||
64 | /* Time in jiffies before concluding the transmitter is hung. */ | 64 | /* Time in jiffies before concluding the transmitter is hung. */ |
65 | #define TX_TIMEOUT (5*HZ) | 65 | #define TX_TIMEOUT (5*HZ) |
66 | 66 | ||
67 | static const char version[] __devinitdata = | 67 | static char version[] __devinitdata = |
68 | "Broadcom NetXtreme II Gigabit Ethernet Driver " DRV_MODULE_NAME " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 68 | "Broadcom NetXtreme II Gigabit Ethernet Driver " DRV_MODULE_NAME " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
69 | 69 | ||
70 | MODULE_AUTHOR("Michael Chan <mchan@broadcom.com>"); | 70 | MODULE_AUTHOR("Michael Chan <mchan@broadcom.com>"); |
@@ -90,7 +90,7 @@ typedef enum { | |||
90 | } board_t; | 90 | } board_t; |
91 | 91 | ||
92 | /* indexed by board_t, above */ | 92 | /* indexed by board_t, above */ |
93 | static const struct { | 93 | static struct { |
94 | char *name; | 94 | char *name; |
95 | } board_info[] __devinitdata = { | 95 | } board_info[] __devinitdata = { |
96 | { "Broadcom NetXtreme II BCM5706 1000Base-T" }, | 96 | { "Broadcom NetXtreme II BCM5706 1000Base-T" }, |
diff --git a/drivers/net/bnx2x.c b/drivers/net/bnx2x.c index 4a73c884d0c4..afc7f34b1dcf 100644 --- a/drivers/net/bnx2x.c +++ b/drivers/net/bnx2x.c | |||
@@ -70,7 +70,7 @@ | |||
70 | /* Time in jiffies before concluding the transmitter is hung. */ | 70 | /* Time in jiffies before concluding the transmitter is hung. */ |
71 | #define TX_TIMEOUT (5*HZ) | 71 | #define TX_TIMEOUT (5*HZ) |
72 | 72 | ||
73 | static const char version[] __devinitdata = | 73 | static char version[] __devinitdata = |
74 | "Broadcom NetXtreme II 577xx 10Gigabit Ethernet Driver " | 74 | "Broadcom NetXtreme II 577xx 10Gigabit Ethernet Driver " |
75 | DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 75 | DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
76 | 76 | ||
@@ -107,7 +107,7 @@ enum bnx2x_board_type { | |||
107 | }; | 107 | }; |
108 | 108 | ||
109 | /* indexed by board_t, above */ | 109 | /* indexed by board_t, above */ |
110 | static const struct { | 110 | static struct { |
111 | char *name; | 111 | char *name; |
112 | } board_info[] __devinitdata = { | 112 | } board_info[] __devinitdata = { |
113 | { "Broadcom NetXtreme II BCM57710 XGb" } | 113 | { "Broadcom NetXtreme II BCM57710 XGb" } |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 0a3e60418e53..385f69c14387 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -127,7 +127,7 @@ static int full_duplex[MAX_UNITS]; | |||
127 | #define NATSEMI_RX_LIMIT 2046 /* maximum supported by hardware */ | 127 | #define NATSEMI_RX_LIMIT 2046 /* maximum supported by hardware */ |
128 | 128 | ||
129 | /* These identify the driver base version and may not be removed. */ | 129 | /* These identify the driver base version and may not be removed. */ |
130 | static const char version[] __devinitdata = | 130 | static char version[] __devinitdata = |
131 | KERN_INFO DRV_NAME " dp8381x driver, version " | 131 | KERN_INFO DRV_NAME " dp8381x driver, version " |
132 | DRV_VERSION ", " DRV_RELDATE "\n" | 132 | DRV_VERSION ", " DRV_RELDATE "\n" |
133 | KERN_INFO " originally by Donald Becker <becker@scyld.com>\n" | 133 | KERN_INFO " originally by Donald Becker <becker@scyld.com>\n" |
@@ -238,7 +238,7 @@ enum { | |||
238 | }; | 238 | }; |
239 | 239 | ||
240 | /* array of board data directly indexed by pci_tbl[x].driver_data */ | 240 | /* array of board data directly indexed by pci_tbl[x].driver_data */ |
241 | static const struct { | 241 | static struct { |
242 | const char *name; | 242 | const char *name; |
243 | unsigned long flags; | 243 | unsigned long flags; |
244 | unsigned int eeprom_size; | 244 | unsigned int eeprom_size; |
@@ -247,7 +247,7 @@ static const struct { | |||
247 | { "NatSemi DP8381[56]", 0, 24 }, | 247 | { "NatSemi DP8381[56]", 0, 24 }, |
248 | }; | 248 | }; |
249 | 249 | ||
250 | static const struct pci_device_id natsemi_pci_tbl[] __devinitdata = { | 250 | static struct pci_device_id natsemi_pci_tbl[] __devinitdata = { |
251 | { PCI_VENDOR_ID_NS, 0x0020, 0x12d9, 0x000c, 0, 0, 0 }, | 251 | { PCI_VENDOR_ID_NS, 0x0020, 0x12d9, 0x000c, 0, 0, 0 }, |
252 | { PCI_VENDOR_ID_NS, 0x0020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, | 252 | { PCI_VENDOR_ID_NS, 0x0020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, |
253 | { } /* terminate list */ | 253 | { } /* terminate list */ |
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 5aa0a8089694..e0b072d9fdb7 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -2289,10 +2289,12 @@ static void pppol2tp_seq_tunnel_show(struct seq_file *m, void *v) | |||
2289 | atomic_read(&tunnel->ref_count) - 1); | 2289 | atomic_read(&tunnel->ref_count) - 1); |
2290 | seq_printf(m, " %08x %llu/%llu/%llu %llu/%llu/%llu\n", | 2290 | seq_printf(m, " %08x %llu/%llu/%llu %llu/%llu/%llu\n", |
2291 | tunnel->debug, | 2291 | tunnel->debug, |
2292 | tunnel->stats.tx_packets, tunnel->stats.tx_bytes, | 2292 | (unsigned long long)tunnel->stats.tx_packets, |
2293 | tunnel->stats.tx_errors, | 2293 | (unsigned long long)tunnel->stats.tx_bytes, |
2294 | tunnel->stats.rx_packets, tunnel->stats.rx_bytes, | 2294 | (unsigned long long)tunnel->stats.tx_errors, |
2295 | tunnel->stats.rx_errors); | 2295 | (unsigned long long)tunnel->stats.rx_packets, |
2296 | (unsigned long long)tunnel->stats.rx_bytes, | ||
2297 | (unsigned long long)tunnel->stats.rx_errors); | ||
2296 | } | 2298 | } |
2297 | 2299 | ||
2298 | static void pppol2tp_seq_session_show(struct seq_file *m, void *v) | 2300 | static void pppol2tp_seq_session_show(struct seq_file *m, void *v) |
@@ -2320,12 +2322,12 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) | |||
2320 | jiffies_to_msecs(session->reorder_timeout)); | 2322 | jiffies_to_msecs(session->reorder_timeout)); |
2321 | seq_printf(m, " %hu/%hu %llu/%llu/%llu %llu/%llu/%llu\n", | 2323 | seq_printf(m, " %hu/%hu %llu/%llu/%llu %llu/%llu/%llu\n", |
2322 | session->nr, session->ns, | 2324 | session->nr, session->ns, |
2323 | session->stats.tx_packets, | 2325 | (unsigned long long)session->stats.tx_packets, |
2324 | session->stats.tx_bytes, | 2326 | (unsigned long long)session->stats.tx_bytes, |
2325 | session->stats.tx_errors, | 2327 | (unsigned long long)session->stats.tx_errors, |
2326 | session->stats.rx_packets, | 2328 | (unsigned long long)session->stats.rx_packets, |
2327 | session->stats.rx_bytes, | 2329 | (unsigned long long)session->stats.rx_bytes, |
2328 | session->stats.rx_errors); | 2330 | (unsigned long long)session->stats.rx_errors); |
2329 | } | 2331 | } |
2330 | 2332 | ||
2331 | static int pppol2tp_seq_show(struct seq_file *m, void *v) | 2333 | static int pppol2tp_seq_show(struct seq_file *m, void *v) |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 6e00dc857afa..c49214feae91 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -216,7 +216,7 @@ do { \ | |||
216 | 216 | ||
217 | 217 | ||
218 | /* These identify the driver base version and may not be removed. */ | 218 | /* These identify the driver base version and may not be removed. */ |
219 | static const char version[] __devinitdata = | 219 | static char version[] = |
220 | KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" | 220 | KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" |
221 | KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; | 221 | KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; |
222 | 222 | ||
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index f50cb520dffb..333961bb7873 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -134,7 +134,7 @@ static const int multicast_filter_limit = 32; | |||
134 | #include "typhoon.h" | 134 | #include "typhoon.h" |
135 | #include "typhoon-firmware.h" | 135 | #include "typhoon-firmware.h" |
136 | 136 | ||
137 | static const char version[] __devinitdata = | 137 | static char version[] __devinitdata = |
138 | "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 138 | "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
139 | 139 | ||
140 | MODULE_AUTHOR("David Dillow <dave@thedillows.org>"); | 140 | MODULE_AUTHOR("David Dillow <dave@thedillows.org>"); |
@@ -178,7 +178,7 @@ enum typhoon_cards { | |||
178 | }; | 178 | }; |
179 | 179 | ||
180 | /* directly indexed by enum typhoon_cards, above */ | 180 | /* directly indexed by enum typhoon_cards, above */ |
181 | static const struct typhoon_card_info typhoon_card_info[] __devinitdata = { | 181 | static struct typhoon_card_info typhoon_card_info[] __devinitdata = { |
182 | { "3Com Typhoon (3C990-TX)", | 182 | { "3Com Typhoon (3C990-TX)", |
183 | TYPHOON_CRYPTO_NONE}, | 183 | TYPHOON_CRYPTO_NONE}, |
184 | { "3Com Typhoon (3CR990-TX-95)", | 184 | { "3Com Typhoon (3CR990-TX-95)", |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 8c9fb824cbd4..cc0addb5640c 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -440,7 +440,7 @@ static void velocity_unregister_notifier(void) | |||
440 | * Internal board variants. At the moment we have only one | 440 | * Internal board variants. At the moment we have only one |
441 | */ | 441 | */ |
442 | 442 | ||
443 | static const struct velocity_info_tbl chip_info_table[] __devinitdata = { | 443 | static struct velocity_info_tbl chip_info_table[] = { |
444 | {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 1, 0x00FFFFFFUL}, | 444 | {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 1, 0x00FFFFFFUL}, |
445 | { } | 445 | { } |
446 | }; | 446 | }; |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 5e2d763c6b5f..0f8aca8a4d43 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -554,7 +554,6 @@ static void x25_asy_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
554 | static int x25_asy_open_tty(struct tty_struct *tty) | 554 | static int x25_asy_open_tty(struct tty_struct *tty) |
555 | { | 555 | { |
556 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; | 556 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; |
557 | struct tty_ldisc *ld; | ||
558 | int err; | 557 | int err; |
559 | 558 | ||
560 | /* First make sure we're not already connected. */ | 559 | /* First make sure we're not already connected. */ |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 519b4ff79f7f..8b22281b087f 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -38,6 +38,7 @@ config PCMCIA_DEBUG | |||
38 | config PCMCIA | 38 | config PCMCIA |
39 | tristate "16-bit PCMCIA support" | 39 | tristate "16-bit PCMCIA support" |
40 | select CRC32 | 40 | select CRC32 |
41 | select HAVE_IDE | ||
41 | default y | 42 | default y |
42 | ---help--- | 43 | ---help--- |
43 | This option enables support for 16-bit PCMCIA cards. Most older | 44 | This option enables support for 16-bit PCMCIA cards. Most older |
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index a64626a82d0b..b35f9bfa2af4 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c | |||
@@ -71,7 +71,6 @@ static int read_regs(struct device *dev, unsigned char *regs, int no_regs) | |||
71 | 71 | ||
72 | static int r9701_get_datetime(struct device *dev, struct rtc_time *dt) | 72 | static int r9701_get_datetime(struct device *dev, struct rtc_time *dt) |
73 | { | 73 | { |
74 | unsigned long time; | ||
75 | int ret; | 74 | int ret; |
76 | unsigned char buf[] = { RSECCNT, RMINCNT, RHRCNT, | 75 | unsigned char buf[] = { RSECCNT, RMINCNT, RHRCNT, |
77 | RDAYCNT, RMONCNT, RYRCNT }; | 76 | RDAYCNT, RMONCNT, RYRCNT }; |
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 68071622d4bb..f47f4a768be5 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * SCLP VT220 terminal driver. | 3 | * SCLP VT220 terminal driver. |
4 | * | 4 | * |
5 | * S390 version | 5 | * S390 version |
6 | * Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation | 6 | * Copyright IBM Corp. 2003,2008 |
7 | * Author(s): Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com> | 7 | * Author(s): Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com> |
8 | */ | 8 | */ |
9 | 9 | ||
@@ -632,6 +632,9 @@ static void __init __sclp_vt220_cleanup(void) | |||
632 | else | 632 | else |
633 | free_bootmem((unsigned long) page, PAGE_SIZE); | 633 | free_bootmem((unsigned long) page, PAGE_SIZE); |
634 | } | 634 | } |
635 | if (!list_empty(&sclp_vt220_register.list)) | ||
636 | sclp_unregister(&sclp_vt220_register); | ||
637 | sclp_vt220_initialized = 0; | ||
635 | } | 638 | } |
636 | 639 | ||
637 | static int __init __sclp_vt220_init(void) | 640 | static int __init __sclp_vt220_init(void) |
@@ -639,6 +642,7 @@ static int __init __sclp_vt220_init(void) | |||
639 | void *page; | 642 | void *page; |
640 | int i; | 643 | int i; |
641 | int num_pages; | 644 | int num_pages; |
645 | int rc; | ||
642 | 646 | ||
643 | if (sclp_vt220_initialized) | 647 | if (sclp_vt220_initialized) |
644 | return 0; | 648 | return 0; |
@@ -667,7 +671,14 @@ static int __init __sclp_vt220_init(void) | |||
667 | } | 671 | } |
668 | list_add_tail((struct list_head *) page, &sclp_vt220_empty); | 672 | list_add_tail((struct list_head *) page, &sclp_vt220_empty); |
669 | } | 673 | } |
670 | return 0; | 674 | rc = sclp_register(&sclp_vt220_register); |
675 | if (rc) { | ||
676 | printk(KERN_ERR SCLP_VT220_PRINT_HEADER | ||
677 | "could not register vt220 - " | ||
678 | "sclp_register returned %d\n", rc); | ||
679 | __sclp_vt220_cleanup(); | ||
680 | } | ||
681 | return rc; | ||
671 | } | 682 | } |
672 | 683 | ||
673 | static const struct tty_operations sclp_vt220_ops = { | 684 | static const struct tty_operations sclp_vt220_ops = { |
@@ -688,22 +699,17 @@ static int __init sclp_vt220_tty_init(void) | |||
688 | { | 699 | { |
689 | struct tty_driver *driver; | 700 | struct tty_driver *driver; |
690 | int rc; | 701 | int rc; |
702 | int cleanup; | ||
691 | 703 | ||
692 | /* Note: we're not testing for CONSOLE_IS_SCLP here to preserve | 704 | /* Note: we're not testing for CONSOLE_IS_SCLP here to preserve |
693 | * symmetry between VM and LPAR systems regarding ttyS1. */ | 705 | * symmetry between VM and LPAR systems regarding ttyS1. */ |
694 | driver = alloc_tty_driver(1); | 706 | driver = alloc_tty_driver(1); |
695 | if (!driver) | 707 | if (!driver) |
696 | return -ENOMEM; | 708 | return -ENOMEM; |
709 | cleanup = !sclp_vt220_initialized; | ||
697 | rc = __sclp_vt220_init(); | 710 | rc = __sclp_vt220_init(); |
698 | if (rc) | 711 | if (rc) |
699 | goto out_driver; | 712 | goto out_driver; |
700 | rc = sclp_register(&sclp_vt220_register); | ||
701 | if (rc) { | ||
702 | printk(KERN_ERR SCLP_VT220_PRINT_HEADER | ||
703 | "could not register tty - " | ||
704 | "sclp_register returned %d\n", rc); | ||
705 | goto out_init; | ||
706 | } | ||
707 | 713 | ||
708 | driver->owner = THIS_MODULE; | 714 | driver->owner = THIS_MODULE; |
709 | driver->driver_name = SCLP_VT220_DRIVER_NAME; | 715 | driver->driver_name = SCLP_VT220_DRIVER_NAME; |
@@ -721,15 +727,14 @@ static int __init sclp_vt220_tty_init(void) | |||
721 | printk(KERN_ERR SCLP_VT220_PRINT_HEADER | 727 | printk(KERN_ERR SCLP_VT220_PRINT_HEADER |
722 | "could not register tty - " | 728 | "could not register tty - " |
723 | "tty_register_driver returned %d\n", rc); | 729 | "tty_register_driver returned %d\n", rc); |
724 | goto out_sclp; | 730 | goto out_init; |
725 | } | 731 | } |
726 | sclp_vt220_driver = driver; | 732 | sclp_vt220_driver = driver; |
727 | return 0; | 733 | return 0; |
728 | 734 | ||
729 | out_sclp: | ||
730 | sclp_unregister(&sclp_vt220_register); | ||
731 | out_init: | 735 | out_init: |
732 | __sclp_vt220_cleanup(); | 736 | if (cleanup) |
737 | __sclp_vt220_cleanup(); | ||
733 | out_driver: | 738 | out_driver: |
734 | put_tty_driver(driver); | 739 | put_tty_driver(driver); |
735 | return rc; | 740 | return rc; |
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index e2a781b6b21d..097fc0967e9d 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -3189,13 +3189,11 @@ qdio_establish(struct qdio_initialize *init_data) | |||
3189 | spin_lock_irqsave(get_ccwdev_lock(cdev),saveflags); | 3189 | spin_lock_irqsave(get_ccwdev_lock(cdev),saveflags); |
3190 | 3190 | ||
3191 | ccw_device_set_options_mask(cdev, 0); | 3191 | ccw_device_set_options_mask(cdev, 0); |
3192 | result=ccw_device_start_timeout(cdev,&irq_ptr->ccw, | 3192 | result = ccw_device_start(cdev, &irq_ptr->ccw, |
3193 | QDIO_DOING_ESTABLISH,0, 0, | 3193 | QDIO_DOING_ESTABLISH, 0, 0); |
3194 | QDIO_ESTABLISH_TIMEOUT); | ||
3195 | if (result) { | 3194 | if (result) { |
3196 | result2=ccw_device_start_timeout(cdev,&irq_ptr->ccw, | 3195 | result2 = ccw_device_start(cdev, &irq_ptr->ccw, |
3197 | QDIO_DOING_ESTABLISH,0,0, | 3196 | QDIO_DOING_ESTABLISH, 0, 0); |
3198 | QDIO_ESTABLISH_TIMEOUT); | ||
3199 | sprintf(dbf_text,"eq:io%4x",result); | 3197 | sprintf(dbf_text,"eq:io%4x",result); |
3200 | QDIO_DBF_TEXT2(1,setup,dbf_text); | 3198 | QDIO_DBF_TEXT2(1,setup,dbf_text); |
3201 | if (result2) { | 3199 | if (result2) { |
@@ -3219,10 +3217,10 @@ qdio_establish(struct qdio_initialize *init_data) | |||
3219 | return result; | 3217 | return result; |
3220 | } | 3218 | } |
3221 | 3219 | ||
3222 | /* Timeout is cared for already by using ccw_device_start_timeout(). */ | 3220 | wait_event_interruptible_timeout(cdev->private->wait_q, |
3223 | wait_event_interruptible(cdev->private->wait_q, | 3221 | irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED || |
3224 | irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED || | 3222 | irq_ptr->state == QDIO_IRQ_STATE_ERR, |
3225 | irq_ptr->state == QDIO_IRQ_STATE_ERR); | 3223 | QDIO_ESTABLISH_TIMEOUT); |
3226 | 3224 | ||
3227 | if (irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED) | 3225 | if (irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED) |
3228 | result = 0; | 3226 | result = 0; |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 67aaff3e668d..d0c6fd3b1c19 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -61,9 +61,9 @@ module_param_named(domain, ap_domain_index, int, 0000); | |||
61 | MODULE_PARM_DESC(domain, "domain index for ap devices"); | 61 | MODULE_PARM_DESC(domain, "domain index for ap devices"); |
62 | EXPORT_SYMBOL(ap_domain_index); | 62 | EXPORT_SYMBOL(ap_domain_index); |
63 | 63 | ||
64 | static int ap_thread_flag = 1; | 64 | static int ap_thread_flag = 0; |
65 | module_param_named(poll_thread, ap_thread_flag, int, 0000); | 65 | module_param_named(poll_thread, ap_thread_flag, int, 0000); |
66 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 1 (on)."); | 66 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 0 (off)."); |
67 | 67 | ||
68 | static struct device *ap_root_device = NULL; | 68 | static struct device *ap_root_device = NULL; |
69 | static DEFINE_SPINLOCK(ap_device_lock); | 69 | static DEFINE_SPINLOCK(ap_device_lock); |
diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile index 4c549540a35d..741d81861d17 100644 --- a/drivers/scsi/aic7xxx/Makefile +++ b/drivers/scsi/aic7xxx/Makefile | |||
@@ -44,8 +44,8 @@ clean-files += aic79xx_seq.h aic79xx_reg.h aic79xx_reg_print.c | |||
44 | 44 | ||
45 | # Dependencies for generated files need to be listed explicitly | 45 | # Dependencies for generated files need to be listed explicitly |
46 | 46 | ||
47 | $(addprefix $(src)/,$(aic7xxx-y:.o=.c)): $(obj)/aic7xxx_seq.h $(obj)/aic7xxx_reg.h | 47 | $(addprefix $(obj)/,$(aic7xxx-y)): $(obj)/aic7xxx_seq.h $(obj)/aic7xxx_reg.h |
48 | $(addprefix $(src)/,$(aic79xx-y:.o=.c)): $(obj)/aic79xx_seq.h $(obj)/aic79xx_reg.h | 48 | $(addprefix $(obj)/,$(aic79xx-y)): $(obj)/aic79xx_seq.h $(obj)/aic79xx_reg.h |
49 | 49 | ||
50 | aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_reg.h | 50 | aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_reg.h |
51 | aic7xxx-gen-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) += $(obj)/aic7xxx_reg_print.c | 51 | aic7xxx-gen-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) += $(obj)/aic7xxx_reg_print.c |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f4e387452246..7dd9b50d5ebc 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -892,7 +892,16 @@ out: | |||
892 | return err; | 892 | return err; |
893 | } | 893 | } |
894 | 894 | ||
895 | #define DIO_CREDITS (EXT4_RESERVE_TRANS_BLOCKS + 32) | 895 | /* Maximum number of blocks we map for direct IO at once. */ |
896 | #define DIO_MAX_BLOCKS 4096 | ||
897 | /* | ||
898 | * Number of credits we need for writing DIO_MAX_BLOCKS: | ||
899 | * We need sb + group descriptor + bitmap + inode -> 4 | ||
900 | * For B blocks with A block pointers per block we need: | ||
901 | * 1 (triple ind.) + (B/A/A + 2) (doubly ind.) + (B/A + 2) (indirect). | ||
902 | * If we plug in 4096 for B and 256 for A (for 1KB block size), we get 25. | ||
903 | */ | ||
904 | #define DIO_CREDITS 25 | ||
896 | 905 | ||
897 | int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, | 906 | int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, |
898 | unsigned long max_blocks, struct buffer_head *bh, | 907 | unsigned long max_blocks, struct buffer_head *bh, |
@@ -939,49 +948,31 @@ static int ext4_get_block(struct inode *inode, sector_t iblock, | |||
939 | struct buffer_head *bh_result, int create) | 948 | struct buffer_head *bh_result, int create) |
940 | { | 949 | { |
941 | handle_t *handle = ext4_journal_current_handle(); | 950 | handle_t *handle = ext4_journal_current_handle(); |
942 | int ret = 0; | 951 | int ret = 0, started = 0; |
943 | unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; | 952 | unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; |
944 | 953 | ||
945 | if (!create) | 954 | if (create && !handle) { |
946 | goto get_block; /* A read */ | 955 | /* Direct IO write... */ |
947 | 956 | if (max_blocks > DIO_MAX_BLOCKS) | |
948 | if (max_blocks == 1) | 957 | max_blocks = DIO_MAX_BLOCKS; |
949 | goto get_block; /* A single block get */ | 958 | handle = ext4_journal_start(inode, DIO_CREDITS + |
950 | 959 | 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb)); | |
951 | if (handle->h_transaction->t_state == T_LOCKED) { | 960 | if (IS_ERR(handle)) { |
952 | /* | ||
953 | * Huge direct-io writes can hold off commits for long | ||
954 | * periods of time. Let this commit run. | ||
955 | */ | ||
956 | ext4_journal_stop(handle); | ||
957 | handle = ext4_journal_start(inode, DIO_CREDITS); | ||
958 | if (IS_ERR(handle)) | ||
959 | ret = PTR_ERR(handle); | 961 | ret = PTR_ERR(handle); |
960 | goto get_block; | 962 | goto out; |
961 | } | ||
962 | |||
963 | if (handle->h_buffer_credits <= EXT4_RESERVE_TRANS_BLOCKS) { | ||
964 | /* | ||
965 | * Getting low on buffer credits... | ||
966 | */ | ||
967 | ret = ext4_journal_extend(handle, DIO_CREDITS); | ||
968 | if (ret > 0) { | ||
969 | /* | ||
970 | * Couldn't extend the transaction. Start a new one. | ||
971 | */ | ||
972 | ret = ext4_journal_restart(handle, DIO_CREDITS); | ||
973 | } | 963 | } |
964 | started = 1; | ||
974 | } | 965 | } |
975 | 966 | ||
976 | get_block: | 967 | ret = ext4_get_blocks_wrap(handle, inode, iblock, |
977 | if (ret == 0) { | ||
978 | ret = ext4_get_blocks_wrap(handle, inode, iblock, | ||
979 | max_blocks, bh_result, create, 0); | 968 | max_blocks, bh_result, create, 0); |
980 | if (ret > 0) { | 969 | if (ret > 0) { |
981 | bh_result->b_size = (ret << inode->i_blkbits); | 970 | bh_result->b_size = (ret << inode->i_blkbits); |
982 | ret = 0; | 971 | ret = 0; |
983 | } | ||
984 | } | 972 | } |
973 | if (started) | ||
974 | ext4_journal_stop(handle); | ||
975 | out: | ||
985 | return ret; | 976 | return ret; |
986 | } | 977 | } |
987 | 978 | ||
@@ -1671,7 +1662,8 @@ static int ext4_releasepage(struct page *page, gfp_t wait) | |||
1671 | * if the machine crashes during the write. | 1662 | * if the machine crashes during the write. |
1672 | * | 1663 | * |
1673 | * If the O_DIRECT write is intantiating holes inside i_size and the machine | 1664 | * If the O_DIRECT write is intantiating holes inside i_size and the machine |
1674 | * crashes then stale disk data _may_ be exposed inside the file. | 1665 | * crashes then stale disk data _may_ be exposed inside the file. But current |
1666 | * VFS code falls back into buffered path in that case so we are safe. | ||
1675 | */ | 1667 | */ |
1676 | static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb, | 1668 | static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb, |
1677 | const struct iovec *iov, loff_t offset, | 1669 | const struct iovec *iov, loff_t offset, |
@@ -1680,7 +1672,7 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb, | |||
1680 | struct file *file = iocb->ki_filp; | 1672 | struct file *file = iocb->ki_filp; |
1681 | struct inode *inode = file->f_mapping->host; | 1673 | struct inode *inode = file->f_mapping->host; |
1682 | struct ext4_inode_info *ei = EXT4_I(inode); | 1674 | struct ext4_inode_info *ei = EXT4_I(inode); |
1683 | handle_t *handle = NULL; | 1675 | handle_t *handle; |
1684 | ssize_t ret; | 1676 | ssize_t ret; |
1685 | int orphan = 0; | 1677 | int orphan = 0; |
1686 | size_t count = iov_length(iov, nr_segs); | 1678 | size_t count = iov_length(iov, nr_segs); |
@@ -1688,17 +1680,21 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb, | |||
1688 | if (rw == WRITE) { | 1680 | if (rw == WRITE) { |
1689 | loff_t final_size = offset + count; | 1681 | loff_t final_size = offset + count; |
1690 | 1682 | ||
1691 | handle = ext4_journal_start(inode, DIO_CREDITS); | ||
1692 | if (IS_ERR(handle)) { | ||
1693 | ret = PTR_ERR(handle); | ||
1694 | goto out; | ||
1695 | } | ||
1696 | if (final_size > inode->i_size) { | 1683 | if (final_size > inode->i_size) { |
1684 | /* Credits for sb + inode write */ | ||
1685 | handle = ext4_journal_start(inode, 2); | ||
1686 | if (IS_ERR(handle)) { | ||
1687 | ret = PTR_ERR(handle); | ||
1688 | goto out; | ||
1689 | } | ||
1697 | ret = ext4_orphan_add(handle, inode); | 1690 | ret = ext4_orphan_add(handle, inode); |
1698 | if (ret) | 1691 | if (ret) { |
1699 | goto out_stop; | 1692 | ext4_journal_stop(handle); |
1693 | goto out; | ||
1694 | } | ||
1700 | orphan = 1; | 1695 | orphan = 1; |
1701 | ei->i_disksize = inode->i_size; | 1696 | ei->i_disksize = inode->i_size; |
1697 | ext4_journal_stop(handle); | ||
1702 | } | 1698 | } |
1703 | } | 1699 | } |
1704 | 1700 | ||
@@ -1706,18 +1702,21 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb, | |||
1706 | offset, nr_segs, | 1702 | offset, nr_segs, |
1707 | ext4_get_block, NULL); | 1703 | ext4_get_block, NULL); |
1708 | 1704 | ||
1709 | /* | 1705 | if (orphan) { |
1710 | * Reacquire the handle: ext4_get_block() can restart the transaction | ||
1711 | */ | ||
1712 | handle = ext4_journal_current_handle(); | ||
1713 | |||
1714 | out_stop: | ||
1715 | if (handle) { | ||
1716 | int err; | 1706 | int err; |
1717 | 1707 | ||
1718 | if (orphan && inode->i_nlink) | 1708 | /* Credits for sb + inode write */ |
1709 | handle = ext4_journal_start(inode, 2); | ||
1710 | if (IS_ERR(handle)) { | ||
1711 | /* This is really bad luck. We've written the data | ||
1712 | * but cannot extend i_size. Bail out and pretend | ||
1713 | * the write failed... */ | ||
1714 | ret = PTR_ERR(handle); | ||
1715 | goto out; | ||
1716 | } | ||
1717 | if (inode->i_nlink) | ||
1719 | ext4_orphan_del(handle, inode); | 1718 | ext4_orphan_del(handle, inode); |
1720 | if (orphan && ret > 0) { | 1719 | if (ret > 0) { |
1721 | loff_t end = offset + ret; | 1720 | loff_t end = offset + ret; |
1722 | if (end > inode->i_size) { | 1721 | if (end > inode->i_size) { |
1723 | ei->i_disksize = end; | 1722 | ei->i_disksize = end; |
@@ -2758,13 +2757,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
2758 | ei->i_data[block] = raw_inode->i_block[block]; | 2757 | ei->i_data[block] = raw_inode->i_block[block]; |
2759 | INIT_LIST_HEAD(&ei->i_orphan); | 2758 | INIT_LIST_HEAD(&ei->i_orphan); |
2760 | 2759 | ||
2761 | if (inode->i_ino >= EXT4_FIRST_INO(inode->i_sb) + 1 && | 2760 | if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) { |
2762 | EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) { | ||
2763 | /* | ||
2764 | * When mke2fs creates big inodes it does not zero out | ||
2765 | * the unused bytes above EXT4_GOOD_OLD_INODE_SIZE, | ||
2766 | * so ignore those first few inodes. | ||
2767 | */ | ||
2768 | ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); | 2761 | ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); |
2769 | if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > | 2762 | if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > |
2770 | EXT4_INODE_SIZE(inode->i_sb)) { | 2763 | EXT4_INODE_SIZE(inode->i_sb)) { |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 76e5fedc0a0b..dd0fcfcb35ce 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -420,6 +420,7 @@ | |||
420 | #define MB_DEFAULT_GROUP_PREALLOC 512 | 420 | #define MB_DEFAULT_GROUP_PREALLOC 512 |
421 | 421 | ||
422 | static struct kmem_cache *ext4_pspace_cachep; | 422 | static struct kmem_cache *ext4_pspace_cachep; |
423 | static struct kmem_cache *ext4_ac_cachep; | ||
423 | 424 | ||
424 | #ifdef EXT4_BB_MAX_BLOCKS | 425 | #ifdef EXT4_BB_MAX_BLOCKS |
425 | #undef EXT4_BB_MAX_BLOCKS | 426 | #undef EXT4_BB_MAX_BLOCKS |
@@ -680,7 +681,6 @@ static void *mb_find_buddy(struct ext4_buddy *e4b, int order, int *max) | |||
680 | { | 681 | { |
681 | char *bb; | 682 | char *bb; |
682 | 683 | ||
683 | /* FIXME!! is this needed */ | ||
684 | BUG_ON(EXT4_MB_BITMAP(e4b) == EXT4_MB_BUDDY(e4b)); | 684 | BUG_ON(EXT4_MB_BITMAP(e4b) == EXT4_MB_BUDDY(e4b)); |
685 | BUG_ON(max == NULL); | 685 | BUG_ON(max == NULL); |
686 | 686 | ||
@@ -964,7 +964,7 @@ static void ext4_mb_generate_buddy(struct super_block *sb, | |||
964 | grp->bb_fragments = fragments; | 964 | grp->bb_fragments = fragments; |
965 | 965 | ||
966 | if (free != grp->bb_free) { | 966 | if (free != grp->bb_free) { |
967 | printk(KERN_DEBUG | 967 | ext4_error(sb, __FUNCTION__, |
968 | "EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n", | 968 | "EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n", |
969 | group, free, grp->bb_free); | 969 | group, free, grp->bb_free); |
970 | grp->bb_free = free; | 970 | grp->bb_free = free; |
@@ -1821,13 +1821,24 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, | |||
1821 | i = ext4_find_next_zero_bit(bitmap, | 1821 | i = ext4_find_next_zero_bit(bitmap, |
1822 | EXT4_BLOCKS_PER_GROUP(sb), i); | 1822 | EXT4_BLOCKS_PER_GROUP(sb), i); |
1823 | if (i >= EXT4_BLOCKS_PER_GROUP(sb)) { | 1823 | if (i >= EXT4_BLOCKS_PER_GROUP(sb)) { |
1824 | BUG_ON(free != 0); | 1824 | /* |
1825 | * IF we corrupt the bitmap we won't find any | ||
1826 | * free blocks even though group info says we | ||
1827 | * we have free blocks | ||
1828 | */ | ||
1829 | ext4_error(sb, __FUNCTION__, "%d free blocks as per " | ||
1830 | "group info. But bitmap says 0\n", | ||
1831 | free); | ||
1825 | break; | 1832 | break; |
1826 | } | 1833 | } |
1827 | 1834 | ||
1828 | mb_find_extent(e4b, 0, i, ac->ac_g_ex.fe_len, &ex); | 1835 | mb_find_extent(e4b, 0, i, ac->ac_g_ex.fe_len, &ex); |
1829 | BUG_ON(ex.fe_len <= 0); | 1836 | BUG_ON(ex.fe_len <= 0); |
1830 | BUG_ON(free < ex.fe_len); | 1837 | if (free < ex.fe_len) { |
1838 | ext4_error(sb, __FUNCTION__, "%d free blocks as per " | ||
1839 | "group info. But got %d blocks\n", | ||
1840 | free, ex.fe_len); | ||
1841 | } | ||
1831 | 1842 | ||
1832 | ext4_mb_measure_extent(ac, &ex, e4b); | 1843 | ext4_mb_measure_extent(ac, &ex, e4b); |
1833 | 1844 | ||
@@ -2959,12 +2970,19 @@ int __init init_ext4_mballoc(void) | |||
2959 | if (ext4_pspace_cachep == NULL) | 2970 | if (ext4_pspace_cachep == NULL) |
2960 | return -ENOMEM; | 2971 | return -ENOMEM; |
2961 | 2972 | ||
2973 | ext4_ac_cachep = | ||
2974 | kmem_cache_create("ext4_alloc_context", | ||
2975 | sizeof(struct ext4_allocation_context), | ||
2976 | 0, SLAB_RECLAIM_ACCOUNT, NULL); | ||
2977 | if (ext4_ac_cachep == NULL) { | ||
2978 | kmem_cache_destroy(ext4_pspace_cachep); | ||
2979 | return -ENOMEM; | ||
2980 | } | ||
2962 | #ifdef CONFIG_PROC_FS | 2981 | #ifdef CONFIG_PROC_FS |
2963 | proc_root_ext4 = proc_mkdir(EXT4_ROOT, proc_root_fs); | 2982 | proc_root_ext4 = proc_mkdir(EXT4_ROOT, proc_root_fs); |
2964 | if (proc_root_ext4 == NULL) | 2983 | if (proc_root_ext4 == NULL) |
2965 | printk(KERN_ERR "EXT4-fs: Unable to create %s\n", EXT4_ROOT); | 2984 | printk(KERN_ERR "EXT4-fs: Unable to create %s\n", EXT4_ROOT); |
2966 | #endif | 2985 | #endif |
2967 | |||
2968 | return 0; | 2986 | return 0; |
2969 | } | 2987 | } |
2970 | 2988 | ||
@@ -2972,6 +2990,7 @@ void exit_ext4_mballoc(void) | |||
2972 | { | 2990 | { |
2973 | /* XXX: synchronize_rcu(); */ | 2991 | /* XXX: synchronize_rcu(); */ |
2974 | kmem_cache_destroy(ext4_pspace_cachep); | 2992 | kmem_cache_destroy(ext4_pspace_cachep); |
2993 | kmem_cache_destroy(ext4_ac_cachep); | ||
2975 | #ifdef CONFIG_PROC_FS | 2994 | #ifdef CONFIG_PROC_FS |
2976 | remove_proc_entry(EXT4_ROOT, proc_root_fs); | 2995 | remove_proc_entry(EXT4_ROOT, proc_root_fs); |
2977 | #endif | 2996 | #endif |
@@ -3069,7 +3088,7 @@ static int ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
3069 | 3088 | ||
3070 | out_err: | 3089 | out_err: |
3071 | sb->s_dirt = 1; | 3090 | sb->s_dirt = 1; |
3072 | put_bh(bitmap_bh); | 3091 | brelse(bitmap_bh); |
3073 | return err; | 3092 | return err; |
3074 | } | 3093 | } |
3075 | 3094 | ||
@@ -3354,13 +3373,10 @@ static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac, | |||
3354 | ac->ac_pa = pa; | 3373 | ac->ac_pa = pa; |
3355 | 3374 | ||
3356 | /* we don't correct pa_pstart or pa_plen here to avoid | 3375 | /* we don't correct pa_pstart or pa_plen here to avoid |
3357 | * possible race when tte group is being loaded concurrently | 3376 | * possible race when the group is being loaded concurrently |
3358 | * instead we correct pa later, after blocks are marked | 3377 | * instead we correct pa later, after blocks are marked |
3359 | * in on-disk bitmap -- see ext4_mb_release_context() */ | 3378 | * in on-disk bitmap -- see ext4_mb_release_context() |
3360 | /* | 3379 | * Other CPUs are prevented from allocating from this pa by lg_mutex |
3361 | * FIXME!! but the other CPUs can look at this particular | ||
3362 | * pa and think that it have enought free blocks if we | ||
3363 | * don't update pa_free here right ? | ||
3364 | */ | 3380 | */ |
3365 | mb_debug("use %u/%u from group pa %p\n", pa->pa_lstart-len, len, pa); | 3381 | mb_debug("use %u/%u from group pa %p\n", pa->pa_lstart-len, len, pa); |
3366 | } | 3382 | } |
@@ -3699,7 +3715,7 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, | |||
3699 | struct buffer_head *bitmap_bh, | 3715 | struct buffer_head *bitmap_bh, |
3700 | struct ext4_prealloc_space *pa) | 3716 | struct ext4_prealloc_space *pa) |
3701 | { | 3717 | { |
3702 | struct ext4_allocation_context ac; | 3718 | struct ext4_allocation_context *ac; |
3703 | struct super_block *sb = e4b->bd_sb; | 3719 | struct super_block *sb = e4b->bd_sb; |
3704 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 3720 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
3705 | unsigned long end; | 3721 | unsigned long end; |
@@ -3715,9 +3731,13 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, | |||
3715 | BUG_ON(group != e4b->bd_group && pa->pa_len != 0); | 3731 | BUG_ON(group != e4b->bd_group && pa->pa_len != 0); |
3716 | end = bit + pa->pa_len; | 3732 | end = bit + pa->pa_len; |
3717 | 3733 | ||
3718 | ac.ac_sb = sb; | 3734 | ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS); |
3719 | ac.ac_inode = pa->pa_inode; | 3735 | |
3720 | ac.ac_op = EXT4_MB_HISTORY_DISCARD; | 3736 | if (ac) { |
3737 | ac->ac_sb = sb; | ||
3738 | ac->ac_inode = pa->pa_inode; | ||
3739 | ac->ac_op = EXT4_MB_HISTORY_DISCARD; | ||
3740 | } | ||
3721 | 3741 | ||
3722 | while (bit < end) { | 3742 | while (bit < end) { |
3723 | bit = ext4_find_next_zero_bit(bitmap_bh->b_data, end, bit); | 3743 | bit = ext4_find_next_zero_bit(bitmap_bh->b_data, end, bit); |
@@ -3733,24 +3753,28 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, | |||
3733 | (unsigned) group); | 3753 | (unsigned) group); |
3734 | free += next - bit; | 3754 | free += next - bit; |
3735 | 3755 | ||
3736 | ac.ac_b_ex.fe_group = group; | 3756 | if (ac) { |
3737 | ac.ac_b_ex.fe_start = bit; | 3757 | ac->ac_b_ex.fe_group = group; |
3738 | ac.ac_b_ex.fe_len = next - bit; | 3758 | ac->ac_b_ex.fe_start = bit; |
3739 | ac.ac_b_ex.fe_logical = 0; | 3759 | ac->ac_b_ex.fe_len = next - bit; |
3740 | ext4_mb_store_history(&ac); | 3760 | ac->ac_b_ex.fe_logical = 0; |
3761 | ext4_mb_store_history(ac); | ||
3762 | } | ||
3741 | 3763 | ||
3742 | mb_free_blocks(pa->pa_inode, e4b, bit, next - bit); | 3764 | mb_free_blocks(pa->pa_inode, e4b, bit, next - bit); |
3743 | bit = next + 1; | 3765 | bit = next + 1; |
3744 | } | 3766 | } |
3745 | if (free != pa->pa_free) { | 3767 | if (free != pa->pa_free) { |
3746 | printk(KERN_ERR "pa %p: logic %lu, phys. %lu, len %lu\n", | 3768 | printk(KERN_CRIT "pa %p: logic %lu, phys. %lu, len %lu\n", |
3747 | pa, (unsigned long) pa->pa_lstart, | 3769 | pa, (unsigned long) pa->pa_lstart, |
3748 | (unsigned long) pa->pa_pstart, | 3770 | (unsigned long) pa->pa_pstart, |
3749 | (unsigned long) pa->pa_len); | 3771 | (unsigned long) pa->pa_len); |
3750 | printk(KERN_ERR "free %u, pa_free %u\n", free, pa->pa_free); | 3772 | ext4_error(sb, __FUNCTION__, "free %u, pa_free %u\n", |
3773 | free, pa->pa_free); | ||
3751 | } | 3774 | } |
3752 | BUG_ON(free != pa->pa_free); | ||
3753 | atomic_add(free, &sbi->s_mb_discarded); | 3775 | atomic_add(free, &sbi->s_mb_discarded); |
3776 | if (ac) | ||
3777 | kmem_cache_free(ext4_ac_cachep, ac); | ||
3754 | 3778 | ||
3755 | return err; | 3779 | return err; |
3756 | } | 3780 | } |
@@ -3758,12 +3782,15 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, | |||
3758 | static int ext4_mb_release_group_pa(struct ext4_buddy *e4b, | 3782 | static int ext4_mb_release_group_pa(struct ext4_buddy *e4b, |
3759 | struct ext4_prealloc_space *pa) | 3783 | struct ext4_prealloc_space *pa) |
3760 | { | 3784 | { |
3761 | struct ext4_allocation_context ac; | 3785 | struct ext4_allocation_context *ac; |
3762 | struct super_block *sb = e4b->bd_sb; | 3786 | struct super_block *sb = e4b->bd_sb; |
3763 | ext4_group_t group; | 3787 | ext4_group_t group; |
3764 | ext4_grpblk_t bit; | 3788 | ext4_grpblk_t bit; |
3765 | 3789 | ||
3766 | ac.ac_op = EXT4_MB_HISTORY_DISCARD; | 3790 | ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS); |
3791 | |||
3792 | if (ac) | ||
3793 | ac->ac_op = EXT4_MB_HISTORY_DISCARD; | ||
3767 | 3794 | ||
3768 | BUG_ON(pa->pa_deleted == 0); | 3795 | BUG_ON(pa->pa_deleted == 0); |
3769 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit); | 3796 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit); |
@@ -3771,13 +3798,16 @@ static int ext4_mb_release_group_pa(struct ext4_buddy *e4b, | |||
3771 | mb_free_blocks(pa->pa_inode, e4b, bit, pa->pa_len); | 3798 | mb_free_blocks(pa->pa_inode, e4b, bit, pa->pa_len); |
3772 | atomic_add(pa->pa_len, &EXT4_SB(sb)->s_mb_discarded); | 3799 | atomic_add(pa->pa_len, &EXT4_SB(sb)->s_mb_discarded); |
3773 | 3800 | ||
3774 | ac.ac_sb = sb; | 3801 | if (ac) { |
3775 | ac.ac_inode = NULL; | 3802 | ac->ac_sb = sb; |
3776 | ac.ac_b_ex.fe_group = group; | 3803 | ac->ac_inode = NULL; |
3777 | ac.ac_b_ex.fe_start = bit; | 3804 | ac->ac_b_ex.fe_group = group; |
3778 | ac.ac_b_ex.fe_len = pa->pa_len; | 3805 | ac->ac_b_ex.fe_start = bit; |
3779 | ac.ac_b_ex.fe_logical = 0; | 3806 | ac->ac_b_ex.fe_len = pa->pa_len; |
3780 | ext4_mb_store_history(&ac); | 3807 | ac->ac_b_ex.fe_logical = 0; |
3808 | ext4_mb_store_history(ac); | ||
3809 | kmem_cache_free(ext4_ac_cachep, ac); | ||
3810 | } | ||
3781 | 3811 | ||
3782 | return 0; | 3812 | return 0; |
3783 | } | 3813 | } |
@@ -4231,7 +4261,7 @@ static int ext4_mb_discard_preallocations(struct super_block *sb, int needed) | |||
4231 | ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, | 4261 | ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, |
4232 | struct ext4_allocation_request *ar, int *errp) | 4262 | struct ext4_allocation_request *ar, int *errp) |
4233 | { | 4263 | { |
4234 | struct ext4_allocation_context ac; | 4264 | struct ext4_allocation_context *ac = NULL; |
4235 | struct ext4_sb_info *sbi; | 4265 | struct ext4_sb_info *sbi; |
4236 | struct super_block *sb; | 4266 | struct super_block *sb; |
4237 | ext4_fsblk_t block = 0; | 4267 | ext4_fsblk_t block = 0; |
@@ -4257,53 +4287,60 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, | |||
4257 | } | 4287 | } |
4258 | inquota = ar->len; | 4288 | inquota = ar->len; |
4259 | 4289 | ||
4290 | ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS); | ||
4291 | if (!ac) { | ||
4292 | *errp = -ENOMEM; | ||
4293 | return 0; | ||
4294 | } | ||
4295 | |||
4260 | ext4_mb_poll_new_transaction(sb, handle); | 4296 | ext4_mb_poll_new_transaction(sb, handle); |
4261 | 4297 | ||
4262 | *errp = ext4_mb_initialize_context(&ac, ar); | 4298 | *errp = ext4_mb_initialize_context(ac, ar); |
4263 | if (*errp) { | 4299 | if (*errp) { |
4264 | ar->len = 0; | 4300 | ar->len = 0; |
4265 | goto out; | 4301 | goto out; |
4266 | } | 4302 | } |
4267 | 4303 | ||
4268 | ac.ac_op = EXT4_MB_HISTORY_PREALLOC; | 4304 | ac->ac_op = EXT4_MB_HISTORY_PREALLOC; |
4269 | if (!ext4_mb_use_preallocated(&ac)) { | 4305 | if (!ext4_mb_use_preallocated(ac)) { |
4270 | 4306 | ||
4271 | ac.ac_op = EXT4_MB_HISTORY_ALLOC; | 4307 | ac->ac_op = EXT4_MB_HISTORY_ALLOC; |
4272 | ext4_mb_normalize_request(&ac, ar); | 4308 | ext4_mb_normalize_request(ac, ar); |
4273 | 4309 | ||
4274 | repeat: | 4310 | repeat: |
4275 | /* allocate space in core */ | 4311 | /* allocate space in core */ |
4276 | ext4_mb_regular_allocator(&ac); | 4312 | ext4_mb_regular_allocator(ac); |
4277 | 4313 | ||
4278 | /* as we've just preallocated more space than | 4314 | /* as we've just preallocated more space than |
4279 | * user requested orinally, we store allocated | 4315 | * user requested orinally, we store allocated |
4280 | * space in a special descriptor */ | 4316 | * space in a special descriptor */ |
4281 | if (ac.ac_status == AC_STATUS_FOUND && | 4317 | if (ac->ac_status == AC_STATUS_FOUND && |
4282 | ac.ac_o_ex.fe_len < ac.ac_b_ex.fe_len) | 4318 | ac->ac_o_ex.fe_len < ac->ac_b_ex.fe_len) |
4283 | ext4_mb_new_preallocation(&ac); | 4319 | ext4_mb_new_preallocation(ac); |
4284 | } | 4320 | } |
4285 | 4321 | ||
4286 | if (likely(ac.ac_status == AC_STATUS_FOUND)) { | 4322 | if (likely(ac->ac_status == AC_STATUS_FOUND)) { |
4287 | ext4_mb_mark_diskspace_used(&ac, handle); | 4323 | ext4_mb_mark_diskspace_used(ac, handle); |
4288 | *errp = 0; | 4324 | *errp = 0; |
4289 | block = ext4_grp_offs_to_block(sb, &ac.ac_b_ex); | 4325 | block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex); |
4290 | ar->len = ac.ac_b_ex.fe_len; | 4326 | ar->len = ac->ac_b_ex.fe_len; |
4291 | } else { | 4327 | } else { |
4292 | freed = ext4_mb_discard_preallocations(sb, ac.ac_o_ex.fe_len); | 4328 | freed = ext4_mb_discard_preallocations(sb, ac->ac_o_ex.fe_len); |
4293 | if (freed) | 4329 | if (freed) |
4294 | goto repeat; | 4330 | goto repeat; |
4295 | *errp = -ENOSPC; | 4331 | *errp = -ENOSPC; |
4296 | ac.ac_b_ex.fe_len = 0; | 4332 | ac->ac_b_ex.fe_len = 0; |
4297 | ar->len = 0; | 4333 | ar->len = 0; |
4298 | ext4_mb_show_ac(&ac); | 4334 | ext4_mb_show_ac(ac); |
4299 | } | 4335 | } |
4300 | 4336 | ||
4301 | ext4_mb_release_context(&ac); | 4337 | ext4_mb_release_context(ac); |
4302 | 4338 | ||
4303 | out: | 4339 | out: |
4304 | if (ar->len < inquota) | 4340 | if (ar->len < inquota) |
4305 | DQUOT_FREE_BLOCK(ar->inode, inquota - ar->len); | 4341 | DQUOT_FREE_BLOCK(ar->inode, inquota - ar->len); |
4306 | 4342 | ||
4343 | kmem_cache_free(ext4_ac_cachep, ac); | ||
4307 | return block; | 4344 | return block; |
4308 | } | 4345 | } |
4309 | static void ext4_mb_poll_new_transaction(struct super_block *sb, | 4346 | static void ext4_mb_poll_new_transaction(struct super_block *sb, |
@@ -4405,9 +4442,9 @@ void ext4_mb_free_blocks(handle_t *handle, struct inode *inode, | |||
4405 | unsigned long block, unsigned long count, | 4442 | unsigned long block, unsigned long count, |
4406 | int metadata, unsigned long *freed) | 4443 | int metadata, unsigned long *freed) |
4407 | { | 4444 | { |
4408 | struct buffer_head *bitmap_bh = 0; | 4445 | struct buffer_head *bitmap_bh = NULL; |
4409 | struct super_block *sb = inode->i_sb; | 4446 | struct super_block *sb = inode->i_sb; |
4410 | struct ext4_allocation_context ac; | 4447 | struct ext4_allocation_context *ac = NULL; |
4411 | struct ext4_group_desc *gdp; | 4448 | struct ext4_group_desc *gdp; |
4412 | struct ext4_super_block *es; | 4449 | struct ext4_super_block *es; |
4413 | unsigned long overflow; | 4450 | unsigned long overflow; |
@@ -4436,9 +4473,12 @@ void ext4_mb_free_blocks(handle_t *handle, struct inode *inode, | |||
4436 | 4473 | ||
4437 | ext4_debug("freeing block %lu\n", block); | 4474 | ext4_debug("freeing block %lu\n", block); |
4438 | 4475 | ||
4439 | ac.ac_op = EXT4_MB_HISTORY_FREE; | 4476 | ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS); |
4440 | ac.ac_inode = inode; | 4477 | if (ac) { |
4441 | ac.ac_sb = sb; | 4478 | ac->ac_op = EXT4_MB_HISTORY_FREE; |
4479 | ac->ac_inode = inode; | ||
4480 | ac->ac_sb = sb; | ||
4481 | } | ||
4442 | 4482 | ||
4443 | do_more: | 4483 | do_more: |
4444 | overflow = 0; | 4484 | overflow = 0; |
@@ -4504,10 +4544,12 @@ do_more: | |||
4504 | BUFFER_TRACE(bitmap_bh, "dirtied bitmap block"); | 4544 | BUFFER_TRACE(bitmap_bh, "dirtied bitmap block"); |
4505 | err = ext4_journal_dirty_metadata(handle, bitmap_bh); | 4545 | err = ext4_journal_dirty_metadata(handle, bitmap_bh); |
4506 | 4546 | ||
4507 | ac.ac_b_ex.fe_group = block_group; | 4547 | if (ac) { |
4508 | ac.ac_b_ex.fe_start = bit; | 4548 | ac->ac_b_ex.fe_group = block_group; |
4509 | ac.ac_b_ex.fe_len = count; | 4549 | ac->ac_b_ex.fe_start = bit; |
4510 | ext4_mb_store_history(&ac); | 4550 | ac->ac_b_ex.fe_len = count; |
4551 | ext4_mb_store_history(ac); | ||
4552 | } | ||
4511 | 4553 | ||
4512 | if (metadata) { | 4554 | if (metadata) { |
4513 | /* blocks being freed are metadata. these blocks shouldn't | 4555 | /* blocks being freed are metadata. these blocks shouldn't |
@@ -4548,5 +4590,7 @@ do_more: | |||
4548 | error_return: | 4590 | error_return: |
4549 | brelse(bitmap_bh); | 4591 | brelse(bitmap_bh); |
4550 | ext4_std_error(sb, err); | 4592 | ext4_std_error(sb, err); |
4593 | if (ac) | ||
4594 | kmem_cache_free(ext4_ac_cachep, ac); | ||
4551 | return; | 4595 | return; |
4552 | } | 4596 | } |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 3ebc2332f52e..8c6c685b9d22 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -61,10 +61,9 @@ static int finish_range(handle_t *handle, struct inode *inode, | |||
61 | retval = ext4_journal_restart(handle, needed); | 61 | retval = ext4_journal_restart(handle, needed); |
62 | if (retval) | 62 | if (retval) |
63 | goto err_out; | 63 | goto err_out; |
64 | } | 64 | } else if (needed) { |
65 | if (needed) { | ||
66 | retval = ext4_journal_extend(handle, needed); | 65 | retval = ext4_journal_extend(handle, needed); |
67 | if (retval != 0) { | 66 | if (retval) { |
68 | /* | 67 | /* |
69 | * IF not able to extend the journal restart the journal | 68 | * IF not able to extend the journal restart the journal |
70 | */ | 69 | */ |
@@ -220,6 +219,26 @@ static int update_tind_extent_range(handle_t *handle, struct inode *inode, | |||
220 | 219 | ||
221 | } | 220 | } |
222 | 221 | ||
222 | static int extend_credit_for_blkdel(handle_t *handle, struct inode *inode) | ||
223 | { | ||
224 | int retval = 0, needed; | ||
225 | |||
226 | if (handle->h_buffer_credits > EXT4_RESERVE_TRANS_BLOCKS) | ||
227 | return 0; | ||
228 | /* | ||
229 | * We are freeing a blocks. During this we touch | ||
230 | * superblock, group descriptor and block bitmap. | ||
231 | * So allocate a credit of 3. We may update | ||
232 | * quota (user and group). | ||
233 | */ | ||
234 | needed = 3 + 2*EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb); | ||
235 | |||
236 | if (ext4_journal_extend(handle, needed) != 0) | ||
237 | retval = ext4_journal_restart(handle, needed); | ||
238 | |||
239 | return retval; | ||
240 | } | ||
241 | |||
223 | static int free_dind_blocks(handle_t *handle, | 242 | static int free_dind_blocks(handle_t *handle, |
224 | struct inode *inode, __le32 i_data) | 243 | struct inode *inode, __le32 i_data) |
225 | { | 244 | { |
@@ -234,11 +253,14 @@ static int free_dind_blocks(handle_t *handle, | |||
234 | 253 | ||
235 | tmp_idata = (__le32 *)bh->b_data; | 254 | tmp_idata = (__le32 *)bh->b_data; |
236 | for (i = 0; i < max_entries; i++) { | 255 | for (i = 0; i < max_entries; i++) { |
237 | if (tmp_idata[i]) | 256 | if (tmp_idata[i]) { |
257 | extend_credit_for_blkdel(handle, inode); | ||
238 | ext4_free_blocks(handle, inode, | 258 | ext4_free_blocks(handle, inode, |
239 | le32_to_cpu(tmp_idata[i]), 1, 1); | 259 | le32_to_cpu(tmp_idata[i]), 1, 1); |
260 | } | ||
240 | } | 261 | } |
241 | put_bh(bh); | 262 | put_bh(bh); |
263 | extend_credit_for_blkdel(handle, inode); | ||
242 | ext4_free_blocks(handle, inode, le32_to_cpu(i_data), 1, 1); | 264 | ext4_free_blocks(handle, inode, le32_to_cpu(i_data), 1, 1); |
243 | return 0; | 265 | return 0; |
244 | } | 266 | } |
@@ -267,29 +289,32 @@ static int free_tind_blocks(handle_t *handle, | |||
267 | } | 289 | } |
268 | } | 290 | } |
269 | put_bh(bh); | 291 | put_bh(bh); |
292 | extend_credit_for_blkdel(handle, inode); | ||
270 | ext4_free_blocks(handle, inode, le32_to_cpu(i_data), 1, 1); | 293 | ext4_free_blocks(handle, inode, le32_to_cpu(i_data), 1, 1); |
271 | return 0; | 294 | return 0; |
272 | } | 295 | } |
273 | 296 | ||
274 | static int free_ind_block(handle_t *handle, struct inode *inode) | 297 | static int free_ind_block(handle_t *handle, struct inode *inode, __le32 *i_data) |
275 | { | 298 | { |
276 | int retval; | 299 | int retval; |
277 | struct ext4_inode_info *ei = EXT4_I(inode); | ||
278 | 300 | ||
279 | if (ei->i_data[EXT4_IND_BLOCK]) | 301 | /* ei->i_data[EXT4_IND_BLOCK] */ |
302 | if (i_data[0]) { | ||
303 | extend_credit_for_blkdel(handle, inode); | ||
280 | ext4_free_blocks(handle, inode, | 304 | ext4_free_blocks(handle, inode, |
281 | le32_to_cpu(ei->i_data[EXT4_IND_BLOCK]), 1, 1); | 305 | le32_to_cpu(i_data[0]), 1, 1); |
306 | } | ||
282 | 307 | ||
283 | if (ei->i_data[EXT4_DIND_BLOCK]) { | 308 | /* ei->i_data[EXT4_DIND_BLOCK] */ |
284 | retval = free_dind_blocks(handle, inode, | 309 | if (i_data[1]) { |
285 | ei->i_data[EXT4_DIND_BLOCK]); | 310 | retval = free_dind_blocks(handle, inode, i_data[1]); |
286 | if (retval) | 311 | if (retval) |
287 | return retval; | 312 | return retval; |
288 | } | 313 | } |
289 | 314 | ||
290 | if (ei->i_data[EXT4_TIND_BLOCK]) { | 315 | /* ei->i_data[EXT4_TIND_BLOCK] */ |
291 | retval = free_tind_blocks(handle, inode, | 316 | if (i_data[2]) { |
292 | ei->i_data[EXT4_TIND_BLOCK]); | 317 | retval = free_tind_blocks(handle, inode, i_data[2]); |
293 | if (retval) | 318 | if (retval) |
294 | return retval; | 319 | return retval; |
295 | } | 320 | } |
@@ -297,15 +322,13 @@ static int free_ind_block(handle_t *handle, struct inode *inode) | |||
297 | } | 322 | } |
298 | 323 | ||
299 | static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, | 324 | static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, |
300 | struct inode *tmp_inode, int retval) | 325 | struct inode *tmp_inode) |
301 | { | 326 | { |
327 | int retval; | ||
328 | __le32 i_data[3]; | ||
302 | struct ext4_inode_info *ei = EXT4_I(inode); | 329 | struct ext4_inode_info *ei = EXT4_I(inode); |
303 | struct ext4_inode_info *tmp_ei = EXT4_I(tmp_inode); | 330 | struct ext4_inode_info *tmp_ei = EXT4_I(tmp_inode); |
304 | 331 | ||
305 | retval = free_ind_block(handle, inode); | ||
306 | if (retval) | ||
307 | goto err_out; | ||
308 | |||
309 | /* | 332 | /* |
310 | * One credit accounted for writing the | 333 | * One credit accounted for writing the |
311 | * i_data field of the original inode | 334 | * i_data field of the original inode |
@@ -317,6 +340,11 @@ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, | |||
317 | goto err_out; | 340 | goto err_out; |
318 | } | 341 | } |
319 | 342 | ||
343 | i_data[0] = ei->i_data[EXT4_IND_BLOCK]; | ||
344 | i_data[1] = ei->i_data[EXT4_DIND_BLOCK]; | ||
345 | i_data[2] = ei->i_data[EXT4_TIND_BLOCK]; | ||
346 | |||
347 | down_write(&EXT4_I(inode)->i_data_sem); | ||
320 | /* | 348 | /* |
321 | * We have the extent map build with the tmp inode. | 349 | * We have the extent map build with the tmp inode. |
322 | * Now copy the i_data across | 350 | * Now copy the i_data across |
@@ -336,8 +364,15 @@ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode, | |||
336 | spin_lock(&inode->i_lock); | 364 | spin_lock(&inode->i_lock); |
337 | inode->i_blocks += tmp_inode->i_blocks; | 365 | inode->i_blocks += tmp_inode->i_blocks; |
338 | spin_unlock(&inode->i_lock); | 366 | spin_unlock(&inode->i_lock); |
367 | up_write(&EXT4_I(inode)->i_data_sem); | ||
339 | 368 | ||
369 | /* | ||
370 | * We mark the inode dirty after, because we decrement the | ||
371 | * i_blocks when freeing the indirect meta-data blocks | ||
372 | */ | ||
373 | retval = free_ind_block(handle, inode, i_data); | ||
340 | ext4_mark_inode_dirty(handle, inode); | 374 | ext4_mark_inode_dirty(handle, inode); |
375 | |||
341 | err_out: | 376 | err_out: |
342 | return retval; | 377 | return retval; |
343 | } | 378 | } |
@@ -365,6 +400,7 @@ static int free_ext_idx(handle_t *handle, struct inode *inode, | |||
365 | } | 400 | } |
366 | } | 401 | } |
367 | put_bh(bh); | 402 | put_bh(bh); |
403 | extend_credit_for_blkdel(handle, inode); | ||
368 | ext4_free_blocks(handle, inode, block, 1, 1); | 404 | ext4_free_blocks(handle, inode, block, 1, 1); |
369 | return retval; | 405 | return retval; |
370 | } | 406 | } |
@@ -414,7 +450,12 @@ int ext4_ext_migrate(struct inode *inode, struct file *filp, | |||
414 | if ((EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) | 450 | if ((EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) |
415 | return -EINVAL; | 451 | return -EINVAL; |
416 | 452 | ||
417 | down_write(&EXT4_I(inode)->i_data_sem); | 453 | if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0) |
454 | /* | ||
455 | * don't migrate fast symlink | ||
456 | */ | ||
457 | return retval; | ||
458 | |||
418 | handle = ext4_journal_start(inode, | 459 | handle = ext4_journal_start(inode, |
419 | EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + | 460 | EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + |
420 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 461 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
@@ -448,13 +489,6 @@ int ext4_ext_migrate(struct inode *inode, struct file *filp, | |||
448 | ext4_orphan_add(handle, tmp_inode); | 489 | ext4_orphan_add(handle, tmp_inode); |
449 | ext4_journal_stop(handle); | 490 | ext4_journal_stop(handle); |
450 | 491 | ||
451 | ei = EXT4_I(inode); | ||
452 | i_data = ei->i_data; | ||
453 | memset(&lb, 0, sizeof(lb)); | ||
454 | |||
455 | /* 32 bit block address 4 bytes */ | ||
456 | max_entries = inode->i_sb->s_blocksize >> 2; | ||
457 | |||
458 | /* | 492 | /* |
459 | * start with one credit accounted for | 493 | * start with one credit accounted for |
460 | * superblock modification. | 494 | * superblock modification. |
@@ -463,7 +497,20 @@ int ext4_ext_migrate(struct inode *inode, struct file *filp, | |||
463 | * trascation that created the inode. Later as and | 497 | * trascation that created the inode. Later as and |
464 | * when we add extents we extent the journal | 498 | * when we add extents we extent the journal |
465 | */ | 499 | */ |
500 | /* | ||
501 | * inode_mutex prevent write and truncate on the file. Read still goes | ||
502 | * through. We take i_data_sem in ext4_ext_swap_inode_data before we | ||
503 | * switch the inode format to prevent read. | ||
504 | */ | ||
505 | mutex_lock(&(inode->i_mutex)); | ||
466 | handle = ext4_journal_start(inode, 1); | 506 | handle = ext4_journal_start(inode, 1); |
507 | |||
508 | ei = EXT4_I(inode); | ||
509 | i_data = ei->i_data; | ||
510 | memset(&lb, 0, sizeof(lb)); | ||
511 | |||
512 | /* 32 bit block address 4 bytes */ | ||
513 | max_entries = inode->i_sb->s_blocksize >> 2; | ||
467 | for (i = 0; i < EXT4_NDIR_BLOCKS; i++, blk_count++) { | 514 | for (i = 0; i < EXT4_NDIR_BLOCKS; i++, blk_count++) { |
468 | if (i_data[i]) { | 515 | if (i_data[i]) { |
469 | retval = update_extent_range(handle, tmp_inode, | 516 | retval = update_extent_range(handle, tmp_inode, |
@@ -501,19 +548,6 @@ int ext4_ext_migrate(struct inode *inode, struct file *filp, | |||
501 | */ | 548 | */ |
502 | retval = finish_range(handle, tmp_inode, &lb); | 549 | retval = finish_range(handle, tmp_inode, &lb); |
503 | err_out: | 550 | err_out: |
504 | /* | ||
505 | * We are either freeing extent information or indirect | ||
506 | * blocks. During this we touch superblock, group descriptor | ||
507 | * and block bitmap. Later we mark the tmp_inode dirty | ||
508 | * via ext4_ext_tree_init. So allocate a credit of 4 | ||
509 | * We may update quota (user and group). | ||
510 | * | ||
511 | * FIXME!! we may be touching bitmaps in different block groups. | ||
512 | */ | ||
513 | if (ext4_journal_extend(handle, | ||
514 | 4 + 2*EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb)) != 0) | ||
515 | ext4_journal_restart(handle, | ||
516 | 4 + 2*EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb)); | ||
517 | if (retval) | 551 | if (retval) |
518 | /* | 552 | /* |
519 | * Failure case delete the extent information with the | 553 | * Failure case delete the extent information with the |
@@ -522,7 +556,11 @@ err_out: | |||
522 | free_ext_block(handle, tmp_inode); | 556 | free_ext_block(handle, tmp_inode); |
523 | else | 557 | else |
524 | retval = ext4_ext_swap_inode_data(handle, inode, | 558 | retval = ext4_ext_swap_inode_data(handle, inode, |
525 | tmp_inode, retval); | 559 | tmp_inode); |
560 | |||
561 | /* We mark the tmp_inode dirty via ext4_ext_tree_init. */ | ||
562 | if (ext4_journal_extend(handle, 1) != 0) | ||
563 | ext4_journal_restart(handle, 1); | ||
526 | 564 | ||
527 | /* | 565 | /* |
528 | * Mark the tmp_inode as of size zero | 566 | * Mark the tmp_inode as of size zero |
@@ -550,8 +588,7 @@ err_out: | |||
550 | tmp_inode->i_nlink = 0; | 588 | tmp_inode->i_nlink = 0; |
551 | 589 | ||
552 | ext4_journal_stop(handle); | 590 | ext4_journal_stop(handle); |
553 | 591 | mutex_unlock(&(inode->i_mutex)); | |
554 | up_write(&EXT4_I(inode)->i_data_sem); | ||
555 | 592 | ||
556 | if (tmp_inode) | 593 | if (tmp_inode) |
557 | iput(tmp_inode); | 594 | iput(tmp_inode); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index d153bb5922fc..a9347fb43bcc 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2223,6 +2223,7 @@ retry: | |||
2223 | inode->i_op = &ext4_fast_symlink_inode_operations; | 2223 | inode->i_op = &ext4_fast_symlink_inode_operations; |
2224 | memcpy((char*)&EXT4_I(inode)->i_data,symname,l); | 2224 | memcpy((char*)&EXT4_I(inode)->i_data,symname,l); |
2225 | inode->i_size = l-1; | 2225 | inode->i_size = l-1; |
2226 | EXT4_I(inode)->i_flags &= ~EXT4_EXTENTS_FL; | ||
2226 | } | 2227 | } |
2227 | EXT4_I(inode)->i_disksize = inode->i_size; | 2228 | EXT4_I(inode)->i_disksize = inode->i_size; |
2228 | err = ext4_add_nondir(handle, dentry, inode); | 2229 | err = ext4_add_nondir(handle, dentry, inode); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 93beb865c20d..0072da75221f 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1919,6 +1919,17 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) | |||
1919 | printk(KERN_WARNING | 1919 | printk(KERN_WARNING |
1920 | "EXT4-fs warning: feature flags set on rev 0 fs, " | 1920 | "EXT4-fs warning: feature flags set on rev 0 fs, " |
1921 | "running e2fsck is recommended\n"); | 1921 | "running e2fsck is recommended\n"); |
1922 | |||
1923 | /* | ||
1924 | * Since ext4 is still considered development code, we require | ||
1925 | * that the TEST_FILESYS flag in s->flags be set. | ||
1926 | */ | ||
1927 | if (!(le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS)) { | ||
1928 | printk(KERN_WARNING "EXT4-fs: %s: not marked " | ||
1929 | "OK to use with test code.\n", sb->s_id); | ||
1930 | goto failed_mount; | ||
1931 | } | ||
1932 | |||
1922 | /* | 1933 | /* |
1923 | * Check feature flags regardless of the revision level, since we | 1934 | * Check feature flags regardless of the revision level, since we |
1924 | * previously didn't change the revision level when setting the flags, | 1935 | * previously didn't change the revision level when setting the flags, |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index d0549cb4fb23..5222345ddccf 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/statfs.h> | 13 | #include <linux/statfs.h> |
14 | #include <linux/seq_file.h> | 14 | #include <linux/seq_file.h> |
15 | #include <linux/mount.h> | ||
15 | #include "hostfs.h" | 16 | #include "hostfs.h" |
16 | #include "init.h" | 17 | #include "init.h" |
17 | #include "kern.h" | 18 | #include "kern.h" |
diff --git a/fs/ioctl.c b/fs/ioctl.c index 683002fefa55..f32fbde2175e 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -18,12 +18,12 @@ | |||
18 | 18 | ||
19 | /** | 19 | /** |
20 | * vfs_ioctl - call filesystem specific ioctl methods | 20 | * vfs_ioctl - call filesystem specific ioctl methods |
21 | * @filp: [in] open file to invoke ioctl method on | 21 | * @filp: open file to invoke ioctl method on |
22 | * @cmd: [in] ioctl command to execute | 22 | * @cmd: ioctl command to execute |
23 | * @arg: [in/out] command-specific argument for ioctl | 23 | * @arg: command-specific argument for ioctl |
24 | * | 24 | * |
25 | * Invokes filesystem specific ->unlocked_ioctl, if one exists; otherwise | 25 | * Invokes filesystem specific ->unlocked_ioctl, if one exists; otherwise |
26 | * invokes * filesystem specific ->ioctl method. If neither method exists, | 26 | * invokes filesystem specific ->ioctl method. If neither method exists, |
27 | * returns -ENOTTY. | 27 | * returns -ENOTTY. |
28 | * | 28 | * |
29 | * Returns 0 on success, -errno on error. | 29 | * Returns 0 on success, -errno on error. |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 8e08efcaede2..a38c7186c570 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -104,7 +104,8 @@ static int journal_write_commit_record(journal_t *journal, | |||
104 | { | 104 | { |
105 | struct journal_head *descriptor; | 105 | struct journal_head *descriptor; |
106 | struct buffer_head *bh; | 106 | struct buffer_head *bh; |
107 | int i, ret; | 107 | journal_header_t *header; |
108 | int ret; | ||
108 | int barrier_done = 0; | 109 | int barrier_done = 0; |
109 | 110 | ||
110 | if (is_journal_aborted(journal)) | 111 | if (is_journal_aborted(journal)) |
@@ -116,13 +117,10 @@ static int journal_write_commit_record(journal_t *journal, | |||
116 | 117 | ||
117 | bh = jh2bh(descriptor); | 118 | bh = jh2bh(descriptor); |
118 | 119 | ||
119 | /* AKPM: buglet - add `i' to tmp! */ | 120 | header = (journal_header_t *)(bh->b_data); |
120 | for (i = 0; i < bh->b_size; i += 512) { | 121 | header->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); |
121 | journal_header_t *tmp = (journal_header_t*)bh->b_data; | 122 | header->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK); |
122 | tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); | 123 | header->h_sequence = cpu_to_be32(commit_transaction->t_tid); |
123 | tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK); | ||
124 | tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid); | ||
125 | } | ||
126 | 124 | ||
127 | JBUFFER_TRACE(descriptor, "write commit block"); | 125 | JBUFFER_TRACE(descriptor, "write commit block"); |
128 | set_buffer_dirty(bh); | 126 | set_buffer_dirty(bh); |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 4f302d279279..a8173081f831 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -136,18 +136,20 @@ static int journal_submit_commit_record(journal_t *journal, | |||
136 | 136 | ||
137 | JBUFFER_TRACE(descriptor, "submit commit block"); | 137 | JBUFFER_TRACE(descriptor, "submit commit block"); |
138 | lock_buffer(bh); | 138 | lock_buffer(bh); |
139 | 139 | get_bh(bh); | |
140 | set_buffer_dirty(bh); | 140 | set_buffer_dirty(bh); |
141 | set_buffer_uptodate(bh); | 141 | set_buffer_uptodate(bh); |
142 | bh->b_end_io = journal_end_buffer_io_sync; | 142 | bh->b_end_io = journal_end_buffer_io_sync; |
143 | 143 | ||
144 | if (journal->j_flags & JBD2_BARRIER && | 144 | if (journal->j_flags & JBD2_BARRIER && |
145 | !JBD2_HAS_COMPAT_FEATURE(journal, | 145 | !JBD2_HAS_INCOMPAT_FEATURE(journal, |
146 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { | 146 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { |
147 | set_buffer_ordered(bh); | 147 | set_buffer_ordered(bh); |
148 | barrier_done = 1; | 148 | barrier_done = 1; |
149 | } | 149 | } |
150 | ret = submit_bh(WRITE, bh); | 150 | ret = submit_bh(WRITE, bh); |
151 | if (barrier_done) | ||
152 | clear_buffer_ordered(bh); | ||
151 | 153 | ||
152 | /* is it possible for another commit to fail at roughly | 154 | /* is it possible for another commit to fail at roughly |
153 | * the same time as this one? If so, we don't want to | 155 | * the same time as this one? If so, we don't want to |
@@ -166,7 +168,6 @@ static int journal_submit_commit_record(journal_t *journal, | |||
166 | spin_unlock(&journal->j_state_lock); | 168 | spin_unlock(&journal->j_state_lock); |
167 | 169 | ||
168 | /* And try again, without the barrier */ | 170 | /* And try again, without the barrier */ |
169 | clear_buffer_ordered(bh); | ||
170 | set_buffer_uptodate(bh); | 171 | set_buffer_uptodate(bh); |
171 | set_buffer_dirty(bh); | 172 | set_buffer_dirty(bh); |
172 | ret = submit_bh(WRITE, bh); | 173 | ret = submit_bh(WRITE, bh); |
@@ -872,7 +873,8 @@ wait_for_iobuf: | |||
872 | if (err) | 873 | if (err) |
873 | __jbd2_journal_abort_hard(journal); | 874 | __jbd2_journal_abort_hard(journal); |
874 | } | 875 | } |
875 | err = journal_wait_on_commit_record(cbh); | 876 | if (!err && !is_journal_aborted(journal)) |
877 | err = journal_wait_on_commit_record(cbh); | ||
876 | 878 | ||
877 | if (err) | 879 | if (err) |
878 | jbd2_journal_abort(journal, err); | 880 | jbd2_journal_abort(journal, err); |
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index d36356f7d222..146411387ada 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c | |||
@@ -641,7 +641,7 @@ static int do_one_pass(journal_t *journal, | |||
641 | if (chksum_err) { | 641 | if (chksum_err) { |
642 | info->end_transaction = next_commit_ID; | 642 | info->end_transaction = next_commit_ID; |
643 | 643 | ||
644 | if (!JBD2_HAS_COMPAT_FEATURE(journal, | 644 | if (!JBD2_HAS_INCOMPAT_FEATURE(journal, |
645 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)){ | 645 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)){ |
646 | printk(KERN_ERR | 646 | printk(KERN_ERR |
647 | "JBD: Transaction %u " | 647 | "JBD: Transaction %u " |
diff --git a/fs/splice.c b/fs/splice.c index 14e2262c0a04..9b559ee711a8 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1234,7 +1234,7 @@ static int get_iovec_page_array(const struct iovec __user *iov, | |||
1234 | if (unlikely(!len)) | 1234 | if (unlikely(!len)) |
1235 | break; | 1235 | break; |
1236 | error = -EFAULT; | 1236 | error = -EFAULT; |
1237 | if (unlikely(!base)) | 1237 | if (!access_ok(VERIFY_READ, base, len)) |
1238 | break; | 1238 | break; |
1239 | 1239 | ||
1240 | /* | 1240 | /* |
diff --git a/include/asm-blackfin/page.h b/include/asm-blackfin/page.h index d5c9d1433781..c7db0220fbd6 100644 --- a/include/asm-blackfin/page.h +++ b/include/asm-blackfin/page.h | |||
@@ -39,6 +39,7 @@ typedef struct { | |||
39 | typedef struct { | 39 | typedef struct { |
40 | unsigned long pgprot; | 40 | unsigned long pgprot; |
41 | } pgprot_t; | 41 | } pgprot_t; |
42 | typedef struct page *pgtable_t; | ||
42 | 43 | ||
43 | #define pte_val(x) ((x).pte) | 44 | #define pte_val(x) ((x).pte) |
44 | #define pmd_val(x) ((&x)->pmd[0]) | 45 | #define pmd_val(x) ((&x)->pmd[0]) |
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h index a83492449130..d6a3eaf3b27e 100644 --- a/include/asm-h8300/page.h +++ b/include/asm-h8300/page.h | |||
@@ -31,6 +31,7 @@ typedef struct { unsigned long pte; } pte_t; | |||
31 | typedef struct { unsigned long pmd[16]; } pmd_t; | 31 | typedef struct { unsigned long pmd[16]; } pmd_t; |
32 | typedef struct { unsigned long pgd; } pgd_t; | 32 | typedef struct { unsigned long pgd; } pgd_t; |
33 | typedef struct { unsigned long pgprot; } pgprot_t; | 33 | typedef struct { unsigned long pgprot; } pgprot_t; |
34 | typedef struct page *pgtable_t; | ||
34 | 35 | ||
35 | #define pte_val(x) ((x).pte) | 36 | #define pte_val(x) ((x).pte) |
36 | #define pmd_val(x) ((&x)->pmd[0]) | 37 | #define pmd_val(x) ((&x)->pmd[0]) |
diff --git a/include/asm-m68knommu/page.h b/include/asm-m68knommu/page.h index 6af480c7f291..1e82ebb7d644 100644 --- a/include/asm-m68knommu/page.h +++ b/include/asm-m68knommu/page.h | |||
@@ -31,6 +31,7 @@ typedef struct { unsigned long pte; } pte_t; | |||
31 | typedef struct { unsigned long pmd[16]; } pmd_t; | 31 | typedef struct { unsigned long pmd[16]; } pmd_t; |
32 | typedef struct { unsigned long pgd; } pgd_t; | 32 | typedef struct { unsigned long pgd; } pgd_t; |
33 | typedef struct { unsigned long pgprot; } pgprot_t; | 33 | typedef struct { unsigned long pgprot; } pgprot_t; |
34 | typedef struct page *pgtable_t; | ||
34 | 35 | ||
35 | #define pte_val(x) ((x).pte) | 36 | #define pte_val(x) ((x).pte) |
36 | #define pmd_val(x) ((&x)->pmd[0]) | 37 | #define pmd_val(x) ((&x)->pmd[0]) |
diff --git a/include/asm-s390/a.out.h b/include/asm-s390/a.out.h deleted file mode 100644 index 8d6bd9c2952e..000000000000 --- a/include/asm-s390/a.out.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-s390/a.out.h | ||
3 | * | ||
4 | * S390 version | ||
5 | * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
6 | * | ||
7 | * Derived from "include/asm-i386/a.out.h" | ||
8 | * Copyright (C) 1992, Linus Torvalds | ||
9 | * | ||
10 | * I don't think we'll ever need a.out ... | ||
11 | */ | ||
12 | |||
13 | #ifndef __S390_A_OUT_H__ | ||
14 | #define __S390_A_OUT_H__ | ||
15 | |||
16 | struct exec | ||
17 | { | ||
18 | unsigned long a_info; /* Use macros N_MAGIC, etc for access */ | ||
19 | unsigned a_text; /* length of text, in bytes */ | ||
20 | unsigned a_data; /* length of data, in bytes */ | ||
21 | unsigned a_bss; /* length of uninitialized data area for file, in bytes */ | ||
22 | unsigned a_syms; /* length of symbol table data in file, in bytes */ | ||
23 | unsigned a_entry; /* start address */ | ||
24 | unsigned a_trsize; /* length of relocation info for text, in bytes */ | ||
25 | unsigned a_drsize; /* length of relocation info for data, in bytes */ | ||
26 | }; | ||
27 | |||
28 | #define N_TRSIZE(a) ((a).a_trsize) | ||
29 | #define N_DRSIZE(a) ((a).a_drsize) | ||
30 | #define N_SYMSIZE(a) ((a).a_syms) | ||
31 | |||
32 | #endif /* __A_OUT_GNU_H__ */ | ||
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h index 882db054110c..ab83c844d04c 100644 --- a/include/asm-s390/bitops.h +++ b/include/asm-s390/bitops.h | |||
@@ -472,7 +472,7 @@ static inline unsigned long __ffz_word_loop(const unsigned long *addr, | |||
472 | " brct %1,0b\n" | 472 | " brct %1,0b\n" |
473 | "1:\n" | 473 | "1:\n" |
474 | #endif | 474 | #endif |
475 | : "+a" (bytes), "+d" (size) | 475 | : "+&a" (bytes), "+&d" (size) |
476 | : "d" (-1UL), "a" (addr), "m" (*(addrtype *) addr) | 476 | : "d" (-1UL), "a" (addr), "m" (*(addrtype *) addr) |
477 | : "cc" ); | 477 | : "cc" ); |
478 | return bytes; | 478 | return bytes; |
@@ -507,7 +507,7 @@ static inline unsigned long __ffs_word_loop(const unsigned long *addr, | |||
507 | " brct %1,0b\n" | 507 | " brct %1,0b\n" |
508 | "1:\n" | 508 | "1:\n" |
509 | #endif | 509 | #endif |
510 | : "+a" (bytes), "+a" (size) | 510 | : "+&a" (bytes), "+&a" (size) |
511 | : "d" (0UL), "a" (addr), "m" (*(addrtype *) addr) | 511 | : "d" (0UL), "a" (addr), "m" (*(addrtype *) addr) |
512 | : "cc" ); | 512 | : "cc" ); |
513 | return bytes; | 513 | return bytes; |
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h index b73a424d0f97..b3ac262c4582 100644 --- a/include/asm-s390/elf.h +++ b/include/asm-s390/elf.h | |||
@@ -115,6 +115,7 @@ typedef s390_regs elf_gregset_t; | |||
115 | 115 | ||
116 | #include <linux/sched.h> /* for task_struct */ | 116 | #include <linux/sched.h> /* for task_struct */ |
117 | #include <asm/system.h> /* for save_access_regs */ | 117 | #include <asm/system.h> /* for save_access_regs */ |
118 | #include <asm/mmu_context.h> | ||
118 | 119 | ||
119 | /* | 120 | /* |
120 | * This is used to ensure we don't load something for the wrong architecture. | 121 | * This is used to ensure we don't load something for the wrong architecture. |
@@ -137,14 +138,7 @@ typedef s390_regs elf_gregset_t; | |||
137 | use of this is to invoke "./ld.so someprog" to test out a new version of | 138 | use of this is to invoke "./ld.so someprog" to test out a new version of |
138 | the loader. We need to make sure that it is out of the way of the program | 139 | the loader. We need to make sure that it is out of the way of the program |
139 | that it will "exec", and that there is sufficient room for the brk. */ | 140 | that it will "exec", and that there is sufficient room for the brk. */ |
140 | 141 | #define ELF_ET_DYN_BASE (STACK_TOP / 3 * 2) | |
141 | #ifndef __s390x__ | ||
142 | #define ELF_ET_DYN_BASE ((TASK_SIZE & 0x80000000) \ | ||
143 | ? TASK_SIZE / 3 * 2 \ | ||
144 | : 2 * TASK_SIZE / 3) | ||
145 | #else /* __s390x__ */ | ||
146 | #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) | ||
147 | #endif /* __s390x__ */ | ||
148 | 142 | ||
149 | /* Wow, the "main" arch needs arch dependent functions too.. :) */ | 143 | /* Wow, the "main" arch needs arch dependent functions too.. :) */ |
150 | 144 | ||
@@ -214,4 +208,16 @@ do { \ | |||
214 | } while (0) | 208 | } while (0) |
215 | #endif /* __s390x__ */ | 209 | #endif /* __s390x__ */ |
216 | 210 | ||
211 | /* | ||
212 | * An executable for which elf_read_implies_exec() returns TRUE will | ||
213 | * have the READ_IMPLIES_EXEC personality flag set automatically. | ||
214 | */ | ||
215 | #define elf_read_implies_exec(ex, executable_stack) \ | ||
216 | ({ \ | ||
217 | if (current->mm->context.noexec && \ | ||
218 | executable_stack != EXSTACK_DISABLE_X) \ | ||
219 | disable_noexec(current->mm, current); \ | ||
220 | current->mm->context.noexec == 0; \ | ||
221 | }) | ||
222 | |||
217 | #endif | 223 | #endif |
diff --git a/include/asm-s390/mmu.h b/include/asm-s390/mmu.h index ccd36d26615a..1698e29c5b20 100644 --- a/include/asm-s390/mmu.h +++ b/include/asm-s390/mmu.h | |||
@@ -1,7 +1,12 @@ | |||
1 | #ifndef __MMU_H | 1 | #ifndef __MMU_H |
2 | #define __MMU_H | 2 | #define __MMU_H |
3 | 3 | ||
4 | /* Default "unsigned long" context */ | 4 | typedef struct { |
5 | typedef unsigned long mm_context_t; | 5 | struct list_head crst_list; |
6 | struct list_head pgtable_list; | ||
7 | unsigned long asce_bits; | ||
8 | unsigned long asce_limit; | ||
9 | int noexec; | ||
10 | } mm_context_t; | ||
6 | 11 | ||
7 | #endif | 12 | #endif |
diff --git a/include/asm-s390/mmu_context.h b/include/asm-s390/mmu_context.h index a77d4ba3c8eb..b5a34c6f91a9 100644 --- a/include/asm-s390/mmu_context.h +++ b/include/asm-s390/mmu_context.h | |||
@@ -10,15 +10,19 @@ | |||
10 | #define __S390_MMU_CONTEXT_H | 10 | #define __S390_MMU_CONTEXT_H |
11 | 11 | ||
12 | #include <asm/pgalloc.h> | 12 | #include <asm/pgalloc.h> |
13 | #include <asm/uaccess.h> | ||
13 | #include <asm-generic/mm_hooks.h> | 14 | #include <asm-generic/mm_hooks.h> |
14 | 15 | ||
15 | static inline int init_new_context(struct task_struct *tsk, | 16 | static inline int init_new_context(struct task_struct *tsk, |
16 | struct mm_struct *mm) | 17 | struct mm_struct *mm) |
17 | { | 18 | { |
18 | mm->context = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS; | 19 | mm->context.asce_bits = _ASCE_TABLE_LENGTH | _ASCE_USER_BITS; |
19 | #ifdef CONFIG_64BIT | 20 | #ifdef CONFIG_64BIT |
20 | mm->context |= _ASCE_TYPE_REGION3; | 21 | mm->context.asce_bits |= _ASCE_TYPE_REGION3; |
21 | #endif | 22 | #endif |
23 | mm->context.noexec = s390_noexec; | ||
24 | mm->context.asce_limit = STACK_TOP_MAX; | ||
25 | crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm)); | ||
22 | return 0; | 26 | return 0; |
23 | } | 27 | } |
24 | 28 | ||
@@ -32,24 +36,25 @@ static inline int init_new_context(struct task_struct *tsk, | |||
32 | 36 | ||
33 | static inline void update_mm(struct mm_struct *mm, struct task_struct *tsk) | 37 | static inline void update_mm(struct mm_struct *mm, struct task_struct *tsk) |
34 | { | 38 | { |
35 | S390_lowcore.user_asce = mm->context | __pa(mm->pgd); | 39 | pgd_t *pgd = mm->pgd; |
40 | |||
41 | S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd); | ||
36 | if (switch_amode) { | 42 | if (switch_amode) { |
37 | /* Load primary space page table origin. */ | 43 | /* Load primary space page table origin. */ |
38 | pgd_t *shadow_pgd = get_shadow_table(mm->pgd) ? : mm->pgd; | 44 | pgd = mm->context.noexec ? get_shadow_table(pgd) : pgd; |
39 | S390_lowcore.user_exec_asce = mm->context | __pa(shadow_pgd); | 45 | S390_lowcore.user_exec_asce = mm->context.asce_bits | __pa(pgd); |
40 | asm volatile(LCTL_OPCODE" 1,1,%0\n" | 46 | asm volatile(LCTL_OPCODE" 1,1,%0\n" |
41 | : : "m" (S390_lowcore.user_exec_asce) ); | 47 | : : "m" (S390_lowcore.user_exec_asce) ); |
42 | } else | 48 | } else |
43 | /* Load home space page table origin. */ | 49 | /* Load home space page table origin. */ |
44 | asm volatile(LCTL_OPCODE" 13,13,%0" | 50 | asm volatile(LCTL_OPCODE" 13,13,%0" |
45 | : : "m" (S390_lowcore.user_asce) ); | 51 | : : "m" (S390_lowcore.user_asce) ); |
52 | set_fs(current->thread.mm_segment); | ||
46 | } | 53 | } |
47 | 54 | ||
48 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | 55 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, |
49 | struct task_struct *tsk) | 56 | struct task_struct *tsk) |
50 | { | 57 | { |
51 | if (unlikely(prev == next)) | ||
52 | return; | ||
53 | cpu_set(smp_processor_id(), next->cpu_vm_mask); | 58 | cpu_set(smp_processor_id(), next->cpu_vm_mask); |
54 | update_mm(next, tsk); | 59 | update_mm(next, tsk); |
55 | } | 60 | } |
@@ -61,7 +66,6 @@ static inline void activate_mm(struct mm_struct *prev, | |||
61 | struct mm_struct *next) | 66 | struct mm_struct *next) |
62 | { | 67 | { |
63 | switch_mm(prev, next, current); | 68 | switch_mm(prev, next, current); |
64 | set_fs(current->thread.mm_segment); | ||
65 | } | 69 | } |
66 | 70 | ||
67 | #endif /* __S390_MMU_CONTEXT_H */ | 71 | #endif /* __S390_MMU_CONTEXT_H */ |
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h index 7f29a981f48c..fe7f92b6ae6d 100644 --- a/include/asm-s390/page.h +++ b/include/asm-s390/page.h | |||
@@ -74,43 +74,17 @@ static inline void copy_page(void *to, void *from) | |||
74 | 74 | ||
75 | typedef struct { unsigned long pgprot; } pgprot_t; | 75 | typedef struct { unsigned long pgprot; } pgprot_t; |
76 | typedef struct { unsigned long pte; } pte_t; | 76 | typedef struct { unsigned long pte; } pte_t; |
77 | |||
78 | #define pte_val(x) ((x).pte) | ||
79 | #define pgprot_val(x) ((x).pgprot) | ||
80 | |||
81 | #ifndef __s390x__ | ||
82 | |||
83 | typedef struct { unsigned long pmd; } pmd_t; | 77 | typedef struct { unsigned long pmd; } pmd_t; |
84 | typedef struct { unsigned long pud; } pud_t; | 78 | typedef struct { unsigned long pud; } pud_t; |
85 | typedef struct { | ||
86 | unsigned long pgd0; | ||
87 | unsigned long pgd1; | ||
88 | unsigned long pgd2; | ||
89 | unsigned long pgd3; | ||
90 | } pgd_t; | ||
91 | |||
92 | #define pmd_val(x) ((x).pmd) | ||
93 | #define pud_val(x) ((x).pud) | ||
94 | #define pgd_val(x) ((x).pgd0) | ||
95 | |||
96 | #else /* __s390x__ */ | ||
97 | |||
98 | typedef struct { | ||
99 | unsigned long pmd0; | ||
100 | unsigned long pmd1; | ||
101 | } pmd_t; | ||
102 | typedef struct { unsigned long pud; } pud_t; | ||
103 | typedef struct { unsigned long pgd; } pgd_t; | 79 | typedef struct { unsigned long pgd; } pgd_t; |
80 | typedef pte_t *pgtable_t; | ||
104 | 81 | ||
105 | #define pmd_val(x) ((x).pmd0) | 82 | #define pgprot_val(x) ((x).pgprot) |
106 | #define pmd_val1(x) ((x).pmd1) | 83 | #define pte_val(x) ((x).pte) |
84 | #define pmd_val(x) ((x).pmd) | ||
107 | #define pud_val(x) ((x).pud) | 85 | #define pud_val(x) ((x).pud) |
108 | #define pgd_val(x) ((x).pgd) | 86 | #define pgd_val(x) ((x).pgd) |
109 | 87 | ||
110 | #endif /* __s390x__ */ | ||
111 | |||
112 | typedef struct page *pgtable_t; | ||
113 | |||
114 | #define __pte(x) ((pte_t) { (x) } ) | 88 | #define __pte(x) ((pte_t) { (x) } ) |
115 | #define __pmd(x) ((pmd_t) { (x) } ) | 89 | #define __pmd(x) ((pmd_t) { (x) } ) |
116 | #define __pgd(x) ((pgd_t) { (x) } ) | 90 | #define __pgd(x) ((pgd_t) { (x) } ) |
@@ -167,7 +141,7 @@ static inline int pfn_valid(unsigned long pfn) | |||
167 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | 141 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) |
168 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 142 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
169 | 143 | ||
170 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | 144 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ |
171 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | 145 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
172 | 146 | ||
173 | #include <asm-generic/memory_model.h> | 147 | #include <asm-generic/memory_model.h> |
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h index 900d44807e10..f5b2bf3d7c1d 100644 --- a/include/asm-s390/pgalloc.h +++ b/include/asm-s390/pgalloc.h | |||
@@ -20,10 +20,11 @@ | |||
20 | #define check_pgt_cache() do {} while (0) | 20 | #define check_pgt_cache() do {} while (0) |
21 | 21 | ||
22 | unsigned long *crst_table_alloc(struct mm_struct *, int); | 22 | unsigned long *crst_table_alloc(struct mm_struct *, int); |
23 | void crst_table_free(unsigned long *); | 23 | void crst_table_free(struct mm_struct *, unsigned long *); |
24 | 24 | ||
25 | unsigned long *page_table_alloc(int); | 25 | unsigned long *page_table_alloc(struct mm_struct *); |
26 | void page_table_free(unsigned long *); | 26 | void page_table_free(struct mm_struct *, unsigned long *); |
27 | void disable_noexec(struct mm_struct *, struct task_struct *); | ||
27 | 28 | ||
28 | static inline void clear_table(unsigned long *s, unsigned long val, size_t n) | 29 | static inline void clear_table(unsigned long *s, unsigned long val, size_t n) |
29 | { | 30 | { |
@@ -72,23 +73,49 @@ static inline unsigned long pgd_entry_type(struct mm_struct *mm) | |||
72 | 73 | ||
73 | static inline unsigned long pgd_entry_type(struct mm_struct *mm) | 74 | static inline unsigned long pgd_entry_type(struct mm_struct *mm) |
74 | { | 75 | { |
75 | return _REGION3_ENTRY_EMPTY; | 76 | if (mm->context.asce_limit <= (1UL << 31)) |
77 | return _SEGMENT_ENTRY_EMPTY; | ||
78 | if (mm->context.asce_limit <= (1UL << 42)) | ||
79 | return _REGION3_ENTRY_EMPTY; | ||
80 | return _REGION2_ENTRY_EMPTY; | ||
76 | } | 81 | } |
77 | 82 | ||
78 | #define pud_alloc_one(mm,address) ({ BUG(); ((pud_t *)2); }) | 83 | int crst_table_upgrade(struct mm_struct *, unsigned long limit); |
79 | #define pud_free(mm, x) do { } while (0) | 84 | void crst_table_downgrade(struct mm_struct *, unsigned long limit); |
85 | |||
86 | static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address) | ||
87 | { | ||
88 | unsigned long *table = crst_table_alloc(mm, mm->context.noexec); | ||
89 | if (table) | ||
90 | crst_table_init(table, _REGION3_ENTRY_EMPTY); | ||
91 | return (pud_t *) table; | ||
92 | } | ||
93 | #define pud_free(mm, pud) crst_table_free(mm, (unsigned long *) pud) | ||
80 | 94 | ||
81 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) | 95 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) |
82 | { | 96 | { |
83 | unsigned long *crst = crst_table_alloc(mm, s390_noexec); | 97 | unsigned long *table = crst_table_alloc(mm, mm->context.noexec); |
84 | if (crst) | 98 | if (table) |
85 | crst_table_init(crst, _SEGMENT_ENTRY_EMPTY); | 99 | crst_table_init(table, _SEGMENT_ENTRY_EMPTY); |
86 | return (pmd_t *) crst; | 100 | return (pmd_t *) table; |
87 | } | 101 | } |
88 | #define pmd_free(mm, pmd) crst_table_free((unsigned long *)pmd) | 102 | #define pmd_free(mm, pmd) crst_table_free(mm, (unsigned long *) pmd) |
89 | 103 | ||
90 | #define pgd_populate(mm, pgd, pud) BUG() | 104 | static inline void pgd_populate_kernel(struct mm_struct *mm, |
91 | #define pgd_populate_kernel(mm, pgd, pud) BUG() | 105 | pgd_t *pgd, pud_t *pud) |
106 | { | ||
107 | pgd_val(*pgd) = _REGION2_ENTRY | __pa(pud); | ||
108 | } | ||
109 | |||
110 | static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) | ||
111 | { | ||
112 | pgd_populate_kernel(mm, pgd, pud); | ||
113 | if (mm->context.noexec) { | ||
114 | pgd = get_shadow_table(pgd); | ||
115 | pud = get_shadow_table(pud); | ||
116 | pgd_populate_kernel(mm, pgd, pud); | ||
117 | } | ||
118 | } | ||
92 | 119 | ||
93 | static inline void pud_populate_kernel(struct mm_struct *mm, | 120 | static inline void pud_populate_kernel(struct mm_struct *mm, |
94 | pud_t *pud, pmd_t *pmd) | 121 | pud_t *pud, pmd_t *pmd) |
@@ -98,63 +125,50 @@ static inline void pud_populate_kernel(struct mm_struct *mm, | |||
98 | 125 | ||
99 | static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) | 126 | static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) |
100 | { | 127 | { |
101 | pud_t *shadow_pud = get_shadow_table(pud); | ||
102 | pmd_t *shadow_pmd = get_shadow_table(pmd); | ||
103 | |||
104 | if (shadow_pud && shadow_pmd) | ||
105 | pud_populate_kernel(mm, shadow_pud, shadow_pmd); | ||
106 | pud_populate_kernel(mm, pud, pmd); | 128 | pud_populate_kernel(mm, pud, pmd); |
129 | if (mm->context.noexec) { | ||
130 | pud = get_shadow_table(pud); | ||
131 | pmd = get_shadow_table(pmd); | ||
132 | pud_populate_kernel(mm, pud, pmd); | ||
133 | } | ||
107 | } | 134 | } |
108 | 135 | ||
109 | #endif /* __s390x__ */ | 136 | #endif /* __s390x__ */ |
110 | 137 | ||
111 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | 138 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
112 | { | 139 | { |
113 | unsigned long *crst = crst_table_alloc(mm, s390_noexec); | 140 | INIT_LIST_HEAD(&mm->context.crst_list); |
114 | if (crst) | 141 | INIT_LIST_HEAD(&mm->context.pgtable_list); |
115 | crst_table_init(crst, pgd_entry_type(mm)); | 142 | return (pgd_t *) crst_table_alloc(mm, s390_noexec); |
116 | return (pgd_t *) crst; | ||
117 | } | 143 | } |
118 | #define pgd_free(mm, pgd) crst_table_free((unsigned long *) pgd) | 144 | #define pgd_free(mm, pgd) crst_table_free(mm, (unsigned long *) pgd) |
119 | 145 | ||
120 | static inline void | 146 | static inline void pmd_populate_kernel(struct mm_struct *mm, |
121 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) | 147 | pmd_t *pmd, pte_t *pte) |
122 | { | 148 | { |
123 | #ifndef __s390x__ | ||
124 | pmd_val(pmd[0]) = _SEGMENT_ENTRY + __pa(pte); | ||
125 | pmd_val(pmd[1]) = _SEGMENT_ENTRY + __pa(pte+256); | ||
126 | pmd_val(pmd[2]) = _SEGMENT_ENTRY + __pa(pte+512); | ||
127 | pmd_val(pmd[3]) = _SEGMENT_ENTRY + __pa(pte+768); | ||
128 | #else /* __s390x__ */ | ||
129 | pmd_val(*pmd) = _SEGMENT_ENTRY + __pa(pte); | 149 | pmd_val(*pmd) = _SEGMENT_ENTRY + __pa(pte); |
130 | pmd_val1(*pmd) = _SEGMENT_ENTRY + __pa(pte+256); | ||
131 | #endif /* __s390x__ */ | ||
132 | } | 150 | } |
133 | 151 | ||
134 | static inline void | 152 | static inline void pmd_populate(struct mm_struct *mm, |
135 | pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page) | 153 | pmd_t *pmd, pgtable_t pte) |
136 | { | 154 | { |
137 | pte_t *pte = (pte_t *)page_to_phys(page); | ||
138 | pmd_t *shadow_pmd = get_shadow_table(pmd); | ||
139 | pte_t *shadow_pte = get_shadow_pte(pte); | ||
140 | |||
141 | pmd_populate_kernel(mm, pmd, pte); | 155 | pmd_populate_kernel(mm, pmd, pte); |
142 | if (shadow_pmd && shadow_pte) | 156 | if (mm->context.noexec) { |
143 | pmd_populate_kernel(mm, shadow_pmd, shadow_pte); | 157 | pmd = get_shadow_table(pmd); |
158 | pmd_populate_kernel(mm, pmd, pte + PTRS_PER_PTE); | ||
159 | } | ||
144 | } | 160 | } |
145 | #define pmd_pgtable(pmd) pmd_page(pmd) | 161 | |
162 | #define pmd_pgtable(pmd) \ | ||
163 | (pgtable_t)(pmd_val(pmd) & -sizeof(pte_t)*PTRS_PER_PTE) | ||
146 | 164 | ||
147 | /* | 165 | /* |
148 | * page table entry allocation/free routines. | 166 | * page table entry allocation/free routines. |
149 | */ | 167 | */ |
150 | #define pte_alloc_one_kernel(mm, vmaddr) \ | 168 | #define pte_alloc_one_kernel(mm, vmaddr) ((pte_t *) page_table_alloc(mm)) |
151 | ((pte_t *) page_table_alloc(s390_noexec)) | 169 | #define pte_alloc_one(mm, vmaddr) ((pte_t *) page_table_alloc(mm)) |
152 | #define pte_alloc_one(mm, vmaddr) \ | 170 | |
153 | virt_to_page(page_table_alloc(s390_noexec)) | 171 | #define pte_free_kernel(mm, pte) page_table_free(mm, (unsigned long *) pte) |
154 | 172 | #define pte_free(mm, pte) page_table_free(mm, (unsigned long *) pte) | |
155 | #define pte_free_kernel(mm, pte) \ | ||
156 | page_table_free((unsigned long *) pte) | ||
157 | #define pte_free(mm, pte) \ | ||
158 | page_table_free((unsigned long *) page_to_phys((struct page *) pte)) | ||
159 | 173 | ||
160 | #endif /* _S390_PGALLOC_H */ | 174 | #endif /* _S390_PGALLOC_H */ |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index 3f520754e71c..65154dc9a9e5 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -57,21 +57,21 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
57 | * PGDIR_SHIFT determines what a third-level page table entry can map | 57 | * PGDIR_SHIFT determines what a third-level page table entry can map |
58 | */ | 58 | */ |
59 | #ifndef __s390x__ | 59 | #ifndef __s390x__ |
60 | # define PMD_SHIFT 22 | 60 | # define PMD_SHIFT 20 |
61 | # define PUD_SHIFT 22 | 61 | # define PUD_SHIFT 20 |
62 | # define PGDIR_SHIFT 22 | 62 | # define PGDIR_SHIFT 20 |
63 | #else /* __s390x__ */ | 63 | #else /* __s390x__ */ |
64 | # define PMD_SHIFT 21 | 64 | # define PMD_SHIFT 20 |
65 | # define PUD_SHIFT 31 | 65 | # define PUD_SHIFT 31 |
66 | # define PGDIR_SHIFT 31 | 66 | # define PGDIR_SHIFT 42 |
67 | #endif /* __s390x__ */ | 67 | #endif /* __s390x__ */ |
68 | 68 | ||
69 | #define PMD_SIZE (1UL << PMD_SHIFT) | 69 | #define PMD_SIZE (1UL << PMD_SHIFT) |
70 | #define PMD_MASK (~(PMD_SIZE-1)) | 70 | #define PMD_MASK (~(PMD_SIZE-1)) |
71 | #define PUD_SIZE (1UL << PUD_SHIFT) | 71 | #define PUD_SIZE (1UL << PUD_SHIFT) |
72 | #define PUD_MASK (~(PUD_SIZE-1)) | 72 | #define PUD_MASK (~(PUD_SIZE-1)) |
73 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 73 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
74 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 74 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
75 | 75 | ||
76 | /* | 76 | /* |
77 | * entries per page directory level: the S390 is two-level, so | 77 | * entries per page directory level: the S390 is two-level, so |
@@ -79,17 +79,15 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
79 | * for S390 segment-table entries are combined to one PGD | 79 | * for S390 segment-table entries are combined to one PGD |
80 | * that leads to 1024 pte per pgd | 80 | * that leads to 1024 pte per pgd |
81 | */ | 81 | */ |
82 | #define PTRS_PER_PTE 256 | ||
82 | #ifndef __s390x__ | 83 | #ifndef __s390x__ |
83 | # define PTRS_PER_PTE 1024 | 84 | #define PTRS_PER_PMD 1 |
84 | # define PTRS_PER_PMD 1 | 85 | #define PTRS_PER_PUD 1 |
85 | # define PTRS_PER_PUD 1 | ||
86 | # define PTRS_PER_PGD 512 | ||
87 | #else /* __s390x__ */ | 86 | #else /* __s390x__ */ |
88 | # define PTRS_PER_PTE 512 | 87 | #define PTRS_PER_PMD 2048 |
89 | # define PTRS_PER_PMD 1024 | 88 | #define PTRS_PER_PUD 2048 |
90 | # define PTRS_PER_PUD 1 | ||
91 | # define PTRS_PER_PGD 2048 | ||
92 | #endif /* __s390x__ */ | 89 | #endif /* __s390x__ */ |
90 | #define PTRS_PER_PGD 2048 | ||
93 | 91 | ||
94 | #define FIRST_USER_ADDRESS 0 | 92 | #define FIRST_USER_ADDRESS 0 |
95 | 93 | ||
@@ -127,8 +125,9 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
127 | * mapping. This needs to be calculated at compile time since the size of the | 125 | * mapping. This needs to be calculated at compile time since the size of the |
128 | * VMEM_MAP is static but the size of struct page can change. | 126 | * VMEM_MAP is static but the size of struct page can change. |
129 | */ | 127 | */ |
130 | #define VMEM_MAX_PHYS min(VMALLOC_START, ((VMEM_MAP_END - VMALLOC_END) / \ | 128 | #define VMEM_MAX_PAGES ((VMEM_MAP_END - VMALLOC_END) / sizeof(struct page)) |
131 | sizeof(struct page) * PAGE_SIZE) & ~((16 << 20) - 1)) | 129 | #define VMEM_MAX_PFN min(VMALLOC_START >> PAGE_SHIFT, VMEM_MAX_PAGES) |
130 | #define VMEM_MAX_PHYS ((VMEM_MAX_PFN << PAGE_SHIFT) & ~((16 << 20) - 1)) | ||
132 | #define VMEM_MAP ((struct page *) VMALLOC_END) | 131 | #define VMEM_MAP ((struct page *) VMALLOC_END) |
133 | 132 | ||
134 | /* | 133 | /* |
@@ -375,24 +374,6 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
375 | # define PxD_SHADOW_SHIFT 2 | 374 | # define PxD_SHADOW_SHIFT 2 |
376 | #endif /* __s390x__ */ | 375 | #endif /* __s390x__ */ |
377 | 376 | ||
378 | static inline struct page *get_shadow_page(struct page *page) | ||
379 | { | ||
380 | if (s390_noexec && page->index) | ||
381 | return virt_to_page((void *)(addr_t) page->index); | ||
382 | return NULL; | ||
383 | } | ||
384 | |||
385 | static inline void *get_shadow_pte(void *table) | ||
386 | { | ||
387 | unsigned long addr, offset; | ||
388 | struct page *page; | ||
389 | |||
390 | addr = (unsigned long) table; | ||
391 | offset = addr & (PAGE_SIZE - 1); | ||
392 | page = virt_to_page((void *)(addr ^ offset)); | ||
393 | return (void *)(addr_t)(page->index ? (page->index | offset) : 0UL); | ||
394 | } | ||
395 | |||
396 | static inline void *get_shadow_table(void *table) | 377 | static inline void *get_shadow_table(void *table) |
397 | { | 378 | { |
398 | unsigned long addr, offset; | 379 | unsigned long addr, offset; |
@@ -410,17 +391,16 @@ static inline void *get_shadow_table(void *table) | |||
410 | * hook is made available. | 391 | * hook is made available. |
411 | */ | 392 | */ |
412 | static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | 393 | static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, |
413 | pte_t *pteptr, pte_t pteval) | 394 | pte_t *ptep, pte_t entry) |
414 | { | 395 | { |
415 | pte_t *shadow_pte = get_shadow_pte(pteptr); | 396 | *ptep = entry; |
416 | 397 | if (mm->context.noexec) { | |
417 | *pteptr = pteval; | 398 | if (!(pte_val(entry) & _PAGE_INVALID) && |
418 | if (shadow_pte) { | 399 | (pte_val(entry) & _PAGE_SWX)) |
419 | if (!(pte_val(pteval) & _PAGE_INVALID) && | 400 | pte_val(entry) |= _PAGE_RO; |
420 | (pte_val(pteval) & _PAGE_SWX)) | ||
421 | pte_val(*shadow_pte) = pte_val(pteval) | _PAGE_RO; | ||
422 | else | 401 | else |
423 | pte_val(*shadow_pte) = _PAGE_TYPE_EMPTY; | 402 | pte_val(entry) = _PAGE_TYPE_EMPTY; |
403 | ptep[PTRS_PER_PTE] = entry; | ||
424 | } | 404 | } |
425 | } | 405 | } |
426 | 406 | ||
@@ -439,24 +419,58 @@ static inline int pud_bad(pud_t pud) { return 0; } | |||
439 | 419 | ||
440 | #else /* __s390x__ */ | 420 | #else /* __s390x__ */ |
441 | 421 | ||
442 | static inline int pgd_present(pgd_t pgd) { return 1; } | 422 | static inline int pgd_present(pgd_t pgd) |
443 | static inline int pgd_none(pgd_t pgd) { return 0; } | 423 | { |
444 | static inline int pgd_bad(pgd_t pgd) { return 0; } | 424 | if ((pgd_val(pgd) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R2) |
425 | return 1; | ||
426 | return (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) != 0UL; | ||
427 | } | ||
428 | |||
429 | static inline int pgd_none(pgd_t pgd) | ||
430 | { | ||
431 | if ((pgd_val(pgd) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R2) | ||
432 | return 0; | ||
433 | return (pgd_val(pgd) & _REGION_ENTRY_INV) != 0UL; | ||
434 | } | ||
435 | |||
436 | static inline int pgd_bad(pgd_t pgd) | ||
437 | { | ||
438 | /* | ||
439 | * With dynamic page table levels the pgd can be a region table | ||
440 | * entry or a segment table entry. Check for the bit that are | ||
441 | * invalid for either table entry. | ||
442 | */ | ||
443 | unsigned long mask = | ||
444 | ~_SEGMENT_ENTRY_ORIGIN & ~_REGION_ENTRY_INV & | ||
445 | ~_REGION_ENTRY_TYPE_MASK & ~_REGION_ENTRY_LENGTH; | ||
446 | return (pgd_val(pgd) & mask) != 0; | ||
447 | } | ||
445 | 448 | ||
446 | static inline int pud_present(pud_t pud) | 449 | static inline int pud_present(pud_t pud) |
447 | { | 450 | { |
451 | if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R3) | ||
452 | return 1; | ||
448 | return (pud_val(pud) & _REGION_ENTRY_ORIGIN) != 0UL; | 453 | return (pud_val(pud) & _REGION_ENTRY_ORIGIN) != 0UL; |
449 | } | 454 | } |
450 | 455 | ||
451 | static inline int pud_none(pud_t pud) | 456 | static inline int pud_none(pud_t pud) |
452 | { | 457 | { |
458 | if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) < _REGION_ENTRY_TYPE_R3) | ||
459 | return 0; | ||
453 | return (pud_val(pud) & _REGION_ENTRY_INV) != 0UL; | 460 | return (pud_val(pud) & _REGION_ENTRY_INV) != 0UL; |
454 | } | 461 | } |
455 | 462 | ||
456 | static inline int pud_bad(pud_t pud) | 463 | static inline int pud_bad(pud_t pud) |
457 | { | 464 | { |
458 | unsigned long mask = ~_REGION_ENTRY_ORIGIN & ~_REGION_ENTRY_INV; | 465 | /* |
459 | return (pud_val(pud) & mask) != _REGION3_ENTRY; | 466 | * With dynamic page table levels the pud can be a region table |
467 | * entry or a segment table entry. Check for the bit that are | ||
468 | * invalid for either table entry. | ||
469 | */ | ||
470 | unsigned long mask = | ||
471 | ~_SEGMENT_ENTRY_ORIGIN & ~_REGION_ENTRY_INV & | ||
472 | ~_REGION_ENTRY_TYPE_MASK & ~_REGION_ENTRY_LENGTH; | ||
473 | return (pud_val(pud) & mask) != 0; | ||
460 | } | 474 | } |
461 | 475 | ||
462 | #endif /* __s390x__ */ | 476 | #endif /* __s390x__ */ |
@@ -535,24 +549,30 @@ static inline int pte_young(pte_t pte) | |||
535 | #define pgd_clear(pgd) do { } while (0) | 549 | #define pgd_clear(pgd) do { } while (0) |
536 | #define pud_clear(pud) do { } while (0) | 550 | #define pud_clear(pud) do { } while (0) |
537 | 551 | ||
538 | static inline void pmd_clear_kernel(pmd_t * pmdp) | 552 | #else /* __s390x__ */ |
553 | |||
554 | static inline void pgd_clear_kernel(pgd_t * pgd) | ||
539 | { | 555 | { |
540 | pmd_val(pmdp[0]) = _SEGMENT_ENTRY_EMPTY; | 556 | if ((pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R2) |
541 | pmd_val(pmdp[1]) = _SEGMENT_ENTRY_EMPTY; | 557 | pgd_val(*pgd) = _REGION2_ENTRY_EMPTY; |
542 | pmd_val(pmdp[2]) = _SEGMENT_ENTRY_EMPTY; | ||
543 | pmd_val(pmdp[3]) = _SEGMENT_ENTRY_EMPTY; | ||
544 | } | 558 | } |
545 | 559 | ||
546 | #else /* __s390x__ */ | 560 | static inline void pgd_clear(pgd_t * pgd) |
561 | { | ||
562 | pgd_t *shadow = get_shadow_table(pgd); | ||
547 | 563 | ||
548 | #define pgd_clear(pgd) do { } while (0) | 564 | pgd_clear_kernel(pgd); |
565 | if (shadow) | ||
566 | pgd_clear_kernel(shadow); | ||
567 | } | ||
549 | 568 | ||
550 | static inline void pud_clear_kernel(pud_t *pud) | 569 | static inline void pud_clear_kernel(pud_t *pud) |
551 | { | 570 | { |
552 | pud_val(*pud) = _REGION3_ENTRY_EMPTY; | 571 | if ((pud_val(*pud) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3) |
572 | pud_val(*pud) = _REGION3_ENTRY_EMPTY; | ||
553 | } | 573 | } |
554 | 574 | ||
555 | static inline void pud_clear(pud_t * pud) | 575 | static inline void pud_clear(pud_t *pud) |
556 | { | 576 | { |
557 | pud_t *shadow = get_shadow_table(pud); | 577 | pud_t *shadow = get_shadow_table(pud); |
558 | 578 | ||
@@ -561,30 +581,27 @@ static inline void pud_clear(pud_t * pud) | |||
561 | pud_clear_kernel(shadow); | 581 | pud_clear_kernel(shadow); |
562 | } | 582 | } |
563 | 583 | ||
584 | #endif /* __s390x__ */ | ||
585 | |||
564 | static inline void pmd_clear_kernel(pmd_t * pmdp) | 586 | static inline void pmd_clear_kernel(pmd_t * pmdp) |
565 | { | 587 | { |
566 | pmd_val(*pmdp) = _SEGMENT_ENTRY_EMPTY; | 588 | pmd_val(*pmdp) = _SEGMENT_ENTRY_EMPTY; |
567 | pmd_val1(*pmdp) = _SEGMENT_ENTRY_EMPTY; | ||
568 | } | 589 | } |
569 | 590 | ||
570 | #endif /* __s390x__ */ | 591 | static inline void pmd_clear(pmd_t *pmd) |
571 | |||
572 | static inline void pmd_clear(pmd_t * pmdp) | ||
573 | { | 592 | { |
574 | pmd_t *shadow_pmd = get_shadow_table(pmdp); | 593 | pmd_t *shadow = get_shadow_table(pmd); |
575 | 594 | ||
576 | pmd_clear_kernel(pmdp); | 595 | pmd_clear_kernel(pmd); |
577 | if (shadow_pmd) | 596 | if (shadow) |
578 | pmd_clear_kernel(shadow_pmd); | 597 | pmd_clear_kernel(shadow); |
579 | } | 598 | } |
580 | 599 | ||
581 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 600 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
582 | { | 601 | { |
583 | pte_t *shadow_pte = get_shadow_pte(ptep); | ||
584 | |||
585 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; | 602 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; |
586 | if (shadow_pte) | 603 | if (mm->context.noexec) |
587 | pte_val(*shadow_pte) = _PAGE_TYPE_EMPTY; | 604 | pte_val(ptep[PTRS_PER_PTE]) = _PAGE_TYPE_EMPTY; |
588 | } | 605 | } |
589 | 606 | ||
590 | /* | 607 | /* |
@@ -665,7 +682,7 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep) | |||
665 | { | 682 | { |
666 | if (!(pte_val(*ptep) & _PAGE_INVALID)) { | 683 | if (!(pte_val(*ptep) & _PAGE_INVALID)) { |
667 | #ifndef __s390x__ | 684 | #ifndef __s390x__ |
668 | /* S390 has 1mb segments, we are emulating 4MB segments */ | 685 | /* pto must point to the start of the segment table */ |
669 | pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); | 686 | pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); |
670 | #else | 687 | #else |
671 | /* ipte in zarch mode can do the math */ | 688 | /* ipte in zarch mode can do the math */ |
@@ -679,12 +696,12 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep) | |||
679 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; | 696 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; |
680 | } | 697 | } |
681 | 698 | ||
682 | static inline void ptep_invalidate(unsigned long address, pte_t *ptep) | 699 | static inline void ptep_invalidate(struct mm_struct *mm, |
700 | unsigned long address, pte_t *ptep) | ||
683 | { | 701 | { |
684 | __ptep_ipte(address, ptep); | 702 | __ptep_ipte(address, ptep); |
685 | ptep = get_shadow_pte(ptep); | 703 | if (mm->context.noexec) |
686 | if (ptep) | 704 | __ptep_ipte(address, ptep + PTRS_PER_PTE); |
687 | __ptep_ipte(address, ptep); | ||
688 | } | 705 | } |
689 | 706 | ||
690 | /* | 707 | /* |
@@ -706,7 +723,7 @@ static inline void ptep_invalidate(unsigned long address, pte_t *ptep) | |||
706 | pte_t __pte = *(__ptep); \ | 723 | pte_t __pte = *(__ptep); \ |
707 | if (atomic_read(&(__mm)->mm_users) > 1 || \ | 724 | if (atomic_read(&(__mm)->mm_users) > 1 || \ |
708 | (__mm) != current->active_mm) \ | 725 | (__mm) != current->active_mm) \ |
709 | ptep_invalidate(__address, __ptep); \ | 726 | ptep_invalidate(__mm, __address, __ptep); \ |
710 | else \ | 727 | else \ |
711 | pte_clear((__mm), (__address), (__ptep)); \ | 728 | pte_clear((__mm), (__address), (__ptep)); \ |
712 | __pte; \ | 729 | __pte; \ |
@@ -717,7 +734,7 @@ static inline pte_t ptep_clear_flush(struct vm_area_struct *vma, | |||
717 | unsigned long address, pte_t *ptep) | 734 | unsigned long address, pte_t *ptep) |
718 | { | 735 | { |
719 | pte_t pte = *ptep; | 736 | pte_t pte = *ptep; |
720 | ptep_invalidate(address, ptep); | 737 | ptep_invalidate(vma->vm_mm, address, ptep); |
721 | return pte; | 738 | return pte; |
722 | } | 739 | } |
723 | 740 | ||
@@ -738,7 +755,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, | |||
738 | if (full) | 755 | if (full) |
739 | pte_clear(mm, addr, ptep); | 756 | pte_clear(mm, addr, ptep); |
740 | else | 757 | else |
741 | ptep_invalidate(addr, ptep); | 758 | ptep_invalidate(mm, addr, ptep); |
742 | return pte; | 759 | return pte; |
743 | } | 760 | } |
744 | 761 | ||
@@ -749,7 +766,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, | |||
749 | if (pte_write(__pte)) { \ | 766 | if (pte_write(__pte)) { \ |
750 | if (atomic_read(&(__mm)->mm_users) > 1 || \ | 767 | if (atomic_read(&(__mm)->mm_users) > 1 || \ |
751 | (__mm) != current->active_mm) \ | 768 | (__mm) != current->active_mm) \ |
752 | ptep_invalidate(__addr, __ptep); \ | 769 | ptep_invalidate(__mm, __addr, __ptep); \ |
753 | set_pte_at(__mm, __addr, __ptep, pte_wrprotect(__pte)); \ | 770 | set_pte_at(__mm, __addr, __ptep, pte_wrprotect(__pte)); \ |
754 | } \ | 771 | } \ |
755 | }) | 772 | }) |
@@ -759,7 +776,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, | |||
759 | ({ \ | 776 | ({ \ |
760 | int __changed = !pte_same(*(__ptep), __entry); \ | 777 | int __changed = !pte_same(*(__ptep), __entry); \ |
761 | if (__changed) { \ | 778 | if (__changed) { \ |
762 | ptep_invalidate(__addr, __ptep); \ | 779 | ptep_invalidate((__vma)->vm_mm, __addr, __ptep); \ |
763 | set_pte_at((__vma)->vm_mm, __addr, __ptep, __entry); \ | 780 | set_pte_at((__vma)->vm_mm, __addr, __ptep, __entry); \ |
764 | } \ | 781 | } \ |
765 | __changed; \ | 782 | __changed; \ |
@@ -840,13 +857,21 @@ static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) | |||
840 | 857 | ||
841 | #define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) | 858 | #define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) |
842 | #define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN) | 859 | #define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN) |
843 | #define pgd_deref(pgd) ({ BUG(); 0UL; }) | 860 | #define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) |
844 | 861 | ||
845 | #define pud_offset(pgd, address) ((pud_t *) pgd) | 862 | static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address) |
863 | { | ||
864 | pud_t *pud = (pud_t *) pgd; | ||
865 | if ((pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R2) | ||
866 | pud = (pud_t *) pgd_deref(*pgd); | ||
867 | return pud + pud_index(address); | ||
868 | } | ||
846 | 869 | ||
847 | static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address) | 870 | static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address) |
848 | { | 871 | { |
849 | pmd_t *pmd = (pmd_t *) pud_deref(*pud); | 872 | pmd_t *pmd = (pmd_t *) pud; |
873 | if ((pud_val(*pud) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3) | ||
874 | pmd = (pmd_t *) pud_deref(*pud); | ||
850 | return pmd + pmd_index(address); | 875 | return pmd + pmd_index(address); |
851 | } | 876 | } |
852 | 877 | ||
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index e8785634cbdb..51d88912aa20 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h | |||
@@ -64,24 +64,29 @@ extern int get_cpu_capability(unsigned int *); | |||
64 | */ | 64 | */ |
65 | #ifndef __s390x__ | 65 | #ifndef __s390x__ |
66 | 66 | ||
67 | # define TASK_SIZE (0x80000000UL) | 67 | #define TASK_SIZE (1UL << 31) |
68 | # define TASK_UNMAPPED_BASE (TASK_SIZE / 2) | 68 | #define TASK_UNMAPPED_BASE (1UL << 30) |
69 | # define DEFAULT_TASK_SIZE (0x80000000UL) | ||
70 | 69 | ||
71 | #else /* __s390x__ */ | 70 | #else /* __s390x__ */ |
72 | 71 | ||
73 | # define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_31BIT) ? \ | 72 | #define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk,TIF_31BIT) ? \ |
74 | (0x80000000UL) : (0x40000000000UL)) | 73 | (1UL << 31) : (1UL << 53)) |
75 | # define TASK_SIZE TASK_SIZE_OF(current) | 74 | #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \ |
76 | # define TASK_UNMAPPED_BASE (TASK_SIZE / 2) | 75 | (1UL << 30) : (1UL << 41)) |
77 | # define DEFAULT_TASK_SIZE (0x40000000000UL) | 76 | #define TASK_SIZE TASK_SIZE_OF(current) |
78 | 77 | ||
79 | #endif /* __s390x__ */ | 78 | #endif /* __s390x__ */ |
80 | 79 | ||
81 | #ifdef __KERNEL__ | 80 | #ifdef __KERNEL__ |
82 | 81 | ||
83 | #define STACK_TOP TASK_SIZE | 82 | #ifndef __s390x__ |
84 | #define STACK_TOP_MAX DEFAULT_TASK_SIZE | 83 | #define STACK_TOP (1UL << 31) |
84 | #define STACK_TOP_MAX (1UL << 31) | ||
85 | #else /* __s390x__ */ | ||
86 | #define STACK_TOP (1UL << (test_thread_flag(TIF_31BIT) ? 31:42)) | ||
87 | #define STACK_TOP_MAX (1UL << 42) | ||
88 | #endif /* __s390x__ */ | ||
89 | |||
85 | 90 | ||
86 | #endif | 91 | #endif |
87 | 92 | ||
@@ -138,8 +143,6 @@ struct stack_frame { | |||
138 | /* | 143 | /* |
139 | * Do necessary setup to start up a new thread. | 144 | * Do necessary setup to start up a new thread. |
140 | */ | 145 | */ |
141 | #ifndef __s390x__ | ||
142 | |||
143 | #define start_thread(regs, new_psw, new_stackp) do { \ | 146 | #define start_thread(regs, new_psw, new_stackp) do { \ |
144 | set_fs(USER_DS); \ | 147 | set_fs(USER_DS); \ |
145 | regs->psw.mask = psw_user_bits; \ | 148 | regs->psw.mask = psw_user_bits; \ |
@@ -147,24 +150,6 @@ struct stack_frame { | |||
147 | regs->gprs[15] = new_stackp ; \ | 150 | regs->gprs[15] = new_stackp ; \ |
148 | } while (0) | 151 | } while (0) |
149 | 152 | ||
150 | #else /* __s390x__ */ | ||
151 | |||
152 | #define start_thread(regs, new_psw, new_stackp) do { \ | ||
153 | set_fs(USER_DS); \ | ||
154 | regs->psw.mask = psw_user_bits; \ | ||
155 | regs->psw.addr = new_psw; \ | ||
156 | regs->gprs[15] = new_stackp; \ | ||
157 | } while (0) | ||
158 | |||
159 | #define start_thread31(regs, new_psw, new_stackp) do { \ | ||
160 | set_fs(USER_DS); \ | ||
161 | regs->psw.mask = psw_user32_bits; \ | ||
162 | regs->psw.addr = new_psw; \ | ||
163 | regs->gprs[15] = new_stackp; \ | ||
164 | } while (0) | ||
165 | |||
166 | #endif /* __s390x__ */ | ||
167 | |||
168 | /* Forward declaration, a strange C thing */ | 153 | /* Forward declaration, a strange C thing */ |
169 | struct task_struct; | 154 | struct task_struct; |
170 | struct mm_struct; | 155 | struct mm_struct; |
diff --git a/include/asm-s390/tlb.h b/include/asm-s390/tlb.h index 3c8177fa9e06..3d8a96d39d9d 100644 --- a/include/asm-s390/tlb.h +++ b/include/asm-s390/tlb.h | |||
@@ -38,7 +38,7 @@ struct mmu_gather { | |||
38 | struct mm_struct *mm; | 38 | struct mm_struct *mm; |
39 | unsigned int fullmm; | 39 | unsigned int fullmm; |
40 | unsigned int nr_ptes; | 40 | unsigned int nr_ptes; |
41 | unsigned int nr_pmds; | 41 | unsigned int nr_pxds; |
42 | void *array[TLB_NR_PTRS]; | 42 | void *array[TLB_NR_PTRS]; |
43 | }; | 43 | }; |
44 | 44 | ||
@@ -53,7 +53,7 @@ static inline struct mmu_gather *tlb_gather_mmu(struct mm_struct *mm, | |||
53 | tlb->fullmm = full_mm_flush || (num_online_cpus() == 1) || | 53 | tlb->fullmm = full_mm_flush || (num_online_cpus() == 1) || |
54 | (atomic_read(&mm->mm_users) <= 1 && mm == current->active_mm); | 54 | (atomic_read(&mm->mm_users) <= 1 && mm == current->active_mm); |
55 | tlb->nr_ptes = 0; | 55 | tlb->nr_ptes = 0; |
56 | tlb->nr_pmds = TLB_NR_PTRS; | 56 | tlb->nr_pxds = TLB_NR_PTRS; |
57 | if (tlb->fullmm) | 57 | if (tlb->fullmm) |
58 | __tlb_flush_mm(mm); | 58 | __tlb_flush_mm(mm); |
59 | return tlb; | 59 | return tlb; |
@@ -62,12 +62,13 @@ static inline struct mmu_gather *tlb_gather_mmu(struct mm_struct *mm, | |||
62 | static inline void tlb_flush_mmu(struct mmu_gather *tlb, | 62 | static inline void tlb_flush_mmu(struct mmu_gather *tlb, |
63 | unsigned long start, unsigned long end) | 63 | unsigned long start, unsigned long end) |
64 | { | 64 | { |
65 | if (!tlb->fullmm && (tlb->nr_ptes > 0 || tlb->nr_pmds < TLB_NR_PTRS)) | 65 | if (!tlb->fullmm && (tlb->nr_ptes > 0 || tlb->nr_pxds < TLB_NR_PTRS)) |
66 | __tlb_flush_mm(tlb->mm); | 66 | __tlb_flush_mm(tlb->mm); |
67 | while (tlb->nr_ptes > 0) | 67 | while (tlb->nr_ptes > 0) |
68 | pte_free(tlb->mm, tlb->array[--tlb->nr_ptes]); | 68 | pte_free(tlb->mm, tlb->array[--tlb->nr_ptes]); |
69 | while (tlb->nr_pmds < TLB_NR_PTRS) | 69 | while (tlb->nr_pxds < TLB_NR_PTRS) |
70 | pmd_free(tlb->mm, (pmd_t *) tlb->array[tlb->nr_pmds++]); | 70 | /* pgd_free frees the pointer as region or segment table */ |
71 | pgd_free(tlb->mm, tlb->array[tlb->nr_pxds++]); | ||
71 | } | 72 | } |
72 | 73 | ||
73 | static inline void tlb_finish_mmu(struct mmu_gather *tlb, | 74 | static inline void tlb_finish_mmu(struct mmu_gather *tlb, |
@@ -95,33 +96,57 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) | |||
95 | * pte_free_tlb frees a pte table and clears the CRSTE for the | 96 | * pte_free_tlb frees a pte table and clears the CRSTE for the |
96 | * page table from the tlb. | 97 | * page table from the tlb. |
97 | */ | 98 | */ |
98 | static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t page) | 99 | static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte) |
99 | { | 100 | { |
100 | if (!tlb->fullmm) { | 101 | if (!tlb->fullmm) { |
101 | tlb->array[tlb->nr_ptes++] = page; | 102 | tlb->array[tlb->nr_ptes++] = pte; |
102 | if (tlb->nr_ptes >= tlb->nr_pmds) | 103 | if (tlb->nr_ptes >= tlb->nr_pxds) |
103 | tlb_flush_mmu(tlb, 0, 0); | 104 | tlb_flush_mmu(tlb, 0, 0); |
104 | } else | 105 | } else |
105 | pte_free(tlb->mm, page); | 106 | pte_free(tlb->mm, pte); |
106 | } | 107 | } |
107 | 108 | ||
108 | /* | 109 | /* |
109 | * pmd_free_tlb frees a pmd table and clears the CRSTE for the | 110 | * pmd_free_tlb frees a pmd table and clears the CRSTE for the |
110 | * segment table entry from the tlb. | 111 | * segment table entry from the tlb. |
112 | * If the mm uses a two level page table the single pmd is freed | ||
113 | * as the pgd. pmd_free_tlb checks the asce_limit against 2GB | ||
114 | * to avoid the double free of the pmd in this case. | ||
111 | */ | 115 | */ |
112 | static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) | 116 | static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) |
113 | { | 117 | { |
114 | #ifdef __s390x__ | 118 | #ifdef __s390x__ |
119 | if (tlb->mm->context.asce_limit <= (1UL << 31)) | ||
120 | return; | ||
115 | if (!tlb->fullmm) { | 121 | if (!tlb->fullmm) { |
116 | tlb->array[--tlb->nr_pmds] = (struct page *) pmd; | 122 | tlb->array[--tlb->nr_pxds] = pmd; |
117 | if (tlb->nr_ptes >= tlb->nr_pmds) | 123 | if (tlb->nr_ptes >= tlb->nr_pxds) |
118 | tlb_flush_mmu(tlb, 0, 0); | 124 | tlb_flush_mmu(tlb, 0, 0); |
119 | } else | 125 | } else |
120 | pmd_free(tlb->mm, pmd); | 126 | pmd_free(tlb->mm, pmd); |
121 | #endif | 127 | #endif |
122 | } | 128 | } |
123 | 129 | ||
124 | #define pud_free_tlb(tlb, pud) do { } while (0) | 130 | /* |
131 | * pud_free_tlb frees a pud table and clears the CRSTE for the | ||
132 | * region third table entry from the tlb. | ||
133 | * If the mm uses a three level page table the single pud is freed | ||
134 | * as the pgd. pud_free_tlb checks the asce_limit against 4TB | ||
135 | * to avoid the double free of the pud in this case. | ||
136 | */ | ||
137 | static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud) | ||
138 | { | ||
139 | #ifdef __s390x__ | ||
140 | if (tlb->mm->context.asce_limit <= (1UL << 42)) | ||
141 | return; | ||
142 | if (!tlb->fullmm) { | ||
143 | tlb->array[--tlb->nr_pxds] = pud; | ||
144 | if (tlb->nr_ptes >= tlb->nr_pxds) | ||
145 | tlb_flush_mmu(tlb, 0, 0); | ||
146 | } else | ||
147 | pud_free(tlb->mm, pud); | ||
148 | #endif | ||
149 | } | ||
125 | 150 | ||
126 | #define tlb_start_vma(tlb, vma) do { } while (0) | 151 | #define tlb_start_vma(tlb, vma) do { } while (0) |
127 | #define tlb_end_vma(tlb, vma) do { } while (0) | 152 | #define tlb_end_vma(tlb, vma) do { } while (0) |
diff --git a/include/asm-s390/tlbflush.h b/include/asm-s390/tlbflush.h index 70fa5ae58180..35fb4f9127b2 100644 --- a/include/asm-s390/tlbflush.h +++ b/include/asm-s390/tlbflush.h | |||
@@ -61,11 +61,12 @@ static inline void __tlb_flush_mm(struct mm_struct * mm) | |||
61 | * only ran on the local cpu. | 61 | * only ran on the local cpu. |
62 | */ | 62 | */ |
63 | if (MACHINE_HAS_IDTE) { | 63 | if (MACHINE_HAS_IDTE) { |
64 | pgd_t *shadow = get_shadow_table(mm->pgd); | 64 | if (mm->context.noexec) |
65 | 65 | __tlb_flush_idte((unsigned long) | |
66 | if (shadow) | 66 | get_shadow_table(mm->pgd) | |
67 | __tlb_flush_idte((unsigned long) shadow | mm->context); | 67 | mm->context.asce_bits); |
68 | __tlb_flush_idte((unsigned long) mm->pgd | mm->context); | 68 | __tlb_flush_idte((unsigned long) mm->pgd | |
69 | mm->context.asce_bits); | ||
69 | return; | 70 | return; |
70 | } | 71 | } |
71 | preempt_disable(); | 72 | preempt_disable(); |
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index f04acb2670a8..583da807ea97 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h | |||
@@ -256,7 +256,10 @@ | |||
256 | #define __NR_signalfd 316 | 256 | #define __NR_signalfd 316 |
257 | #define __NR_timerfd 317 | 257 | #define __NR_timerfd 317 |
258 | #define __NR_eventfd 318 | 258 | #define __NR_eventfd 318 |
259 | #define NR_syscalls 319 | 259 | #define __NR_timerfd_create 319 |
260 | #define __NR_timerfd_settime 320 | ||
261 | #define __NR_timerfd_gettime 321 | ||
262 | #define NR_syscalls 322 | ||
260 | 263 | ||
261 | /* | 264 | /* |
262 | * There are some system calls that are not present on 64 bit, some | 265 | * There are some system calls that are not present on 64 bit, some |
diff --git a/include/asm-sparc/a.out.h b/include/asm-sparc/a.out.h index 744cfe6c0de8..2f1c3748a068 100644 --- a/include/asm-sparc/a.out.h +++ b/include/asm-sparc/a.out.h | |||
@@ -1,24 +1,27 @@ | |||
1 | /* $Id: a.out.h,v 1.13 2000/01/09 10:46:53 anton Exp $ */ | ||
2 | #ifndef __SPARC_A_OUT_H__ | 1 | #ifndef __SPARC_A_OUT_H__ |
3 | #define __SPARC_A_OUT_H__ | 2 | #define __SPARC_A_OUT_H__ |
4 | 3 | ||
5 | #define SPARC_PGSIZE 0x2000 /* Thanks to the sun4 architecture... */ | 4 | #define SPARC_PGSIZE 0x2000 /* Thanks to the sun4 architecture... */ |
6 | #define SEGMENT_SIZE SPARC_PGSIZE /* whee... */ | 5 | #define SEGMENT_SIZE SPARC_PGSIZE /* whee... */ |
7 | 6 | ||
7 | #ifndef __ASSEMBLY__ | ||
8 | |||
8 | struct exec { | 9 | struct exec { |
9 | unsigned char a_dynamic:1; /* A __DYNAMIC is in this image */ | 10 | unsigned char a_dynamic:1; /* A __DYNAMIC is in this image */ |
10 | unsigned char a_toolversion:7; | 11 | unsigned char a_toolversion:7; |
11 | unsigned char a_machtype; | 12 | unsigned char a_machtype; |
12 | unsigned short a_info; | 13 | unsigned short a_info; |
13 | unsigned long a_text; /* length of text, in bytes */ | 14 | unsigned int a_text; /* length of text, in bytes */ |
14 | unsigned long a_data; /* length of data, in bytes */ | 15 | unsigned int a_data; /* length of data, in bytes */ |
15 | unsigned long a_bss; /* length of bss, in bytes */ | 16 | unsigned int a_bss; /* length of bss, in bytes */ |
16 | unsigned long a_syms; /* length of symbol table, in bytes */ | 17 | unsigned int a_syms; /* length of symbol table, in bytes */ |
17 | unsigned long a_entry; /* where program begins */ | 18 | unsigned int a_entry; /* where program begins */ |
18 | unsigned long a_trsize; | 19 | unsigned int a_trsize; |
19 | unsigned long a_drsize; | 20 | unsigned int a_drsize; |
20 | }; | 21 | }; |
21 | 22 | ||
23 | #endif /* !__ASSEMBLY__ */ | ||
24 | |||
22 | /* Where in the file does the text information begin? */ | 25 | /* Where in the file does the text information begin? */ |
23 | #define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec)) | 26 | #define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec)) |
24 | 27 | ||
@@ -28,19 +31,21 @@ struct exec { | |||
28 | (x).a_drsize) | 31 | (x).a_drsize) |
29 | 32 | ||
30 | /* Where does text segment go in memory after being loaded? */ | 33 | /* Where does text segment go in memory after being loaded? */ |
31 | #define N_TXTADDR(x) (((N_MAGIC(x) == ZMAGIC) && \ | 34 | #define N_TXTADDR(x) (unsigned long)(((N_MAGIC(x) == ZMAGIC) && \ |
32 | ((x).a_entry < SPARC_PGSIZE)) ? \ | 35 | ((x).a_entry < SPARC_PGSIZE)) ? \ |
33 | 0 : SPARC_PGSIZE) | 36 | 0 : SPARC_PGSIZE) |
34 | 37 | ||
35 | /* And same for the data segment.. */ | 38 | /* And same for the data segment.. */ |
36 | #define N_DATADDR(x) (N_MAGIC(x)==OMAGIC ? \ | 39 | #define N_DATADDR(x) (N_MAGIC(x)==OMAGIC ? \ |
37 | (N_TXTADDR(x) + (x).a_text) \ | 40 | (N_TXTADDR(x) + (x).a_text) \ |
38 | : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) | 41 | : (unsigned long) (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) |
39 | 42 | ||
40 | #define N_TRSIZE(a) ((a).a_trsize) | 43 | #define N_TRSIZE(a) ((a).a_trsize) |
41 | #define N_DRSIZE(a) ((a).a_drsize) | 44 | #define N_DRSIZE(a) ((a).a_drsize) |
42 | #define N_SYMSIZE(a) ((a).a_syms) | 45 | #define N_SYMSIZE(a) ((a).a_syms) |
43 | 46 | ||
47 | #ifndef __ASSEMBLY__ | ||
48 | |||
44 | /* | 49 | /* |
45 | * Sparc relocation types | 50 | * Sparc relocation types |
46 | */ | 51 | */ |
@@ -77,14 +82,16 @@ enum reloc_type | |||
77 | */ | 82 | */ |
78 | struct relocation_info /* used when header.a_machtype == M_SPARC */ | 83 | struct relocation_info /* used when header.a_machtype == M_SPARC */ |
79 | { | 84 | { |
80 | unsigned long r_address; /* relocation addr */ | 85 | unsigned int r_address; /* relocation addr */ |
81 | unsigned int r_index:24; /* segment index or symbol index */ | 86 | unsigned int r_index:24; /* segment index or symbol index */ |
82 | unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ | 87 | unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ |
83 | unsigned int r_pad:2; /* <unused> */ | 88 | unsigned int r_pad:2; /* <unused> */ |
84 | enum reloc_type r_type:5; /* type of relocation to perform */ | 89 | enum reloc_type r_type:5; /* type of relocation to perform */ |
85 | long r_addend; /* addend for relocation value */ | 90 | int r_addend; /* addend for relocation value */ |
86 | }; | 91 | }; |
87 | 92 | ||
88 | #define N_RELOCATION_INFO_DECLARED 1 | 93 | #define N_RELOCATION_INFO_DECLARED 1 |
89 | 94 | ||
95 | #endif /* !(__ASSEMBLY__) */ | ||
96 | |||
90 | #endif /* __SPARC_A_OUT_H__ */ | 97 | #endif /* __SPARC_A_OUT_H__ */ |
diff --git a/include/asm-sparc/bpp.h b/include/asm-sparc/bpp.h index 3578ac113cf0..31f515e499a7 100644 --- a/include/asm-sparc/bpp.h +++ b/include/asm-sparc/bpp.h | |||
@@ -17,7 +17,7 @@ | |||
17 | * with compliant or compatible devices. It will use whatever features | 17 | * with compliant or compatible devices. It will use whatever features |
18 | * the device supports, prefering those that are typically faster. | 18 | * the device supports, prefering those that are typically faster. |
19 | * | 19 | * |
20 | * When the device is opened, it is left in COMPATABILITY mode, and | 20 | * When the device is opened, it is left in COMPATIBILITY mode, and |
21 | * writes work like any printer device. The driver only attempt to | 21 | * writes work like any printer device. The driver only attempt to |
22 | * negotiate 1284 modes when needed so that plugs can be pulled, | 22 | * negotiate 1284 modes when needed so that plugs can be pulled, |
23 | * switch boxes switched, etc., without disrupting things. It will | 23 | * switch boxes switched, etc., without disrupting things. It will |
diff --git a/include/asm-sparc/bsderrno.h b/include/asm-sparc/bsderrno.h deleted file mode 100644 index 54a75be43abb..000000000000 --- a/include/asm-sparc/bsderrno.h +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* $Id: bsderrno.h,v 1.3 1996/04/25 06:12:47 davem Exp $ | ||
2 | * bsderrno.h: Error numbers for NetBSD binary compatibility | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC_BSDERRNO_H | ||
8 | #define _SPARC_BSDERRNO_H | ||
9 | |||
10 | #define BSD_EPERM 1 /* Operation not permitted */ | ||
11 | #define BSD_ENOENT 2 /* No such file or directory */ | ||
12 | #define BSD_ESRCH 3 /* No such process */ | ||
13 | #define BSD_EINTR 4 /* Interrupted system call */ | ||
14 | #define BSD_EIO 5 /* Input/output error */ | ||
15 | #define BSD_ENXIO 6 /* Device not configured */ | ||
16 | #define BSD_E2BIG 7 /* Argument list too long */ | ||
17 | #define BSD_ENOEXEC 8 /* Exec format error */ | ||
18 | #define BSD_EBADF 9 /* Bad file descriptor */ | ||
19 | #define BSD_ECHILD 10 /* No child processes */ | ||
20 | #define BSD_EDEADLK 11 /* Resource deadlock avoided */ | ||
21 | #define BSD_ENOMEM 12 /* Cannot allocate memory */ | ||
22 | #define BSD_EACCES 13 /* Permission denied */ | ||
23 | #define BSD_EFAULT 14 /* Bad address */ | ||
24 | #define BSD_ENOTBLK 15 /* Block device required */ | ||
25 | #define BSD_EBUSY 16 /* Device busy */ | ||
26 | #define BSD_EEXIST 17 /* File exists */ | ||
27 | #define BSD_EXDEV 18 /* Cross-device link */ | ||
28 | #define BSD_ENODEV 19 /* Operation not supported by device */ | ||
29 | #define BSD_ENOTDIR 20 /* Not a directory */ | ||
30 | #define BSD_EISDIR 21 /* Is a directory */ | ||
31 | #define BSD_EINVAL 22 /* Invalid argument */ | ||
32 | #define BSD_ENFILE 23 /* Too many open files in system */ | ||
33 | #define BSD_EMFILE 24 /* Too many open files */ | ||
34 | #define BSD_ENOTTY 25 /* Inappropriate ioctl for device */ | ||
35 | #define BSD_ETXTBSY 26 /* Text file busy */ | ||
36 | #define BSD_EFBIG 27 /* File too large */ | ||
37 | #define BSD_ENOSPC 28 /* No space left on device */ | ||
38 | #define BSD_ESPIPE 29 /* Illegal seek */ | ||
39 | #define BSD_EROFS 30 /* Read-only file system */ | ||
40 | #define BSD_EMLINK 31 /* Too many links */ | ||
41 | #define BSD_EPIPE 32 /* Broken pipe */ | ||
42 | #define BSD_EDOM 33 /* Numerical argument out of domain */ | ||
43 | #define BSD_ERANGE 34 /* Result too large */ | ||
44 | #define BSD_EAGAIN 35 /* Resource temporarily unavailable */ | ||
45 | #define BSD_EWOULDBLOCK EAGAIN /* Operation would block */ | ||
46 | #define BSD_EINPROGRESS 36 /* Operation now in progress */ | ||
47 | #define BSD_EALREADY 37 /* Operation already in progress */ | ||
48 | #define BSD_ENOTSOCK 38 /* Socket operation on non-socket */ | ||
49 | #define BSD_EDESTADDRREQ 39 /* Destination address required */ | ||
50 | #define BSD_EMSGSIZE 40 /* Message too long */ | ||
51 | #define BSD_EPROTOTYPE 41 /* Protocol wrong type for socket */ | ||
52 | #define BSD_ENOPROTOOPT 42 /* Protocol not available */ | ||
53 | #define BSD_EPROTONOSUPPORT 43 /* Protocol not supported */ | ||
54 | #define BSD_ESOCKTNOSUPPORT 44 /* Socket type not supported */ | ||
55 | #define BSD_EOPNOTSUPP 45 /* Operation not supported */ | ||
56 | #define BSD_EPFNOSUPPORT 46 /* Protocol family not supported */ | ||
57 | #define BSD_EAFNOSUPPORT 47 /* Address family not supported by protocol family */ | ||
58 | #define BSD_EADDRINUSE 48 /* Address already in use */ | ||
59 | #define BSD_EADDRNOTAVAIL 49 /* Can't assign requested address */ | ||
60 | #define BSD_ENETDOWN 50 /* Network is down */ | ||
61 | #define BSD_ENETUNREACH 51 /* Network is unreachable */ | ||
62 | #define BSD_ENETRESET 52 /* Network dropped connection on reset */ | ||
63 | #define BSD_ECONNABORTED 53 /* Software caused connection abort */ | ||
64 | #define BSD_ECONNRESET 54 /* Connection reset by peer */ | ||
65 | #define BSD_ENOBUFS 55 /* No buffer space available */ | ||
66 | #define BSD_EISCONN 56 /* Socket is already connected */ | ||
67 | #define BSD_ENOTCONN 57 /* Socket is not connected */ | ||
68 | #define BSD_ESHUTDOWN 58 /* Can't send after socket shutdown */ | ||
69 | #define BSD_ETOOMANYREFS 59 /* Too many references: can't splice */ | ||
70 | #define BSD_ETIMEDOUT 60 /* Operation timed out */ | ||
71 | #define BSD_ECONNREFUSED 61 /* Connection refused */ | ||
72 | #define BSD_ELOOP 62 /* Too many levels of symbolic links */ | ||
73 | #define BSD_ENAMETOOLONG 63 /* File name too long */ | ||
74 | #define BSD_EHOSTDOWN 64 /* Host is down */ | ||
75 | #define BSD_EHOSTUNREACH 65 /* No route to host */ | ||
76 | #define BSD_ENOTEMPTY 66 /* Directory not empty */ | ||
77 | #define BSD_EPROCLIM 67 /* Too many processes */ | ||
78 | #define BSD_EUSERS 68 /* Too many users */ | ||
79 | #define BSD_EDQUOT 69 /* Disc quota exceeded */ | ||
80 | #define BSD_ESTALE 70 /* Stale NFS file handle */ | ||
81 | #define BSD_EREMOTE 71 /* Too many levels of remote in path */ | ||
82 | #define BSD_EBADRPC 72 /* RPC struct is bad */ | ||
83 | #define BSD_ERPCMISMATCH 73 /* RPC version wrong */ | ||
84 | #define BSD_EPROGUNAVAIL 74 /* RPC prog. not avail */ | ||
85 | #define BSD_EPROGMISMATCH 75 /* Program version wrong */ | ||
86 | #define BSD_EPROCUNAVAIL 76 /* Bad procedure for program */ | ||
87 | #define BSD_ENOLCK 77 /* No locks available */ | ||
88 | #define BSD_ENOSYS 78 /* Function not implemented */ | ||
89 | #define BSD_EFTYPE 79 /* Inappropriate file type or format */ | ||
90 | #define BSD_EAUTH 80 /* Authentication error */ | ||
91 | #define BSD_ENEEDAUTH 81 /* Need authenticator */ | ||
92 | #define BSD_ELAST 81 /* Must be equal largest errno */ | ||
93 | |||
94 | #endif /* !(_SPARC_BSDERRNO_H) */ | ||
diff --git a/include/asm-sparc/bug.h b/include/asm-sparc/bug.h index 04151208189f..8a59e5a8c217 100644 --- a/include/asm-sparc/bug.h +++ b/include/asm-sparc/bug.h | |||
@@ -2,28 +2,16 @@ | |||
2 | #define _SPARC_BUG_H | 2 | #define _SPARC_BUG_H |
3 | 3 | ||
4 | #ifdef CONFIG_BUG | 4 | #ifdef CONFIG_BUG |
5 | /* Only use the inline asm until a gcc release that can handle __builtin_trap | 5 | #include <linux/compiler.h> |
6 | * -rob 2003-06-25 | ||
7 | * | ||
8 | * gcc-3.3.1 and later will be OK -DaveM | ||
9 | */ | ||
10 | #if (__GNUC__ > 3) || \ | ||
11 | (__GNUC__ == 3 && __GNUC_MINOR__ > 3) || \ | ||
12 | (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4) | ||
13 | #define __bug_trap() __builtin_trap() | ||
14 | #else | ||
15 | #define __bug_trap() \ | ||
16 | __asm__ __volatile__ ("t 0x5\n\t" : : ) | ||
17 | #endif | ||
18 | 6 | ||
19 | #ifdef CONFIG_DEBUG_BUGVERBOSE | 7 | #ifdef CONFIG_DEBUG_BUGVERBOSE |
20 | extern void do_BUG(const char *file, int line); | 8 | extern void do_BUG(const char *file, int line); |
21 | #define BUG() do { \ | 9 | #define BUG() do { \ |
22 | do_BUG(__FILE__, __LINE__); \ | 10 | do_BUG(__FILE__, __LINE__); \ |
23 | __bug_trap(); \ | 11 | __builtin_trap(); \ |
24 | } while (0) | 12 | } while (0) |
25 | #else | 13 | #else |
26 | #define BUG() __bug_trap() | 14 | #define BUG() __builtin_trap() |
27 | #endif | 15 | #endif |
28 | 16 | ||
29 | #define HAVE_ARCH_BUG | 17 | #define HAVE_ARCH_BUG |
diff --git a/include/asm-sparc/bugs.h b/include/asm-sparc/bugs.h index a0f939beeea1..2dfc07bc8e54 100644 --- a/include/asm-sparc/bugs.h +++ b/include/asm-sparc/bugs.h | |||
@@ -1,16 +1,24 @@ | |||
1 | /* $Id: bugs.h,v 1.1 1996/12/26 13:25:20 davem Exp $ | 1 | /* include/asm-sparc/bugs.h: Sparc probes for various bugs. |
2 | * include/asm-sparc/bugs.h: Sparc probes for various bugs. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | 3 | * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | 5 | ||
6 | #ifdef CONFIG_SPARC32 | ||
7 | #include <asm/cpudata.h> | 7 | #include <asm/cpudata.h> |
8 | #endif | ||
9 | |||
10 | #ifdef CONFIG_SPARC64 | ||
11 | #include <asm/sstate.h> | ||
12 | #endif | ||
8 | 13 | ||
9 | extern unsigned long loops_per_jiffy; | 14 | extern unsigned long loops_per_jiffy; |
10 | 15 | ||
11 | static void check_bugs(void) | 16 | static void __init check_bugs(void) |
12 | { | 17 | { |
13 | #ifndef CONFIG_SMP | 18 | #if defined(CONFIG_SPARC32) && !defined(CONFIG_SMP) |
14 | cpu_data(0).udelay_val = loops_per_jiffy; | 19 | cpu_data(0).udelay_val = loops_per_jiffy; |
15 | #endif | 20 | #endif |
21 | #ifdef CONFIG_SPARC64 | ||
22 | sstate_running(); | ||
23 | #endif | ||
16 | } | 24 | } |
diff --git a/include/asm-sparc/byteorder.h b/include/asm-sparc/byteorder.h index a2949aea48ef..bcd83aa351c5 100644 --- a/include/asm-sparc/byteorder.h +++ b/include/asm-sparc/byteorder.h | |||
@@ -1,12 +1,55 @@ | |||
1 | /* $Id: byteorder.h,v 1.15 1997/12/16 19:20:44 davem Exp $ */ | ||
2 | #ifndef _SPARC_BYTEORDER_H | 1 | #ifndef _SPARC_BYTEORDER_H |
3 | #define _SPARC_BYTEORDER_H | 2 | #define _SPARC_BYTEORDER_H |
4 | 3 | ||
5 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | #include <asm/asi.h> | ||
6 | |||
7 | #ifdef __GNUC__ | ||
8 | |||
9 | #ifdef CONFIG_SPARC32 | ||
10 | #define __SWAB_64_THRU_32__ | ||
11 | #endif | ||
12 | |||
13 | #ifdef CONFIG_SPARC64 | ||
14 | |||
15 | static inline __u16 ___arch__swab16p(const __u16 *addr) | ||
16 | { | ||
17 | __u16 ret; | ||
18 | |||
19 | __asm__ __volatile__ ("lduha [%1] %2, %0" | ||
20 | : "=r" (ret) | ||
21 | : "r" (addr), "i" (ASI_PL)); | ||
22 | return ret; | ||
23 | } | ||
24 | |||
25 | static inline __u32 ___arch__swab32p(const __u32 *addr) | ||
26 | { | ||
27 | __u32 ret; | ||
28 | |||
29 | __asm__ __volatile__ ("lduwa [%1] %2, %0" | ||
30 | : "=r" (ret) | ||
31 | : "r" (addr), "i" (ASI_PL)); | ||
32 | return ret; | ||
33 | } | ||
34 | |||
35 | static inline __u64 ___arch__swab64p(const __u64 *addr) | ||
36 | { | ||
37 | __u64 ret; | ||
38 | |||
39 | __asm__ __volatile__ ("ldxa [%1] %2, %0" | ||
40 | : "=r" (ret) | ||
41 | : "r" (addr), "i" (ASI_PL)); | ||
42 | return ret; | ||
43 | } | ||
44 | |||
45 | #define __arch__swab16p(x) ___arch__swab16p(x) | ||
46 | #define __arch__swab32p(x) ___arch__swab32p(x) | ||
47 | #define __arch__swab64p(x) ___arch__swab64p(x) | ||
48 | |||
49 | #endif /* CONFIG_SPARC64 */ | ||
50 | |||
51 | #define __BYTEORDER_HAS_U64__ | ||
6 | 52 | ||
7 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
8 | # define __BYTEORDER_HAS_U64__ | ||
9 | # define __SWAB_64_THRU_32__ | ||
10 | #endif | 53 | #endif |
11 | 54 | ||
12 | #include <linux/byteorder/big_endian.h> | 55 | #include <linux/byteorder/big_endian.h> |
diff --git a/include/asm-sparc/cache.h b/include/asm-sparc/cache.h index cb971e88aea4..41f85ae4bd4a 100644 --- a/include/asm-sparc/cache.h +++ b/include/asm-sparc/cache.h | |||
@@ -1,20 +1,28 @@ | |||
1 | /* $Id: cache.h,v 1.9 1999/08/14 03:51:58 anton Exp $ | 1 | /* cache.h: Cache specific code for the Sparc. These include flushing |
2 | * cache.h: Cache specific code for the Sparc. These include flushing | ||
3 | * and direct tag/data line access. | 2 | * and direct tag/data line access. |
4 | * | 3 | * |
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | 4 | * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) |
6 | */ | 5 | */ |
7 | 6 | ||
8 | #ifndef _SPARC_CACHE_H | 7 | #ifndef _SPARC_CACHE_H |
9 | #define _SPARC_CACHE_H | 8 | #define _SPARC_CACHE_H |
10 | 9 | ||
11 | #include <asm/asi.h> | ||
12 | |||
13 | #define L1_CACHE_SHIFT 5 | 10 | #define L1_CACHE_SHIFT 5 |
14 | #define L1_CACHE_BYTES 32 | 11 | #define L1_CACHE_BYTES 32 |
15 | #define L1_CACHE_ALIGN(x) ((((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))) | 12 | #define L1_CACHE_ALIGN(x) ((((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))) |
16 | 13 | ||
17 | #define SMP_CACHE_BYTES 32 | 14 | #ifdef CONFIG_SPARC32 |
15 | #define SMP_CACHE_BYTES_SHIFT 5 | ||
16 | #else | ||
17 | #define SMP_CACHE_BYTES_SHIFT 6 | ||
18 | #endif | ||
19 | |||
20 | #define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) | ||
21 | |||
22 | #define __read_mostly __attribute__((__section__(".data.read_mostly"))) | ||
23 | |||
24 | #ifdef CONFIG_SPARC32 | ||
25 | #include <asm/asi.h> | ||
18 | 26 | ||
19 | /* Direct access to the instruction cache is provided through and | 27 | /* Direct access to the instruction cache is provided through and |
20 | * alternate address space. The IDC bit must be off in the ICCR on | 28 | * alternate address space. The IDC bit must be off in the ICCR on |
@@ -125,5 +133,6 @@ static inline void flush_ei_user(unsigned int addr) | |||
125 | "r" (addr), "i" (ASI_M_FLUSH_USER) : | 133 | "r" (addr), "i" (ASI_M_FLUSH_USER) : |
126 | "memory"); | 134 | "memory"); |
127 | } | 135 | } |
136 | #endif /* CONFIG_SPARC32 */ | ||
128 | 137 | ||
129 | #endif /* !(_SPARC_CACHE_H) */ | 138 | #endif /* !(_SPARC_CACHE_H) */ |
diff --git a/include/asm-sparc/current.h b/include/asm-sparc/current.h index 8fe7c82a5e21..8a1d9d6643b0 100644 --- a/include/asm-sparc/current.h +++ b/include/asm-sparc/current.h | |||
@@ -1,31 +1,34 @@ | |||
1 | /* | 1 | /* include/asm-sparc/current.h |
2 | * include/asm-sparc/current.h | ||
3 | * | 2 | * |
4 | * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation | 3 | * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation |
5 | * Copyright (C) 2002 Pete Zaitcev (zaitcev@yahoo.com) | 4 | * Copyright (C) 2002 Pete Zaitcev (zaitcev@yahoo.com) |
5 | * Copyright (C) 2007 David S. Miller (davem@davemloft.net) | ||
6 | * | 6 | * |
7 | * Derived from "include/asm-s390/current.h" by | 7 | * Derived from "include/asm-s390/current.h" by |
8 | * Martin Schwidefsky (schwidefsky@de.ibm.com) | 8 | * Martin Schwidefsky (schwidefsky@de.ibm.com) |
9 | * Derived from "include/asm-i386/current.h" | 9 | * Derived from "include/asm-i386/current.h" |
10 | */ | 10 | */ |
11 | #ifndef _ASM_CURRENT_H | 11 | #ifndef _SPARC_CURRENT_H |
12 | #define _ASM_CURRENT_H | 12 | #define _SPARC_CURRENT_H |
13 | |||
14 | /* | ||
15 | * At the sparc64 DaveM keeps current_thread_info in %g4. | ||
16 | * We might want to consider doing the same to shave a few cycles. | ||
17 | */ | ||
18 | 13 | ||
19 | #include <linux/thread_info.h> | 14 | #include <linux/thread_info.h> |
20 | 15 | ||
21 | struct task_struct; | 16 | #ifdef CONFIG_SPARC64 |
17 | register struct task_struct *current asm("g4"); | ||
18 | #endif | ||
22 | 19 | ||
23 | /* Two stage process (inline + #define) for type-checking. */ | 20 | #ifdef CONFIG_SPARC32 |
24 | /* We also obfuscate get_current() to check if anyone used that by mistake. */ | 21 | /* We might want to consider using %g4 like sparc64 to shave a few cycles. |
22 | * | ||
23 | * Two stage process (inline + #define) for type-checking. | ||
24 | * We also obfuscate get_current() to check if anyone used that by mistake. | ||
25 | */ | ||
26 | struct task_struct; | ||
25 | static inline struct task_struct *__get_current(void) | 27 | static inline struct task_struct *__get_current(void) |
26 | { | 28 | { |
27 | return current_thread_info()->task; | 29 | return current_thread_info()->task; |
28 | } | 30 | } |
29 | #define current __get_current() | 31 | #define current __get_current() |
32 | #endif | ||
30 | 33 | ||
31 | #endif /* !(_ASM_CURRENT_H) */ | 34 | #endif /* !(_SPARC_CURRENT_H) */ |
diff --git a/include/asm-sparc/device.h b/include/asm-sparc/device.h index c0a7786d65f7..680e51d87374 100644 --- a/include/asm-sparc/device.h +++ b/include/asm-sparc/device.h | |||
@@ -19,5 +19,3 @@ struct dev_archdata { | |||
19 | }; | 19 | }; |
20 | 20 | ||
21 | #endif /* _ASM_SPARC_DEVICE_H */ | 21 | #endif /* _ASM_SPARC_DEVICE_H */ |
22 | |||
23 | |||
diff --git a/include/asm-sparc/errno.h b/include/asm-sparc/errno.h index ed41c8bac1fa..a9ef172977de 100644 --- a/include/asm-sparc/errno.h +++ b/include/asm-sparc/errno.h | |||
@@ -1,4 +1,3 @@ | |||
1 | /* $Id: errno.h,v 1.6 1997/04/15 09:03:38 davem Exp $ */ | ||
2 | #ifndef _SPARC_ERRNO_H | 1 | #ifndef _SPARC_ERRNO_H |
3 | #define _SPARC_ERRNO_H | 2 | #define _SPARC_ERRNO_H |
4 | 3 | ||
diff --git a/include/asm-sparc/fb.h b/include/asm-sparc/fb.h index c73ca081e1f5..b83e44729655 100644 --- a/include/asm-sparc/fb.h +++ b/include/asm-sparc/fb.h | |||
@@ -1,9 +1,17 @@ | |||
1 | #ifndef _ASM_FB_H_ | 1 | #ifndef _SPARC_FB_H_ |
2 | #define _ASM_FB_H_ | 2 | #define _SPARC_FB_H_ |
3 | #include <linux/fb.h> | 3 | #include <linux/fb.h> |
4 | #include <linux/fs.h> | ||
5 | #include <asm/page.h> | ||
4 | #include <asm/prom.h> | 6 | #include <asm/prom.h> |
5 | 7 | ||
6 | #define fb_pgprotect(...) do {} while (0) | 8 | static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, |
9 | unsigned long off) | ||
10 | { | ||
11 | #ifdef CONFIG_SPARC64 | ||
12 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
13 | #endif | ||
14 | } | ||
7 | 15 | ||
8 | static inline int fb_is_primary_device(struct fb_info *info) | 16 | static inline int fb_is_primary_device(struct fb_info *info) |
9 | { | 17 | { |
@@ -18,4 +26,4 @@ static inline int fb_is_primary_device(struct fb_info *info) | |||
18 | return 0; | 26 | return 0; |
19 | } | 27 | } |
20 | 28 | ||
21 | #endif /* _ASM_FB_H_ */ | 29 | #endif /* _SPARC_FB_H_ */ |
diff --git a/include/asm-sparc/of_platform.h b/include/asm-sparc/of_platform.h index d638737ff13c..38334351c36b 100644 --- a/include/asm-sparc/of_platform.h +++ b/include/asm-sparc/of_platform.h | |||
@@ -21,9 +21,4 @@ extern struct bus_type sbus_bus_type; | |||
21 | 21 | ||
22 | #define of_bus_type of_platform_bus_type /* for compatibility */ | 22 | #define of_bus_type of_platform_bus_type /* for compatibility */ |
23 | 23 | ||
24 | extern struct of_device *of_platform_device_create(struct device_node *np, | ||
25 | const char *bus_id, | ||
26 | struct device *parent, | ||
27 | struct bus_type *bus); | ||
28 | |||
29 | #endif /* _ASM_SPARC_OF_PLATFORM_H */ | 24 | #endif /* _ASM_SPARC_OF_PLATFORM_H */ |
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h index 71f2a1998324..df5dc4422483 100644 --- a/include/asm-sparc/prom.h +++ b/include/asm-sparc/prom.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * Copyright (C) 1996-2005 Paul Mackerras. | 9 | * Copyright (C) 1996-2005 Paul Mackerras. |
10 | * | 10 | * |
11 | * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. | 11 | * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. |
12 | * Updates for SPARC32 by David S. Miller | 12 | * Updates for SPARC by David S. Miller |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or | 14 | * This program is free software; you can redistribute it and/or |
15 | * modify it under the terms of the GNU General Public License | 15 | * modify it under the terms of the GNU General Public License |
@@ -39,6 +39,7 @@ struct property { | |||
39 | unsigned int unique_id; | 39 | unsigned int unique_id; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct of_irq_controller; | ||
42 | struct device_node { | 43 | struct device_node { |
43 | const char *name; | 44 | const char *name; |
44 | const char *type; | 45 | const char *type; |
@@ -58,11 +59,19 @@ struct device_node { | |||
58 | unsigned long _flags; | 59 | unsigned long _flags; |
59 | void *data; | 60 | void *data; |
60 | unsigned int unique_id; | 61 | unsigned int unique_id; |
62 | |||
63 | struct of_irq_controller *irq_trans; | ||
64 | }; | ||
65 | |||
66 | struct of_irq_controller { | ||
67 | unsigned int (*irq_build)(struct device_node *, unsigned int, void *); | ||
68 | void *data; | ||
61 | }; | 69 | }; |
62 | 70 | ||
63 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | 71 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) |
64 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | 72 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) |
65 | 73 | ||
74 | extern struct device_node *of_find_node_by_cpuid(int cpuid); | ||
66 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 75 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); |
67 | extern int of_getintprop_default(struct device_node *np, | 76 | extern int of_getintprop_default(struct device_node *np, |
68 | const char *name, | 77 | const char *name, |
diff --git a/include/asm-sparc64/a.out.h b/include/asm-sparc64/a.out.h index 53c95bdfc66e..44208c2a188e 100644 --- a/include/asm-sparc64/a.out.h +++ b/include/asm-sparc64/a.out.h | |||
@@ -1,98 +1 @@ | |||
1 | /* $Id: a.out.h,v 1.8 2002/02/09 19:49:31 davem Exp $ */ | #include <asm-sparc/a.out.h> | |
2 | #ifndef __SPARC64_A_OUT_H__ | ||
3 | #define __SPARC64_A_OUT_H__ | ||
4 | |||
5 | #define SPARC_PGSIZE 0x2000 /* Thanks to the sun4 architecture... */ | ||
6 | #define SEGMENT_SIZE SPARC_PGSIZE /* whee... */ | ||
7 | |||
8 | #ifndef __ASSEMBLY__ | ||
9 | |||
10 | struct exec { | ||
11 | unsigned char a_dynamic:1; /* A __DYNAMIC is in this image */ | ||
12 | unsigned char a_toolversion:7; | ||
13 | unsigned char a_machtype; | ||
14 | unsigned short a_info; | ||
15 | unsigned int a_text; /* length of text, in bytes */ | ||
16 | unsigned int a_data; /* length of data, in bytes */ | ||
17 | unsigned int a_bss; /* length of bss, in bytes */ | ||
18 | unsigned int a_syms; /* length of symbol table, in bytes */ | ||
19 | unsigned int a_entry; /* where program begins */ | ||
20 | unsigned int a_trsize; | ||
21 | unsigned int a_drsize; | ||
22 | }; | ||
23 | |||
24 | #endif /* !__ASSEMBLY__ */ | ||
25 | |||
26 | /* Where in the file does the text information begin? */ | ||
27 | #define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec)) | ||
28 | |||
29 | /* Where do the Symbols start? */ | ||
30 | #define N_SYMOFF(x) (N_TXTOFF(x) + (x).a_text + \ | ||
31 | (x).a_data + (x).a_trsize + \ | ||
32 | (x).a_drsize) | ||
33 | |||
34 | /* Where does text segment go in memory after being loaded? */ | ||
35 | #define N_TXTADDR(x) (unsigned long)(((N_MAGIC(x) == ZMAGIC) && \ | ||
36 | ((x).a_entry < SPARC_PGSIZE)) ? \ | ||
37 | 0 : SPARC_PGSIZE) | ||
38 | |||
39 | /* And same for the data segment.. */ | ||
40 | #define N_DATADDR(x) (N_MAGIC(x)==OMAGIC ? \ | ||
41 | (N_TXTADDR(x) + (x).a_text) \ | ||
42 | : (unsigned long)(_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) | ||
43 | |||
44 | #define N_TRSIZE(a) ((a).a_trsize) | ||
45 | #define N_DRSIZE(a) ((a).a_drsize) | ||
46 | #define N_SYMSIZE(a) ((a).a_syms) | ||
47 | |||
48 | #ifndef __ASSEMBLY__ | ||
49 | |||
50 | /* | ||
51 | * Sparc relocation types | ||
52 | */ | ||
53 | enum reloc_type | ||
54 | { | ||
55 | RELOC_8, | ||
56 | RELOC_16, | ||
57 | RELOC_32, /* simplest relocs */ | ||
58 | RELOC_DISP8, | ||
59 | RELOC_DISP16, | ||
60 | RELOC_DISP32, /* Disp's (pc-rel) */ | ||
61 | RELOC_WDISP30, | ||
62 | RELOC_WDISP22, /* SR word disp's */ | ||
63 | RELOC_HI22, | ||
64 | RELOC_22, /* SR 22-bit relocs */ | ||
65 | RELOC_13, | ||
66 | RELOC_LO10, /* SR 13&10-bit relocs */ | ||
67 | RELOC_SFA_BASE, | ||
68 | RELOC_SFA_OFF13, /* SR S.F.A. relocs */ | ||
69 | RELOC_BASE10, | ||
70 | RELOC_BASE13, | ||
71 | RELOC_BASE22, /* base_relative pic */ | ||
72 | RELOC_PC10, | ||
73 | RELOC_PC22, /* special pc-rel pic */ | ||
74 | RELOC_JMP_TBL, /* jmp_tbl_rel in pic */ | ||
75 | RELOC_SEGOFF16, /* ShLib offset-in-seg */ | ||
76 | RELOC_GLOB_DAT, | ||
77 | RELOC_JMP_SLOT, | ||
78 | RELOC_RELATIVE /* rtld relocs */ | ||
79 | }; | ||
80 | |||
81 | /* | ||
82 | * Format of a relocation datum. | ||
83 | */ | ||
84 | struct relocation_info /* used when header.a_machtype == M_SPARC */ | ||
85 | { | ||
86 | unsigned int r_address; /* relocation addr */ | ||
87 | unsigned int r_index:24; /* segment index or symbol index */ | ||
88 | unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ | ||
89 | unsigned int r_pad:2; /* <unused> */ | ||
90 | enum reloc_type r_type:5; /* type of relocation to perform */ | ||
91 | int r_addend; /* addend for relocation value */ | ||
92 | }; | ||
93 | |||
94 | #define N_RELOCATION_INFO_DECLARED 1 | ||
95 | |||
96 | #endif /* !(__ASSEMBLY__) */ | ||
97 | |||
98 | #endif /* !(__SPARC64_A_OUT_H__) */ | ||
diff --git a/include/asm-sparc64/auxvec.h b/include/asm-sparc64/auxvec.h index 436a29129828..1f45c67d7316 100644 --- a/include/asm-sparc64/auxvec.h +++ b/include/asm-sparc64/auxvec.h | |||
@@ -1,4 +1 @@ | |||
1 | #ifndef __ASM_SPARC64_AUXVEC_H | #include <asm-sparc/auxvec.h> | |
2 | #define __ASM_SPARC64_AUXVEC_H | ||
3 | |||
4 | #endif /* !(__ASM_SPARC64_AUXVEC_H) */ | ||
diff --git a/include/asm-sparc64/bpp.h b/include/asm-sparc64/bpp.h index abe163a50382..514eee20272e 100644 --- a/include/asm-sparc64/bpp.h +++ b/include/asm-sparc64/bpp.h | |||
@@ -1,73 +1 @@ | |||
1 | #ifndef _SPARC64_BPP_H | #include <asm-sparc/bpp.h> | |
2 | #define _SPARC64_BPP_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (c) 1995 Picture Elements | ||
6 | * Stephen Williams | ||
7 | * Gus Baldauf | ||
8 | * | ||
9 | * Linux/SPARC port by Peter Zaitcev. | ||
10 | * Integration into SPARC tree by Tom Dyas. | ||
11 | */ | ||
12 | |||
13 | #include <linux/ioctl.h> | ||
14 | |||
15 | /* | ||
16 | * This is a driver that supports IEEE Std 1284-1994 communications | ||
17 | * with compliant or compatible devices. It will use whatever features | ||
18 | * the device supports, prefering those that are typically faster. | ||
19 | * | ||
20 | * When the device is opened, it is left in COMPATIBILITY mode, and | ||
21 | * writes work like any printer device. The driver only attempt to | ||
22 | * negotiate 1284 modes when needed so that plugs can be pulled, | ||
23 | * switch boxes switched, etc., without disrupting things. It will | ||
24 | * also leave the device in compatibility mode when closed. | ||
25 | */ | ||
26 | |||
27 | |||
28 | |||
29 | /* | ||
30 | * This driver also supplies ioctls to manually manipulate the | ||
31 | * pins. This is great for testing devices, or writing code to deal | ||
32 | * with bizzarro-mode of the ACME Special TurboThingy Plus. | ||
33 | * | ||
34 | * NOTE: These ioctl currently do not interact well with | ||
35 | * read/write. Caveat emptor. | ||
36 | * | ||
37 | * PUT_PINS allows us to assign the sense of all the pins, including | ||
38 | * the data pins if being driven by the host. The GET_PINS returns the | ||
39 | * pins that the peripheral drives, including data if appropriate. | ||
40 | */ | ||
41 | |||
42 | # define BPP_PUT_PINS _IOW('B', 1, int) | ||
43 | # define BPP_GET_PINS _IOR('B', 2, char) /* that's bogus - should've been _IO */ | ||
44 | # define BPP_PUT_DATA _IOW('B', 3, int) | ||
45 | # define BPP_GET_DATA _IOR('B', 4, char) /* ditto */ | ||
46 | |||
47 | /* | ||
48 | * Set the data bus to input mode. Disengage the data bin driver and | ||
49 | * be prepared to read values from the peripheral. If the arg is 0, | ||
50 | * then revert the bus to output mode. | ||
51 | */ | ||
52 | # define BPP_SET_INPUT _IOW('B', 5, int) | ||
53 | |||
54 | /* | ||
55 | * These bits apply to the PUT operation... | ||
56 | */ | ||
57 | # define BPP_PP_nStrobe 0x0001 | ||
58 | # define BPP_PP_nAutoFd 0x0002 | ||
59 | # define BPP_PP_nInit 0x0004 | ||
60 | # define BPP_PP_nSelectIn 0x0008 | ||
61 | |||
62 | /* | ||
63 | * These apply to the GET operation, which also reads the current value | ||
64 | * of the previously put values. A bit mask of these will be returned | ||
65 | * as a bit mask in the return code of the ioctl(). | ||
66 | */ | ||
67 | # define BPP_GP_nAck 0x0100 | ||
68 | # define BPP_GP_Busy 0x0200 | ||
69 | # define BPP_GP_PError 0x0400 | ||
70 | # define BPP_GP_Select 0x0800 | ||
71 | # define BPP_GP_nFault 0x1000 | ||
72 | |||
73 | #endif | ||
diff --git a/include/asm-sparc64/bsderrno.h b/include/asm-sparc64/bsderrno.h deleted file mode 100644 index 52fe880d2af8..000000000000 --- a/include/asm-sparc64/bsderrno.h +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* $Id: bsderrno.h,v 1.1 1996/12/26 13:25:21 davem Exp $ | ||
2 | * bsderrno.h: Error numbers for NetBSD binary compatibility | ||
3 | * | ||
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #ifndef _SPARC64_BSDERRNO_H | ||
8 | #define _SPARC64_BSDERRNO_H | ||
9 | |||
10 | #define BSD_EPERM 1 /* Operation not permitted */ | ||
11 | #define BSD_ENOENT 2 /* No such file or directory */ | ||
12 | #define BSD_ESRCH 3 /* No such process */ | ||
13 | #define BSD_EINTR 4 /* Interrupted system call */ | ||
14 | #define BSD_EIO 5 /* Input/output error */ | ||
15 | #define BSD_ENXIO 6 /* Device not configured */ | ||
16 | #define BSD_E2BIG 7 /* Argument list too long */ | ||
17 | #define BSD_ENOEXEC 8 /* Exec format error */ | ||
18 | #define BSD_EBADF 9 /* Bad file descriptor */ | ||
19 | #define BSD_ECHILD 10 /* No child processes */ | ||
20 | #define BSD_EDEADLK 11 /* Resource deadlock avoided */ | ||
21 | #define BSD_ENOMEM 12 /* Cannot allocate memory */ | ||
22 | #define BSD_EACCES 13 /* Permission denied */ | ||
23 | #define BSD_EFAULT 14 /* Bad address */ | ||
24 | #define BSD_ENOTBLK 15 /* Block device required */ | ||
25 | #define BSD_EBUSY 16 /* Device busy */ | ||
26 | #define BSD_EEXIST 17 /* File exists */ | ||
27 | #define BSD_EXDEV 18 /* Cross-device link */ | ||
28 | #define BSD_ENODEV 19 /* Operation not supported by device */ | ||
29 | #define BSD_ENOTDIR 20 /* Not a directory */ | ||
30 | #define BSD_EISDIR 21 /* Is a directory */ | ||
31 | #define BSD_EINVAL 22 /* Invalid argument */ | ||
32 | #define BSD_ENFILE 23 /* Too many open files in system */ | ||
33 | #define BSD_EMFILE 24 /* Too many open files */ | ||
34 | #define BSD_ENOTTY 25 /* Inappropriate ioctl for device */ | ||
35 | #define BSD_ETXTBSY 26 /* Text file busy */ | ||
36 | #define BSD_EFBIG 27 /* File too large */ | ||
37 | #define BSD_ENOSPC 28 /* No space left on device */ | ||
38 | #define BSD_ESPIPE 29 /* Illegal seek */ | ||
39 | #define BSD_EROFS 30 /* Read-only file system */ | ||
40 | #define BSD_EMLINK 31 /* Too many links */ | ||
41 | #define BSD_EPIPE 32 /* Broken pipe */ | ||
42 | #define BSD_EDOM 33 /* Numerical argument out of domain */ | ||
43 | #define BSD_ERANGE 34 /* Result too large */ | ||
44 | #define BSD_EAGAIN 35 /* Resource temporarily unavailable */ | ||
45 | #define BSD_EWOULDBLOCK EAGAIN /* Operation would block */ | ||
46 | #define BSD_EINPROGRESS 36 /* Operation now in progress */ | ||
47 | #define BSD_EALREADY 37 /* Operation already in progress */ | ||
48 | #define BSD_ENOTSOCK 38 /* Socket operation on non-socket */ | ||
49 | #define BSD_EDESTADDRREQ 39 /* Destination address required */ | ||
50 | #define BSD_EMSGSIZE 40 /* Message too long */ | ||
51 | #define BSD_EPROTOTYPE 41 /* Protocol wrong type for socket */ | ||
52 | #define BSD_ENOPROTOOPT 42 /* Protocol not available */ | ||
53 | #define BSD_EPROTONOSUPPORT 43 /* Protocol not supported */ | ||
54 | #define BSD_ESOCKTNOSUPPORT 44 /* Socket type not supported */ | ||
55 | #define BSD_EOPNOTSUPP 45 /* Operation not supported */ | ||
56 | #define BSD_EPFNOSUPPORT 46 /* Protocol family not supported */ | ||
57 | #define BSD_EAFNOSUPPORT 47 /* Address family not supported by protocol family */ | ||
58 | #define BSD_EADDRINUSE 48 /* Address already in use */ | ||
59 | #define BSD_EADDRNOTAVAIL 49 /* Can't assign requested address */ | ||
60 | #define BSD_ENETDOWN 50 /* Network is down */ | ||
61 | #define BSD_ENETUNREACH 51 /* Network is unreachable */ | ||
62 | #define BSD_ENETRESET 52 /* Network dropped connection on reset */ | ||
63 | #define BSD_ECONNABORTED 53 /* Software caused connection abort */ | ||
64 | #define BSD_ECONNRESET 54 /* Connection reset by peer */ | ||
65 | #define BSD_ENOBUFS 55 /* No buffer space available */ | ||
66 | #define BSD_EISCONN 56 /* Socket is already connected */ | ||
67 | #define BSD_ENOTCONN 57 /* Socket is not connected */ | ||
68 | #define BSD_ESHUTDOWN 58 /* Can't send after socket shutdown */ | ||
69 | #define BSD_ETOOMANYREFS 59 /* Too many references: can't splice */ | ||
70 | #define BSD_ETIMEDOUT 60 /* Operation timed out */ | ||
71 | #define BSD_ECONNREFUSED 61 /* Connection refused */ | ||
72 | #define BSD_ELOOP 62 /* Too many levels of symbolic links */ | ||
73 | #define BSD_ENAMETOOLONG 63 /* File name too long */ | ||
74 | #define BSD_EHOSTDOWN 64 /* Host is down */ | ||
75 | #define BSD_EHOSTUNREACH 65 /* No route to host */ | ||
76 | #define BSD_ENOTEMPTY 66 /* Directory not empty */ | ||
77 | #define BSD_EPROCLIM 67 /* Too many processes */ | ||
78 | #define BSD_EUSERS 68 /* Too many users */ | ||
79 | #define BSD_EDQUOT 69 /* Disc quota exceeded */ | ||
80 | #define BSD_ESTALE 70 /* Stale NFS file handle */ | ||
81 | #define BSD_EREMOTE 71 /* Too many levels of remote in path */ | ||
82 | #define BSD_EBADRPC 72 /* RPC struct is bad */ | ||
83 | #define BSD_ERPCMISMATCH 73 /* RPC version wrong */ | ||
84 | #define BSD_EPROGUNAVAIL 74 /* RPC prog. not avail */ | ||
85 | #define BSD_EPROGMISMATCH 75 /* Program version wrong */ | ||
86 | #define BSD_EPROCUNAVAIL 76 /* Bad procedure for program */ | ||
87 | #define BSD_ENOLCK 77 /* No locks available */ | ||
88 | #define BSD_ENOSYS 78 /* Function not implemented */ | ||
89 | #define BSD_EFTYPE 79 /* Inappropriate file type or format */ | ||
90 | #define BSD_EAUTH 80 /* Authentication error */ | ||
91 | #define BSD_ENEEDAUTH 81 /* Need authenticator */ | ||
92 | #define BSD_ELAST 81 /* Must be equal largest errno */ | ||
93 | |||
94 | #endif /* !(_SPARC64_BSDERRNO_H) */ | ||
diff --git a/include/asm-sparc64/bug.h b/include/asm-sparc64/bug.h index 516bb27f3fc4..3433737c7a67 100644 --- a/include/asm-sparc64/bug.h +++ b/include/asm-sparc64/bug.h | |||
@@ -1,22 +1 @@ | |||
1 | #ifndef _SPARC64_BUG_H | #include <asm-sparc/bug.h> | |
2 | #define _SPARC64_BUG_H | ||
3 | |||
4 | #ifdef CONFIG_BUG | ||
5 | #include <linux/compiler.h> | ||
6 | |||
7 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
8 | extern void do_BUG(const char *file, int line); | ||
9 | #define BUG() do { \ | ||
10 | do_BUG(__FILE__, __LINE__); \ | ||
11 | __builtin_trap(); \ | ||
12 | } while (0) | ||
13 | #else | ||
14 | #define BUG() __builtin_trap() | ||
15 | #endif | ||
16 | |||
17 | #define HAVE_ARCH_BUG | ||
18 | #endif | ||
19 | |||
20 | #include <asm-generic/bug.h> | ||
21 | |||
22 | #endif | ||
diff --git a/include/asm-sparc64/bugs.h b/include/asm-sparc64/bugs.h index 11ade6841971..04ae9e2818cf 100644 --- a/include/asm-sparc64/bugs.h +++ b/include/asm-sparc64/bugs.h | |||
@@ -1,10 +1 @@ | |||
1 | /* bugs.h: Sparc64 probes for various bugs. | #include <asm-sparc/bugs.h> | |
2 | * | ||
3 | * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net) | ||
4 | */ | ||
5 | #include <asm/sstate.h> | ||
6 | |||
7 | static void __init check_bugs(void) | ||
8 | { | ||
9 | sstate_running(); | ||
10 | } | ||
diff --git a/include/asm-sparc64/byteorder.h b/include/asm-sparc64/byteorder.h index 3943022906fd..f672855bee17 100644 --- a/include/asm-sparc64/byteorder.h +++ b/include/asm-sparc64/byteorder.h | |||
@@ -1,49 +1 @@ | |||
1 | #ifndef _SPARC64_BYTEORDER_H | #include <asm-sparc/byteorder.h> | |
2 | #define _SPARC64_BYTEORDER_H | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | #include <asm/asi.h> | ||
6 | |||
7 | #ifdef __GNUC__ | ||
8 | |||
9 | static inline __u16 ___arch__swab16p(const __u16 *addr) | ||
10 | { | ||
11 | __u16 ret; | ||
12 | |||
13 | __asm__ __volatile__ ("lduha [%1] %2, %0" | ||
14 | : "=r" (ret) | ||
15 | : "r" (addr), "i" (ASI_PL)); | ||
16 | return ret; | ||
17 | } | ||
18 | |||
19 | static inline __u32 ___arch__swab32p(const __u32 *addr) | ||
20 | { | ||
21 | __u32 ret; | ||
22 | |||
23 | __asm__ __volatile__ ("lduwa [%1] %2, %0" | ||
24 | : "=r" (ret) | ||
25 | : "r" (addr), "i" (ASI_PL)); | ||
26 | return ret; | ||
27 | } | ||
28 | |||
29 | static inline __u64 ___arch__swab64p(const __u64 *addr) | ||
30 | { | ||
31 | __u64 ret; | ||
32 | |||
33 | __asm__ __volatile__ ("ldxa [%1] %2, %0" | ||
34 | : "=r" (ret) | ||
35 | : "r" (addr), "i" (ASI_PL)); | ||
36 | return ret; | ||
37 | } | ||
38 | |||
39 | #define __arch__swab16p(x) ___arch__swab16p(x) | ||
40 | #define __arch__swab32p(x) ___arch__swab32p(x) | ||
41 | #define __arch__swab64p(x) ___arch__swab64p(x) | ||
42 | |||
43 | #define __BYTEORDER_HAS_U64__ | ||
44 | |||
45 | #endif /* __GNUC__ */ | ||
46 | |||
47 | #include <linux/byteorder/big_endian.h> | ||
48 | |||
49 | #endif /* _SPARC64_BYTEORDER_H */ | ||
diff --git a/include/asm-sparc64/cache.h b/include/asm-sparc64/cache.h index e9df17acedde..fa9de5cadbf1 100644 --- a/include/asm-sparc64/cache.h +++ b/include/asm-sparc64/cache.h | |||
@@ -1,18 +1 @@ | |||
1 | /* | #include <asm-sparc/cache.h> | |
2 | * include/asm-sparc64/cache.h | ||
3 | */ | ||
4 | #ifndef __ARCH_SPARC64_CACHE_H | ||
5 | #define __ARCH_SPARC64_CACHE_H | ||
6 | |||
7 | /* bytes per L1 cache line */ | ||
8 | #define L1_CACHE_SHIFT 5 | ||
9 | #define L1_CACHE_BYTES 32 /* Two 16-byte sub-blocks per line. */ | ||
10 | |||
11 | #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) | ||
12 | |||
13 | #define SMP_CACHE_BYTES_SHIFT 6 | ||
14 | #define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) /* L2 cache line size. */ | ||
15 | |||
16 | #define __read_mostly __attribute__((__section__(".data.read_mostly"))) | ||
17 | |||
18 | #endif | ||
diff --git a/include/asm-sparc64/cputime.h b/include/asm-sparc64/cputime.h index dec2fc7a36f8..435f37a92f7c 100644 --- a/include/asm-sparc64/cputime.h +++ b/include/asm-sparc64/cputime.h | |||
@@ -1,6 +1 @@ | |||
1 | #ifndef __SPARC64_CPUTIME_H | #include <asm-sparc/cputime.h> | |
2 | #define __SPARC64_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __SPARC64_CPUTIME_H */ | ||
diff --git a/include/asm-sparc64/current.h b/include/asm-sparc64/current.h index 6c21e4ee2475..a7904a7f53a8 100644 --- a/include/asm-sparc64/current.h +++ b/include/asm-sparc64/current.h | |||
@@ -1,8 +1 @@ | |||
1 | #ifndef _SPARC64_CURRENT_H | #include <asm-sparc/current.h> | |
2 | #define _SPARC64_CURRENT_H | ||
3 | |||
4 | #include <linux/thread_info.h> | ||
5 | |||
6 | register struct task_struct *current asm("g4"); | ||
7 | |||
8 | #endif /* !(_SPARC64_CURRENT_H) */ | ||
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h index 5111e8717be3..4145c47097e2 100644 --- a/include/asm-sparc64/device.h +++ b/include/asm-sparc64/device.h | |||
@@ -1,21 +1 @@ | |||
1 | /* | #include <asm-sparc/device.h> | |
2 | * Arch specific extensions to struct device | ||
3 | * | ||
4 | * This file is released under the GPLv2 | ||
5 | */ | ||
6 | #ifndef _ASM_SPARC64_DEVICE_H | ||
7 | #define _ASM_SPARC64_DEVICE_H | ||
8 | |||
9 | struct device_node; | ||
10 | struct of_device; | ||
11 | |||
12 | struct dev_archdata { | ||
13 | void *iommu; | ||
14 | void *stc; | ||
15 | void *host_controller; | ||
16 | |||
17 | struct device_node *prom_node; | ||
18 | struct of_device *op; | ||
19 | }; | ||
20 | |||
21 | #endif /* _ASM_SPARC64_DEVICE_H */ | ||
diff --git a/include/asm-sparc64/div64.h b/include/asm-sparc64/div64.h index 6cd978cefb28..928c94f99ecf 100644 --- a/include/asm-sparc64/div64.h +++ b/include/asm-sparc64/div64.h | |||
@@ -1 +1 @@ | |||
#include <asm-generic/div64.h> | #include <asm-sparc/div64.h> | ||
diff --git a/include/asm-sparc64/emergency-restart.h b/include/asm-sparc64/emergency-restart.h index 108d8c48e42e..2cac7b644da8 100644 --- a/include/asm-sparc64/emergency-restart.h +++ b/include/asm-sparc64/emergency-restart.h | |||
@@ -1,6 +1 @@ | |||
1 | #ifndef _ASM_EMERGENCY_RESTART_H | #include <asm-sparc/emergency-restart.h> | |
2 | #define _ASM_EMERGENCY_RESTART_H | ||
3 | |||
4 | #include <asm-generic/emergency-restart.h> | ||
5 | |||
6 | #endif /* _ASM_EMERGENCY_RESTART_H */ | ||
diff --git a/include/asm-sparc64/errno.h b/include/asm-sparc64/errno.h index ea3509ee1b0b..9701fe01cc53 100644 --- a/include/asm-sparc64/errno.h +++ b/include/asm-sparc64/errno.h | |||
@@ -1,114 +1 @@ | |||
1 | /* $Id: errno.h,v 1.2 1997/04/15 12:46:11 jj Exp $ */ | #include <asm-sparc/errno.h> | |
2 | #ifndef _SPARC64_ERRNO_H | ||
3 | #define _SPARC64_ERRNO_H | ||
4 | |||
5 | /* These match the SunOS error numbering scheme. */ | ||
6 | |||
7 | #include <asm-generic/errno-base.h> | ||
8 | |||
9 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | ||
10 | #define EINPROGRESS 36 /* Operation now in progress */ | ||
11 | #define EALREADY 37 /* Operation already in progress */ | ||
12 | #define ENOTSOCK 38 /* Socket operation on non-socket */ | ||
13 | #define EDESTADDRREQ 39 /* Destination address required */ | ||
14 | #define EMSGSIZE 40 /* Message too long */ | ||
15 | #define EPROTOTYPE 41 /* Protocol wrong type for socket */ | ||
16 | #define ENOPROTOOPT 42 /* Protocol not available */ | ||
17 | #define EPROTONOSUPPORT 43 /* Protocol not supported */ | ||
18 | #define ESOCKTNOSUPPORT 44 /* Socket type not supported */ | ||
19 | #define EOPNOTSUPP 45 /* Op not supported on transport endpoint */ | ||
20 | #define EPFNOSUPPORT 46 /* Protocol family not supported */ | ||
21 | #define EAFNOSUPPORT 47 /* Address family not supported by protocol */ | ||
22 | #define EADDRINUSE 48 /* Address already in use */ | ||
23 | #define EADDRNOTAVAIL 49 /* Cannot assign requested address */ | ||
24 | #define ENETDOWN 50 /* Network is down */ | ||
25 | #define ENETUNREACH 51 /* Network is unreachable */ | ||
26 | #define ENETRESET 52 /* Net dropped connection because of reset */ | ||
27 | #define ECONNABORTED 53 /* Software caused connection abort */ | ||
28 | #define ECONNRESET 54 /* Connection reset by peer */ | ||
29 | #define ENOBUFS 55 /* No buffer space available */ | ||
30 | #define EISCONN 56 /* Transport endpoint is already connected */ | ||
31 | #define ENOTCONN 57 /* Transport endpoint is not connected */ | ||
32 | #define ESHUTDOWN 58 /* No send after transport endpoint shutdown */ | ||
33 | #define ETOOMANYREFS 59 /* Too many references: cannot splice */ | ||
34 | #define ETIMEDOUT 60 /* Connection timed out */ | ||
35 | #define ECONNREFUSED 61 /* Connection refused */ | ||
36 | #define ELOOP 62 /* Too many symbolic links encountered */ | ||
37 | #define ENAMETOOLONG 63 /* File name too long */ | ||
38 | #define EHOSTDOWN 64 /* Host is down */ | ||
39 | #define EHOSTUNREACH 65 /* No route to host */ | ||
40 | #define ENOTEMPTY 66 /* Directory not empty */ | ||
41 | #define EPROCLIM 67 /* SUNOS: Too many processes */ | ||
42 | #define EUSERS 68 /* Too many users */ | ||
43 | #define EDQUOT 69 /* Quota exceeded */ | ||
44 | #define ESTALE 70 /* Stale NFS file handle */ | ||
45 | #define EREMOTE 71 /* Object is remote */ | ||
46 | #define ENOSTR 72 /* Device not a stream */ | ||
47 | #define ETIME 73 /* Timer expired */ | ||
48 | #define ENOSR 74 /* Out of streams resources */ | ||
49 | #define ENOMSG 75 /* No message of desired type */ | ||
50 | #define EBADMSG 76 /* Not a data message */ | ||
51 | #define EIDRM 77 /* Identifier removed */ | ||
52 | #define EDEADLK 78 /* Resource deadlock would occur */ | ||
53 | #define ENOLCK 79 /* No record locks available */ | ||
54 | #define ENONET 80 /* Machine is not on the network */ | ||
55 | #define ERREMOTE 81 /* SunOS: Too many lvls of remote in path */ | ||
56 | #define ENOLINK 82 /* Link has been severed */ | ||
57 | #define EADV 83 /* Advertise error */ | ||
58 | #define ESRMNT 84 /* Srmount error */ | ||
59 | #define ECOMM 85 /* Communication error on send */ | ||
60 | #define EPROTO 86 /* Protocol error */ | ||
61 | #define EMULTIHOP 87 /* Multihop attempted */ | ||
62 | #define EDOTDOT 88 /* RFS specific error */ | ||
63 | #define EREMCHG 89 /* Remote address changed */ | ||
64 | #define ENOSYS 90 /* Function not implemented */ | ||
65 | |||
66 | /* The rest have no SunOS equivalent. */ | ||
67 | #define ESTRPIPE 91 /* Streams pipe error */ | ||
68 | #define EOVERFLOW 92 /* Value too large for defined data type */ | ||
69 | #define EBADFD 93 /* File descriptor in bad state */ | ||
70 | #define ECHRNG 94 /* Channel number out of range */ | ||
71 | #define EL2NSYNC 95 /* Level 2 not synchronized */ | ||
72 | #define EL3HLT 96 /* Level 3 halted */ | ||
73 | #define EL3RST 97 /* Level 3 reset */ | ||
74 | #define ELNRNG 98 /* Link number out of range */ | ||
75 | #define EUNATCH 99 /* Protocol driver not attached */ | ||
76 | #define ENOCSI 100 /* No CSI structure available */ | ||
77 | #define EL2HLT 101 /* Level 2 halted */ | ||
78 | #define EBADE 102 /* Invalid exchange */ | ||
79 | #define EBADR 103 /* Invalid request descriptor */ | ||
80 | #define EXFULL 104 /* Exchange full */ | ||
81 | #define ENOANO 105 /* No anode */ | ||
82 | #define EBADRQC 106 /* Invalid request code */ | ||
83 | #define EBADSLT 107 /* Invalid slot */ | ||
84 | #define EDEADLOCK 108 /* File locking deadlock error */ | ||
85 | #define EBFONT 109 /* Bad font file format */ | ||
86 | #define ELIBEXEC 110 /* Cannot exec a shared library directly */ | ||
87 | #define ENODATA 111 /* No data available */ | ||
88 | #define ELIBBAD 112 /* Accessing a corrupted shared library */ | ||
89 | #define ENOPKG 113 /* Package not installed */ | ||
90 | #define ELIBACC 114 /* Can not access a needed shared library */ | ||
91 | #define ENOTUNIQ 115 /* Name not unique on network */ | ||
92 | #define ERESTART 116 /* Interrupted syscall should be restarted */ | ||
93 | #define EUCLEAN 117 /* Structure needs cleaning */ | ||
94 | #define ENOTNAM 118 /* Not a XENIX named type file */ | ||
95 | #define ENAVAIL 119 /* No XENIX semaphores available */ | ||
96 | #define EISNAM 120 /* Is a named type file */ | ||
97 | #define EREMOTEIO 121 /* Remote I/O error */ | ||
98 | #define EILSEQ 122 /* Illegal byte sequence */ | ||
99 | #define ELIBMAX 123 /* Atmpt to link in too many shared libs */ | ||
100 | #define ELIBSCN 124 /* .lib section in a.out corrupted */ | ||
101 | |||
102 | #define ENOMEDIUM 125 /* No medium found */ | ||
103 | #define EMEDIUMTYPE 126 /* Wrong medium type */ | ||
104 | #define ECANCELED 127 /* Operation Cancelled */ | ||
105 | #define ENOKEY 128 /* Required key not available */ | ||
106 | #define EKEYEXPIRED 129 /* Key has expired */ | ||
107 | #define EKEYREVOKED 130 /* Key has been revoked */ | ||
108 | #define EKEYREJECTED 131 /* Key was rejected by service */ | ||
109 | |||
110 | /* for robust mutexes */ | ||
111 | #define EOWNERDEAD 132 /* Owner died */ | ||
112 | #define ENOTRECOVERABLE 133 /* State not recoverable */ | ||
113 | |||
114 | #endif /* !(_SPARC64_ERRNO_H) */ | ||
diff --git a/include/asm-sparc64/fb.h b/include/asm-sparc64/fb.h index 389012e5fbad..1c2ac5832f39 100644 --- a/include/asm-sparc64/fb.h +++ b/include/asm-sparc64/fb.h | |||
@@ -1,27 +1 @@ | |||
1 | #ifndef _ASM_FB_H_ | #include <asm-sparc/fb.h> | |
2 | #define _ASM_FB_H_ | ||
3 | #include <linux/fb.h> | ||
4 | #include <linux/fs.h> | ||
5 | #include <asm/page.h> | ||
6 | #include <asm/prom.h> | ||
7 | |||
8 | static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, | ||
9 | unsigned long off) | ||
10 | { | ||
11 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
12 | } | ||
13 | |||
14 | static inline int fb_is_primary_device(struct fb_info *info) | ||
15 | { | ||
16 | struct device *dev = info->device; | ||
17 | struct device_node *node; | ||
18 | |||
19 | node = dev->archdata.prom_node; | ||
20 | if (node && | ||
21 | node == of_console_device) | ||
22 | return 1; | ||
23 | |||
24 | return 0; | ||
25 | } | ||
26 | |||
27 | #endif /* _ASM_FB_H_ */ | ||
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index b6ece223562d..c299b853b5ba 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h | |||
@@ -16,7 +16,7 @@ | |||
16 | /* BIO layer definitions. */ | 16 | /* BIO layer definitions. */ |
17 | extern unsigned long kern_base, kern_size; | 17 | extern unsigned long kern_base, kern_size; |
18 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | 18 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) |
19 | #define BIO_VMERGE_BOUNDARY 0 | 19 | #define BIO_VMERGE_BOUNDARY 8192 |
20 | 20 | ||
21 | static inline u8 _inb(unsigned long addr) | 21 | static inline u8 _inb(unsigned long addr) |
22 | { | 22 | { |
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h index 9eac6676caf1..46325ddee23b 100644 --- a/include/asm-sparc64/iommu.h +++ b/include/asm-sparc64/iommu.h | |||
@@ -26,6 +26,7 @@ struct iommu_arena { | |||
26 | struct iommu { | 26 | struct iommu { |
27 | spinlock_t lock; | 27 | spinlock_t lock; |
28 | struct iommu_arena arena; | 28 | struct iommu_arena arena; |
29 | void (*flush_all)(struct iommu *); | ||
29 | iopte_t *page_table; | 30 | iopte_t *page_table; |
30 | u32 page_table_map_base; | 31 | u32 page_table_map_base; |
31 | unsigned long iommu_control; | 32 | unsigned long iommu_control; |
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h index 5020eaf67c29..7237dd87663e 100644 --- a/include/asm-sparc64/kprobes.h +++ b/include/asm-sparc64/kprobes.h | |||
@@ -14,11 +14,15 @@ typedef u32 kprobe_opcode_t; | |||
14 | 14 | ||
15 | #define arch_remove_kprobe(p) do {} while (0) | 15 | #define arch_remove_kprobe(p) do {} while (0) |
16 | 16 | ||
17 | #define ARCH_SUPPORTS_KRETPROBES | ||
18 | |||
17 | #define flush_insn_slot(p) \ | 19 | #define flush_insn_slot(p) \ |
18 | do { flushi(&(p)->ainsn.insn[0]); \ | 20 | do { flushi(&(p)->ainsn.insn[0]); \ |
19 | flushi(&(p)->ainsn.insn[1]); \ | 21 | flushi(&(p)->ainsn.insn[1]); \ |
20 | } while (0) | 22 | } while (0) |
21 | 23 | ||
24 | void kretprobe_trampoline(void); | ||
25 | |||
22 | /* Architecture specific copy of original instruction*/ | 26 | /* Architecture specific copy of original instruction*/ |
23 | struct arch_specific_insn { | 27 | struct arch_specific_insn { |
24 | /* copy of the original instruction */ | 28 | /* copy of the original instruction */ |
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h index 46d69b3223c5..a769fdbe164a 100644 --- a/include/asm-sparc64/of_device.h +++ b/include/asm-sparc64/of_device.h | |||
@@ -1,38 +1 @@ | |||
1 | #ifndef _ASM_SPARC64_OF_DEVICE_H | #include <asm-sparc/of_device.h> | |
2 | #define _ASM_SPARC64_OF_DEVICE_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | #include <linux/device.h> | ||
6 | #include <linux/of.h> | ||
7 | #include <linux/mod_devicetable.h> | ||
8 | #include <asm/openprom.h> | ||
9 | |||
10 | /* | ||
11 | * The of_device is a kind of "base class" that is a superset of | ||
12 | * struct device for use by devices attached to an OF node and | ||
13 | * probed using OF properties. | ||
14 | */ | ||
15 | struct of_device | ||
16 | { | ||
17 | struct device_node *node; | ||
18 | struct device dev; | ||
19 | struct resource resource[PROMREG_MAX]; | ||
20 | unsigned int irqs[PROMINTR_MAX]; | ||
21 | int num_irqs; | ||
22 | |||
23 | void *sysdata; | ||
24 | |||
25 | int slot; | ||
26 | int portid; | ||
27 | int clock_freq; | ||
28 | }; | ||
29 | |||
30 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); | ||
31 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); | ||
32 | |||
33 | /* These are just here during the transition */ | ||
34 | #include <linux/of_device.h> | ||
35 | #include <linux/of_platform.h> | ||
36 | |||
37 | #endif /* __KERNEL__ */ | ||
38 | #endif /* _ASM_SPARC64_OF_DEVICE_H */ | ||
diff --git a/include/asm-sparc64/of_platform.h b/include/asm-sparc64/of_platform.h index f15cfa723916..78aa032b674c 100644 --- a/include/asm-sparc64/of_platform.h +++ b/include/asm-sparc64/of_platform.h | |||
@@ -22,9 +22,4 @@ extern struct bus_type sbus_bus_type; | |||
22 | 22 | ||
23 | #define of_bus_type of_platform_bus_type /* for compatibility */ | 23 | #define of_bus_type of_platform_bus_type /* for compatibility */ |
24 | 24 | ||
25 | extern struct of_device *of_platform_device_create(struct device_node *np, | ||
26 | const char *bus_id, | ||
27 | struct device *parent, | ||
28 | struct bus_type *bus); | ||
29 | |||
30 | #endif /* _ASM_SPARC64_OF_PLATFORM_H */ | 25 | #endif /* _ASM_SPARC64_OF_PLATFORM_H */ |
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index 07843f9f05df..5fa166ee3ffa 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h | |||
@@ -1,103 +1 @@ | |||
1 | #ifndef _SPARC64_PROM_H | #include <asm-sparc/prom.h> | |
2 | #define _SPARC64_PROM_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | /* | ||
6 | * Definitions for talking to the Open Firmware PROM on | ||
7 | * Power Macintosh computers. | ||
8 | * | ||
9 | * Copyright (C) 1996-2005 Paul Mackerras. | ||
10 | * | ||
11 | * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. | ||
12 | * Updates for SPARC64 by David S. Miller | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version | ||
17 | * 2 of the License, or (at your option) any later version. | ||
18 | */ | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/proc_fs.h> | ||
21 | #include <asm/atomic.h> | ||
22 | |||
23 | #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2 | ||
24 | #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 | ||
25 | |||
26 | #define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l)) | ||
27 | #define of_prop_cmp(s1, s2) strcasecmp((s1), (s2)) | ||
28 | #define of_node_cmp(s1, s2) strcmp((s1), (s2)) | ||
29 | |||
30 | typedef u32 phandle; | ||
31 | typedef u32 ihandle; | ||
32 | |||
33 | struct property { | ||
34 | char *name; | ||
35 | int length; | ||
36 | void *value; | ||
37 | struct property *next; | ||
38 | unsigned long _flags; | ||
39 | unsigned int unique_id; | ||
40 | }; | ||
41 | |||
42 | struct of_irq_controller; | ||
43 | struct device_node { | ||
44 | const char *name; | ||
45 | const char *type; | ||
46 | phandle node; | ||
47 | char *path_component_name; | ||
48 | char *full_name; | ||
49 | |||
50 | struct property *properties; | ||
51 | struct property *deadprops; /* removed properties */ | ||
52 | struct device_node *parent; | ||
53 | struct device_node *child; | ||
54 | struct device_node *sibling; | ||
55 | struct device_node *next; /* next device of same type */ | ||
56 | struct device_node *allnext; /* next in list of all nodes */ | ||
57 | struct proc_dir_entry *pde; /* this node's proc directory */ | ||
58 | struct kref kref; | ||
59 | unsigned long _flags; | ||
60 | void *data; | ||
61 | unsigned int unique_id; | ||
62 | |||
63 | struct of_irq_controller *irq_trans; | ||
64 | }; | ||
65 | |||
66 | struct of_irq_controller { | ||
67 | unsigned int (*irq_build)(struct device_node *, unsigned int, void *); | ||
68 | void *data; | ||
69 | }; | ||
70 | |||
71 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | ||
72 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | ||
73 | |||
74 | extern struct device_node *of_find_node_by_cpuid(int cpuid); | ||
75 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | ||
76 | extern int of_getintprop_default(struct device_node *np, | ||
77 | const char *name, | ||
78 | int def); | ||
79 | extern int of_find_in_proplist(const char *list, const char *match, int len); | ||
80 | |||
81 | extern void prom_build_devicetree(void); | ||
82 | |||
83 | /* Dummy ref counting routines - to be implemented later */ | ||
84 | static inline struct device_node *of_node_get(struct device_node *node) | ||
85 | { | ||
86 | return node; | ||
87 | } | ||
88 | static inline void of_node_put(struct device_node *node) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | /* | ||
93 | * NB: This is here while we transition from using asm/prom.h | ||
94 | * to linux/of.h | ||
95 | */ | ||
96 | #include <linux/of.h> | ||
97 | |||
98 | extern struct device_node *of_console_device; | ||
99 | extern char *of_console_path; | ||
100 | extern char *of_console_options; | ||
101 | |||
102 | #endif /* __KERNEL__ */ | ||
103 | #endif /* _SPARC64_PROM_H */ | ||
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h index 661d8cd08839..74a539a9bd59 100644 --- a/include/asm-v850/page.h +++ b/include/asm-v850/page.h | |||
@@ -57,6 +57,7 @@ typedef struct { unsigned long pte; } pte_t; | |||
57 | typedef struct { unsigned long pmd; } pmd_t; | 57 | typedef struct { unsigned long pmd; } pmd_t; |
58 | typedef struct { unsigned long pgd; } pgd_t; | 58 | typedef struct { unsigned long pgd; } pgd_t; |
59 | typedef struct { unsigned long pgprot; } pgprot_t; | 59 | typedef struct { unsigned long pgprot; } pgprot_t; |
60 | typedef struct page *pgtable_t; | ||
60 | 61 | ||
61 | #define pte_val(x) ((x).pte) | 62 | #define pte_val(x) ((x).pte) |
62 | #define pmd_val(x) ((x).pmd) | 63 | #define pmd_val(x) ((x).pmd) |
diff --git a/include/asm-x86/acpi.h b/include/asm-x86/acpi.h index 98a9ca266531..7a72d6aa50be 100644 --- a/include/asm-x86/acpi.h +++ b/include/asm-x86/acpi.h | |||
@@ -89,6 +89,10 @@ extern int acpi_pci_disabled; | |||
89 | extern int acpi_skip_timer_override; | 89 | extern int acpi_skip_timer_override; |
90 | extern int acpi_use_timer_override; | 90 | extern int acpi_use_timer_override; |
91 | 91 | ||
92 | extern u8 acpi_sci_flags; | ||
93 | extern int acpi_sci_override_gsi; | ||
94 | void acpi_pic_sci_set_trigger(unsigned int, u16); | ||
95 | |||
92 | static inline void disable_acpi(void) | 96 | static inline void disable_acpi(void) |
93 | { | 97 | { |
94 | acpi_disabled = 1; | 98 | acpi_disabled = 1; |
diff --git a/include/asm-x86/cacheflush.h b/include/asm-x86/cacheflush.h index 8dd8c5e3cc7f..6a22212b4b20 100644 --- a/include/asm-x86/cacheflush.h +++ b/include/asm-x86/cacheflush.h | |||
@@ -44,6 +44,8 @@ int set_memory_np(unsigned long addr, int numpages); | |||
44 | 44 | ||
45 | void clflush_cache_range(void *addr, unsigned int size); | 45 | void clflush_cache_range(void *addr, unsigned int size); |
46 | 46 | ||
47 | void cpa_init(void); | ||
48 | |||
47 | #ifdef CONFIG_DEBUG_RODATA | 49 | #ifdef CONFIG_DEBUG_RODATA |
48 | void mark_rodata_ro(void); | 50 | void mark_rodata_ro(void); |
49 | #endif | 51 | #endif |
diff --git a/include/asm-x86/geode.h b/include/asm-x86/geode.h index 811fe14f70b2..9e7280092a48 100644 --- a/include/asm-x86/geode.h +++ b/include/asm-x86/geode.h | |||
@@ -206,12 +206,17 @@ static inline u16 geode_mfgpt_read(int timer, u16 reg) | |||
206 | return inw(base + reg + (timer * 8)); | 206 | return inw(base + reg + (timer * 8)); |
207 | } | 207 | } |
208 | 208 | ||
209 | extern int __init geode_mfgpt_detect(void); | ||
210 | extern int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable); | 209 | extern int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable); |
211 | extern int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable); | 210 | extern int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable); |
212 | extern int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner); | 211 | extern int geode_mfgpt_alloc_timer(int timer, int domain); |
213 | 212 | ||
214 | #define geode_mfgpt_setup_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 1) | 213 | #define geode_mfgpt_setup_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 1) |
215 | #define geode_mfgpt_release_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 0) | 214 | #define geode_mfgpt_release_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 0) |
216 | 215 | ||
216 | #ifdef CONFIG_GEODE_MFGPT_TIMER | ||
217 | extern int __init mfgpt_timer_setup(void); | ||
218 | #else | ||
219 | static inline int mfgpt_timer_setup(void) { return 0; } | ||
220 | #endif | ||
221 | |||
217 | #endif | 222 | #endif |
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h index 984998a30741..5f7257fd589b 100644 --- a/include/asm-x86/page_32.h +++ b/include/asm-x86/page_32.h | |||
@@ -48,7 +48,6 @@ typedef unsigned long pgprotval_t; | |||
48 | typedef unsigned long phys_addr_t; | 48 | typedef unsigned long phys_addr_t; |
49 | 49 | ||
50 | typedef union { pteval_t pte, pte_low; } pte_t; | 50 | typedef union { pteval_t pte, pte_low; } pte_t; |
51 | typedef pte_t boot_pte_t; | ||
52 | 51 | ||
53 | #endif /* __ASSEMBLY__ */ | 52 | #endif /* __ASSEMBLY__ */ |
54 | #endif /* CONFIG_X86_PAE */ | 53 | #endif /* CONFIG_X86_PAE */ |
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index 44c0a4f1b1eb..174b87738714 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -255,7 +255,7 @@ enum { | |||
255 | * NOTE: the return type is pte_t but if the pmd is PSE then we return it | 255 | * NOTE: the return type is pte_t but if the pmd is PSE then we return it |
256 | * as a pte too. | 256 | * as a pte too. |
257 | */ | 257 | */ |
258 | extern pte_t *lookup_address(unsigned long address, int *level); | 258 | extern pte_t *lookup_address(unsigned long address, unsigned int *level); |
259 | 259 | ||
260 | /* local pte updates need not use xchg for locking */ | 260 | /* local pte updates need not use xchg for locking */ |
261 | static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep) | 261 | static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep) |
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h index 80dd438642f6..a842c7222b1e 100644 --- a/include/asm-x86/pgtable_32.h +++ b/include/asm-x86/pgtable_32.h | |||
@@ -52,10 +52,6 @@ void paging_init(void); | |||
52 | #define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT) | 52 | #define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT) |
53 | #define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS) | 53 | #define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS) |
54 | 54 | ||
55 | #define TWOLEVEL_PGDIR_SHIFT 22 | ||
56 | #define BOOT_USER_PGD_PTRS (__PAGE_OFFSET >> TWOLEVEL_PGDIR_SHIFT) | ||
57 | #define BOOT_KERNEL_PGD_PTRS (1024-BOOT_USER_PGD_PTRS) | ||
58 | |||
59 | /* Just any arbitrary offset to the start of the vmalloc VM area: the | 55 | /* Just any arbitrary offset to the start of the vmalloc VM area: the |
60 | * current 8MB value just means that there will be a 8MB "hole" after the | 56 | * current 8MB value just means that there will be a 8MB "hole" after the |
61 | * physical memory until the kernel virtual memory starts. That means that | 57 | * physical memory until the kernel virtual memory starts. That means that |
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index 0ab3a3232330..974f5b7bb205 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h | |||
@@ -5,15 +5,6 @@ | |||
5 | /* These definitions are for GCC v4.x. */ | 5 | /* These definitions are for GCC v4.x. */ |
6 | #include <linux/compiler-gcc.h> | 6 | #include <linux/compiler-gcc.h> |
7 | 7 | ||
8 | #ifdef CONFIG_FORCED_INLINING | ||
9 | # undef inline | ||
10 | # undef __inline__ | ||
11 | # undef __inline | ||
12 | # define inline inline __attribute__((always_inline)) | ||
13 | # define __inline__ __inline__ __attribute__((always_inline)) | ||
14 | # define __inline __inline __attribute__((always_inline)) | ||
15 | #endif | ||
16 | |||
17 | #define __used __attribute__((__used__)) | 8 | #define __used __attribute__((__used__)) |
18 | #define __must_check __attribute__((warn_unused_result)) | 9 | #define __must_check __attribute__((warn_unused_result)) |
19 | #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) | 10 | #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) |
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h index c4f635a4dd25..250032548597 100644 --- a/include/linux/ext4_fs.h +++ b/include/linux/ext4_fs.h | |||
@@ -490,6 +490,13 @@ do { \ | |||
490 | #define EXT4_ORPHAN_FS 0x0004 /* Orphans being recovered */ | 490 | #define EXT4_ORPHAN_FS 0x0004 /* Orphans being recovered */ |
491 | 491 | ||
492 | /* | 492 | /* |
493 | * Misc. filesystem flags | ||
494 | */ | ||
495 | #define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */ | ||
496 | #define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */ | ||
497 | #define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */ | ||
498 | |||
499 | /* | ||
493 | * Mount flags | 500 | * Mount flags |
494 | */ | 501 | */ |
495 | #define EXT4_MOUNT_CHECK 0x00001 /* Do mount-time checks */ | 502 | #define EXT4_MOUNT_CHECK 0x00001 /* Do mount-time checks */ |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 600fc3bcf63e..1ad56a7b2f74 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -316,7 +316,7 @@ static inline u64 hrtimer_forward_now(struct hrtimer *timer, | |||
316 | 316 | ||
317 | /* Precise sleep: */ | 317 | /* Precise sleep: */ |
318 | extern long hrtimer_nanosleep(struct timespec *rqtp, | 318 | extern long hrtimer_nanosleep(struct timespec *rqtp, |
319 | struct timespec *rmtp, | 319 | struct timespec __user *rmtp, |
320 | const enum hrtimer_mode mode, | 320 | const enum hrtimer_mode mode, |
321 | const clockid_t clockid); | 321 | const clockid_t clockid); |
322 | extern long hrtimer_nanosleep_restart(struct restart_block *restart_block); | 322 | extern long hrtimer_nanosleep_restart(struct restart_block *restart_block); |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 9815951ec995..925d57b236aa 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -51,10 +51,8 @@ extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, | |||
51 | gfp_t gfp_mask); | 51 | gfp_t gfp_mask); |
52 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); | 52 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); |
53 | 53 | ||
54 | static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm) | 54 | #define vm_match_cgroup(mm, cgroup) \ |
55 | { | 55 | ((cgroup) == rcu_dereference((mm)->mem_cgroup)) |
56 | return rcu_dereference(mm->mem_cgroup); | ||
57 | } | ||
58 | 56 | ||
59 | extern int mem_cgroup_prepare_migration(struct page *page); | 57 | extern int mem_cgroup_prepare_migration(struct page *page); |
60 | extern void mem_cgroup_end_migration(struct page *page); | 58 | extern void mem_cgroup_end_migration(struct page *page); |
@@ -123,9 +121,9 @@ static inline int mem_cgroup_cache_charge(struct page *page, | |||
123 | return 0; | 121 | return 0; |
124 | } | 122 | } |
125 | 123 | ||
126 | static inline struct mem_cgroup *mm_cgroup(const struct mm_struct *mm) | 124 | static inline int vm_match_cgroup(struct mm_struct *mm, struct mem_cgroup *mem) |
127 | { | 125 | { |
128 | return NULL; | 126 | return 1; |
129 | } | 127 | } |
130 | 128 | ||
131 | static inline int task_in_mem_cgroup(struct task_struct *task, | 129 | static inline int task_in_mem_cgroup(struct task_struct *task, |
diff --git a/include/linux/memstick.h b/include/linux/memstick.h new file mode 100644 index 000000000000..334d059d6794 --- /dev/null +++ b/include/linux/memstick.h | |||
@@ -0,0 +1,299 @@ | |||
1 | /* | ||
2 | * Sony MemoryStick support | ||
3 | * | ||
4 | * Copyright (C) 2007 Alex Dubov <oakad@yahoo.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef _MEMSTICK_H | ||
13 | #define _MEMSTICK_H | ||
14 | |||
15 | #include <linux/workqueue.h> | ||
16 | #include <linux/scatterlist.h> | ||
17 | #include <linux/device.h> | ||
18 | |||
19 | /*** Hardware based structures ***/ | ||
20 | |||
21 | struct ms_status_register { | ||
22 | unsigned char reserved; | ||
23 | unsigned char interrupt; | ||
24 | #define MEMSTICK_INT_CMDNAK 0x0001 | ||
25 | #define MEMSTICK_INT_BREQ 0x0020 | ||
26 | #define MEMSTICK_INT_ERR 0x0040 | ||
27 | #define MEMSTICK_INT_CED 0x0080 | ||
28 | |||
29 | unsigned char status0; | ||
30 | #define MEMSTICK_STATUS0_WP 0x0001 | ||
31 | #define MEMSTICK_STATUS0_SL 0x0002 | ||
32 | #define MEMSTICK_STATUS0_BF 0x0010 | ||
33 | #define MEMSTICK_STATUS0_BE 0x0020 | ||
34 | #define MEMSTICK_STATUS0_FB0 0x0040 | ||
35 | #define MEMSTICK_STATUS0_MB 0x0080 | ||
36 | |||
37 | unsigned char status1; | ||
38 | #define MEMSTICK_STATUS1_UCFG 0x0001 | ||
39 | #define MEMSTICK_STATUS1_FGER 0x0002 | ||
40 | #define MEMSTICK_STATUS1_UCEX 0x0004 | ||
41 | #define MEMSTICK_STATUS1_EXER 0x0008 | ||
42 | #define MEMSTICK_STATUS1_UCDT 0x0010 | ||
43 | #define MEMSTICK_STATUS1_DTER 0x0020 | ||
44 | #define MEMSTICK_STATUS1_FBI 0x0040 | ||
45 | #define MEMSTICK_STATUS1_MB 0x0080 | ||
46 | } __attribute__((packed)); | ||
47 | |||
48 | struct ms_id_register { | ||
49 | unsigned char type; | ||
50 | unsigned char reserved; | ||
51 | unsigned char category; | ||
52 | unsigned char class; | ||
53 | } __attribute__((packed)); | ||
54 | |||
55 | struct ms_param_register { | ||
56 | unsigned char system; | ||
57 | unsigned char block_address_msb; | ||
58 | unsigned short block_address; | ||
59 | unsigned char cp; | ||
60 | #define MEMSTICK_CP_BLOCK 0x0000 | ||
61 | #define MEMSTICK_CP_PAGE 0x0020 | ||
62 | #define MEMSTICK_CP_EXTRA 0x0040 | ||
63 | #define MEMSTICK_CP_OVERWRITE 0x0080 | ||
64 | |||
65 | unsigned char page_address; | ||
66 | } __attribute__((packed)); | ||
67 | |||
68 | struct ms_extra_data_register { | ||
69 | unsigned char overwrite_flag; | ||
70 | #define MEMSTICK_OVERWRITE_UPDATA 0x0010 | ||
71 | #define MEMSTICK_OVERWRITE_PAGE 0x0060 | ||
72 | #define MEMSTICK_OVERWRITE_BLOCK 0x0080 | ||
73 | |||
74 | unsigned char management_flag; | ||
75 | #define MEMSTICK_MANAGEMENT_SYSTEM 0x0004 | ||
76 | #define MEMSTICK_MANAGEMENT_TRANS_TABLE 0x0008 | ||
77 | #define MEMSTICK_MANAGEMENT_COPY 0x0010 | ||
78 | #define MEMSTICK_MANAGEMENT_ACCESS 0x0020 | ||
79 | |||
80 | unsigned short logical_address; | ||
81 | } __attribute__((packed)); | ||
82 | |||
83 | struct ms_register { | ||
84 | struct ms_status_register status; | ||
85 | struct ms_id_register id; | ||
86 | unsigned char reserved[8]; | ||
87 | struct ms_param_register param; | ||
88 | struct ms_extra_data_register extra_data; | ||
89 | } __attribute__((packed)); | ||
90 | |||
91 | struct mspro_param_register { | ||
92 | unsigned char system; | ||
93 | unsigned short data_count; | ||
94 | unsigned int data_address; | ||
95 | unsigned char cmd_param; | ||
96 | } __attribute__((packed)); | ||
97 | |||
98 | struct mspro_register { | ||
99 | struct ms_status_register status; | ||
100 | struct ms_id_register id; | ||
101 | unsigned char reserved[8]; | ||
102 | struct mspro_param_register param; | ||
103 | } __attribute__((packed)); | ||
104 | |||
105 | struct ms_register_addr { | ||
106 | unsigned char r_offset; | ||
107 | unsigned char r_length; | ||
108 | unsigned char w_offset; | ||
109 | unsigned char w_length; | ||
110 | } __attribute__((packed)); | ||
111 | |||
112 | enum { | ||
113 | MS_TPC_READ_LONG_DATA = 0x02, | ||
114 | MS_TPC_READ_SHORT_DATA = 0x03, | ||
115 | MS_TPC_READ_REG = 0x04, | ||
116 | MS_TPC_READ_IO_DATA = 0x05, /* unverified */ | ||
117 | MS_TPC_GET_INT = 0x07, | ||
118 | MS_TPC_SET_RW_REG_ADRS = 0x08, | ||
119 | MS_TPC_EX_SET_CMD = 0x09, | ||
120 | MS_TPC_WRITE_IO_DATA = 0x0a, /* unverified */ | ||
121 | MS_TPC_WRITE_REG = 0x0b, | ||
122 | MS_TPC_WRITE_SHORT_DATA = 0x0c, | ||
123 | MS_TPC_WRITE_LONG_DATA = 0x0d, | ||
124 | MS_TPC_SET_CMD = 0x0e | ||
125 | }; | ||
126 | |||
127 | enum { | ||
128 | MS_CMD_BLOCK_END = 0x33, | ||
129 | MS_CMD_RESET = 0x3c, | ||
130 | MS_CMD_BLOCK_WRITE = 0x55, | ||
131 | MS_CMD_SLEEP = 0x5a, | ||
132 | MS_CMD_BLOCK_ERASE = 0x99, | ||
133 | MS_CMD_BLOCK_READ = 0xaa, | ||
134 | MS_CMD_CLEAR_BUF = 0xc3, | ||
135 | MS_CMD_FLASH_STOP = 0xcc, | ||
136 | MSPRO_CMD_FORMAT = 0x10, | ||
137 | MSPRO_CMD_SLEEP = 0x11, | ||
138 | MSPRO_CMD_READ_DATA = 0x20, | ||
139 | MSPRO_CMD_WRITE_DATA = 0x21, | ||
140 | MSPRO_CMD_READ_ATRB = 0x24, | ||
141 | MSPRO_CMD_STOP = 0x25, | ||
142 | MSPRO_CMD_ERASE = 0x26, | ||
143 | MSPRO_CMD_SET_IBA = 0x46, | ||
144 | MSPRO_CMD_SET_IBD = 0x47 | ||
145 | /* | ||
146 | MSPRO_CMD_RESET | ||
147 | MSPRO_CMD_WAKEUP | ||
148 | MSPRO_CMD_IN_IO_DATA | ||
149 | MSPRO_CMD_OUT_IO_DATA | ||
150 | MSPRO_CMD_READ_IO_ATRB | ||
151 | MSPRO_CMD_IN_IO_FIFO | ||
152 | MSPRO_CMD_OUT_IO_FIFO | ||
153 | MSPRO_CMD_IN_IOM | ||
154 | MSPRO_CMD_OUT_IOM | ||
155 | */ | ||
156 | }; | ||
157 | |||
158 | /*** Driver structures and functions ***/ | ||
159 | |||
160 | #define MEMSTICK_PART_SHIFT 3 | ||
161 | |||
162 | enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE }; | ||
163 | |||
164 | #define MEMSTICK_POWER_OFF 0 | ||
165 | #define MEMSTICK_POWER_ON 1 | ||
166 | |||
167 | #define MEMSTICK_SERIAL 0 | ||
168 | #define MEMSTICK_PARALLEL 1 | ||
169 | |||
170 | struct memstick_host; | ||
171 | struct memstick_driver; | ||
172 | |||
173 | #define MEMSTICK_MATCH_ALL 0x01 | ||
174 | |||
175 | #define MEMSTICK_TYPE_LEGACY 0xff | ||
176 | #define MEMSTICK_TYPE_DUO 0x00 | ||
177 | #define MEMSTICK_TYPE_PRO 0x01 | ||
178 | |||
179 | #define MEMSTICK_CATEGORY_STORAGE 0xff | ||
180 | #define MEMSTICK_CATEGORY_STORAGE_DUO 0x00 | ||
181 | |||
182 | #define MEMSTICK_CLASS_GENERIC 0xff | ||
183 | #define MEMSTICK_CLASS_GENERIC_DUO 0x00 | ||
184 | |||
185 | |||
186 | struct memstick_device_id { | ||
187 | unsigned char match_flags; | ||
188 | unsigned char type; | ||
189 | unsigned char category; | ||
190 | unsigned char class; | ||
191 | }; | ||
192 | |||
193 | struct memstick_request { | ||
194 | unsigned char tpc; | ||
195 | unsigned char data_dir:1, | ||
196 | need_card_int:1, | ||
197 | get_int_reg:1, | ||
198 | io_type:2; | ||
199 | #define MEMSTICK_IO_NONE 0 | ||
200 | #define MEMSTICK_IO_VAL 1 | ||
201 | #define MEMSTICK_IO_SG 2 | ||
202 | |||
203 | unsigned char int_reg; | ||
204 | int error; | ||
205 | union { | ||
206 | struct scatterlist sg; | ||
207 | struct { | ||
208 | unsigned char data_len; | ||
209 | unsigned char data[15]; | ||
210 | }; | ||
211 | }; | ||
212 | }; | ||
213 | |||
214 | struct memstick_dev { | ||
215 | struct memstick_device_id id; | ||
216 | struct memstick_host *host; | ||
217 | struct ms_register_addr reg_addr; | ||
218 | struct completion mrq_complete; | ||
219 | struct memstick_request current_mrq; | ||
220 | |||
221 | /* Check that media driver is still willing to operate the device. */ | ||
222 | int (*check)(struct memstick_dev *card); | ||
223 | /* Get next request from the media driver. */ | ||
224 | int (*next_request)(struct memstick_dev *card, | ||
225 | struct memstick_request **mrq); | ||
226 | |||
227 | struct device dev; | ||
228 | }; | ||
229 | |||
230 | struct memstick_host { | ||
231 | struct mutex lock; | ||
232 | unsigned int id; | ||
233 | unsigned int caps; | ||
234 | #define MEMSTICK_CAP_PARALLEL 1 | ||
235 | #define MEMSTICK_CAP_AUTO_GET_INT 2 | ||
236 | |||
237 | struct work_struct media_checker; | ||
238 | struct class_device cdev; | ||
239 | |||
240 | struct memstick_dev *card; | ||
241 | unsigned int retries; | ||
242 | |||
243 | /* Notify the host that some requests are pending. */ | ||
244 | void (*request)(struct memstick_host *host); | ||
245 | /* Set host IO parameters (power, clock, etc). */ | ||
246 | void (*set_param)(struct memstick_host *host, | ||
247 | enum memstick_param param, | ||
248 | int value); | ||
249 | unsigned long private[0] ____cacheline_aligned; | ||
250 | }; | ||
251 | |||
252 | struct memstick_driver { | ||
253 | struct memstick_device_id *id_table; | ||
254 | int (*probe)(struct memstick_dev *card); | ||
255 | void (*remove)(struct memstick_dev *card); | ||
256 | int (*suspend)(struct memstick_dev *card, | ||
257 | pm_message_t state); | ||
258 | int (*resume)(struct memstick_dev *card); | ||
259 | |||
260 | struct device_driver driver; | ||
261 | }; | ||
262 | |||
263 | int memstick_register_driver(struct memstick_driver *drv); | ||
264 | void memstick_unregister_driver(struct memstick_driver *drv); | ||
265 | |||
266 | struct memstick_host *memstick_alloc_host(unsigned int extra, | ||
267 | struct device *dev); | ||
268 | |||
269 | int memstick_add_host(struct memstick_host *host); | ||
270 | void memstick_remove_host(struct memstick_host *host); | ||
271 | void memstick_free_host(struct memstick_host *host); | ||
272 | void memstick_detect_change(struct memstick_host *host); | ||
273 | |||
274 | void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, | ||
275 | struct scatterlist *sg); | ||
276 | void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, | ||
277 | void *buf, size_t length); | ||
278 | int memstick_next_req(struct memstick_host *host, | ||
279 | struct memstick_request **mrq); | ||
280 | void memstick_new_req(struct memstick_host *host); | ||
281 | |||
282 | int memstick_set_rw_addr(struct memstick_dev *card); | ||
283 | |||
284 | static inline void *memstick_priv(struct memstick_host *host) | ||
285 | { | ||
286 | return (void *)host->private; | ||
287 | } | ||
288 | |||
289 | static inline void *memstick_get_drvdata(struct memstick_dev *card) | ||
290 | { | ||
291 | return dev_get_drvdata(&card->dev); | ||
292 | } | ||
293 | |||
294 | static inline void memstick_set_drvdata(struct memstick_dev *card, void *data) | ||
295 | { | ||
296 | dev_set_drvdata(&card->dev, data); | ||
297 | } | ||
298 | |||
299 | #endif | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 7215d3b1f4af..87195b62de52 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -301,14 +301,14 @@ struct pci_ops { | |||
301 | int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); | 301 | int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); |
302 | }; | 302 | }; |
303 | 303 | ||
304 | struct pci_raw_ops { | 304 | /* |
305 | int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn, | 305 | * ACPI needs to be able to access PCI config space before we've done a |
306 | int reg, int len, u32 *val); | 306 | * PCI bus scan and created pci_bus structures. |
307 | int (*write)(unsigned int domain, unsigned int bus, unsigned int devfn, | 307 | */ |
308 | int reg, int len, u32 val); | 308 | extern int raw_pci_read(unsigned int domain, unsigned int bus, |
309 | }; | 309 | unsigned int devfn, int reg, int len, u32 *val); |
310 | 310 | extern int raw_pci_write(unsigned int domain, unsigned int bus, | |
311 | extern struct pci_raw_ops *raw_pci_ops; | 311 | unsigned int devfn, int reg, int len, u32 val); |
312 | 312 | ||
313 | struct pci_bus_region { | 313 | struct pci_bus_region { |
314 | resource_size_t start; | 314 | resource_size_t start; |
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 5eb38cc0e5a4..8ba1c320f975 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
@@ -10,13 +10,13 @@ | |||
10 | * | 10 | * |
11 | * Various protocol defined structures. | 11 | * Various protocol defined structures. |
12 | * | 12 | * |
13 | * The SCTP reference implementation is free software; | 13 | * This SCTP implementation is free software; |
14 | * you can redistribute it and/or modify it under the terms of | 14 | * you can redistribute it and/or modify it under the terms of |
15 | * the GNU General Public License as published by | 15 | * the GNU General Public License as published by |
16 | * the Free Software Foundation; either version 2, or (at your option) | 16 | * the Free Software Foundation; either version 2, or (at your option) |
17 | * any later version. | 17 | * any later version. |
18 | * | 18 | * |
19 | * The SCTP reference implementation is distributed in the hope that it | 19 | * This SCTP implementation is distributed in the hope that it |
20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
21 | * ************************ | 21 | * ************************ |
22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/linux/swapops.h b/include/linux/swapops.h index 7bf2d149d209..6ec39ab27b4b 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h | |||
@@ -42,11 +42,13 @@ static inline pgoff_t swp_offset(swp_entry_t entry) | |||
42 | return entry.val & SWP_OFFSET_MASK(entry); | 42 | return entry.val & SWP_OFFSET_MASK(entry); |
43 | } | 43 | } |
44 | 44 | ||
45 | #ifdef CONFIG_MMU | ||
45 | /* check whether a pte points to a swap entry */ | 46 | /* check whether a pte points to a swap entry */ |
46 | static inline int is_swap_pte(pte_t pte) | 47 | static inline int is_swap_pte(pte_t pte) |
47 | { | 48 | { |
48 | return !pte_none(pte) && !pte_present(pte) && !pte_file(pte); | 49 | return !pte_none(pte) && !pte_present(pte) && !pte_file(pte); |
49 | } | 50 | } |
51 | #endif | ||
50 | 52 | ||
51 | /* | 53 | /* |
52 | * Convert the arch-dependent pte representation of a swp_entry_t into an | 54 | * Convert the arch-dependent pte representation of a swp_entry_t into an |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index bba7712cadc7..818ca1cf0b6d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -79,7 +79,9 @@ struct thermal_zone_device { | |||
79 | }; | 79 | }; |
80 | 80 | ||
81 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, | 81 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, |
82 | struct thermal_zone_device_ops *); | 82 | struct |
83 | thermal_zone_device_ops | ||
84 | *); | ||
83 | void thermal_zone_device_unregister(struct thermal_zone_device *); | 85 | void thermal_zone_device_unregister(struct thermal_zone_device *); |
84 | 86 | ||
85 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, | 87 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, |
@@ -87,8 +89,23 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, | |||
87 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, | 89 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, |
88 | struct thermal_cooling_device *); | 90 | struct thermal_cooling_device *); |
89 | 91 | ||
92 | #ifdef CONFIG_THERMAL | ||
90 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 93 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
91 | struct thermal_cooling_device_ops *); | 94 | struct |
95 | thermal_cooling_device_ops | ||
96 | *); | ||
92 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 97 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
98 | #else | ||
99 | static inline struct thermal_cooling_device | ||
100 | *thermal_cooling_device_register(char *c, void *v, | ||
101 | struct thermal_cooling_device_ops *t) | ||
102 | { | ||
103 | return NULL; | ||
104 | } | ||
105 | static inline | ||
106 | void thermal_cooling_device_unregister(struct thermal_cooling_device *t) | ||
107 | { | ||
108 | }; | ||
109 | #endif | ||
93 | 110 | ||
94 | #endif /* __THERMAL_H__ */ | 111 | #endif /* __THERMAL_H__ */ |
diff --git a/include/linux/tifm.h b/include/linux/tifm.h index 2096b76d0cee..da76ed85f595 100644 --- a/include/linux/tifm.h +++ b/include/linux/tifm.h | |||
@@ -72,6 +72,7 @@ enum { | |||
72 | #define TIFM_FIFO_READY 0x00000001 | 72 | #define TIFM_FIFO_READY 0x00000001 |
73 | #define TIFM_FIFO_INT_SETALL 0x0000ffff | 73 | #define TIFM_FIFO_INT_SETALL 0x0000ffff |
74 | #define TIFM_FIFO_INTMASK 0x00000005 | 74 | #define TIFM_FIFO_INTMASK 0x00000005 |
75 | #define TIFM_FIFO_SIZE 0x00000200 | ||
75 | 76 | ||
76 | #define TIFM_DMA_RESET 0x00000002 | 77 | #define TIFM_DMA_RESET 0x00000002 |
77 | #define TIFM_DMA_TX 0x00008000 | 78 | #define TIFM_DMA_TX 0x00008000 |
@@ -124,6 +125,8 @@ struct tifm_adapter { | |||
124 | 125 | ||
125 | void (*eject)(struct tifm_adapter *fm, | 126 | void (*eject)(struct tifm_adapter *fm, |
126 | struct tifm_dev *sock); | 127 | struct tifm_dev *sock); |
128 | int (*has_ms_pif)(struct tifm_adapter *fm, | ||
129 | struct tifm_dev *sock); | ||
127 | 130 | ||
128 | struct tifm_dev *sockets[0]; | 131 | struct tifm_dev *sockets[0]; |
129 | }; | 132 | }; |
@@ -141,6 +144,7 @@ struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id, | |||
141 | int tifm_register_driver(struct tifm_driver *drv); | 144 | int tifm_register_driver(struct tifm_driver *drv); |
142 | void tifm_unregister_driver(struct tifm_driver *drv); | 145 | void tifm_unregister_driver(struct tifm_driver *drv); |
143 | void tifm_eject(struct tifm_dev *sock); | 146 | void tifm_eject(struct tifm_dev *sock); |
147 | int tifm_has_ms_pif(struct tifm_dev *sock); | ||
144 | int tifm_map_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents, | 148 | int tifm_map_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents, |
145 | int direction); | 149 | int direction); |
146 | void tifm_unmap_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents, | 150 | void tifm_unmap_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents, |
diff --git a/include/linux/timex.h b/include/linux/timex.h index 8ea3e71ba7fa..c3f374786a43 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -232,7 +232,14 @@ static inline int ntp_synced(void) | |||
232 | #else | 232 | #else |
233 | #define NTP_INTERVAL_FREQ (HZ) | 233 | #define NTP_INTERVAL_FREQ (HZ) |
234 | #endif | 234 | #endif |
235 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 235 | |
236 | #define CLOCK_TICK_OVERFLOW (LATCH * HZ - CLOCK_TICK_RATE) | ||
237 | #define CLOCK_TICK_ADJUST (((s64)CLOCK_TICK_OVERFLOW * NSEC_PER_SEC) / \ | ||
238 | (s64)CLOCK_TICK_RATE) | ||
239 | |||
240 | /* Because using NSEC_PER_SEC would be too easy */ | ||
241 | #define NTP_INTERVAL_LENGTH ((((s64)TICK_USEC * NSEC_PER_USEC * USER_HZ) + \ | ||
242 | CLOCK_TICK_ADJUST) / NTP_INTERVAL_FREQ) | ||
236 | 243 | ||
237 | /* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ | 244 | /* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ |
238 | extern u64 current_tick_length(void); | 245 | extern u64 current_tick_length(void); |
diff --git a/include/net/sctp/auth.h b/include/net/sctp/auth.h index 5db261a1e85e..49bc9577c61e 100644 --- a/include/net/sctp/auth.h +++ b/include/net/sctp/auth.h | |||
@@ -1,15 +1,15 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright 2007 Hewlett-Packard Development Company, L.P. | 2 | * (C) Copyright 2007 Hewlett-Packard Development Company, L.P. |
3 | * | 3 | * |
4 | * This file is part of the SCTP kernel reference Implementation | 4 | * This file is part of the SCTP kernel implementation |
5 | * | 5 | * |
6 | * The SCTP reference implementation is free software; | 6 | * This SCTP implementation is free software; |
7 | * you can redistribute it and/or modify it under the terms of | 7 | * you can redistribute it and/or modify it under the terms of |
8 | * the GNU General Public License as published by | 8 | * the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2, or (at your option) | 9 | * the Free Software Foundation; either version 2, or (at your option) |
10 | * any later version. | 10 | * any later version. |
11 | * | 11 | * |
12 | * The SCTP reference implementation is distributed in the hope that it | 12 | * This SCTP implementation is distributed in the hope that it |
13 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 13 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
14 | * ************************ | 14 | * ************************ |
15 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 15 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index c1f797673571..10ae2da6f93b 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
@@ -1,18 +1,18 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel Implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (C) 1999-2001 Cisco, Motorola | 3 | * Copyright (C) 1999-2001 Cisco, Motorola |
4 | * | 4 | * |
5 | * This file is part of the SCTP kernel reference Implementation | 5 | * This file is part of the SCTP kernel implementation |
6 | * | 6 | * |
7 | * These are the definitions needed for the command object. | 7 | * These are the definitions needed for the command object. |
8 | * | 8 | * |
9 | * The SCTP reference implementation is free software; | 9 | * This SCTP implementation is free software; |
10 | * you can redistribute it and/or modify it under the terms of | 10 | * you can redistribute it and/or modify it under the terms of |
11 | * the GNU General Public License as published by | 11 | * the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2, or (at your option) | 12 | * the Free Software Foundation; either version 2, or (at your option) |
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | * the SCTP reference implementation is distributed in the hope that it | 15 | * This SCTP implementation is distributed in the hope that it |
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | * ************************ | 17 | * ************************ |
18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index fefcba67bd1e..c32ddf0279c8 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -1,18 +1,18 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001 Intel Corp. | 5 | * Copyright (c) 2001 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * The SCTP reference implementation is free software; | 9 | * This SCTP implementation is free software; |
10 | * you can redistribute it and/or modify it under the terms of | 10 | * you can redistribute it and/or modify it under the terms of |
11 | * the GNU General Public License as published by | 11 | * the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2, or (at your option) | 12 | * the Free Software Foundation; either version 2, or (at your option) |
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | * The SCTP reference implementation is distributed in the hope that it | 15 | * This SCTP implementation is distributed in the hope that it |
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | * ************************ | 17 | * ************************ |
18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 4977b0a81535..57df27f19588 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -1,20 +1,20 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001-2003 Intel Corp. | 5 | * Copyright (c) 2001-2003 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * The base lksctp header. | 9 | * The base lksctp header. |
10 | * | 10 | * |
11 | * The SCTP reference implementation is free software; | 11 | * This SCTP implementation is free software; |
12 | * you can redistribute it and/or modify it under the terms of | 12 | * you can redistribute it and/or modify it under the terms of |
13 | * the GNU General Public License as published by | 13 | * the GNU General Public License as published by |
14 | * the Free Software Foundation; either version 2, or (at your option) | 14 | * the Free Software Foundation; either version 2, or (at your option) |
15 | * any later version. | 15 | * any later version. |
16 | * | 16 | * |
17 | * The SCTP reference implementation is distributed in the hope that it | 17 | * This SCTP implementation is distributed in the hope that it |
18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
19 | * ************************ | 19 | * ************************ |
20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index bf2f5ed69c15..ef9e7ed2c82e 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -1,20 +1,20 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001 Intel Corp. | 5 | * Copyright (c) 2001 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * These are definitions needed by the state machine. | 9 | * These are definitions needed by the state machine. |
10 | * | 10 | * |
11 | * The SCTP reference implementation is free software; | 11 | * This SCTP implementation is free software; |
12 | * you can redistribute it and/or modify it under the terms of | 12 | * you can redistribute it and/or modify it under the terms of |
13 | * the GNU General Public License as published by | 13 | * the GNU General Public License as published by |
14 | * the Free Software Foundation; either version 2, or (at your option) | 14 | * the Free Software Foundation; either version 2, or (at your option) |
15 | * any later version. | 15 | * any later version. |
16 | * | 16 | * |
17 | * The SCTP reference implementation is distributed in the hope that it | 17 | * This SCTP implementation is distributed in the hope that it |
18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
19 | * ************************ | 19 | * ************************ |
20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 4d591bfce452..9c827a749b6f 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -1,18 +1,18 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001 Intel Corp. | 5 | * Copyright (c) 2001 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * The SCTP reference implementation is free software; | 9 | * This SCTP implementation is free software; |
10 | * you can redistribute it and/or modify it under the terms of | 10 | * you can redistribute it and/or modify it under the terms of |
11 | * the GNU General Public License as published by | 11 | * the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2, or (at your option) | 12 | * the Free Software Foundation; either version 2, or (at your option) |
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | * The SCTP reference implementation is distributed in the hope that it | 15 | * This SCTP implementation is distributed in the hope that it |
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | * ************************ | 17 | * ************************ |
18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/net/sctp/tsnmap.h b/include/net/sctp/tsnmap.h index 70a824df6f60..099211bf998d 100644 --- a/include/net/sctp/tsnmap.h +++ b/include/net/sctp/tsnmap.h | |||
@@ -1,21 +1,21 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001 Intel Corp. | 5 | * Copyright (c) 2001 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * These are the definitions needed for the tsnmap type. The tsnmap is used | 9 | * These are the definitions needed for the tsnmap type. The tsnmap is used |
10 | * to track out of order TSNs received. | 10 | * to track out of order TSNs received. |
11 | * | 11 | * |
12 | * The SCTP reference implementation is free software; | 12 | * This SCTP implementation is free software; |
13 | * you can redistribute it and/or modify it under the terms of | 13 | * you can redistribute it and/or modify it under the terms of |
14 | * the GNU General Public License as published by | 14 | * the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2, or (at your option) | 15 | * the Free Software Foundation; either version 2, or (at your option) |
16 | * any later version. | 16 | * any later version. |
17 | * | 17 | * |
18 | * The SCTP reference implementation is distributed in the hope that it | 18 | * This SCTP implementation is distributed in the hope that it |
19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | * ************************ | 20 | * ************************ |
21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h index 922a151eb93c..9bcfc12275e8 100644 --- a/include/net/sctp/ulpevent.h +++ b/include/net/sctp/ulpevent.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
@@ -10,15 +10,15 @@ | |||
10 | * sctp_ulpevent type is used to carry information from the state machine | 10 | * sctp_ulpevent type is used to carry information from the state machine |
11 | * upwards to the ULP. | 11 | * upwards to the ULP. |
12 | * | 12 | * |
13 | * This file is part of the SCTP kernel reference Implementation | 13 | * This file is part of the SCTP kernel implementation |
14 | * | 14 | * |
15 | * The SCTP reference implementation is free software; | 15 | * This SCTP implementation is free software; |
16 | * you can redistribute it and/or modify it under the terms of | 16 | * you can redistribute it and/or modify it under the terms of |
17 | * the GNU General Public License as published by | 17 | * the GNU General Public License as published by |
18 | * the Free Software Foundation; either version 2, or (at your option) | 18 | * the Free Software Foundation; either version 2, or (at your option) |
19 | * any later version. | 19 | * any later version. |
20 | * | 20 | * |
21 | * The SCTP reference implementation is distributed in the hope that it | 21 | * This SCTP implementation is distributed in the hope that it |
22 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 22 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
23 | * ************************ | 23 | * ************************ |
24 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 24 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h index cd33270e86dd..2e5ee0d8458d 100644 --- a/include/net/sctp/ulpqueue.h +++ b/include/net/sctp/ulpqueue.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
@@ -11,13 +11,13 @@ | |||
11 | * and the core SCTP state machine. This is the component which handles | 11 | * and the core SCTP state machine. This is the component which handles |
12 | * reassembly and ordering. | 12 | * reassembly and ordering. |
13 | * | 13 | * |
14 | * The SCTP reference implementation is free software; | 14 | * This SCTP implementation is free software; |
15 | * you can redistribute it and/or modify it under the terms of | 15 | * you can redistribute it and/or modify it under the terms of |
16 | * the GNU General Public License as published by | 16 | * the GNU General Public License as published by |
17 | * the Free Software Foundation; either version 2, or (at your option) | 17 | * the Free Software Foundation; either version 2, or (at your option) |
18 | * any later version. | 18 | * any later version. |
19 | * | 19 | * |
20 | * the SCTP reference implementation is distributed in the hope that it | 20 | * This SCTP implementation is distributed in the hope that it |
21 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 21 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
22 | * ************************ | 22 | * ************************ |
23 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 23 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index 954090b1e354..9462d6ae2f37 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
@@ -1,21 +1,21 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2002 Intel Corp. | 5 | * Copyright (c) 2002 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * This header represents the structures and constants needed to support | 9 | * This header represents the structures and constants needed to support |
10 | * the SCTP Extension to the Sockets API. | 10 | * the SCTP Extension to the Sockets API. |
11 | * | 11 | * |
12 | * The SCTP reference implementation is free software; | 12 | * This SCTP implementation is free software; |
13 | * you can redistribute it and/or modify it under the terms of | 13 | * you can redistribute it and/or modify it under the terms of |
14 | * the GNU General Public License as published by | 14 | * the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2, or (at your option) | 15 | * the Free Software Foundation; either version 2, or (at your option) |
16 | * any later version. | 16 | * any later version. |
17 | * | 17 | * |
18 | * The SCTP reference implementation is distributed in the hope that it | 18 | * This SCTP implementation is distributed in the hope that it |
19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | * ************************ | 20 | * ************************ |
21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/init/Kconfig b/init/Kconfig index 455170e1c1e3..824d48cb67bf 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -587,7 +587,7 @@ config COMPAT_BRK | |||
587 | disabled, and can be overriden runtime by setting | 587 | disabled, and can be overriden runtime by setting |
588 | /proc/sys/kernel/randomize_va_space to 2. | 588 | /proc/sys/kernel/randomize_va_space to 2. |
589 | 589 | ||
590 | On non-ancient distros (post-2000 ones) Y is usually a safe choice. | 590 | On non-ancient distros (post-2000 ones) N is usually a safe choice. |
591 | 591 | ||
592 | config BASE_FULL | 592 | config BASE_FULL |
593 | default y | 593 | default y |
diff --git a/init/Makefile b/init/Makefile index 633392f5cdee..c5f157ce293e 100644 --- a/init/Makefile +++ b/init/Makefile | |||
@@ -27,7 +27,9 @@ $(obj)/version.o: include/linux/compile.h | |||
27 | # mkcompile_h will make sure to only update the | 27 | # mkcompile_h will make sure to only update the |
28 | # actual file if its content has changed. | 28 | # actual file if its content has changed. |
29 | 29 | ||
30 | quiet_chk_compile.h = echo ' CHK $@' | ||
31 | silent_chk_compile.h = : | ||
30 | include/linux/compile.h: FORCE | 32 | include/linux/compile.h: FORCE |
31 | @echo ' CHK $@' | 33 | @$($(quiet)chk_compile.h) |
32 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ | 34 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ |
33 | "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)" | 35 | "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)" |
diff --git a/init/main.c b/init/main.c index c59859b85db0..8b1982082ad8 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -558,7 +558,6 @@ asmlinkage void __init start_kernel(void) | |||
558 | preempt_disable(); | 558 | preempt_disable(); |
559 | build_all_zonelists(); | 559 | build_all_zonelists(); |
560 | page_alloc_init(); | 560 | page_alloc_init(); |
561 | enable_debug_pagealloc(); | ||
562 | printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line); | 561 | printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line); |
563 | parse_early_param(); | 562 | parse_early_param(); |
564 | parse_args("Booting kernel", static_command_line, __start___param, | 563 | parse_args("Booting kernel", static_command_line, __start___param, |
@@ -614,6 +613,7 @@ asmlinkage void __init start_kernel(void) | |||
614 | vfs_caches_init_early(); | 613 | vfs_caches_init_early(); |
615 | cpuset_init_early(); | 614 | cpuset_init_early(); |
616 | mem_init(); | 615 | mem_init(); |
616 | enable_debug_pagealloc(); | ||
617 | cpu_hotplug_init(); | 617 | cpu_hotplug_init(); |
618 | kmem_cache_init(); | 618 | kmem_cache_init(); |
619 | setup_per_cpu_pageset(); | 619 | setup_per_cpu_pageset(); |
diff --git a/kernel/.gitignore b/kernel/.gitignore index f2ab70073bd4..ab4f1090f437 100644 --- a/kernel/.gitignore +++ b/kernel/.gitignore | |||
@@ -3,3 +3,4 @@ | |||
3 | # | 3 | # |
4 | config_data.h | 4 | config_data.h |
5 | config_data.gz | 5 | config_data.gz |
6 | timeconst.h | ||
diff --git a/kernel/compat.c b/kernel/compat.c index 42a1ed4b61b1..5f0e201bcfd3 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -40,10 +40,35 @@ int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user | |||
40 | __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; | 40 | __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; |
41 | } | 41 | } |
42 | 42 | ||
43 | static long compat_nanosleep_restart(struct restart_block *restart) | ||
44 | { | ||
45 | struct compat_timespec __user *rmtp; | ||
46 | struct timespec rmt; | ||
47 | mm_segment_t oldfs; | ||
48 | long ret; | ||
49 | |||
50 | rmtp = (struct compat_timespec __user *)(restart->arg1); | ||
51 | restart->arg1 = (unsigned long)&rmt; | ||
52 | oldfs = get_fs(); | ||
53 | set_fs(KERNEL_DS); | ||
54 | ret = hrtimer_nanosleep_restart(restart); | ||
55 | set_fs(oldfs); | ||
56 | |||
57 | if (ret) { | ||
58 | restart->arg1 = (unsigned long)rmtp; | ||
59 | |||
60 | if (rmtp && put_compat_timespec(&rmt, rmtp)) | ||
61 | return -EFAULT; | ||
62 | } | ||
63 | |||
64 | return ret; | ||
65 | } | ||
66 | |||
43 | asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, | 67 | asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, |
44 | struct compat_timespec __user *rmtp) | 68 | struct compat_timespec __user *rmtp) |
45 | { | 69 | { |
46 | struct timespec tu, rmt; | 70 | struct timespec tu, rmt; |
71 | mm_segment_t oldfs; | ||
47 | long ret; | 72 | long ret; |
48 | 73 | ||
49 | if (get_compat_timespec(&tu, rqtp)) | 74 | if (get_compat_timespec(&tu, rqtp)) |
@@ -52,11 +77,21 @@ asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, | |||
52 | if (!timespec_valid(&tu)) | 77 | if (!timespec_valid(&tu)) |
53 | return -EINVAL; | 78 | return -EINVAL; |
54 | 79 | ||
55 | ret = hrtimer_nanosleep(&tu, rmtp ? &rmt : NULL, HRTIMER_MODE_REL, | 80 | oldfs = get_fs(); |
56 | CLOCK_MONOTONIC); | 81 | set_fs(KERNEL_DS); |
82 | ret = hrtimer_nanosleep(&tu, | ||
83 | rmtp ? (struct timespec __user *)&rmt : NULL, | ||
84 | HRTIMER_MODE_REL, CLOCK_MONOTONIC); | ||
85 | set_fs(oldfs); | ||
86 | |||
87 | if (ret) { | ||
88 | struct restart_block *restart | ||
89 | = ¤t_thread_info()->restart_block; | ||
90 | |||
91 | restart->fn = compat_nanosleep_restart; | ||
92 | restart->arg1 = (unsigned long)rmtp; | ||
57 | 93 | ||
58 | if (ret && rmtp) { | 94 | if (rmtp && put_compat_timespec(&rmt, rmtp)) |
59 | if (put_compat_timespec(&rmt, rmtp)) | ||
60 | return -EFAULT; | 95 | return -EFAULT; |
61 | } | 96 | } |
62 | 97 | ||
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 668f3967eb39..3f4a57c7895d 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -1319,13 +1319,26 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod | |||
1319 | return t->task == NULL; | 1319 | return t->task == NULL; |
1320 | } | 1320 | } |
1321 | 1321 | ||
1322 | static int update_rmtp(struct hrtimer *timer, struct timespec __user *rmtp) | ||
1323 | { | ||
1324 | struct timespec rmt; | ||
1325 | ktime_t rem; | ||
1326 | |||
1327 | rem = ktime_sub(timer->expires, timer->base->get_time()); | ||
1328 | if (rem.tv64 <= 0) | ||
1329 | return 0; | ||
1330 | rmt = ktime_to_timespec(rem); | ||
1331 | |||
1332 | if (copy_to_user(rmtp, &rmt, sizeof(*rmtp))) | ||
1333 | return -EFAULT; | ||
1334 | |||
1335 | return 1; | ||
1336 | } | ||
1337 | |||
1322 | long __sched hrtimer_nanosleep_restart(struct restart_block *restart) | 1338 | long __sched hrtimer_nanosleep_restart(struct restart_block *restart) |
1323 | { | 1339 | { |
1324 | struct hrtimer_sleeper t; | 1340 | struct hrtimer_sleeper t; |
1325 | struct timespec *rmtp; | 1341 | struct timespec __user *rmtp; |
1326 | ktime_t time; | ||
1327 | |||
1328 | restart->fn = do_no_restart_syscall; | ||
1329 | 1342 | ||
1330 | hrtimer_init(&t.timer, restart->arg0, HRTIMER_MODE_ABS); | 1343 | hrtimer_init(&t.timer, restart->arg0, HRTIMER_MODE_ABS); |
1331 | t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2; | 1344 | t.timer.expires.tv64 = ((u64)restart->arg3 << 32) | (u64) restart->arg2; |
@@ -1333,26 +1346,22 @@ long __sched hrtimer_nanosleep_restart(struct restart_block *restart) | |||
1333 | if (do_nanosleep(&t, HRTIMER_MODE_ABS)) | 1346 | if (do_nanosleep(&t, HRTIMER_MODE_ABS)) |
1334 | return 0; | 1347 | return 0; |
1335 | 1348 | ||
1336 | rmtp = (struct timespec *)restart->arg1; | 1349 | rmtp = (struct timespec __user *)restart->arg1; |
1337 | if (rmtp) { | 1350 | if (rmtp) { |
1338 | time = ktime_sub(t.timer.expires, t.timer.base->get_time()); | 1351 | int ret = update_rmtp(&t.timer, rmtp); |
1339 | if (time.tv64 <= 0) | 1352 | if (ret <= 0) |
1340 | return 0; | 1353 | return ret; |
1341 | *rmtp = ktime_to_timespec(time); | ||
1342 | } | 1354 | } |
1343 | 1355 | ||
1344 | restart->fn = hrtimer_nanosleep_restart; | ||
1345 | |||
1346 | /* The other values in restart are already filled in */ | 1356 | /* The other values in restart are already filled in */ |
1347 | return -ERESTART_RESTARTBLOCK; | 1357 | return -ERESTART_RESTARTBLOCK; |
1348 | } | 1358 | } |
1349 | 1359 | ||
1350 | long hrtimer_nanosleep(struct timespec *rqtp, struct timespec *rmtp, | 1360 | long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, |
1351 | const enum hrtimer_mode mode, const clockid_t clockid) | 1361 | const enum hrtimer_mode mode, const clockid_t clockid) |
1352 | { | 1362 | { |
1353 | struct restart_block *restart; | 1363 | struct restart_block *restart; |
1354 | struct hrtimer_sleeper t; | 1364 | struct hrtimer_sleeper t; |
1355 | ktime_t rem; | ||
1356 | 1365 | ||
1357 | hrtimer_init(&t.timer, clockid, mode); | 1366 | hrtimer_init(&t.timer, clockid, mode); |
1358 | t.timer.expires = timespec_to_ktime(*rqtp); | 1367 | t.timer.expires = timespec_to_ktime(*rqtp); |
@@ -1364,10 +1373,9 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec *rmtp, | |||
1364 | return -ERESTARTNOHAND; | 1373 | return -ERESTARTNOHAND; |
1365 | 1374 | ||
1366 | if (rmtp) { | 1375 | if (rmtp) { |
1367 | rem = ktime_sub(t.timer.expires, t.timer.base->get_time()); | 1376 | int ret = update_rmtp(&t.timer, rmtp); |
1368 | if (rem.tv64 <= 0) | 1377 | if (ret <= 0) |
1369 | return 0; | 1378 | return ret; |
1370 | *rmtp = ktime_to_timespec(rem); | ||
1371 | } | 1379 | } |
1372 | 1380 | ||
1373 | restart = ¤t_thread_info()->restart_block; | 1381 | restart = ¤t_thread_info()->restart_block; |
@@ -1383,8 +1391,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec *rmtp, | |||
1383 | asmlinkage long | 1391 | asmlinkage long |
1384 | sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) | 1392 | sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) |
1385 | { | 1393 | { |
1386 | struct timespec tu, rmt; | 1394 | struct timespec tu; |
1387 | int ret; | ||
1388 | 1395 | ||
1389 | if (copy_from_user(&tu, rqtp, sizeof(tu))) | 1396 | if (copy_from_user(&tu, rqtp, sizeof(tu))) |
1390 | return -EFAULT; | 1397 | return -EFAULT; |
@@ -1392,15 +1399,7 @@ sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) | |||
1392 | if (!timespec_valid(&tu)) | 1399 | if (!timespec_valid(&tu)) |
1393 | return -EINVAL; | 1400 | return -EINVAL; |
1394 | 1401 | ||
1395 | ret = hrtimer_nanosleep(&tu, rmtp ? &rmt : NULL, HRTIMER_MODE_REL, | 1402 | return hrtimer_nanosleep(&tu, rmtp, HRTIMER_MODE_REL, CLOCK_MONOTONIC); |
1396 | CLOCK_MONOTONIC); | ||
1397 | |||
1398 | if (ret && rmtp) { | ||
1399 | if (copy_to_user(rmtp, &rmt, sizeof(*rmtp))) | ||
1400 | return -EFAULT; | ||
1401 | } | ||
1402 | |||
1403 | return ret; | ||
1404 | } | 1403 | } |
1405 | 1404 | ||
1406 | /* | 1405 | /* |
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index ce268966007d..022c9c3cee6f 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -982,20 +982,9 @@ sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp) | |||
982 | static int common_nsleep(const clockid_t which_clock, int flags, | 982 | static int common_nsleep(const clockid_t which_clock, int flags, |
983 | struct timespec *tsave, struct timespec __user *rmtp) | 983 | struct timespec *tsave, struct timespec __user *rmtp) |
984 | { | 984 | { |
985 | struct timespec rmt; | 985 | return hrtimer_nanosleep(tsave, rmtp, flags & TIMER_ABSTIME ? |
986 | int ret; | 986 | HRTIMER_MODE_ABS : HRTIMER_MODE_REL, |
987 | 987 | which_clock); | |
988 | ret = hrtimer_nanosleep(tsave, rmtp ? &rmt : NULL, | ||
989 | flags & TIMER_ABSTIME ? | ||
990 | HRTIMER_MODE_ABS : HRTIMER_MODE_REL, | ||
991 | which_clock); | ||
992 | |||
993 | if (ret && rmtp) { | ||
994 | if (copy_to_user(rmtp, &rmt, sizeof(*rmtp))) | ||
995 | return -EFAULT; | ||
996 | } | ||
997 | |||
998 | return ret; | ||
999 | } | 988 | } |
1000 | 989 | ||
1001 | asmlinkage long | 990 | asmlinkage long |
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index e64efaf957e8..c88b5910e7ab 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -43,10 +43,6 @@ long time_freq; /* frequency offset (scaled ppm)*/ | |||
43 | static long time_reftime; /* time at last adjustment (s) */ | 43 | static long time_reftime; /* time at last adjustment (s) */ |
44 | long time_adjust; | 44 | long time_adjust; |
45 | 45 | ||
46 | #define CLOCK_TICK_OVERFLOW (LATCH * HZ - CLOCK_TICK_RATE) | ||
47 | #define CLOCK_TICK_ADJUST (((s64)CLOCK_TICK_OVERFLOW * NSEC_PER_SEC) / \ | ||
48 | (s64)CLOCK_TICK_RATE) | ||
49 | |||
50 | static void ntp_update_frequency(void) | 46 | static void ntp_update_frequency(void) |
51 | { | 47 | { |
52 | u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) | 48 | u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ce0bb2600c25..a370fe828a79 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -465,20 +465,6 @@ config FRAME_POINTER | |||
465 | some architectures or if you use external debuggers. | 465 | some architectures or if you use external debuggers. |
466 | If you don't debug the kernel, you can say N. | 466 | If you don't debug the kernel, you can say N. |
467 | 467 | ||
468 | config FORCED_INLINING | ||
469 | bool "Force gcc to inline functions marked 'inline'" | ||
470 | depends on DEBUG_KERNEL | ||
471 | default y | ||
472 | help | ||
473 | This option determines if the kernel forces gcc to inline the functions | ||
474 | developers have marked 'inline'. Doing so takes away freedom from gcc to | ||
475 | do what it thinks is best, which is desirable for the gcc 3.x series of | ||
476 | compilers. The gcc 4.x series have a rewritten inlining algorithm and | ||
477 | disabling this option will generate a smaller kernel there. Hopefully | ||
478 | this algorithm is so good that allowing gcc4 to make the decision can | ||
479 | become the default in the future, until then this option is there to | ||
480 | test gcc for this. | ||
481 | |||
482 | config BOOT_PRINTK_DELAY | 468 | config BOOT_PRINTK_DELAY |
483 | bool "Delay each boot printk message by N milliseconds" | 469 | bool "Delay each boot printk message by N milliseconds" |
484 | depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY | 470 | depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 419993f58c6b..fd987b17bda7 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -26,6 +26,9 @@ | |||
26 | #include <asm/page.h> /* for PAGE_SIZE */ | 26 | #include <asm/page.h> /* for PAGE_SIZE */ |
27 | #include <asm/div64.h> | 27 | #include <asm/div64.h> |
28 | 28 | ||
29 | /* Works only for digits and letters, but small and fast */ | ||
30 | #define TOLOWER(x) ((x) | 0x20) | ||
31 | |||
29 | /** | 32 | /** |
30 | * simple_strtoul - convert a string to an unsigned long | 33 | * simple_strtoul - convert a string to an unsigned long |
31 | * @cp: The start of the string | 34 | * @cp: The start of the string |
@@ -41,17 +44,17 @@ unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) | |||
41 | if (*cp == '0') { | 44 | if (*cp == '0') { |
42 | base = 8; | 45 | base = 8; |
43 | cp++; | 46 | cp++; |
44 | if ((toupper(*cp) == 'X') && isxdigit(cp[1])) { | 47 | if ((TOLOWER(*cp) == 'x') && isxdigit(cp[1])) { |
45 | cp++; | 48 | cp++; |
46 | base = 16; | 49 | base = 16; |
47 | } | 50 | } |
48 | } | 51 | } |
49 | } else if (base == 16) { | 52 | } else if (base == 16) { |
50 | if (cp[0] == '0' && toupper(cp[1]) == 'X') | 53 | if (cp[0] == '0' && TOLOWER(cp[1]) == 'x') |
51 | cp += 2; | 54 | cp += 2; |
52 | } | 55 | } |
53 | while (isxdigit(*cp) && | 56 | while (isxdigit(*cp) && |
54 | (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) { | 57 | (value = isdigit(*cp) ? *cp-'0' : TOLOWER(*cp)-'a'+10) < base) { |
55 | result = result*base + value; | 58 | result = result*base + value; |
56 | cp++; | 59 | cp++; |
57 | } | 60 | } |
@@ -92,17 +95,17 @@ unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base) | |||
92 | if (*cp == '0') { | 95 | if (*cp == '0') { |
93 | base = 8; | 96 | base = 8; |
94 | cp++; | 97 | cp++; |
95 | if ((toupper(*cp) == 'X') && isxdigit(cp[1])) { | 98 | if ((TOLOWER(*cp) == 'x') && isxdigit(cp[1])) { |
96 | cp++; | 99 | cp++; |
97 | base = 16; | 100 | base = 16; |
98 | } | 101 | } |
99 | } | 102 | } |
100 | } else if (base == 16) { | 103 | } else if (base == 16) { |
101 | if (cp[0] == '0' && toupper(cp[1]) == 'X') | 104 | if (cp[0] == '0' && TOLOWER(cp[1]) == 'x') |
102 | cp += 2; | 105 | cp += 2; |
103 | } | 106 | } |
104 | while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp) | 107 | while (isxdigit(*cp) |
105 | ? toupper(*cp) : *cp)-'A'+10) < base) { | 108 | && (value = isdigit(*cp) ? *cp-'0' : TOLOWER(*cp)-'a'+10) < base) { |
106 | result = result*base + value; | 109 | result = result*base + value; |
107 | cp++; | 110 | cp++; |
108 | } | 111 | } |
@@ -360,24 +363,25 @@ static noinline char* put_dec(char *buf, unsigned long long num) | |||
360 | #define PLUS 4 /* show plus */ | 363 | #define PLUS 4 /* show plus */ |
361 | #define SPACE 8 /* space if plus */ | 364 | #define SPACE 8 /* space if plus */ |
362 | #define LEFT 16 /* left justified */ | 365 | #define LEFT 16 /* left justified */ |
363 | #define SPECIAL 32 /* 0x */ | 366 | #define SMALL 32 /* Must be 32 == 0x20 */ |
364 | #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ | 367 | #define SPECIAL 64 /* 0x */ |
365 | 368 | ||
366 | static char *number(char *buf, char *end, unsigned long long num, int base, int size, int precision, int type) | 369 | static char *number(char *buf, char *end, unsigned long long num, int base, int size, int precision, int type) |
367 | { | 370 | { |
368 | char sign,tmp[66]; | 371 | /* we are called with base 8, 10 or 16, only, thus don't need "G..." */ |
369 | const char *digits; | 372 | static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */ |
370 | /* we are called with base 8, 10 or 16, only, thus don't need "g..." */ | 373 | |
371 | static const char small_digits[] = "0123456789abcdefx"; /* "ghijklmnopqrstuvwxyz"; */ | 374 | char tmp[66]; |
372 | static const char large_digits[] = "0123456789ABCDEFX"; /* "GHIJKLMNOPQRSTUVWXYZ"; */ | 375 | char sign; |
376 | char locase; | ||
373 | int need_pfx = ((type & SPECIAL) && base != 10); | 377 | int need_pfx = ((type & SPECIAL) && base != 10); |
374 | int i; | 378 | int i; |
375 | 379 | ||
376 | digits = (type & LARGE) ? large_digits : small_digits; | 380 | /* locase = 0 or 0x20. ORing digits or letters with 'locase' |
381 | * produces same digits or (maybe lowercased) letters */ | ||
382 | locase = (type & SMALL); | ||
377 | if (type & LEFT) | 383 | if (type & LEFT) |
378 | type &= ~ZEROPAD; | 384 | type &= ~ZEROPAD; |
379 | if (base < 2 || base > 36) | ||
380 | return NULL; | ||
381 | sign = 0; | 385 | sign = 0; |
382 | if (type & SIGN) { | 386 | if (type & SIGN) { |
383 | if ((signed long long) num < 0) { | 387 | if ((signed long long) num < 0) { |
@@ -404,7 +408,7 @@ static char *number(char *buf, char *end, unsigned long long num, int base, int | |||
404 | tmp[i++] = '0'; | 408 | tmp[i++] = '0'; |
405 | /* Generic code, for any base: | 409 | /* Generic code, for any base: |
406 | else do { | 410 | else do { |
407 | tmp[i++] = digits[do_div(num,base)]; | 411 | tmp[i++] = (digits[do_div(num,base)] | locase); |
408 | } while (num != 0); | 412 | } while (num != 0); |
409 | */ | 413 | */ |
410 | else if (base != 10) { /* 8 or 16 */ | 414 | else if (base != 10) { /* 8 or 16 */ |
@@ -412,7 +416,7 @@ static char *number(char *buf, char *end, unsigned long long num, int base, int | |||
412 | int shift = 3; | 416 | int shift = 3; |
413 | if (base == 16) shift = 4; | 417 | if (base == 16) shift = 4; |
414 | do { | 418 | do { |
415 | tmp[i++] = digits[((unsigned char)num) & mask]; | 419 | tmp[i++] = (digits[((unsigned char)num) & mask] | locase); |
416 | num >>= shift; | 420 | num >>= shift; |
417 | } while (num); | 421 | } while (num); |
418 | } else { /* base 10 */ | 422 | } else { /* base 10 */ |
@@ -444,7 +448,7 @@ static char *number(char *buf, char *end, unsigned long long num, int base, int | |||
444 | ++buf; | 448 | ++buf; |
445 | if (base == 16) { | 449 | if (base == 16) { |
446 | if (buf < end) | 450 | if (buf < end) |
447 | *buf = digits[16]; /* for arbitrary base: digits[33]; */ | 451 | *buf = ('X' | locase); |
448 | ++buf; | 452 | ++buf; |
449 | } | 453 | } |
450 | } | 454 | } |
@@ -644,6 +648,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) | |||
644 | continue; | 648 | continue; |
645 | 649 | ||
646 | case 'p': | 650 | case 'p': |
651 | flags |= SMALL; | ||
647 | if (field_width == -1) { | 652 | if (field_width == -1) { |
648 | field_width = 2*sizeof(void *); | 653 | field_width = 2*sizeof(void *); |
649 | flags |= ZEROPAD; | 654 | flags |= ZEROPAD; |
@@ -680,9 +685,9 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) | |||
680 | base = 8; | 685 | base = 8; |
681 | break; | 686 | break; |
682 | 687 | ||
683 | case 'X': | ||
684 | flags |= LARGE; | ||
685 | case 'x': | 688 | case 'x': |
689 | flags |= SMALL; | ||
690 | case 'X': | ||
686 | base = 16; | 691 | base = 16; |
687 | break; | 692 | break; |
688 | 693 | ||
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 5c2c702af617..6bded84c20c8 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -399,7 +399,7 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem) | |||
399 | int ret; | 399 | int ret; |
400 | 400 | ||
401 | task_lock(task); | 401 | task_lock(task); |
402 | ret = task->mm && mm_cgroup(task->mm) == mem; | 402 | ret = task->mm && vm_match_cgroup(task->mm, mem); |
403 | task_unlock(task); | 403 | task_unlock(task); |
404 | return ret; | 404 | return ret; |
405 | } | 405 | } |
@@ -321,7 +321,7 @@ static int page_referenced_anon(struct page *page, | |||
321 | * counting on behalf of references from different | 321 | * counting on behalf of references from different |
322 | * cgroups | 322 | * cgroups |
323 | */ | 323 | */ |
324 | if (mem_cont && (mm_cgroup(vma->vm_mm) != mem_cont)) | 324 | if (mem_cont && !vm_match_cgroup(vma->vm_mm, mem_cont)) |
325 | continue; | 325 | continue; |
326 | referenced += page_referenced_one(page, vma, &mapcount); | 326 | referenced += page_referenced_one(page, vma, &mapcount); |
327 | if (!mapcount) | 327 | if (!mapcount) |
@@ -382,7 +382,7 @@ static int page_referenced_file(struct page *page, | |||
382 | * counting on behalf of references from different | 382 | * counting on behalf of references from different |
383 | * cgroups | 383 | * cgroups |
384 | */ | 384 | */ |
385 | if (mem_cont && (mm_cgroup(vma->vm_mm) != mem_cont)) | 385 | if (mem_cont && !vm_match_cgroup(vma->vm_mm, mem_cont)) |
386 | continue; | 386 | continue; |
387 | if ((vma->vm_flags & (VM_LOCKED|VM_MAYSHARE)) | 387 | if ((vma->vm_flags & (VM_LOCKED|VM_MAYSHARE)) |
388 | == (VM_LOCKED|VM_MAYSHARE)) { | 388 | == (VM_LOCKED|VM_MAYSHARE)) { |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 994648be80ab..732cd07e6071 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -922,13 +922,11 @@ int igmp_rcv(struct sk_buff *skb) | |||
922 | struct in_device *in_dev = in_dev_get(skb->dev); | 922 | struct in_device *in_dev = in_dev_get(skb->dev); |
923 | int len = skb->len; | 923 | int len = skb->len; |
924 | 924 | ||
925 | if (in_dev==NULL) { | 925 | if (in_dev == NULL) |
926 | kfree_skb(skb); | 926 | goto drop; |
927 | return 0; | ||
928 | } | ||
929 | 927 | ||
930 | if (!pskb_may_pull(skb, sizeof(struct igmphdr))) | 928 | if (!pskb_may_pull(skb, sizeof(struct igmphdr))) |
931 | goto drop; | 929 | goto drop_ref; |
932 | 930 | ||
933 | switch (skb->ip_summed) { | 931 | switch (skb->ip_summed) { |
934 | case CHECKSUM_COMPLETE: | 932 | case CHECKSUM_COMPLETE: |
@@ -938,7 +936,7 @@ int igmp_rcv(struct sk_buff *skb) | |||
938 | case CHECKSUM_NONE: | 936 | case CHECKSUM_NONE: |
939 | skb->csum = 0; | 937 | skb->csum = 0; |
940 | if (__skb_checksum_complete(skb)) | 938 | if (__skb_checksum_complete(skb)) |
941 | goto drop; | 939 | goto drop_ref; |
942 | } | 940 | } |
943 | 941 | ||
944 | ih = igmp_hdr(skb); | 942 | ih = igmp_hdr(skb); |
@@ -972,8 +970,9 @@ int igmp_rcv(struct sk_buff *skb) | |||
972 | break; | 970 | break; |
973 | } | 971 | } |
974 | 972 | ||
975 | drop: | 973 | drop_ref: |
976 | in_dev_put(in_dev); | 974 | in_dev_put(in_dev); |
975 | drop: | ||
977 | kfree_skb(skb); | 976 | kfree_skb(skb); |
978 | return 0; | 977 | return 0; |
979 | } | 978 | } |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 513f72e3db0d..6e7b56ef4449 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1620,7 +1620,7 @@ static struct rt6_info *rt6_add_route_info(struct in6_addr *prefix, int prefixle | |||
1620 | { | 1620 | { |
1621 | struct fib6_config cfg = { | 1621 | struct fib6_config cfg = { |
1622 | .fc_table = RT6_TABLE_INFO, | 1622 | .fc_table = RT6_TABLE_INFO, |
1623 | .fc_metric = 1024, | 1623 | .fc_metric = IP6_RT_PRIO_USER, |
1624 | .fc_ifindex = ifindex, | 1624 | .fc_ifindex = ifindex, |
1625 | .fc_dst_len = prefixlen, | 1625 | .fc_dst_len = prefixlen, |
1626 | .fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_ROUTEINFO | | 1626 | .fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_ROUTEINFO | |
@@ -1670,7 +1670,7 @@ struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr, | |||
1670 | { | 1670 | { |
1671 | struct fib6_config cfg = { | 1671 | struct fib6_config cfg = { |
1672 | .fc_table = RT6_TABLE_DFLT, | 1672 | .fc_table = RT6_TABLE_DFLT, |
1673 | .fc_metric = 1024, | 1673 | .fc_metric = IP6_RT_PRIO_USER, |
1674 | .fc_ifindex = dev->ifindex, | 1674 | .fc_ifindex = dev->ifindex, |
1675 | .fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | | 1675 | .fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | |
1676 | RTF_UP | RTF_EXPIRES | RTF_PREF(pref), | 1676 | RTF_UP | RTF_EXPIRES | RTF_PREF(pref), |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 45c3c27d279a..b3ac85e808ac 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -3734,21 +3734,15 @@ static struct net_proto_family pfkey_family_ops = { | |||
3734 | }; | 3734 | }; |
3735 | 3735 | ||
3736 | #ifdef CONFIG_PROC_FS | 3736 | #ifdef CONFIG_PROC_FS |
3737 | static int pfkey_read_proc(char *buffer, char **start, off_t offset, | 3737 | static int pfkey_seq_show(struct seq_file *f, void *v) |
3738 | int length, int *eof, void *data) | ||
3739 | { | 3738 | { |
3740 | off_t pos = 0; | ||
3741 | off_t begin = 0; | ||
3742 | int len = 0; | ||
3743 | struct sock *s; | 3739 | struct sock *s; |
3744 | struct hlist_node *node; | ||
3745 | |||
3746 | len += sprintf(buffer,"sk RefCnt Rmem Wmem User Inode\n"); | ||
3747 | |||
3748 | read_lock(&pfkey_table_lock); | ||
3749 | 3740 | ||
3750 | sk_for_each(s, node, &pfkey_table) { | 3741 | s = (struct sock *)v; |
3751 | len += sprintf(buffer+len,"%p %-6d %-6u %-6u %-6u %-6lu", | 3742 | if (v == SEQ_START_TOKEN) |
3743 | seq_printf(f ,"sk RefCnt Rmem Wmem User Inode\n"); | ||
3744 | else | ||
3745 | seq_printf(f ,"%p %-6d %-6u %-6u %-6u %-6lu\n", | ||
3752 | s, | 3746 | s, |
3753 | atomic_read(&s->sk_refcnt), | 3747 | atomic_read(&s->sk_refcnt), |
3754 | atomic_read(&s->sk_rmem_alloc), | 3748 | atomic_read(&s->sk_rmem_alloc), |
@@ -3756,31 +3750,82 @@ static int pfkey_read_proc(char *buffer, char **start, off_t offset, | |||
3756 | sock_i_uid(s), | 3750 | sock_i_uid(s), |
3757 | sock_i_ino(s) | 3751 | sock_i_ino(s) |
3758 | ); | 3752 | ); |
3753 | return 0; | ||
3754 | } | ||
3759 | 3755 | ||
3760 | buffer[len++] = '\n'; | 3756 | static void *pfkey_seq_start(struct seq_file *f, loff_t *ppos) |
3757 | { | ||
3758 | struct sock *s; | ||
3759 | struct hlist_node *node; | ||
3760 | loff_t pos = *ppos; | ||
3761 | 3761 | ||
3762 | pos = begin + len; | 3762 | read_lock(&pfkey_table_lock); |
3763 | if (pos < offset) { | 3763 | if (pos == 0) |
3764 | len = 0; | 3764 | return SEQ_START_TOKEN; |
3765 | begin = pos; | ||
3766 | } | ||
3767 | if(pos > offset + length) | ||
3768 | goto done; | ||
3769 | } | ||
3770 | *eof = 1; | ||
3771 | 3765 | ||
3772 | done: | 3766 | sk_for_each(s, node, &pfkey_table) |
3767 | if (pos-- == 1) | ||
3768 | return s; | ||
3769 | |||
3770 | return NULL; | ||
3771 | } | ||
3772 | |||
3773 | static void *pfkey_seq_next(struct seq_file *f, void *v, loff_t *ppos) | ||
3774 | { | ||
3775 | ++*ppos; | ||
3776 | return (v == SEQ_START_TOKEN) ? | ||
3777 | sk_head(&pfkey_table) : | ||
3778 | sk_next((struct sock *)v); | ||
3779 | } | ||
3780 | |||
3781 | static void pfkey_seq_stop(struct seq_file *f, void *v) | ||
3782 | { | ||
3773 | read_unlock(&pfkey_table_lock); | 3783 | read_unlock(&pfkey_table_lock); |
3784 | } | ||
3785 | |||
3786 | static struct seq_operations pfkey_seq_ops = { | ||
3787 | .start = pfkey_seq_start, | ||
3788 | .next = pfkey_seq_next, | ||
3789 | .stop = pfkey_seq_stop, | ||
3790 | .show = pfkey_seq_show, | ||
3791 | }; | ||
3792 | |||
3793 | static int pfkey_seq_open(struct inode *inode, struct file *file) | ||
3794 | { | ||
3795 | return seq_open(file, &pfkey_seq_ops); | ||
3796 | } | ||
3774 | 3797 | ||
3775 | *start = buffer + (offset - begin); | 3798 | static struct file_operations pfkey_proc_ops = { |
3776 | len -= (offset - begin); | 3799 | .open = pfkey_seq_open, |
3800 | .read = seq_read, | ||
3801 | .llseek = seq_lseek, | ||
3802 | .release = seq_release, | ||
3803 | }; | ||
3777 | 3804 | ||
3778 | if (len > length) | 3805 | static int pfkey_init_proc(void) |
3779 | len = length; | 3806 | { |
3780 | if (len < 0) | 3807 | struct proc_dir_entry *e; |
3781 | len = 0; | ||
3782 | 3808 | ||
3783 | return len; | 3809 | e = create_proc_entry("pfkey", 0, init_net.proc_net); |
3810 | if (e == NULL) | ||
3811 | return -ENOMEM; | ||
3812 | |||
3813 | e->proc_fops = &pfkey_proc_ops; | ||
3814 | return 0; | ||
3815 | } | ||
3816 | |||
3817 | static void pfkey_exit_proc(void) | ||
3818 | { | ||
3819 | remove_proc_entry("net/pfkey", NULL); | ||
3820 | } | ||
3821 | #else | ||
3822 | static inline int pfkey_init_proc(void) | ||
3823 | { | ||
3824 | return 0; | ||
3825 | } | ||
3826 | |||
3827 | static inline void pfkey_exit_proc(void) | ||
3828 | { | ||
3784 | } | 3829 | } |
3785 | #endif | 3830 | #endif |
3786 | 3831 | ||
@@ -3798,7 +3843,7 @@ static struct xfrm_mgr pfkeyv2_mgr = | |||
3798 | static void __exit ipsec_pfkey_exit(void) | 3843 | static void __exit ipsec_pfkey_exit(void) |
3799 | { | 3844 | { |
3800 | xfrm_unregister_km(&pfkeyv2_mgr); | 3845 | xfrm_unregister_km(&pfkeyv2_mgr); |
3801 | remove_proc_entry("pfkey", init_net.proc_net); | 3846 | pfkey_exit_proc(); |
3802 | sock_unregister(PF_KEY); | 3847 | sock_unregister(PF_KEY); |
3803 | proto_unregister(&key_proto); | 3848 | proto_unregister(&key_proto); |
3804 | } | 3849 | } |
@@ -3813,21 +3858,17 @@ static int __init ipsec_pfkey_init(void) | |||
3813 | err = sock_register(&pfkey_family_ops); | 3858 | err = sock_register(&pfkey_family_ops); |
3814 | if (err != 0) | 3859 | if (err != 0) |
3815 | goto out_unregister_key_proto; | 3860 | goto out_unregister_key_proto; |
3816 | #ifdef CONFIG_PROC_FS | 3861 | err = pfkey_init_proc(); |
3817 | err = -ENOMEM; | 3862 | if (err != 0) |
3818 | if (create_proc_read_entry("pfkey", 0, init_net.proc_net, pfkey_read_proc, NULL) == NULL) | ||
3819 | goto out_sock_unregister; | 3863 | goto out_sock_unregister; |
3820 | #endif | ||
3821 | err = xfrm_register_km(&pfkeyv2_mgr); | 3864 | err = xfrm_register_km(&pfkeyv2_mgr); |
3822 | if (err != 0) | 3865 | if (err != 0) |
3823 | goto out_remove_proc_entry; | 3866 | goto out_remove_proc_entry; |
3824 | out: | 3867 | out: |
3825 | return err; | 3868 | return err; |
3826 | out_remove_proc_entry: | 3869 | out_remove_proc_entry: |
3827 | #ifdef CONFIG_PROC_FS | 3870 | pfkey_exit_proc(); |
3828 | remove_proc_entry("net/pfkey", NULL); | ||
3829 | out_sock_unregister: | 3871 | out_sock_unregister: |
3830 | #endif | ||
3831 | sock_unregister(PF_KEY); | 3872 | sock_unregister(PF_KEY); |
3832 | out_unregister_key_proto: | 3873 | out_unregister_key_proto: |
3833 | proto_unregister(&key_proto); | 3874 | proto_unregister(&key_proto); |
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index d417ec8e3ca3..3da4129b89d1 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -687,8 +687,8 @@ static inline struct meta_type_ops * meta_type_ops(struct meta_value *v) | |||
687 | * Core | 687 | * Core |
688 | **************************************************************************/ | 688 | **************************************************************************/ |
689 | 689 | ||
690 | static inline int meta_get(struct sk_buff *skb, struct tcf_pkt_info *info, | 690 | static int meta_get(struct sk_buff *skb, struct tcf_pkt_info *info, |
691 | struct meta_value *v, struct meta_obj *dst) | 691 | struct meta_value *v, struct meta_obj *dst) |
692 | { | 692 | { |
693 | int err = 0; | 693 | int err = 0; |
694 | 694 | ||
@@ -733,7 +733,7 @@ static int em_meta_match(struct sk_buff *skb, struct tcf_ematch *m, | |||
733 | return 0; | 733 | return 0; |
734 | } | 734 | } |
735 | 735 | ||
736 | static inline void meta_delete(struct meta_match *meta) | 736 | static void meta_delete(struct meta_match *meta) |
737 | { | 737 | { |
738 | if (meta) { | 738 | if (meta) { |
739 | struct meta_type_ops *ops = meta_type_ops(&meta->lvalue); | 739 | struct meta_type_ops *ops = meta_type_ops(&meta->lvalue); |
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 74ff918455a2..5e6f82e0e6f3 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -312,10 +312,9 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct nlattr *nla, | |||
312 | struct tcf_ematch_tree_hdr *tree_hdr; | 312 | struct tcf_ematch_tree_hdr *tree_hdr; |
313 | struct tcf_ematch *em; | 313 | struct tcf_ematch *em; |
314 | 314 | ||
315 | if (!nla) { | 315 | memset(tree, 0, sizeof(*tree)); |
316 | memset(tree, 0, sizeof(*tree)); | 316 | if (!nla) |
317 | return 0; | 317 | return 0; |
318 | } | ||
319 | 318 | ||
320 | err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, em_policy); | 319 | err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, em_policy); |
321 | if (err < 0) | 320 | if (err < 0) |
@@ -410,7 +409,7 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree) | |||
410 | if (em->ops) { | 409 | if (em->ops) { |
411 | if (em->ops->destroy) | 410 | if (em->ops->destroy) |
412 | em->ops->destroy(tp, em); | 411 | em->ops->destroy(tp, em); |
413 | else if (!tcf_em_is_simple(em) && em->data) | 412 | else if (!tcf_em_is_simple(em)) |
414 | kfree((void *) em->data); | 413 | kfree((void *) em->data); |
415 | module_put(em->ops->owner); | 414 | module_put(em->ops->owner); |
416 | } | 415 | } |
@@ -418,6 +417,7 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree) | |||
418 | 417 | ||
419 | tree->hdr.nmatches = 0; | 418 | tree->hdr.nmatches = 0; |
420 | kfree(tree->matches); | 419 | kfree(tree->matches); |
420 | tree->matches = NULL; | ||
421 | } | 421 | } |
422 | EXPORT_SYMBOL(tcf_em_tree_destroy); | 422 | EXPORT_SYMBOL(tcf_em_tree_destroy); |
423 | 423 | ||
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index e1a579efc215..795c761ad99f 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -609,14 +609,14 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
609 | /* TODO: requeuing packet charges it to policers again !! */ | 609 | /* TODO: requeuing packet charges it to policers again !! */ |
610 | static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch) | 610 | static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch) |
611 | { | 611 | { |
612 | int ret; | ||
612 | struct htb_sched *q = qdisc_priv(sch); | 613 | struct htb_sched *q = qdisc_priv(sch); |
613 | int ret = NET_XMIT_SUCCESS; | ||
614 | struct htb_class *cl = htb_classify(skb, sch, &ret); | 614 | struct htb_class *cl = htb_classify(skb, sch, &ret); |
615 | struct sk_buff *tskb; | 615 | struct sk_buff *tskb; |
616 | 616 | ||
617 | if (cl == HTB_DIRECT || !cl) { | 617 | if (cl == HTB_DIRECT) { |
618 | /* enqueue to helper queue */ | 618 | /* enqueue to helper queue */ |
619 | if (q->direct_queue.qlen < q->direct_qlen && cl) { | 619 | if (q->direct_queue.qlen < q->direct_qlen) { |
620 | __skb_queue_head(&q->direct_queue, skb); | 620 | __skb_queue_head(&q->direct_queue, skb); |
621 | } else { | 621 | } else { |
622 | __skb_queue_head(&q->direct_queue, skb); | 622 | __skb_queue_head(&q->direct_queue, skb); |
@@ -625,6 +625,13 @@ static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch) | |||
625 | sch->qstats.drops++; | 625 | sch->qstats.drops++; |
626 | return NET_XMIT_CN; | 626 | return NET_XMIT_CN; |
627 | } | 627 | } |
628 | #ifdef CONFIG_NET_CLS_ACT | ||
629 | } else if (!cl) { | ||
630 | if (ret == NET_XMIT_BYPASS) | ||
631 | sch->qstats.drops++; | ||
632 | kfree_skb(skb); | ||
633 | return ret; | ||
634 | #endif | ||
628 | } else if (cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q) != | 635 | } else if (cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q) != |
629 | NET_XMIT_SUCCESS) { | 636 | NET_XMIT_SUCCESS) { |
630 | sch->qstats.drops++; | 637 | sch->qstats.drops++; |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index a016e78061f4..d29f792e0529 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -1,21 +1,21 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001 Intel Corp. | 5 | * Copyright (c) 2001 Intel Corp. |
6 | * Copyright (c) 2001 La Monte H.P. Yarroll | 6 | * Copyright (c) 2001 La Monte H.P. Yarroll |
7 | * | 7 | * |
8 | * This file is part of the SCTP kernel reference Implementation | 8 | * This file is part of the SCTP kernel implementation |
9 | * | 9 | * |
10 | * This module provides the abstraction for an SCTP association. | 10 | * This module provides the abstraction for an SCTP association. |
11 | * | 11 | * |
12 | * The SCTP reference implementation is free software; | 12 | * This SCTP implementation is free software; |
13 | * you can redistribute it and/or modify it under the terms of | 13 | * you can redistribute it and/or modify it under the terms of |
14 | * the GNU General Public License as published by | 14 | * the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2, or (at your option) | 15 | * the Free Software Foundation; either version 2, or (at your option) |
16 | * any later version. | 16 | * any later version. |
17 | * | 17 | * |
18 | * The SCTP reference implementation is distributed in the hope that it | 18 | * This SCTP implementation is distributed in the hope that it |
19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | * ************************ | 20 | * ************************ |
21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
@@ -1525,7 +1525,7 @@ struct sctp_chunk *sctp_assoc_lookup_asconf_ack( | |||
1525 | const struct sctp_association *asoc, | 1525 | const struct sctp_association *asoc, |
1526 | __be32 serial) | 1526 | __be32 serial) |
1527 | { | 1527 | { |
1528 | struct sctp_chunk *ack = NULL; | 1528 | struct sctp_chunk *ack; |
1529 | 1529 | ||
1530 | /* Walk through the list of cached ASCONF-ACKs and find the | 1530 | /* Walk through the list of cached ASCONF-ACKs and find the |
1531 | * ack chunk whose serial number matches that of the request. | 1531 | * ack chunk whose serial number matches that of the request. |
@@ -1533,9 +1533,9 @@ struct sctp_chunk *sctp_assoc_lookup_asconf_ack( | |||
1533 | list_for_each_entry(ack, &asoc->asconf_ack_list, transmitted_list) { | 1533 | list_for_each_entry(ack, &asoc->asconf_ack_list, transmitted_list) { |
1534 | if (ack->subh.addip_hdr->serial == serial) { | 1534 | if (ack->subh.addip_hdr->serial == serial) { |
1535 | sctp_chunk_hold(ack); | 1535 | sctp_chunk_hold(ack); |
1536 | break; | 1536 | return ack; |
1537 | } | 1537 | } |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | return ack; | 1540 | return NULL; |
1541 | } | 1541 | } |
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index ae367c82e512..8bb79f281774 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
@@ -1,15 +1,15 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright 2007 Hewlett-Packard Development Company, L.P. | 2 | * (C) Copyright 2007 Hewlett-Packard Development Company, L.P. |
3 | * | 3 | * |
4 | * This file is part of the SCTP kernel reference Implementation | 4 | * This file is part of the SCTP kernel implementation |
5 | * | 5 | * |
6 | * The SCTP reference implementation is free software; | 6 | * This SCTP implementation is free software; |
7 | * you can redistribute it and/or modify it under the terms of | 7 | * you can redistribute it and/or modify it under the terms of |
8 | * the GNU General Public License as published by | 8 | * the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2, or (at your option) | 9 | * the Free Software Foundation; either version 2, or (at your option) |
10 | * any later version. | 10 | * any later version. |
11 | * | 11 | * |
12 | * The SCTP reference implementation is distributed in the hope that it | 12 | * This SCTP implementation is distributed in the hope that it |
13 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 13 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
14 | * ************************ | 14 | * ************************ |
15 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 15 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index 13fbfb449a55..a27511ebc4cb 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2003 | 2 | * (C) Copyright IBM Corp. 2001, 2003 |
3 | * Copyright (c) Cisco 1999,2000 | 3 | * Copyright (c) Cisco 1999,2000 |
4 | * Copyright (c) Motorola 1999,2000,2001 | 4 | * Copyright (c) Motorola 1999,2000,2001 |
5 | * Copyright (c) La Monte H.P. Yarroll 2001 | 5 | * Copyright (c) La Monte H.P. Yarroll 2001 |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference implementation. | 7 | * This file is part of the SCTP kernel implementation. |
8 | * | 8 | * |
9 | * A collection class to handle the storage of transport addresses. | 9 | * A collection class to handle the storage of transport addresses. |
10 | * | 10 | * |
11 | * The SCTP reference implementation is free software; | 11 | * This SCTP implementation is free software; |
12 | * you can redistribute it and/or modify it under the terms of | 12 | * you can redistribute it and/or modify it under the terms of |
13 | * the GNU General Public License as published by | 13 | * the GNU General Public License as published by |
14 | * the Free Software Foundation; either version 2, or (at your option) | 14 | * the Free Software Foundation; either version 2, or (at your option) |
15 | * any later version. | 15 | * any later version. |
16 | * | 16 | * |
17 | * The SCTP reference implementation is distributed in the hope that it | 17 | * This SCTP implementation is distributed in the hope that it |
18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
19 | * ************************ | 19 | * ************************ |
20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c index 619d0f2dee51..4d3128f5ccc3 100644 --- a/net/sctp/chunk.c +++ b/net/sctp/chunk.c | |||
@@ -1,17 +1,17 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2003, 2004 | 2 | * (C) Copyright IBM Corp. 2003, 2004 |
3 | * | 3 | * |
4 | * This file is part of the SCTP kernel reference Implementation | 4 | * This file is part of the SCTP kernel implementation |
5 | * | 5 | * |
6 | * This file contains the code relating the chunk abstraction. | 6 | * This file contains the code relating the chunk abstraction. |
7 | * | 7 | * |
8 | * The SCTP reference implementation is free software; | 8 | * This SCTP implementation is free software; |
9 | * you can redistribute it and/or modify it under the terms of | 9 | * you can redistribute it and/or modify it under the terms of |
10 | * the GNU General Public License as published by | 10 | * the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2, or (at your option) | 11 | * the Free Software Foundation; either version 2, or (at your option) |
12 | * any later version. | 12 | * any later version. |
13 | * | 13 | * |
14 | * The SCTP reference implementation is distributed in the hope that it | 14 | * This SCTP implementation is distributed in the hope that it |
15 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
16 | * ************************ | 16 | * ************************ |
17 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/command.c b/net/sctp/command.c index 3ff804757f4a..bb977330002a 100644 --- a/net/sctp/command.c +++ b/net/sctp/command.c | |||
@@ -1,18 +1,18 @@ | |||
1 | /* SCTP kernel reference Implementation Copyright (C) 1999-2001 | 1 | /* SCTP kernel implementation Copyright (C) 1999-2001 |
2 | * Cisco, Motorola, and IBM | 2 | * Cisco, Motorola, and IBM |
3 | * Copyright 2001 La Monte H.P. Yarroll | 3 | * Copyright 2001 La Monte H.P. Yarroll |
4 | * | 4 | * |
5 | * This file is part of the SCTP kernel reference Implementation | 5 | * This file is part of the SCTP kernel implementation |
6 | * | 6 | * |
7 | * These functions manipulate sctp command sequences. | 7 | * These functions manipulate sctp command sequences. |
8 | * | 8 | * |
9 | * The SCTP reference implementation is free software; | 9 | * This SCTP implementation is free software; |
10 | * you can redistribute it and/or modify it under the terms of | 10 | * you can redistribute it and/or modify it under the terms of |
11 | * the GNU General Public License as published by | 11 | * the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2, or (at your option) | 12 | * the Free Software Foundation; either version 2, or (at your option) |
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | * The SCTP reference implementation is distributed in the hope that it | 15 | * This SCTP implementation is distributed in the hope that it |
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | * ************************ | 17 | * ************************ |
18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/debug.c b/net/sctp/debug.c index 80f70aa53386..67715f4eb849 100644 --- a/net/sctp/debug.c +++ b/net/sctp/debug.c | |||
@@ -1,25 +1,21 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001 Intel Corp. | 5 | * Copyright (c) 2001 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | ||
9 | * This file is part of the implementation of the add-IP extension, | ||
10 | * based on <draft-ietf-tsvwg-addip-sctp-02.txt> June 29, 2001, | ||
11 | * for the SCTP kernel reference Implementation. | ||
12 | * | 8 | * |
13 | * This file converts numerical ID value to alphabetical names for SCTP | 9 | * This file converts numerical ID value to alphabetical names for SCTP |
14 | * terms such as chunk type, parameter time, event type, etc. | 10 | * terms such as chunk type, parameter time, event type, etc. |
15 | * | 11 | * |
16 | * The SCTP reference implementation is free software; | 12 | * This SCTP implementation is free software; |
17 | * you can redistribute it and/or modify it under the terms of | 13 | * you can redistribute it and/or modify it under the terms of |
18 | * the GNU General Public License as published by | 14 | * the GNU General Public License as published by |
19 | * the Free Software Foundation; either version 2, or (at your option) | 15 | * the Free Software Foundation; either version 2, or (at your option) |
20 | * any later version. | 16 | * any later version. |
21 | * | 17 | * |
22 | * The SCTP reference implementation is distributed in the hope that it | 18 | * This SCTP implementation is distributed in the hope that it |
23 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
24 | * ************************ | 20 | * ************************ |
25 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index de6f505d6ff8..e39a0cdef184 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * Copyright (c) 1999-2000 Cisco, Inc. | 2 | * Copyright (c) 1999-2000 Cisco, Inc. |
3 | * Copyright (c) 1999-2001 Motorola, Inc. | 3 | * Copyright (c) 1999-2001 Motorola, Inc. |
4 | * Copyright (c) 2001-2002 International Business Machines, Corp. | 4 | * Copyright (c) 2001-2002 International Business Machines, Corp. |
@@ -6,21 +6,17 @@ | |||
6 | * Copyright (c) 2001 Nokia, Inc. | 6 | * Copyright (c) 2001 Nokia, Inc. |
7 | * Copyright (c) 2001 La Monte H.P. Yarroll | 7 | * Copyright (c) 2001 La Monte H.P. Yarroll |
8 | * | 8 | * |
9 | * This file is part of the SCTP kernel reference Implementation | 9 | * This file is part of the SCTP kernel implementation |
10 | * | 10 | * |
11 | * This abstraction represents an SCTP endpoint. | 11 | * This abstraction represents an SCTP endpoint. |
12 | * | 12 | * |
13 | * This file is part of the implementation of the add-IP extension, | 13 | * The SCTP implementation is free software; |
14 | * based on <draft-ietf-tsvwg-addip-sctp-02.txt> June 29, 2001, | ||
15 | * for the SCTP kernel reference Implementation. | ||
16 | * | ||
17 | * The SCTP reference implementation is free software; | ||
18 | * you can redistribute it and/or modify it under the terms of | 14 | * you can redistribute it and/or modify it under the terms of |
19 | * the GNU General Public License as published by | 15 | * the GNU General Public License as published by |
20 | * the Free Software Foundation; either version 2, or (at your option) | 16 | * the Free Software Foundation; either version 2, or (at your option) |
21 | * any later version. | 17 | * any later version. |
22 | * | 18 | * |
23 | * The SCTP reference implementation is distributed in the hope that it | 19 | * The SCTP implementation is distributed in the hope that it |
24 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
25 | * ************************ | 21 | * ************************ |
26 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/input.c b/net/sctp/input.c index d695f710fc77..57fe2f81eca8 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * Copyright (c) 1999-2000 Cisco, Inc. | 2 | * Copyright (c) 1999-2000 Cisco, Inc. |
3 | * Copyright (c) 1999-2001 Motorola, Inc. | 3 | * Copyright (c) 1999-2001 Motorola, Inc. |
4 | * Copyright (c) 2001-2003 International Business Machines, Corp. | 4 | * Copyright (c) 2001-2003 International Business Machines, Corp. |
@@ -6,17 +6,17 @@ | |||
6 | * Copyright (c) 2001 Nokia, Inc. | 6 | * Copyright (c) 2001 Nokia, Inc. |
7 | * Copyright (c) 2001 La Monte H.P. Yarroll | 7 | * Copyright (c) 2001 La Monte H.P. Yarroll |
8 | * | 8 | * |
9 | * This file is part of the SCTP kernel reference Implementation | 9 | * This file is part of the SCTP kernel implementation |
10 | * | 10 | * |
11 | * These functions handle all input from the IP layer into SCTP. | 11 | * These functions handle all input from the IP layer into SCTP. |
12 | * | 12 | * |
13 | * The SCTP reference implementation is free software; | 13 | * This SCTP implementation is free software; |
14 | * you can redistribute it and/or modify it under the terms of | 14 | * you can redistribute it and/or modify it under the terms of |
15 | * the GNU General Public License as published by | 15 | * the GNU General Public License as published by |
16 | * the Free Software Foundation; either version 2, or (at your option) | 16 | * the Free Software Foundation; either version 2, or (at your option) |
17 | * any later version. | 17 | * any later version. |
18 | * | 18 | * |
19 | * The SCTP reference implementation is distributed in the hope that it | 19 | * This SCTP implementation is distributed in the hope that it |
20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
21 | * ************************ | 21 | * ************************ |
22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c index cf4b7eb023b3..bbf5dd2a97c4 100644 --- a/net/sctp/inqueue.c +++ b/net/sctp/inqueue.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * Copyright (c) 1999-2000 Cisco, Inc. | 2 | * Copyright (c) 1999-2000 Cisco, Inc. |
3 | * Copyright (c) 1999-2001 Motorola, Inc. | 3 | * Copyright (c) 1999-2001 Motorola, Inc. |
4 | * Copyright (c) 2002 International Business Machines, Corp. | 4 | * Copyright (c) 2002 International Business Machines, Corp. |
5 | * | 5 | * |
6 | * This file is part of the SCTP kernel reference Implementation | 6 | * This file is part of the SCTP kernel implementation |
7 | * | 7 | * |
8 | * These functions are the methods for accessing the SCTP inqueue. | 8 | * These functions are the methods for accessing the SCTP inqueue. |
9 | * | 9 | * |
@@ -11,13 +11,13 @@ | |||
11 | * (which might be bundles or fragments of chunks) and out of which you | 11 | * (which might be bundles or fragments of chunks) and out of which you |
12 | * pop SCTP whole chunks. | 12 | * pop SCTP whole chunks. |
13 | * | 13 | * |
14 | * The SCTP reference implementation is free software; | 14 | * This SCTP implementation is free software; |
15 | * you can redistribute it and/or modify it under the terms of | 15 | * you can redistribute it and/or modify it under the terms of |
16 | * the GNU General Public License as published by | 16 | * the GNU General Public License as published by |
17 | * the Free Software Foundation; either version 2, or (at your option) | 17 | * the Free Software Foundation; either version 2, or (at your option) |
18 | * any later version. | 18 | * any later version. |
19 | * | 19 | * |
20 | * The SCTP reference implementation is distributed in the hope that it | 20 | * This SCTP implementation is distributed in the hope that it |
21 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 21 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
22 | * ************************ | 22 | * ************************ |
23 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 23 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 74f106a7a7e9..4d7ec961ae1d 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2002, 2004 | 2 | * (C) Copyright IBM Corp. 2002, 2004 |
3 | * Copyright (c) 2001 Nokia, Inc. | 3 | * Copyright (c) 2001 Nokia, Inc. |
4 | * Copyright (c) 2001 La Monte H.P. Yarroll | 4 | * Copyright (c) 2001 La Monte H.P. Yarroll |
5 | * Copyright (c) 2002-2003 Intel Corp. | 5 | * Copyright (c) 2002-2003 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * SCTP over IPv6. | 9 | * SCTP over IPv6. |
10 | * | 10 | * |
11 | * The SCTP reference implementation is free software; | 11 | * This SCTP implementation is free software; |
12 | * you can redistribute it and/or modify it under the terms of | 12 | * you can redistribute it and/or modify it under the terms of |
13 | * the GNU General Public License as published by | 13 | * the GNU General Public License as published by |
14 | * the Free Software Foundation; either version 2, or (at your option) | 14 | * the Free Software Foundation; either version 2, or (at your option) |
15 | * any later version. | 15 | * any later version. |
16 | * | 16 | * |
17 | * The SCTP reference implementation is distributed in the hope that it | 17 | * This SCTP implementation is distributed in the hope that it |
18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
19 | * ************************ | 19 | * ************************ |
20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c index 2cf6ad6ff8ce..14e294e37626 100644 --- a/net/sctp/objcnt.c +++ b/net/sctp/objcnt.c | |||
@@ -1,19 +1,19 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * | 3 | * |
4 | * This file is part of the SCTP kernel reference Implementation | 4 | * This file is part of the SCTP kernel implementation |
5 | * | 5 | * |
6 | * Support for memory object debugging. This allows one to monitor the | 6 | * Support for memory object debugging. This allows one to monitor the |
7 | * object allocations/deallocations for types instrumented for this | 7 | * object allocations/deallocations for types instrumented for this |
8 | * via the proc fs. | 8 | * via the proc fs. |
9 | * | 9 | * |
10 | * The SCTP reference implementation is free software; | 10 | * This SCTP implementation is free software; |
11 | * you can redistribute it and/or modify it under the terms of | 11 | * you can redistribute it and/or modify it under the terms of |
12 | * the GNU General Public License as published by | 12 | * the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2, or (at your option) | 13 | * the Free Software Foundation; either version 2, or (at your option) |
14 | * any later version. | 14 | * any later version. |
15 | * | 15 | * |
16 | * The SCTP reference implementation is distributed in the hope that it | 16 | * This SCTP implementation is distributed in the hope that it |
17 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 17 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
18 | * ************************ | 18 | * ************************ |
19 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 19 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
@@ -80,61 +80,64 @@ static sctp_dbg_objcnt_entry_t sctp_dbg_objcnt[] = { | |||
80 | /* Callback from procfs to read out objcount information. | 80 | /* Callback from procfs to read out objcount information. |
81 | * Walk through the entries in the sctp_dbg_objcnt array, dumping | 81 | * Walk through the entries in the sctp_dbg_objcnt array, dumping |
82 | * the raw object counts for each monitored type. | 82 | * the raw object counts for each monitored type. |
83 | * | ||
84 | * This code was modified from similar code in route.c | ||
85 | */ | 83 | */ |
86 | static int sctp_dbg_objcnt_read(char *buffer, char **start, off_t offset, | 84 | static int sctp_objcnt_seq_show(struct seq_file *seq, void *v) |
87 | int length, int *eof, void *data) | ||
88 | { | 85 | { |
89 | int len = 0; | ||
90 | off_t pos = 0; | ||
91 | int entries; | ||
92 | int i; | 86 | int i; |
93 | char temp[128]; | 87 | char temp[128]; |
94 | 88 | ||
95 | /* How many entries? */ | 89 | i = (int)*(loff_t *)v; |
96 | entries = ARRAY_SIZE(sctp_dbg_objcnt); | 90 | sprintf(temp, "%s: %d", sctp_dbg_objcnt[i].label, |
97 | 91 | atomic_read(sctp_dbg_objcnt[i].counter)); | |
98 | /* Walk the entries and print out the debug information | 92 | seq_printf(seq, "%-127s\n", temp); |
99 | * for proc fs. | 93 | return 0; |
100 | */ | 94 | } |
101 | for (i = 0; i < entries; i++) { | 95 | |
102 | pos += 128; | 96 | static void *sctp_objcnt_seq_start(struct seq_file *seq, loff_t *pos) |
103 | 97 | { | |
104 | /* Skip ahead. */ | 98 | return (*pos >= ARRAY_SIZE(sctp_dbg_objcnt)) ? NULL : (void *)pos; |
105 | if (pos <= offset) { | 99 | } |
106 | len = 0; | 100 | |
107 | continue; | 101 | static void sctp_objcnt_seq_stop(struct seq_file *seq, void *v) |
108 | } | 102 | { |
109 | /* Print out each entry. */ | 103 | } |
110 | sprintf(temp, "%s: %d", | 104 | |
111 | sctp_dbg_objcnt[i].label, | 105 | static void * sctp_objcnt_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
112 | atomic_read(sctp_dbg_objcnt[i].counter)); | 106 | { |
113 | 107 | ++*pos; | |
114 | sprintf(buffer + len, "%-127s\n", temp); | 108 | return (*pos >= ARRAY_SIZE(sctp_dbg_objcnt)) ? NULL : (void *)pos; |
115 | len += 128; | ||
116 | if (pos >= offset+length) | ||
117 | goto done; | ||
118 | } | ||
119 | |||
120 | done: | ||
121 | *start = buffer + len - (pos - offset); | ||
122 | len = pos - offset; | ||
123 | if (len > length) | ||
124 | len = length; | ||
125 | |||
126 | return len; | ||
127 | } | 109 | } |
128 | 110 | ||
111 | static const struct seq_operations sctp_objcnt_seq_ops = { | ||
112 | .start = sctp_objcnt_seq_start, | ||
113 | .next = sctp_objcnt_seq_next, | ||
114 | .stop = sctp_objcnt_seq_stop, | ||
115 | .show = sctp_objcnt_seq_show, | ||
116 | }; | ||
117 | |||
118 | static int sctp_objcnt_seq_open(struct inode *inode, struct file *file) | ||
119 | { | ||
120 | return seq_open(file, &sctp_objcnt_seq_ops); | ||
121 | } | ||
122 | |||
123 | static const struct file_operations sctp_objcnt_ops = { | ||
124 | .open = sctp_objcnt_seq_open, | ||
125 | .read = seq_read, | ||
126 | .llseek = seq_lseek, | ||
127 | .release = seq_release, | ||
128 | }; | ||
129 | |||
129 | /* Initialize the objcount in the proc filesystem. */ | 130 | /* Initialize the objcount in the proc filesystem. */ |
130 | void sctp_dbg_objcnt_init(void) | 131 | void sctp_dbg_objcnt_init(void) |
131 | { | 132 | { |
132 | struct proc_dir_entry *ent; | 133 | struct proc_dir_entry *ent; |
133 | ent = create_proc_read_entry("sctp_dbg_objcnt", 0, proc_net_sctp, | 134 | |
134 | sctp_dbg_objcnt_read, NULL); | 135 | ent = create_proc_entry("sctp_dbg_objcnt", 0, proc_net_sctp); |
135 | if (!ent) | 136 | if (!ent) |
136 | printk(KERN_WARNING | 137 | printk(KERN_WARNING |
137 | "sctp_dbg_objcnt: Unable to create /proc entry.\n"); | 138 | "sctp_dbg_objcnt: Unable to create /proc entry.\n"); |
139 | else | ||
140 | ent->proc_fops = &sctp_objcnt_ops; | ||
138 | } | 141 | } |
139 | 142 | ||
140 | /* Cleanup the objcount entry in the proc filesystem. */ | 143 | /* Cleanup the objcount entry in the proc filesystem. */ |
diff --git a/net/sctp/output.c b/net/sctp/output.c index 5e811b91f21c..aa700feea76c 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
@@ -1,19 +1,19 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * | 5 | * |
6 | * This file is part of the SCTP kernel reference Implementation | 6 | * This file is part of the SCTP kernel implementation |
7 | * | 7 | * |
8 | * These functions handle output processing. | 8 | * These functions handle output processing. |
9 | * | 9 | * |
10 | * The SCTP reference implementation is free software; | 10 | * This SCTP implementation is free software; |
11 | * you can redistribute it and/or modify it under the terms of | 11 | * you can redistribute it and/or modify it under the terms of |
12 | * the GNU General Public License as published by | 12 | * the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2, or (at your option) | 13 | * the Free Software Foundation; either version 2, or (at your option) |
14 | * any later version. | 14 | * any later version. |
15 | * | 15 | * |
16 | * The SCTP reference implementation is distributed in the hope that it | 16 | * This SCTP implementation is distributed in the hope that it |
17 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 17 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
18 | * ************************ | 18 | * ************************ |
19 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 19 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index a42af865c2ef..1bb3c5c35d2a 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -1,21 +1,21 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001-2003 Intel Corp. | 5 | * Copyright (c) 2001-2003 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * These functions implement the sctp_outq class. The outqueue handles | 9 | * These functions implement the sctp_outq class. The outqueue handles |
10 | * bundling and queueing of outgoing SCTP chunks. | 10 | * bundling and queueing of outgoing SCTP chunks. |
11 | * | 11 | * |
12 | * The SCTP reference implementation is free software; | 12 | * This SCTP implementation is free software; |
13 | * you can redistribute it and/or modify it under the terms of | 13 | * you can redistribute it and/or modify it under the terms of |
14 | * the GNU General Public License as published by | 14 | * the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2, or (at your option) | 15 | * the Free Software Foundation; either version 2, or (at your option) |
16 | * any later version. | 16 | * any later version. |
17 | * | 17 | * |
18 | * The SCTP reference implementation is distributed in the hope that it | 18 | * This SCTP implementation is distributed in the hope that it |
19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | * ************************ | 20 | * ************************ |
21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
@@ -1179,8 +1179,10 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1179 | tchunk = list_entry(lchunk, struct sctp_chunk, | 1179 | tchunk = list_entry(lchunk, struct sctp_chunk, |
1180 | transmitted_list); | 1180 | transmitted_list); |
1181 | tsn = ntohl(tchunk->subh.data_hdr->tsn); | 1181 | tsn = ntohl(tchunk->subh.data_hdr->tsn); |
1182 | if (TSN_lte(tsn, ctsn)) | 1182 | if (TSN_lte(tsn, ctsn)) { |
1183 | list_del_init(&tchunk->transmitted_list); | ||
1183 | sctp_chunk_free(tchunk); | 1184 | sctp_chunk_free(tchunk); |
1185 | } | ||
1184 | } | 1186 | } |
1185 | 1187 | ||
1186 | /* ii) Set rwnd equal to the newly received a_rwnd minus the | 1188 | /* ii) Set rwnd equal to the newly received a_rwnd minus the |
diff --git a/net/sctp/primitive.c b/net/sctp/primitive.c index 1b2976d34ac7..8cb4f060bce6 100644 --- a/net/sctp/primitive.c +++ b/net/sctp/primitive.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * Copyright (c) 1999-2000 Cisco, Inc. | 2 | * Copyright (c) 1999-2000 Cisco, Inc. |
3 | * Copyright (c) 1999-2001 Motorola, Inc. | 3 | * Copyright (c) 1999-2001 Motorola, Inc. |
4 | * | 4 | * |
5 | * This file is part of the SCTP kernel reference Implementation | 5 | * This file is part of the SCTP kernel implementation |
6 | * | 6 | * |
7 | * These functions implement the SCTP primitive functions from Section 10. | 7 | * These functions implement the SCTP primitive functions from Section 10. |
8 | * | 8 | * |
@@ -10,13 +10,13 @@ | |||
10 | * functions--this file is the functions which populate the struct proto | 10 | * functions--this file is the functions which populate the struct proto |
11 | * for SCTP which is the BOTTOM of the sockets interface. | 11 | * for SCTP which is the BOTTOM of the sockets interface. |
12 | * | 12 | * |
13 | * The SCTP reference implementation is free software; | 13 | * This SCTP implementation is free software; |
14 | * you can redistribute it and/or modify it under the terms of | 14 | * you can redistribute it and/or modify it under the terms of |
15 | * the GNU General Public License as published by | 15 | * the GNU General Public License as published by |
16 | * the Free Software Foundation; either version 2, or (at your option) | 16 | * the Free Software Foundation; either version 2, or (at your option) |
17 | * any later version. | 17 | * any later version. |
18 | * | 18 | * |
19 | * The SCTP reference implementation is distributed in the hope that it | 19 | * This SCTP implementation is distributed in the hope that it |
20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
21 | * ************************ | 21 | * ************************ |
22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/proc.c b/net/sctp/proc.c index 249973204070..69bb5a63fd8b 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c | |||
@@ -1,15 +1,15 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * Copyright (c) 2003 International Business Machines, Corp. | 2 | * Copyright (c) 2003 International Business Machines, Corp. |
3 | * | 3 | * |
4 | * This file is part of the SCTP kernel reference Implementation | 4 | * This file is part of the SCTP kernel implementation |
5 | * | 5 | * |
6 | * The SCTP reference implementation is free software; | 6 | * This SCTP implementation is free software; |
7 | * you can redistribute it and/or modify it under the terms of | 7 | * you can redistribute it and/or modify it under the terms of |
8 | * the GNU General Public License as published by | 8 | * the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2, or (at your option) | 9 | * the Free Software Foundation; either version 2, or (at your option) |
10 | * any later version. | 10 | * any later version. |
11 | * | 11 | * |
12 | * The SCTP reference implementation is distributed in the hope that it | 12 | * This SCTP implementation is distributed in the hope that it |
13 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 13 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
14 | * ************************ | 14 | * ************************ |
15 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 15 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/seq_file.h> | 38 | #include <linux/seq_file.h> |
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <net/sctp/sctp.h> | 40 | #include <net/sctp/sctp.h> |
41 | #include <net/ip.h> /* for snmp_fold_field */ | ||
41 | 42 | ||
42 | static struct snmp_mib sctp_snmp_list[] = { | 43 | static struct snmp_mib sctp_snmp_list[] = { |
43 | SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB), | 44 | SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB), |
@@ -75,26 +76,6 @@ static struct snmp_mib sctp_snmp_list[] = { | |||
75 | SNMP_MIB_SENTINEL | 76 | SNMP_MIB_SENTINEL |
76 | }; | 77 | }; |
77 | 78 | ||
78 | /* Return the current value of a particular entry in the mib by adding its | ||
79 | * per cpu counters. | ||
80 | */ | ||
81 | static unsigned long | ||
82 | fold_field(void *mib[], int nr) | ||
83 | { | ||
84 | unsigned long res = 0; | ||
85 | int i; | ||
86 | |||
87 | for_each_possible_cpu(i) { | ||
88 | res += | ||
89 | *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) + | ||
90 | sizeof (unsigned long) * nr)); | ||
91 | res += | ||
92 | *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) + | ||
93 | sizeof (unsigned long) * nr)); | ||
94 | } | ||
95 | return res; | ||
96 | } | ||
97 | |||
98 | /* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */ | 79 | /* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */ |
99 | static int sctp_snmp_seq_show(struct seq_file *seq, void *v) | 80 | static int sctp_snmp_seq_show(struct seq_file *seq, void *v) |
100 | { | 81 | { |
@@ -102,7 +83,7 @@ static int sctp_snmp_seq_show(struct seq_file *seq, void *v) | |||
102 | 83 | ||
103 | for (i = 0; sctp_snmp_list[i].name != NULL; i++) | 84 | for (i = 0; sctp_snmp_list[i].name != NULL; i++) |
104 | seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name, | 85 | seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name, |
105 | fold_field((void **)sctp_statistics, | 86 | snmp_fold_field((void **)sctp_statistics, |
106 | sctp_snmp_list[i].entry)); | 87 | sctp_snmp_list[i].entry)); |
107 | 88 | ||
108 | return 0; | 89 | return 0; |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 1339742e49f1..22a16571499c 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
@@ -6,17 +6,17 @@ | |||
6 | * Copyright (c) 2001 Nokia, Inc. | 6 | * Copyright (c) 2001 Nokia, Inc. |
7 | * Copyright (c) 2001 La Monte H.P. Yarroll | 7 | * Copyright (c) 2001 La Monte H.P. Yarroll |
8 | * | 8 | * |
9 | * This file is part of the SCTP kernel reference Implementation | 9 | * This file is part of the SCTP kernel implementation |
10 | * | 10 | * |
11 | * Initialization/cleanup for SCTP protocol support. | 11 | * Initialization/cleanup for SCTP protocol support. |
12 | * | 12 | * |
13 | * The SCTP reference implementation is free software; | 13 | * This SCTP implementation is free software; |
14 | * you can redistribute it and/or modify it under the terms of | 14 | * you can redistribute it and/or modify it under the terms of |
15 | * the GNU General Public License as published by | 15 | * the GNU General Public License as published by |
16 | * the Free Software Foundation; either version 2, or (at your option) | 16 | * the Free Software Foundation; either version 2, or (at your option) |
17 | * any later version. | 17 | * any later version. |
18 | * | 18 | * |
19 | * The SCTP reference implementation is distributed in the hope that it | 19 | * This SCTP implementation is distributed in the hope that it |
20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
21 | * ************************ | 21 | * ************************ |
22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 77383e9b3988..e45be4e3f80d 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1,22 +1,22 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001-2002 Intel Corp. | 5 | * Copyright (c) 2001-2002 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * These functions work with the state functions in sctp_sm_statefuns.c | 9 | * These functions work with the state functions in sctp_sm_statefuns.c |
10 | * to implement the state operations. These functions implement the | 10 | * to implement the state operations. These functions implement the |
11 | * steps which require modifying existing data structures. | 11 | * steps which require modifying existing data structures. |
12 | * | 12 | * |
13 | * The SCTP reference implementation is free software; | 13 | * This SCTP implementation is free software; |
14 | * you can redistribute it and/or modify it under the terms of | 14 | * you can redistribute it and/or modify it under the terms of |
15 | * the GNU General Public License as published by | 15 | * the GNU General Public License as published by |
16 | * the Free Software Foundation; either version 2, or (at your option) | 16 | * the Free Software Foundation; either version 2, or (at your option) |
17 | * any later version. | 17 | * any later version. |
18 | * | 18 | * |
19 | * The SCTP reference implementation is distributed in the hope that it | 19 | * This SCTP implementation is distributed in the hope that it |
20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 20 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
21 | * ************************ | 21 | * ************************ |
22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
@@ -3224,6 +3224,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, | |||
3224 | } | 3224 | } |
3225 | 3225 | ||
3226 | /* Free the cached last sent asconf chunk. */ | 3226 | /* Free the cached last sent asconf chunk. */ |
3227 | list_del_init(&asconf->transmitted_list); | ||
3227 | sctp_chunk_free(asconf); | 3228 | sctp_chunk_free(asconf); |
3228 | asoc->addip_last_asconf = NULL; | 3229 | asoc->addip_last_asconf = NULL; |
3229 | 3230 | ||
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 78d1a8a49bd0..28eb38eb6083 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -1,21 +1,21 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999 Cisco, Inc. | 3 | * Copyright (c) 1999 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * | 5 | * |
6 | * This file is part of the SCTP kernel reference Implementation | 6 | * This file is part of the SCTP kernel implementation |
7 | * | 7 | * |
8 | * These functions work with the state functions in sctp_sm_statefuns.c | 8 | * These functions work with the state functions in sctp_sm_statefuns.c |
9 | * to implement that state operations. These functions implement the | 9 | * to implement that state operations. These functions implement the |
10 | * steps which require modifying existing data structures. | 10 | * steps which require modifying existing data structures. |
11 | * | 11 | * |
12 | * The SCTP reference implementation is free software; | 12 | * This SCTP implementation is free software; |
13 | * you can redistribute it and/or modify it under the terms of | 13 | * you can redistribute it and/or modify it under the terms of |
14 | * the GNU General Public License as published by | 14 | * the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2, or (at your option) | 15 | * the Free Software Foundation; either version 2, or (at your option) |
16 | * any later version. | 16 | * any later version. |
17 | * | 17 | * |
18 | * The SCTP reference implementation is distributed in the hope that it | 18 | * This SCTP implementation is distributed in the hope that it |
19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | * ************************ | 20 | * ************************ |
21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index f98658782d4f..f2ed6473feef 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -1,23 +1,21 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001-2002 Intel Corp. | 5 | * Copyright (c) 2001-2002 Intel Corp. |
6 | * Copyright (c) 2002 Nokia Corp. | 6 | * Copyright (c) 2002 Nokia Corp. |
7 | * | 7 | * |
8 | * This file is part of the SCTP kernel reference Implementation | 8 | * This is part of the SCTP Linux Kernel Implementation. |
9 | * | ||
10 | * This is part of the SCTP Linux Kernel Reference Implementation. | ||
11 | * | 9 | * |
12 | * These are the state functions for the state machine. | 10 | * These are the state functions for the state machine. |
13 | * | 11 | * |
14 | * The SCTP reference implementation is free software; | 12 | * This SCTP implementation is free software; |
15 | * you can redistribute it and/or modify it under the terms of | 13 | * you can redistribute it and/or modify it under the terms of |
16 | * the GNU General Public License as published by | 14 | * the GNU General Public License as published by |
17 | * the Free Software Foundation; either version 2, or (at your option) | 15 | * the Free Software Foundation; either version 2, or (at your option) |
18 | * any later version. | 16 | * any later version. |
19 | * | 17 | * |
20 | * The SCTP reference implementation is distributed in the hope that it | 18 | * This SCTP implementation is distributed in the hope that it |
21 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
22 | * ************************ | 20 | * ************************ |
23 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c index e6016e41ffa0..d991237fb400 100644 --- a/net/sctp/sm_statetable.c +++ b/net/sctp/sm_statetable.c | |||
@@ -1,21 +1,21 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001 Intel Corp. | 5 | * Copyright (c) 2001 Intel Corp. |
6 | * Copyright (c) 2001 Nokia, Inc. | 6 | * Copyright (c) 2001 Nokia, Inc. |
7 | * | 7 | * |
8 | * This file is part of the SCTP kernel reference Implementation | 8 | * This file is part of the SCTP kernel implementation |
9 | * | 9 | * |
10 | * These are the state tables for the SCTP state machine. | 10 | * These are the state tables for the SCTP state machine. |
11 | * | 11 | * |
12 | * The SCTP reference implementation is free software; | 12 | * This SCTP implementation is free software; |
13 | * you can redistribute it and/or modify it under the terms of | 13 | * you can redistribute it and/or modify it under the terms of |
14 | * the GNU General Public License as published by | 14 | * the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2, or (at your option) | 15 | * the Free Software Foundation; either version 2, or (at your option) |
16 | * any later version. | 16 | * any later version. |
17 | * | 17 | * |
18 | * The SCTP reference implementation is distributed in the hope that it | 18 | * This SCTP implementation is distributed in the hope that it |
19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | * ************************ | 20 | * ************************ |
21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 710df67a6785..d47d5787e2e5 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (c) 2001-2002 Nokia, Inc. | 6 | * Copyright (c) 2001-2002 Nokia, Inc. |
7 | * Copyright (c) 2001 La Monte H.P. Yarroll | 7 | * Copyright (c) 2001 La Monte H.P. Yarroll |
8 | * | 8 | * |
9 | * This file is part of the SCTP kernel reference Implementation | 9 | * This file is part of the SCTP kernel implementation |
10 | * | 10 | * |
11 | * These functions interface with the sockets layer to implement the | 11 | * These functions interface with the sockets layer to implement the |
12 | * SCTP Extensions for the Sockets API. | 12 | * SCTP Extensions for the Sockets API. |
@@ -15,13 +15,13 @@ | |||
15 | * functions--this file is the functions which populate the struct proto | 15 | * functions--this file is the functions which populate the struct proto |
16 | * for SCTP which is the BOTTOM of the sockets interface. | 16 | * for SCTP which is the BOTTOM of the sockets interface. |
17 | * | 17 | * |
18 | * The SCTP reference implementation is free software; | 18 | * This SCTP implementation is free software; |
19 | * you can redistribute it and/or modify it under the terms of | 19 | * you can redistribute it and/or modify it under the terms of |
20 | * the GNU General Public License as published by | 20 | * the GNU General Public License as published by |
21 | * the Free Software Foundation; either version 2, or (at your option) | 21 | * the Free Software Foundation; either version 2, or (at your option) |
22 | * any later version. | 22 | * any later version. |
23 | * | 23 | * |
24 | * The SCTP reference implementation is distributed in the hope that it | 24 | * This SCTP implementation is distributed in the hope that it |
25 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 25 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
26 | * ************************ | 26 | * ************************ |
27 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 27 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
@@ -1911,7 +1911,8 @@ SCTP_STATIC int sctp_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
1911 | * rwnd by that amount. If all the data in the skb is read, | 1911 | * rwnd by that amount. If all the data in the skb is read, |
1912 | * rwnd is updated when the event is freed. | 1912 | * rwnd is updated when the event is freed. |
1913 | */ | 1913 | */ |
1914 | sctp_assoc_rwnd_increase(event->asoc, copied); | 1914 | if (!sctp_ulpevent_is_notification(event)) |
1915 | sctp_assoc_rwnd_increase(event->asoc, copied); | ||
1915 | goto out; | 1916 | goto out; |
1916 | } else if ((event->msg_flags & MSG_NOTIFICATION) || | 1917 | } else if ((event->msg_flags & MSG_NOTIFICATION) || |
1917 | (event->msg_flags & MSG_EOR)) | 1918 | (event->msg_flags & MSG_EOR)) |
@@ -4314,6 +4315,9 @@ static int sctp_copy_laddrs_old(struct sock *sk, __u16 port, | |||
4314 | (AF_INET6 == addr->a.sa.sa_family)) | 4315 | (AF_INET6 == addr->a.sa.sa_family)) |
4315 | continue; | 4316 | continue; |
4316 | memcpy(&temp, &addr->a, sizeof(temp)); | 4317 | memcpy(&temp, &addr->a, sizeof(temp)); |
4318 | if (!temp.v4.sin_port) | ||
4319 | temp.v4.sin_port = htons(port); | ||
4320 | |||
4317 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), | 4321 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), |
4318 | &temp); | 4322 | &temp); |
4319 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; | 4323 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; |
@@ -4346,6 +4350,9 @@ static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to, | |||
4346 | (AF_INET6 == addr->a.sa.sa_family)) | 4350 | (AF_INET6 == addr->a.sa.sa_family)) |
4347 | continue; | 4351 | continue; |
4348 | memcpy(&temp, &addr->a, sizeof(temp)); | 4352 | memcpy(&temp, &addr->a, sizeof(temp)); |
4353 | if (!temp.v4.sin_port) | ||
4354 | temp.v4.sin_port = htons(port); | ||
4355 | |||
4349 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), | 4356 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk), |
4350 | &temp); | 4357 | &temp); |
4351 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; | 4358 | addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; |
diff --git a/net/sctp/ssnmap.c b/net/sctp/ssnmap.c index cbe2513d2822..737d330e5ffc 100644 --- a/net/sctp/ssnmap.c +++ b/net/sctp/ssnmap.c | |||
@@ -1,17 +1,17 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * Copyright (c) 2003 International Business Machines, Corp. | 2 | * Copyright (c) 2003 International Business Machines, Corp. |
3 | * | 3 | * |
4 | * This file is part of the SCTP kernel reference Implementation | 4 | * This file is part of the SCTP kernel implementation |
5 | * | 5 | * |
6 | * These functions manipulate sctp SSN tracker. | 6 | * These functions manipulate sctp SSN tracker. |
7 | * | 7 | * |
8 | * The SCTP reference implementation is free software; | 8 | * This SCTP implementation is free software; |
9 | * you can redistribute it and/or modify it under the terms of | 9 | * you can redistribute it and/or modify it under the terms of |
10 | * the GNU General Public License as published by | 10 | * the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2, or (at your option) | 11 | * the Free Software Foundation; either version 2, or (at your option) |
12 | * any later version. | 12 | * any later version. |
13 | * | 13 | * |
14 | * The SCTP reference implementation is distributed in the hope that it | 14 | * This SCTP implementation is distributed in the hope that it |
15 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
16 | * ************************ | 16 | * ************************ |
17 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 5eb6ea829b54..52910697e104 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -1,18 +1,18 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2002, 2004 | 2 | * (C) Copyright IBM Corp. 2002, 2004 |
3 | * Copyright (c) 2002 Intel Corp. | 3 | * Copyright (c) 2002 Intel Corp. |
4 | * | 4 | * |
5 | * This file is part of the SCTP kernel reference Implementation | 5 | * This file is part of the SCTP kernel implementation |
6 | * | 6 | * |
7 | * Sysctl related interfaces for SCTP. | 7 | * Sysctl related interfaces for SCTP. |
8 | * | 8 | * |
9 | * The SCTP reference implementation is free software; | 9 | * This SCTP implementation is free software; |
10 | * you can redistribute it and/or modify it under the terms of | 10 | * you can redistribute it and/or modify it under the terms of |
11 | * the GNU General Public License as published by | 11 | * the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2, or (at your option) | 12 | * the Free Software Foundation; either version 2, or (at your option) |
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | * The SCTP reference implementation is distributed in the hope that it | 15 | * This SCTP implementation is distributed in the hope that it |
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | * ************************ | 17 | * ************************ |
18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index dfa109341aeb..d9f8af852b56 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -1,23 +1,23 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * Copyright (c) 1999-2000 Cisco, Inc. | 2 | * Copyright (c) 1999-2000 Cisco, Inc. |
3 | * Copyright (c) 1999-2001 Motorola, Inc. | 3 | * Copyright (c) 1999-2001 Motorola, Inc. |
4 | * Copyright (c) 2001-2003 International Business Machines Corp. | 4 | * Copyright (c) 2001-2003 International Business Machines Corp. |
5 | * Copyright (c) 2001 Intel Corp. | 5 | * Copyright (c) 2001 Intel Corp. |
6 | * Copyright (c) 2001 La Monte H.P. Yarroll | 6 | * Copyright (c) 2001 La Monte H.P. Yarroll |
7 | * | 7 | * |
8 | * This file is part of the SCTP kernel reference Implementation | 8 | * This file is part of the SCTP kernel implementation |
9 | * | 9 | * |
10 | * This module provides the abstraction for an SCTP tranport representing | 10 | * This module provides the abstraction for an SCTP tranport representing |
11 | * a remote transport address. For local transport addresses, we just use | 11 | * a remote transport address. For local transport addresses, we just use |
12 | * union sctp_addr. | 12 | * union sctp_addr. |
13 | * | 13 | * |
14 | * The SCTP reference implementation is free software; | 14 | * This SCTP implementation is free software; |
15 | * you can redistribute it and/or modify it under the terms of | 15 | * you can redistribute it and/or modify it under the terms of |
16 | * the GNU General Public License as published by | 16 | * the GNU General Public License as published by |
17 | * the Free Software Foundation; either version 2, or (at your option) | 17 | * the Free Software Foundation; either version 2, or (at your option) |
18 | * any later version. | 18 | * any later version. |
19 | * | 19 | * |
20 | * The SCTP reference implementation is distributed in the hope that it | 20 | * This SCTP implementation is distributed in the hope that it |
21 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 21 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
22 | * ************************ | 22 | * ************************ |
23 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 23 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c index 1ff0daade304..f3e58b275905 100644 --- a/net/sctp/tsnmap.c +++ b/net/sctp/tsnmap.c | |||
@@ -1,20 +1,20 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
5 | * Copyright (c) 2001 Intel Corp. | 5 | * Copyright (c) 2001 Intel Corp. |
6 | * | 6 | * |
7 | * This file is part of the SCTP kernel reference Implementation | 7 | * This file is part of the SCTP kernel implementation |
8 | * | 8 | * |
9 | * These functions manipulate sctp tsn mapping array. | 9 | * These functions manipulate sctp tsn mapping array. |
10 | * | 10 | * |
11 | * The SCTP reference implementation is free software; | 11 | * This SCTP implementation is free software; |
12 | * you can redistribute it and/or modify it under the terms of | 12 | * you can redistribute it and/or modify it under the terms of |
13 | * the GNU General Public License as published by | 13 | * the GNU General Public License as published by |
14 | * the Free Software Foundation; either version 2, or (at your option) | 14 | * the Free Software Foundation; either version 2, or (at your option) |
15 | * any later version. | 15 | * any later version. |
16 | * | 16 | * |
17 | * The SCTP reference implementation is distributed in the hope that it | 17 | * This SCTP implementation is distributed in the hope that it |
18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
19 | * ************************ | 19 | * ************************ |
20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 047c27df98f4..e27b11f18b7f 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
@@ -8,13 +8,14 @@ | |||
8 | * | 8 | * |
9 | * These functions manipulate an sctp event. The struct ulpevent is used | 9 | * These functions manipulate an sctp event. The struct ulpevent is used |
10 | * to carry notifications and data to the ULP (sockets). | 10 | * to carry notifications and data to the ULP (sockets). |
11 | * The SCTP reference implementation is free software; | 11 | * |
12 | * This SCTP implementation is free software; | ||
12 | * you can redistribute it and/or modify it under the terms of | 13 | * you can redistribute it and/or modify it under the terms of |
13 | * the GNU General Public License as published by | 14 | * the GNU General Public License as published by |
14 | * the Free Software Foundation; either version 2, or (at your option) | 15 | * the Free Software Foundation; either version 2, or (at your option) |
15 | * any later version. | 16 | * any later version. |
16 | * | 17 | * |
17 | * The SCTP reference implementation is distributed in the hope that it | 18 | * This SCTP implementation is distributed in the hope that it |
18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
19 | * ************************ | 20 | * ************************ |
20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c index c25caefa3bcb..5061a26c5028 100644 --- a/net/sctp/ulpqueue.c +++ b/net/sctp/ulpqueue.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* SCTP kernel reference Implementation | 1 | /* SCTP kernel implementation |
2 | * (C) Copyright IBM Corp. 2001, 2004 | 2 | * (C) Copyright IBM Corp. 2001, 2004 |
3 | * Copyright (c) 1999-2000 Cisco, Inc. | 3 | * Copyright (c) 1999-2000 Cisco, Inc. |
4 | * Copyright (c) 1999-2001 Motorola, Inc. | 4 | * Copyright (c) 1999-2001 Motorola, Inc. |
@@ -8,13 +8,13 @@ | |||
8 | * | 8 | * |
9 | * This abstraction carries sctp events to the ULP (sockets). | 9 | * This abstraction carries sctp events to the ULP (sockets). |
10 | * | 10 | * |
11 | * The SCTP reference implementation is free software; | 11 | * This SCTP implementation is free software; |
12 | * you can redistribute it and/or modify it under the terms of | 12 | * you can redistribute it and/or modify it under the terms of |
13 | * the GNU General Public License as published by | 13 | * the GNU General Public License as published by |
14 | * the Free Software Foundation; either version 2, or (at your option) | 14 | * the Free Software Foundation; either version 2, or (at your option) |
15 | * any later version. | 15 | * any later version. |
16 | * | 16 | * |
17 | * The SCTP reference implementation is distributed in the hope that it | 17 | * This SCTP implementation is distributed in the hope that it |
18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | 18 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
19 | * ************************ | 19 | * ************************ |
20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
@@ -283,7 +283,7 @@ out_free: | |||
283 | /* 2nd Level Abstractions */ | 283 | /* 2nd Level Abstractions */ |
284 | 284 | ||
285 | /* Helper function to store chunks that need to be reassembled. */ | 285 | /* Helper function to store chunks that need to be reassembled. */ |
286 | static inline void sctp_ulpq_store_reasm(struct sctp_ulpq *ulpq, | 286 | static void sctp_ulpq_store_reasm(struct sctp_ulpq *ulpq, |
287 | struct sctp_ulpevent *event) | 287 | struct sctp_ulpevent *event) |
288 | { | 288 | { |
289 | struct sk_buff *pos; | 289 | struct sk_buff *pos; |
@@ -405,7 +405,7 @@ static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff_head *qu | |||
405 | /* Helper function to check if an incoming chunk has filled up the last | 405 | /* Helper function to check if an incoming chunk has filled up the last |
406 | * missing fragment in a SCTP datagram and return the corresponding event. | 406 | * missing fragment in a SCTP datagram and return the corresponding event. |
407 | */ | 407 | */ |
408 | static inline struct sctp_ulpevent *sctp_ulpq_retrieve_reassembled(struct sctp_ulpq *ulpq) | 408 | static struct sctp_ulpevent *sctp_ulpq_retrieve_reassembled(struct sctp_ulpq *ulpq) |
409 | { | 409 | { |
410 | struct sk_buff *pos; | 410 | struct sk_buff *pos; |
411 | struct sctp_ulpevent *cevent; | 411 | struct sctp_ulpevent *cevent; |
@@ -512,7 +512,7 @@ found: | |||
512 | } | 512 | } |
513 | 513 | ||
514 | /* Retrieve the next set of fragments of a partial message. */ | 514 | /* Retrieve the next set of fragments of a partial message. */ |
515 | static inline struct sctp_ulpevent *sctp_ulpq_retrieve_partial(struct sctp_ulpq *ulpq) | 515 | static struct sctp_ulpevent *sctp_ulpq_retrieve_partial(struct sctp_ulpq *ulpq) |
516 | { | 516 | { |
517 | struct sk_buff *pos, *last_frag, *first_frag; | 517 | struct sk_buff *pos, *last_frag, *first_frag; |
518 | struct sctp_ulpevent *cevent; | 518 | struct sctp_ulpevent *cevent; |
@@ -606,7 +606,7 @@ static struct sctp_ulpevent *sctp_ulpq_reasm(struct sctp_ulpq *ulpq, | |||
606 | } | 606 | } |
607 | 607 | ||
608 | /* Retrieve the first part (sequential fragments) for partial delivery. */ | 608 | /* Retrieve the first part (sequential fragments) for partial delivery. */ |
609 | static inline struct sctp_ulpevent *sctp_ulpq_retrieve_first(struct sctp_ulpq *ulpq) | 609 | static struct sctp_ulpevent *sctp_ulpq_retrieve_first(struct sctp_ulpq *ulpq) |
610 | { | 610 | { |
611 | struct sk_buff *pos, *last_frag, *first_frag; | 611 | struct sk_buff *pos, *last_frag, *first_frag; |
612 | struct sctp_ulpevent *cevent; | 612 | struct sctp_ulpevent *cevent; |
@@ -735,7 +735,7 @@ static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq) | |||
735 | /* Helper function to gather skbs that have possibly become | 735 | /* Helper function to gather skbs that have possibly become |
736 | * ordered by an an incoming chunk. | 736 | * ordered by an an incoming chunk. |
737 | */ | 737 | */ |
738 | static inline void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq, | 738 | static void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq, |
739 | struct sctp_ulpevent *event) | 739 | struct sctp_ulpevent *event) |
740 | { | 740 | { |
741 | struct sk_buff_head *event_list; | 741 | struct sk_buff_head *event_list; |
@@ -779,7 +779,7 @@ static inline void sctp_ulpq_retrieve_ordered(struct sctp_ulpq *ulpq, | |||
779 | } | 779 | } |
780 | 780 | ||
781 | /* Helper function to store chunks needing ordering. */ | 781 | /* Helper function to store chunks needing ordering. */ |
782 | static inline void sctp_ulpq_store_ordered(struct sctp_ulpq *ulpq, | 782 | static void sctp_ulpq_store_ordered(struct sctp_ulpq *ulpq, |
783 | struct sctp_ulpevent *event) | 783 | struct sctp_ulpevent *event) |
784 | { | 784 | { |
785 | struct sk_buff *pos; | 785 | struct sk_buff *pos; |
@@ -867,13 +867,14 @@ static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq, | |||
867 | /* Helper function to gather skbs that have possibly become | 867 | /* Helper function to gather skbs that have possibly become |
868 | * ordered by forward tsn skipping their dependencies. | 868 | * ordered by forward tsn skipping their dependencies. |
869 | */ | 869 | */ |
870 | static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid) | 870 | static void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid) |
871 | { | 871 | { |
872 | struct sk_buff *pos, *tmp; | 872 | struct sk_buff *pos, *tmp; |
873 | struct sctp_ulpevent *cevent; | 873 | struct sctp_ulpevent *cevent; |
874 | struct sctp_ulpevent *event; | 874 | struct sctp_ulpevent *event; |
875 | struct sctp_stream *in; | 875 | struct sctp_stream *in; |
876 | struct sk_buff_head temp; | 876 | struct sk_buff_head temp; |
877 | struct sk_buff_head *lobby = &ulpq->lobby; | ||
877 | __u16 csid, cssn; | 878 | __u16 csid, cssn; |
878 | 879 | ||
879 | in = &ulpq->asoc->ssnmap->in; | 880 | in = &ulpq->asoc->ssnmap->in; |
@@ -881,7 +882,7 @@ static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid) | |||
881 | /* We are holding the chunks by stream, by SSN. */ | 882 | /* We are holding the chunks by stream, by SSN. */ |
882 | skb_queue_head_init(&temp); | 883 | skb_queue_head_init(&temp); |
883 | event = NULL; | 884 | event = NULL; |
884 | sctp_skb_for_each(pos, &ulpq->lobby, tmp) { | 885 | sctp_skb_for_each(pos, lobby, tmp) { |
885 | cevent = (struct sctp_ulpevent *) pos->cb; | 886 | cevent = (struct sctp_ulpevent *) pos->cb; |
886 | csid = cevent->stream; | 887 | csid = cevent->stream; |
887 | cssn = cevent->ssn; | 888 | cssn = cevent->ssn; |
@@ -895,10 +896,10 @@ static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid) | |||
895 | continue; | 896 | continue; |
896 | 897 | ||
897 | /* see if this ssn has been marked by skipping */ | 898 | /* see if this ssn has been marked by skipping */ |
898 | if (!SSN_lte(cssn, sctp_ssn_peek(in, csid))) | 899 | if (!SSN_lt(cssn, sctp_ssn_peek(in, csid))) |
899 | break; | 900 | break; |
900 | 901 | ||
901 | __skb_unlink(pos, &ulpq->lobby); | 902 | __skb_unlink(pos, lobby); |
902 | if (!event) | 903 | if (!event) |
903 | /* Create a temporary list to collect chunks on. */ | 904 | /* Create a temporary list to collect chunks on. */ |
904 | event = sctp_skb2event(pos); | 905 | event = sctp_skb2event(pos); |
@@ -907,6 +908,22 @@ static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid) | |||
907 | __skb_queue_tail(&temp, pos); | 908 | __skb_queue_tail(&temp, pos); |
908 | } | 909 | } |
909 | 910 | ||
911 | /* If we didn't reap any data, see if the next expected SSN | ||
912 | * is next on the queue and if so, use that. | ||
913 | */ | ||
914 | if (event == NULL && pos != (struct sk_buff *)lobby) { | ||
915 | cevent = (struct sctp_ulpevent *) pos->cb; | ||
916 | csid = cevent->stream; | ||
917 | cssn = cevent->ssn; | ||
918 | |||
919 | if (csid == sid && cssn == sctp_ssn_peek(in, csid)) { | ||
920 | sctp_ssn_next(in, csid); | ||
921 | __skb_unlink(pos, lobby); | ||
922 | __skb_queue_tail(&temp, pos); | ||
923 | event = sctp_skb2event(pos); | ||
924 | } | ||
925 | } | ||
926 | |||
910 | /* Send event to the ULP. 'event' is the sctp_ulpevent for | 927 | /* Send event to the ULP. 'event' is the sctp_ulpevent for |
911 | * very first SKB on the 'temp' list. | 928 | * very first SKB on the 'temp' list. |
912 | */ | 929 | */ |
diff --git a/scripts/.gitignore b/scripts/.gitignore index a1f52cb47200..b939fbd01195 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore | |||
@@ -6,3 +6,4 @@ kallsyms | |||
6 | pnmtologo | 6 | pnmtologo |
7 | bin2c | 7 | bin2c |
8 | unifdef | 8 | unifdef |
9 | binoffset | ||
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index b96ea8d6a5ed..da3559ea92e0 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -39,15 +39,19 @@ escsq = $(subst $(squote),'\$(squote)',$1) | |||
39 | # - If they are equal no change, and no timestamp update | 39 | # - If they are equal no change, and no timestamp update |
40 | # - stdin is piped in from the first prerequisite ($<) so one has | 40 | # - stdin is piped in from the first prerequisite ($<) so one has |
41 | # to specify a valid file as first prerequisite (often the kbuild file) | 41 | # to specify a valid file as first prerequisite (often the kbuild file) |
42 | quiet_chk_filechk = echo ' CHK $@' | ||
43 | silent_chk_filechk = : | ||
44 | quiet_upd_filechk = echo ' UPD $@' | ||
45 | silent_upd_filechk = : | ||
42 | define filechk | 46 | define filechk |
43 | $(Q)set -e; \ | 47 | $(Q)set -e; \ |
44 | echo ' CHK $@'; \ | 48 | $($(quiet)chk_filechk); \ |
45 | mkdir -p $(dir $@); \ | 49 | mkdir -p $(dir $@); \ |
46 | $(filechk_$(1)) < $< > $@.tmp; \ | 50 | $(filechk_$(1)) < $< > $@.tmp; \ |
47 | if [ -r $@ ] && cmp -s $@ $@.tmp; then \ | 51 | if [ -r $@ ] && cmp -s $@ $@.tmp; then \ |
48 | rm -f $@.tmp; \ | 52 | rm -f $@.tmp; \ |
49 | else \ | 53 | else \ |
50 | echo ' UPD $@'; \ | 54 | $($(quiet)upd_filechk); \ |
51 | mv -f $@.tmp $@; \ | 55 | mv -f $@.tmp $@; \ |
52 | fi | 56 | fi |
53 | endef | 57 | endef |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 5d546466e6b1..dbe1fb5e8cc0 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -613,7 +613,7 @@ static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) | |||
613 | if (sym) | 613 | if (sym) |
614 | return elf->strtab + sym->st_name; | 614 | return elf->strtab + sym->st_name; |
615 | else | 615 | else |
616 | return ""; | 616 | return "(unknown)"; |
617 | } | 617 | } |
618 | 618 | ||
619 | static const char *sec_name(struct elf_info *elf, int shndx) | 619 | static const char *sec_name(struct elf_info *elf, int shndx) |
@@ -1102,7 +1102,7 @@ static int is_function(Elf_Sym *sym) | |||
1102 | if (sym) | 1102 | if (sym) |
1103 | return ELF_ST_TYPE(sym->st_info) == STT_FUNC; | 1103 | return ELF_ST_TYPE(sym->st_info) == STT_FUNC; |
1104 | else | 1104 | else |
1105 | return 0; | 1105 | return -1; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | /* | 1108 | /* |
@@ -1120,24 +1120,31 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, | |||
1120 | { | 1120 | { |
1121 | const char *from, *from_p; | 1121 | const char *from, *from_p; |
1122 | const char *to, *to_p; | 1122 | const char *to, *to_p; |
1123 | from = from_is_func ? "function" : "variable"; | 1123 | |
1124 | from_p = from_is_func ? "()" : ""; | 1124 | switch (from_is_func) { |
1125 | to = to_is_func ? "function" : "variable"; | 1125 | case 0: from = "variable"; from_p = ""; break; |
1126 | to_p = to_is_func ? "()" : ""; | 1126 | case 1: from = "function"; from_p = "()"; break; |
1127 | default: from = "(unknown reference)"; from_p = ""; break; | ||
1128 | } | ||
1129 | switch (to_is_func) { | ||
1130 | case 0: to = "variable"; to_p = ""; break; | ||
1131 | case 1: to = "function"; to_p = "()"; break; | ||
1132 | default: to = "(unknown reference)"; to_p = ""; break; | ||
1133 | } | ||
1127 | 1134 | ||
1128 | sec_mismatch_count++; | 1135 | sec_mismatch_count++; |
1129 | if (!sec_mismatch_verbose) | 1136 | if (!sec_mismatch_verbose) |
1130 | return; | 1137 | return; |
1131 | 1138 | ||
1132 | fprintf(stderr, "WARNING: %s(%s+0x%llx): Section mismatch in" | 1139 | warn("%s(%s+0x%llx): Section mismatch in reference from the %s %s%s " |
1133 | " reference from the %s %s%s to the %s %s:%s%s\n", | 1140 | "to the %s %s:%s%s\n", |
1134 | modname, fromsec, fromaddr, from, fromsym, from_p, | 1141 | modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec, |
1135 | to, tosec, tosym, to_p); | 1142 | tosym, to_p); |
1136 | 1143 | ||
1137 | switch (mismatch) { | 1144 | switch (mismatch) { |
1138 | case TEXT_TO_INIT: | 1145 | case TEXT_TO_INIT: |
1139 | fprintf(stderr, | 1146 | fprintf(stderr, |
1140 | "The function %s %s() references\n" | 1147 | "The function %s%s() references\n" |
1141 | "the %s %s%s%s.\n" | 1148 | "the %s %s%s%s.\n" |
1142 | "This is often because %s lacks a %s\n" | 1149 | "This is often because %s lacks a %s\n" |
1143 | "annotation or the annotation of %s is wrong.\n", | 1150 | "annotation or the annotation of %s is wrong.\n", |
@@ -1938,10 +1945,10 @@ int main(int argc, char **argv) | |||
1938 | if (dump_write) | 1945 | if (dump_write) |
1939 | write_dump(dump_write); | 1946 | write_dump(dump_write); |
1940 | if (sec_mismatch_count && !sec_mismatch_verbose) | 1947 | if (sec_mismatch_count && !sec_mismatch_verbose) |
1941 | fprintf(stderr, "modpost: Found %d section mismatch(es).\n" | 1948 | warn("modpost: Found %d section mismatch(es).\n" |
1942 | "To see full details build your kernel with:\n" | 1949 | "To see full details build your kernel with:\n" |
1943 | "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", | 1950 | "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", |
1944 | sec_mismatch_count); | 1951 | sec_mismatch_count); |
1945 | 1952 | ||
1946 | return err; | 1953 | return err; |
1947 | } | 1954 | } |
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 0f657b5f3bc8..ba6bf5d5abf9 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
@@ -13,6 +13,7 @@ set -e | |||
13 | 13 | ||
14 | # Some variables and settings used throughout the script | 14 | # Some variables and settings used throughout the script |
15 | version=$KERNELRELEASE | 15 | version=$KERNELRELEASE |
16 | revision=`cat .version` | ||
16 | tmpdir="$objtree/debian/tmp" | 17 | tmpdir="$objtree/debian/tmp" |
17 | packagename=linux-$version | 18 | packagename=linux-$version |
18 | 19 | ||
@@ -65,7 +66,7 @@ done | |||
65 | name="Kernel Compiler <$(id -nu)@$(hostname -f)>" | 66 | name="Kernel Compiler <$(id -nu)@$(hostname -f)>" |
66 | # Generate a simple changelog template | 67 | # Generate a simple changelog template |
67 | cat <<EOF > debian/changelog | 68 | cat <<EOF > debian/changelog |
68 | linux ($version) unstable; urgency=low | 69 | linux ($version-$revision) unstable; urgency=low |
69 | 70 | ||
70 | * A standard release | 71 | * A standard release |
71 | 72 | ||