diff options
207 files changed, 9930 insertions, 2153 deletions
diff --git a/Documentation/aoe/mkshelf.sh b/Documentation/aoe/mkshelf.sh index 8bacf9f2c7cc..32615814271c 100644 --- a/Documentation/aoe/mkshelf.sh +++ b/Documentation/aoe/mkshelf.sh | |||
@@ -8,13 +8,15 @@ fi | |||
8 | n_partitions=${n_partitions:-16} | 8 | n_partitions=${n_partitions:-16} |
9 | dir=$1 | 9 | dir=$1 |
10 | shelf=$2 | 10 | shelf=$2 |
11 | nslots=16 | ||
12 | maxslot=`echo $nslots 1 - p | dc` | ||
11 | MAJOR=152 | 13 | MAJOR=152 |
12 | 14 | ||
13 | set -e | 15 | set -e |
14 | 16 | ||
15 | minor=`echo 10 \* $shelf \* $n_partitions | bc` | 17 | minor=`echo $nslots \* $shelf \* $n_partitions | bc` |
16 | endp=`echo $n_partitions - 1 | bc` | 18 | endp=`echo $n_partitions - 1 | bc` |
17 | for slot in `seq 0 9`; do | 19 | for slot in `seq 0 $maxslot`; do |
18 | for part in `seq 0 $endp`; do | 20 | for part in `seq 0 $endp`; do |
19 | name=e$shelf.$slot | 21 | name=e$shelf.$slot |
20 | test "$part" != "0" && name=${name}p$part | 22 | test "$part" != "0" && name=${name}p$part |
diff --git a/Documentation/fb/intel810.txt b/Documentation/fb/intel810.txt index fd68b162e4a1..4f0d6bc789ef 100644 --- a/Documentation/fb/intel810.txt +++ b/Documentation/fb/intel810.txt | |||
@@ -5,6 +5,7 @@ Intel 810/815 Framebuffer driver | |||
5 | March 17, 2002 | 5 | March 17, 2002 |
6 | 6 | ||
7 | First Released: July 2001 | 7 | First Released: July 2001 |
8 | Last Update: September 12, 2005 | ||
8 | ================================================================ | 9 | ================================================================ |
9 | 10 | ||
10 | A. Introduction | 11 | A. Introduction |
@@ -44,6 +45,8 @@ B. Features | |||
44 | 45 | ||
45 | - Hardware Cursor Support | 46 | - Hardware Cursor Support |
46 | 47 | ||
48 | - Supports EDID probing either by DDC/I2C or through the BIOS | ||
49 | |||
47 | C. List of available options | 50 | C. List of available options |
48 | 51 | ||
49 | a. "video=i810fb" | 52 | a. "video=i810fb" |
@@ -52,14 +55,17 @@ C. List of available options | |||
52 | Recommendation: required | 55 | Recommendation: required |
53 | 56 | ||
54 | b. "xres:<value>" | 57 | b. "xres:<value>" |
55 | select horizontal resolution in pixels | 58 | select horizontal resolution in pixels. (This parameter will be |
59 | ignored if 'mode_option' is specified. See 'o' below). | ||
56 | 60 | ||
57 | Recommendation: user preference | 61 | Recommendation: user preference |
58 | (default = 640) | 62 | (default = 640) |
59 | 63 | ||
60 | c. "yres:<value>" | 64 | c. "yres:<value>" |
61 | select vertical resolution in scanlines. If Discrete Video Timings | 65 | select vertical resolution in scanlines. If Discrete Video Timings |
62 | is enabled, this will be ignored and computed as 3*xres/4. | 66 | is enabled, this will be ignored and computed as 3*xres/4. (This |
67 | parameter will be ignored if 'mode_option' is specified. See 'o' | ||
68 | below) | ||
63 | 69 | ||
64 | Recommendation: user preference | 70 | Recommendation: user preference |
65 | (default = 480) | 71 | (default = 480) |
@@ -86,7 +92,8 @@ C. List of available options | |||
86 | g. "hsync1/hsync2:<value>" | 92 | g. "hsync1/hsync2:<value>" |
87 | select the minimum and maximum Horizontal Sync Frequency of the | 93 | select the minimum and maximum Horizontal Sync Frequency of the |
88 | monitor in KHz. If a using a fixed frequency monitor, hsync1 must | 94 | monitor in KHz. If a using a fixed frequency monitor, hsync1 must |
89 | be equal to hsync2. | 95 | be equal to hsync2. If EDID probing is successful, these will be |
96 | ignored and values will be taken from the EDID block. | ||
90 | 97 | ||
91 | Recommendation: check monitor manual for correct values | 98 | Recommendation: check monitor manual for correct values |
92 | default (29/30) | 99 | default (29/30) |
@@ -94,7 +101,8 @@ C. List of available options | |||
94 | h. "vsync1/vsync2:<value>" | 101 | h. "vsync1/vsync2:<value>" |
95 | select the minimum and maximum Vertical Sync Frequency of the monitor | 102 | select the minimum and maximum Vertical Sync Frequency of the monitor |
96 | in Hz. You can also use this option to lock your monitor's refresh | 103 | in Hz. You can also use this option to lock your monitor's refresh |
97 | rate. | 104 | rate. If EDID probing is successful, these will be ignored and values |
105 | will be taken from the EDID block. | ||
98 | 106 | ||
99 | Recommendation: check monitor manual for correct values | 107 | Recommendation: check monitor manual for correct values |
100 | (default = 60/60) | 108 | (default = 60/60) |
@@ -154,7 +162,11 @@ C. List of available options | |||
154 | 162 | ||
155 | Recommendation: do not set | 163 | Recommendation: do not set |
156 | (default = not set) | 164 | (default = not set) |
157 | 165 | o. <xres>x<yres>[-<bpp>][@<refresh>] | |
166 | The driver will now accept specification of boot mode option. If this | ||
167 | is specified, the options 'xres' and 'yres' will be ignored. See | ||
168 | Documentation/fb/modedb.txt for usage. | ||
169 | |||
158 | D. Kernel booting | 170 | D. Kernel booting |
159 | 171 | ||
160 | Separate each option/option-pair by commas (,) and the option from its value | 172 | Separate each option/option-pair by commas (,) and the option from its value |
@@ -176,7 +188,10 @@ will be computed based on the hsync1/hsync2 and vsync1/vsync2 values. | |||
176 | 188 | ||
177 | IMPORTANT: | 189 | IMPORTANT: |
178 | You must include hsync1, hsync2, vsync1 and vsync2 to enable video modes | 190 | You must include hsync1, hsync2, vsync1 and vsync2 to enable video modes |
179 | better than 640x480 at 60Hz. | 191 | better than 640x480 at 60Hz. HOWEVER, if your chipset/display combination |
192 | supports I2C and has an EDID block, you can safely exclude hsync1, hsync2, | ||
193 | vsync1 and vsync2 parameters. These parameters will be taken from the EDID | ||
194 | block. | ||
180 | 195 | ||
181 | E. Module options | 196 | E. Module options |
182 | 197 | ||
@@ -217,32 +232,21 @@ F. Setup | |||
217 | This is required. The option is under "Character Devices" | 232 | This is required. The option is under "Character Devices" |
218 | 233 | ||
219 | d. Under "Graphics Support", select "Intel 810/815" either statically | 234 | d. Under "Graphics Support", select "Intel 810/815" either statically |
220 | or as a module. Choose "use VESA GTF for video timings" if you | 235 | or as a module. Choose "use VESA Generalized Timing Formula" if |
221 | need to maximize the capability of your display. To be on the | 236 | you need to maximize the capability of your display. To be on the |
222 | safe side, you can leave this unselected. | 237 | safe side, you can leave this unselected. |
223 | 238 | ||
224 | e. If you want a framebuffer console, enable it under "Console | 239 | e. If you want support for DDC/I2C probing (Plug and Play Displays), |
240 | set 'Enable DDC Support' to 'y'. To make this option appear, set | ||
241 | 'use VESA Generalized Timing Formula' to 'y'. | ||
242 | |||
243 | f. If you want a framebuffer console, enable it under "Console | ||
225 | Drivers" | 244 | Drivers" |
226 | 245 | ||
227 | f. Compile your kernel. | 246 | g. Compile your kernel. |
228 | 247 | ||
229 | g. Load the driver as described in section D and E. | 248 | h. Load the driver as described in section D and E. |
230 | 249 | ||
231 | Optional: | ||
232 | h. If you are going to run XFree86 with its native drivers, the | ||
233 | standard XFree86 4.1.0 and 4.2.0 drivers should work as is. | ||
234 | However, there's a bug in the XFree86 i810 drivers. It attempts | ||
235 | to use XAA even when switched to the console. This will crash | ||
236 | your server. I have a fix at this site: | ||
237 | |||
238 | http://i810fb.sourceforge.net. | ||
239 | |||
240 | You can either use the patch, or just replace | ||
241 | |||
242 | /usr/X11R6/lib/modules/drivers/i810_drv.o | ||
243 | |||
244 | with the one provided at the website. | ||
245 | |||
246 | i. Try the DirectFB (http://www.directfb.org) + the i810 gfxdriver | 250 | i. Try the DirectFB (http://www.directfb.org) + the i810 gfxdriver |
247 | patch to see the chipset in action (or inaction :-). | 251 | patch to see the chipset in action (or inaction :-). |
248 | 252 | ||
diff --git a/Documentation/firmware_class/firmware_sample_driver.c b/Documentation/firmware_class/firmware_sample_driver.c index e1c56a7e6583..4bef8c25172c 100644 --- a/Documentation/firmware_class/firmware_sample_driver.c +++ b/Documentation/firmware_class/firmware_sample_driver.c | |||
@@ -32,14 +32,14 @@ static void sample_firmware_load(char *firmware, int size) | |||
32 | u8 buf[size+1]; | 32 | u8 buf[size+1]; |
33 | memcpy(buf, firmware, size); | 33 | memcpy(buf, firmware, size); |
34 | buf[size] = '\0'; | 34 | buf[size] = '\0'; |
35 | printk("firmware_sample_driver: firmware: %s\n", buf); | 35 | printk(KERN_INFO "firmware_sample_driver: firmware: %s\n", buf); |
36 | } | 36 | } |
37 | 37 | ||
38 | static void sample_probe_default(void) | 38 | static void sample_probe_default(void) |
39 | { | 39 | { |
40 | /* uses the default method to get the firmware */ | 40 | /* uses the default method to get the firmware */ |
41 | const struct firmware *fw_entry; | 41 | const struct firmware *fw_entry; |
42 | printk("firmware_sample_driver: a ghost device got inserted :)\n"); | 42 | printk(KERN_INFO "firmware_sample_driver: a ghost device got inserted :)\n"); |
43 | 43 | ||
44 | if(request_firmware(&fw_entry, "sample_driver_fw", &ghost_device)!=0) | 44 | if(request_firmware(&fw_entry, "sample_driver_fw", &ghost_device)!=0) |
45 | { | 45 | { |
@@ -61,7 +61,7 @@ static void sample_probe_specific(void) | |||
61 | 61 | ||
62 | /* NOTE: This currently doesn't work */ | 62 | /* NOTE: This currently doesn't work */ |
63 | 63 | ||
64 | printk("firmware_sample_driver: a ghost device got inserted :)\n"); | 64 | printk(KERN_INFO "firmware_sample_driver: a ghost device got inserted :)\n"); |
65 | 65 | ||
66 | if(request_firmware(NULL, "sample_driver_fw", &ghost_device)!=0) | 66 | if(request_firmware(NULL, "sample_driver_fw", &ghost_device)!=0) |
67 | { | 67 | { |
@@ -83,7 +83,7 @@ static void sample_probe_async_cont(const struct firmware *fw, void *context) | |||
83 | return; | 83 | return; |
84 | } | 84 | } |
85 | 85 | ||
86 | printk("firmware_sample_driver: device pointer \"%s\"\n", | 86 | printk(KERN_INFO "firmware_sample_driver: device pointer \"%s\"\n", |
87 | (char *)context); | 87 | (char *)context); |
88 | sample_firmware_load(fw->data, fw->size); | 88 | sample_firmware_load(fw->data, fw->size); |
89 | } | 89 | } |
diff --git a/Documentation/input/appletouch.txt b/Documentation/input/appletouch.txt new file mode 100644 index 000000000000..b48d11d0326d --- /dev/null +++ b/Documentation/input/appletouch.txt | |||
@@ -0,0 +1,84 @@ | |||
1 | Apple Touchpad Driver (appletouch) | ||
2 | ---------------------------------- | ||
3 | Copyright (C) 2005 Stelian Pop <stelian@popies.net> | ||
4 | |||
5 | appletouch is a Linux kernel driver for the USB touchpad found on post | ||
6 | February 2005 Apple Alu Powerbooks. | ||
7 | |||
8 | This driver is derived from Johannes Berg's appletrackpad driver[1], but it has | ||
9 | been improved in some areas: | ||
10 | * appletouch is a full kernel driver, no userspace program is necessary | ||
11 | * appletouch can be interfaced with the synaptics X11 driver, in order | ||
12 | to have touchpad acceleration, scrolling, etc. | ||
13 | |||
14 | Credits go to Johannes Berg for reverse-engineering the touchpad protocol, | ||
15 | Frank Arnold for further improvements, and Alex Harper for some additional | ||
16 | information about the inner workings of the touchpad sensors. | ||
17 | |||
18 | Usage: | ||
19 | ------ | ||
20 | |||
21 | In order to use the touchpad in the basic mode, compile the driver and load | ||
22 | the module. A new input device will be detected and you will be able to read | ||
23 | the mouse data from /dev/input/mice (using gpm, or X11). | ||
24 | |||
25 | In X11, you can configure the touchpad to use the synaptics X11 driver, which | ||
26 | will give additional functionalities, like acceleration, scrolling, 2 finger | ||
27 | tap for middle button mouse emulation, 3 finger tap for right button mouse | ||
28 | emulation, etc. In order to do this, make sure you're using a recent version of | ||
29 | the synaptics driver (tested with 0.14.2, available from [2]), and configure a | ||
30 | new input device in your X11 configuration file (take a look below for an | ||
31 | example). For additional configuration, see the synaptics driver documentation. | ||
32 | |||
33 | Section "InputDevice" | ||
34 | Identifier "Synaptics Touchpad" | ||
35 | Driver "synaptics" | ||
36 | Option "SendCoreEvents" "true" | ||
37 | Option "Device" "/dev/input/mice" | ||
38 | Option "Protocol" "auto-dev" | ||
39 | Option "LeftEdge" "0" | ||
40 | Option "RightEdge" "850" | ||
41 | Option "TopEdge" "0" | ||
42 | Option "BottomEdge" "645" | ||
43 | Option "MinSpeed" "0.4" | ||
44 | Option "MaxSpeed" "1" | ||
45 | Option "AccelFactor" "0.02" | ||
46 | Option "FingerLow" "0" | ||
47 | Option "FingerHigh" "30" | ||
48 | Option "MaxTapMove" "20" | ||
49 | Option "MaxTapTime" "100" | ||
50 | Option "HorizScrollDelta" "0" | ||
51 | Option "VertScrollDelta" "30" | ||
52 | Option "SHMConfig" "on" | ||
53 | EndSection | ||
54 | |||
55 | Section "ServerLayout" | ||
56 | ... | ||
57 | InputDevice "Mouse" | ||
58 | InputDevice "Synaptics Touchpad" | ||
59 | ... | ||
60 | EndSection | ||
61 | |||
62 | Fuzz problems: | ||
63 | -------------- | ||
64 | |||
65 | The touchpad sensors are very sensitive to heat, and will generate a lot of | ||
66 | noise when the temperature changes. This is especially true when you power-on | ||
67 | the laptop for the first time. | ||
68 | |||
69 | The appletouch driver tries to handle this noise and auto adapt itself, but it | ||
70 | is not perfect. If finger movements are not recognized anymore, try reloading | ||
71 | the driver. | ||
72 | |||
73 | You can activate debugging using the 'debug' module parameter. A value of 0 | ||
74 | deactivates any debugging, 1 activates tracing of invalid samples, 2 activates | ||
75 | full tracing (each sample is being traced): | ||
76 | modprobe appletouch debug=1 | ||
77 | or | ||
78 | echo "1" > /sys/module/appletouch/parameters/debug | ||
79 | |||
80 | Links: | ||
81 | ------ | ||
82 | |||
83 | [1]: http://johannes.sipsolutions.net/PowerBook/touchpad/ | ||
84 | [2]: http://web.telia.com/~u89404340/touchpad/index.html | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index db2603ceabba..7086f0a90d14 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -164,6 +164,15 @@ running once the system is up. | |||
164 | over-ride platform specific driver. | 164 | over-ride platform specific driver. |
165 | See also Documentation/acpi-hotkey.txt. | 165 | See also Documentation/acpi-hotkey.txt. |
166 | 166 | ||
167 | enable_timer_pin_1 [i386,x86-64] | ||
168 | Enable PIN 1 of APIC timer | ||
169 | Can be useful to work around chipset bugs (in particular on some ATI chipsets) | ||
170 | The kernel tries to set a reasonable default. | ||
171 | |||
172 | disable_timer_pin_1 [i386,x86-64] | ||
173 | Disable PIN 1 of APIC timer | ||
174 | Can be useful to work around chipset bugs. | ||
175 | |||
167 | ad1816= [HW,OSS] | 176 | ad1816= [HW,OSS] |
168 | Format: <io>,<irq>,<dma>,<dma2> | 177 | Format: <io>,<irq>,<dma>,<dma2> |
169 | See also Documentation/sound/oss/AD1816. | 178 | See also Documentation/sound/oss/AD1816. |
diff --git a/Documentation/usb/proc_usb_info.txt b/Documentation/usb/proc_usb_info.txt index 729c72d34c89..f86550fe38ee 100644 --- a/Documentation/usb/proc_usb_info.txt +++ b/Documentation/usb/proc_usb_info.txt | |||
@@ -20,7 +20,7 @@ the /proc/bus/usb/BBB/DDD files. | |||
20 | 20 | ||
21 | to /etc/fstab. This will mount usbfs at each reboot. | 21 | to /etc/fstab. This will mount usbfs at each reboot. |
22 | You can then issue `cat /proc/bus/usb/devices` to extract | 22 | You can then issue `cat /proc/bus/usb/devices` to extract |
23 | USB device information, and user mode drivers can use usbfs | 23 | USB device information, and user mode drivers can use usbfs |
24 | to interact with USB devices. | 24 | to interact with USB devices. |
25 | 25 | ||
26 | There are a number of mount options supported by usbfs. | 26 | There are a number of mount options supported by usbfs. |
@@ -32,7 +32,7 @@ the /proc/bus/usb/BBB/DDD files. | |||
32 | still see references to the older "usbdevfs" name. | 32 | still see references to the older "usbdevfs" name. |
33 | 33 | ||
34 | For more information on mounting the usbfs file system, see the | 34 | For more information on mounting the usbfs file system, see the |
35 | "USB Device Filesystem" section of the USB Guide. The latest copy | 35 | "USB Device Filesystem" section of the USB Guide. The latest copy |
36 | of the USB Guide can be found at http://www.linux-usb.org/ | 36 | of the USB Guide can be found at http://www.linux-usb.org/ |
37 | 37 | ||
38 | 38 | ||
@@ -133,7 +133,7 @@ B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd | |||
133 | are the only transfers that reserve bandwidth. Control and bulk | 133 | are the only transfers that reserve bandwidth. Control and bulk |
134 | transfers use all other bandwidth, including reserved bandwidth that | 134 | transfers use all other bandwidth, including reserved bandwidth that |
135 | is not used for transfers (such as for short packets). | 135 | is not used for transfers (such as for short packets). |
136 | 136 | ||
137 | The percentage is how much of the "reserved" bandwidth is scheduled by | 137 | The percentage is how much of the "reserved" bandwidth is scheduled by |
138 | those transfers. For a low or full speed bus (loosely, "USB 1.1"), | 138 | those transfers. For a low or full speed bus (loosely, "USB 1.1"), |
139 | 90% of the bus bandwidth is reserved. For a high speed bus (loosely, | 139 | 90% of the bus bandwidth is reserved. For a high speed bus (loosely, |
@@ -197,7 +197,7 @@ C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA | |||
197 | | | |__NumberOfInterfaces | 197 | | | |__NumberOfInterfaces |
198 | | |__ "*" indicates the active configuration (others are " ") | 198 | | |__ "*" indicates the active configuration (others are " ") |
199 | |__Config info tag | 199 | |__Config info tag |
200 | 200 | ||
201 | USB devices may have multiple configurations, each of which act | 201 | USB devices may have multiple configurations, each of which act |
202 | rather differently. For example, a bus-powered configuration | 202 | rather differently. For example, a bus-powered configuration |
203 | might be much less capable than one that is self-powered. Only | 203 | might be much less capable than one that is self-powered. Only |
@@ -228,7 +228,7 @@ I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss | |||
228 | For example, default settings may not use more than a small | 228 | For example, default settings may not use more than a small |
229 | amount of periodic bandwidth. To use significant fractions | 229 | amount of periodic bandwidth. To use significant fractions |
230 | of bus bandwidth, drivers must select a non-default altsetting. | 230 | of bus bandwidth, drivers must select a non-default altsetting. |
231 | 231 | ||
232 | Only one setting for an interface may be active at a time, and | 232 | Only one setting for an interface may be active at a time, and |
233 | only one driver may bind to an interface at a time. Most devices | 233 | only one driver may bind to an interface at a time. Most devices |
234 | have only one alternate setting per interface. | 234 | have only one alternate setting per interface. |
@@ -297,18 +297,21 @@ S: SerialNumber=dce0 | |||
297 | C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA | 297 | C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA |
298 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub | 298 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub |
299 | E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms | 299 | E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms |
300 | |||
300 | T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4 | 301 | T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4 |
301 | D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | 302 | D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 |
302 | P: Vendor=0451 ProdID=1446 Rev= 1.00 | 303 | P: Vendor=0451 ProdID=1446 Rev= 1.00 |
303 | C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA | 304 | C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA |
304 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub | 305 | I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub |
305 | E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms | 306 | E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms |
307 | |||
306 | T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0 | 308 | T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0 |
307 | D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | 309 | D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 |
308 | P: Vendor=04b4 ProdID=0001 Rev= 0.00 | 310 | P: Vendor=04b4 ProdID=0001 Rev= 0.00 |
309 | C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA | 311 | C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA |
310 | I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse | 312 | I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse |
311 | E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms | 313 | E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms |
314 | |||
312 | T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0 | 315 | T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0 |
313 | D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 | 316 | D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 |
314 | P: Vendor=0565 ProdID=0001 Rev= 1.08 | 317 | P: Vendor=0565 ProdID=0001 Rev= 1.08 |
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt index 678e8f192db2..ffe1c062088b 100644 --- a/Documentation/x86_64/boot-options.txt +++ b/Documentation/x86_64/boot-options.txt | |||
@@ -11,6 +11,11 @@ Machine check | |||
11 | If your BIOS doesn't do that it's a good idea to enable though | 11 | If your BIOS doesn't do that it's a good idea to enable though |
12 | to make sure you log even machine check events that result | 12 | to make sure you log even machine check events that result |
13 | in a reboot. | 13 | in a reboot. |
14 | mce=tolerancelevel (number) | ||
15 | 0: always panic, 1: panic if deadlock possible, | ||
16 | 2: try to avoid panic, 3: never panic or exit (for testing) | ||
17 | default is 1 | ||
18 | Can be also set using sysfs which is preferable. | ||
14 | 19 | ||
15 | nomce (for compatibility with i386): same as mce=off | 20 | nomce (for compatibility with i386): same as mce=off |
16 | 21 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index f038dca34ee8..a67bf7d315d7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -964,6 +964,13 @@ L: lm-sensors@lm-sensors.org | |||
964 | W: http://www.lm-sensors.nu/ | 964 | W: http://www.lm-sensors.nu/ |
965 | S: Maintained | 965 | S: Maintained |
966 | 966 | ||
967 | HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER | ||
968 | P: Robert Love | ||
969 | M: rlove@rlove.org | ||
970 | M: linux-kernel@vger.kernel.org | ||
971 | W: http://www.kernel.org/pub/linux/kernel/people/rml/hdaps/ | ||
972 | S: Maintained | ||
973 | |||
967 | HARMONY SOUND DRIVER | 974 | HARMONY SOUND DRIVER |
968 | P: Kyle McMartin | 975 | P: Kyle McMartin |
969 | M: kyle@parisc-linux.org | 976 | M: kyle@parisc-linux.org |
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c index f1b9d2a46dab..1ae2aeeda18b 100644 --- a/arch/i386/kernel/acpi/earlyquirk.c +++ b/arch/i386/kernel/acpi/earlyquirk.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/pci.h> | 7 | #include <linux/pci.h> |
8 | #include <asm/pci-direct.h> | 8 | #include <asm/pci-direct.h> |
9 | #include <asm/acpi.h> | 9 | #include <asm/acpi.h> |
10 | #include <asm/apic.h> | ||
10 | 11 | ||
11 | static int __init check_bridge(int vendor, int device) | 12 | static int __init check_bridge(int vendor, int device) |
12 | { | 13 | { |
@@ -15,6 +16,15 @@ static int __init check_bridge(int vendor, int device) | |||
15 | if (vendor == PCI_VENDOR_ID_NVIDIA) { | 16 | if (vendor == PCI_VENDOR_ID_NVIDIA) { |
16 | acpi_skip_timer_override = 1; | 17 | acpi_skip_timer_override = 1; |
17 | } | 18 | } |
19 | #ifdef CONFIG_X86_LOCAL_APIC | ||
20 | /* | ||
21 | * ATI IXP chipsets get double timer interrupts. | ||
22 | * For now just do this for all ATI chipsets. | ||
23 | * FIXME: this needs to be checked for the non ACPI case too. | ||
24 | */ | ||
25 | if (vendor == PCI_VENDOR_ID_ATI) | ||
26 | disable_timer_pin_1 = 1; | ||
27 | #endif | ||
18 | return 0; | 28 | return 0; |
19 | } | 29 | } |
20 | 30 | ||
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index 3aad03839660..9e24f7b207ee 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S | |||
@@ -319,7 +319,7 @@ work_notifysig: # deal with pending signals and | |||
319 | # vm86-space | 319 | # vm86-space |
320 | xorl %edx, %edx | 320 | xorl %edx, %edx |
321 | call do_notify_resume | 321 | call do_notify_resume |
322 | jmp restore_all | 322 | jmp resume_userspace |
323 | 323 | ||
324 | ALIGN | 324 | ALIGN |
325 | work_notifysig_v86: | 325 | work_notifysig_v86: |
@@ -329,7 +329,7 @@ work_notifysig_v86: | |||
329 | movl %eax, %esp | 329 | movl %eax, %esp |
330 | xorl %edx, %edx | 330 | xorl %edx, %edx |
331 | call do_notify_resume | 331 | call do_notify_resume |
332 | jmp restore_all | 332 | jmp resume_userspace |
333 | 333 | ||
334 | # perform syscall exit tracing | 334 | # perform syscall exit tracing |
335 | ALIGN | 335 | ALIGN |
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 35d3ce26a544..378313b0cce9 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c | |||
@@ -60,6 +60,8 @@ int sis_apic_bug = -1; | |||
60 | */ | 60 | */ |
61 | int nr_ioapic_registers[MAX_IO_APICS]; | 61 | int nr_ioapic_registers[MAX_IO_APICS]; |
62 | 62 | ||
63 | int disable_timer_pin_1 __initdata; | ||
64 | |||
63 | /* | 65 | /* |
64 | * Rough estimation of how many shared IRQs there are, can | 66 | * Rough estimation of how many shared IRQs there are, can |
65 | * be changed anytime. | 67 | * be changed anytime. |
@@ -2211,6 +2213,8 @@ static inline void check_timer(void) | |||
2211 | setup_nmi(); | 2213 | setup_nmi(); |
2212 | enable_8259A_irq(0); | 2214 | enable_8259A_irq(0); |
2213 | } | 2215 | } |
2216 | if (disable_timer_pin_1 > 0) | ||
2217 | clear_IO_APIC_pin(0, pin1); | ||
2214 | return; | 2218 | return; |
2215 | } | 2219 | } |
2216 | clear_IO_APIC_pin(0, pin1); | 2220 | clear_IO_APIC_pin(0, pin1); |
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index f3d808451d25..dc39ca6a7eca 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -851,6 +851,11 @@ static void __init parse_cmdline_early (char ** cmdline_p) | |||
851 | #endif | 851 | #endif |
852 | 852 | ||
853 | #ifdef CONFIG_X86_LOCAL_APIC | 853 | #ifdef CONFIG_X86_LOCAL_APIC |
854 | if (!memcmp(from, "disable_timer_pin_1", 19)) | ||
855 | disable_timer_pin_1 = 1; | ||
856 | if (!memcmp(from, "enable_timer_pin_1", 18)) | ||
857 | disable_timer_pin_1 = -1; | ||
858 | |||
854 | /* disable IO-APIC */ | 859 | /* disable IO-APIC */ |
855 | else if (!memcmp(from, "noapic", 6)) | 860 | else if (!memcmp(from, "noapic", 6)) |
856 | disable_ioapic_setup(); | 861 | disable_ioapic_setup(); |
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c index 7b3b27d64409..516bf5653b02 100644 --- a/arch/i386/kernel/srat.c +++ b/arch/i386/kernel/srat.c | |||
@@ -213,12 +213,18 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c | |||
213 | node_end_pfn[nid] = memory_chunk->end_pfn; | 213 | node_end_pfn[nid] = memory_chunk->end_pfn; |
214 | } | 214 | } |
215 | 215 | ||
216 | static u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */ | ||
217 | |||
218 | int pxm_to_node(int pxm) | ||
219 | { | ||
220 | return pxm_to_nid_map[pxm]; | ||
221 | } | ||
222 | |||
216 | /* Parse the ACPI Static Resource Affinity Table */ | 223 | /* Parse the ACPI Static Resource Affinity Table */ |
217 | static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | 224 | static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) |
218 | { | 225 | { |
219 | u8 *start, *end, *p; | 226 | u8 *start, *end, *p; |
220 | int i, j, nid; | 227 | int i, j, nid; |
221 | u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */ | ||
222 | u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */ | 228 | u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */ |
223 | 229 | ||
224 | start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ | 230 | start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ |
diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c index 42913f43feb0..2941674f35eb 100644 --- a/arch/i386/pci/acpi.c +++ b/arch/i386/pci/acpi.c | |||
@@ -3,16 +3,31 @@ | |||
3 | #include <linux/init.h> | 3 | #include <linux/init.h> |
4 | #include <linux/irq.h> | 4 | #include <linux/irq.h> |
5 | #include <asm/hw_irq.h> | 5 | #include <asm/hw_irq.h> |
6 | #include <asm/numa.h> | ||
6 | #include "pci.h" | 7 | #include "pci.h" |
7 | 8 | ||
8 | struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum) | 9 | struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum) |
9 | { | 10 | { |
11 | struct pci_bus *bus; | ||
12 | |||
10 | if (domain != 0) { | 13 | if (domain != 0) { |
11 | printk(KERN_WARNING "PCI: Multiple domains not supported\n"); | 14 | printk(KERN_WARNING "PCI: Multiple domains not supported\n"); |
12 | return NULL; | 15 | return NULL; |
13 | } | 16 | } |
14 | 17 | ||
15 | return pcibios_scan_root(busnum); | 18 | bus = pcibios_scan_root(busnum); |
19 | #ifdef CONFIG_ACPI_NUMA | ||
20 | if (bus != NULL) { | ||
21 | int pxm = acpi_get_pxm(device->handle); | ||
22 | if (pxm >= 0) { | ||
23 | bus->sysdata = (void *)(unsigned long)pxm_to_node(pxm); | ||
24 | printk("bus %d -> pxm %d -> node %ld\n", | ||
25 | busnum, pxm, (long)(bus->sysdata)); | ||
26 | } | ||
27 | } | ||
28 | #endif | ||
29 | |||
30 | return bus; | ||
16 | } | 31 | } |
17 | 32 | ||
18 | extern int pci_routeirq; | 33 | extern int pci_routeirq; |
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c index 60f0e7a1162a..dfbf80cff834 100644 --- a/arch/i386/pci/mmconfig.c +++ b/arch/i386/pci/mmconfig.c | |||
@@ -127,13 +127,6 @@ static int __init pci_mmcfg_init(void) | |||
127 | (pci_mmcfg_config[0].base_address == 0)) | 127 | (pci_mmcfg_config[0].base_address == 0)) |
128 | goto out; | 128 | goto out; |
129 | 129 | ||
130 | /* Kludge for now. Don't use mmconfig on AMD systems because | ||
131 | those have some busses where mmconfig doesn't work, | ||
132 | and we don't parse ACPI MCFG well enough to handle that. | ||
133 | Remove when proper handling is added. */ | ||
134 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) | ||
135 | goto out; | ||
136 | |||
137 | printk(KERN_INFO "PCI: Using MMCONFIG\n"); | 130 | printk(KERN_INFO "PCI: Using MMCONFIG\n"); |
138 | raw_pci_ops = &pci_mmcfg; | 131 | raw_pci_ops = &pci_mmcfg; |
139 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; | 132 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; |
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index e29a8a55486a..3fa67ecebc83 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c | |||
@@ -2327,7 +2327,7 @@ sys32_sendfile (int out_fd, int in_fd, int __user *offset, unsigned int count) | |||
2327 | ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count); | 2327 | ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *) &of : NULL, count); |
2328 | set_fs(old_fs); | 2328 | set_fs(old_fs); |
2329 | 2329 | ||
2330 | if (!ret && offset && put_user(of, offset)) | 2330 | if (offset && put_user(of, offset)) |
2331 | return -EFAULT; | 2331 | return -EFAULT; |
2332 | 2332 | ||
2333 | return ret; | 2333 | return ret; |
diff --git a/arch/m68knommu/platform/68360/head-ram.S b/arch/m68knommu/platform/68360/head-ram.S new file mode 100644 index 000000000000..a5c639a51eef --- /dev/null +++ b/arch/m68knommu/platform/68360/head-ram.S | |||
@@ -0,0 +1,408 @@ | |||
1 | /* arch/m68knommu/platform/68360/head-ram.S | ||
2 | * | ||
3 | * Startup code for Motorola 68360 | ||
4 | * | ||
5 | * Copyright 2001 (C) SED Systems, a Division of Calian Ltd. | ||
6 | * Based on: arch/m68knommu/platform/68328/pilot/crt0_rom.S | ||
7 | * Based on: arch/m68knommu/platform/68360/uCquicc/crt0_rom.S, 2.0.38.1.pre7 | ||
8 | * uClinux Kernel | ||
9 | * Copyright (C) Michael Leslie <mleslie@lineo.com> | ||
10 | * Based on: arch/m68knommu/platform/68EZ328/ucsimm/crt0_rom.S | ||
11 | * Copyright (C) 1998 D. Jeff Dionne <jeff@uclinux.org>, | ||
12 | * | ||
13 | */ | ||
14 | #define ASSEMBLY | ||
15 | #include <linux/config.h> | ||
16 | |||
17 | .global _stext | ||
18 | .global _start | ||
19 | |||
20 | .global _rambase | ||
21 | .global __ramvec | ||
22 | .global _ramvec | ||
23 | .global _ramstart | ||
24 | .global _ramend | ||
25 | |||
26 | .global _quicc_base | ||
27 | .global _periph_base | ||
28 | |||
29 | #define REGB 0x1000 | ||
30 | #define PEPAR (_dprbase + REGB + 0x0016) | ||
31 | #define GMR (_dprbase + REGB + 0x0040) | ||
32 | #define OR0 (_dprbase + REGB + 0x0054) | ||
33 | #define BR0 (_dprbase + REGB + 0x0050) | ||
34 | #define OR1 (_dprbase + REGB + 0x0064) | ||
35 | #define BR1 (_dprbase + REGB + 0x0060) | ||
36 | #define OR4 (_dprbase + REGB + 0x0094) | ||
37 | #define BR4 (_dprbase + REGB + 0x0090) | ||
38 | #define OR6 (_dprbase + REGB + 0x00b4) | ||
39 | #define BR6 (_dprbase + REGB + 0x00b0) | ||
40 | #define OR7 (_dprbase + REGB + 0x00c4) | ||
41 | #define BR7 (_dprbase + REGB + 0x00c0) | ||
42 | |||
43 | #define MCR (_dprbase + REGB + 0x0000) | ||
44 | #define AVR (_dprbase + REGB + 0x0008) | ||
45 | |||
46 | #define SYPCR (_dprbase + REGB + 0x0022) | ||
47 | |||
48 | #define PLLCR (_dprbase + REGB + 0x0010) | ||
49 | #define CLKOCR (_dprbase + REGB + 0x000C) | ||
50 | #define CDVCR (_dprbase + REGB + 0x0014) | ||
51 | |||
52 | #define BKAR (_dprbase + REGB + 0x0030) | ||
53 | #define BKCR (_dprbase + REGB + 0x0034) | ||
54 | #define SWIV (_dprbase + REGB + 0x0023) | ||
55 | #define PICR (_dprbase + REGB + 0x0026) | ||
56 | #define PITR (_dprbase + REGB + 0x002A) | ||
57 | |||
58 | /* Define for all memory configuration */ | ||
59 | #define MCU_SIM_GMR 0x00000000 | ||
60 | #define SIM_OR_MASK 0x0fffffff | ||
61 | |||
62 | /* Defines for chip select zero - the flash */ | ||
63 | #define SIM_OR0_MASK 0x20000002 | ||
64 | #define SIM_BR0_MASK 0x00000001 | ||
65 | |||
66 | |||
67 | /* Defines for chip select one - the RAM */ | ||
68 | #define SIM_OR1_MASK 0x10000000 | ||
69 | #define SIM_BR1_MASK 0x00000001 | ||
70 | |||
71 | #define MCU_SIM_MBAR_ADRS 0x0003ff00 | ||
72 | #define MCU_SIM_MBAR_BA_MASK 0xfffff000 | ||
73 | #define MCU_SIM_MBAR_AS_MASK 0x00000001 | ||
74 | |||
75 | #define MCU_SIM_PEPAR 0x00B4 | ||
76 | |||
77 | #define MCU_DISABLE_INTRPTS 0x2700 | ||
78 | #define MCU_SIM_AVR 0x00 | ||
79 | |||
80 | #define MCU_SIM_MCR 0x00005cff | ||
81 | |||
82 | #define MCU_SIM_CLKOCR 0x00 | ||
83 | #define MCU_SIM_PLLCR 0x8000 | ||
84 | #define MCU_SIM_CDVCR 0x0000 | ||
85 | |||
86 | #define MCU_SIM_SYPCR 0x0000 | ||
87 | #define MCU_SIM_SWIV 0x00 | ||
88 | #define MCU_SIM_PICR 0x0000 | ||
89 | #define MCU_SIM_PITR 0x0000 | ||
90 | |||
91 | |||
92 | #include <asm/m68360_regs.h> | ||
93 | |||
94 | |||
95 | /* | ||
96 | * By the time this RAM specific code begins to execute, DPRAM | ||
97 | * and DRAM should already be mapped and accessible. | ||
98 | */ | ||
99 | |||
100 | .text | ||
101 | _start: | ||
102 | _stext: | ||
103 | nop | ||
104 | ori.w #MCU_DISABLE_INTRPTS, %sr /* disable interrupts: */ | ||
105 | /* We should not need to setup the boot stack the reset should do it. */ | ||
106 | movea.l #__ramend, %sp /*set up stack at the end of DRAM:*/ | ||
107 | |||
108 | set_mbar_register: | ||
109 | moveq.l #0x07, %d1 /* Setup MBAR */ | ||
110 | movec %d1, %dfc | ||
111 | |||
112 | lea.l MCU_SIM_MBAR_ADRS, %a0 | ||
113 | move.l #_dprbase, %d0 | ||
114 | andi.l #MCU_SIM_MBAR_BA_MASK, %d0 | ||
115 | ori.l #MCU_SIM_MBAR_AS_MASK, %d0 | ||
116 | moves.l %d0, %a0@ | ||
117 | |||
118 | moveq.l #0x05, %d1 | ||
119 | movec.l %d1, %dfc | ||
120 | |||
121 | /* Now we can begin to access registers in DPRAM */ | ||
122 | |||
123 | set_sim_mcr: | ||
124 | /* Set Module Configuration Register */ | ||
125 | move.l #MCU_SIM_MCR, MCR | ||
126 | |||
127 | /* to do: Determine cause of reset */ | ||
128 | |||
129 | /* | ||
130 | * configure system clock MC68360 p. 6-40 | ||
131 | * (value +1)*osc/128 = system clock | ||
132 | */ | ||
133 | set_sim_clock: | ||
134 | move.w #MCU_SIM_PLLCR, PLLCR | ||
135 | move.b #MCU_SIM_CLKOCR, CLKOCR | ||
136 | move.w #MCU_SIM_CDVCR, CDVCR | ||
137 | |||
138 | /* Wait for the PLL to settle */ | ||
139 | move.w #16384, %d0 | ||
140 | pll_settle_wait: | ||
141 | subi.w #1, %d0 | ||
142 | bne pll_settle_wait | ||
143 | |||
144 | /* Setup the system protection register, and watchdog timer register */ | ||
145 | move.b #MCU_SIM_SWIV, SWIV | ||
146 | move.w #MCU_SIM_PICR, PICR | ||
147 | move.w #MCU_SIM_PITR, PITR | ||
148 | move.w #MCU_SIM_SYPCR, SYPCR | ||
149 | |||
150 | /* Clear DPRAM - system + parameter */ | ||
151 | movea.l #_dprbase, %a0 | ||
152 | movea.l #_dprbase+0x2000, %a1 | ||
153 | |||
154 | /* Copy 0 to %a0 until %a0 == %a1 */ | ||
155 | clear_dpram: | ||
156 | movel #0, %a0@+ | ||
157 | cmpal %a0, %a1 | ||
158 | bhi clear_dpram | ||
159 | |||
160 | configure_memory_controller: | ||
161 | /* Set up Global Memory Register (GMR) */ | ||
162 | move.l #MCU_SIM_GMR, %d0 | ||
163 | move.l %d0, GMR | ||
164 | |||
165 | configure_chip_select_0: | ||
166 | move.l #__ramend, %d0 | ||
167 | subi.l #__ramstart, %d0 | ||
168 | subq.l #0x01, %d0 | ||
169 | eori.l #SIM_OR_MASK, %d0 | ||
170 | ori.l #SIM_OR0_MASK, %d0 | ||
171 | move.l %d0, OR0 | ||
172 | |||
173 | move.l #__ramstart, %d0 | ||
174 | ori.l #SIM_BR0_MASK, %d0 | ||
175 | move.l %d0, BR0 | ||
176 | |||
177 | configure_chip_select_1: | ||
178 | move.l #__rom_end, %d0 | ||
179 | subi.l #__rom_start, %d0 | ||
180 | subq.l #0x01, %d0 | ||
181 | eori.l #SIM_OR_MASK, %d0 | ||
182 | ori.l #SIM_OR1_MASK, %d0 | ||
183 | move.l %d0, OR1 | ||
184 | |||
185 | move.l #__rom_start, %d0 | ||
186 | ori.l #SIM_BR1_MASK, %d0 | ||
187 | move.l %d0, BR1 | ||
188 | |||
189 | move.w #MCU_SIM_PEPAR, PEPAR | ||
190 | |||
191 | /* point to vector table: */ | ||
192 | move.l #_romvec, %a0 | ||
193 | move.l #_ramvec, %a1 | ||
194 | copy_vectors: | ||
195 | move.l %a0@, %d0 | ||
196 | move.l %d0, %a1@ | ||
197 | move.l %a0@, %a1@ | ||
198 | addq.l #0x04, %a0 | ||
199 | addq.l #0x04, %a1 | ||
200 | cmp.l #_start, %a0 | ||
201 | blt copy_vectors | ||
202 | |||
203 | move.l #_ramvec, %a1 | ||
204 | movec %a1, %vbr | ||
205 | |||
206 | |||
207 | /* Copy data segment from ROM to RAM */ | ||
208 | moveal #_stext, %a0 | ||
209 | moveal #_sdata, %a1 | ||
210 | moveal #_edata, %a2 | ||
211 | |||
212 | /* Copy %a0 to %a1 until %a1 == %a2 */ | ||
213 | LD1: | ||
214 | move.l %a0@, %d0 | ||
215 | addq.l #0x04, %a0 | ||
216 | move.l %d0, %a1@ | ||
217 | addq.l #0x04, %a1 | ||
218 | cmp.l #_edata, %a1 | ||
219 | blt LD1 | ||
220 | |||
221 | moveal #_sbss, %a0 | ||
222 | moveal #_ebss, %a1 | ||
223 | |||
224 | /* Copy 0 to %a0 until %a0 == %a1 */ | ||
225 | L1: | ||
226 | movel #0, %a0@+ | ||
227 | cmpal %a0, %a1 | ||
228 | bhi L1 | ||
229 | |||
230 | load_quicc: | ||
231 | move.l #_dprbase, _quicc_base | ||
232 | |||
233 | store_ram_size: | ||
234 | /* Set ram size information */ | ||
235 | move.l #_sdata, _rambase | ||
236 | move.l #_ebss, _ramstart | ||
237 | move.l #__ramend, %d0 | ||
238 | sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/ | ||
239 | move.l %d0, _ramend /* Different from __ramend.*/ | ||
240 | |||
241 | store_flash_size: | ||
242 | /* Set rom size information */ | ||
243 | move.l #__rom_end, %d0 | ||
244 | sub.l #__rom_start, %d0 | ||
245 | move.l %d0, rom_length | ||
246 | |||
247 | pea 0 | ||
248 | pea env | ||
249 | pea %sp@(4) | ||
250 | pea 0 | ||
251 | |||
252 | lea init_thread_union, %a2 | ||
253 | lea 0x2000(%a2), %sp | ||
254 | |||
255 | lp: | ||
256 | jsr start_kernel | ||
257 | |||
258 | _exit: | ||
259 | jmp _exit | ||
260 | |||
261 | |||
262 | .data | ||
263 | .align 4 | ||
264 | env: | ||
265 | .long 0 | ||
266 | _quicc_base: | ||
267 | .long 0 | ||
268 | _periph_base: | ||
269 | .long 0 | ||
270 | _ramvec: | ||
271 | .long 0 | ||
272 | _rambase: | ||
273 | .long 0 | ||
274 | _ramstart: | ||
275 | .long 0 | ||
276 | _ramend: | ||
277 | .long 0 | ||
278 | _dprbase: | ||
279 | .long 0xffffe000 | ||
280 | |||
281 | .text | ||
282 | |||
283 | /* | ||
284 | * These are the exception vectors at boot up, they are copied into RAM | ||
285 | * and then overwritten as needed. | ||
286 | */ | ||
287 | |||
288 | .section ".data.initvect","awx" | ||
289 | .long __ramend /* Reset: Initial Stack Pointer - 0. */ | ||
290 | .long _start /* Reset: Initial Program Counter - 1. */ | ||
291 | .long buserr /* Bus Error - 2. */ | ||
292 | .long trap /* Address Error - 3. */ | ||
293 | .long trap /* Illegal Instruction - 4. */ | ||
294 | .long trap /* Divide by zero - 5. */ | ||
295 | .long trap /* CHK, CHK2 Instructions - 6. */ | ||
296 | .long trap /* TRAPcc, TRAPV Instructions - 7. */ | ||
297 | .long trap /* Privilege Violation - 8. */ | ||
298 | .long trap /* Trace - 9. */ | ||
299 | .long trap /* Line 1010 Emulator - 10. */ | ||
300 | .long trap /* Line 1111 Emualtor - 11. */ | ||
301 | .long trap /* Harware Breakpoint - 12. */ | ||
302 | .long trap /* (Reserved for Coprocessor Protocol Violation)- 13. */ | ||
303 | .long trap /* Format Error - 14. */ | ||
304 | .long trap /* Uninitialized Interrupt - 15. */ | ||
305 | .long trap /* (Unassigned, Reserver) - 16. */ | ||
306 | .long trap /* (Unassigned, Reserver) - 17. */ | ||
307 | .long trap /* (Unassigned, Reserver) - 18. */ | ||
308 | .long trap /* (Unassigned, Reserver) - 19. */ | ||
309 | .long trap /* (Unassigned, Reserver) - 20. */ | ||
310 | .long trap /* (Unassigned, Reserver) - 21. */ | ||
311 | .long trap /* (Unassigned, Reserver) - 22. */ | ||
312 | .long trap /* (Unassigned, Reserver) - 23. */ | ||
313 | .long trap /* Spurious Interrupt - 24. */ | ||
314 | .long trap /* Level 1 Interrupt Autovector - 25. */ | ||
315 | .long trap /* Level 2 Interrupt Autovector - 26. */ | ||
316 | .long trap /* Level 3 Interrupt Autovector - 27. */ | ||
317 | .long trap /* Level 4 Interrupt Autovector - 28. */ | ||
318 | .long trap /* Level 5 Interrupt Autovector - 29. */ | ||
319 | .long trap /* Level 6 Interrupt Autovector - 30. */ | ||
320 | .long trap /* Level 7 Interrupt Autovector - 31. */ | ||
321 | .long system_call /* Trap Instruction Vectors 0 - 32. */ | ||
322 | .long trap /* Trap Instruction Vectors 1 - 33. */ | ||
323 | .long trap /* Trap Instruction Vectors 2 - 34. */ | ||
324 | .long trap /* Trap Instruction Vectors 3 - 35. */ | ||
325 | .long trap /* Trap Instruction Vectors 4 - 36. */ | ||
326 | .long trap /* Trap Instruction Vectors 5 - 37. */ | ||
327 | .long trap /* Trap Instruction Vectors 6 - 38. */ | ||
328 | .long trap /* Trap Instruction Vectors 7 - 39. */ | ||
329 | .long trap /* Trap Instruction Vectors 8 - 40. */ | ||
330 | .long trap /* Trap Instruction Vectors 9 - 41. */ | ||
331 | .long trap /* Trap Instruction Vectors 10 - 42. */ | ||
332 | .long trap /* Trap Instruction Vectors 11 - 43. */ | ||
333 | .long trap /* Trap Instruction Vectors 12 - 44. */ | ||
334 | .long trap /* Trap Instruction Vectors 13 - 45. */ | ||
335 | .long trap /* Trap Instruction Vectors 14 - 46. */ | ||
336 | .long trap /* Trap Instruction Vectors 15 - 47. */ | ||
337 | .long 0 /* (Reserved for Coprocessor) - 48. */ | ||
338 | .long 0 /* (Reserved for Coprocessor) - 49. */ | ||
339 | .long 0 /* (Reserved for Coprocessor) - 50. */ | ||
340 | .long 0 /* (Reserved for Coprocessor) - 51. */ | ||
341 | .long 0 /* (Reserved for Coprocessor) - 52. */ | ||
342 | .long 0 /* (Reserved for Coprocessor) - 53. */ | ||
343 | .long 0 /* (Reserved for Coprocessor) - 54. */ | ||
344 | .long 0 /* (Reserved for Coprocessor) - 55. */ | ||
345 | .long 0 /* (Reserved for Coprocessor) - 56. */ | ||
346 | .long 0 /* (Reserved for Coprocessor) - 57. */ | ||
347 | .long 0 /* (Reserved for Coprocessor) - 58. */ | ||
348 | .long 0 /* (Unassigned, Reserved) - 59. */ | ||
349 | .long 0 /* (Unassigned, Reserved) - 60. */ | ||
350 | .long 0 /* (Unassigned, Reserved) - 61. */ | ||
351 | .long 0 /* (Unassigned, Reserved) - 62. */ | ||
352 | .long 0 /* (Unassigned, Reserved) - 63. */ | ||
353 | /* The assignment of these vectors to the CPM is */ | ||
354 | /* dependent on the configuration of the CPM vba */ | ||
355 | /* fields. */ | ||
356 | .long 0 /* (User-Defined Vectors 1) CPM Error - 64. */ | ||
357 | .long 0 /* (User-Defined Vectors 2) CPM Parallel IO PC11- 65. */ | ||
358 | .long 0 /* (User-Defined Vectors 3) CPM Parallel IO PC10- 66. */ | ||
359 | .long 0 /* (User-Defined Vectors 4) CPM SMC2 / PIP - 67. */ | ||
360 | .long 0 /* (User-Defined Vectors 5) CPM SMC1 - 68. */ | ||
361 | .long 0 /* (User-Defined Vectors 6) CPM SPI - 69. */ | ||
362 | .long 0 /* (User-Defined Vectors 7) CPM Parallel IO PC9 - 70. */ | ||
363 | .long 0 /* (User-Defined Vectors 8) CPM Timer 4 - 71. */ | ||
364 | .long 0 /* (User-Defined Vectors 9) CPM Reserved - 72. */ | ||
365 | .long 0 /* (User-Defined Vectors 10) CPM Parallel IO PC8- 73. */ | ||
366 | .long 0 /* (User-Defined Vectors 11) CPM Parallel IO PC7- 74. */ | ||
367 | .long 0 /* (User-Defined Vectors 12) CPM Parallel IO PC6- 75. */ | ||
368 | .long 0 /* (User-Defined Vectors 13) CPM Timer 3 - 76. */ | ||
369 | .long 0 /* (User-Defined Vectors 14) CPM Reserved - 77. */ | ||
370 | .long 0 /* (User-Defined Vectors 15) CPM Parallel IO PC5- 78. */ | ||
371 | .long 0 /* (User-Defined Vectors 16) CPM Parallel IO PC4- 79. */ | ||
372 | .long 0 /* (User-Defined Vectors 17) CPM Reserved - 80. */ | ||
373 | .long 0 /* (User-Defined Vectors 18) CPM RISC Timer Tbl - 81. */ | ||
374 | .long 0 /* (User-Defined Vectors 19) CPM Timer 2 - 82. */ | ||
375 | .long 0 /* (User-Defined Vectors 21) CPM Reserved - 83. */ | ||
376 | .long 0 /* (User-Defined Vectors 22) CPM IDMA2 - 84. */ | ||
377 | .long 0 /* (User-Defined Vectors 23) CPM IDMA1 - 85. */ | ||
378 | .long 0 /* (User-Defined Vectors 24) CPM SDMA Bus Err - 86. */ | ||
379 | .long 0 /* (User-Defined Vectors 25) CPM Parallel IO PC3- 87. */ | ||
380 | .long 0 /* (User-Defined Vectors 26) CPM Parallel IO PC2- 88. */ | ||
381 | .long 0 /* (User-Defined Vectors 27) CPM Timer 1 - 89. */ | ||
382 | .long 0 /* (User-Defined Vectors 28) CPM Parallel IO PC1- 90. */ | ||
383 | .long 0 /* (User-Defined Vectors 29) CPM SCC 4 - 91. */ | ||
384 | .long 0 /* (User-Defined Vectors 30) CPM SCC 3 - 92. */ | ||
385 | .long 0 /* (User-Defined Vectors 31) CPM SCC 2 - 93. */ | ||
386 | .long 0 /* (User-Defined Vectors 32) CPM SCC 1 - 94. */ | ||
387 | .long 0 /* (User-Defined Vectors 33) CPM Parallel IO PC0- 95. */ | ||
388 | /* I don't think anything uses the vectors after here. */ | ||
389 | .long 0 /* (User-Defined Vectors 34) - 96. */ | ||
390 | .long 0,0,0,0,0 /* (User-Defined Vectors 35 - 39). */ | ||
391 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 40 - 49). */ | ||
392 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 50 - 59). */ | ||
393 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 60 - 69). */ | ||
394 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 70 - 79). */ | ||
395 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 80 - 89). */ | ||
396 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 90 - 99). */ | ||
397 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 100 - 109). */ | ||
398 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 110 - 119). */ | ||
399 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 120 - 129). */ | ||
400 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 130 - 139). */ | ||
401 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 140 - 149). */ | ||
402 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 150 - 159). */ | ||
403 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 160 - 169). */ | ||
404 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 170 - 179). */ | ||
405 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 180 - 189). */ | ||
406 | .long 0,0,0 /* (User-Defined Vectors 190 - 192). */ | ||
407 | .text | ||
408 | ignore: rte | ||
diff --git a/arch/m68knommu/platform/68360/head-rom.S b/arch/m68knommu/platform/68360/head-rom.S new file mode 100644 index 000000000000..0da357a4cfee --- /dev/null +++ b/arch/m68knommu/platform/68360/head-rom.S | |||
@@ -0,0 +1,420 @@ | |||
1 | /* arch/m68knommu/platform/68360/head-rom.S | ||
2 | * | ||
3 | * Startup code for Motorola 68360 | ||
4 | * | ||
5 | * Copyright (C) SED Systems, a Division of Calian Ltd. | ||
6 | * Based on: arch/m68knommu/platform/68328/pilot/crt0_rom.S | ||
7 | * Based on: arch/m68knommu/platform/68360/uCquicc/crt0_rom.S, 2.0.38.1.pre7 | ||
8 | * uClinux Kernel | ||
9 | * Copyright (C) Michael Leslie <mleslie@lineo.com> | ||
10 | * Based on: arch/m68knommu/platform/68EZ328/ucsimm/crt0_rom.S | ||
11 | * Copyright (C) 1998 D. Jeff Dionne <jeff@uclinux.org>, | ||
12 | * | ||
13 | */ | ||
14 | #include <linux/config.h> | ||
15 | |||
16 | .global _stext | ||
17 | .global _sbss | ||
18 | .global _start | ||
19 | |||
20 | .global _rambase | ||
21 | .global __ramvec | ||
22 | .global _ramvec | ||
23 | .global _ramstart | ||
24 | .global _ramend | ||
25 | |||
26 | .global _quicc_base | ||
27 | .global _periph_base | ||
28 | |||
29 | #define REGB 0x1000 | ||
30 | #define PEPAR (_dprbase + REGB + 0x0016) | ||
31 | #define GMR (_dprbase + REGB + 0x0040) | ||
32 | #define OR0 (_dprbase + REGB + 0x0054) | ||
33 | #define BR0 (_dprbase + REGB + 0x0050) | ||
34 | |||
35 | #define OR1 (_dprbase + REGB + 0x0064) | ||
36 | #define BR1 (_dprbase + REGB + 0x0060) | ||
37 | |||
38 | #define OR2 (_dprbase + REGB + 0x0074) | ||
39 | #define BR2 (_dprbase + REGB + 0x0070) | ||
40 | |||
41 | #define OR3 (_dprbase + REGB + 0x0084) | ||
42 | #define BR3 (_dprbase + REGB + 0x0080) | ||
43 | |||
44 | #define OR4 (_dprbase + REGB + 0x0094) | ||
45 | #define BR4 (_dprbase + REGB + 0x0090) | ||
46 | |||
47 | #define OR5 (_dprbase + REGB + 0x00A4) | ||
48 | #define BR5 (_dprbase + REGB + 0x00A0) | ||
49 | |||
50 | #define OR6 (_dprbase + REGB + 0x00b4) | ||
51 | #define BR6 (_dprbase + REGB + 0x00b0) | ||
52 | |||
53 | #define OR7 (_dprbase + REGB + 0x00c4) | ||
54 | #define BR7 (_dprbase + REGB + 0x00c0) | ||
55 | |||
56 | #define MCR (_dprbase + REGB + 0x0000) | ||
57 | #define AVR (_dprbase + REGB + 0x0008) | ||
58 | |||
59 | #define SYPCR (_dprbase + REGB + 0x0022) | ||
60 | |||
61 | #define PLLCR (_dprbase + REGB + 0x0010) | ||
62 | #define CLKOCR (_dprbase + REGB + 0x000C) | ||
63 | #define CDVCR (_dprbase + REGB + 0x0014) | ||
64 | |||
65 | #define BKAR (_dprbase + REGB + 0x0030) | ||
66 | #define BKCR (_dprbase + REGB + 0x0034) | ||
67 | #define SWIV (_dprbase + REGB + 0x0023) | ||
68 | #define PICR (_dprbase + REGB + 0x0026) | ||
69 | #define PITR (_dprbase + REGB + 0x002A) | ||
70 | |||
71 | /* Define for all memory configuration */ | ||
72 | #define MCU_SIM_GMR 0x00000000 | ||
73 | #define SIM_OR_MASK 0x0fffffff | ||
74 | |||
75 | /* Defines for chip select zero - the flash */ | ||
76 | #define SIM_OR0_MASK 0x20000000 | ||
77 | #define SIM_BR0_MASK 0x00000001 | ||
78 | |||
79 | /* Defines for chip select one - the RAM */ | ||
80 | #define SIM_OR1_MASK 0x10000000 | ||
81 | #define SIM_BR1_MASK 0x00000001 | ||
82 | |||
83 | #define MCU_SIM_MBAR_ADRS 0x0003ff00 | ||
84 | #define MCU_SIM_MBAR_BA_MASK 0xfffff000 | ||
85 | #define MCU_SIM_MBAR_AS_MASK 0x00000001 | ||
86 | |||
87 | #define MCU_SIM_PEPAR 0x00B4 | ||
88 | |||
89 | #define MCU_DISABLE_INTRPTS 0x2700 | ||
90 | #define MCU_SIM_AVR 0x00 | ||
91 | |||
92 | #define MCU_SIM_MCR 0x00005cff | ||
93 | |||
94 | #define MCU_SIM_CLKOCR 0x00 | ||
95 | #define MCU_SIM_PLLCR 0x8000 | ||
96 | #define MCU_SIM_CDVCR 0x0000 | ||
97 | |||
98 | #define MCU_SIM_SYPCR 0x0000 | ||
99 | #define MCU_SIM_SWIV 0x00 | ||
100 | #define MCU_SIM_PICR 0x0000 | ||
101 | #define MCU_SIM_PITR 0x0000 | ||
102 | |||
103 | |||
104 | #include <asm/m68360_regs.h> | ||
105 | |||
106 | |||
107 | /* | ||
108 | * By the time this RAM specific code begins to execute, DPRAM | ||
109 | * and DRAM should already be mapped and accessible. | ||
110 | */ | ||
111 | |||
112 | .text | ||
113 | _start: | ||
114 | _stext: | ||
115 | nop | ||
116 | ori.w #MCU_DISABLE_INTRPTS, %sr /* disable interrupts: */ | ||
117 | /* We should not need to setup the boot stack the reset should do it. */ | ||
118 | movea.l #__ramend, %sp /* set up stack at the end of DRAM:*/ | ||
119 | |||
120 | |||
121 | set_mbar_register: | ||
122 | moveq.l #0x07, %d1 /* Setup MBAR */ | ||
123 | movec %d1, %dfc | ||
124 | |||
125 | lea.l MCU_SIM_MBAR_ADRS, %a0 | ||
126 | move.l #_dprbase, %d0 | ||
127 | andi.l #MCU_SIM_MBAR_BA_MASK, %d0 | ||
128 | ori.l #MCU_SIM_MBAR_AS_MASK, %d0 | ||
129 | moves.l %d0, %a0@ | ||
130 | |||
131 | moveq.l #0x05, %d1 | ||
132 | movec.l %d1, %dfc | ||
133 | |||
134 | /* Now we can begin to access registers in DPRAM */ | ||
135 | |||
136 | set_sim_mcr: | ||
137 | /* Set Module Configuration Register */ | ||
138 | move.l #MCU_SIM_MCR, MCR | ||
139 | |||
140 | /* to do: Determine cause of reset */ | ||
141 | |||
142 | /* | ||
143 | * configure system clock MC68360 p. 6-40 | ||
144 | * (value +1)*osc/128 = system clock | ||
145 | * or | ||
146 | * (value + 1)*osc = system clock | ||
147 | * You do not need to divide the oscillator by 128 unless you want to. | ||
148 | */ | ||
149 | set_sim_clock: | ||
150 | move.w #MCU_SIM_PLLCR, PLLCR | ||
151 | move.b #MCU_SIM_CLKOCR, CLKOCR | ||
152 | move.w #MCU_SIM_CDVCR, CDVCR | ||
153 | |||
154 | /* Wait for the PLL to settle */ | ||
155 | move.w #16384, %d0 | ||
156 | pll_settle_wait: | ||
157 | subi.w #1, %d0 | ||
158 | bne pll_settle_wait | ||
159 | |||
160 | /* Setup the system protection register, and watchdog timer register */ | ||
161 | move.b #MCU_SIM_SWIV, SWIV | ||
162 | move.w #MCU_SIM_PICR, PICR | ||
163 | move.w #MCU_SIM_PITR, PITR | ||
164 | move.w #MCU_SIM_SYPCR, SYPCR | ||
165 | |||
166 | /* Clear DPRAM - system + parameter */ | ||
167 | movea.l #_dprbase, %a0 | ||
168 | movea.l #_dprbase+0x2000, %a1 | ||
169 | |||
170 | /* Copy 0 to %a0 until %a0 == %a1 */ | ||
171 | clear_dpram: | ||
172 | movel #0, %a0@+ | ||
173 | cmpal %a0, %a1 | ||
174 | bhi clear_dpram | ||
175 | |||
176 | configure_memory_controller: | ||
177 | /* Set up Global Memory Register (GMR) */ | ||
178 | move.l #MCU_SIM_GMR, %d0 | ||
179 | move.l %d0, GMR | ||
180 | |||
181 | configure_chip_select_0: | ||
182 | move.l #0x00400000, %d0 | ||
183 | subq.l #0x01, %d0 | ||
184 | eori.l #SIM_OR_MASK, %d0 | ||
185 | ori.l #SIM_OR0_MASK, %d0 | ||
186 | move.l %d0, OR0 | ||
187 | |||
188 | move.l #__rom_start, %d0 | ||
189 | ori.l #SIM_BR0_MASK, %d0 | ||
190 | move.l %d0, BR0 | ||
191 | |||
192 | move.l #0x0, BR1 | ||
193 | move.l #0x0, BR2 | ||
194 | move.l #0x0, BR3 | ||
195 | move.l #0x0, BR4 | ||
196 | move.l #0x0, BR5 | ||
197 | move.l #0x0, BR6 | ||
198 | move.l #0x0, BR7 | ||
199 | |||
200 | move.w #MCU_SIM_PEPAR, PEPAR | ||
201 | |||
202 | /* point to vector table: */ | ||
203 | move.l #_romvec, %a0 | ||
204 | move.l #_ramvec, %a1 | ||
205 | copy_vectors: | ||
206 | move.l %a0@, %d0 | ||
207 | move.l %d0, %a1@ | ||
208 | move.l %a0@, %a1@ | ||
209 | addq.l #0x04, %a0 | ||
210 | addq.l #0x04, %a1 | ||
211 | cmp.l #_start, %a0 | ||
212 | blt copy_vectors | ||
213 | |||
214 | move.l #_ramvec, %a1 | ||
215 | movec %a1, %vbr | ||
216 | |||
217 | |||
218 | /* Copy data segment from ROM to RAM */ | ||
219 | moveal #_etext, %a0 | ||
220 | moveal #_sdata, %a1 | ||
221 | moveal #_edata, %a2 | ||
222 | |||
223 | /* Copy %a0 to %a1 until %a1 == %a2 */ | ||
224 | LD1: | ||
225 | move.l %a0@, %d0 | ||
226 | addq.l #0x04, %a0 | ||
227 | move.l %d0, %a1@ | ||
228 | addq.l #0x04, %a1 | ||
229 | cmp.l #_edata, %a1 | ||
230 | blt LD1 | ||
231 | |||
232 | moveal #_sbss, %a0 | ||
233 | moveal #_ebss, %a1 | ||
234 | |||
235 | /* Copy 0 to %a0 until %a0 == %a1 */ | ||
236 | L1: | ||
237 | movel #0, %a0@+ | ||
238 | cmpal %a0, %a1 | ||
239 | bhi L1 | ||
240 | |||
241 | load_quicc: | ||
242 | move.l #_dprbase, _quicc_base | ||
243 | |||
244 | store_ram_size: | ||
245 | /* Set ram size information */ | ||
246 | move.l #_sdata, _rambase | ||
247 | move.l #_ebss, _ramstart | ||
248 | move.l #__ramend, %d0 | ||
249 | sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/ | ||
250 | move.l %d0, _ramend /* Different from __ramend.*/ | ||
251 | |||
252 | store_flash_size: | ||
253 | /* Set rom size information */ | ||
254 | move.l #__rom_end, %d0 | ||
255 | sub.l #__rom_start, %d0 | ||
256 | move.l %d0, rom_length | ||
257 | |||
258 | pea 0 | ||
259 | pea env | ||
260 | pea %sp@(4) | ||
261 | pea 0 | ||
262 | |||
263 | lea init_thread_union, %a2 | ||
264 | lea 0x2000(%a2), %sp | ||
265 | |||
266 | lp: | ||
267 | jsr start_kernel | ||
268 | |||
269 | _exit: | ||
270 | jmp _exit | ||
271 | |||
272 | |||
273 | .data | ||
274 | .align 4 | ||
275 | env: | ||
276 | .long 0 | ||
277 | _quicc_base: | ||
278 | .long 0 | ||
279 | _periph_base: | ||
280 | .long 0 | ||
281 | _ramvec: | ||
282 | .long 0 | ||
283 | _rambase: | ||
284 | .long 0 | ||
285 | _ramstart: | ||
286 | .long 0 | ||
287 | _ramend: | ||
288 | .long 0 | ||
289 | _dprbase: | ||
290 | .long 0xffffe000 | ||
291 | |||
292 | |||
293 | .text | ||
294 | |||
295 | /* | ||
296 | * These are the exception vectors at boot up, they are copied into RAM | ||
297 | * and then overwritten as needed. | ||
298 | */ | ||
299 | |||
300 | .section ".data.initvect","awx" | ||
301 | .long __ramend /* Reset: Initial Stack Pointer - 0. */ | ||
302 | .long _start /* Reset: Initial Program Counter - 1. */ | ||
303 | .long buserr /* Bus Error - 2. */ | ||
304 | .long trap /* Address Error - 3. */ | ||
305 | .long trap /* Illegal Instruction - 4. */ | ||
306 | .long trap /* Divide by zero - 5. */ | ||
307 | .long trap /* CHK, CHK2 Instructions - 6. */ | ||
308 | .long trap /* TRAPcc, TRAPV Instructions - 7. */ | ||
309 | .long trap /* Privilege Violation - 8. */ | ||
310 | .long trap /* Trace - 9. */ | ||
311 | .long trap /* Line 1010 Emulator - 10. */ | ||
312 | .long trap /* Line 1111 Emualtor - 11. */ | ||
313 | .long trap /* Harware Breakpoint - 12. */ | ||
314 | .long trap /* (Reserved for Coprocessor Protocol Violation)- 13. */ | ||
315 | .long trap /* Format Error - 14. */ | ||
316 | .long trap /* Uninitialized Interrupt - 15. */ | ||
317 | .long trap /* (Unassigned, Reserver) - 16. */ | ||
318 | .long trap /* (Unassigned, Reserver) - 17. */ | ||
319 | .long trap /* (Unassigned, Reserver) - 18. */ | ||
320 | .long trap /* (Unassigned, Reserver) - 19. */ | ||
321 | .long trap /* (Unassigned, Reserver) - 20. */ | ||
322 | .long trap /* (Unassigned, Reserver) - 21. */ | ||
323 | .long trap /* (Unassigned, Reserver) - 22. */ | ||
324 | .long trap /* (Unassigned, Reserver) - 23. */ | ||
325 | .long trap /* Spurious Interrupt - 24. */ | ||
326 | .long trap /* Level 1 Interrupt Autovector - 25. */ | ||
327 | .long trap /* Level 2 Interrupt Autovector - 26. */ | ||
328 | .long trap /* Level 3 Interrupt Autovector - 27. */ | ||
329 | .long trap /* Level 4 Interrupt Autovector - 28. */ | ||
330 | .long trap /* Level 5 Interrupt Autovector - 29. */ | ||
331 | .long trap /* Level 6 Interrupt Autovector - 30. */ | ||
332 | .long trap /* Level 7 Interrupt Autovector - 31. */ | ||
333 | .long system_call /* Trap Instruction Vectors 0 - 32. */ | ||
334 | .long trap /* Trap Instruction Vectors 1 - 33. */ | ||
335 | .long trap /* Trap Instruction Vectors 2 - 34. */ | ||
336 | .long trap /* Trap Instruction Vectors 3 - 35. */ | ||
337 | .long trap /* Trap Instruction Vectors 4 - 36. */ | ||
338 | .long trap /* Trap Instruction Vectors 5 - 37. */ | ||
339 | .long trap /* Trap Instruction Vectors 6 - 38. */ | ||
340 | .long trap /* Trap Instruction Vectors 7 - 39. */ | ||
341 | .long trap /* Trap Instruction Vectors 8 - 40. */ | ||
342 | .long trap /* Trap Instruction Vectors 9 - 41. */ | ||
343 | .long trap /* Trap Instruction Vectors 10 - 42. */ | ||
344 | .long trap /* Trap Instruction Vectors 11 - 43. */ | ||
345 | .long trap /* Trap Instruction Vectors 12 - 44. */ | ||
346 | .long trap /* Trap Instruction Vectors 13 - 45. */ | ||
347 | .long trap /* Trap Instruction Vectors 14 - 46. */ | ||
348 | .long trap /* Trap Instruction Vectors 15 - 47. */ | ||
349 | .long 0 /* (Reserved for Coprocessor) - 48. */ | ||
350 | .long 0 /* (Reserved for Coprocessor) - 49. */ | ||
351 | .long 0 /* (Reserved for Coprocessor) - 50. */ | ||
352 | .long 0 /* (Reserved for Coprocessor) - 51. */ | ||
353 | .long 0 /* (Reserved for Coprocessor) - 52. */ | ||
354 | .long 0 /* (Reserved for Coprocessor) - 53. */ | ||
355 | .long 0 /* (Reserved for Coprocessor) - 54. */ | ||
356 | .long 0 /* (Reserved for Coprocessor) - 55. */ | ||
357 | .long 0 /* (Reserved for Coprocessor) - 56. */ | ||
358 | .long 0 /* (Reserved for Coprocessor) - 57. */ | ||
359 | .long 0 /* (Reserved for Coprocessor) - 58. */ | ||
360 | .long 0 /* (Unassigned, Reserved) - 59. */ | ||
361 | .long 0 /* (Unassigned, Reserved) - 60. */ | ||
362 | .long 0 /* (Unassigned, Reserved) - 61. */ | ||
363 | .long 0 /* (Unassigned, Reserved) - 62. */ | ||
364 | .long 0 /* (Unassigned, Reserved) - 63. */ | ||
365 | /* The assignment of these vectors to the CPM is */ | ||
366 | /* dependent on the configuration of the CPM vba */ | ||
367 | /* fields. */ | ||
368 | .long 0 /* (User-Defined Vectors 1) CPM Error - 64. */ | ||
369 | .long 0 /* (User-Defined Vectors 2) CPM Parallel IO PC11- 65. */ | ||
370 | .long 0 /* (User-Defined Vectors 3) CPM Parallel IO PC10- 66. */ | ||
371 | .long 0 /* (User-Defined Vectors 4) CPM SMC2 / PIP - 67. */ | ||
372 | .long 0 /* (User-Defined Vectors 5) CPM SMC1 - 68. */ | ||
373 | .long 0 /* (User-Defined Vectors 6) CPM SPI - 69. */ | ||
374 | .long 0 /* (User-Defined Vectors 7) CPM Parallel IO PC9 - 70. */ | ||
375 | .long 0 /* (User-Defined Vectors 8) CPM Timer 4 - 71. */ | ||
376 | .long 0 /* (User-Defined Vectors 9) CPM Reserved - 72. */ | ||
377 | .long 0 /* (User-Defined Vectors 10) CPM Parallel IO PC8- 73. */ | ||
378 | .long 0 /* (User-Defined Vectors 11) CPM Parallel IO PC7- 74. */ | ||
379 | .long 0 /* (User-Defined Vectors 12) CPM Parallel IO PC6- 75. */ | ||
380 | .long 0 /* (User-Defined Vectors 13) CPM Timer 3 - 76. */ | ||
381 | .long 0 /* (User-Defined Vectors 14) CPM Reserved - 77. */ | ||
382 | .long 0 /* (User-Defined Vectors 15) CPM Parallel IO PC5- 78. */ | ||
383 | .long 0 /* (User-Defined Vectors 16) CPM Parallel IO PC4- 79. */ | ||
384 | .long 0 /* (User-Defined Vectors 17) CPM Reserved - 80. */ | ||
385 | .long 0 /* (User-Defined Vectors 18) CPM RISC Timer Tbl - 81. */ | ||
386 | .long 0 /* (User-Defined Vectors 19) CPM Timer 2 - 82. */ | ||
387 | .long 0 /* (User-Defined Vectors 21) CPM Reserved - 83. */ | ||
388 | .long 0 /* (User-Defined Vectors 22) CPM IDMA2 - 84. */ | ||
389 | .long 0 /* (User-Defined Vectors 23) CPM IDMA1 - 85. */ | ||
390 | .long 0 /* (User-Defined Vectors 24) CPM SDMA Bus Err - 86. */ | ||
391 | .long 0 /* (User-Defined Vectors 25) CPM Parallel IO PC3- 87. */ | ||
392 | .long 0 /* (User-Defined Vectors 26) CPM Parallel IO PC2- 88. */ | ||
393 | .long 0 /* (User-Defined Vectors 27) CPM Timer 1 - 89. */ | ||
394 | .long 0 /* (User-Defined Vectors 28) CPM Parallel IO PC1- 90. */ | ||
395 | .long 0 /* (User-Defined Vectors 29) CPM SCC 4 - 91. */ | ||
396 | .long 0 /* (User-Defined Vectors 30) CPM SCC 3 - 92. */ | ||
397 | .long 0 /* (User-Defined Vectors 31) CPM SCC 2 - 93. */ | ||
398 | .long 0 /* (User-Defined Vectors 32) CPM SCC 1 - 94. */ | ||
399 | .long 0 /* (User-Defined Vectors 33) CPM Parallel IO PC0- 95. */ | ||
400 | /* I don't think anything uses the vectors after here. */ | ||
401 | .long 0 /* (User-Defined Vectors 34) - 96. */ | ||
402 | .long 0,0,0,0,0 /* (User-Defined Vectors 35 - 39). */ | ||
403 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 40 - 49). */ | ||
404 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 50 - 59). */ | ||
405 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 60 - 69). */ | ||
406 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 70 - 79). */ | ||
407 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 80 - 89). */ | ||
408 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 90 - 99). */ | ||
409 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 100 - 109). */ | ||
410 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 110 - 119). */ | ||
411 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 120 - 129). */ | ||
412 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 130 - 139). */ | ||
413 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 140 - 149). */ | ||
414 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 150 - 159). */ | ||
415 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 160 - 169). */ | ||
416 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 170 - 179). */ | ||
417 | .long 0,0,0,0,0,0,0,0,0,0 /* (User-Defined Vectors 180 - 189). */ | ||
418 | .long 0,0,0 /* (User-Defined Vectors 190 - 192). */ | ||
419 | .text | ||
420 | ignore: rte | ||
diff --git a/arch/ppc64/kernel/iSeries_pci.c b/arch/ppc64/kernel/iSeries_pci.c index 356e4fd9a94f..fbc273c32bcc 100644 --- a/arch/ppc64/kernel/iSeries_pci.c +++ b/arch/ppc64/kernel/iSeries_pci.c | |||
@@ -252,7 +252,7 @@ unsigned long __init find_and_init_phbs(void) | |||
252 | phb = (struct pci_controller *)kmalloc(sizeof(struct pci_controller), GFP_KERNEL); | 252 | phb = (struct pci_controller *)kmalloc(sizeof(struct pci_controller), GFP_KERNEL); |
253 | if (phb == NULL) | 253 | if (phb == NULL) |
254 | return -ENOMEM; | 254 | return -ENOMEM; |
255 | pci_setup_pci_controller(phb); | 255 | pci_setup_pci_controller(phb); |
256 | 256 | ||
257 | phb->pci_mem_offset = phb->local_number = bus; | 257 | phb->pci_mem_offset = phb->local_number = bus; |
258 | phb->first_busno = bus; | 258 | phb->first_busno = bus; |
diff --git a/arch/ppc64/kernel/maple_pci.c b/arch/ppc64/kernel/maple_pci.c index 5a8b4d8c2dd6..1d297e0edfc0 100644 --- a/arch/ppc64/kernel/maple_pci.c +++ b/arch/ppc64/kernel/maple_pci.c | |||
@@ -283,7 +283,7 @@ static void __init setup_u3_agp(struct pci_controller* hose) | |||
283 | * the reg address cell, we shall fix that by killing struct | 283 | * the reg address cell, we shall fix that by killing struct |
284 | * reg_property and using some accessor functions instead | 284 | * reg_property and using some accessor functions instead |
285 | */ | 285 | */ |
286 | hose->first_busno = 0xf0; | 286 | hose->first_busno = 0xf0; |
287 | hose->last_busno = 0xff; | 287 | hose->last_busno = 0xff; |
288 | hose->ops = &u3_agp_pci_ops; | 288 | hose->ops = &u3_agp_pci_ops; |
289 | hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000); | 289 | hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000); |
@@ -315,24 +315,24 @@ static int __init add_bridge(struct device_node *dev) | |||
315 | char* disp_name; | 315 | char* disp_name; |
316 | int *bus_range; | 316 | int *bus_range; |
317 | int primary = 1; | 317 | int primary = 1; |
318 | struct property *of_prop; | 318 | struct property *of_prop; |
319 | 319 | ||
320 | DBG("Adding PCI host bridge %s\n", dev->full_name); | 320 | DBG("Adding PCI host bridge %s\n", dev->full_name); |
321 | 321 | ||
322 | bus_range = (int *) get_property(dev, "bus-range", &len); | 322 | bus_range = (int *) get_property(dev, "bus-range", &len); |
323 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 323 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
324 | printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", | 324 | printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", |
325 | dev->full_name); | 325 | dev->full_name); |
326 | } | 326 | } |
327 | 327 | ||
328 | hose = alloc_bootmem(sizeof(struct pci_controller)); | 328 | hose = alloc_bootmem(sizeof(struct pci_controller)); |
329 | if (hose == NULL) | 329 | if (hose == NULL) |
330 | return -ENOMEM; | 330 | return -ENOMEM; |
331 | pci_setup_pci_controller(hose); | 331 | pci_setup_pci_controller(hose); |
332 | 332 | ||
333 | hose->arch_data = dev; | 333 | hose->arch_data = dev; |
334 | hose->first_busno = bus_range ? bus_range[0] : 0; | 334 | hose->first_busno = bus_range ? bus_range[0] : 0; |
335 | hose->last_busno = bus_range ? bus_range[1] : 0xff; | 335 | hose->last_busno = bus_range ? bus_range[1] : 0xff; |
336 | 336 | ||
337 | of_prop = alloc_bootmem(sizeof(struct property) + | 337 | of_prop = alloc_bootmem(sizeof(struct property) + |
338 | sizeof(hose->global_number)); | 338 | sizeof(hose->global_number)); |
@@ -346,25 +346,25 @@ static int __init add_bridge(struct device_node *dev) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | disp_name = NULL; | 348 | disp_name = NULL; |
349 | if (device_is_compatible(dev, "u3-agp")) { | 349 | if (device_is_compatible(dev, "u3-agp")) { |
350 | setup_u3_agp(hose); | 350 | setup_u3_agp(hose); |
351 | disp_name = "U3-AGP"; | 351 | disp_name = "U3-AGP"; |
352 | primary = 0; | 352 | primary = 0; |
353 | } else if (device_is_compatible(dev, "u3-ht")) { | 353 | } else if (device_is_compatible(dev, "u3-ht")) { |
354 | setup_u3_ht(hose); | 354 | setup_u3_ht(hose); |
355 | disp_name = "U3-HT"; | 355 | disp_name = "U3-HT"; |
356 | primary = 1; | 356 | primary = 1; |
357 | } | 357 | } |
358 | printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", | 358 | printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", |
359 | disp_name, hose->first_busno, hose->last_busno); | 359 | disp_name, hose->first_busno, hose->last_busno); |
360 | 360 | ||
361 | /* Interpret the "ranges" property */ | 361 | /* Interpret the "ranges" property */ |
362 | /* This also maps the I/O region and sets isa_io/mem_base */ | 362 | /* This also maps the I/O region and sets isa_io/mem_base */ |
363 | pci_process_bridge_OF_ranges(hose, dev); | 363 | pci_process_bridge_OF_ranges(hose, dev); |
364 | pci_setup_phb_io(hose, primary); | 364 | pci_setup_phb_io(hose, primary); |
365 | 365 | ||
366 | /* Fixup "bus-range" OF property */ | 366 | /* Fixup "bus-range" OF property */ |
367 | fixup_bus_range(dev); | 367 | fixup_bus_range(dev); |
368 | 368 | ||
369 | return 0; | 369 | return 0; |
370 | } | 370 | } |
diff --git a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c index 9490b6c5b173..bfadccc7b8be 100644 --- a/arch/ppc64/kernel/pSeries_setup.c +++ b/arch/ppc64/kernel/pSeries_setup.c | |||
@@ -590,6 +590,13 @@ static int pseries_shared_idle(void) | |||
590 | return 0; | 590 | return 0; |
591 | } | 591 | } |
592 | 592 | ||
593 | static int pSeries_pci_probe_mode(struct pci_bus *bus) | ||
594 | { | ||
595 | if (systemcfg->platform & PLATFORM_LPAR) | ||
596 | return PCI_PROBE_DEVTREE; | ||
597 | return PCI_PROBE_NORMAL; | ||
598 | } | ||
599 | |||
593 | struct machdep_calls __initdata pSeries_md = { | 600 | struct machdep_calls __initdata pSeries_md = { |
594 | .probe = pSeries_probe, | 601 | .probe = pSeries_probe, |
595 | .setup_arch = pSeries_setup_arch, | 602 | .setup_arch = pSeries_setup_arch, |
@@ -597,6 +604,7 @@ struct machdep_calls __initdata pSeries_md = { | |||
597 | .get_cpuinfo = pSeries_get_cpuinfo, | 604 | .get_cpuinfo = pSeries_get_cpuinfo, |
598 | .log_error = pSeries_log_error, | 605 | .log_error = pSeries_log_error, |
599 | .pcibios_fixup = pSeries_final_fixup, | 606 | .pcibios_fixup = pSeries_final_fixup, |
607 | .pci_probe_mode = pSeries_pci_probe_mode, | ||
600 | .irq_bus_setup = pSeries_irq_bus_setup, | 608 | .irq_bus_setup = pSeries_irq_bus_setup, |
601 | .restart = rtas_restart, | 609 | .restart = rtas_restart, |
602 | .power_off = rtas_power_off, | 610 | .power_off = rtas_power_off, |
diff --git a/arch/ppc64/kernel/pSeries_smp.c b/arch/ppc64/kernel/pSeries_smp.c index 79c7f3223665..d2c7e2c4733b 100644 --- a/arch/ppc64/kernel/pSeries_smp.c +++ b/arch/ppc64/kernel/pSeries_smp.c | |||
@@ -272,6 +272,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu) | |||
272 | unsigned long start_here = __pa((u32)*((unsigned long *) | 272 | unsigned long start_here = __pa((u32)*((unsigned long *) |
273 | pSeries_secondary_smp_init)); | 273 | pSeries_secondary_smp_init)); |
274 | unsigned int pcpu; | 274 | unsigned int pcpu; |
275 | int start_cpu; | ||
275 | 276 | ||
276 | if (cpu_isset(lcpu, of_spin_map)) | 277 | if (cpu_isset(lcpu, of_spin_map)) |
277 | /* Already started by OF and sitting in spin loop */ | 278 | /* Already started by OF and sitting in spin loop */ |
@@ -282,12 +283,20 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu) | |||
282 | /* Fixup atomic count: it exited inside IRQ handler. */ | 283 | /* Fixup atomic count: it exited inside IRQ handler. */ |
283 | paca[lcpu].__current->thread_info->preempt_count = 0; | 284 | paca[lcpu].__current->thread_info->preempt_count = 0; |
284 | 285 | ||
285 | status = rtas_call(rtas_token("start-cpu"), 3, 1, NULL, | 286 | /* |
286 | pcpu, start_here, lcpu); | 287 | * If the RTAS start-cpu token does not exist then presume the |
288 | * cpu is already spinning. | ||
289 | */ | ||
290 | start_cpu = rtas_token("start-cpu"); | ||
291 | if (start_cpu == RTAS_UNKNOWN_SERVICE) | ||
292 | return 1; | ||
293 | |||
294 | status = rtas_call(start_cpu, 3, 1, NULL, pcpu, start_here, lcpu); | ||
287 | if (status != 0) { | 295 | if (status != 0) { |
288 | printk(KERN_ERR "start-cpu failed: %i\n", status); | 296 | printk(KERN_ERR "start-cpu failed: %i\n", status); |
289 | return 0; | 297 | return 0; |
290 | } | 298 | } |
299 | |||
291 | return 1; | 300 | return 1; |
292 | } | 301 | } |
293 | 302 | ||
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c index 8447dcc2c2b3..861138ad092c 100644 --- a/arch/ppc64/kernel/pci.c +++ b/arch/ppc64/kernel/pci.c | |||
@@ -51,6 +51,10 @@ unsigned long io_page_mask; | |||
51 | 51 | ||
52 | EXPORT_SYMBOL(io_page_mask); | 52 | EXPORT_SYMBOL(io_page_mask); |
53 | 53 | ||
54 | #ifdef CONFIG_PPC_MULTIPLATFORM | ||
55 | static void fixup_resource(struct resource *res, struct pci_dev *dev); | ||
56 | static void do_bus_setup(struct pci_bus *bus); | ||
57 | #endif | ||
54 | 58 | ||
55 | unsigned int pcibios_assign_all_busses(void) | 59 | unsigned int pcibios_assign_all_busses(void) |
56 | { | 60 | { |
@@ -225,10 +229,287 @@ static void __init pcibios_claim_of_setup(void) | |||
225 | } | 229 | } |
226 | #endif | 230 | #endif |
227 | 231 | ||
232 | #ifdef CONFIG_PPC_MULTIPLATFORM | ||
233 | static u32 get_int_prop(struct device_node *np, const char *name, u32 def) | ||
234 | { | ||
235 | u32 *prop; | ||
236 | int len; | ||
237 | |||
238 | prop = (u32 *) get_property(np, name, &len); | ||
239 | if (prop && len >= 4) | ||
240 | return *prop; | ||
241 | return def; | ||
242 | } | ||
243 | |||
244 | static unsigned int pci_parse_of_flags(u32 addr0) | ||
245 | { | ||
246 | unsigned int flags = 0; | ||
247 | |||
248 | if (addr0 & 0x02000000) { | ||
249 | flags |= IORESOURCE_MEM; | ||
250 | if (addr0 & 0x40000000) | ||
251 | flags |= IORESOURCE_PREFETCH; | ||
252 | } else if (addr0 & 0x01000000) | ||
253 | flags |= IORESOURCE_IO; | ||
254 | return flags; | ||
255 | } | ||
256 | |||
257 | #define GET_64BIT(prop, i) ((((u64) (prop)[(i)]) << 32) | (prop)[(i)+1]) | ||
258 | |||
259 | static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev) | ||
260 | { | ||
261 | u64 base, size; | ||
262 | unsigned int flags; | ||
263 | struct resource *res; | ||
264 | u32 *addrs, i; | ||
265 | int proplen; | ||
266 | |||
267 | addrs = (u32 *) get_property(node, "assigned-addresses", &proplen); | ||
268 | if (!addrs) | ||
269 | return; | ||
270 | for (; proplen >= 20; proplen -= 20, addrs += 5) { | ||
271 | flags = pci_parse_of_flags(addrs[0]); | ||
272 | if (!flags) | ||
273 | continue; | ||
274 | base = GET_64BIT(addrs, 1); | ||
275 | size = GET_64BIT(addrs, 3); | ||
276 | if (!size) | ||
277 | continue; | ||
278 | i = addrs[0] & 0xff; | ||
279 | if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) { | ||
280 | res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2]; | ||
281 | } else if (i == dev->rom_base_reg) { | ||
282 | res = &dev->resource[PCI_ROM_RESOURCE]; | ||
283 | flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE; | ||
284 | } else { | ||
285 | printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i); | ||
286 | continue; | ||
287 | } | ||
288 | res->start = base; | ||
289 | res->end = base + size - 1; | ||
290 | res->flags = flags; | ||
291 | res->name = pci_name(dev); | ||
292 | fixup_resource(res, dev); | ||
293 | } | ||
294 | } | ||
295 | |||
296 | static struct pci_dev *of_create_pci_dev(struct device_node *node, | ||
297 | struct pci_bus *bus, int devfn) | ||
298 | { | ||
299 | struct pci_dev *dev; | ||
300 | const char *type; | ||
301 | |||
302 | dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL); | ||
303 | if (!dev) | ||
304 | return NULL; | ||
305 | type = get_property(node, "device_type", NULL); | ||
306 | if (type == NULL) | ||
307 | type = ""; | ||
308 | |||
309 | memset(dev, 0, sizeof(struct pci_dev)); | ||
310 | dev->bus = bus; | ||
311 | dev->sysdata = node; | ||
312 | dev->dev.parent = bus->bridge; | ||
313 | dev->dev.bus = &pci_bus_type; | ||
314 | dev->devfn = devfn; | ||
315 | dev->multifunction = 0; /* maybe a lie? */ | ||
316 | |||
317 | dev->vendor = get_int_prop(node, "vendor-id", 0xffff); | ||
318 | dev->device = get_int_prop(node, "device-id", 0xffff); | ||
319 | dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0); | ||
320 | dev->subsystem_device = get_int_prop(node, "subsystem-id", 0); | ||
321 | |||
322 | dev->cfg_size = 256; /*pci_cfg_space_size(dev);*/ | ||
323 | |||
324 | sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), | ||
325 | dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); | ||
326 | dev->class = get_int_prop(node, "class-code", 0); | ||
327 | |||
328 | dev->current_state = 4; /* unknown power state */ | ||
329 | |||
330 | if (!strcmp(type, "pci")) { | ||
331 | /* a PCI-PCI bridge */ | ||
332 | dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; | ||
333 | dev->rom_base_reg = PCI_ROM_ADDRESS1; | ||
334 | } else if (!strcmp(type, "cardbus")) { | ||
335 | dev->hdr_type = PCI_HEADER_TYPE_CARDBUS; | ||
336 | } else { | ||
337 | dev->hdr_type = PCI_HEADER_TYPE_NORMAL; | ||
338 | dev->rom_base_reg = PCI_ROM_ADDRESS; | ||
339 | dev->irq = NO_IRQ; | ||
340 | if (node->n_intrs > 0) { | ||
341 | dev->irq = node->intrs[0].line; | ||
342 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, | ||
343 | dev->irq); | ||
344 | } | ||
345 | } | ||
346 | |||
347 | pci_parse_of_addrs(node, dev); | ||
348 | |||
349 | pci_device_add(dev, bus); | ||
350 | |||
351 | /* XXX pci_scan_msi_device(dev); */ | ||
352 | |||
353 | return dev; | ||
354 | } | ||
355 | |||
356 | static void of_scan_pci_bridge(struct device_node *node, struct pci_dev *dev); | ||
357 | |||
358 | static void __devinit of_scan_bus(struct device_node *node, | ||
359 | struct pci_bus *bus) | ||
360 | { | ||
361 | struct device_node *child = NULL; | ||
362 | u32 *reg; | ||
363 | int reglen, devfn; | ||
364 | struct pci_dev *dev; | ||
365 | |||
366 | while ((child = of_get_next_child(node, child)) != NULL) { | ||
367 | reg = (u32 *) get_property(child, "reg", ®len); | ||
368 | if (reg == NULL || reglen < 20) | ||
369 | continue; | ||
370 | devfn = (reg[0] >> 8) & 0xff; | ||
371 | /* create a new pci_dev for this device */ | ||
372 | dev = of_create_pci_dev(child, bus, devfn); | ||
373 | if (!dev) | ||
374 | continue; | ||
375 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | ||
376 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | ||
377 | of_scan_pci_bridge(child, dev); | ||
378 | } | ||
379 | |||
380 | do_bus_setup(bus); | ||
381 | } | ||
382 | |||
383 | static void __devinit of_scan_pci_bridge(struct device_node *node, | ||
384 | struct pci_dev *dev) | ||
385 | { | ||
386 | struct pci_bus *bus; | ||
387 | u32 *busrange, *ranges; | ||
388 | int len, i, mode; | ||
389 | struct resource *res; | ||
390 | unsigned int flags; | ||
391 | u64 size; | ||
392 | |||
393 | /* parse bus-range property */ | ||
394 | busrange = (u32 *) get_property(node, "bus-range", &len); | ||
395 | if (busrange == NULL || len != 8) { | ||
396 | printk(KERN_ERR "Can't get bus-range for PCI-PCI bridge %s\n", | ||
397 | node->full_name); | ||
398 | return; | ||
399 | } | ||
400 | ranges = (u32 *) get_property(node, "ranges", &len); | ||
401 | if (ranges == NULL) { | ||
402 | printk(KERN_ERR "Can't get ranges for PCI-PCI bridge %s\n", | ||
403 | node->full_name); | ||
404 | return; | ||
405 | } | ||
406 | |||
407 | bus = pci_add_new_bus(dev->bus, dev, busrange[0]); | ||
408 | if (!bus) { | ||
409 | printk(KERN_ERR "Failed to create pci bus for %s\n", | ||
410 | node->full_name); | ||
411 | return; | ||
412 | } | ||
413 | |||
414 | bus->primary = dev->bus->number; | ||
415 | bus->subordinate = busrange[1]; | ||
416 | bus->bridge_ctl = 0; | ||
417 | bus->sysdata = node; | ||
418 | |||
419 | /* parse ranges property */ | ||
420 | /* PCI #address-cells == 3 and #size-cells == 2 always */ | ||
421 | res = &dev->resource[PCI_BRIDGE_RESOURCES]; | ||
422 | for (i = 0; i < PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES; ++i) { | ||
423 | res->flags = 0; | ||
424 | bus->resource[i] = res; | ||
425 | ++res; | ||
426 | } | ||
427 | i = 1; | ||
428 | for (; len >= 32; len -= 32, ranges += 8) { | ||
429 | flags = pci_parse_of_flags(ranges[0]); | ||
430 | size = GET_64BIT(ranges, 6); | ||
431 | if (flags == 0 || size == 0) | ||
432 | continue; | ||
433 | if (flags & IORESOURCE_IO) { | ||
434 | res = bus->resource[0]; | ||
435 | if (res->flags) { | ||
436 | printk(KERN_ERR "PCI: ignoring extra I/O range" | ||
437 | " for bridge %s\n", node->full_name); | ||
438 | continue; | ||
439 | } | ||
440 | } else { | ||
441 | if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) { | ||
442 | printk(KERN_ERR "PCI: too many memory ranges" | ||
443 | " for bridge %s\n", node->full_name); | ||
444 | continue; | ||
445 | } | ||
446 | res = bus->resource[i]; | ||
447 | ++i; | ||
448 | } | ||
449 | res->start = GET_64BIT(ranges, 1); | ||
450 | res->end = res->start + size - 1; | ||
451 | res->flags = flags; | ||
452 | fixup_resource(res, dev); | ||
453 | } | ||
454 | sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), | ||
455 | bus->number); | ||
456 | |||
457 | mode = PCI_PROBE_NORMAL; | ||
458 | if (ppc_md.pci_probe_mode) | ||
459 | mode = ppc_md.pci_probe_mode(bus); | ||
460 | if (mode == PCI_PROBE_DEVTREE) | ||
461 | of_scan_bus(node, bus); | ||
462 | else if (mode == PCI_PROBE_NORMAL) | ||
463 | pci_scan_child_bus(bus); | ||
464 | } | ||
465 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | ||
466 | |||
467 | static void __devinit scan_phb(struct pci_controller *hose) | ||
468 | { | ||
469 | struct pci_bus *bus; | ||
470 | struct device_node *node = hose->arch_data; | ||
471 | int i, mode; | ||
472 | struct resource *res; | ||
473 | |||
474 | bus = pci_create_bus(NULL, hose->first_busno, hose->ops, node); | ||
475 | if (bus == NULL) { | ||
476 | printk(KERN_ERR "Failed to create bus for PCI domain %04x\n", | ||
477 | hose->global_number); | ||
478 | return; | ||
479 | } | ||
480 | bus->secondary = hose->first_busno; | ||
481 | hose->bus = bus; | ||
482 | |||
483 | bus->resource[0] = res = &hose->io_resource; | ||
484 | if (res->flags && request_resource(&ioport_resource, res)) | ||
485 | printk(KERN_ERR "Failed to request PCI IO region " | ||
486 | "on PCI domain %04x\n", hose->global_number); | ||
487 | |||
488 | for (i = 0; i < 3; ++i) { | ||
489 | res = &hose->mem_resources[i]; | ||
490 | bus->resource[i+1] = res; | ||
491 | if (res->flags && request_resource(&iomem_resource, res)) | ||
492 | printk(KERN_ERR "Failed to request PCI memory region " | ||
493 | "on PCI domain %04x\n", hose->global_number); | ||
494 | } | ||
495 | |||
496 | mode = PCI_PROBE_NORMAL; | ||
497 | #ifdef CONFIG_PPC_MULTIPLATFORM | ||
498 | if (ppc_md.pci_probe_mode) | ||
499 | mode = ppc_md.pci_probe_mode(bus); | ||
500 | if (mode == PCI_PROBE_DEVTREE) { | ||
501 | bus->subordinate = hose->last_busno; | ||
502 | of_scan_bus(node, bus); | ||
503 | } | ||
504 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | ||
505 | if (mode == PCI_PROBE_NORMAL) | ||
506 | hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); | ||
507 | pci_bus_add_devices(bus); | ||
508 | } | ||
509 | |||
228 | static int __init pcibios_init(void) | 510 | static int __init pcibios_init(void) |
229 | { | 511 | { |
230 | struct pci_controller *hose, *tmp; | 512 | struct pci_controller *hose, *tmp; |
231 | struct pci_bus *bus; | ||
232 | 513 | ||
233 | /* For now, override phys_mem_access_prot. If we need it, | 514 | /* For now, override phys_mem_access_prot. If we need it, |
234 | * later, we may move that initialization to each ppc_md | 515 | * later, we may move that initialization to each ppc_md |
@@ -242,13 +523,8 @@ static int __init pcibios_init(void) | |||
242 | printk("PCI: Probing PCI hardware\n"); | 523 | printk("PCI: Probing PCI hardware\n"); |
243 | 524 | ||
244 | /* Scan all of the recorded PCI controllers. */ | 525 | /* Scan all of the recorded PCI controllers. */ |
245 | list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { | 526 | list_for_each_entry_safe(hose, tmp, &hose_list, list_node) |
246 | hose->last_busno = 0xff; | 527 | scan_phb(hose); |
247 | bus = pci_scan_bus(hose->first_busno, hose->ops, | ||
248 | hose->arch_data); | ||
249 | hose->bus = bus; | ||
250 | hose->last_busno = bus->subordinate; | ||
251 | } | ||
252 | 528 | ||
253 | #ifndef CONFIG_PPC_ISERIES | 529 | #ifndef CONFIG_PPC_ISERIES |
254 | if (pci_probe_only) | 530 | if (pci_probe_only) |
@@ -820,120 +1096,89 @@ void phbs_remap_io(void) | |||
820 | /* | 1096 | /* |
821 | * ppc64 can have multifunction devices that do not respond to function 0. | 1097 | * ppc64 can have multifunction devices that do not respond to function 0. |
822 | * In this case we must scan all functions. | 1098 | * In this case we must scan all functions. |
1099 | * XXX this can go now, we use the OF device tree in all the | ||
1100 | * cases that caused problems. -- paulus | ||
823 | */ | 1101 | */ |
824 | int pcibios_scan_all_fns(struct pci_bus *bus, int devfn) | 1102 | int pcibios_scan_all_fns(struct pci_bus *bus, int devfn) |
825 | { | 1103 | { |
826 | struct device_node *busdn, *dn; | ||
827 | |||
828 | if (bus->self) | ||
829 | busdn = pci_device_to_OF_node(bus->self); | ||
830 | else | ||
831 | busdn = bus->sysdata; /* must be a phb */ | ||
832 | |||
833 | if (busdn == NULL) | ||
834 | return 0; | ||
835 | |||
836 | /* | ||
837 | * Check to see if there is any of the 8 functions are in the | ||
838 | * device tree. If they are then we need to scan all the | ||
839 | * functions of this slot. | ||
840 | */ | ||
841 | for (dn = busdn->child; dn; dn = dn->sibling) { | ||
842 | struct pci_dn *pdn = dn->data; | ||
843 | if (pdn && (pdn->devfn >> 3) == (devfn >> 3)) | ||
844 | return 1; | ||
845 | } | ||
846 | |||
847 | return 0; | 1104 | return 0; |
848 | } | 1105 | } |
849 | 1106 | ||
1107 | static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev) | ||
1108 | { | ||
1109 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | ||
1110 | unsigned long start, end, mask, offset; | ||
1111 | |||
1112 | if (res->flags & IORESOURCE_IO) { | ||
1113 | offset = (unsigned long)hose->io_base_virt - pci_io_base; | ||
1114 | |||
1115 | start = res->start += offset; | ||
1116 | end = res->end += offset; | ||
1117 | |||
1118 | /* Need to allow IO access to pages that are in the | ||
1119 | ISA range */ | ||
1120 | if (start < MAX_ISA_PORT) { | ||
1121 | if (end > MAX_ISA_PORT) | ||
1122 | end = MAX_ISA_PORT; | ||
1123 | |||
1124 | start >>= PAGE_SHIFT; | ||
1125 | end >>= PAGE_SHIFT; | ||
1126 | |||
1127 | /* get the range of pages for the map */ | ||
1128 | mask = ((1 << (end+1)) - 1) ^ ((1 << start) - 1); | ||
1129 | io_page_mask |= mask; | ||
1130 | } | ||
1131 | } else if (res->flags & IORESOURCE_MEM) { | ||
1132 | res->start += hose->pci_mem_offset; | ||
1133 | res->end += hose->pci_mem_offset; | ||
1134 | } | ||
1135 | } | ||
850 | 1136 | ||
851 | void __devinit pcibios_fixup_device_resources(struct pci_dev *dev, | 1137 | void __devinit pcibios_fixup_device_resources(struct pci_dev *dev, |
852 | struct pci_bus *bus) | 1138 | struct pci_bus *bus) |
853 | { | 1139 | { |
854 | /* Update device resources. */ | 1140 | /* Update device resources. */ |
855 | struct pci_controller *hose = pci_bus_to_host(bus); | ||
856 | int i; | 1141 | int i; |
857 | 1142 | ||
858 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | 1143 | for (i = 0; i < PCI_NUM_RESOURCES; i++) |
859 | if (dev->resource[i].flags & IORESOURCE_IO) { | 1144 | if (dev->resource[i].flags) |
860 | unsigned long offset = (unsigned long)hose->io_base_virt | 1145 | fixup_resource(&dev->resource[i], dev); |
861 | - pci_io_base; | ||
862 | unsigned long start, end, mask; | ||
863 | |||
864 | start = dev->resource[i].start += offset; | ||
865 | end = dev->resource[i].end += offset; | ||
866 | |||
867 | /* Need to allow IO access to pages that are in the | ||
868 | ISA range */ | ||
869 | if (start < MAX_ISA_PORT) { | ||
870 | if (end > MAX_ISA_PORT) | ||
871 | end = MAX_ISA_PORT; | ||
872 | |||
873 | start >>= PAGE_SHIFT; | ||
874 | end >>= PAGE_SHIFT; | ||
875 | |||
876 | /* get the range of pages for the map */ | ||
877 | mask = ((1 << (end+1))-1) ^ ((1 << start)-1); | ||
878 | io_page_mask |= mask; | ||
879 | } | ||
880 | } | ||
881 | else if (dev->resource[i].flags & IORESOURCE_MEM) { | ||
882 | dev->resource[i].start += hose->pci_mem_offset; | ||
883 | dev->resource[i].end += hose->pci_mem_offset; | ||
884 | } | ||
885 | } | ||
886 | } | 1146 | } |
887 | EXPORT_SYMBOL(pcibios_fixup_device_resources); | 1147 | EXPORT_SYMBOL(pcibios_fixup_device_resources); |
888 | 1148 | ||
889 | void __devinit pcibios_fixup_bus(struct pci_bus *bus) | 1149 | static void __devinit do_bus_setup(struct pci_bus *bus) |
890 | { | 1150 | { |
891 | struct pci_controller *hose = pci_bus_to_host(bus); | 1151 | struct pci_dev *dev; |
892 | struct pci_dev *dev = bus->self; | ||
893 | struct resource *res; | ||
894 | int i; | ||
895 | 1152 | ||
896 | if (!dev) { | 1153 | ppc_md.iommu_bus_setup(bus); |
897 | /* Root bus. */ | ||
898 | 1154 | ||
899 | hose->bus = bus; | 1155 | list_for_each_entry(dev, &bus->devices, bus_list) |
900 | bus->resource[0] = res = &hose->io_resource; | 1156 | ppc_md.iommu_dev_setup(dev); |
901 | 1157 | ||
902 | if (res->flags && request_resource(&ioport_resource, res)) | 1158 | if (ppc_md.irq_bus_setup) |
903 | printk(KERN_ERR "Failed to request IO on " | 1159 | ppc_md.irq_bus_setup(bus); |
904 | "PCI domain %d\n", pci_domain_nr(bus)); | 1160 | } |
905 | 1161 | ||
906 | for (i = 0; i < 3; ++i) { | 1162 | void __devinit pcibios_fixup_bus(struct pci_bus *bus) |
907 | res = &hose->mem_resources[i]; | 1163 | { |
908 | bus->resource[i+1] = res; | 1164 | struct pci_dev *dev = bus->self; |
909 | if (res->flags && request_resource(&iomem_resource, res)) | 1165 | |
910 | printk(KERN_ERR "Failed to request MEM on " | 1166 | if (dev && pci_probe_only && |
911 | "PCI domain %d\n", | 1167 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { |
912 | pci_domain_nr(bus)); | ||
913 | } | ||
914 | } else if (pci_probe_only && | ||
915 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | ||
916 | /* This is a subordinate bridge */ | 1168 | /* This is a subordinate bridge */ |
917 | 1169 | ||
918 | pci_read_bridge_bases(bus); | 1170 | pci_read_bridge_bases(bus); |
919 | pcibios_fixup_device_resources(dev, bus); | 1171 | pcibios_fixup_device_resources(dev, bus); |
920 | } | 1172 | } |
921 | 1173 | ||
922 | ppc_md.iommu_bus_setup(bus); | 1174 | do_bus_setup(bus); |
923 | |||
924 | list_for_each_entry(dev, &bus->devices, bus_list) | ||
925 | ppc_md.iommu_dev_setup(dev); | ||
926 | |||
927 | if (ppc_md.irq_bus_setup) | ||
928 | ppc_md.irq_bus_setup(bus); | ||
929 | 1175 | ||
930 | if (!pci_probe_only) | 1176 | if (!pci_probe_only) |
931 | return; | 1177 | return; |
932 | 1178 | ||
933 | list_for_each_entry(dev, &bus->devices, bus_list) { | 1179 | list_for_each_entry(dev, &bus->devices, bus_list) |
934 | if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) | 1180 | if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) |
935 | pcibios_fixup_device_resources(dev, bus); | 1181 | pcibios_fixup_device_resources(dev, bus); |
936 | } | ||
937 | } | 1182 | } |
938 | EXPORT_SYMBOL(pcibios_fixup_bus); | 1183 | EXPORT_SYMBOL(pcibios_fixup_bus); |
939 | 1184 | ||
diff --git a/arch/ppc64/kernel/pmac_pci.c b/arch/ppc64/kernel/pmac_pci.c index d37bff2d7d40..dc40a0cad0b4 100644 --- a/arch/ppc64/kernel/pmac_pci.c +++ b/arch/ppc64/kernel/pmac_pci.c | |||
@@ -388,7 +388,7 @@ static void __init setup_u3_agp(struct pci_controller* hose) | |||
388 | * the reg address cell, we shall fix that by killing struct | 388 | * the reg address cell, we shall fix that by killing struct |
389 | * reg_property and using some accessor functions instead | 389 | * reg_property and using some accessor functions instead |
390 | */ | 390 | */ |
391 | hose->first_busno = 0xf0; | 391 | hose->first_busno = 0xf0; |
392 | hose->last_busno = 0xff; | 392 | hose->last_busno = 0xff; |
393 | has_uninorth = 1; | 393 | has_uninorth = 1; |
394 | hose->ops = ¯isc_pci_ops; | 394 | hose->ops = ¯isc_pci_ops; |
@@ -473,7 +473,7 @@ static void __init setup_u3_ht(struct pci_controller* hose) | |||
473 | continue; | 473 | continue; |
474 | } | 474 | } |
475 | cur++; | 475 | cur++; |
476 | DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n", | 476 | DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n", |
477 | cur-1, res->start - 1, cur, res->end + 1); | 477 | cur-1, res->start - 1, cur, res->end + 1); |
478 | hose->mem_resources[cur].name = np->full_name; | 478 | hose->mem_resources[cur].name = np->full_name; |
479 | hose->mem_resources[cur].flags = IORESOURCE_MEM; | 479 | hose->mem_resources[cur].flags = IORESOURCE_MEM; |
@@ -603,24 +603,24 @@ static int __init add_bridge(struct device_node *dev) | |||
603 | char* disp_name; | 603 | char* disp_name; |
604 | int *bus_range; | 604 | int *bus_range; |
605 | int primary = 1; | 605 | int primary = 1; |
606 | struct property *of_prop; | 606 | struct property *of_prop; |
607 | 607 | ||
608 | DBG("Adding PCI host bridge %s\n", dev->full_name); | 608 | DBG("Adding PCI host bridge %s\n", dev->full_name); |
609 | 609 | ||
610 | bus_range = (int *) get_property(dev, "bus-range", &len); | 610 | bus_range = (int *) get_property(dev, "bus-range", &len); |
611 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 611 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
612 | printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", | 612 | printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", |
613 | dev->full_name); | 613 | dev->full_name); |
614 | } | 614 | } |
615 | 615 | ||
616 | hose = alloc_bootmem(sizeof(struct pci_controller)); | 616 | hose = alloc_bootmem(sizeof(struct pci_controller)); |
617 | if (hose == NULL) | 617 | if (hose == NULL) |
618 | return -ENOMEM; | 618 | return -ENOMEM; |
619 | pci_setup_pci_controller(hose); | 619 | pci_setup_pci_controller(hose); |
620 | 620 | ||
621 | hose->arch_data = dev; | 621 | hose->arch_data = dev; |
622 | hose->first_busno = bus_range ? bus_range[0] : 0; | 622 | hose->first_busno = bus_range ? bus_range[0] : 0; |
623 | hose->last_busno = bus_range ? bus_range[1] : 0xff; | 623 | hose->last_busno = bus_range ? bus_range[1] : 0xff; |
624 | 624 | ||
625 | of_prop = alloc_bootmem(sizeof(struct property) + | 625 | of_prop = alloc_bootmem(sizeof(struct property) + |
626 | sizeof(hose->global_number)); | 626 | sizeof(hose->global_number)); |
@@ -634,24 +634,24 @@ static int __init add_bridge(struct device_node *dev) | |||
634 | } | 634 | } |
635 | 635 | ||
636 | disp_name = NULL; | 636 | disp_name = NULL; |
637 | if (device_is_compatible(dev, "u3-agp")) { | 637 | if (device_is_compatible(dev, "u3-agp")) { |
638 | setup_u3_agp(hose); | 638 | setup_u3_agp(hose); |
639 | disp_name = "U3-AGP"; | 639 | disp_name = "U3-AGP"; |
640 | primary = 0; | 640 | primary = 0; |
641 | } else if (device_is_compatible(dev, "u3-ht")) { | 641 | } else if (device_is_compatible(dev, "u3-ht")) { |
642 | setup_u3_ht(hose); | 642 | setup_u3_ht(hose); |
643 | disp_name = "U3-HT"; | 643 | disp_name = "U3-HT"; |
644 | primary = 1; | 644 | primary = 1; |
645 | } | 645 | } |
646 | printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", | 646 | printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", |
647 | disp_name, hose->first_busno, hose->last_busno); | 647 | disp_name, hose->first_busno, hose->last_busno); |
648 | 648 | ||
649 | /* Interpret the "ranges" property */ | 649 | /* Interpret the "ranges" property */ |
650 | /* This also maps the I/O region and sets isa_io/mem_base */ | 650 | /* This also maps the I/O region and sets isa_io/mem_base */ |
651 | pmac_process_bridge_OF_ranges(hose, dev, primary); | 651 | pmac_process_bridge_OF_ranges(hose, dev, primary); |
652 | 652 | ||
653 | /* Fixup "bus-range" OF property */ | 653 | /* Fixup "bus-range" OF property */ |
654 | fixup_bus_range(dev); | 654 | fixup_bus_range(dev); |
655 | 655 | ||
656 | return 0; | 656 | return 0; |
657 | } | 657 | } |
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c index e7f695dcd8c8..325426c7bed0 100644 --- a/arch/ppc64/kernel/pmac_setup.c +++ b/arch/ppc64/kernel/pmac_setup.c | |||
@@ -477,6 +477,18 @@ static int __init pmac_probe(int platform) | |||
477 | return 1; | 477 | return 1; |
478 | } | 478 | } |
479 | 479 | ||
480 | static int pmac_probe_mode(struct pci_bus *bus) | ||
481 | { | ||
482 | struct device_node *node = bus->sysdata; | ||
483 | |||
484 | /* We need to use normal PCI probing for the AGP bus, | ||
485 | since the device for the AGP bridge isn't in the tree. */ | ||
486 | if (bus->self == NULL && device_is_compatible(node, "u3-agp")) | ||
487 | return PCI_PROBE_NORMAL; | ||
488 | |||
489 | return PCI_PROBE_DEVTREE; | ||
490 | } | ||
491 | |||
480 | struct machdep_calls __initdata pmac_md = { | 492 | struct machdep_calls __initdata pmac_md = { |
481 | #ifdef CONFIG_HOTPLUG_CPU | 493 | #ifdef CONFIG_HOTPLUG_CPU |
482 | .cpu_die = generic_mach_cpu_die, | 494 | .cpu_die = generic_mach_cpu_die, |
@@ -488,6 +500,7 @@ struct machdep_calls __initdata pmac_md = { | |||
488 | .init_IRQ = pmac_init_IRQ, | 500 | .init_IRQ = pmac_init_IRQ, |
489 | .get_irq = mpic_get_irq, | 501 | .get_irq = mpic_get_irq, |
490 | .pcibios_fixup = pmac_pcibios_fixup, | 502 | .pcibios_fixup = pmac_pcibios_fixup, |
503 | .pci_probe_mode = pmac_probe_mode, | ||
491 | .restart = pmac_restart, | 504 | .restart = pmac_restart, |
492 | .power_off = pmac_power_off, | 505 | .power_off = pmac_power_off, |
493 | .halt = pmac_halt, | 506 | .halt = pmac_halt, |
diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c index 7a7e027653ad..887005358eb1 100644 --- a/arch/ppc64/kernel/process.c +++ b/arch/ppc64/kernel/process.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <asm/sections.h> | 54 | #include <asm/sections.h> |
55 | #include <asm/tlbflush.h> | 55 | #include <asm/tlbflush.h> |
56 | #include <asm/time.h> | 56 | #include <asm/time.h> |
57 | #include <asm/plpar_wrappers.h> | ||
57 | 58 | ||
58 | #ifndef CONFIG_SMP | 59 | #ifndef CONFIG_SMP |
59 | struct task_struct *last_task_used_math = NULL; | 60 | struct task_struct *last_task_used_math = NULL; |
@@ -163,7 +164,30 @@ int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs) | |||
163 | 164 | ||
164 | #endif /* CONFIG_ALTIVEC */ | 165 | #endif /* CONFIG_ALTIVEC */ |
165 | 166 | ||
167 | static void set_dabr_spr(unsigned long val) | ||
168 | { | ||
169 | mtspr(SPRN_DABR, val); | ||
170 | } | ||
171 | |||
172 | int set_dabr(unsigned long dabr) | ||
173 | { | ||
174 | int ret = 0; | ||
175 | |||
176 | if (firmware_has_feature(FW_FEATURE_XDABR)) { | ||
177 | /* We want to catch accesses from kernel and userspace */ | ||
178 | unsigned long flags = H_DABRX_KERNEL|H_DABRX_USER; | ||
179 | ret = plpar_set_xdabr(dabr, flags); | ||
180 | } else if (firmware_has_feature(FW_FEATURE_DABR)) { | ||
181 | ret = plpar_set_dabr(dabr); | ||
182 | } else { | ||
183 | set_dabr_spr(dabr); | ||
184 | } | ||
185 | |||
186 | return ret; | ||
187 | } | ||
188 | |||
166 | DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); | 189 | DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); |
190 | static DEFINE_PER_CPU(unsigned long, current_dabr); | ||
167 | 191 | ||
168 | struct task_struct *__switch_to(struct task_struct *prev, | 192 | struct task_struct *__switch_to(struct task_struct *prev, |
169 | struct task_struct *new) | 193 | struct task_struct *new) |
@@ -198,6 +222,11 @@ struct task_struct *__switch_to(struct task_struct *prev, | |||
198 | new->thread.regs->msr |= MSR_VEC; | 222 | new->thread.regs->msr |= MSR_VEC; |
199 | #endif /* CONFIG_ALTIVEC */ | 223 | #endif /* CONFIG_ALTIVEC */ |
200 | 224 | ||
225 | if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) { | ||
226 | set_dabr(new->thread.dabr); | ||
227 | __get_cpu_var(current_dabr) = new->thread.dabr; | ||
228 | } | ||
229 | |||
201 | flush_tlb_pending(); | 230 | flush_tlb_pending(); |
202 | 231 | ||
203 | new_thread = &new->thread; | 232 | new_thread = &new->thread; |
@@ -334,6 +363,11 @@ void flush_thread(void) | |||
334 | last_task_used_altivec = NULL; | 363 | last_task_used_altivec = NULL; |
335 | #endif /* CONFIG_ALTIVEC */ | 364 | #endif /* CONFIG_ALTIVEC */ |
336 | #endif /* CONFIG_SMP */ | 365 | #endif /* CONFIG_SMP */ |
366 | |||
367 | if (current->thread.dabr) { | ||
368 | current->thread.dabr = 0; | ||
369 | set_dabr(0); | ||
370 | } | ||
337 | } | 371 | } |
338 | 372 | ||
339 | void | 373 | void |
diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c index 2993f108d96d..85ed3188a91d 100644 --- a/arch/ppc64/kernel/ptrace.c +++ b/arch/ppc64/kernel/ptrace.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * this archive for more details. | 17 | * this archive for more details. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/config.h> | ||
20 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
@@ -206,6 +207,19 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
206 | break; | 207 | break; |
207 | } | 208 | } |
208 | 209 | ||
210 | case PTRACE_GET_DEBUGREG: { | ||
211 | ret = -EINVAL; | ||
212 | /* We only support one DABR and no IABRS at the moment */ | ||
213 | if (addr > 0) | ||
214 | break; | ||
215 | ret = put_user(child->thread.dabr, | ||
216 | (unsigned long __user *)data); | ||
217 | break; | ||
218 | } | ||
219 | |||
220 | case PTRACE_SET_DEBUGREG: | ||
221 | ret = ptrace_set_debugreg(child, addr, data); | ||
222 | |||
209 | case PTRACE_DETACH: | 223 | case PTRACE_DETACH: |
210 | ret = ptrace_detach(child, data); | 224 | ret = ptrace_detach(child, data); |
211 | break; | 225 | break; |
@@ -274,6 +288,20 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
274 | break; | 288 | break; |
275 | } | 289 | } |
276 | 290 | ||
291 | #ifdef CONFIG_ALTIVEC | ||
292 | case PTRACE_GETVRREGS: | ||
293 | /* Get the child altivec register state. */ | ||
294 | flush_altivec_to_thread(child); | ||
295 | ret = get_vrregs((unsigned long __user *)data, child); | ||
296 | break; | ||
297 | |||
298 | case PTRACE_SETVRREGS: | ||
299 | /* Set the child altivec register state. */ | ||
300 | flush_altivec_to_thread(child); | ||
301 | ret = set_vrregs(child, (unsigned long __user *)data); | ||
302 | break; | ||
303 | #endif | ||
304 | |||
277 | default: | 305 | default: |
278 | ret = ptrace_request(child, request, addr, data); | 306 | ret = ptrace_request(child, request, addr, data); |
279 | break; | 307 | break; |
diff --git a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c index 16436426c7e2..fb8c22d6084a 100644 --- a/arch/ppc64/kernel/ptrace32.c +++ b/arch/ppc64/kernel/ptrace32.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * this archive for more details. | 17 | * this archive for more details. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/config.h> | ||
20 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
@@ -337,6 +338,19 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) | |||
337 | break; | 338 | break; |
338 | } | 339 | } |
339 | 340 | ||
341 | case PTRACE_GET_DEBUGREG: { | ||
342 | ret = -EINVAL; | ||
343 | /* We only support one DABR and no IABRS at the moment */ | ||
344 | if (addr > 0) | ||
345 | break; | ||
346 | ret = put_user(child->thread.dabr, (u32 __user *)data); | ||
347 | break; | ||
348 | } | ||
349 | |||
350 | case PTRACE_SET_DEBUGREG: | ||
351 | ret = ptrace_set_debugreg(child, addr, data); | ||
352 | break; | ||
353 | |||
340 | case PTRACE_DETACH: | 354 | case PTRACE_DETACH: |
341 | ret = ptrace_detach(child, data); | 355 | ret = ptrace_detach(child, data); |
342 | break; | 356 | break; |
@@ -405,9 +419,23 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) | |||
405 | break; | 419 | break; |
406 | } | 420 | } |
407 | 421 | ||
408 | case PTRACE_GETEVENTMSG: | 422 | case PTRACE_GETEVENTMSG: |
409 | ret = put_user(child->ptrace_message, (unsigned int __user *) data); | 423 | ret = put_user(child->ptrace_message, (unsigned int __user *) data); |
410 | break; | 424 | break; |
425 | |||
426 | #ifdef CONFIG_ALTIVEC | ||
427 | case PTRACE_GETVRREGS: | ||
428 | /* Get the child altivec register state. */ | ||
429 | flush_altivec_to_thread(child); | ||
430 | ret = get_vrregs((unsigned long __user *)data, child); | ||
431 | break; | ||
432 | |||
433 | case PTRACE_SETVRREGS: | ||
434 | /* Set the child altivec register state. */ | ||
435 | flush_altivec_to_thread(child); | ||
436 | ret = set_vrregs(child, (unsigned long __user *)data); | ||
437 | break; | ||
438 | #endif | ||
411 | 439 | ||
412 | default: | 440 | default: |
413 | ret = ptrace_request(child, request, addr, data); | 441 | ret = ptrace_request(child, request, addr, data); |
diff --git a/arch/ppc64/kernel/ras.c b/arch/ppc64/kernel/ras.c index 3c00f7bfc1b5..41b97dc9cc0a 100644 --- a/arch/ppc64/kernel/ras.c +++ b/arch/ppc64/kernel/ras.c | |||
@@ -59,8 +59,6 @@ char mce_data_buf[RTAS_ERROR_LOG_MAX] | |||
59 | /* This is true if we are using the firmware NMI handler (typically LPAR) */ | 59 | /* This is true if we are using the firmware NMI handler (typically LPAR) */ |
60 | extern int fwnmi_active; | 60 | extern int fwnmi_active; |
61 | 61 | ||
62 | extern void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); | ||
63 | |||
64 | static int ras_get_sensor_state_token; | 62 | static int ras_get_sensor_state_token; |
65 | static int ras_check_exception_token; | 63 | static int ras_check_exception_token; |
66 | 64 | ||
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c index bfa8791c9807..5ac48bd64891 100644 --- a/arch/ppc64/kernel/setup.c +++ b/arch/ppc64/kernel/setup.c | |||
@@ -1064,8 +1064,6 @@ void __init setup_arch(char **cmdline_p) | |||
1064 | #define PPC64_LINUX_FUNCTION 0x0f000000 | 1064 | #define PPC64_LINUX_FUNCTION 0x0f000000 |
1065 | #define PPC64_IPL_MESSAGE 0xc0000000 | 1065 | #define PPC64_IPL_MESSAGE 0xc0000000 |
1066 | #define PPC64_TERM_MESSAGE 0xb0000000 | 1066 | #define PPC64_TERM_MESSAGE 0xb0000000 |
1067 | #define PPC64_ATTN_MESSAGE 0xa0000000 | ||
1068 | #define PPC64_DUMP_MESSAGE 0xd0000000 | ||
1069 | 1067 | ||
1070 | static void ppc64_do_msg(unsigned int src, const char *msg) | 1068 | static void ppc64_do_msg(unsigned int src, const char *msg) |
1071 | { | 1069 | { |
@@ -1093,20 +1091,6 @@ void ppc64_terminate_msg(unsigned int src, const char *msg) | |||
1093 | printk("[terminate]%04x %s\n", src, msg); | 1091 | printk("[terminate]%04x %s\n", src, msg); |
1094 | } | 1092 | } |
1095 | 1093 | ||
1096 | /* Print something that needs attention (device error, etc) */ | ||
1097 | void ppc64_attention_msg(unsigned int src, const char *msg) | ||
1098 | { | ||
1099 | ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_ATTN_MESSAGE|src, msg); | ||
1100 | printk("[attention]%04x %s\n", src, msg); | ||
1101 | } | ||
1102 | |||
1103 | /* Print a dump progress message. */ | ||
1104 | void ppc64_dump_msg(unsigned int src, const char *msg) | ||
1105 | { | ||
1106 | ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_DUMP_MESSAGE|src, msg); | ||
1107 | printk("[dump]%04x %s\n", src, msg); | ||
1108 | } | ||
1109 | |||
1110 | /* This should only be called on processor 0 during calibrate decr */ | 1094 | /* This should only be called on processor 0 during calibrate decr */ |
1111 | void __init setup_default_decr(void) | 1095 | void __init setup_default_decr(void) |
1112 | { | 1096 | { |
diff --git a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c index 49a79a55c32d..347112cca3c0 100644 --- a/arch/ppc64/kernel/signal.c +++ b/arch/ppc64/kernel/signal.c | |||
@@ -550,6 +550,15 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
550 | /* Whee! Actually deliver the signal. */ | 550 | /* Whee! Actually deliver the signal. */ |
551 | if (TRAP(regs) == 0x0C00) | 551 | if (TRAP(regs) == 0x0C00) |
552 | syscall_restart(regs, &ka); | 552 | syscall_restart(regs, &ka); |
553 | |||
554 | /* | ||
555 | * Reenable the DABR before delivering the signal to | ||
556 | * user space. The DABR will have been cleared if it | ||
557 | * triggered inside the kernel. | ||
558 | */ | ||
559 | if (current->thread.dabr) | ||
560 | set_dabr(current->thread.dabr); | ||
561 | |||
553 | return handle_signal(signr, &ka, &info, oldset, regs); | 562 | return handle_signal(signr, &ka, &info, oldset, regs); |
554 | } | 563 | } |
555 | 564 | ||
diff --git a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c index 46f4d6cc7fc9..a8b7a5a56bb4 100644 --- a/arch/ppc64/kernel/signal32.c +++ b/arch/ppc64/kernel/signal32.c | |||
@@ -970,6 +970,14 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs) | |||
970 | newsp = regs->gpr[1]; | 970 | newsp = regs->gpr[1]; |
971 | newsp &= ~0xfUL; | 971 | newsp &= ~0xfUL; |
972 | 972 | ||
973 | /* | ||
974 | * Reenable the DABR before delivering the signal to | ||
975 | * user space. The DABR will have been cleared if it | ||
976 | * triggered inside the kernel. | ||
977 | */ | ||
978 | if (current->thread.dabr) | ||
979 | set_dabr(current->thread.dabr); | ||
980 | |||
973 | /* Whee! Actually deliver the signal. */ | 981 | /* Whee! Actually deliver the signal. */ |
974 | if (ka.sa.sa_flags & SA_SIGINFO) | 982 | if (ka.sa.sa_flags & SA_SIGINFO) |
975 | ret = handle_rt_signal32(signr, &ka, &info, oldset, regs, newsp); | 983 | ret = handle_rt_signal32(signr, &ka, &info, oldset, regs, newsp); |
diff --git a/arch/ppc64/kernel/xics.c b/arch/ppc64/kernel/xics.c index d9dc6f28d050..daf93885dcfa 100644 --- a/arch/ppc64/kernel/xics.c +++ b/arch/ppc64/kernel/xics.c | |||
@@ -38,7 +38,7 @@ static void xics_mask_and_ack_irq(unsigned int irq); | |||
38 | static void xics_end_irq(unsigned int irq); | 38 | static void xics_end_irq(unsigned int irq); |
39 | static void xics_set_affinity(unsigned int irq_nr, cpumask_t cpumask); | 39 | static void xics_set_affinity(unsigned int irq_nr, cpumask_t cpumask); |
40 | 40 | ||
41 | struct hw_interrupt_type xics_pic = { | 41 | static struct hw_interrupt_type xics_pic = { |
42 | .typename = " XICS ", | 42 | .typename = " XICS ", |
43 | .startup = xics_startup, | 43 | .startup = xics_startup, |
44 | .enable = xics_enable_irq, | 44 | .enable = xics_enable_irq, |
@@ -48,7 +48,7 @@ struct hw_interrupt_type xics_pic = { | |||
48 | .set_affinity = xics_set_affinity | 48 | .set_affinity = xics_set_affinity |
49 | }; | 49 | }; |
50 | 50 | ||
51 | struct hw_interrupt_type xics_8259_pic = { | 51 | static struct hw_interrupt_type xics_8259_pic = { |
52 | .typename = " XICS/8259", | 52 | .typename = " XICS/8259", |
53 | .ack = xics_mask_and_ack_irq, | 53 | .ack = xics_mask_and_ack_irq, |
54 | }; | 54 | }; |
@@ -89,9 +89,8 @@ static struct xics_ipl __iomem *xics_per_cpu[NR_CPUS]; | |||
89 | static int xics_irq_8259_cascade = 0; | 89 | static int xics_irq_8259_cascade = 0; |
90 | static int xics_irq_8259_cascade_real = 0; | 90 | static int xics_irq_8259_cascade_real = 0; |
91 | static unsigned int default_server = 0xFF; | 91 | static unsigned int default_server = 0xFF; |
92 | /* also referenced in smp.c... */ | 92 | static unsigned int default_distrib_server = 0; |
93 | unsigned int default_distrib_server = 0; | 93 | static unsigned int interrupt_server_size = 8; |
94 | unsigned int interrupt_server_size = 8; | ||
95 | 94 | ||
96 | /* | 95 | /* |
97 | * XICS only has a single IPI, so encode the messages per CPU | 96 | * XICS only has a single IPI, so encode the messages per CPU |
@@ -99,10 +98,10 @@ unsigned int interrupt_server_size = 8; | |||
99 | struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; | 98 | struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; |
100 | 99 | ||
101 | /* RTAS service tokens */ | 100 | /* RTAS service tokens */ |
102 | int ibm_get_xive; | 101 | static int ibm_get_xive; |
103 | int ibm_set_xive; | 102 | static int ibm_set_xive; |
104 | int ibm_int_on; | 103 | static int ibm_int_on; |
105 | int ibm_int_off; | 104 | static int ibm_int_off; |
106 | 105 | ||
107 | typedef struct { | 106 | typedef struct { |
108 | int (*xirr_info_get)(int cpu); | 107 | int (*xirr_info_get)(int cpu); |
@@ -284,16 +283,17 @@ static void xics_enable_irq(unsigned int virq) | |||
284 | call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, | 283 | call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, |
285 | DEFAULT_PRIORITY); | 284 | DEFAULT_PRIORITY); |
286 | if (call_status != 0) { | 285 | if (call_status != 0) { |
287 | printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_set_xive " | 286 | printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_set_xive " |
288 | "returned %x\n", irq, call_status); | 287 | "returned %d\n", irq, call_status); |
288 | printk("set_xive %x, server %x\n", ibm_set_xive, server); | ||
289 | return; | 289 | return; |
290 | } | 290 | } |
291 | 291 | ||
292 | /* Now unmask the interrupt (often a no-op) */ | 292 | /* Now unmask the interrupt (often a no-op) */ |
293 | call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq); | 293 | call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq); |
294 | if (call_status != 0) { | 294 | if (call_status != 0) { |
295 | printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_int_on " | 295 | printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_int_on " |
296 | "returned %x\n", irq, call_status); | 296 | "returned %d\n", irq, call_status); |
297 | return; | 297 | return; |
298 | } | 298 | } |
299 | } | 299 | } |
@@ -308,8 +308,8 @@ static void xics_disable_real_irq(unsigned int irq) | |||
308 | 308 | ||
309 | call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq); | 309 | call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq); |
310 | if (call_status != 0) { | 310 | if (call_status != 0) { |
311 | printk(KERN_ERR "xics_disable_real_irq: irq=%d: " | 311 | printk(KERN_ERR "xics_disable_real_irq: irq=%u: " |
312 | "ibm_int_off returned %x\n", irq, call_status); | 312 | "ibm_int_off returned %d\n", irq, call_status); |
313 | return; | 313 | return; |
314 | } | 314 | } |
315 | 315 | ||
@@ -317,8 +317,8 @@ static void xics_disable_real_irq(unsigned int irq) | |||
317 | /* Have to set XIVE to 0xff to be able to remove a slot */ | 317 | /* Have to set XIVE to 0xff to be able to remove a slot */ |
318 | call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff); | 318 | call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff); |
319 | if (call_status != 0) { | 319 | if (call_status != 0) { |
320 | printk(KERN_ERR "xics_disable_irq: irq=%d: ibm_set_xive(0xff)" | 320 | printk(KERN_ERR "xics_disable_irq: irq=%u: ibm_set_xive(0xff)" |
321 | " returned %x\n", irq, call_status); | 321 | " returned %d\n", irq, call_status); |
322 | return; | 322 | return; |
323 | } | 323 | } |
324 | } | 324 | } |
@@ -380,7 +380,7 @@ int xics_get_irq(struct pt_regs *regs) | |||
380 | if (irq == NO_IRQ) | 380 | if (irq == NO_IRQ) |
381 | irq = real_irq_to_virt_slowpath(vec); | 381 | irq = real_irq_to_virt_slowpath(vec); |
382 | if (irq == NO_IRQ) { | 382 | if (irq == NO_IRQ) { |
383 | printk(KERN_ERR "Interrupt %d (real) is invalid," | 383 | printk(KERN_ERR "Interrupt %u (real) is invalid," |
384 | " disabling it.\n", vec); | 384 | " disabling it.\n", vec); |
385 | xics_disable_real_irq(vec); | 385 | xics_disable_real_irq(vec); |
386 | } else | 386 | } else |
@@ -622,7 +622,7 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) | |||
622 | status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); | 622 | status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); |
623 | 623 | ||
624 | if (status) { | 624 | if (status) { |
625 | printk(KERN_ERR "xics_set_affinity: irq=%d ibm,get-xive " | 625 | printk(KERN_ERR "xics_set_affinity: irq=%u ibm,get-xive " |
626 | "returns %d\n", irq, status); | 626 | "returns %d\n", irq, status); |
627 | return; | 627 | return; |
628 | } | 628 | } |
@@ -641,7 +641,7 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) | |||
641 | irq, newmask, xics_status[1]); | 641 | irq, newmask, xics_status[1]); |
642 | 642 | ||
643 | if (status) { | 643 | if (status) { |
644 | printk(KERN_ERR "xics_set_affinity: irq=%d ibm,set-xive " | 644 | printk(KERN_ERR "xics_set_affinity: irq=%u ibm,set-xive " |
645 | "returns %d\n", irq, status); | 645 | "returns %d\n", irq, status); |
646 | return; | 646 | return; |
647 | } | 647 | } |
@@ -720,7 +720,7 @@ void xics_migrate_irqs_away(void) | |||
720 | 720 | ||
721 | status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); | 721 | status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); |
722 | if (status) { | 722 | if (status) { |
723 | printk(KERN_ERR "migrate_irqs_away: irq=%d " | 723 | printk(KERN_ERR "migrate_irqs_away: irq=%u " |
724 | "ibm,get-xive returns %d\n", | 724 | "ibm,get-xive returns %d\n", |
725 | virq, status); | 725 | virq, status); |
726 | goto unlock; | 726 | goto unlock; |
@@ -734,7 +734,7 @@ void xics_migrate_irqs_away(void) | |||
734 | if (xics_status[0] != get_hard_smp_processor_id(cpu)) | 734 | if (xics_status[0] != get_hard_smp_processor_id(cpu)) |
735 | goto unlock; | 735 | goto unlock; |
736 | 736 | ||
737 | printk(KERN_WARNING "IRQ %d affinity broken off cpu %u\n", | 737 | printk(KERN_WARNING "IRQ %u affinity broken off cpu %u\n", |
738 | virq, cpu); | 738 | virq, cpu); |
739 | 739 | ||
740 | /* Reset affinity to all cpus */ | 740 | /* Reset affinity to all cpus */ |
diff --git a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c index 772f0714a5b7..7fbc68bbb739 100644 --- a/arch/ppc64/mm/fault.c +++ b/arch/ppc64/mm/fault.c | |||
@@ -77,6 +77,28 @@ static int store_updates_sp(struct pt_regs *regs) | |||
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
79 | 79 | ||
80 | static void do_dabr(struct pt_regs *regs, unsigned long error_code) | ||
81 | { | ||
82 | siginfo_t info; | ||
83 | |||
84 | if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, | ||
85 | 11, SIGSEGV) == NOTIFY_STOP) | ||
86 | return; | ||
87 | |||
88 | if (debugger_dabr_match(regs)) | ||
89 | return; | ||
90 | |||
91 | /* Clear the DABR */ | ||
92 | set_dabr(0); | ||
93 | |||
94 | /* Deliver the signal to userspace */ | ||
95 | info.si_signo = SIGTRAP; | ||
96 | info.si_errno = 0; | ||
97 | info.si_code = TRAP_HWBKPT; | ||
98 | info.si_addr = (void __user *)regs->nip; | ||
99 | force_sig_info(SIGTRAP, &info, current); | ||
100 | } | ||
101 | |||
80 | /* | 102 | /* |
81 | * The error_code parameter is | 103 | * The error_code parameter is |
82 | * - DSISR for a non-SLB data access fault, | 104 | * - DSISR for a non-SLB data access fault, |
@@ -111,12 +133,9 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address, | |||
111 | if (!user_mode(regs) && (address >= TASK_SIZE)) | 133 | if (!user_mode(regs) && (address >= TASK_SIZE)) |
112 | return SIGSEGV; | 134 | return SIGSEGV; |
113 | 135 | ||
114 | if (error_code & DSISR_DABRMATCH) { | 136 | if (error_code & DSISR_DABRMATCH) { |
115 | if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, | 137 | do_dabr(regs, error_code); |
116 | 11, SIGSEGV) == NOTIFY_STOP) | 138 | return 0; |
117 | return 0; | ||
118 | if (debugger_dabr_match(regs)) | ||
119 | return 0; | ||
120 | } | 139 | } |
121 | 140 | ||
122 | if (in_atomic() || mm == NULL) { | 141 | if (in_atomic() || mm == NULL) { |
diff --git a/arch/ppc64/xmon/privinst.h b/arch/ppc64/xmon/privinst.h index 183c3e400258..02eb40dac0b3 100644 --- a/arch/ppc64/xmon/privinst.h +++ b/arch/ppc64/xmon/privinst.h | |||
@@ -46,7 +46,6 @@ GSETSPR(287, pvr) | |||
46 | GSETSPR(1008, hid0) | 46 | GSETSPR(1008, hid0) |
47 | GSETSPR(1009, hid1) | 47 | GSETSPR(1009, hid1) |
48 | GSETSPR(1010, iabr) | 48 | GSETSPR(1010, iabr) |
49 | GSETSPR(1013, dabr) | ||
50 | GSETSPR(1023, pir) | 49 | GSETSPR(1023, pir) |
51 | 50 | ||
52 | static inline void store_inst(void *p) | 51 | static inline void store_inst(void *p) |
diff --git a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c index 45908b10acd3..74e63a886a69 100644 --- a/arch/ppc64/xmon/xmon.c +++ b/arch/ppc64/xmon/xmon.c | |||
@@ -586,6 +586,8 @@ int xmon_dabr_match(struct pt_regs *regs) | |||
586 | { | 586 | { |
587 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) | 587 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) |
588 | return 0; | 588 | return 0; |
589 | if (dabr.enabled == 0) | ||
590 | return 0; | ||
589 | xmon_core(regs, 0); | 591 | xmon_core(regs, 0); |
590 | return 1; | 592 | return 1; |
591 | } | 593 | } |
@@ -628,20 +630,6 @@ int xmon_fault_handler(struct pt_regs *regs) | |||
628 | return 0; | 630 | return 0; |
629 | } | 631 | } |
630 | 632 | ||
631 | /* On systems with a hypervisor, we can't set the DABR | ||
632 | (data address breakpoint register) directly. */ | ||
633 | static void set_controlled_dabr(unsigned long val) | ||
634 | { | ||
635 | #ifdef CONFIG_PPC_PSERIES | ||
636 | if (systemcfg->platform == PLATFORM_PSERIES_LPAR) { | ||
637 | int rc = plpar_hcall_norets(H_SET_DABR, val); | ||
638 | if (rc != H_Success) | ||
639 | xmon_printf("Warning: setting DABR failed (%d)\n", rc); | ||
640 | } else | ||
641 | #endif | ||
642 | set_dabr(val); | ||
643 | } | ||
644 | |||
645 | static struct bpt *at_breakpoint(unsigned long pc) | 633 | static struct bpt *at_breakpoint(unsigned long pc) |
646 | { | 634 | { |
647 | int i; | 635 | int i; |
@@ -728,7 +716,7 @@ static void insert_bpts(void) | |||
728 | static void insert_cpu_bpts(void) | 716 | static void insert_cpu_bpts(void) |
729 | { | 717 | { |
730 | if (dabr.enabled) | 718 | if (dabr.enabled) |
731 | set_controlled_dabr(dabr.address | (dabr.enabled & 7)); | 719 | set_dabr(dabr.address | (dabr.enabled & 7)); |
732 | if (iabr && cpu_has_feature(CPU_FTR_IABR)) | 720 | if (iabr && cpu_has_feature(CPU_FTR_IABR)) |
733 | set_iabr(iabr->address | 721 | set_iabr(iabr->address |
734 | | (iabr->enabled & (BP_IABR|BP_IABR_TE))); | 722 | | (iabr->enabled & (BP_IABR|BP_IABR_TE))); |
@@ -756,7 +744,7 @@ static void remove_bpts(void) | |||
756 | 744 | ||
757 | static void remove_cpu_bpts(void) | 745 | static void remove_cpu_bpts(void) |
758 | { | 746 | { |
759 | set_controlled_dabr(0); | 747 | set_dabr(0); |
760 | if (cpu_has_feature(CPU_FTR_IABR)) | 748 | if (cpu_has_feature(CPU_FTR_IABR)) |
761 | set_iabr(0); | 749 | set_iabr(0); |
762 | } | 750 | } |
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index 18610cea03a2..ed877d0f27e6 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
@@ -678,7 +678,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size | |||
678 | ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); | 678 | ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); |
679 | set_fs(old_fs); | 679 | set_fs(old_fs); |
680 | 680 | ||
681 | if (!ret && offset && put_user(of, offset)) | 681 | if (offset && put_user(of, offset)) |
682 | return -EFAULT; | 682 | return -EFAULT; |
683 | 683 | ||
684 | return ret; | 684 | return ret; |
diff --git a/arch/x86_64/boot/Makefile b/arch/x86_64/boot/Makefile index f4399c701b77..18c6e915d69b 100644 --- a/arch/x86_64/boot/Makefile +++ b/arch/x86_64/boot/Makefile | |||
@@ -46,7 +46,7 @@ cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \ | |||
46 | $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \ | 46 | $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \ |
47 | $(obj)/vmlinux.bin $(obj)/tools/build FORCE | 47 | $(obj)/vmlinux.bin $(obj)/tools/build FORCE |
48 | $(call if_changed,image) | 48 | $(call if_changed,image) |
49 | @echo 'Kernel: $@ is ready' | 49 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
50 | 50 | ||
51 | $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE | 51 | $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE |
52 | $(call if_changed,objcopy) | 52 | $(call if_changed,objcopy) |
diff --git a/arch/x86_64/boot/compressed/misc.c b/arch/x86_64/boot/compressed/misc.c index b38d5b8b5fb8..0e10fd84c7cc 100644 --- a/arch/x86_64/boot/compressed/misc.c +++ b/arch/x86_64/boot/compressed/misc.c | |||
@@ -83,7 +83,7 @@ static unsigned char *real_mode; /* Pointer to real-mode data */ | |||
83 | #endif | 83 | #endif |
84 | #define SCREEN_INFO (*(struct screen_info *)(real_mode+0)) | 84 | #define SCREEN_INFO (*(struct screen_info *)(real_mode+0)) |
85 | 85 | ||
86 | extern char input_data[]; | 86 | extern unsigned char input_data[]; |
87 | extern int input_len; | 87 | extern int input_len; |
88 | 88 | ||
89 | static long bytes_out = 0; | 89 | static long bytes_out = 0; |
@@ -288,7 +288,7 @@ void setup_normal_output_buffer(void) | |||
288 | #else | 288 | #else |
289 | if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory"); | 289 | if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory"); |
290 | #endif | 290 | #endif |
291 | output_data = (char *)__PHYSICAL_START; /* Normally Points to 1M */ | 291 | output_data = (unsigned char *)__PHYSICAL_START; /* Normally Points to 1M */ |
292 | free_mem_end_ptr = (long)real_mode; | 292 | free_mem_end_ptr = (long)real_mode; |
293 | } | 293 | } |
294 | 294 | ||
@@ -305,7 +305,7 @@ void setup_output_buffer_if_we_run_high(struct moveparams *mv) | |||
305 | #else | 305 | #else |
306 | if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory"); | 306 | if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory"); |
307 | #endif | 307 | #endif |
308 | mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; | 308 | mv->low_buffer_start = output_data = (unsigned char *)LOW_BUFFER_START; |
309 | low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX | 309 | low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX |
310 | ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff; | 310 | ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff; |
311 | low_buffer_size = low_buffer_end - LOW_BUFFER_START; | 311 | low_buffer_size = low_buffer_end - LOW_BUFFER_START; |
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig index bf57e2362bf4..f8db7e500fbf 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86_64/defconfig | |||
@@ -1,11 +1,12 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.13-rc6-git3 | 3 | # Linux kernel version: 2.6.13-git11 |
4 | # Fri Aug 12 16:40:34 2005 | 4 | # Mon Sep 12 16:16:16 2005 |
5 | # | 5 | # |
6 | CONFIG_X86_64=y | 6 | CONFIG_X86_64=y |
7 | CONFIG_64BIT=y | 7 | CONFIG_64BIT=y |
8 | CONFIG_X86=y | 8 | CONFIG_X86=y |
9 | CONFIG_SEMAPHORE_SLEEPERS=y | ||
9 | CONFIG_MMU=y | 10 | CONFIG_MMU=y |
10 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | 11 | CONFIG_RWSEM_GENERIC_SPINLOCK=y |
11 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 12 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
@@ -13,6 +14,7 @@ CONFIG_X86_CMPXCHG=y | |||
13 | CONFIG_EARLY_PRINTK=y | 14 | CONFIG_EARLY_PRINTK=y |
14 | CONFIG_GENERIC_ISA_DMA=y | 15 | CONFIG_GENERIC_ISA_DMA=y |
15 | CONFIG_GENERIC_IOMAP=y | 16 | CONFIG_GENERIC_IOMAP=y |
17 | CONFIG_ARCH_MAY_HAVE_PC_FDC=y | ||
16 | 18 | ||
17 | # | 19 | # |
18 | # Code maturity level options | 20 | # Code maturity level options |
@@ -26,6 +28,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32 | |||
26 | # General setup | 28 | # General setup |
27 | # | 29 | # |
28 | CONFIG_LOCALVERSION="" | 30 | CONFIG_LOCALVERSION="" |
31 | CONFIG_LOCALVERSION_AUTO=y | ||
29 | CONFIG_SWAP=y | 32 | CONFIG_SWAP=y |
30 | CONFIG_SYSVIPC=y | 33 | CONFIG_SYSVIPC=y |
31 | CONFIG_POSIX_MQUEUE=y | 34 | CONFIG_POSIX_MQUEUE=y |
@@ -37,6 +40,7 @@ CONFIG_KOBJECT_UEVENT=y | |||
37 | CONFIG_IKCONFIG=y | 40 | CONFIG_IKCONFIG=y |
38 | CONFIG_IKCONFIG_PROC=y | 41 | CONFIG_IKCONFIG_PROC=y |
39 | # CONFIG_CPUSETS is not set | 42 | # CONFIG_CPUSETS is not set |
43 | CONFIG_INITRAMFS_SOURCE="" | ||
40 | # CONFIG_EMBEDDED is not set | 44 | # CONFIG_EMBEDDED is not set |
41 | CONFIG_KALLSYMS=y | 45 | CONFIG_KALLSYMS=y |
42 | CONFIG_KALLSYMS_ALL=y | 46 | CONFIG_KALLSYMS_ALL=y |
@@ -102,6 +106,7 @@ CONFIG_DISCONTIGMEM_MANUAL=y | |||
102 | CONFIG_DISCONTIGMEM=y | 106 | CONFIG_DISCONTIGMEM=y |
103 | CONFIG_FLAT_NODE_MEM_MAP=y | 107 | CONFIG_FLAT_NODE_MEM_MAP=y |
104 | CONFIG_NEED_MULTIPLE_NODES=y | 108 | CONFIG_NEED_MULTIPLE_NODES=y |
109 | # CONFIG_SPARSEMEM_STATIC is not set | ||
105 | CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y | 110 | CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y |
106 | CONFIG_HAVE_DEC_LOCK=y | 111 | CONFIG_HAVE_DEC_LOCK=y |
107 | CONFIG_NR_CPUS=32 | 112 | CONFIG_NR_CPUS=32 |
@@ -122,6 +127,7 @@ CONFIG_HZ=250 | |||
122 | CONFIG_GENERIC_HARDIRQS=y | 127 | CONFIG_GENERIC_HARDIRQS=y |
123 | CONFIG_GENERIC_IRQ_PROBE=y | 128 | CONFIG_GENERIC_IRQ_PROBE=y |
124 | CONFIG_ISA_DMA_API=y | 129 | CONFIG_ISA_DMA_API=y |
130 | CONFIG_GENERIC_PENDING_IRQ=y | ||
125 | 131 | ||
126 | # | 132 | # |
127 | # Power management options | 133 | # Power management options |
@@ -194,7 +200,6 @@ CONFIG_UNORDERED_IO=y | |||
194 | # CONFIG_PCIEPORTBUS is not set | 200 | # CONFIG_PCIEPORTBUS is not set |
195 | CONFIG_PCI_MSI=y | 201 | CONFIG_PCI_MSI=y |
196 | # CONFIG_PCI_LEGACY_PROC is not set | 202 | # CONFIG_PCI_LEGACY_PROC is not set |
197 | # CONFIG_PCI_NAMES is not set | ||
198 | # CONFIG_PCI_DEBUG is not set | 203 | # CONFIG_PCI_DEBUG is not set |
199 | 204 | ||
200 | # | 205 | # |
@@ -234,7 +239,10 @@ CONFIG_INET=y | |||
234 | CONFIG_IP_MULTICAST=y | 239 | CONFIG_IP_MULTICAST=y |
235 | # CONFIG_IP_ADVANCED_ROUTER is not set | 240 | # CONFIG_IP_ADVANCED_ROUTER is not set |
236 | CONFIG_IP_FIB_HASH=y | 241 | CONFIG_IP_FIB_HASH=y |
237 | # CONFIG_IP_PNP is not set | 242 | CONFIG_IP_PNP=y |
243 | CONFIG_IP_PNP_DHCP=y | ||
244 | # CONFIG_IP_PNP_BOOTP is not set | ||
245 | # CONFIG_IP_PNP_RARP is not set | ||
238 | # CONFIG_NET_IPIP is not set | 246 | # CONFIG_NET_IPIP is not set |
239 | # CONFIG_NET_IPGRE is not set | 247 | # CONFIG_NET_IPGRE is not set |
240 | # CONFIG_IP_MROUTE is not set | 248 | # CONFIG_IP_MROUTE is not set |
@@ -244,8 +252,8 @@ CONFIG_IP_FIB_HASH=y | |||
244 | # CONFIG_INET_ESP is not set | 252 | # CONFIG_INET_ESP is not set |
245 | # CONFIG_INET_IPCOMP is not set | 253 | # CONFIG_INET_IPCOMP is not set |
246 | # CONFIG_INET_TUNNEL is not set | 254 | # CONFIG_INET_TUNNEL is not set |
247 | CONFIG_IP_TCPDIAG=y | 255 | CONFIG_INET_DIAG=y |
248 | CONFIG_IP_TCPDIAG_IPV6=y | 256 | CONFIG_INET_TCP_DIAG=y |
249 | # CONFIG_TCP_CONG_ADVANCED is not set | 257 | # CONFIG_TCP_CONG_ADVANCED is not set |
250 | CONFIG_TCP_CONG_BIC=y | 258 | CONFIG_TCP_CONG_BIC=y |
251 | CONFIG_IPV6=y | 259 | CONFIG_IPV6=y |
@@ -258,6 +266,11 @@ CONFIG_IPV6=y | |||
258 | # CONFIG_NETFILTER is not set | 266 | # CONFIG_NETFILTER is not set |
259 | 267 | ||
260 | # | 268 | # |
269 | # DCCP Configuration (EXPERIMENTAL) | ||
270 | # | ||
271 | # CONFIG_IP_DCCP is not set | ||
272 | |||
273 | # | ||
261 | # SCTP Configuration (EXPERIMENTAL) | 274 | # SCTP Configuration (EXPERIMENTAL) |
262 | # | 275 | # |
263 | # CONFIG_IP_SCTP is not set | 276 | # CONFIG_IP_SCTP is not set |
@@ -280,9 +293,11 @@ CONFIG_IPV6=y | |||
280 | # Network testing | 293 | # Network testing |
281 | # | 294 | # |
282 | # CONFIG_NET_PKTGEN is not set | 295 | # CONFIG_NET_PKTGEN is not set |
296 | # CONFIG_NETFILTER_NETLINK is not set | ||
283 | # CONFIG_HAMRADIO is not set | 297 | # CONFIG_HAMRADIO is not set |
284 | # CONFIG_IRDA is not set | 298 | # CONFIG_IRDA is not set |
285 | # CONFIG_BT is not set | 299 | # CONFIG_BT is not set |
300 | # CONFIG_IEEE80211 is not set | ||
286 | 301 | ||
287 | # | 302 | # |
288 | # Device Drivers | 303 | # Device Drivers |
@@ -329,7 +344,6 @@ CONFIG_BLK_DEV_RAM=y | |||
329 | CONFIG_BLK_DEV_RAM_COUNT=16 | 344 | CONFIG_BLK_DEV_RAM_COUNT=16 |
330 | CONFIG_BLK_DEV_RAM_SIZE=4096 | 345 | CONFIG_BLK_DEV_RAM_SIZE=4096 |
331 | CONFIG_BLK_DEV_INITRD=y | 346 | CONFIG_BLK_DEV_INITRD=y |
332 | CONFIG_INITRAMFS_SOURCE="" | ||
333 | CONFIG_LBD=y | 347 | CONFIG_LBD=y |
334 | # CONFIG_CDROM_PKTCDVD is not set | 348 | # CONFIG_CDROM_PKTCDVD is not set |
335 | 349 | ||
@@ -409,6 +423,7 @@ CONFIG_IDEDMA_AUTO=y | |||
409 | # | 423 | # |
410 | # SCSI device support | 424 | # SCSI device support |
411 | # | 425 | # |
426 | # CONFIG_RAID_ATTRS is not set | ||
412 | CONFIG_SCSI=y | 427 | CONFIG_SCSI=y |
413 | # CONFIG_SCSI_PROC_FS is not set | 428 | # CONFIG_SCSI_PROC_FS is not set |
414 | 429 | ||
@@ -432,7 +447,7 @@ CONFIG_BLK_DEV_SD=y | |||
432 | # | 447 | # |
433 | # SCSI Transport Attributes | 448 | # SCSI Transport Attributes |
434 | # | 449 | # |
435 | # CONFIG_SCSI_SPI_ATTRS is not set | 450 | CONFIG_SCSI_SPI_ATTRS=y |
436 | # CONFIG_SCSI_FC_ATTRS is not set | 451 | # CONFIG_SCSI_FC_ATTRS is not set |
437 | # CONFIG_SCSI_ISCSI_ATTRS is not set | 452 | # CONFIG_SCSI_ISCSI_ATTRS is not set |
438 | 453 | ||
@@ -458,6 +473,7 @@ CONFIG_SCSI_SATA=y | |||
458 | # CONFIG_SCSI_SATA_AHCI is not set | 473 | # CONFIG_SCSI_SATA_AHCI is not set |
459 | # CONFIG_SCSI_SATA_SVW is not set | 474 | # CONFIG_SCSI_SATA_SVW is not set |
460 | CONFIG_SCSI_ATA_PIIX=y | 475 | CONFIG_SCSI_ATA_PIIX=y |
476 | # CONFIG_SCSI_SATA_MV is not set | ||
461 | # CONFIG_SCSI_SATA_NV is not set | 477 | # CONFIG_SCSI_SATA_NV is not set |
462 | # CONFIG_SCSI_SATA_PROMISE is not set | 478 | # CONFIG_SCSI_SATA_PROMISE is not set |
463 | # CONFIG_SCSI_SATA_QSTOR is not set | 479 | # CONFIG_SCSI_SATA_QSTOR is not set |
@@ -537,6 +553,11 @@ CONFIG_TUN=y | |||
537 | # CONFIG_ARCNET is not set | 553 | # CONFIG_ARCNET is not set |
538 | 554 | ||
539 | # | 555 | # |
556 | # PHY device support | ||
557 | # | ||
558 | # CONFIG_PHYLIB is not set | ||
559 | |||
560 | # | ||
540 | # Ethernet (10 or 100Mbit) | 561 | # Ethernet (10 or 100Mbit) |
541 | # | 562 | # |
542 | CONFIG_NET_ETHERNET=y | 563 | CONFIG_NET_ETHERNET=y |
@@ -586,6 +607,7 @@ CONFIG_E1000=y | |||
586 | # CONFIG_HAMACHI is not set | 607 | # CONFIG_HAMACHI is not set |
587 | # CONFIG_YELLOWFIN is not set | 608 | # CONFIG_YELLOWFIN is not set |
588 | # CONFIG_R8169 is not set | 609 | # CONFIG_R8169 is not set |
610 | # CONFIG_SIS190 is not set | ||
589 | # CONFIG_SKGE is not set | 611 | # CONFIG_SKGE is not set |
590 | # CONFIG_SK98LIN is not set | 612 | # CONFIG_SK98LIN is not set |
591 | # CONFIG_VIA_VELOCITY is not set | 613 | # CONFIG_VIA_VELOCITY is not set |
@@ -595,6 +617,7 @@ CONFIG_TIGON3=y | |||
595 | # | 617 | # |
596 | # Ethernet (10000 Mbit) | 618 | # Ethernet (10000 Mbit) |
597 | # | 619 | # |
620 | # CONFIG_CHELSIO_T1 is not set | ||
598 | # CONFIG_IXGB is not set | 621 | # CONFIG_IXGB is not set |
599 | CONFIG_S2IO=m | 622 | CONFIG_S2IO=m |
600 | # CONFIG_S2IO_NAPI is not set | 623 | # CONFIG_S2IO_NAPI is not set |
@@ -749,7 +772,6 @@ CONFIG_MAX_RAW_DEVS=256 | |||
749 | # I2C support | 772 | # I2C support |
750 | # | 773 | # |
751 | # CONFIG_I2C is not set | 774 | # CONFIG_I2C is not set |
752 | # CONFIG_I2C_SENSOR is not set | ||
753 | 775 | ||
754 | # | 776 | # |
755 | # Dallas's 1-wire bus | 777 | # Dallas's 1-wire bus |
@@ -760,6 +782,7 @@ CONFIG_MAX_RAW_DEVS=256 | |||
760 | # Hardware Monitoring support | 782 | # Hardware Monitoring support |
761 | # | 783 | # |
762 | CONFIG_HWMON=y | 784 | CONFIG_HWMON=y |
785 | # CONFIG_HWMON_VID is not set | ||
763 | # CONFIG_HWMON_DEBUG_CHIP is not set | 786 | # CONFIG_HWMON_DEBUG_CHIP is not set |
764 | 787 | ||
765 | # | 788 | # |
@@ -768,6 +791,10 @@ CONFIG_HWMON=y | |||
768 | # CONFIG_IBM_ASM is not set | 791 | # CONFIG_IBM_ASM is not set |
769 | 792 | ||
770 | # | 793 | # |
794 | # Multimedia Capabilities Port drivers | ||
795 | # | ||
796 | |||
797 | # | ||
771 | # Multimedia devices | 798 | # Multimedia devices |
772 | # | 799 | # |
773 | # CONFIG_VIDEO_DEV is not set | 800 | # CONFIG_VIDEO_DEV is not set |
@@ -858,9 +885,8 @@ CONFIG_USB_UHCI_HCD=y | |||
858 | # | 885 | # |
859 | # USB Device Class drivers | 886 | # USB Device Class drivers |
860 | # | 887 | # |
861 | # CONFIG_USB_AUDIO is not set | 888 | # CONFIG_OBSOLETE_OSS_USB_DRIVER is not set |
862 | # CONFIG_USB_BLUETOOTH_TTY is not set | 889 | # CONFIG_USB_BLUETOOTH_TTY is not set |
863 | # CONFIG_USB_MIDI is not set | ||
864 | # CONFIG_USB_ACM is not set | 890 | # CONFIG_USB_ACM is not set |
865 | CONFIG_USB_PRINTER=y | 891 | CONFIG_USB_PRINTER=y |
866 | 892 | ||
@@ -877,6 +903,7 @@ CONFIG_USB_STORAGE=y | |||
877 | # CONFIG_USB_STORAGE_SDDR09 is not set | 903 | # CONFIG_USB_STORAGE_SDDR09 is not set |
878 | # CONFIG_USB_STORAGE_SDDR55 is not set | 904 | # CONFIG_USB_STORAGE_SDDR55 is not set |
879 | # CONFIG_USB_STORAGE_JUMPSHOT is not set | 905 | # CONFIG_USB_STORAGE_JUMPSHOT is not set |
906 | # CONFIG_USB_STORAGE_ONETOUCH is not set | ||
880 | 907 | ||
881 | # | 908 | # |
882 | # USB Input Devices | 909 | # USB Input Devices |
@@ -893,6 +920,7 @@ CONFIG_USB_HIDINPUT=y | |||
893 | # CONFIG_USB_MTOUCH is not set | 920 | # CONFIG_USB_MTOUCH is not set |
894 | # CONFIG_USB_ITMTOUCH is not set | 921 | # CONFIG_USB_ITMTOUCH is not set |
895 | # CONFIG_USB_EGALAX is not set | 922 | # CONFIG_USB_EGALAX is not set |
923 | # CONFIG_USB_YEALINK is not set | ||
896 | # CONFIG_USB_XPAD is not set | 924 | # CONFIG_USB_XPAD is not set |
897 | # CONFIG_USB_ATI_REMOTE is not set | 925 | # CONFIG_USB_ATI_REMOTE is not set |
898 | # CONFIG_USB_KEYSPAN_REMOTE is not set | 926 | # CONFIG_USB_KEYSPAN_REMOTE is not set |
@@ -976,6 +1004,8 @@ CONFIG_USB_MON=y | |||
976 | # Firmware Drivers | 1004 | # Firmware Drivers |
977 | # | 1005 | # |
978 | # CONFIG_EDD is not set | 1006 | # CONFIG_EDD is not set |
1007 | # CONFIG_DELL_RBU is not set | ||
1008 | CONFIG_DCDBAS=m | ||
979 | 1009 | ||
980 | # | 1010 | # |
981 | # File systems | 1011 | # File systems |
@@ -1000,10 +1030,6 @@ CONFIG_REISERFS_FS_POSIX_ACL=y | |||
1000 | # CONFIG_REISERFS_FS_SECURITY is not set | 1030 | # CONFIG_REISERFS_FS_SECURITY is not set |
1001 | # CONFIG_JFS_FS is not set | 1031 | # CONFIG_JFS_FS is not set |
1002 | CONFIG_FS_POSIX_ACL=y | 1032 | CONFIG_FS_POSIX_ACL=y |
1003 | |||
1004 | # | ||
1005 | # XFS support | ||
1006 | # | ||
1007 | # CONFIG_XFS_FS is not set | 1033 | # CONFIG_XFS_FS is not set |
1008 | # CONFIG_MINIX_FS is not set | 1034 | # CONFIG_MINIX_FS is not set |
1009 | # CONFIG_ROMFS_FS is not set | 1035 | # CONFIG_ROMFS_FS is not set |
@@ -1012,6 +1038,7 @@ CONFIG_INOTIFY=y | |||
1012 | CONFIG_DNOTIFY=y | 1038 | CONFIG_DNOTIFY=y |
1013 | CONFIG_AUTOFS_FS=y | 1039 | CONFIG_AUTOFS_FS=y |
1014 | # CONFIG_AUTOFS4_FS is not set | 1040 | # CONFIG_AUTOFS4_FS is not set |
1041 | # CONFIG_FUSE_FS is not set | ||
1015 | 1042 | ||
1016 | # | 1043 | # |
1017 | # CD-ROM/DVD Filesystems | 1044 | # CD-ROM/DVD Filesystems |
@@ -1037,12 +1064,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" | |||
1037 | CONFIG_PROC_FS=y | 1064 | CONFIG_PROC_FS=y |
1038 | CONFIG_PROC_KCORE=y | 1065 | CONFIG_PROC_KCORE=y |
1039 | CONFIG_SYSFS=y | 1066 | CONFIG_SYSFS=y |
1040 | # CONFIG_DEVPTS_FS_XATTR is not set | ||
1041 | CONFIG_TMPFS=y | 1067 | CONFIG_TMPFS=y |
1042 | # CONFIG_TMPFS_XATTR is not set | ||
1043 | CONFIG_HUGETLBFS=y | 1068 | CONFIG_HUGETLBFS=y |
1044 | CONFIG_HUGETLB_PAGE=y | 1069 | CONFIG_HUGETLB_PAGE=y |
1045 | CONFIG_RAMFS=y | 1070 | CONFIG_RAMFS=y |
1071 | # CONFIG_RELAYFS_FS is not set | ||
1046 | 1072 | ||
1047 | # | 1073 | # |
1048 | # Miscellaneous filesystems | 1074 | # Miscellaneous filesystems |
@@ -1074,6 +1100,7 @@ CONFIG_NFSD_V3=y | |||
1074 | # CONFIG_NFSD_V3_ACL is not set | 1100 | # CONFIG_NFSD_V3_ACL is not set |
1075 | # CONFIG_NFSD_V4 is not set | 1101 | # CONFIG_NFSD_V4 is not set |
1076 | CONFIG_NFSD_TCP=y | 1102 | CONFIG_NFSD_TCP=y |
1103 | CONFIG_ROOT_NFS=y | ||
1077 | CONFIG_LOCKD=y | 1104 | CONFIG_LOCKD=y |
1078 | CONFIG_LOCKD_V4=y | 1105 | CONFIG_LOCKD_V4=y |
1079 | CONFIG_EXPORTFS=y | 1106 | CONFIG_EXPORTFS=y |
@@ -1086,6 +1113,7 @@ CONFIG_SUNRPC=y | |||
1086 | # CONFIG_NCP_FS is not set | 1113 | # CONFIG_NCP_FS is not set |
1087 | # CONFIG_CODA_FS is not set | 1114 | # CONFIG_CODA_FS is not set |
1088 | # CONFIG_AFS_FS is not set | 1115 | # CONFIG_AFS_FS is not set |
1116 | # CONFIG_9P_FS is not set | ||
1089 | 1117 | ||
1090 | # | 1118 | # |
1091 | # Partition Types | 1119 | # Partition Types |
@@ -1150,6 +1178,7 @@ CONFIG_OPROFILE=y | |||
1150 | CONFIG_DEBUG_KERNEL=y | 1178 | CONFIG_DEBUG_KERNEL=y |
1151 | CONFIG_MAGIC_SYSRQ=y | 1179 | CONFIG_MAGIC_SYSRQ=y |
1152 | CONFIG_LOG_BUF_SHIFT=18 | 1180 | CONFIG_LOG_BUF_SHIFT=18 |
1181 | CONFIG_DETECT_SOFTLOCKUP=y | ||
1153 | # CONFIG_SCHEDSTATS is not set | 1182 | # CONFIG_SCHEDSTATS is not set |
1154 | # CONFIG_DEBUG_SLAB is not set | 1183 | # CONFIG_DEBUG_SLAB is not set |
1155 | # CONFIG_DEBUG_SPINLOCK is not set | 1184 | # CONFIG_DEBUG_SPINLOCK is not set |
@@ -1157,6 +1186,7 @@ CONFIG_LOG_BUF_SHIFT=18 | |||
1157 | # CONFIG_DEBUG_KOBJECT is not set | 1186 | # CONFIG_DEBUG_KOBJECT is not set |
1158 | # CONFIG_DEBUG_INFO is not set | 1187 | # CONFIG_DEBUG_INFO is not set |
1159 | CONFIG_DEBUG_FS=y | 1188 | CONFIG_DEBUG_FS=y |
1189 | # CONFIG_FRAME_POINTER is not set | ||
1160 | CONFIG_INIT_DEBUG=y | 1190 | CONFIG_INIT_DEBUG=y |
1161 | # CONFIG_IOMMU_DEBUG is not set | 1191 | # CONFIG_IOMMU_DEBUG is not set |
1162 | CONFIG_KPROBES=y | 1192 | CONFIG_KPROBES=y |
@@ -1180,5 +1210,6 @@ CONFIG_KPROBES=y | |||
1180 | # Library routines | 1210 | # Library routines |
1181 | # | 1211 | # |
1182 | # CONFIG_CRC_CCITT is not set | 1212 | # CONFIG_CRC_CCITT is not set |
1213 | # CONFIG_CRC16 is not set | ||
1183 | CONFIG_CRC32=y | 1214 | CONFIG_CRC32=y |
1184 | # CONFIG_LIBCRC32C is not set | 1215 | # CONFIG_LIBCRC32C is not set |
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S index 5244f803203d..e0eb0c712fe9 100644 --- a/arch/x86_64/ia32/ia32entry.S +++ b/arch/x86_64/ia32/ia32entry.S | |||
@@ -55,20 +55,34 @@ | |||
55 | * with the int 0x80 path. | 55 | * with the int 0x80 path. |
56 | */ | 56 | */ |
57 | ENTRY(ia32_sysenter_target) | 57 | ENTRY(ia32_sysenter_target) |
58 | CFI_STARTPROC | 58 | CFI_STARTPROC simple |
59 | CFI_DEF_CFA rsp,0 | ||
60 | CFI_REGISTER rsp,rbp | ||
59 | swapgs | 61 | swapgs |
60 | movq %gs:pda_kernelstack, %rsp | 62 | movq %gs:pda_kernelstack, %rsp |
61 | addq $(PDA_STACKOFFSET),%rsp | 63 | addq $(PDA_STACKOFFSET),%rsp |
62 | sti | 64 | sti |
63 | movl %ebp,%ebp /* zero extension */ | 65 | movl %ebp,%ebp /* zero extension */ |
64 | pushq $__USER32_DS | 66 | pushq $__USER32_DS |
67 | CFI_ADJUST_CFA_OFFSET 8 | ||
68 | /*CFI_REL_OFFSET ss,0*/ | ||
65 | pushq %rbp | 69 | pushq %rbp |
70 | CFI_ADJUST_CFA_OFFSET 8 | ||
71 | CFI_REL_OFFSET rsp,0 | ||
66 | pushfq | 72 | pushfq |
73 | CFI_ADJUST_CFA_OFFSET 8 | ||
74 | /*CFI_REL_OFFSET rflags,0*/ | ||
67 | movl $VSYSCALL32_SYSEXIT, %r10d | 75 | movl $VSYSCALL32_SYSEXIT, %r10d |
76 | CFI_REGISTER rip,r10 | ||
68 | pushq $__USER32_CS | 77 | pushq $__USER32_CS |
78 | CFI_ADJUST_CFA_OFFSET 8 | ||
79 | /*CFI_REL_OFFSET cs,0*/ | ||
69 | movl %eax, %eax | 80 | movl %eax, %eax |
70 | pushq %r10 | 81 | pushq %r10 |
82 | CFI_ADJUST_CFA_OFFSET 8 | ||
83 | CFI_REL_OFFSET rip,0 | ||
71 | pushq %rax | 84 | pushq %rax |
85 | CFI_ADJUST_CFA_OFFSET 8 | ||
72 | cld | 86 | cld |
73 | SAVE_ARGS 0,0,1 | 87 | SAVE_ARGS 0,0,1 |
74 | /* no need to do an access_ok check here because rbp has been | 88 | /* no need to do an access_ok check here because rbp has been |
@@ -79,6 +93,7 @@ ENTRY(ia32_sysenter_target) | |||
79 | .previous | 93 | .previous |
80 | GET_THREAD_INFO(%r10) | 94 | GET_THREAD_INFO(%r10) |
81 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) | 95 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
96 | CFI_REMEMBER_STATE | ||
82 | jnz sysenter_tracesys | 97 | jnz sysenter_tracesys |
83 | sysenter_do_call: | 98 | sysenter_do_call: |
84 | cmpl $(IA32_NR_syscalls),%eax | 99 | cmpl $(IA32_NR_syscalls),%eax |
@@ -94,14 +109,20 @@ sysenter_do_call: | |||
94 | andl $~0x200,EFLAGS-R11(%rsp) | 109 | andl $~0x200,EFLAGS-R11(%rsp) |
95 | RESTORE_ARGS 1,24,1,1,1,1 | 110 | RESTORE_ARGS 1,24,1,1,1,1 |
96 | popfq | 111 | popfq |
112 | CFI_ADJUST_CFA_OFFSET -8 | ||
113 | /*CFI_RESTORE rflags*/ | ||
97 | popq %rcx /* User %esp */ | 114 | popq %rcx /* User %esp */ |
115 | CFI_ADJUST_CFA_OFFSET -8 | ||
116 | CFI_REGISTER rsp,rcx | ||
98 | movl $VSYSCALL32_SYSEXIT,%edx /* User %eip */ | 117 | movl $VSYSCALL32_SYSEXIT,%edx /* User %eip */ |
118 | CFI_REGISTER rip,rdx | ||
99 | swapgs | 119 | swapgs |
100 | sti /* sti only takes effect after the next instruction */ | 120 | sti /* sti only takes effect after the next instruction */ |
101 | /* sysexit */ | 121 | /* sysexit */ |
102 | .byte 0xf, 0x35 | 122 | .byte 0xf, 0x35 |
103 | 123 | ||
104 | sysenter_tracesys: | 124 | sysenter_tracesys: |
125 | CFI_RESTORE_STATE | ||
105 | SAVE_REST | 126 | SAVE_REST |
106 | CLEAR_RREGS | 127 | CLEAR_RREGS |
107 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ | 128 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ |
@@ -140,21 +161,28 @@ sysenter_tracesys: | |||
140 | * with the int 0x80 path. | 161 | * with the int 0x80 path. |
141 | */ | 162 | */ |
142 | ENTRY(ia32_cstar_target) | 163 | ENTRY(ia32_cstar_target) |
143 | CFI_STARTPROC | 164 | CFI_STARTPROC simple |
165 | CFI_DEF_CFA rsp,0 | ||
166 | CFI_REGISTER rip,rcx | ||
167 | /*CFI_REGISTER rflags,r11*/ | ||
144 | swapgs | 168 | swapgs |
145 | movl %esp,%r8d | 169 | movl %esp,%r8d |
170 | CFI_REGISTER rsp,r8 | ||
146 | movq %gs:pda_kernelstack,%rsp | 171 | movq %gs:pda_kernelstack,%rsp |
147 | sti | 172 | sti |
148 | SAVE_ARGS 8,1,1 | 173 | SAVE_ARGS 8,1,1 |
149 | movl %eax,%eax /* zero extension */ | 174 | movl %eax,%eax /* zero extension */ |
150 | movq %rax,ORIG_RAX-ARGOFFSET(%rsp) | 175 | movq %rax,ORIG_RAX-ARGOFFSET(%rsp) |
151 | movq %rcx,RIP-ARGOFFSET(%rsp) | 176 | movq %rcx,RIP-ARGOFFSET(%rsp) |
177 | CFI_REL_OFFSET rip,RIP-ARGOFFSET | ||
152 | movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */ | 178 | movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */ |
153 | movl %ebp,%ecx | 179 | movl %ebp,%ecx |
154 | movq $__USER32_CS,CS-ARGOFFSET(%rsp) | 180 | movq $__USER32_CS,CS-ARGOFFSET(%rsp) |
155 | movq $__USER32_DS,SS-ARGOFFSET(%rsp) | 181 | movq $__USER32_DS,SS-ARGOFFSET(%rsp) |
156 | movq %r11,EFLAGS-ARGOFFSET(%rsp) | 182 | movq %r11,EFLAGS-ARGOFFSET(%rsp) |
183 | /*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/ | ||
157 | movq %r8,RSP-ARGOFFSET(%rsp) | 184 | movq %r8,RSP-ARGOFFSET(%rsp) |
185 | CFI_REL_OFFSET rsp,RSP-ARGOFFSET | ||
158 | /* no need to do an access_ok check here because r8 has been | 186 | /* no need to do an access_ok check here because r8 has been |
159 | 32bit zero extended */ | 187 | 32bit zero extended */ |
160 | /* hardware stack frame is complete now */ | 188 | /* hardware stack frame is complete now */ |
@@ -164,6 +192,7 @@ ENTRY(ia32_cstar_target) | |||
164 | .previous | 192 | .previous |
165 | GET_THREAD_INFO(%r10) | 193 | GET_THREAD_INFO(%r10) |
166 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) | 194 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
195 | CFI_REMEMBER_STATE | ||
167 | jnz cstar_tracesys | 196 | jnz cstar_tracesys |
168 | cstar_do_call: | 197 | cstar_do_call: |
169 | cmpl $IA32_NR_syscalls,%eax | 198 | cmpl $IA32_NR_syscalls,%eax |
@@ -177,12 +206,16 @@ cstar_do_call: | |||
177 | jnz int_ret_from_sys_call | 206 | jnz int_ret_from_sys_call |
178 | RESTORE_ARGS 1,-ARG_SKIP,1,1,1 | 207 | RESTORE_ARGS 1,-ARG_SKIP,1,1,1 |
179 | movl RIP-ARGOFFSET(%rsp),%ecx | 208 | movl RIP-ARGOFFSET(%rsp),%ecx |
209 | CFI_REGISTER rip,rcx | ||
180 | movl EFLAGS-ARGOFFSET(%rsp),%r11d | 210 | movl EFLAGS-ARGOFFSET(%rsp),%r11d |
211 | /*CFI_REGISTER rflags,r11*/ | ||
181 | movl RSP-ARGOFFSET(%rsp),%esp | 212 | movl RSP-ARGOFFSET(%rsp),%esp |
213 | CFI_RESTORE rsp | ||
182 | swapgs | 214 | swapgs |
183 | sysretl | 215 | sysretl |
184 | 216 | ||
185 | cstar_tracesys: | 217 | cstar_tracesys: |
218 | CFI_RESTORE_STATE | ||
186 | SAVE_REST | 219 | SAVE_REST |
187 | CLEAR_RREGS | 220 | CLEAR_RREGS |
188 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ | 221 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ |
@@ -226,11 +259,18 @@ ia32_badarg: | |||
226 | */ | 259 | */ |
227 | 260 | ||
228 | ENTRY(ia32_syscall) | 261 | ENTRY(ia32_syscall) |
229 | CFI_STARTPROC | 262 | CFI_STARTPROC simple |
263 | CFI_DEF_CFA rsp,SS+8-RIP | ||
264 | /*CFI_REL_OFFSET ss,SS-RIP*/ | ||
265 | CFI_REL_OFFSET rsp,RSP-RIP | ||
266 | /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/ | ||
267 | /*CFI_REL_OFFSET cs,CS-RIP*/ | ||
268 | CFI_REL_OFFSET rip,RIP-RIP | ||
230 | swapgs | 269 | swapgs |
231 | sti | 270 | sti |
232 | movl %eax,%eax | 271 | movl %eax,%eax |
233 | pushq %rax | 272 | pushq %rax |
273 | CFI_ADJUST_CFA_OFFSET 8 | ||
234 | cld | 274 | cld |
235 | /* note the registers are not zero extended to the sf. | 275 | /* note the registers are not zero extended to the sf. |
236 | this could be a problem. */ | 276 | this could be a problem. */ |
@@ -278,6 +318,8 @@ quiet_ni_syscall: | |||
278 | jmp ia32_ptregs_common | 318 | jmp ia32_ptregs_common |
279 | .endm | 319 | .endm |
280 | 320 | ||
321 | CFI_STARTPROC | ||
322 | |||
281 | PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi | 323 | PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi |
282 | PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi | 324 | PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi |
283 | PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx | 325 | PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx |
@@ -290,8 +332,9 @@ quiet_ni_syscall: | |||
290 | PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend, %rdx | 332 | PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend, %rdx |
291 | 333 | ||
292 | ENTRY(ia32_ptregs_common) | 334 | ENTRY(ia32_ptregs_common) |
293 | CFI_STARTPROC | ||
294 | popq %r11 | 335 | popq %r11 |
336 | CFI_ADJUST_CFA_OFFSET -8 | ||
337 | CFI_REGISTER rip, r11 | ||
295 | SAVE_REST | 338 | SAVE_REST |
296 | call *%rax | 339 | call *%rax |
297 | RESTORE_REST | 340 | RESTORE_REST |
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c index 04d80406ce4f..5389df610e78 100644 --- a/arch/x86_64/ia32/sys_ia32.c +++ b/arch/x86_64/ia32/sys_ia32.c | |||
@@ -751,7 +751,7 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) | |||
751 | ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); | 751 | ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); |
752 | set_fs(old_fs); | 752 | set_fs(old_fs); |
753 | 753 | ||
754 | if (!ret && offset && put_user(of, offset)) | 754 | if (offset && put_user(of, offset)) |
755 | return -EFAULT; | 755 | return -EFAULT; |
756 | 756 | ||
757 | return ret; | 757 | return ret; |
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile index 1579bdd0adcd..bcdd0a805fe7 100644 --- a/arch/x86_64/kernel/Makefile +++ b/arch/x86_64/kernel/Makefile | |||
@@ -46,3 +46,4 @@ microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o | |||
46 | intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o | 46 | intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o |
47 | quirks-y += ../../i386/kernel/quirks.o | 47 | quirks-y += ../../i386/kernel/quirks.o |
48 | i8237-y += ../../i386/kernel/i8237.o | 48 | i8237-y += ../../i386/kernel/i8237.o |
49 | msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o | ||
diff --git a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c index 148f6f7ea315..867a0ebee177 100644 --- a/arch/x86_64/kernel/acpi/sleep.c +++ b/arch/x86_64/kernel/acpi/sleep.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
36 | #include <linux/bootmem.h> | 36 | #include <linux/bootmem.h> |
37 | #include <linux/irq.h> | ||
38 | #include <linux/acpi.h> | 37 | #include <linux/acpi.h> |
39 | #include <asm/mpspec.h> | 38 | #include <asm/mpspec.h> |
40 | #include <asm/io.h> | 39 | #include <asm/io.h> |
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c index c9a6b812e926..962ad4823b6a 100644 --- a/arch/x86_64/kernel/aperture.c +++ b/arch/x86_64/kernel/aperture.c | |||
@@ -245,6 +245,8 @@ void __init iommu_hole_init(void) | |||
245 | 245 | ||
246 | if (aper_alloc) { | 246 | if (aper_alloc) { |
247 | /* Got the aperture from the AGP bridge */ | 247 | /* Got the aperture from the AGP bridge */ |
248 | } else if (swiotlb && !valid_agp) { | ||
249 | /* Do nothing */ | ||
248 | } else if ((!no_iommu && end_pfn >= 0xffffffff>>PAGE_SHIFT) || | 250 | } else if ((!no_iommu && end_pfn >= 0xffffffff>>PAGE_SHIFT) || |
249 | force_iommu || | 251 | force_iommu || |
250 | valid_agp || | 252 | valid_agp || |
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c index 375d369570ca..b6e7715d877f 100644 --- a/arch/x86_64/kernel/apic.c +++ b/arch/x86_64/kernel/apic.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | 19 | ||
20 | #include <linux/mm.h> | 20 | #include <linux/mm.h> |
21 | #include <linux/irq.h> | ||
22 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/bootmem.h> | 22 | #include <linux/bootmem.h> |
24 | #include <linux/smp_lock.h> | 23 | #include <linux/smp_lock.h> |
@@ -109,11 +108,8 @@ void clear_local_APIC(void) | |||
109 | if (maxlvt >= 4) | 108 | if (maxlvt >= 4) |
110 | apic_write_around(APIC_LVTPC, APIC_LVT_MASKED); | 109 | apic_write_around(APIC_LVTPC, APIC_LVT_MASKED); |
111 | v = GET_APIC_VERSION(apic_read(APIC_LVR)); | 110 | v = GET_APIC_VERSION(apic_read(APIC_LVR)); |
112 | if (APIC_INTEGRATED(v)) { /* !82489DX */ | 111 | apic_write(APIC_ESR, 0); |
113 | if (maxlvt > 3) /* Due to Pentium errata 3AP and 11AP. */ | 112 | apic_read(APIC_ESR); |
114 | apic_write(APIC_ESR, 0); | ||
115 | apic_read(APIC_ESR); | ||
116 | } | ||
117 | } | 113 | } |
118 | 114 | ||
119 | void __init connect_bsp_APIC(void) | 115 | void __init connect_bsp_APIC(void) |
@@ -316,8 +312,6 @@ void __init init_bsp_APIC(void) | |||
316 | */ | 312 | */ |
317 | apic_write_around(APIC_LVT0, APIC_DM_EXTINT); | 313 | apic_write_around(APIC_LVT0, APIC_DM_EXTINT); |
318 | value = APIC_DM_NMI; | 314 | value = APIC_DM_NMI; |
319 | if (!APIC_INTEGRATED(ver)) /* 82489DX */ | ||
320 | value |= APIC_LVT_LEVEL_TRIGGER; | ||
321 | apic_write_around(APIC_LVT1, value); | 315 | apic_write_around(APIC_LVT1, value); |
322 | } | 316 | } |
323 | 317 | ||
@@ -325,14 +319,6 @@ void __cpuinit setup_local_APIC (void) | |||
325 | { | 319 | { |
326 | unsigned int value, ver, maxlvt; | 320 | unsigned int value, ver, maxlvt; |
327 | 321 | ||
328 | /* Pound the ESR really hard over the head with a big hammer - mbligh */ | ||
329 | if (esr_disable) { | ||
330 | apic_write(APIC_ESR, 0); | ||
331 | apic_write(APIC_ESR, 0); | ||
332 | apic_write(APIC_ESR, 0); | ||
333 | apic_write(APIC_ESR, 0); | ||
334 | } | ||
335 | |||
336 | value = apic_read(APIC_LVR); | 322 | value = apic_read(APIC_LVR); |
337 | ver = GET_APIC_VERSION(value); | 323 | ver = GET_APIC_VERSION(value); |
338 | 324 | ||
@@ -430,15 +416,11 @@ void __cpuinit setup_local_APIC (void) | |||
430 | value = APIC_DM_NMI; | 416 | value = APIC_DM_NMI; |
431 | else | 417 | else |
432 | value = APIC_DM_NMI | APIC_LVT_MASKED; | 418 | value = APIC_DM_NMI | APIC_LVT_MASKED; |
433 | if (!APIC_INTEGRATED(ver)) /* 82489DX */ | ||
434 | value |= APIC_LVT_LEVEL_TRIGGER; | ||
435 | apic_write_around(APIC_LVT1, value); | 419 | apic_write_around(APIC_LVT1, value); |
436 | 420 | ||
437 | if (APIC_INTEGRATED(ver) && !esr_disable) { /* !82489DX */ | 421 | { |
438 | unsigned oldvalue; | 422 | unsigned oldvalue; |
439 | maxlvt = get_maxlvt(); | 423 | maxlvt = get_maxlvt(); |
440 | if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ | ||
441 | apic_write(APIC_ESR, 0); | ||
442 | oldvalue = apic_read(APIC_ESR); | 424 | oldvalue = apic_read(APIC_ESR); |
443 | value = ERROR_APIC_VECTOR; // enables sending errors | 425 | value = ERROR_APIC_VECTOR; // enables sending errors |
444 | apic_write_around(APIC_LVTERR, value); | 426 | apic_write_around(APIC_LVTERR, value); |
@@ -452,17 +434,6 @@ void __cpuinit setup_local_APIC (void) | |||
452 | apic_printk(APIC_VERBOSE, | 434 | apic_printk(APIC_VERBOSE, |
453 | "ESR value after enabling vector: %08x, after %08x\n", | 435 | "ESR value after enabling vector: %08x, after %08x\n", |
454 | oldvalue, value); | 436 | oldvalue, value); |
455 | } else { | ||
456 | if (esr_disable) | ||
457 | /* | ||
458 | * Something untraceble is creating bad interrupts on | ||
459 | * secondary quads ... for the moment, just leave the | ||
460 | * ESR disabled - we can't do anything useful with the | ||
461 | * errors anyway - mbligh | ||
462 | */ | ||
463 | apic_printk(APIC_DEBUG, "Leaving ESR disabled.\n"); | ||
464 | else | ||
465 | apic_printk(APIC_DEBUG, "No ESR for 82489DX.\n"); | ||
466 | } | 437 | } |
467 | 438 | ||
468 | nmi_watchdog_default(); | 439 | nmi_watchdog_default(); |
@@ -650,8 +621,7 @@ void __init init_apic_mappings(void) | |||
650 | * Fetch the APIC ID of the BSP in case we have a | 621 | * Fetch the APIC ID of the BSP in case we have a |
651 | * default configuration (or the MP table is broken). | 622 | * default configuration (or the MP table is broken). |
652 | */ | 623 | */ |
653 | if (boot_cpu_id == -1U) | 624 | boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); |
654 | boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); | ||
655 | 625 | ||
656 | #ifdef CONFIG_X86_IO_APIC | 626 | #ifdef CONFIG_X86_IO_APIC |
657 | { | 627 | { |
@@ -693,8 +663,6 @@ static void __setup_APIC_LVTT(unsigned int clocks) | |||
693 | 663 | ||
694 | ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | 664 | ver = GET_APIC_VERSION(apic_read(APIC_LVR)); |
695 | lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; | 665 | lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; |
696 | if (!APIC_INTEGRATED(ver)) | ||
697 | lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV); | ||
698 | apic_write_around(APIC_LVTT, lvtt_value); | 666 | apic_write_around(APIC_LVTT, lvtt_value); |
699 | 667 | ||
700 | /* | 668 | /* |
@@ -1081,7 +1049,7 @@ int __init APIC_init_uniprocessor (void) | |||
1081 | 1049 | ||
1082 | connect_bsp_APIC(); | 1050 | connect_bsp_APIC(); |
1083 | 1051 | ||
1084 | phys_cpu_present_map = physid_mask_of_physid(0); | 1052 | phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); |
1085 | apic_write_around(APIC_ID, boot_cpu_id); | 1053 | apic_write_around(APIC_ID, boot_cpu_id); |
1086 | 1054 | ||
1087 | setup_local_APIC(); | 1055 | setup_local_APIC(); |
diff --git a/arch/x86_64/kernel/asm-offsets.c b/arch/x86_64/kernel/asm-offsets.c index 35b4c3fcbb37..aaa6d3833517 100644 --- a/arch/x86_64/kernel/asm-offsets.c +++ b/arch/x86_64/kernel/asm-offsets.c | |||
@@ -39,7 +39,6 @@ int main(void) | |||
39 | ENTRY(kernelstack); | 39 | ENTRY(kernelstack); |
40 | ENTRY(oldrsp); | 40 | ENTRY(oldrsp); |
41 | ENTRY(pcurrent); | 41 | ENTRY(pcurrent); |
42 | ENTRY(irqrsp); | ||
43 | ENTRY(irqcount); | 42 | ENTRY(irqcount); |
44 | ENTRY(cpunumber); | 43 | ENTRY(cpunumber); |
45 | ENTRY(irqstackptr); | 44 | ENTRY(irqstackptr); |
diff --git a/arch/x86_64/kernel/crash.c b/arch/x86_64/kernel/crash.c index d7fa4248501c..535e04466079 100644 --- a/arch/x86_64/kernel/crash.c +++ b/arch/x86_64/kernel/crash.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
14 | #include <linux/irq.h> | ||
15 | #include <linux/reboot.h> | 14 | #include <linux/reboot.h> |
16 | #include <linux/kexec.h> | 15 | #include <linux/kexec.h> |
17 | 16 | ||
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c index bb0ae18ec02b..eb7929eea7b3 100644 --- a/arch/x86_64/kernel/e820.c +++ b/arch/x86_64/kernel/e820.c | |||
@@ -131,7 +131,7 @@ void __init e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned lon | |||
131 | 131 | ||
132 | if (ei->type != E820_RAM || | 132 | if (ei->type != E820_RAM || |
133 | ei->addr+ei->size <= start || | 133 | ei->addr+ei->size <= start || |
134 | ei->addr > end) | 134 | ei->addr >= end) |
135 | continue; | 135 | continue; |
136 | 136 | ||
137 | addr = round_up(ei->addr, PAGE_SIZE); | 137 | addr = round_up(ei->addr, PAGE_SIZE); |
diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c index 9631c747c5e3..9cd968dd0f5a 100644 --- a/arch/x86_64/kernel/early_printk.c +++ b/arch/x86_64/kernel/early_printk.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/tty.h> | 5 | #include <linux/tty.h> |
6 | #include <asm/io.h> | 6 | #include <asm/io.h> |
7 | #include <asm/processor.h> | 7 | #include <asm/processor.h> |
8 | #include <asm/fcntl.h> | ||
8 | 9 | ||
9 | /* Simple VGA output */ | 10 | /* Simple VGA output */ |
10 | 11 | ||
@@ -158,6 +159,47 @@ static struct console early_serial_console = { | |||
158 | .index = -1, | 159 | .index = -1, |
159 | }; | 160 | }; |
160 | 161 | ||
162 | /* Console interface to a host file on AMD's SimNow! */ | ||
163 | |||
164 | static int simnow_fd; | ||
165 | |||
166 | enum { | ||
167 | MAGIC1 = 0xBACCD00A, | ||
168 | MAGIC2 = 0xCA110000, | ||
169 | XOPEN = 5, | ||
170 | XWRITE = 4, | ||
171 | }; | ||
172 | |||
173 | static noinline long simnow(long cmd, long a, long b, long c) | ||
174 | { | ||
175 | long ret; | ||
176 | asm volatile("cpuid" : | ||
177 | "=a" (ret) : | ||
178 | "b" (a), "c" (b), "d" (c), "0" (MAGIC1), "D" (cmd + MAGIC2)); | ||
179 | return ret; | ||
180 | } | ||
181 | |||
182 | void __init simnow_init(char *str) | ||
183 | { | ||
184 | char *fn = "klog"; | ||
185 | if (*str == '=') | ||
186 | fn = ++str; | ||
187 | /* error ignored */ | ||
188 | simnow_fd = simnow(XOPEN, (unsigned long)fn, O_WRONLY|O_APPEND|O_CREAT, 0644); | ||
189 | } | ||
190 | |||
191 | static void simnow_write(struct console *con, const char *s, unsigned n) | ||
192 | { | ||
193 | simnow(XWRITE, simnow_fd, (unsigned long)s, n); | ||
194 | } | ||
195 | |||
196 | static struct console simnow_console = { | ||
197 | .name = "simnow", | ||
198 | .write = simnow_write, | ||
199 | .flags = CON_PRINTBUFFER, | ||
200 | .index = -1, | ||
201 | }; | ||
202 | |||
161 | /* Direct interface for emergencies */ | 203 | /* Direct interface for emergencies */ |
162 | struct console *early_console = &early_vga_console; | 204 | struct console *early_console = &early_vga_console; |
163 | static int early_console_initialized = 0; | 205 | static int early_console_initialized = 0; |
@@ -205,6 +247,10 @@ int __init setup_early_printk(char *opt) | |||
205 | max_xpos = SCREEN_INFO.orig_video_cols; | 247 | max_xpos = SCREEN_INFO.orig_video_cols; |
206 | max_ypos = SCREEN_INFO.orig_video_lines; | 248 | max_ypos = SCREEN_INFO.orig_video_lines; |
207 | early_console = &early_vga_console; | 249 | early_console = &early_vga_console; |
250 | } else if (!strncmp(buf, "simnow", 6)) { | ||
251 | simnow_init(buf + 6); | ||
252 | early_console = &simnow_console; | ||
253 | keep_early = 1; | ||
208 | } | 254 | } |
209 | early_console_initialized = 1; | 255 | early_console_initialized = 1; |
210 | register_console(early_console); | 256 | register_console(early_console); |
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index 3620508c8bd9..7937971d1853 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S | |||
@@ -79,16 +79,19 @@ | |||
79 | xorl %eax, %eax | 79 | xorl %eax, %eax |
80 | pushq %rax /* ss */ | 80 | pushq %rax /* ss */ |
81 | CFI_ADJUST_CFA_OFFSET 8 | 81 | CFI_ADJUST_CFA_OFFSET 8 |
82 | /*CFI_REL_OFFSET ss,0*/ | ||
82 | pushq %rax /* rsp */ | 83 | pushq %rax /* rsp */ |
83 | CFI_ADJUST_CFA_OFFSET 8 | 84 | CFI_ADJUST_CFA_OFFSET 8 |
84 | CFI_OFFSET rip,0 | 85 | CFI_REL_OFFSET rsp,0 |
85 | pushq $(1<<9) /* eflags - interrupts on */ | 86 | pushq $(1<<9) /* eflags - interrupts on */ |
86 | CFI_ADJUST_CFA_OFFSET 8 | 87 | CFI_ADJUST_CFA_OFFSET 8 |
88 | /*CFI_REL_OFFSET rflags,0*/ | ||
87 | pushq $__KERNEL_CS /* cs */ | 89 | pushq $__KERNEL_CS /* cs */ |
88 | CFI_ADJUST_CFA_OFFSET 8 | 90 | CFI_ADJUST_CFA_OFFSET 8 |
91 | /*CFI_REL_OFFSET cs,0*/ | ||
89 | pushq \child_rip /* rip */ | 92 | pushq \child_rip /* rip */ |
90 | CFI_ADJUST_CFA_OFFSET 8 | 93 | CFI_ADJUST_CFA_OFFSET 8 |
91 | CFI_OFFSET rip,0 | 94 | CFI_REL_OFFSET rip,0 |
92 | pushq %rax /* orig rax */ | 95 | pushq %rax /* orig rax */ |
93 | CFI_ADJUST_CFA_OFFSET 8 | 96 | CFI_ADJUST_CFA_OFFSET 8 |
94 | .endm | 97 | .endm |
@@ -98,32 +101,39 @@ | |||
98 | CFI_ADJUST_CFA_OFFSET -(6*8) | 101 | CFI_ADJUST_CFA_OFFSET -(6*8) |
99 | .endm | 102 | .endm |
100 | 103 | ||
101 | .macro CFI_DEFAULT_STACK | 104 | .macro CFI_DEFAULT_STACK start=1 |
102 | CFI_ADJUST_CFA_OFFSET (SS) | 105 | .if \start |
103 | CFI_OFFSET r15,R15-SS | 106 | CFI_STARTPROC simple |
104 | CFI_OFFSET r14,R14-SS | 107 | CFI_DEF_CFA rsp,SS+8 |
105 | CFI_OFFSET r13,R13-SS | 108 | .else |
106 | CFI_OFFSET r12,R12-SS | 109 | CFI_DEF_CFA_OFFSET SS+8 |
107 | CFI_OFFSET rbp,RBP-SS | 110 | .endif |
108 | CFI_OFFSET rbx,RBX-SS | 111 | CFI_REL_OFFSET r15,R15 |
109 | CFI_OFFSET r11,R11-SS | 112 | CFI_REL_OFFSET r14,R14 |
110 | CFI_OFFSET r10,R10-SS | 113 | CFI_REL_OFFSET r13,R13 |
111 | CFI_OFFSET r9,R9-SS | 114 | CFI_REL_OFFSET r12,R12 |
112 | CFI_OFFSET r8,R8-SS | 115 | CFI_REL_OFFSET rbp,RBP |
113 | CFI_OFFSET rax,RAX-SS | 116 | CFI_REL_OFFSET rbx,RBX |
114 | CFI_OFFSET rcx,RCX-SS | 117 | CFI_REL_OFFSET r11,R11 |
115 | CFI_OFFSET rdx,RDX-SS | 118 | CFI_REL_OFFSET r10,R10 |
116 | CFI_OFFSET rsi,RSI-SS | 119 | CFI_REL_OFFSET r9,R9 |
117 | CFI_OFFSET rdi,RDI-SS | 120 | CFI_REL_OFFSET r8,R8 |
118 | CFI_OFFSET rsp,RSP-SS | 121 | CFI_REL_OFFSET rax,RAX |
119 | CFI_OFFSET rip,RIP-SS | 122 | CFI_REL_OFFSET rcx,RCX |
123 | CFI_REL_OFFSET rdx,RDX | ||
124 | CFI_REL_OFFSET rsi,RSI | ||
125 | CFI_REL_OFFSET rdi,RDI | ||
126 | CFI_REL_OFFSET rip,RIP | ||
127 | /*CFI_REL_OFFSET cs,CS*/ | ||
128 | /*CFI_REL_OFFSET rflags,EFLAGS*/ | ||
129 | CFI_REL_OFFSET rsp,RSP | ||
130 | /*CFI_REL_OFFSET ss,SS*/ | ||
120 | .endm | 131 | .endm |
121 | /* | 132 | /* |
122 | * A newly forked process directly context switches into this. | 133 | * A newly forked process directly context switches into this. |
123 | */ | 134 | */ |
124 | /* rdi: prev */ | 135 | /* rdi: prev */ |
125 | ENTRY(ret_from_fork) | 136 | ENTRY(ret_from_fork) |
126 | CFI_STARTPROC | ||
127 | CFI_DEFAULT_STACK | 137 | CFI_DEFAULT_STACK |
128 | call schedule_tail | 138 | call schedule_tail |
129 | GET_THREAD_INFO(%rcx) | 139 | GET_THREAD_INFO(%rcx) |
@@ -172,16 +182,21 @@ rff_trace: | |||
172 | */ | 182 | */ |
173 | 183 | ||
174 | ENTRY(system_call) | 184 | ENTRY(system_call) |
175 | CFI_STARTPROC | 185 | CFI_STARTPROC simple |
186 | CFI_DEF_CFA rsp,0 | ||
187 | CFI_REGISTER rip,rcx | ||
188 | /*CFI_REGISTER rflags,r11*/ | ||
176 | swapgs | 189 | swapgs |
177 | movq %rsp,%gs:pda_oldrsp | 190 | movq %rsp,%gs:pda_oldrsp |
178 | movq %gs:pda_kernelstack,%rsp | 191 | movq %gs:pda_kernelstack,%rsp |
179 | sti | 192 | sti |
180 | SAVE_ARGS 8,1 | 193 | SAVE_ARGS 8,1 |
181 | movq %rax,ORIG_RAX-ARGOFFSET(%rsp) | 194 | movq %rax,ORIG_RAX-ARGOFFSET(%rsp) |
182 | movq %rcx,RIP-ARGOFFSET(%rsp) | 195 | movq %rcx,RIP-ARGOFFSET(%rsp) |
196 | CFI_REL_OFFSET rip,RIP-ARGOFFSET | ||
183 | GET_THREAD_INFO(%rcx) | 197 | GET_THREAD_INFO(%rcx) |
184 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx) | 198 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx) |
199 | CFI_REMEMBER_STATE | ||
185 | jnz tracesys | 200 | jnz tracesys |
186 | cmpq $__NR_syscall_max,%rax | 201 | cmpq $__NR_syscall_max,%rax |
187 | ja badsys | 202 | ja badsys |
@@ -201,9 +216,12 @@ sysret_check: | |||
201 | cli | 216 | cli |
202 | movl threadinfo_flags(%rcx),%edx | 217 | movl threadinfo_flags(%rcx),%edx |
203 | andl %edi,%edx | 218 | andl %edi,%edx |
219 | CFI_REMEMBER_STATE | ||
204 | jnz sysret_careful | 220 | jnz sysret_careful |
205 | movq RIP-ARGOFFSET(%rsp),%rcx | 221 | movq RIP-ARGOFFSET(%rsp),%rcx |
222 | CFI_REGISTER rip,rcx | ||
206 | RESTORE_ARGS 0,-ARG_SKIP,1 | 223 | RESTORE_ARGS 0,-ARG_SKIP,1 |
224 | /*CFI_REGISTER rflags,r11*/ | ||
207 | movq %gs:pda_oldrsp,%rsp | 225 | movq %gs:pda_oldrsp,%rsp |
208 | swapgs | 226 | swapgs |
209 | sysretq | 227 | sysretq |
@@ -211,12 +229,15 @@ sysret_check: | |||
211 | /* Handle reschedules */ | 229 | /* Handle reschedules */ |
212 | /* edx: work, edi: workmask */ | 230 | /* edx: work, edi: workmask */ |
213 | sysret_careful: | 231 | sysret_careful: |
232 | CFI_RESTORE_STATE | ||
214 | bt $TIF_NEED_RESCHED,%edx | 233 | bt $TIF_NEED_RESCHED,%edx |
215 | jnc sysret_signal | 234 | jnc sysret_signal |
216 | sti | 235 | sti |
217 | pushq %rdi | 236 | pushq %rdi |
237 | CFI_ADJUST_CFA_OFFSET 8 | ||
218 | call schedule | 238 | call schedule |
219 | popq %rdi | 239 | popq %rdi |
240 | CFI_ADJUST_CFA_OFFSET -8 | ||
220 | jmp sysret_check | 241 | jmp sysret_check |
221 | 242 | ||
222 | /* Handle a signal */ | 243 | /* Handle a signal */ |
@@ -234,8 +255,13 @@ sysret_signal: | |||
234 | 1: movl $_TIF_NEED_RESCHED,%edi | 255 | 1: movl $_TIF_NEED_RESCHED,%edi |
235 | jmp sysret_check | 256 | jmp sysret_check |
236 | 257 | ||
258 | badsys: | ||
259 | movq $-ENOSYS,RAX-ARGOFFSET(%rsp) | ||
260 | jmp ret_from_sys_call | ||
261 | |||
237 | /* Do syscall tracing */ | 262 | /* Do syscall tracing */ |
238 | tracesys: | 263 | tracesys: |
264 | CFI_RESTORE_STATE | ||
239 | SAVE_REST | 265 | SAVE_REST |
240 | movq $-ENOSYS,RAX(%rsp) | 266 | movq $-ENOSYS,RAX(%rsp) |
241 | FIXUP_TOP_OF_STACK %rdi | 267 | FIXUP_TOP_OF_STACK %rdi |
@@ -254,16 +280,29 @@ tracesys: | |||
254 | RESTORE_TOP_OF_STACK %rbx | 280 | RESTORE_TOP_OF_STACK %rbx |
255 | RESTORE_REST | 281 | RESTORE_REST |
256 | jmp ret_from_sys_call | 282 | jmp ret_from_sys_call |
283 | CFI_ENDPROC | ||
257 | 284 | ||
258 | badsys: | ||
259 | movq $-ENOSYS,RAX-ARGOFFSET(%rsp) | ||
260 | jmp ret_from_sys_call | ||
261 | |||
262 | /* | 285 | /* |
263 | * Syscall return path ending with IRET. | 286 | * Syscall return path ending with IRET. |
264 | * Has correct top of stack, but partial stack frame. | 287 | * Has correct top of stack, but partial stack frame. |
265 | */ | 288 | */ |
266 | ENTRY(int_ret_from_sys_call) | 289 | ENTRY(int_ret_from_sys_call) |
290 | CFI_STARTPROC simple | ||
291 | CFI_DEF_CFA rsp,SS+8-ARGOFFSET | ||
292 | /*CFI_REL_OFFSET ss,SS-ARGOFFSET*/ | ||
293 | CFI_REL_OFFSET rsp,RSP-ARGOFFSET | ||
294 | /*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/ | ||
295 | /*CFI_REL_OFFSET cs,CS-ARGOFFSET*/ | ||
296 | CFI_REL_OFFSET rip,RIP-ARGOFFSET | ||
297 | CFI_REL_OFFSET rdx,RDX-ARGOFFSET | ||
298 | CFI_REL_OFFSET rcx,RCX-ARGOFFSET | ||
299 | CFI_REL_OFFSET rax,RAX-ARGOFFSET | ||
300 | CFI_REL_OFFSET rdi,RDI-ARGOFFSET | ||
301 | CFI_REL_OFFSET rsi,RSI-ARGOFFSET | ||
302 | CFI_REL_OFFSET r8,R8-ARGOFFSET | ||
303 | CFI_REL_OFFSET r9,R9-ARGOFFSET | ||
304 | CFI_REL_OFFSET r10,R10-ARGOFFSET | ||
305 | CFI_REL_OFFSET r11,R11-ARGOFFSET | ||
267 | cli | 306 | cli |
268 | testl $3,CS-ARGOFFSET(%rsp) | 307 | testl $3,CS-ARGOFFSET(%rsp) |
269 | je retint_restore_args | 308 | je retint_restore_args |
@@ -284,8 +323,10 @@ int_careful: | |||
284 | jnc int_very_careful | 323 | jnc int_very_careful |
285 | sti | 324 | sti |
286 | pushq %rdi | 325 | pushq %rdi |
326 | CFI_ADJUST_CFA_OFFSET 8 | ||
287 | call schedule | 327 | call schedule |
288 | popq %rdi | 328 | popq %rdi |
329 | CFI_ADJUST_CFA_OFFSET -8 | ||
289 | cli | 330 | cli |
290 | jmp int_with_check | 331 | jmp int_with_check |
291 | 332 | ||
@@ -297,9 +338,11 @@ int_very_careful: | |||
297 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edx | 338 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edx |
298 | jz int_signal | 339 | jz int_signal |
299 | pushq %rdi | 340 | pushq %rdi |
341 | CFI_ADJUST_CFA_OFFSET 8 | ||
300 | leaq 8(%rsp),%rdi # &ptregs -> arg1 | 342 | leaq 8(%rsp),%rdi # &ptregs -> arg1 |
301 | call syscall_trace_leave | 343 | call syscall_trace_leave |
302 | popq %rdi | 344 | popq %rdi |
345 | CFI_ADJUST_CFA_OFFSET -8 | ||
303 | andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi | 346 | andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi |
304 | cli | 347 | cli |
305 | jmp int_restore_rest | 348 | jmp int_restore_rest |
@@ -329,6 +372,8 @@ int_restore_rest: | |||
329 | jmp ptregscall_common | 372 | jmp ptregscall_common |
330 | .endm | 373 | .endm |
331 | 374 | ||
375 | CFI_STARTPROC | ||
376 | |||
332 | PTREGSCALL stub_clone, sys_clone, %r8 | 377 | PTREGSCALL stub_clone, sys_clone, %r8 |
333 | PTREGSCALL stub_fork, sys_fork, %rdi | 378 | PTREGSCALL stub_fork, sys_fork, %rdi |
334 | PTREGSCALL stub_vfork, sys_vfork, %rdi | 379 | PTREGSCALL stub_vfork, sys_vfork, %rdi |
@@ -337,40 +382,49 @@ int_restore_rest: | |||
337 | PTREGSCALL stub_iopl, sys_iopl, %rsi | 382 | PTREGSCALL stub_iopl, sys_iopl, %rsi |
338 | 383 | ||
339 | ENTRY(ptregscall_common) | 384 | ENTRY(ptregscall_common) |
340 | CFI_STARTPROC | ||
341 | popq %r11 | 385 | popq %r11 |
342 | CFI_ADJUST_CFA_OFFSET -8 | 386 | CFI_ADJUST_CFA_OFFSET -8 |
387 | CFI_REGISTER rip, r11 | ||
343 | SAVE_REST | 388 | SAVE_REST |
344 | movq %r11, %r15 | 389 | movq %r11, %r15 |
390 | CFI_REGISTER rip, r15 | ||
345 | FIXUP_TOP_OF_STACK %r11 | 391 | FIXUP_TOP_OF_STACK %r11 |
346 | call *%rax | 392 | call *%rax |
347 | RESTORE_TOP_OF_STACK %r11 | 393 | RESTORE_TOP_OF_STACK %r11 |
348 | movq %r15, %r11 | 394 | movq %r15, %r11 |
395 | CFI_REGISTER rip, r11 | ||
349 | RESTORE_REST | 396 | RESTORE_REST |
350 | pushq %r11 | 397 | pushq %r11 |
351 | CFI_ADJUST_CFA_OFFSET 8 | 398 | CFI_ADJUST_CFA_OFFSET 8 |
399 | CFI_REL_OFFSET rip, 0 | ||
352 | ret | 400 | ret |
353 | CFI_ENDPROC | 401 | CFI_ENDPROC |
354 | 402 | ||
355 | ENTRY(stub_execve) | 403 | ENTRY(stub_execve) |
356 | CFI_STARTPROC | 404 | CFI_STARTPROC |
357 | popq %r11 | 405 | popq %r11 |
358 | CFI_ADJUST_CFA_OFFSET -8 | 406 | CFI_ADJUST_CFA_OFFSET -8 |
407 | CFI_REGISTER rip, r11 | ||
359 | SAVE_REST | 408 | SAVE_REST |
360 | movq %r11, %r15 | 409 | movq %r11, %r15 |
410 | CFI_REGISTER rip, r15 | ||
361 | FIXUP_TOP_OF_STACK %r11 | 411 | FIXUP_TOP_OF_STACK %r11 |
362 | call sys_execve | 412 | call sys_execve |
363 | GET_THREAD_INFO(%rcx) | 413 | GET_THREAD_INFO(%rcx) |
364 | bt $TIF_IA32,threadinfo_flags(%rcx) | 414 | bt $TIF_IA32,threadinfo_flags(%rcx) |
415 | CFI_REMEMBER_STATE | ||
365 | jc exec_32bit | 416 | jc exec_32bit |
366 | RESTORE_TOP_OF_STACK %r11 | 417 | RESTORE_TOP_OF_STACK %r11 |
367 | movq %r15, %r11 | 418 | movq %r15, %r11 |
419 | CFI_REGISTER rip, r11 | ||
368 | RESTORE_REST | 420 | RESTORE_REST |
369 | push %r11 | 421 | pushq %r11 |
422 | CFI_ADJUST_CFA_OFFSET 8 | ||
423 | CFI_REL_OFFSET rip, 0 | ||
370 | ret | 424 | ret |
371 | 425 | ||
372 | exec_32bit: | 426 | exec_32bit: |
373 | CFI_ADJUST_CFA_OFFSET REST_SKIP | 427 | CFI_RESTORE_STATE |
374 | movq %rax,RAX(%rsp) | 428 | movq %rax,RAX(%rsp) |
375 | RESTORE_REST | 429 | RESTORE_REST |
376 | jmp int_ret_from_sys_call | 430 | jmp int_ret_from_sys_call |
@@ -382,7 +436,8 @@ exec_32bit: | |||
382 | */ | 436 | */ |
383 | ENTRY(stub_rt_sigreturn) | 437 | ENTRY(stub_rt_sigreturn) |
384 | CFI_STARTPROC | 438 | CFI_STARTPROC |
385 | addq $8, %rsp | 439 | addq $8, %rsp |
440 | CFI_ADJUST_CFA_OFFSET -8 | ||
386 | SAVE_REST | 441 | SAVE_REST |
387 | movq %rsp,%rdi | 442 | movq %rsp,%rdi |
388 | FIXUP_TOP_OF_STACK %r11 | 443 | FIXUP_TOP_OF_STACK %r11 |
@@ -392,6 +447,25 @@ ENTRY(stub_rt_sigreturn) | |||
392 | jmp int_ret_from_sys_call | 447 | jmp int_ret_from_sys_call |
393 | CFI_ENDPROC | 448 | CFI_ENDPROC |
394 | 449 | ||
450 | /* | ||
451 | * initial frame state for interrupts and exceptions | ||
452 | */ | ||
453 | .macro _frame ref | ||
454 | CFI_STARTPROC simple | ||
455 | CFI_DEF_CFA rsp,SS+8-\ref | ||
456 | /*CFI_REL_OFFSET ss,SS-\ref*/ | ||
457 | CFI_REL_OFFSET rsp,RSP-\ref | ||
458 | /*CFI_REL_OFFSET rflags,EFLAGS-\ref*/ | ||
459 | /*CFI_REL_OFFSET cs,CS-\ref*/ | ||
460 | CFI_REL_OFFSET rip,RIP-\ref | ||
461 | .endm | ||
462 | |||
463 | /* initial frame state for interrupts (and exceptions without error code) */ | ||
464 | #define INTR_FRAME _frame RIP | ||
465 | /* initial frame state for exceptions with error code (and interrupts with | ||
466 | vector already pushed) */ | ||
467 | #define XCPT_FRAME _frame ORIG_RAX | ||
468 | |||
395 | /* | 469 | /* |
396 | * Interrupt entry/exit. | 470 | * Interrupt entry/exit. |
397 | * | 471 | * |
@@ -402,10 +476,6 @@ ENTRY(stub_rt_sigreturn) | |||
402 | 476 | ||
403 | /* 0(%rsp): interrupt number */ | 477 | /* 0(%rsp): interrupt number */ |
404 | .macro interrupt func | 478 | .macro interrupt func |
405 | CFI_STARTPROC simple | ||
406 | CFI_DEF_CFA rsp,(SS-RDI) | ||
407 | CFI_REL_OFFSET rsp,(RSP-ORIG_RAX) | ||
408 | CFI_REL_OFFSET rip,(RIP-ORIG_RAX) | ||
409 | cld | 479 | cld |
410 | #ifdef CONFIG_DEBUG_INFO | 480 | #ifdef CONFIG_DEBUG_INFO |
411 | SAVE_ALL | 481 | SAVE_ALL |
@@ -425,23 +495,27 @@ ENTRY(stub_rt_sigreturn) | |||
425 | swapgs | 495 | swapgs |
426 | 1: incl %gs:pda_irqcount # RED-PEN should check preempt count | 496 | 1: incl %gs:pda_irqcount # RED-PEN should check preempt count |
427 | movq %gs:pda_irqstackptr,%rax | 497 | movq %gs:pda_irqstackptr,%rax |
428 | cmoveq %rax,%rsp | 498 | cmoveq %rax,%rsp /*todo This needs CFI annotation! */ |
429 | pushq %rdi # save old stack | 499 | pushq %rdi # save old stack |
500 | CFI_ADJUST_CFA_OFFSET 8 | ||
430 | call \func | 501 | call \func |
431 | .endm | 502 | .endm |
432 | 503 | ||
433 | ENTRY(common_interrupt) | 504 | ENTRY(common_interrupt) |
505 | XCPT_FRAME | ||
434 | interrupt do_IRQ | 506 | interrupt do_IRQ |
435 | /* 0(%rsp): oldrsp-ARGOFFSET */ | 507 | /* 0(%rsp): oldrsp-ARGOFFSET */ |
436 | ret_from_intr: | 508 | ret_from_intr: |
437 | popq %rdi | 509 | popq %rdi |
510 | CFI_ADJUST_CFA_OFFSET -8 | ||
438 | cli | 511 | cli |
439 | decl %gs:pda_irqcount | 512 | decl %gs:pda_irqcount |
440 | #ifdef CONFIG_DEBUG_INFO | 513 | #ifdef CONFIG_DEBUG_INFO |
441 | movq RBP(%rdi),%rbp | 514 | movq RBP(%rdi),%rbp |
515 | CFI_DEF_CFA_REGISTER rsp | ||
442 | #endif | 516 | #endif |
443 | leaq ARGOFFSET(%rdi),%rsp | 517 | leaq ARGOFFSET(%rdi),%rsp /*todo This needs CFI annotation! */ |
444 | exit_intr: | 518 | exit_intr: |
445 | GET_THREAD_INFO(%rcx) | 519 | GET_THREAD_INFO(%rcx) |
446 | testl $3,CS-ARGOFFSET(%rsp) | 520 | testl $3,CS-ARGOFFSET(%rsp) |
447 | je retint_kernel | 521 | je retint_kernel |
@@ -453,9 +527,10 @@ exit_intr: | |||
453 | */ | 527 | */ |
454 | retint_with_reschedule: | 528 | retint_with_reschedule: |
455 | movl $_TIF_WORK_MASK,%edi | 529 | movl $_TIF_WORK_MASK,%edi |
456 | retint_check: | 530 | retint_check: |
457 | movl threadinfo_flags(%rcx),%edx | 531 | movl threadinfo_flags(%rcx),%edx |
458 | andl %edi,%edx | 532 | andl %edi,%edx |
533 | CFI_REMEMBER_STATE | ||
459 | jnz retint_careful | 534 | jnz retint_careful |
460 | retint_swapgs: | 535 | retint_swapgs: |
461 | swapgs | 536 | swapgs |
@@ -476,14 +551,17 @@ bad_iret: | |||
476 | jmp do_exit | 551 | jmp do_exit |
477 | .previous | 552 | .previous |
478 | 553 | ||
479 | /* edi: workmask, edx: work */ | 554 | /* edi: workmask, edx: work */ |
480 | retint_careful: | 555 | retint_careful: |
556 | CFI_RESTORE_STATE | ||
481 | bt $TIF_NEED_RESCHED,%edx | 557 | bt $TIF_NEED_RESCHED,%edx |
482 | jnc retint_signal | 558 | jnc retint_signal |
483 | sti | 559 | sti |
484 | pushq %rdi | 560 | pushq %rdi |
561 | CFI_ADJUST_CFA_OFFSET 8 | ||
485 | call schedule | 562 | call schedule |
486 | popq %rdi | 563 | popq %rdi |
564 | CFI_ADJUST_CFA_OFFSET -8 | ||
487 | GET_THREAD_INFO(%rcx) | 565 | GET_THREAD_INFO(%rcx) |
488 | cli | 566 | cli |
489 | jmp retint_check | 567 | jmp retint_check |
@@ -523,7 +601,9 @@ retint_kernel: | |||
523 | * APIC interrupts. | 601 | * APIC interrupts. |
524 | */ | 602 | */ |
525 | .macro apicinterrupt num,func | 603 | .macro apicinterrupt num,func |
604 | INTR_FRAME | ||
526 | pushq $\num-256 | 605 | pushq $\num-256 |
606 | CFI_ADJUST_CFA_OFFSET 8 | ||
527 | interrupt \func | 607 | interrupt \func |
528 | jmp ret_from_intr | 608 | jmp ret_from_intr |
529 | CFI_ENDPROC | 609 | CFI_ENDPROC |
@@ -536,8 +616,19 @@ ENTRY(thermal_interrupt) | |||
536 | ENTRY(reschedule_interrupt) | 616 | ENTRY(reschedule_interrupt) |
537 | apicinterrupt RESCHEDULE_VECTOR,smp_reschedule_interrupt | 617 | apicinterrupt RESCHEDULE_VECTOR,smp_reschedule_interrupt |
538 | 618 | ||
539 | ENTRY(invalidate_interrupt) | 619 | .macro INVALIDATE_ENTRY num |
540 | apicinterrupt INVALIDATE_TLB_VECTOR,smp_invalidate_interrupt | 620 | ENTRY(invalidate_interrupt\num) |
621 | apicinterrupt INVALIDATE_TLB_VECTOR_START+\num,smp_invalidate_interrupt | ||
622 | .endm | ||
623 | |||
624 | INVALIDATE_ENTRY 0 | ||
625 | INVALIDATE_ENTRY 1 | ||
626 | INVALIDATE_ENTRY 2 | ||
627 | INVALIDATE_ENTRY 3 | ||
628 | INVALIDATE_ENTRY 4 | ||
629 | INVALIDATE_ENTRY 5 | ||
630 | INVALIDATE_ENTRY 6 | ||
631 | INVALIDATE_ENTRY 7 | ||
541 | 632 | ||
542 | ENTRY(call_function_interrupt) | 633 | ENTRY(call_function_interrupt) |
543 | apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt | 634 | apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt |
@@ -558,16 +649,23 @@ ENTRY(spurious_interrupt) | |||
558 | * Exception entry points. | 649 | * Exception entry points. |
559 | */ | 650 | */ |
560 | .macro zeroentry sym | 651 | .macro zeroentry sym |
652 | INTR_FRAME | ||
561 | pushq $0 /* push error code/oldrax */ | 653 | pushq $0 /* push error code/oldrax */ |
654 | CFI_ADJUST_CFA_OFFSET 8 | ||
562 | pushq %rax /* push real oldrax to the rdi slot */ | 655 | pushq %rax /* push real oldrax to the rdi slot */ |
656 | CFI_ADJUST_CFA_OFFSET 8 | ||
563 | leaq \sym(%rip),%rax | 657 | leaq \sym(%rip),%rax |
564 | jmp error_entry | 658 | jmp error_entry |
659 | CFI_ENDPROC | ||
565 | .endm | 660 | .endm |
566 | 661 | ||
567 | .macro errorentry sym | 662 | .macro errorentry sym |
663 | XCPT_FRAME | ||
568 | pushq %rax | 664 | pushq %rax |
665 | CFI_ADJUST_CFA_OFFSET 8 | ||
569 | leaq \sym(%rip),%rax | 666 | leaq \sym(%rip),%rax |
570 | jmp error_entry | 667 | jmp error_entry |
668 | CFI_ENDPROC | ||
571 | .endm | 669 | .endm |
572 | 670 | ||
573 | /* error code is on the stack already */ | 671 | /* error code is on the stack already */ |
@@ -594,10 +692,7 @@ ENTRY(spurious_interrupt) | |||
594 | * and the exception handler in %rax. | 692 | * and the exception handler in %rax. |
595 | */ | 693 | */ |
596 | ENTRY(error_entry) | 694 | ENTRY(error_entry) |
597 | CFI_STARTPROC simple | 695 | _frame RDI |
598 | CFI_DEF_CFA rsp,(SS-RDI) | ||
599 | CFI_REL_OFFSET rsp,(RSP-RDI) | ||
600 | CFI_REL_OFFSET rip,(RIP-RDI) | ||
601 | /* rdi slot contains rax, oldrax contains error code */ | 696 | /* rdi slot contains rax, oldrax contains error code */ |
602 | cld | 697 | cld |
603 | subq $14*8,%rsp | 698 | subq $14*8,%rsp |
@@ -679,7 +774,9 @@ error_kernelspace: | |||
679 | /* Reload gs selector with exception handling */ | 774 | /* Reload gs selector with exception handling */ |
680 | /* edi: new selector */ | 775 | /* edi: new selector */ |
681 | ENTRY(load_gs_index) | 776 | ENTRY(load_gs_index) |
777 | CFI_STARTPROC | ||
682 | pushf | 778 | pushf |
779 | CFI_ADJUST_CFA_OFFSET 8 | ||
683 | cli | 780 | cli |
684 | swapgs | 781 | swapgs |
685 | gs_change: | 782 | gs_change: |
@@ -687,7 +784,9 @@ gs_change: | |||
687 | 2: mfence /* workaround */ | 784 | 2: mfence /* workaround */ |
688 | swapgs | 785 | swapgs |
689 | popf | 786 | popf |
787 | CFI_ADJUST_CFA_OFFSET -8 | ||
690 | ret | 788 | ret |
789 | CFI_ENDPROC | ||
691 | 790 | ||
692 | .section __ex_table,"a" | 791 | .section __ex_table,"a" |
693 | .align 8 | 792 | .align 8 |
@@ -799,7 +898,7 @@ ENTRY(device_not_available) | |||
799 | 898 | ||
800 | /* runs on exception stack */ | 899 | /* runs on exception stack */ |
801 | KPROBE_ENTRY(debug) | 900 | KPROBE_ENTRY(debug) |
802 | CFI_STARTPROC | 901 | INTR_FRAME |
803 | pushq $0 | 902 | pushq $0 |
804 | CFI_ADJUST_CFA_OFFSET 8 | 903 | CFI_ADJUST_CFA_OFFSET 8 |
805 | paranoidentry do_debug | 904 | paranoidentry do_debug |
@@ -809,9 +908,9 @@ KPROBE_ENTRY(debug) | |||
809 | 908 | ||
810 | /* runs on exception stack */ | 909 | /* runs on exception stack */ |
811 | ENTRY(nmi) | 910 | ENTRY(nmi) |
812 | CFI_STARTPROC | 911 | INTR_FRAME |
813 | pushq $-1 | 912 | pushq $-1 |
814 | CFI_ADJUST_CFA_OFFSET 8 | 913 | CFI_ADJUST_CFA_OFFSET 8 |
815 | paranoidentry do_nmi | 914 | paranoidentry do_nmi |
816 | /* | 915 | /* |
817 | * "Paranoid" exit path from exception stack. | 916 | * "Paranoid" exit path from exception stack. |
@@ -877,7 +976,7 @@ ENTRY(reserved) | |||
877 | 976 | ||
878 | /* runs on exception stack */ | 977 | /* runs on exception stack */ |
879 | ENTRY(double_fault) | 978 | ENTRY(double_fault) |
880 | CFI_STARTPROC | 979 | XCPT_FRAME |
881 | paranoidentry do_double_fault | 980 | paranoidentry do_double_fault |
882 | jmp paranoid_exit | 981 | jmp paranoid_exit |
883 | CFI_ENDPROC | 982 | CFI_ENDPROC |
@@ -890,7 +989,7 @@ ENTRY(segment_not_present) | |||
890 | 989 | ||
891 | /* runs on exception stack */ | 990 | /* runs on exception stack */ |
892 | ENTRY(stack_segment) | 991 | ENTRY(stack_segment) |
893 | CFI_STARTPROC | 992 | XCPT_FRAME |
894 | paranoidentry do_stack_segment | 993 | paranoidentry do_stack_segment |
895 | jmp paranoid_exit | 994 | jmp paranoid_exit |
896 | CFI_ENDPROC | 995 | CFI_ENDPROC |
@@ -911,7 +1010,7 @@ ENTRY(spurious_interrupt_bug) | |||
911 | #ifdef CONFIG_X86_MCE | 1010 | #ifdef CONFIG_X86_MCE |
912 | /* runs on exception stack */ | 1011 | /* runs on exception stack */ |
913 | ENTRY(machine_check) | 1012 | ENTRY(machine_check) |
914 | CFI_STARTPROC | 1013 | INTR_FRAME |
915 | pushq $0 | 1014 | pushq $0 |
916 | CFI_ADJUST_CFA_OFFSET 8 | 1015 | CFI_ADJUST_CFA_OFFSET 8 |
917 | paranoidentry do_machine_check | 1016 | paranoidentry do_machine_check |
@@ -923,14 +1022,19 @@ ENTRY(call_debug) | |||
923 | zeroentry do_call_debug | 1022 | zeroentry do_call_debug |
924 | 1023 | ||
925 | ENTRY(call_softirq) | 1024 | ENTRY(call_softirq) |
1025 | CFI_STARTPROC | ||
926 | movq %gs:pda_irqstackptr,%rax | 1026 | movq %gs:pda_irqstackptr,%rax |
927 | pushq %r15 | 1027 | pushq %r15 |
1028 | CFI_ADJUST_CFA_OFFSET 8 | ||
928 | movq %rsp,%r15 | 1029 | movq %rsp,%r15 |
1030 | CFI_DEF_CFA_REGISTER r15 | ||
929 | incl %gs:pda_irqcount | 1031 | incl %gs:pda_irqcount |
930 | cmove %rax,%rsp | 1032 | cmove %rax,%rsp |
931 | call __do_softirq | 1033 | call __do_softirq |
932 | movq %r15,%rsp | 1034 | movq %r15,%rsp |
1035 | CFI_DEF_CFA_REGISTER rsp | ||
933 | decl %gs:pda_irqcount | 1036 | decl %gs:pda_irqcount |
934 | popq %r15 | 1037 | popq %r15 |
1038 | CFI_ADJUST_CFA_OFFSET -8 | ||
935 | ret | 1039 | ret |
936 | 1040 | CFI_ENDPROC | |
diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c index b1c144f73149..7a64ea181788 100644 --- a/arch/x86_64/kernel/genapic.c +++ b/arch/x86_64/kernel/genapic.c | |||
@@ -45,7 +45,7 @@ void __init clustered_apic_check(void) | |||
45 | u8 clusters, max_cluster; | 45 | u8 clusters, max_cluster; |
46 | u8 id; | 46 | u8 id; |
47 | u8 cluster_cnt[NUM_APIC_CLUSTERS]; | 47 | u8 cluster_cnt[NUM_APIC_CLUSTERS]; |
48 | int num_cpus = 0; | 48 | int max_apic = 0; |
49 | 49 | ||
50 | #if defined(CONFIG_ACPI) | 50 | #if defined(CONFIG_ACPI) |
51 | /* | 51 | /* |
@@ -64,14 +64,15 @@ void __init clustered_apic_check(void) | |||
64 | id = bios_cpu_apicid[i]; | 64 | id = bios_cpu_apicid[i]; |
65 | if (id == BAD_APICID) | 65 | if (id == BAD_APICID) |
66 | continue; | 66 | continue; |
67 | num_cpus++; | 67 | if (id > max_apic) |
68 | max_apic = id; | ||
68 | cluster_cnt[APIC_CLUSTERID(id)]++; | 69 | cluster_cnt[APIC_CLUSTERID(id)]++; |
69 | } | 70 | } |
70 | 71 | ||
71 | /* Don't use clustered mode on AMD platforms. */ | 72 | /* Don't use clustered mode on AMD platforms. */ |
72 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { | 73 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { |
73 | genapic = &apic_physflat; | 74 | genapic = &apic_physflat; |
74 | #ifndef CONFIG_CPU_HOTPLUG | 75 | #ifndef CONFIG_HOTPLUG_CPU |
75 | /* In the CPU hotplug case we cannot use broadcast mode | 76 | /* In the CPU hotplug case we cannot use broadcast mode |
76 | because that opens a race when a CPU is removed. | 77 | because that opens a race when a CPU is removed. |
77 | Stay at physflat mode in this case. | 78 | Stay at physflat mode in this case. |
@@ -79,7 +80,7 @@ void __init clustered_apic_check(void) | |||
79 | we have ACPI platform support for CPU hotplug | 80 | we have ACPI platform support for CPU hotplug |
80 | we should detect hotplug capablity from ACPI tables and | 81 | we should detect hotplug capablity from ACPI tables and |
81 | only do this when really needed. -AK */ | 82 | only do this when really needed. -AK */ |
82 | if (num_cpus <= 8) | 83 | if (max_apic <= 8) |
83 | genapic = &apic_flat; | 84 | genapic = &apic_flat; |
84 | #endif | 85 | #endif |
85 | goto print; | 86 | goto print; |
@@ -103,9 +104,14 @@ void __init clustered_apic_check(void) | |||
103 | * (We don't use lowest priority delivery + HW APIC IRQ steering, so | 104 | * (We don't use lowest priority delivery + HW APIC IRQ steering, so |
104 | * can ignore the clustered logical case and go straight to physical.) | 105 | * can ignore the clustered logical case and go straight to physical.) |
105 | */ | 106 | */ |
106 | if (clusters <= 1 && max_cluster <= 8 && cluster_cnt[0] == max_cluster) | 107 | if (clusters <= 1 && max_cluster <= 8 && cluster_cnt[0] == max_cluster) { |
108 | #ifdef CONFIG_HOTPLUG_CPU | ||
109 | /* Don't use APIC shortcuts in CPU hotplug to avoid races */ | ||
110 | genapic = &apic_physflat; | ||
111 | #else | ||
107 | genapic = &apic_flat; | 112 | genapic = &apic_flat; |
108 | else | 113 | #endif |
114 | } else | ||
109 | genapic = &apic_cluster; | 115 | genapic = &apic_cluster; |
110 | 116 | ||
111 | print: | 117 | print: |
diff --git a/arch/x86_64/kernel/genapic_cluster.c b/arch/x86_64/kernel/genapic_cluster.c index f6523dd1bc09..a472d62f899a 100644 --- a/arch/x86_64/kernel/genapic_cluster.c +++ b/arch/x86_64/kernel/genapic_cluster.c | |||
@@ -51,10 +51,10 @@ static void cluster_init_apic_ldr(void) | |||
51 | count = 3; | 51 | count = 3; |
52 | id = my_cluster | (1UL << count); | 52 | id = my_cluster | (1UL << count); |
53 | x86_cpu_to_log_apicid[smp_processor_id()] = id; | 53 | x86_cpu_to_log_apicid[smp_processor_id()] = id; |
54 | apic_write_around(APIC_DFR, APIC_DFR_CLUSTER); | 54 | apic_write(APIC_DFR, APIC_DFR_CLUSTER); |
55 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | 55 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; |
56 | val |= SET_APIC_LOGICAL_ID(id); | 56 | val |= SET_APIC_LOGICAL_ID(id); |
57 | apic_write_around(APIC_LDR, val); | 57 | apic_write(APIC_LDR, val); |
58 | } | 58 | } |
59 | 59 | ||
60 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ | 60 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ |
diff --git a/arch/x86_64/kernel/genapic_flat.c b/arch/x86_64/kernel/genapic_flat.c index 6d57da96bf8c..9da3edb799ea 100644 --- a/arch/x86_64/kernel/genapic_flat.c +++ b/arch/x86_64/kernel/genapic_flat.c | |||
@@ -38,10 +38,10 @@ static void flat_init_apic_ldr(void) | |||
38 | num = smp_processor_id(); | 38 | num = smp_processor_id(); |
39 | id = 1UL << num; | 39 | id = 1UL << num; |
40 | x86_cpu_to_log_apicid[num] = id; | 40 | x86_cpu_to_log_apicid[num] = id; |
41 | apic_write_around(APIC_DFR, APIC_DFR_FLAT); | 41 | apic_write(APIC_DFR, APIC_DFR_FLAT); |
42 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | 42 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; |
43 | val |= SET_APIC_LOGICAL_ID(id); | 43 | val |= SET_APIC_LOGICAL_ID(id); |
44 | apic_write_around(APIC_LDR, val); | 44 | apic_write(APIC_LDR, val); |
45 | } | 45 | } |
46 | 46 | ||
47 | static void flat_send_IPI_mask(cpumask_t cpumask, int vector) | 47 | static void flat_send_IPI_mask(cpumask_t cpumask, int vector) |
@@ -62,7 +62,7 @@ static void flat_send_IPI_mask(cpumask_t cpumask, int vector) | |||
62 | * prepare target chip field | 62 | * prepare target chip field |
63 | */ | 63 | */ |
64 | cfg = __prepare_ICR2(mask); | 64 | cfg = __prepare_ICR2(mask); |
65 | apic_write_around(APIC_ICR2, cfg); | 65 | apic_write(APIC_ICR2, cfg); |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * program the ICR | 68 | * program the ICR |
@@ -72,7 +72,7 @@ static void flat_send_IPI_mask(cpumask_t cpumask, int vector) | |||
72 | /* | 72 | /* |
73 | * Send the IPI. The write to APIC_ICR fires this off. | 73 | * Send the IPI. The write to APIC_ICR fires this off. |
74 | */ | 74 | */ |
75 | apic_write_around(APIC_ICR, cfg); | 75 | apic_write(APIC_ICR, cfg); |
76 | local_irq_restore(flags); | 76 | local_irq_restore(flags); |
77 | } | 77 | } |
78 | 78 | ||
@@ -177,9 +177,9 @@ static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask) | |||
177 | 177 | ||
178 | struct genapic apic_physflat = { | 178 | struct genapic apic_physflat = { |
179 | .name = "physical flat", | 179 | .name = "physical flat", |
180 | .int_delivery_mode = dest_LowestPrio, | 180 | .int_delivery_mode = dest_Fixed, |
181 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | 181 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), |
182 | .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_LOWEST, | 182 | .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_FIXED, |
183 | .target_cpus = physflat_target_cpus, | 183 | .target_cpus = physflat_target_cpus, |
184 | .apic_id_registered = flat_apic_id_registered, | 184 | .apic_id_registered = flat_apic_id_registered, |
185 | .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/ | 185 | .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/ |
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S index 98ff5eb32b9a..4592bf21fcaf 100644 --- a/arch/x86_64/kernel/head.S +++ b/arch/x86_64/kernel/head.S | |||
@@ -270,7 +270,7 @@ ENTRY(level3_kernel_pgt) | |||
270 | .org 0x4000 | 270 | .org 0x4000 |
271 | ENTRY(level2_ident_pgt) | 271 | ENTRY(level2_ident_pgt) |
272 | /* 40MB for bootup. */ | 272 | /* 40MB for bootup. */ |
273 | .quad 0x0000000000000283 | 273 | .quad 0x0000000000000183 |
274 | .quad 0x0000000000200183 | 274 | .quad 0x0000000000200183 |
275 | .quad 0x0000000000400183 | 275 | .quad 0x0000000000400183 |
276 | .quad 0x0000000000600183 | 276 | .quad 0x0000000000600183 |
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c index a89169095129..b2a238b5a17e 100644 --- a/arch/x86_64/kernel/i8259.c +++ b/arch/x86_64/kernel/i8259.c | |||
@@ -18,15 +18,12 @@ | |||
18 | #include <asm/atomic.h> | 18 | #include <asm/atomic.h> |
19 | #include <asm/system.h> | 19 | #include <asm/system.h> |
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | #include <asm/irq.h> | ||
22 | #include <asm/hw_irq.h> | 21 | #include <asm/hw_irq.h> |
23 | #include <asm/pgtable.h> | 22 | #include <asm/pgtable.h> |
24 | #include <asm/delay.h> | 23 | #include <asm/delay.h> |
25 | #include <asm/desc.h> | 24 | #include <asm/desc.h> |
26 | #include <asm/apic.h> | 25 | #include <asm/apic.h> |
27 | 26 | ||
28 | #include <linux/irq.h> | ||
29 | |||
30 | /* | 27 | /* |
31 | * Common place to define all x86 IRQ vectors | 28 | * Common place to define all x86 IRQ vectors |
32 | * | 29 | * |
@@ -486,7 +483,14 @@ void spurious_interrupt(void); | |||
486 | void error_interrupt(void); | 483 | void error_interrupt(void); |
487 | void reschedule_interrupt(void); | 484 | void reschedule_interrupt(void); |
488 | void call_function_interrupt(void); | 485 | void call_function_interrupt(void); |
489 | void invalidate_interrupt(void); | 486 | void invalidate_interrupt0(void); |
487 | void invalidate_interrupt1(void); | ||
488 | void invalidate_interrupt2(void); | ||
489 | void invalidate_interrupt3(void); | ||
490 | void invalidate_interrupt4(void); | ||
491 | void invalidate_interrupt5(void); | ||
492 | void invalidate_interrupt6(void); | ||
493 | void invalidate_interrupt7(void); | ||
490 | void thermal_interrupt(void); | 494 | void thermal_interrupt(void); |
491 | void i8254_timer_resume(void); | 495 | void i8254_timer_resume(void); |
492 | 496 | ||
@@ -562,8 +566,15 @@ void __init init_IRQ(void) | |||
562 | */ | 566 | */ |
563 | set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); | 567 | set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); |
564 | 568 | ||
565 | /* IPI for invalidation */ | 569 | /* IPIs for invalidation */ |
566 | set_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt); | 570 | set_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0); |
571 | set_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1); | ||
572 | set_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2); | ||
573 | set_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3); | ||
574 | set_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4); | ||
575 | set_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5); | ||
576 | set_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6); | ||
577 | set_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7); | ||
567 | 578 | ||
568 | /* IPI for generic function call */ | 579 | /* IPI for generic function call */ |
569 | set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); | 580 | set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); |
diff --git a/arch/x86_64/kernel/init_task.c b/arch/x86_64/kernel/init_task.c index c4dc91491157..e0ba5c1043fd 100644 --- a/arch/x86_64/kernel/init_task.c +++ b/arch/x86_64/kernel/init_task.c | |||
@@ -44,6 +44,6 @@ EXPORT_SYMBOL(init_task); | |||
44 | * section. Since TSS's are completely CPU-local, we want them | 44 | * section. Since TSS's are completely CPU-local, we want them |
45 | * on exact cacheline boundaries, to eliminate cacheline ping-pong. | 45 | * on exact cacheline boundaries, to eliminate cacheline ping-pong. |
46 | */ | 46 | */ |
47 | DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp; | 47 | DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp = INIT_TSS; |
48 | 48 | ||
49 | #define ALIGN_TO_4K __attribute__((section(".data.init_task"))) | 49 | #define ALIGN_TO_4K __attribute__((section(".data.init_task"))) |
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 5f1529be1237..522944a000ad 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c | |||
@@ -21,7 +21,6 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/irq.h> | ||
25 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
26 | #include <linux/init.h> | 25 | #include <linux/init.h> |
27 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
@@ -45,6 +44,8 @@ int sis_apic_bug; /* not actually supported, dummy for compile */ | |||
45 | 44 | ||
46 | static int no_timer_check; | 45 | static int no_timer_check; |
47 | 46 | ||
47 | int disable_timer_pin_1 __initdata; | ||
48 | |||
48 | static DEFINE_SPINLOCK(ioapic_lock); | 49 | static DEFINE_SPINLOCK(ioapic_lock); |
49 | 50 | ||
50 | /* | 51 | /* |
@@ -298,6 +299,15 @@ void __init check_ioapic(void) | |||
298 | #endif | 299 | #endif |
299 | /* RED-PEN skip them on mptables too? */ | 300 | /* RED-PEN skip them on mptables too? */ |
300 | return; | 301 | return; |
302 | case PCI_VENDOR_ID_ATI: | ||
303 | /* All timer interrupts on atiixp | ||
304 | are doubled. Disable one. */ | ||
305 | if (disable_timer_pin_1 == 0) { | ||
306 | disable_timer_pin_1 = 1; | ||
307 | printk(KERN_INFO | ||
308 | "ATI board detected. Disabling timer pin 1.\n"); | ||
309 | } | ||
310 | return; | ||
301 | } | 311 | } |
302 | 312 | ||
303 | /* No multi-function device? */ | 313 | /* No multi-function device? */ |
@@ -1022,13 +1032,11 @@ void __apicdebuginit print_local_APIC(void * dummy) | |||
1022 | v = apic_read(APIC_TASKPRI); | 1032 | v = apic_read(APIC_TASKPRI); |
1023 | printk(KERN_DEBUG "... APIC TASKPRI: %08x (%02x)\n", v, v & APIC_TPRI_MASK); | 1033 | printk(KERN_DEBUG "... APIC TASKPRI: %08x (%02x)\n", v, v & APIC_TPRI_MASK); |
1024 | 1034 | ||
1025 | if (APIC_INTEGRATED(ver)) { /* !82489DX */ | 1035 | v = apic_read(APIC_ARBPRI); |
1026 | v = apic_read(APIC_ARBPRI); | 1036 | printk(KERN_DEBUG "... APIC ARBPRI: %08x (%02x)\n", v, |
1027 | printk(KERN_DEBUG "... APIC ARBPRI: %08x (%02x)\n", v, | 1037 | v & APIC_ARBPRI_MASK); |
1028 | v & APIC_ARBPRI_MASK); | 1038 | v = apic_read(APIC_PROCPRI); |
1029 | v = apic_read(APIC_PROCPRI); | 1039 | printk(KERN_DEBUG "... APIC PROCPRI: %08x\n", v); |
1030 | printk(KERN_DEBUG "... APIC PROCPRI: %08x\n", v); | ||
1031 | } | ||
1032 | 1040 | ||
1033 | v = apic_read(APIC_EOI); | 1041 | v = apic_read(APIC_EOI); |
1034 | printk(KERN_DEBUG "... APIC EOI: %08x\n", v); | 1042 | printk(KERN_DEBUG "... APIC EOI: %08x\n", v); |
@@ -1048,12 +1056,8 @@ void __apicdebuginit print_local_APIC(void * dummy) | |||
1048 | printk(KERN_DEBUG "... APIC IRR field:\n"); | 1056 | printk(KERN_DEBUG "... APIC IRR field:\n"); |
1049 | print_APIC_bitfield(APIC_IRR); | 1057 | print_APIC_bitfield(APIC_IRR); |
1050 | 1058 | ||
1051 | if (APIC_INTEGRATED(ver)) { /* !82489DX */ | 1059 | v = apic_read(APIC_ESR); |
1052 | if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ | 1060 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); |
1053 | apic_write(APIC_ESR, 0); | ||
1054 | v = apic_read(APIC_ESR); | ||
1055 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); | ||
1056 | } | ||
1057 | 1061 | ||
1058 | v = apic_read(APIC_ICR); | 1062 | v = apic_read(APIC_ICR); |
1059 | printk(KERN_DEBUG "... APIC ICR: %08x\n", v); | 1063 | printk(KERN_DEBUG "... APIC ICR: %08x\n", v); |
@@ -1665,6 +1669,8 @@ static inline void check_timer(void) | |||
1665 | setup_nmi(); | 1669 | setup_nmi(); |
1666 | enable_8259A_irq(0); | 1670 | enable_8259A_irq(0); |
1667 | } | 1671 | } |
1672 | if (disable_timer_pin_1 > 0) | ||
1673 | clear_IO_APIC_pin(0, pin1); | ||
1668 | return; | 1674 | return; |
1669 | } | 1675 | } |
1670 | clear_IO_APIC_pin(0, pin1); | 1676 | clear_IO_APIC_pin(0, pin1); |
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c index 849a20aec7ca..d6a04a8320a3 100644 --- a/arch/x86_64/kernel/irq.c +++ b/arch/x86_64/kernel/irq.c | |||
@@ -99,7 +99,6 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) | |||
99 | unsigned irq = regs->orig_rax & 0xff; | 99 | unsigned irq = regs->orig_rax & 0xff; |
100 | 100 | ||
101 | irq_enter(); | 101 | irq_enter(); |
102 | BUG_ON(irq > 256); | ||
103 | 102 | ||
104 | __do_IRQ(irq, regs); | 103 | __do_IRQ(irq, regs); |
105 | irq_exit(); | 104 | irq_exit(); |
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c index 8aa56736cde3..969365c0771b 100644 --- a/arch/x86_64/kernel/mce.c +++ b/arch/x86_64/kernel/mce.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/cpu.h> | 18 | #include <linux/cpu.h> |
19 | #include <linux/percpu.h> | 19 | #include <linux/percpu.h> |
20 | #include <linux/ctype.h> | ||
20 | #include <asm/processor.h> | 21 | #include <asm/processor.h> |
21 | #include <asm/msr.h> | 22 | #include <asm/msr.h> |
22 | #include <asm/mce.h> | 23 | #include <asm/mce.h> |
@@ -56,15 +57,19 @@ void mce_log(struct mce *mce) | |||
56 | smp_wmb(); | 57 | smp_wmb(); |
57 | for (;;) { | 58 | for (;;) { |
58 | entry = rcu_dereference(mcelog.next); | 59 | entry = rcu_dereference(mcelog.next); |
59 | /* When the buffer fills up discard new entries. Assume | 60 | for (;;) { |
60 | that the earlier errors are the more interesting. */ | 61 | /* When the buffer fills up discard new entries. Assume |
61 | if (entry >= MCE_LOG_LEN) { | 62 | that the earlier errors are the more interesting. */ |
62 | set_bit(MCE_OVERFLOW, &mcelog.flags); | 63 | if (entry >= MCE_LOG_LEN) { |
63 | return; | 64 | set_bit(MCE_OVERFLOW, &mcelog.flags); |
65 | return; | ||
66 | } | ||
67 | /* Old left over entry. Skip. */ | ||
68 | if (mcelog.entry[entry].finished) { | ||
69 | entry++; | ||
70 | continue; | ||
71 | } | ||
64 | } | 72 | } |
65 | /* Old left over entry. Skip. */ | ||
66 | if (mcelog.entry[entry].finished) | ||
67 | continue; | ||
68 | smp_rmb(); | 73 | smp_rmb(); |
69 | next = entry + 1; | 74 | next = entry + 1; |
70 | if (cmpxchg(&mcelog.next, entry, next) == entry) | 75 | if (cmpxchg(&mcelog.next, entry, next) == entry) |
@@ -404,9 +409,15 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff | |||
404 | } | 409 | } |
405 | 410 | ||
406 | err = 0; | 411 | err = 0; |
407 | for (i = 0; i < next; i++) { | 412 | for (i = 0; i < next; i++) { |
408 | if (!mcelog.entry[i].finished) | 413 | unsigned long start = jiffies; |
409 | continue; | 414 | while (!mcelog.entry[i].finished) { |
415 | if (!time_before(jiffies, start + 2)) { | ||
416 | memset(mcelog.entry + i,0, sizeof(struct mce)); | ||
417 | continue; | ||
418 | } | ||
419 | cpu_relax(); | ||
420 | } | ||
410 | smp_rmb(); | 421 | smp_rmb(); |
411 | err |= copy_to_user(buf, mcelog.entry + i, sizeof(struct mce)); | 422 | err |= copy_to_user(buf, mcelog.entry + i, sizeof(struct mce)); |
412 | buf += sizeof(struct mce); | 423 | buf += sizeof(struct mce); |
@@ -479,6 +490,7 @@ static int __init mcheck_disable(char *str) | |||
479 | 490 | ||
480 | /* mce=off disables machine check. Note you can reenable it later | 491 | /* mce=off disables machine check. Note you can reenable it later |
481 | using sysfs. | 492 | using sysfs. |
493 | mce=TOLERANCELEVEL (number, see above) | ||
482 | mce=bootlog Log MCEs from before booting. Disabled by default to work | 494 | mce=bootlog Log MCEs from before booting. Disabled by default to work |
483 | around buggy BIOS that leave bogus MCEs. */ | 495 | around buggy BIOS that leave bogus MCEs. */ |
484 | static int __init mcheck_enable(char *str) | 496 | static int __init mcheck_enable(char *str) |
@@ -489,6 +501,8 @@ static int __init mcheck_enable(char *str) | |||
489 | mce_dont_init = 1; | 501 | mce_dont_init = 1; |
490 | else if (!strcmp(str, "bootlog")) | 502 | else if (!strcmp(str, "bootlog")) |
491 | mce_bootlog = 1; | 503 | mce_bootlog = 1; |
504 | else if (isdigit(str[0])) | ||
505 | get_option(&str, &tolerant); | ||
492 | else | 506 | else |
493 | printk("mce= argument %s ignored. Please use /sys", str); | 507 | printk("mce= argument %s ignored. Please use /sys", str); |
494 | return 0; | 508 | return 0; |
@@ -501,10 +515,12 @@ __setup("mce", mcheck_enable); | |||
501 | * Sysfs support | 515 | * Sysfs support |
502 | */ | 516 | */ |
503 | 517 | ||
504 | /* On resume clear all MCE state. Don't want to see leftovers from the BIOS. */ | 518 | /* On resume clear all MCE state. Don't want to see leftovers from the BIOS. |
519 | Only one CPU is active at this time, the others get readded later using | ||
520 | CPU hotplug. */ | ||
505 | static int mce_resume(struct sys_device *dev) | 521 | static int mce_resume(struct sys_device *dev) |
506 | { | 522 | { |
507 | on_each_cpu(mce_init, NULL, 1, 1); | 523 | mce_init(NULL); |
508 | return 0; | 524 | return 0; |
509 | } | 525 | } |
510 | 526 | ||
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 8d8ed6ae1d0c..f16d38d09daf 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/irq.h> | ||
18 | #include <linux/init.h> | 17 | #include <linux/init.h> |
19 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
20 | #include <linux/config.h> | 19 | #include <linux/config.h> |
@@ -46,8 +45,6 @@ int acpi_found_madt; | |||
46 | int apic_version [MAX_APICS]; | 45 | int apic_version [MAX_APICS]; |
47 | unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; | 46 | unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; |
48 | int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; | 47 | int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; |
49 | unsigned char pci_bus_to_node [256]; | ||
50 | EXPORT_SYMBOL(pci_bus_to_node); | ||
51 | 48 | ||
52 | static int mp_current_pci_id = 0; | 49 | static int mp_current_pci_id = 0; |
53 | /* I/O APIC entries */ | 50 | /* I/O APIC entries */ |
@@ -705,7 +702,7 @@ void __init mp_register_lapic ( | |||
705 | 702 | ||
706 | processor.mpc_type = MP_PROCESSOR; | 703 | processor.mpc_type = MP_PROCESSOR; |
707 | processor.mpc_apicid = id; | 704 | processor.mpc_apicid = id; |
708 | processor.mpc_apicver = 0x10; /* TBD: lapic version */ | 705 | processor.mpc_apicver = GET_APIC_VERSION(apic_read(APIC_LVR)); |
709 | processor.mpc_cpuflag = (enabled ? CPU_ENABLED : 0); | 706 | processor.mpc_cpuflag = (enabled ? CPU_ENABLED : 0); |
710 | processor.mpc_cpuflag |= (boot_cpu ? CPU_BOOTPROCESSOR : 0); | 707 | processor.mpc_cpuflag |= (boot_cpu ? CPU_BOOTPROCESSOR : 0); |
711 | processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | | 708 | processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | |
diff --git a/arch/x86_64/kernel/msr.c b/arch/x86_64/kernel/msr.c deleted file mode 100644 index 598953ab0154..000000000000 --- a/arch/x86_64/kernel/msr.c +++ /dev/null | |||
@@ -1,279 +0,0 @@ | |||
1 | /* ----------------------------------------------------------------------- * | ||
2 | * | ||
3 | * Copyright 2000 H. Peter Anvin - All Rights Reserved | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139, | ||
8 | * USA; either version 2 of the License, or (at your option) any later | ||
9 | * version; incorporated herein by reference. | ||
10 | * | ||
11 | * ----------------------------------------------------------------------- */ | ||
12 | |||
13 | /* | ||
14 | * msr.c | ||
15 | * | ||
16 | * x86 MSR access device | ||
17 | * | ||
18 | * This device is accessed by lseek() to the appropriate register number | ||
19 | * and then read/write in chunks of 8 bytes. A larger size means multiple | ||
20 | * reads or writes of the same register. | ||
21 | * | ||
22 | * This driver uses /dev/cpu/%d/msr where %d is the minor number, and on | ||
23 | * an SMP box will direct the access to CPU %d. | ||
24 | */ | ||
25 | |||
26 | #include <linux/module.h> | ||
27 | #include <linux/config.h> | ||
28 | |||
29 | #include <linux/types.h> | ||
30 | #include <linux/errno.h> | ||
31 | #include <linux/fcntl.h> | ||
32 | #include <linux/init.h> | ||
33 | #include <linux/poll.h> | ||
34 | #include <linux/smp.h> | ||
35 | #include <linux/smp_lock.h> | ||
36 | #include <linux/major.h> | ||
37 | #include <linux/fs.h> | ||
38 | |||
39 | #include <asm/processor.h> | ||
40 | #include <asm/msr.h> | ||
41 | #include <asm/uaccess.h> | ||
42 | #include <asm/system.h> | ||
43 | |||
44 | /* Note: "err" is handled in a funny way below. Otherwise one version | ||
45 | of gcc or another breaks. */ | ||
46 | |||
47 | static inline int wrmsr_eio(u32 reg, u32 eax, u32 edx) | ||
48 | { | ||
49 | int err; | ||
50 | |||
51 | asm volatile ("1: wrmsr\n" | ||
52 | "2:\n" | ||
53 | ".section .fixup,\"ax\"\n" | ||
54 | "3: movl %4,%0\n" | ||
55 | " jmp 2b\n" | ||
56 | ".previous\n" | ||
57 | ".section __ex_table,\"a\"\n" | ||
58 | " .align 8\n" " .quad 1b,3b\n" ".previous":"=&bDS" (err) | ||
59 | :"a"(eax), "d"(edx), "c"(reg), "i"(-EIO), "0"(0)); | ||
60 | |||
61 | return err; | ||
62 | } | ||
63 | |||
64 | static inline int rdmsr_eio(u32 reg, u32 *eax, u32 *edx) | ||
65 | { | ||
66 | int err; | ||
67 | |||
68 | asm volatile ("1: rdmsr\n" | ||
69 | "2:\n" | ||
70 | ".section .fixup,\"ax\"\n" | ||
71 | "3: movl %4,%0\n" | ||
72 | " jmp 2b\n" | ||
73 | ".previous\n" | ||
74 | ".section __ex_table,\"a\"\n" | ||
75 | " .align 8\n" | ||
76 | " .quad 1b,3b\n" | ||
77 | ".previous":"=&bDS" (err), "=a"(*eax), "=d"(*edx) | ||
78 | :"c"(reg), "i"(-EIO), "0"(0)); | ||
79 | |||
80 | return err; | ||
81 | } | ||
82 | |||
83 | #ifdef CONFIG_SMP | ||
84 | |||
85 | struct msr_command { | ||
86 | int cpu; | ||
87 | int err; | ||
88 | u32 reg; | ||
89 | u32 data[2]; | ||
90 | }; | ||
91 | |||
92 | static void msr_smp_wrmsr(void *cmd_block) | ||
93 | { | ||
94 | struct msr_command *cmd = (struct msr_command *)cmd_block; | ||
95 | |||
96 | if (cmd->cpu == smp_processor_id()) | ||
97 | cmd->err = wrmsr_eio(cmd->reg, cmd->data[0], cmd->data[1]); | ||
98 | } | ||
99 | |||
100 | static void msr_smp_rdmsr(void *cmd_block) | ||
101 | { | ||
102 | struct msr_command *cmd = (struct msr_command *)cmd_block; | ||
103 | |||
104 | if (cmd->cpu == smp_processor_id()) | ||
105 | cmd->err = rdmsr_eio(cmd->reg, &cmd->data[0], &cmd->data[1]); | ||
106 | } | ||
107 | |||
108 | static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx) | ||
109 | { | ||
110 | struct msr_command cmd; | ||
111 | int ret; | ||
112 | |||
113 | preempt_disable(); | ||
114 | if (cpu == smp_processor_id()) { | ||
115 | ret = wrmsr_eio(reg, eax, edx); | ||
116 | } else { | ||
117 | cmd.cpu = cpu; | ||
118 | cmd.reg = reg; | ||
119 | cmd.data[0] = eax; | ||
120 | cmd.data[1] = edx; | ||
121 | |||
122 | smp_call_function(msr_smp_wrmsr, &cmd, 1, 1); | ||
123 | ret = cmd.err; | ||
124 | } | ||
125 | preempt_enable(); | ||
126 | return ret; | ||
127 | } | ||
128 | |||
129 | static inline int do_rdmsr(int cpu, u32 reg, u32 * eax, u32 * edx) | ||
130 | { | ||
131 | struct msr_command cmd; | ||
132 | int ret; | ||
133 | |||
134 | preempt_disable(); | ||
135 | if (cpu == smp_processor_id()) { | ||
136 | ret = rdmsr_eio(reg, eax, edx); | ||
137 | } else { | ||
138 | cmd.cpu = cpu; | ||
139 | cmd.reg = reg; | ||
140 | |||
141 | smp_call_function(msr_smp_rdmsr, &cmd, 1, 1); | ||
142 | |||
143 | *eax = cmd.data[0]; | ||
144 | *edx = cmd.data[1]; | ||
145 | |||
146 | ret = cmd.err; | ||
147 | } | ||
148 | preempt_enable(); | ||
149 | return ret; | ||
150 | } | ||
151 | |||
152 | #else /* ! CONFIG_SMP */ | ||
153 | |||
154 | static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx) | ||
155 | { | ||
156 | return wrmsr_eio(reg, eax, edx); | ||
157 | } | ||
158 | |||
159 | static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx) | ||
160 | { | ||
161 | return rdmsr_eio(reg, eax, edx); | ||
162 | } | ||
163 | |||
164 | #endif /* ! CONFIG_SMP */ | ||
165 | |||
166 | static loff_t msr_seek(struct file *file, loff_t offset, int orig) | ||
167 | { | ||
168 | loff_t ret = -EINVAL; | ||
169 | |||
170 | lock_kernel(); | ||
171 | switch (orig) { | ||
172 | case 0: | ||
173 | file->f_pos = offset; | ||
174 | ret = file->f_pos; | ||
175 | break; | ||
176 | case 1: | ||
177 | file->f_pos += offset; | ||
178 | ret = file->f_pos; | ||
179 | } | ||
180 | unlock_kernel(); | ||
181 | return ret; | ||
182 | } | ||
183 | |||
184 | static ssize_t msr_read(struct file *file, char __user * buf, | ||
185 | size_t count, loff_t * ppos) | ||
186 | { | ||
187 | u32 __user *tmp = (u32 __user *) buf; | ||
188 | u32 data[2]; | ||
189 | size_t rv; | ||
190 | u32 reg = *ppos; | ||
191 | int cpu = iminor(file->f_dentry->d_inode); | ||
192 | int err; | ||
193 | |||
194 | if (count % 8) | ||
195 | return -EINVAL; /* Invalid chunk size */ | ||
196 | |||
197 | for (rv = 0; count; count -= 8) { | ||
198 | err = do_rdmsr(cpu, reg, &data[0], &data[1]); | ||
199 | if (err) | ||
200 | return err; | ||
201 | if (copy_to_user(tmp, &data, 8)) | ||
202 | return -EFAULT; | ||
203 | tmp += 2; | ||
204 | } | ||
205 | |||
206 | return ((char __user *)tmp) - buf; | ||
207 | } | ||
208 | |||
209 | static ssize_t msr_write(struct file *file, const char __user *buf, | ||
210 | size_t count, loff_t *ppos) | ||
211 | { | ||
212 | const u32 __user *tmp = (const u32 __user *)buf; | ||
213 | u32 data[2]; | ||
214 | size_t rv; | ||
215 | u32 reg = *ppos; | ||
216 | int cpu = iminor(file->f_dentry->d_inode); | ||
217 | int err; | ||
218 | |||
219 | if (count % 8) | ||
220 | return -EINVAL; /* Invalid chunk size */ | ||
221 | |||
222 | for (rv = 0; count; count -= 8) { | ||
223 | if (copy_from_user(&data, tmp, 8)) | ||
224 | return -EFAULT; | ||
225 | err = do_wrmsr(cpu, reg, data[0], data[1]); | ||
226 | if (err) | ||
227 | return err; | ||
228 | tmp += 2; | ||
229 | } | ||
230 | |||
231 | return ((char __user *)tmp) - buf; | ||
232 | } | ||
233 | |||
234 | static int msr_open(struct inode *inode, struct file *file) | ||
235 | { | ||
236 | unsigned int cpu = iminor(file->f_dentry->d_inode); | ||
237 | struct cpuinfo_x86 *c = &(cpu_data)[cpu]; | ||
238 | |||
239 | if (cpu >= NR_CPUS || !cpu_online(cpu)) | ||
240 | return -ENXIO; /* No such CPU */ | ||
241 | if (!cpu_has(c, X86_FEATURE_MSR)) | ||
242 | return -EIO; /* MSR not supported */ | ||
243 | |||
244 | return 0; | ||
245 | } | ||
246 | |||
247 | /* | ||
248 | * File operations we support | ||
249 | */ | ||
250 | static struct file_operations msr_fops = { | ||
251 | .owner = THIS_MODULE, | ||
252 | .llseek = msr_seek, | ||
253 | .read = msr_read, | ||
254 | .write = msr_write, | ||
255 | .open = msr_open, | ||
256 | }; | ||
257 | |||
258 | static int __init msr_init(void) | ||
259 | { | ||
260 | if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) { | ||
261 | printk(KERN_ERR "msr: unable to get major %d for msr\n", | ||
262 | MSR_MAJOR); | ||
263 | return -EBUSY; | ||
264 | } | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | static void __exit msr_exit(void) | ||
270 | { | ||
271 | unregister_chrdev(MSR_MAJOR, "cpu/msr"); | ||
272 | } | ||
273 | |||
274 | module_init(msr_init); | ||
275 | module_exit(msr_exit) | ||
276 | |||
277 | MODULE_AUTHOR("H. Peter Anvin <hpa@zytor.com>"); | ||
278 | MODULE_DESCRIPTION("x86 generic MSR driver"); | ||
279 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c index caf164959e19..4388b8a5bae7 100644 --- a/arch/x86_64/kernel/nmi.c +++ b/arch/x86_64/kernel/nmi.c | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #include <linux/config.h> | 15 | #include <linux/config.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/irq.h> | ||
18 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
19 | #include <linux/bootmem.h> | 18 | #include <linux/bootmem.h> |
20 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
@@ -488,8 +487,8 @@ void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason) | |||
488 | == NOTIFY_STOP) { | 487 | == NOTIFY_STOP) { |
489 | local_set(&__get_cpu_var(alert_counter), 0); | 488 | local_set(&__get_cpu_var(alert_counter), 0); |
490 | return; | 489 | return; |
491 | } | 490 | } |
492 | die_nmi("NMI Watchdog detected LOCKUP on CPU%d", regs); | 491 | die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs); |
493 | } | 492 | } |
494 | } else { | 493 | } else { |
495 | __get_cpu_var(last_irq_sum) = sum; | 494 | __get_cpu_var(last_irq_sum) = sum; |
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index 57f35c68aa34..cf0a0315d586 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c | |||
@@ -191,11 +191,9 @@ static void *dma_alloc_pages(struct device *dev, unsigned gfp, unsigned order) | |||
191 | { | 191 | { |
192 | struct page *page; | 192 | struct page *page; |
193 | int node; | 193 | int node; |
194 | if (dev->bus == &pci_bus_type) { | 194 | if (dev->bus == &pci_bus_type) |
195 | cpumask_t mask; | 195 | node = pcibus_to_node(to_pci_dev(dev)->bus); |
196 | mask = pcibus_to_cpumask(to_pci_dev(dev)->bus); | 196 | else |
197 | node = cpu_to_node(first_cpu(mask)); | ||
198 | } else | ||
199 | node = numa_node_id(); | 197 | node = numa_node_id(); |
200 | page = alloc_pages_node(node, gfp, order); | 198 | page = alloc_pages_node(node, gfp, order); |
201 | return page ? page_address(page) : NULL; | 199 | return page ? page_address(page) : NULL; |
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 8661f82ac70b..b5a89c0bdf59 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/a.out.h> | 32 | #include <linux/a.out.h> |
33 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/irq.h> | ||
36 | #include <linux/ptrace.h> | 35 | #include <linux/ptrace.h> |
37 | #include <linux/utsname.h> | 36 | #include <linux/utsname.h> |
38 | #include <linux/random.h> | 37 | #include <linux/random.h> |
@@ -123,6 +122,7 @@ static void poll_idle (void) | |||
123 | : : | 122 | : : |
124 | "i" (_TIF_NEED_RESCHED), | 123 | "i" (_TIF_NEED_RESCHED), |
125 | "m" (current_thread_info()->flags)); | 124 | "m" (current_thread_info()->flags)); |
125 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
126 | } else { | 126 | } else { |
127 | set_need_resched(); | 127 | set_need_resched(); |
128 | } | 128 | } |
@@ -271,8 +271,11 @@ void __show_regs(struct pt_regs * regs) | |||
271 | 271 | ||
272 | printk("\n"); | 272 | printk("\n"); |
273 | print_modules(); | 273 | print_modules(); |
274 | printk("Pid: %d, comm: %.20s %s %s\n", | 274 | printk("Pid: %d, comm: %.20s %s %s %.*s\n", |
275 | current->pid, current->comm, print_tainted(), system_utsname.release); | 275 | current->pid, current->comm, print_tainted(), |
276 | system_utsname.release, | ||
277 | (int)strcspn(system_utsname.version, " "), | ||
278 | system_utsname.version); | ||
276 | printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip); | 279 | printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip); |
277 | printk_address(regs->rip); | 280 | printk_address(regs->rip); |
278 | printk("\nRSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, regs->eflags); | 281 | printk("\nRSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, regs->eflags); |
@@ -483,33 +486,6 @@ out: | |||
483 | } | 486 | } |
484 | 487 | ||
485 | /* | 488 | /* |
486 | * This function selects if the context switch from prev to next | ||
487 | * has to tweak the TSC disable bit in the cr4. | ||
488 | */ | ||
489 | static inline void disable_tsc(struct task_struct *prev_p, | ||
490 | struct task_struct *next_p) | ||
491 | { | ||
492 | struct thread_info *prev, *next; | ||
493 | |||
494 | /* | ||
495 | * gcc should eliminate the ->thread_info dereference if | ||
496 | * has_secure_computing returns 0 at compile time (SECCOMP=n). | ||
497 | */ | ||
498 | prev = prev_p->thread_info; | ||
499 | next = next_p->thread_info; | ||
500 | |||
501 | if (has_secure_computing(prev) || has_secure_computing(next)) { | ||
502 | /* slow path here */ | ||
503 | if (has_secure_computing(prev) && | ||
504 | !has_secure_computing(next)) { | ||
505 | write_cr4(read_cr4() & ~X86_CR4_TSD); | ||
506 | } else if (!has_secure_computing(prev) && | ||
507 | has_secure_computing(next)) | ||
508 | write_cr4(read_cr4() | X86_CR4_TSD); | ||
509 | } | ||
510 | } | ||
511 | |||
512 | /* | ||
513 | * This special macro can be used to load a debugging register | 489 | * This special macro can be used to load a debugging register |
514 | */ | 490 | */ |
515 | #define loaddebug(thread,r) set_debug(thread->debugreg ## r, r) | 491 | #define loaddebug(thread,r) set_debug(thread->debugreg ## r, r) |
@@ -627,8 +603,6 @@ struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct * | |||
627 | } | 603 | } |
628 | } | 604 | } |
629 | 605 | ||
630 | disable_tsc(prev_p, next_p); | ||
631 | |||
632 | return prev_p; | 606 | return prev_p; |
633 | } | 607 | } |
634 | 608 | ||
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 9aec524be3eb..351d8d64c2fb 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -336,6 +336,11 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
336 | #endif | 336 | #endif |
337 | #endif | 337 | #endif |
338 | 338 | ||
339 | if (!memcmp(from, "disable_timer_pin_1", 19)) | ||
340 | disable_timer_pin_1 = 1; | ||
341 | if (!memcmp(from, "enable_timer_pin_1", 18)) | ||
342 | disable_timer_pin_1 = -1; | ||
343 | |||
339 | if (!memcmp(from, "nolapic", 7) || | 344 | if (!memcmp(from, "nolapic", 7) || |
340 | !memcmp(from, "disableapic", 11)) | 345 | !memcmp(from, "disableapic", 11)) |
341 | disable_apic = 1; | 346 | disable_apic = 1; |
@@ -755,6 +760,24 @@ static void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c) | |||
755 | } | 760 | } |
756 | } | 761 | } |
757 | 762 | ||
763 | #ifdef CONFIG_NUMA | ||
764 | static int nearby_node(int apicid) | ||
765 | { | ||
766 | int i; | ||
767 | for (i = apicid - 1; i >= 0; i--) { | ||
768 | int node = apicid_to_node[i]; | ||
769 | if (node != NUMA_NO_NODE && node_online(node)) | ||
770 | return node; | ||
771 | } | ||
772 | for (i = apicid + 1; i < MAX_LOCAL_APIC; i++) { | ||
773 | int node = apicid_to_node[i]; | ||
774 | if (node != NUMA_NO_NODE && node_online(node)) | ||
775 | return node; | ||
776 | } | ||
777 | return first_node(node_online_map); /* Shouldn't happen */ | ||
778 | } | ||
779 | #endif | ||
780 | |||
758 | /* | 781 | /* |
759 | * On a AMD dual core setup the lower bits of the APIC id distingush the cores. | 782 | * On a AMD dual core setup the lower bits of the APIC id distingush the cores. |
760 | * Assumes number of cores is a power of two. | 783 | * Assumes number of cores is a power of two. |
@@ -763,8 +786,11 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
763 | { | 786 | { |
764 | #ifdef CONFIG_SMP | 787 | #ifdef CONFIG_SMP |
765 | int cpu = smp_processor_id(); | 788 | int cpu = smp_processor_id(); |
766 | int node = 0; | ||
767 | unsigned bits; | 789 | unsigned bits; |
790 | #ifdef CONFIG_NUMA | ||
791 | int node = 0; | ||
792 | unsigned apicid = phys_proc_id[cpu]; | ||
793 | #endif | ||
768 | 794 | ||
769 | bits = 0; | 795 | bits = 0; |
770 | while ((1 << bits) < c->x86_num_cores) | 796 | while ((1 << bits) < c->x86_num_cores) |
@@ -776,20 +802,32 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
776 | phys_proc_id[cpu] >>= bits; | 802 | phys_proc_id[cpu] >>= bits; |
777 | 803 | ||
778 | #ifdef CONFIG_NUMA | 804 | #ifdef CONFIG_NUMA |
779 | /* When an ACPI SRAT table is available use the mappings from SRAT | 805 | node = phys_proc_id[cpu]; |
780 | instead. */ | 806 | if (apicid_to_node[apicid] != NUMA_NO_NODE) |
781 | if (acpi_numa <= 0) { | 807 | node = apicid_to_node[apicid]; |
782 | node = phys_proc_id[cpu]; | 808 | if (!node_online(node)) { |
783 | if (!node_online(node)) | 809 | /* Two possibilities here: |
784 | node = first_node(node_online_map); | 810 | - The CPU is missing memory and no node was created. |
785 | cpu_to_node[cpu] = node; | 811 | In that case try picking one from a nearby CPU |
786 | } else { | 812 | - The APIC IDs differ from the HyperTransport node IDs |
787 | node = cpu_to_node[cpu]; | 813 | which the K8 northbridge parsing fills in. |
788 | } | 814 | Assume they are all increased by a constant offset, |
815 | but in the same order as the HT nodeids. | ||
816 | If that doesn't result in a usable node fall back to the | ||
817 | path for the previous case. */ | ||
818 | int ht_nodeid = apicid - (phys_proc_id[0] << bits); | ||
819 | if (ht_nodeid >= 0 && | ||
820 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) | ||
821 | node = apicid_to_node[ht_nodeid]; | ||
822 | /* Pick a nearby node */ | ||
823 | if (!node_online(node)) | ||
824 | node = nearby_node(apicid); | ||
825 | } | ||
826 | cpu_to_node[cpu] = node; | ||
827 | |||
828 | printk(KERN_INFO "CPU %d(%d) -> Node %d -> Core %d\n", | ||
829 | cpu, c->x86_num_cores, node, cpu_core_id[cpu]); | ||
789 | #endif | 830 | #endif |
790 | |||
791 | printk(KERN_INFO "CPU %d(%d) -> Node %d -> Core %d\n", | ||
792 | cpu, c->x86_num_cores, node, cpu_core_id[cpu]); | ||
793 | #endif | 831 | #endif |
794 | } | 832 | } |
795 | 833 | ||
@@ -909,6 +947,25 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c) | |||
909 | return 1; | 947 | return 1; |
910 | } | 948 | } |
911 | 949 | ||
950 | static void srat_detect_node(void) | ||
951 | { | ||
952 | #ifdef CONFIG_NUMA | ||
953 | unsigned apicid, node; | ||
954 | int cpu = smp_processor_id(); | ||
955 | |||
956 | /* Don't do the funky fallback heuristics the AMD version employs | ||
957 | for now. */ | ||
958 | apicid = phys_proc_id[cpu]; | ||
959 | node = apicid_to_node[apicid]; | ||
960 | if (node == NUMA_NO_NODE) | ||
961 | node = 0; | ||
962 | cpu_to_node[cpu] = node; | ||
963 | |||
964 | if (acpi_numa > 0) | ||
965 | printk(KERN_INFO "CPU %d -> Node %d\n", cpu, node); | ||
966 | #endif | ||
967 | } | ||
968 | |||
912 | static void __cpuinit init_intel(struct cpuinfo_x86 *c) | 969 | static void __cpuinit init_intel(struct cpuinfo_x86 *c) |
913 | { | 970 | { |
914 | /* Cache sizes */ | 971 | /* Cache sizes */ |
@@ -927,6 +984,8 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) | |||
927 | if (c->x86 >= 15) | 984 | if (c->x86 >= 15) |
928 | set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); | 985 | set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); |
929 | c->x86_num_cores = intel_num_cpu_cores(c); | 986 | c->x86_num_cores = intel_num_cpu_cores(c); |
987 | |||
988 | srat_detect_node(); | ||
930 | } | 989 | } |
931 | 990 | ||
932 | static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c) | 991 | static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c) |
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index e3ffcacc8c90..bd33be24a386 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c | |||
@@ -94,7 +94,7 @@ void __init setup_per_cpu_areas(void) | |||
94 | size = PERCPU_ENOUGH_ROOM; | 94 | size = PERCPU_ENOUGH_ROOM; |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | for (i = 0; i < NR_CPUS; i++) { | 97 | for_each_cpu_mask (i, cpu_possible_map) { |
98 | char *ptr; | 98 | char *ptr; |
99 | 99 | ||
100 | if (!NODE_DATA(cpu_to_node(i))) { | 100 | if (!NODE_DATA(cpu_to_node(i))) { |
@@ -119,7 +119,6 @@ void pda_init(int cpu) | |||
119 | asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); | 119 | asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); |
120 | wrmsrl(MSR_GS_BASE, cpu_pda + cpu); | 120 | wrmsrl(MSR_GS_BASE, cpu_pda + cpu); |
121 | 121 | ||
122 | pda->me = pda; | ||
123 | pda->cpunumber = cpu; | 122 | pda->cpunumber = cpu; |
124 | pda->irqcount = -1; | 123 | pda->irqcount = -1; |
125 | pda->kernelstack = | 124 | pda->kernelstack = |
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c index e5958220d6b8..9db9dda161b4 100644 --- a/arch/x86_64/kernel/smp.c +++ b/arch/x86_64/kernel/smp.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | 13 | ||
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | #include <linux/irq.h> | ||
16 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
17 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
18 | #include <linux/smp_lock.h> | 17 | #include <linux/smp_lock.h> |
@@ -29,6 +28,8 @@ | |||
29 | #include <asm/proto.h> | 28 | #include <asm/proto.h> |
30 | #include <asm/apicdef.h> | 29 | #include <asm/apicdef.h> |
31 | 30 | ||
31 | #define __cpuinit __init | ||
32 | |||
32 | /* | 33 | /* |
33 | * Smarter SMP flushing macros. | 34 | * Smarter SMP flushing macros. |
34 | * c/o Linus Torvalds. | 35 | * c/o Linus Torvalds. |
@@ -37,19 +38,41 @@ | |||
37 | * writing to user space from interrupts. (Its not allowed anyway). | 38 | * writing to user space from interrupts. (Its not allowed anyway). |
38 | * | 39 | * |
39 | * Optimizations Manfred Spraul <manfred@colorfullife.com> | 40 | * Optimizations Manfred Spraul <manfred@colorfullife.com> |
41 | * | ||
42 | * More scalable flush, from Andi Kleen | ||
43 | * | ||
44 | * To avoid global state use 8 different call vectors. | ||
45 | * Each CPU uses a specific vector to trigger flushes on other | ||
46 | * CPUs. Depending on the received vector the target CPUs look into | ||
47 | * the right per cpu variable for the flush data. | ||
48 | * | ||
49 | * With more than 8 CPUs they are hashed to the 8 available | ||
50 | * vectors. The limited global vector space forces us to this right now. | ||
51 | * In future when interrupts are split into per CPU domains this could be | ||
52 | * fixed, at the cost of triggering multiple IPIs in some cases. | ||
40 | */ | 53 | */ |
41 | 54 | ||
42 | static cpumask_t flush_cpumask; | 55 | union smp_flush_state { |
43 | static struct mm_struct * flush_mm; | 56 | struct { |
44 | static unsigned long flush_va; | 57 | cpumask_t flush_cpumask; |
45 | static DEFINE_SPINLOCK(tlbstate_lock); | 58 | struct mm_struct *flush_mm; |
59 | unsigned long flush_va; | ||
46 | #define FLUSH_ALL -1ULL | 60 | #define FLUSH_ALL -1ULL |
61 | spinlock_t tlbstate_lock; | ||
62 | }; | ||
63 | char pad[SMP_CACHE_BYTES]; | ||
64 | } ____cacheline_aligned; | ||
65 | |||
66 | /* State is put into the per CPU data section, but padded | ||
67 | to a full cache line because other CPUs can access it and we don't | ||
68 | want false sharing in the per cpu data segment. */ | ||
69 | static DEFINE_PER_CPU(union smp_flush_state, flush_state); | ||
47 | 70 | ||
48 | /* | 71 | /* |
49 | * We cannot call mmdrop() because we are in interrupt context, | 72 | * We cannot call mmdrop() because we are in interrupt context, |
50 | * instead update mm->cpu_vm_mask. | 73 | * instead update mm->cpu_vm_mask. |
51 | */ | 74 | */ |
52 | static inline void leave_mm (unsigned long cpu) | 75 | static inline void leave_mm(int cpu) |
53 | { | 76 | { |
54 | if (read_pda(mmu_state) == TLBSTATE_OK) | 77 | if (read_pda(mmu_state) == TLBSTATE_OK) |
55 | BUG(); | 78 | BUG(); |
@@ -101,15 +124,25 @@ static inline void leave_mm (unsigned long cpu) | |||
101 | * | 124 | * |
102 | * 1) Flush the tlb entries if the cpu uses the mm that's being flushed. | 125 | * 1) Flush the tlb entries if the cpu uses the mm that's being flushed. |
103 | * 2) Leave the mm if we are in the lazy tlb mode. | 126 | * 2) Leave the mm if we are in the lazy tlb mode. |
127 | * | ||
128 | * Interrupts are disabled. | ||
104 | */ | 129 | */ |
105 | 130 | ||
106 | asmlinkage void smp_invalidate_interrupt (void) | 131 | asmlinkage void smp_invalidate_interrupt(struct pt_regs *regs) |
107 | { | 132 | { |
108 | unsigned long cpu; | 133 | int cpu; |
134 | int sender; | ||
135 | union smp_flush_state *f; | ||
109 | 136 | ||
110 | cpu = get_cpu(); | 137 | cpu = smp_processor_id(); |
138 | /* | ||
139 | * orig_rax contains the interrupt vector - 256. | ||
140 | * Use that to determine where the sender put the data. | ||
141 | */ | ||
142 | sender = regs->orig_rax + 256 - INVALIDATE_TLB_VECTOR_START; | ||
143 | f = &per_cpu(flush_state, sender); | ||
111 | 144 | ||
112 | if (!cpu_isset(cpu, flush_cpumask)) | 145 | if (!cpu_isset(cpu, f->flush_cpumask)) |
113 | goto out; | 146 | goto out; |
114 | /* | 147 | /* |
115 | * This was a BUG() but until someone can quote me the | 148 | * This was a BUG() but until someone can quote me the |
@@ -120,64 +153,63 @@ asmlinkage void smp_invalidate_interrupt (void) | |||
120 | * BUG(); | 153 | * BUG(); |
121 | */ | 154 | */ |
122 | 155 | ||
123 | if (flush_mm == read_pda(active_mm)) { | 156 | if (f->flush_mm == read_pda(active_mm)) { |
124 | if (read_pda(mmu_state) == TLBSTATE_OK) { | 157 | if (read_pda(mmu_state) == TLBSTATE_OK) { |
125 | if (flush_va == FLUSH_ALL) | 158 | if (f->flush_va == FLUSH_ALL) |
126 | local_flush_tlb(); | 159 | local_flush_tlb(); |
127 | else | 160 | else |
128 | __flush_tlb_one(flush_va); | 161 | __flush_tlb_one(f->flush_va); |
129 | } else | 162 | } else |
130 | leave_mm(cpu); | 163 | leave_mm(cpu); |
131 | } | 164 | } |
132 | out: | 165 | out: |
133 | ack_APIC_irq(); | 166 | ack_APIC_irq(); |
134 | cpu_clear(cpu, flush_cpumask); | 167 | cpu_clear(cpu, f->flush_cpumask); |
135 | put_cpu_no_resched(); | ||
136 | } | 168 | } |
137 | 169 | ||
138 | static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, | 170 | static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, |
139 | unsigned long va) | 171 | unsigned long va) |
140 | { | 172 | { |
141 | cpumask_t tmp; | 173 | int sender; |
142 | /* | 174 | union smp_flush_state *f; |
143 | * A couple of (to be removed) sanity checks: | ||
144 | * | ||
145 | * - we do not send IPIs to not-yet booted CPUs. | ||
146 | * - current CPU must not be in mask | ||
147 | * - mask must exist :) | ||
148 | */ | ||
149 | BUG_ON(cpus_empty(cpumask)); | ||
150 | cpus_and(tmp, cpumask, cpu_online_map); | ||
151 | BUG_ON(!cpus_equal(tmp, cpumask)); | ||
152 | BUG_ON(cpu_isset(smp_processor_id(), cpumask)); | ||
153 | if (!mm) | ||
154 | BUG(); | ||
155 | 175 | ||
156 | /* | 176 | /* Caller has disabled preemption */ |
157 | * I'm not happy about this global shared spinlock in the | 177 | sender = smp_processor_id() % NUM_INVALIDATE_TLB_VECTORS; |
158 | * MM hot path, but we'll see how contended it is. | 178 | f = &per_cpu(flush_state, sender); |
159 | * Temporarily this turns IRQs off, so that lockups are | 179 | |
160 | * detected by the NMI watchdog. | 180 | /* Could avoid this lock when |
161 | */ | 181 | num_online_cpus() <= NUM_INVALIDATE_TLB_VECTORS, but it is |
162 | spin_lock(&tlbstate_lock); | 182 | probably not worth checking this for a cache-hot lock. */ |
163 | 183 | spin_lock(&f->tlbstate_lock); | |
164 | flush_mm = mm; | 184 | |
165 | flush_va = va; | 185 | f->flush_mm = mm; |
166 | cpus_or(flush_cpumask, cpumask, flush_cpumask); | 186 | f->flush_va = va; |
187 | cpus_or(f->flush_cpumask, cpumask, f->flush_cpumask); | ||
167 | 188 | ||
168 | /* | 189 | /* |
169 | * We have to send the IPI only to | 190 | * We have to send the IPI only to |
170 | * CPUs affected. | 191 | * CPUs affected. |
171 | */ | 192 | */ |
172 | send_IPI_mask(cpumask, INVALIDATE_TLB_VECTOR); | 193 | send_IPI_mask(cpumask, INVALIDATE_TLB_VECTOR_START + sender); |
194 | |||
195 | while (!cpus_empty(f->flush_cpumask)) | ||
196 | cpu_relax(); | ||
173 | 197 | ||
174 | while (!cpus_empty(flush_cpumask)) | 198 | f->flush_mm = NULL; |
175 | mb(); /* nothing. lockup detection does not belong here */; | 199 | f->flush_va = 0; |
200 | spin_unlock(&f->tlbstate_lock); | ||
201 | } | ||
176 | 202 | ||
177 | flush_mm = NULL; | 203 | int __cpuinit init_smp_flush(void) |
178 | flush_va = 0; | 204 | { |
179 | spin_unlock(&tlbstate_lock); | 205 | int i; |
206 | for_each_cpu_mask(i, cpu_possible_map) { | ||
207 | spin_lock_init(&per_cpu(flush_state.tlbstate_lock, i)); | ||
208 | } | ||
209 | return 0; | ||
180 | } | 210 | } |
211 | |||
212 | core_initcall(init_smp_flush); | ||
181 | 213 | ||
182 | void flush_tlb_current_task(void) | 214 | void flush_tlb_current_task(void) |
183 | { | 215 | { |
@@ -295,8 +327,11 @@ void unlock_ipi_call_lock(void) | |||
295 | /* | 327 | /* |
296 | * this function sends a 'generic call function' IPI to one other CPU | 328 | * this function sends a 'generic call function' IPI to one other CPU |
297 | * in the system. | 329 | * in the system. |
330 | * | ||
331 | * cpu is a standard Linux logical CPU number. | ||
298 | */ | 332 | */ |
299 | static void __smp_call_function_single (int cpu, void (*func) (void *info), void *info, | 333 | static void |
334 | __smp_call_function_single(int cpu, void (*func) (void *info), void *info, | ||
300 | int nonatomic, int wait) | 335 | int nonatomic, int wait) |
301 | { | 336 | { |
302 | struct call_data_struct data; | 337 | struct call_data_struct data; |
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 4fb34b5cb1f9..e12d7baeb33e 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/mm.h> | 44 | #include <linux/mm.h> |
45 | #include <linux/kernel_stat.h> | 45 | #include <linux/kernel_stat.h> |
46 | #include <linux/smp_lock.h> | 46 | #include <linux/smp_lock.h> |
47 | #include <linux/irq.h> | ||
48 | #include <linux/bootmem.h> | 47 | #include <linux/bootmem.h> |
49 | #include <linux/thread_info.h> | 48 | #include <linux/thread_info.h> |
50 | #include <linux/module.h> | 49 | #include <linux/module.h> |
@@ -58,6 +57,8 @@ | |||
58 | #include <asm/tlbflush.h> | 57 | #include <asm/tlbflush.h> |
59 | #include <asm/proto.h> | 58 | #include <asm/proto.h> |
60 | #include <asm/nmi.h> | 59 | #include <asm/nmi.h> |
60 | #include <asm/irq.h> | ||
61 | #include <asm/hw_irq.h> | ||
61 | 62 | ||
62 | /* Number of siblings per CPU package */ | 63 | /* Number of siblings per CPU package */ |
63 | int smp_num_siblings = 1; | 64 | int smp_num_siblings = 1; |
@@ -413,8 +414,13 @@ void __cpuinit smp_callin(void) | |||
413 | 414 | ||
414 | /* | 415 | /* |
415 | * Get our bogomips. | 416 | * Get our bogomips. |
417 | * | ||
418 | * Need to enable IRQs because it can take longer and then | ||
419 | * the NMI watchdog might kill us. | ||
416 | */ | 420 | */ |
421 | local_irq_enable(); | ||
417 | calibrate_delay(); | 422 | calibrate_delay(); |
423 | local_irq_disable(); | ||
418 | Dprintk("Stack at about %p\n",&cpuid); | 424 | Dprintk("Stack at about %p\n",&cpuid); |
419 | 425 | ||
420 | disable_APIC_timer(); | 426 | disable_APIC_timer(); |
@@ -540,8 +546,8 @@ static void inquire_remote_apic(int apicid) | |||
540 | */ | 546 | */ |
541 | apic_wait_icr_idle(); | 547 | apic_wait_icr_idle(); |
542 | 548 | ||
543 | apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(apicid)); | 549 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(apicid)); |
544 | apic_write_around(APIC_ICR, APIC_DM_REMRD | regs[i]); | 550 | apic_write(APIC_ICR, APIC_DM_REMRD | regs[i]); |
545 | 551 | ||
546 | timeout = 0; | 552 | timeout = 0; |
547 | do { | 553 | do { |
@@ -574,12 +580,12 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta | |||
574 | /* | 580 | /* |
575 | * Turn INIT on target chip | 581 | * Turn INIT on target chip |
576 | */ | 582 | */ |
577 | apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); | 583 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); |
578 | 584 | ||
579 | /* | 585 | /* |
580 | * Send IPI | 586 | * Send IPI |
581 | */ | 587 | */ |
582 | apic_write_around(APIC_ICR, APIC_INT_LEVELTRIG | APIC_INT_ASSERT | 588 | apic_write(APIC_ICR, APIC_INT_LEVELTRIG | APIC_INT_ASSERT |
583 | | APIC_DM_INIT); | 589 | | APIC_DM_INIT); |
584 | 590 | ||
585 | Dprintk("Waiting for send to finish...\n"); | 591 | Dprintk("Waiting for send to finish...\n"); |
@@ -595,10 +601,10 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta | |||
595 | Dprintk("Deasserting INIT.\n"); | 601 | Dprintk("Deasserting INIT.\n"); |
596 | 602 | ||
597 | /* Target chip */ | 603 | /* Target chip */ |
598 | apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); | 604 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); |
599 | 605 | ||
600 | /* Send IPI */ | 606 | /* Send IPI */ |
601 | apic_write_around(APIC_ICR, APIC_INT_LEVELTRIG | APIC_DM_INIT); | 607 | apic_write(APIC_ICR, APIC_INT_LEVELTRIG | APIC_DM_INIT); |
602 | 608 | ||
603 | Dprintk("Waiting for send to finish...\n"); | 609 | Dprintk("Waiting for send to finish...\n"); |
604 | timeout = 0; | 610 | timeout = 0; |
@@ -610,16 +616,7 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta | |||
610 | 616 | ||
611 | atomic_set(&init_deasserted, 1); | 617 | atomic_set(&init_deasserted, 1); |
612 | 618 | ||
613 | /* | 619 | num_starts = 2; |
614 | * Should we send STARTUP IPIs ? | ||
615 | * | ||
616 | * Determine this based on the APIC version. | ||
617 | * If we don't have an integrated APIC, don't send the STARTUP IPIs. | ||
618 | */ | ||
619 | if (APIC_INTEGRATED(apic_version[phys_apicid])) | ||
620 | num_starts = 2; | ||
621 | else | ||
622 | num_starts = 0; | ||
623 | 620 | ||
624 | /* | 621 | /* |
625 | * Run STARTUP IPI loop. | 622 | * Run STARTUP IPI loop. |
@@ -640,12 +637,11 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta | |||
640 | */ | 637 | */ |
641 | 638 | ||
642 | /* Target chip */ | 639 | /* Target chip */ |
643 | apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); | 640 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); |
644 | 641 | ||
645 | /* Boot on the stack */ | 642 | /* Boot on the stack */ |
646 | /* Kick the second */ | 643 | /* Kick the second */ |
647 | apic_write_around(APIC_ICR, APIC_DM_STARTUP | 644 | apic_write(APIC_ICR, APIC_DM_STARTUP | (start_rip >> 12)); |
648 | | (start_rip >> 12)); | ||
649 | 645 | ||
650 | /* | 646 | /* |
651 | * Give the other CPU some time to accept the IPI. | 647 | * Give the other CPU some time to accept the IPI. |
@@ -864,17 +860,6 @@ static __cpuinit void smp_cleanup_boot(void) | |||
864 | * Reset trampoline flag | 860 | * Reset trampoline flag |
865 | */ | 861 | */ |
866 | *((volatile int *) phys_to_virt(0x467)) = 0; | 862 | *((volatile int *) phys_to_virt(0x467)) = 0; |
867 | |||
868 | #ifndef CONFIG_HOTPLUG_CPU | ||
869 | /* | ||
870 | * Free pages reserved for SMP bootup. | ||
871 | * When you add hotplug CPU support later remove this | ||
872 | * Note there is more work to be done for later CPU bootup. | ||
873 | */ | ||
874 | |||
875 | free_page((unsigned long) __va(PAGE_SIZE)); | ||
876 | free_page((unsigned long) __va(SMP_TRAMPOLINE_BASE)); | ||
877 | #endif | ||
878 | } | 863 | } |
879 | 864 | ||
880 | /* | 865 | /* |
diff --git a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c index 0612640d91b1..ebb9abf3ce6d 100644 --- a/arch/x86_64/kernel/suspend.c +++ b/arch/x86_64/kernel/suspend.c | |||
@@ -8,23 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/smp.h> |
12 | #include <linux/module.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | #include <linux/poll.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/sysrq.h> | ||
19 | #include <linux/proc_fs.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/pm.h> | ||
22 | #include <linux/device.h> | ||
23 | #include <linux/suspend.h> | 12 | #include <linux/suspend.h> |
24 | #include <asm/uaccess.h> | ||
25 | #include <asm/acpi.h> | ||
26 | #include <asm/tlbflush.h> | ||
27 | #include <asm/io.h> | ||
28 | #include <asm/proto.h> | 13 | #include <asm/proto.h> |
29 | 14 | ||
30 | struct saved_context saved_context; | 15 | struct saved_context saved_context; |
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 7b6abe058253..2373cb8b8625 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/mc146818rtc.h> | 20 | #include <linux/mc146818rtc.h> |
21 | #include <linux/irq.h> | ||
22 | #include <linux/time.h> | 21 | #include <linux/time.h> |
23 | #include <linux/ioport.h> | 22 | #include <linux/ioport.h> |
24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
@@ -937,7 +936,6 @@ void __init time_init(void) | |||
937 | vxtime.mode = VXTIME_TSC; | 936 | vxtime.mode = VXTIME_TSC; |
938 | vxtime.quot = (1000000L << 32) / vxtime_hz; | 937 | vxtime.quot = (1000000L << 32) / vxtime_hz; |
939 | vxtime.tsc_quot = (1000L << 32) / cpu_khz; | 938 | vxtime.tsc_quot = (1000L << 32) / cpu_khz; |
940 | vxtime.hz = vxtime_hz; | ||
941 | rdtscll_sync(&vxtime.last_tsc); | 939 | rdtscll_sync(&vxtime.last_tsc); |
942 | setup_irq(0, &irq0); | 940 | setup_irq(0, &irq0); |
943 | 941 | ||
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index f238d6078a5a..b5e09e6b5536 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c | |||
@@ -47,9 +47,6 @@ | |||
47 | #include <asm/proto.h> | 47 | #include <asm/proto.h> |
48 | #include <asm/nmi.h> | 48 | #include <asm/nmi.h> |
49 | 49 | ||
50 | #include <linux/irq.h> | ||
51 | |||
52 | |||
53 | extern struct gate_struct idt_table[256]; | 50 | extern struct gate_struct idt_table[256]; |
54 | 51 | ||
55 | asmlinkage void divide_error(void); | 52 | asmlinkage void divide_error(void); |
@@ -324,13 +321,13 @@ void handle_BUG(struct pt_regs *regs) | |||
324 | if (__copy_from_user(&f, (struct bug_frame *) regs->rip, | 321 | if (__copy_from_user(&f, (struct bug_frame *) regs->rip, |
325 | sizeof(struct bug_frame))) | 322 | sizeof(struct bug_frame))) |
326 | return; | 323 | return; |
327 | if ((unsigned long)f.filename < __PAGE_OFFSET || | 324 | if (f.filename >= 0 || |
328 | f.ud2[0] != 0x0f || f.ud2[1] != 0x0b) | 325 | f.ud2[0] != 0x0f || f.ud2[1] != 0x0b) |
329 | return; | 326 | return; |
330 | if (__get_user(tmp, f.filename)) | 327 | if (__get_user(tmp, (char *)(long)f.filename)) |
331 | f.filename = "unmapped filename"; | 328 | f.filename = (int)(long)"unmapped filename"; |
332 | printk("----------- [cut here ] --------- [please bite here ] ---------\n"); | 329 | printk("----------- [cut here ] --------- [please bite here ] ---------\n"); |
333 | printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", f.filename, f.line); | 330 | printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", (char *)(long)f.filename, f.line); |
334 | } | 331 | } |
335 | 332 | ||
336 | #ifdef CONFIG_BUG | 333 | #ifdef CONFIG_BUG |
@@ -343,30 +340,33 @@ void out_of_line_bug(void) | |||
343 | static DEFINE_SPINLOCK(die_lock); | 340 | static DEFINE_SPINLOCK(die_lock); |
344 | static int die_owner = -1; | 341 | static int die_owner = -1; |
345 | 342 | ||
346 | void oops_begin(void) | 343 | unsigned long oops_begin(void) |
347 | { | 344 | { |
348 | int cpu = safe_smp_processor_id(); | 345 | int cpu = safe_smp_processor_id(); |
349 | /* racy, but better than risking deadlock. */ | 346 | unsigned long flags; |
350 | local_irq_disable(); | 347 | |
348 | /* racy, but better than risking deadlock. */ | ||
349 | local_irq_save(flags); | ||
351 | if (!spin_trylock(&die_lock)) { | 350 | if (!spin_trylock(&die_lock)) { |
352 | if (cpu == die_owner) | 351 | if (cpu == die_owner) |
353 | /* nested oops. should stop eventually */; | 352 | /* nested oops. should stop eventually */; |
354 | else | 353 | else |
355 | spin_lock(&die_lock); | 354 | spin_lock(&die_lock); |
356 | } | 355 | } |
357 | die_owner = cpu; | 356 | die_owner = cpu; |
358 | console_verbose(); | 357 | console_verbose(); |
359 | bust_spinlocks(1); | 358 | bust_spinlocks(1); |
359 | return flags; | ||
360 | } | 360 | } |
361 | 361 | ||
362 | void oops_end(void) | 362 | void oops_end(unsigned long flags) |
363 | { | 363 | { |
364 | die_owner = -1; | 364 | die_owner = -1; |
365 | bust_spinlocks(0); | 365 | bust_spinlocks(0); |
366 | spin_unlock(&die_lock); | 366 | spin_unlock_irqrestore(&die_lock, flags); |
367 | if (panic_on_oops) | 367 | if (panic_on_oops) |
368 | panic("Oops"); | 368 | panic("Oops"); |
369 | } | 369 | } |
370 | 370 | ||
371 | void __die(const char * str, struct pt_regs * regs, long err) | 371 | void __die(const char * str, struct pt_regs * regs, long err) |
372 | { | 372 | { |
@@ -392,10 +392,11 @@ void __die(const char * str, struct pt_regs * regs, long err) | |||
392 | 392 | ||
393 | void die(const char * str, struct pt_regs * regs, long err) | 393 | void die(const char * str, struct pt_regs * regs, long err) |
394 | { | 394 | { |
395 | oops_begin(); | 395 | unsigned long flags = oops_begin(); |
396 | |||
396 | handle_BUG(regs); | 397 | handle_BUG(regs); |
397 | __die(str, regs, err); | 398 | __die(str, regs, err); |
398 | oops_end(); | 399 | oops_end(flags); |
399 | do_exit(SIGSEGV); | 400 | do_exit(SIGSEGV); |
400 | } | 401 | } |
401 | static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err) | 402 | static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err) |
@@ -406,7 +407,8 @@ static inline void die_if_kernel(const char * str, struct pt_regs * regs, long e | |||
406 | 407 | ||
407 | void die_nmi(char *str, struct pt_regs *regs) | 408 | void die_nmi(char *str, struct pt_regs *regs) |
408 | { | 409 | { |
409 | oops_begin(); | 410 | unsigned long flags = oops_begin(); |
411 | |||
410 | /* | 412 | /* |
411 | * We are in trouble anyway, lets at least try | 413 | * We are in trouble anyway, lets at least try |
412 | * to get a message out. | 414 | * to get a message out. |
@@ -416,7 +418,7 @@ void die_nmi(char *str, struct pt_regs *regs) | |||
416 | if (panic_on_timeout || panic_on_oops) | 418 | if (panic_on_timeout || panic_on_oops) |
417 | panic("nmi watchdog"); | 419 | panic("nmi watchdog"); |
418 | printk("console shuts up ...\n"); | 420 | printk("console shuts up ...\n"); |
419 | oops_end(); | 421 | oops_end(flags); |
420 | do_exit(SIGSEGV); | 422 | do_exit(SIGSEGV); |
421 | } | 423 | } |
422 | 424 | ||
@@ -790,13 +792,16 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs) | |||
790 | */ | 792 | */ |
791 | cwd = get_fpu_cwd(task); | 793 | cwd = get_fpu_cwd(task); |
792 | swd = get_fpu_swd(task); | 794 | swd = get_fpu_swd(task); |
793 | switch (((~cwd) & swd & 0x3f) | (swd & 0x240)) { | 795 | switch (swd & ~cwd & 0x3f) { |
794 | case 0x000: | 796 | case 0x000: |
795 | default: | 797 | default: |
796 | break; | 798 | break; |
797 | case 0x001: /* Invalid Op */ | 799 | case 0x001: /* Invalid Op */ |
798 | case 0x041: /* Stack Fault */ | 800 | /* |
799 | case 0x241: /* Stack Fault | Direction */ | 801 | * swd & 0x240 == 0x040: Stack Underflow |
802 | * swd & 0x240 == 0x240: Stack Overflow | ||
803 | * User must clear the SF bit (0x40) if set | ||
804 | */ | ||
800 | info.si_code = FPE_FLTINV; | 805 | info.si_code = FPE_FLTINV; |
801 | break; | 806 | break; |
802 | case 0x002: /* Denormalize */ | 807 | case 0x002: /* Denormalize */ |
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c index 2e5734425949..70a0bd16085f 100644 --- a/arch/x86_64/kernel/vsyscall.c +++ b/arch/x86_64/kernel/vsyscall.c | |||
@@ -107,7 +107,7 @@ static force_inline long time_syscall(long *t) | |||
107 | return secs; | 107 | return secs; |
108 | } | 108 | } |
109 | 109 | ||
110 | static int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz) | 110 | int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz) |
111 | { | 111 | { |
112 | if (unlikely(!__sysctl_vsyscall)) | 112 | if (unlikely(!__sysctl_vsyscall)) |
113 | return gettimeofday(tv,tz); | 113 | return gettimeofday(tv,tz); |
@@ -120,7 +120,7 @@ static int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz | |||
120 | 120 | ||
121 | /* This will break when the xtime seconds get inaccurate, but that is | 121 | /* This will break when the xtime seconds get inaccurate, but that is |
122 | * unlikely */ | 122 | * unlikely */ |
123 | static time_t __vsyscall(1) vtime(time_t *t) | 123 | time_t __vsyscall(1) vtime(time_t *t) |
124 | { | 124 | { |
125 | if (unlikely(!__sysctl_vsyscall)) | 125 | if (unlikely(!__sysctl_vsyscall)) |
126 | return time_syscall(t); | 126 | return time_syscall(t); |
@@ -129,12 +129,12 @@ static time_t __vsyscall(1) vtime(time_t *t) | |||
129 | return __xtime.tv_sec; | 129 | return __xtime.tv_sec; |
130 | } | 130 | } |
131 | 131 | ||
132 | static long __vsyscall(2) venosys_0(void) | 132 | long __vsyscall(2) venosys_0(void) |
133 | { | 133 | { |
134 | return -ENOSYS; | 134 | return -ENOSYS; |
135 | } | 135 | } |
136 | 136 | ||
137 | static long __vsyscall(3) venosys_1(void) | 137 | long __vsyscall(3) venosys_1(void) |
138 | { | 138 | { |
139 | return -ENOSYS; | 139 | return -ENOSYS; |
140 | } | 140 | } |
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c index 816732d8858c..b75b872ec154 100644 --- a/arch/x86_64/mm/fault.c +++ b/arch/x86_64/mm/fault.c | |||
@@ -221,12 +221,13 @@ int unhandled_signal(struct task_struct *tsk, int sig) | |||
221 | static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs, | 221 | static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs, |
222 | unsigned long error_code) | 222 | unsigned long error_code) |
223 | { | 223 | { |
224 | oops_begin(); | 224 | unsigned long flags = oops_begin(); |
225 | |||
225 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", | 226 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", |
226 | current->comm, address); | 227 | current->comm, address); |
227 | dump_pagetable(address); | 228 | dump_pagetable(address); |
228 | __die("Bad pagetable", regs, error_code); | 229 | __die("Bad pagetable", regs, error_code); |
229 | oops_end(); | 230 | oops_end(flags); |
230 | do_exit(SIGKILL); | 231 | do_exit(SIGKILL); |
231 | } | 232 | } |
232 | 233 | ||
@@ -304,6 +305,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | |||
304 | unsigned long address; | 305 | unsigned long address; |
305 | const struct exception_table_entry *fixup; | 306 | const struct exception_table_entry *fixup; |
306 | int write; | 307 | int write; |
308 | unsigned long flags; | ||
307 | siginfo_t info; | 309 | siginfo_t info; |
308 | 310 | ||
309 | #ifdef CONFIG_CHECKING | 311 | #ifdef CONFIG_CHECKING |
@@ -521,7 +523,7 @@ no_context: | |||
521 | * terminate things with extreme prejudice. | 523 | * terminate things with extreme prejudice. |
522 | */ | 524 | */ |
523 | 525 | ||
524 | oops_begin(); | 526 | flags = oops_begin(); |
525 | 527 | ||
526 | if (address < PAGE_SIZE) | 528 | if (address < PAGE_SIZE) |
527 | printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); | 529 | printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); |
@@ -534,7 +536,7 @@ no_context: | |||
534 | __die("Oops", regs, error_code); | 536 | __die("Oops", regs, error_code); |
535 | /* Executive summary in case the body of the oops scrolled away */ | 537 | /* Executive summary in case the body of the oops scrolled away */ |
536 | printk(KERN_EMERG "CR2: %016lx\n", address); | 538 | printk(KERN_EMERG "CR2: %016lx\n", address); |
537 | oops_end(); | 539 | oops_end(flags); |
538 | do_exit(SIGKILL); | 540 | do_exit(SIGKILL); |
539 | 541 | ||
540 | /* | 542 | /* |
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c index aa4a5189ecee..e60a1a848de8 100644 --- a/arch/x86_64/mm/init.c +++ b/arch/x86_64/mm/init.c | |||
@@ -57,31 +57,31 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); | |||
57 | 57 | ||
58 | void show_mem(void) | 58 | void show_mem(void) |
59 | { | 59 | { |
60 | int i, total = 0, reserved = 0; | 60 | long i, total = 0, reserved = 0; |
61 | int shared = 0, cached = 0; | 61 | long shared = 0, cached = 0; |
62 | pg_data_t *pgdat; | 62 | pg_data_t *pgdat; |
63 | struct page *page; | 63 | struct page *page; |
64 | 64 | ||
65 | printk("Mem-info:\n"); | 65 | printk(KERN_INFO "Mem-info:\n"); |
66 | show_free_areas(); | 66 | show_free_areas(); |
67 | printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); | 67 | printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); |
68 | 68 | ||
69 | for_each_pgdat(pgdat) { | 69 | for_each_pgdat(pgdat) { |
70 | for (i = 0; i < pgdat->node_spanned_pages; ++i) { | 70 | for (i = 0; i < pgdat->node_spanned_pages; ++i) { |
71 | page = pfn_to_page(pgdat->node_start_pfn + i); | 71 | page = pfn_to_page(pgdat->node_start_pfn + i); |
72 | total++; | 72 | total++; |
73 | if (PageReserved(page)) | 73 | if (PageReserved(page)) |
74 | reserved++; | 74 | reserved++; |
75 | else if (PageSwapCache(page)) | 75 | else if (PageSwapCache(page)) |
76 | cached++; | 76 | cached++; |
77 | else if (page_count(page)) | 77 | else if (page_count(page)) |
78 | shared += page_count(page) - 1; | 78 | shared += page_count(page) - 1; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | printk("%d pages of RAM\n", total); | 81 | printk(KERN_INFO "%lu pages of RAM\n", total); |
82 | printk("%d reserved pages\n",reserved); | 82 | printk(KERN_INFO "%lu reserved pages\n",reserved); |
83 | printk("%d pages shared\n",shared); | 83 | printk(KERN_INFO "%lu pages shared\n",shared); |
84 | printk("%d pages swap cached\n",cached); | 84 | printk(KERN_INFO "%lu pages swap cached\n",cached); |
85 | } | 85 | } |
86 | 86 | ||
87 | /* References to section boundaries */ | 87 | /* References to section boundaries */ |
@@ -381,41 +381,14 @@ void __init clear_kernel_mapping(unsigned long address, unsigned long size) | |||
381 | __flush_tlb_all(); | 381 | __flush_tlb_all(); |
382 | } | 382 | } |
383 | 383 | ||
384 | static inline int page_is_ram (unsigned long pagenr) | ||
385 | { | ||
386 | int i; | ||
387 | |||
388 | for (i = 0; i < e820.nr_map; i++) { | ||
389 | unsigned long addr, end; | ||
390 | |||
391 | if (e820.map[i].type != E820_RAM) /* not usable memory */ | ||
392 | continue; | ||
393 | /* | ||
394 | * !!!FIXME!!! Some BIOSen report areas as RAM that | ||
395 | * are not. Notably the 640->1Mb area. We need a sanity | ||
396 | * check here. | ||
397 | */ | ||
398 | addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT; | ||
399 | end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT; | ||
400 | if ((pagenr >= addr) && (pagenr < end)) | ||
401 | return 1; | ||
402 | } | ||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | extern int swiotlb_force; | ||
407 | |||
408 | static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules, | 384 | static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules, |
409 | kcore_vsyscall; | 385 | kcore_vsyscall; |
410 | 386 | ||
411 | void __init mem_init(void) | 387 | void __init mem_init(void) |
412 | { | 388 | { |
413 | int codesize, reservedpages, datasize, initsize; | 389 | long codesize, reservedpages, datasize, initsize; |
414 | int tmp; | ||
415 | 390 | ||
416 | #ifdef CONFIG_SWIOTLB | 391 | #ifdef CONFIG_SWIOTLB |
417 | if (swiotlb_force) | ||
418 | swiotlb = 1; | ||
419 | if (!iommu_aperture && | 392 | if (!iommu_aperture && |
420 | (end_pfn >= 0xffffffff>>PAGE_SHIFT || force_iommu)) | 393 | (end_pfn >= 0xffffffff>>PAGE_SHIFT || force_iommu)) |
421 | swiotlb = 1; | 394 | swiotlb = 1; |
@@ -436,25 +409,11 @@ void __init mem_init(void) | |||
436 | 409 | ||
437 | /* this will put all low memory onto the freelists */ | 410 | /* this will put all low memory onto the freelists */ |
438 | #ifdef CONFIG_NUMA | 411 | #ifdef CONFIG_NUMA |
439 | totalram_pages += numa_free_all_bootmem(); | 412 | totalram_pages = numa_free_all_bootmem(); |
440 | tmp = 0; | ||
441 | /* should count reserved pages here for all nodes */ | ||
442 | #else | 413 | #else |
443 | 414 | totalram_pages = free_all_bootmem(); | |
444 | #ifdef CONFIG_FLATMEM | ||
445 | max_mapnr = end_pfn; | ||
446 | if (!mem_map) BUG(); | ||
447 | #endif | ||
448 | |||
449 | totalram_pages += free_all_bootmem(); | ||
450 | |||
451 | for (tmp = 0; tmp < end_pfn; tmp++) | ||
452 | /* | ||
453 | * Only count reserved RAM pages | ||
454 | */ | ||
455 | if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp))) | ||
456 | reservedpages++; | ||
457 | #endif | 415 | #endif |
416 | reservedpages = end_pfn - totalram_pages - e820_hole_size(0, end_pfn); | ||
458 | 417 | ||
459 | after_bootmem = 1; | 418 | after_bootmem = 1; |
460 | 419 | ||
@@ -471,7 +430,7 @@ void __init mem_init(void) | |||
471 | kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, | 430 | kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, |
472 | VSYSCALL_END - VSYSCALL_START); | 431 | VSYSCALL_END - VSYSCALL_START); |
473 | 432 | ||
474 | printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n", | 433 | printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n", |
475 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), | 434 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), |
476 | end_pfn << (PAGE_SHIFT-10), | 435 | end_pfn << (PAGE_SHIFT-10), |
477 | codesize >> 10, | 436 | codesize >> 10, |
diff --git a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c index ec35747aacd7..65417b040c1b 100644 --- a/arch/x86_64/mm/k8topology.c +++ b/arch/x86_64/mm/k8topology.c | |||
@@ -45,10 +45,12 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
45 | unsigned long prevbase; | 45 | unsigned long prevbase; |
46 | struct node nodes[8]; | 46 | struct node nodes[8]; |
47 | int nodeid, i, nb; | 47 | int nodeid, i, nb; |
48 | unsigned char nodeids[8]; | ||
48 | int found = 0; | 49 | int found = 0; |
49 | u32 reg; | 50 | u32 reg; |
50 | unsigned numnodes; | 51 | unsigned numnodes; |
51 | nodemask_t nodes_parsed; | 52 | nodemask_t nodes_parsed; |
53 | unsigned dualcore = 0; | ||
52 | 54 | ||
53 | nodes_clear(nodes_parsed); | 55 | nodes_clear(nodes_parsed); |
54 | 56 | ||
@@ -67,11 +69,15 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
67 | prevbase = 0; | 69 | prevbase = 0; |
68 | for (i = 0; i < 8; i++) { | 70 | for (i = 0; i < 8; i++) { |
69 | unsigned long base,limit; | 71 | unsigned long base,limit; |
70 | 72 | u32 nodeid; | |
73 | |||
74 | /* Undefined before E stepping, but hopefully 0 */ | ||
75 | dualcore |= ((read_pci_config(0, nb, 3, 0xe8) >> 12) & 3) == 1; | ||
71 | base = read_pci_config(0, nb, 1, 0x40 + i*8); | 76 | base = read_pci_config(0, nb, 1, 0x40 + i*8); |
72 | limit = read_pci_config(0, nb, 1, 0x44 + i*8); | 77 | limit = read_pci_config(0, nb, 1, 0x44 + i*8); |
73 | 78 | ||
74 | nodeid = limit & 7; | 79 | nodeid = limit & 7; |
80 | nodeids[i] = nodeid; | ||
75 | if ((base & 3) == 0) { | 81 | if ((base & 3) == 0) { |
76 | if (i < numnodes) | 82 | if (i < numnodes) |
77 | printk("Skipping disabled node %d\n", i); | 83 | printk("Skipping disabled node %d\n", i); |
@@ -157,8 +163,9 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
157 | 163 | ||
158 | for (i = 0; i < 8; i++) { | 164 | for (i = 0; i < 8; i++) { |
159 | if (nodes[i].start != nodes[i].end) { | 165 | if (nodes[i].start != nodes[i].end) { |
160 | /* assume 1:1 NODE:CPU */ | 166 | nodeid = nodeids[i]; |
161 | cpu_to_node[i] = i; | 167 | apicid_to_node[nodeid << dualcore] = i; |
168 | apicid_to_node[(nodeid << dualcore) + dualcore] = i; | ||
162 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); | 169 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); |
163 | } | 170 | } |
164 | } | 171 | } |
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c index 04f7a33e144c..80a49d9bd8a7 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c | |||
@@ -28,8 +28,13 @@ bootmem_data_t plat_node_bdata[MAX_NUMNODES]; | |||
28 | int memnode_shift; | 28 | int memnode_shift; |
29 | u8 memnodemap[NODEMAPSIZE]; | 29 | u8 memnodemap[NODEMAPSIZE]; |
30 | 30 | ||
31 | unsigned char cpu_to_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; | 31 | unsigned char cpu_to_node[NR_CPUS] __read_mostly = { |
32 | cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly; | 32 | [0 ... NR_CPUS-1] = NUMA_NO_NODE |
33 | }; | ||
34 | unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { | ||
35 | [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE | ||
36 | }; | ||
37 | cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly; | ||
33 | 38 | ||
34 | int numa_off __initdata; | 39 | int numa_off __initdata; |
35 | 40 | ||
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c index 8e3d097a9ddd..4b2e844c15a7 100644 --- a/arch/x86_64/mm/srat.c +++ b/arch/x86_64/mm/srat.c | |||
@@ -20,14 +20,20 @@ | |||
20 | 20 | ||
21 | static struct acpi_table_slit *acpi_slit; | 21 | static struct acpi_table_slit *acpi_slit; |
22 | 22 | ||
23 | /* Internal processor count */ | ||
24 | static unsigned int __initdata num_processors = 0; | ||
25 | |||
26 | static nodemask_t nodes_parsed __initdata; | 23 | static nodemask_t nodes_parsed __initdata; |
27 | static nodemask_t nodes_found __initdata; | 24 | static nodemask_t nodes_found __initdata; |
28 | static struct node nodes[MAX_NUMNODES] __initdata; | 25 | static struct node nodes[MAX_NUMNODES] __initdata; |
29 | static __u8 pxm2node[256] = { [0 ... 255] = 0xff }; | 26 | static __u8 pxm2node[256] = { [0 ... 255] = 0xff }; |
30 | 27 | ||
28 | static int node_to_pxm(int n); | ||
29 | |||
30 | int pxm_to_node(int pxm) | ||
31 | { | ||
32 | if ((unsigned)pxm >= 256) | ||
33 | return 0; | ||
34 | return pxm2node[pxm]; | ||
35 | } | ||
36 | |||
31 | static __init int setup_node(int pxm) | 37 | static __init int setup_node(int pxm) |
32 | { | 38 | { |
33 | unsigned node = pxm2node[pxm]; | 39 | unsigned node = pxm2node[pxm]; |
@@ -44,14 +50,14 @@ static __init int setup_node(int pxm) | |||
44 | static __init int conflicting_nodes(unsigned long start, unsigned long end) | 50 | static __init int conflicting_nodes(unsigned long start, unsigned long end) |
45 | { | 51 | { |
46 | int i; | 52 | int i; |
47 | for_each_online_node(i) { | 53 | for_each_node_mask(i, nodes_parsed) { |
48 | struct node *nd = &nodes[i]; | 54 | struct node *nd = &nodes[i]; |
49 | if (nd->start == nd->end) | 55 | if (nd->start == nd->end) |
50 | continue; | 56 | continue; |
51 | if (nd->end > start && nd->start < end) | 57 | if (nd->end > start && nd->start < end) |
52 | return 1; | 58 | return i; |
53 | if (nd->end == end && nd->start == start) | 59 | if (nd->end == end && nd->start == start) |
54 | return 1; | 60 | return i; |
55 | } | 61 | } |
56 | return -1; | 62 | return -1; |
57 | } | 63 | } |
@@ -75,8 +81,11 @@ static __init void cutoff_node(int i, unsigned long start, unsigned long end) | |||
75 | 81 | ||
76 | static __init void bad_srat(void) | 82 | static __init void bad_srat(void) |
77 | { | 83 | { |
84 | int i; | ||
78 | printk(KERN_ERR "SRAT: SRAT not used.\n"); | 85 | printk(KERN_ERR "SRAT: SRAT not used.\n"); |
79 | acpi_numa = -1; | 86 | acpi_numa = -1; |
87 | for (i = 0; i < MAX_LOCAL_APIC; i++) | ||
88 | apicid_to_node[i] = NUMA_NO_NODE; | ||
80 | } | 89 | } |
81 | 90 | ||
82 | static __init inline int srat_disabled(void) | 91 | static __init inline int srat_disabled(void) |
@@ -104,18 +113,10 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) | |||
104 | bad_srat(); | 113 | bad_srat(); |
105 | return; | 114 | return; |
106 | } | 115 | } |
107 | if (num_processors >= NR_CPUS) { | 116 | apicid_to_node[pa->apic_id] = node; |
108 | printk(KERN_ERR "SRAT: Processor #%d (lapic %u) INVALID. (Max ID: %d).\n", | ||
109 | num_processors, pa->apic_id, NR_CPUS); | ||
110 | bad_srat(); | ||
111 | return; | ||
112 | } | ||
113 | cpu_to_node[num_processors] = node; | ||
114 | acpi_numa = 1; | 117 | acpi_numa = 1; |
115 | printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> CPU %u -> Node %u\n", | 118 | printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n", |
116 | pxm, pa->apic_id, num_processors, node); | 119 | pxm, pa->apic_id, node); |
117 | |||
118 | num_processors++; | ||
119 | } | 120 | } |
120 | 121 | ||
121 | /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ | 122 | /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ |
@@ -143,10 +144,15 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) | |||
143 | printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n", | 144 | printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n", |
144 | start, end); | 145 | start, end); |
145 | i = conflicting_nodes(start, end); | 146 | i = conflicting_nodes(start, end); |
146 | if (i >= 0) { | 147 | if (i == node) { |
148 | printk(KERN_WARNING | ||
149 | "SRAT: Warning: PXM %d (%lx-%lx) overlaps with itself (%Lx-%Lx)\n", | ||
150 | pxm, start, end, nodes[i].start, nodes[i].end); | ||
151 | } else if (i >= 0) { | ||
147 | printk(KERN_ERR | 152 | printk(KERN_ERR |
148 | "SRAT: pxm %d overlap %lx-%lx with node %d(%Lx-%Lx)\n", | 153 | "SRAT: PXM %d (%lx-%lx) overlaps with PXM %d (%Lx-%Lx)\n", |
149 | pxm, start, end, i, nodes[i].start, nodes[i].end); | 154 | pxm, start, end, node_to_pxm(i), |
155 | nodes[i].start, nodes[i].end); | ||
150 | bad_srat(); | 156 | bad_srat(); |
151 | return; | 157 | return; |
152 | } | 158 | } |
@@ -174,6 +180,14 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
174 | int i; | 180 | int i; |
175 | if (acpi_numa <= 0) | 181 | if (acpi_numa <= 0) |
176 | return -1; | 182 | return -1; |
183 | |||
184 | /* First clean up the node list */ | ||
185 | for_each_node_mask(i, nodes_parsed) { | ||
186 | cutoff_node(i, start, end); | ||
187 | if (nodes[i].start == nodes[i].end) | ||
188 | node_clear(i, nodes_parsed); | ||
189 | } | ||
190 | |||
177 | memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed)); | 191 | memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed)); |
178 | if (memnode_shift < 0) { | 192 | if (memnode_shift < 0) { |
179 | printk(KERN_ERR | 193 | printk(KERN_ERR |
@@ -181,16 +195,10 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
181 | bad_srat(); | 195 | bad_srat(); |
182 | return -1; | 196 | return -1; |
183 | } | 197 | } |
184 | for (i = 0; i < MAX_NUMNODES; i++) { | 198 | |
185 | if (!node_isset(i, nodes_parsed)) | 199 | /* Finally register nodes */ |
186 | continue; | 200 | for_each_node_mask(i, nodes_parsed) |
187 | cutoff_node(i, start, end); | ||
188 | if (nodes[i].start == nodes[i].end) { | ||
189 | node_clear(i, nodes_parsed); | ||
190 | continue; | ||
191 | } | ||
192 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); | 201 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); |
193 | } | ||
194 | for (i = 0; i < NR_CPUS; i++) { | 202 | for (i = 0; i < NR_CPUS; i++) { |
195 | if (cpu_to_node[i] == NUMA_NO_NODE) | 203 | if (cpu_to_node[i] == NUMA_NO_NODE) |
196 | continue; | 204 | continue; |
@@ -201,7 +209,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
201 | return 0; | 209 | return 0; |
202 | } | 210 | } |
203 | 211 | ||
204 | int node_to_pxm(int n) | 212 | static int node_to_pxm(int n) |
205 | { | 213 | { |
206 | int i; | 214 | int i; |
207 | if (pxm2node[n] == n) | 215 | if (pxm2node[n] == n) |
diff --git a/arch/x86_64/pci/k8-bus.c b/arch/x86_64/pci/k8-bus.c index d80c323669e0..3acf60ded2a0 100644 --- a/arch/x86_64/pci/k8-bus.c +++ b/arch/x86_64/pci/k8-bus.c | |||
@@ -58,10 +58,16 @@ fill_mp_bus_to_cpumask(void) | |||
58 | for (j = SECONDARY_LDT_BUS_NUMBER(ldtbus); | 58 | for (j = SECONDARY_LDT_BUS_NUMBER(ldtbus); |
59 | j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus); | 59 | j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus); |
60 | j++) { | 60 | j++) { |
61 | int node = NODE_ID(nid); | 61 | struct pci_bus *bus; |
62 | long node = NODE_ID(nid); | ||
63 | /* Algorithm a bit dumb, but | ||
64 | it shouldn't matter here */ | ||
65 | bus = pci_find_bus(0, j); | ||
66 | if (!bus) | ||
67 | continue; | ||
62 | if (!node_online(node)) | 68 | if (!node_online(node)) |
63 | node = 0; | 69 | node = 0; |
64 | pci_bus_to_node[j] = node; | 70 | bus->sysdata = (void *)node; |
65 | } | 71 | } |
66 | } | 72 | } |
67 | } | 73 | } |
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c index 657e88aa0902..a0838c4a94e4 100644 --- a/arch/x86_64/pci/mmconfig.c +++ b/arch/x86_64/pci/mmconfig.c | |||
@@ -111,13 +111,6 @@ static int __init pci_mmcfg_init(void) | |||
111 | (pci_mmcfg_config[0].base_address == 0)) | 111 | (pci_mmcfg_config[0].base_address == 0)) |
112 | return 0; | 112 | return 0; |
113 | 113 | ||
114 | /* Kludge for now. Don't use mmconfig on AMD systems because | ||
115 | those have some busses where mmconfig doesn't work, | ||
116 | and we don't parse ACPI MCFG well enough to handle that. | ||
117 | Remove when proper handling is added. */ | ||
118 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) | ||
119 | return 0; | ||
120 | |||
121 | /* RED-PEN i386 doesn't do _nocache right now */ | 114 | /* RED-PEN i386 doesn't do _nocache right now */ |
122 | pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL); | 115 | pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL); |
123 | if (pci_mmcfg_virt == NULL) { | 116 | if (pci_mmcfg_virt == NULL) { |
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index 721ba8086043..0e9e586e9ba3 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ | 1 | /* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ |
2 | #define VERSION "10" | 2 | #define VERSION "12" |
3 | #define AOE_MAJOR 152 | 3 | #define AOE_MAJOR 152 |
4 | #define DEVICE_NAME "aoe" | 4 | #define DEVICE_NAME "aoe" |
5 | 5 | ||
@@ -7,12 +7,12 @@ | |||
7 | * default is 16, which is 15 partitions plus the whole disk | 7 | * default is 16, which is 15 partitions plus the whole disk |
8 | */ | 8 | */ |
9 | #ifndef AOE_PARTITIONS | 9 | #ifndef AOE_PARTITIONS |
10 | #define AOE_PARTITIONS 16 | 10 | #define AOE_PARTITIONS (16) |
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | #define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * 10 + (aoeminor)) | 13 | #define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * NPERSHELF + (aoeminor)) |
14 | #define AOEMAJOR(sysminor) ((sysminor) / 10) | 14 | #define AOEMAJOR(sysminor) ((sysminor) / NPERSHELF) |
15 | #define AOEMINOR(sysminor) ((sysminor) % 10) | 15 | #define AOEMINOR(sysminor) ((sysminor) % NPERSHELF) |
16 | #define WHITESPACE " \t\v\f\n" | 16 | #define WHITESPACE " \t\v\f\n" |
17 | 17 | ||
18 | enum { | 18 | enum { |
@@ -83,7 +83,7 @@ enum { | |||
83 | 83 | ||
84 | enum { | 84 | enum { |
85 | MAXATADATA = 1024, | 85 | MAXATADATA = 1024, |
86 | NPERSHELF = 10, | 86 | NPERSHELF = 16, /* number of slots per shelf address */ |
87 | FREETAG = -1, | 87 | FREETAG = -1, |
88 | MIN_BUFS = 8, | 88 | MIN_BUFS = 8, |
89 | }; | 89 | }; |
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index c3898afce3ae..fa789ea36bbe 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
@@ -139,6 +139,15 @@ config SA1100_WATCHDOG | |||
139 | To compile this driver as a module, choose M here: the | 139 | To compile this driver as a module, choose M here: the |
140 | module will be called sa1100_wdt. | 140 | module will be called sa1100_wdt. |
141 | 141 | ||
142 | config MPCORE_WATCHDOG | ||
143 | tristate "MPcore watchdog" | ||
144 | depends on WATCHDOG && ARM_MPCORE_PLATFORM && LOCAL_TIMERS | ||
145 | help | ||
146 | Watchdog timer embedded into the MPcore system. | ||
147 | |||
148 | To compile this driver as a module, choose M here: the | ||
149 | module will be called mpcore_wdt. | ||
150 | |||
142 | # X86 (i386 + ia64 + x86_64) Architecture | 151 | # X86 (i386 + ia64 + x86_64) Architecture |
143 | 152 | ||
144 | config ACQUIRE_WDT | 153 | config ACQUIRE_WDT |
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile index cfeac6f10137..bc6f5fe88c8c 100644 --- a/drivers/char/watchdog/Makefile +++ b/drivers/char/watchdog/Makefile | |||
@@ -29,6 +29,7 @@ obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o | |||
29 | obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o | 29 | obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o |
30 | obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o | 30 | obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o |
31 | obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o | 31 | obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o |
32 | obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o | ||
32 | 33 | ||
33 | # X86 (i386 + ia64 + x86_64) Architecture | 34 | # X86 (i386 + ia64 + x86_64) Architecture |
34 | obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o | 35 | obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o |
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c new file mode 100644 index 000000000000..c694eee1fb24 --- /dev/null +++ b/drivers/char/watchdog/mpcore_wdt.c | |||
@@ -0,0 +1,434 @@ | |||
1 | /* | ||
2 | * Watchdog driver for the mpcore watchdog timer | ||
3 | * | ||
4 | * (c) Copyright 2004 ARM Limited | ||
5 | * | ||
6 | * Based on the SoftDog driver: | ||
7 | * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. | ||
8 | * http://www.redhat.com | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version | ||
13 | * 2 of the License, or (at your option) any later version. | ||
14 | * | ||
15 | * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide | ||
16 | * warranty for any of this software. This material is provided | ||
17 | * "AS-IS" and at no charge. | ||
18 | * | ||
19 | * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> | ||
20 | * | ||
21 | */ | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/moduleparam.h> | ||
24 | #include <linux/config.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/miscdevice.h> | ||
27 | #include <linux/watchdog.h> | ||
28 | #include <linux/fs.h> | ||
29 | #include <linux/reboot.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/device.h> | ||
33 | #include <asm/uaccess.h> | ||
34 | |||
35 | struct mpcore_wdt { | ||
36 | unsigned long timer_alive; | ||
37 | struct device *dev; | ||
38 | void __iomem *base; | ||
39 | int irq; | ||
40 | unsigned int perturb; | ||
41 | char expect_close; | ||
42 | }; | ||
43 | |||
44 | static struct platform_device *mpcore_wdt_dev; | ||
45 | |||
46 | extern unsigned int mpcore_timer_rate; | ||
47 | |||
48 | #define TIMER_MARGIN 60 | ||
49 | static int mpcore_margin = TIMER_MARGIN; | ||
50 | module_param(mpcore_margin, int, 0); | ||
51 | MODULE_PARM_DESC(mpcore_margin, "MPcore timer margin in seconds. (0<mpcore_margin<65536, default=" __MODULE_STRING(TIMER_MARGIN) ")"); | ||
52 | |||
53 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
54 | module_param(nowayout, int, 0); | ||
55 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
56 | |||
57 | #define ONLY_TESTING 0 | ||
58 | static int mpcore_noboot = ONLY_TESTING; | ||
59 | module_param(mpcore_noboot, int, 0); | ||
60 | MODULE_PARM_DESC(mpcore_noboot, "MPcore watchdog action, set to 1 to ignore reboots, 0 to reboot (default=" __MODULE_STRING(ONLY_TESTING) ")"); | ||
61 | |||
62 | /* | ||
63 | * This is the interrupt handler. Note that we only use this | ||
64 | * in testing mode, so don't actually do a reboot here. | ||
65 | */ | ||
66 | static irqreturn_t mpcore_wdt_fire(int irq, void *arg, struct pt_regs *regs) | ||
67 | { | ||
68 | struct mpcore_wdt *wdt = arg; | ||
69 | |||
70 | /* Check it really was our interrupt */ | ||
71 | if (readl(wdt->base + TWD_WDOG_INTSTAT)) { | ||
72 | dev_printk(KERN_CRIT, wdt->dev, "Triggered - Reboot ignored.\n"); | ||
73 | |||
74 | /* Clear the interrupt on the watchdog */ | ||
75 | writel(1, wdt->base + TWD_WDOG_INTSTAT); | ||
76 | |||
77 | return IRQ_HANDLED; | ||
78 | } | ||
79 | |||
80 | return IRQ_NONE; | ||
81 | } | ||
82 | |||
83 | /* | ||
84 | * mpcore_wdt_keepalive - reload the timer | ||
85 | * | ||
86 | * Note that the spec says a DIFFERENT value must be written to the reload | ||
87 | * register each time. The "perturb" variable deals with this by adding 1 | ||
88 | * to the count every other time the function is called. | ||
89 | */ | ||
90 | static void mpcore_wdt_keepalive(struct mpcore_wdt *wdt) | ||
91 | { | ||
92 | unsigned int count; | ||
93 | |||
94 | /* Assume prescale is set to 256 */ | ||
95 | count = (mpcore_timer_rate / 256) * mpcore_margin; | ||
96 | |||
97 | /* Reload the counter */ | ||
98 | writel(count + wdt->perturb, wdt->base + TWD_WDOG_LOAD); | ||
99 | |||
100 | wdt->perturb = wdt->perturb ? 0 : 1; | ||
101 | } | ||
102 | |||
103 | static void mpcore_wdt_stop(struct mpcore_wdt *wdt) | ||
104 | { | ||
105 | writel(0x12345678, wdt->base + TWD_WDOG_DISABLE); | ||
106 | writel(0x87654321, wdt->base + TWD_WDOG_DISABLE); | ||
107 | writel(0x0, wdt->base + TWD_WDOG_CONTROL); | ||
108 | } | ||
109 | |||
110 | static void mpcore_wdt_start(struct mpcore_wdt *wdt) | ||
111 | { | ||
112 | dev_printk(KERN_INFO, wdt->dev, "enabling watchdog.\n"); | ||
113 | |||
114 | /* This loads the count register but does NOT start the count yet */ | ||
115 | mpcore_wdt_keepalive(wdt); | ||
116 | |||
117 | if (mpcore_noboot) { | ||
118 | /* Enable watchdog - prescale=256, watchdog mode=0, enable=1 */ | ||
119 | writel(0x0000FF01, wdt->base + TWD_WDOG_CONTROL); | ||
120 | } else { | ||
121 | /* Enable watchdog - prescale=256, watchdog mode=1, enable=1 */ | ||
122 | writel(0x0000FF09, wdt->base + TWD_WDOG_CONTROL); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | static int mpcore_wdt_set_heartbeat(int t) | ||
127 | { | ||
128 | if (t < 0x0001 || t > 0xFFFF) | ||
129 | return -EINVAL; | ||
130 | |||
131 | mpcore_margin = t; | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | /* | ||
136 | * /dev/watchdog handling | ||
137 | */ | ||
138 | static int mpcore_wdt_open(struct inode *inode, struct file *file) | ||
139 | { | ||
140 | struct mpcore_wdt *wdt = dev_get_drvdata(&mpcore_wdt_dev->dev); | ||
141 | |||
142 | if (test_and_set_bit(0, &wdt->timer_alive)) | ||
143 | return -EBUSY; | ||
144 | |||
145 | if (nowayout) | ||
146 | __module_get(THIS_MODULE); | ||
147 | |||
148 | file->private_data = wdt; | ||
149 | |||
150 | /* | ||
151 | * Activate timer | ||
152 | */ | ||
153 | mpcore_wdt_start(wdt); | ||
154 | |||
155 | return nonseekable_open(inode, file); | ||
156 | } | ||
157 | |||
158 | static int mpcore_wdt_release(struct inode *inode, struct file *file) | ||
159 | { | ||
160 | struct mpcore_wdt *wdt = file->private_data; | ||
161 | |||
162 | /* | ||
163 | * Shut off the timer. | ||
164 | * Lock it in if it's a module and we set nowayout | ||
165 | */ | ||
166 | if (wdt->expect_close == 42) { | ||
167 | mpcore_wdt_stop(wdt); | ||
168 | } else { | ||
169 | dev_printk(KERN_CRIT, wdt->dev, "unexpected close, not stopping watchdog!\n"); | ||
170 | mpcore_wdt_keepalive(wdt); | ||
171 | } | ||
172 | clear_bit(0, &wdt->timer_alive); | ||
173 | wdt->expect_close = 0; | ||
174 | return 0; | ||
175 | } | ||
176 | |||
177 | static ssize_t mpcore_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos) | ||
178 | { | ||
179 | struct mpcore_wdt *wdt = file->private_data; | ||
180 | |||
181 | /* Can't seek (pwrite) on this device */ | ||
182 | if (ppos != &file->f_pos) | ||
183 | return -ESPIPE; | ||
184 | |||
185 | /* | ||
186 | * Refresh the timer. | ||
187 | */ | ||
188 | if (len) { | ||
189 | if (!nowayout) { | ||
190 | size_t i; | ||
191 | |||
192 | /* In case it was set long ago */ | ||
193 | wdt->expect_close = 0; | ||
194 | |||
195 | for (i = 0; i != len; i++) { | ||
196 | char c; | ||
197 | |||
198 | if (get_user(c, data + i)) | ||
199 | return -EFAULT; | ||
200 | if (c == 'V') | ||
201 | wdt->expect_close = 42; | ||
202 | } | ||
203 | } | ||
204 | mpcore_wdt_keepalive(wdt); | ||
205 | } | ||
206 | return len; | ||
207 | } | ||
208 | |||
209 | static struct watchdog_info ident = { | ||
210 | .options = WDIOF_SETTIMEOUT | | ||
211 | WDIOF_KEEPALIVEPING | | ||
212 | WDIOF_MAGICCLOSE, | ||
213 | .identity = "MPcore Watchdog", | ||
214 | }; | ||
215 | |||
216 | static int mpcore_wdt_ioctl(struct inode *inode, struct file *file, | ||
217 | unsigned int cmd, unsigned long arg) | ||
218 | { | ||
219 | struct mpcore_wdt *wdt = file->private_data; | ||
220 | int ret; | ||
221 | union { | ||
222 | struct watchdog_info ident; | ||
223 | int i; | ||
224 | } uarg; | ||
225 | |||
226 | if (_IOC_DIR(cmd) && _IOC_SIZE(cmd) > sizeof(uarg)) | ||
227 | return -ENOIOCTLCMD; | ||
228 | |||
229 | if (_IOC_DIR(cmd) & _IOC_WRITE) { | ||
230 | ret = copy_from_user(&uarg, (void __user *)arg, _IOC_SIZE(cmd)); | ||
231 | if (ret) | ||
232 | return -EFAULT; | ||
233 | } | ||
234 | |||
235 | switch (cmd) { | ||
236 | case WDIOC_GETSUPPORT: | ||
237 | uarg.ident = ident; | ||
238 | ret = 0; | ||
239 | break; | ||
240 | |||
241 | case WDIOC_SETOPTIONS: | ||
242 | ret = -EINVAL; | ||
243 | if (uarg.i & WDIOS_DISABLECARD) { | ||
244 | mpcore_wdt_stop(wdt); | ||
245 | ret = 0; | ||
246 | } | ||
247 | if (uarg.i & WDIOS_ENABLECARD) { | ||
248 | mpcore_wdt_start(wdt); | ||
249 | ret = 0; | ||
250 | } | ||
251 | break; | ||
252 | |||
253 | case WDIOC_GETSTATUS: | ||
254 | case WDIOC_GETBOOTSTATUS: | ||
255 | uarg.i = 0; | ||
256 | ret = 0; | ||
257 | break; | ||
258 | |||
259 | case WDIOC_KEEPALIVE: | ||
260 | mpcore_wdt_keepalive(wdt); | ||
261 | ret = 0; | ||
262 | break; | ||
263 | |||
264 | case WDIOC_SETTIMEOUT: | ||
265 | ret = mpcore_wdt_set_heartbeat(uarg.i); | ||
266 | if (ret) | ||
267 | break; | ||
268 | |||
269 | mpcore_wdt_keepalive(wdt); | ||
270 | /* Fall */ | ||
271 | case WDIOC_GETTIMEOUT: | ||
272 | uarg.i = mpcore_margin; | ||
273 | ret = 0; | ||
274 | break; | ||
275 | |||
276 | default: | ||
277 | return -ENOIOCTLCMD; | ||
278 | } | ||
279 | |||
280 | if (ret == 0 && _IOC_DIR(cmd) & _IOC_READ) { | ||
281 | ret = copy_to_user((void __user *)arg, &uarg, _IOC_SIZE(cmd)); | ||
282 | if (ret) | ||
283 | ret = -EFAULT; | ||
284 | } | ||
285 | return ret; | ||
286 | } | ||
287 | |||
288 | /* | ||
289 | * System shutdown handler. Turn off the watchdog if we're | ||
290 | * restarting or halting the system. | ||
291 | */ | ||
292 | static void mpcore_wdt_shutdown(struct device *_dev) | ||
293 | { | ||
294 | struct mpcore_wdt *wdt = dev_get_drvdata(_dev); | ||
295 | |||
296 | if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) | ||
297 | mpcore_wdt_stop(wdt); | ||
298 | } | ||
299 | |||
300 | /* | ||
301 | * Kernel Interfaces | ||
302 | */ | ||
303 | static struct file_operations mpcore_wdt_fops = { | ||
304 | .owner = THIS_MODULE, | ||
305 | .llseek = no_llseek, | ||
306 | .write = mpcore_wdt_write, | ||
307 | .ioctl = mpcore_wdt_ioctl, | ||
308 | .open = mpcore_wdt_open, | ||
309 | .release = mpcore_wdt_release, | ||
310 | }; | ||
311 | |||
312 | static struct miscdevice mpcore_wdt_miscdev = { | ||
313 | .minor = WATCHDOG_MINOR, | ||
314 | .name = "watchdog", | ||
315 | .fops = &mpcore_wdt_fops, | ||
316 | }; | ||
317 | |||
318 | static int __devinit mpcore_wdt_probe(struct device *_dev) | ||
319 | { | ||
320 | struct platform_device *dev = to_platform_device(_dev); | ||
321 | struct mpcore_wdt *wdt; | ||
322 | struct resource *res; | ||
323 | int ret; | ||
324 | |||
325 | /* We only accept one device, and it must have an id of -1 */ | ||
326 | if (dev->id != -1) | ||
327 | return -ENODEV; | ||
328 | |||
329 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
330 | if (!res) { | ||
331 | ret = -ENODEV; | ||
332 | goto err_out; | ||
333 | } | ||
334 | |||
335 | wdt = kmalloc(sizeof(struct mpcore_wdt), GFP_KERNEL); | ||
336 | if (!wdt) { | ||
337 | ret = -ENOMEM; | ||
338 | goto err_out; | ||
339 | } | ||
340 | memset(wdt, 0, sizeof(struct mpcore_wdt)); | ||
341 | |||
342 | wdt->dev = &dev->dev; | ||
343 | wdt->irq = platform_get_irq(dev, 0); | ||
344 | wdt->base = ioremap(res->start, res->end - res->start + 1); | ||
345 | if (!wdt->base) { | ||
346 | ret = -ENOMEM; | ||
347 | goto err_free; | ||
348 | } | ||
349 | |||
350 | mpcore_wdt_miscdev.dev = &dev->dev; | ||
351 | ret = misc_register(&mpcore_wdt_miscdev); | ||
352 | if (ret) { | ||
353 | dev_printk(KERN_ERR, _dev, "cannot register miscdev on minor=%d (err=%d)\n", | ||
354 | WATCHDOG_MINOR, ret); | ||
355 | goto err_misc; | ||
356 | } | ||
357 | |||
358 | ret = request_irq(wdt->irq, mpcore_wdt_fire, SA_INTERRUPT, "mpcore_wdt", wdt); | ||
359 | if (ret) { | ||
360 | dev_printk(KERN_ERR, _dev, "cannot register IRQ%d for watchdog\n", wdt->irq); | ||
361 | goto err_irq; | ||
362 | } | ||
363 | |||
364 | mpcore_wdt_stop(wdt); | ||
365 | dev_set_drvdata(&dev->dev, wdt); | ||
366 | mpcore_wdt_dev = dev; | ||
367 | |||
368 | return 0; | ||
369 | |||
370 | err_irq: | ||
371 | misc_deregister(&mpcore_wdt_miscdev); | ||
372 | err_misc: | ||
373 | iounmap(wdt->base); | ||
374 | err_free: | ||
375 | kfree(wdt); | ||
376 | err_out: | ||
377 | return ret; | ||
378 | } | ||
379 | |||
380 | static int __devexit mpcore_wdt_remove(struct device *dev) | ||
381 | { | ||
382 | struct mpcore_wdt *wdt = dev_get_drvdata(dev); | ||
383 | |||
384 | dev_set_drvdata(dev, NULL); | ||
385 | |||
386 | misc_deregister(&mpcore_wdt_miscdev); | ||
387 | |||
388 | mpcore_wdt_dev = NULL; | ||
389 | |||
390 | free_irq(wdt->irq, wdt); | ||
391 | iounmap(wdt->base); | ||
392 | kfree(wdt); | ||
393 | return 0; | ||
394 | } | ||
395 | |||
396 | static struct device_driver mpcore_wdt_driver = { | ||
397 | .name = "mpcore_wdt", | ||
398 | .bus = &platform_bus_type, | ||
399 | .probe = mpcore_wdt_probe, | ||
400 | .remove = __devexit_p(mpcore_wdt_remove), | ||
401 | .shutdown = mpcore_wdt_shutdown, | ||
402 | }; | ||
403 | |||
404 | static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; | ||
405 | |||
406 | static int __init mpcore_wdt_init(void) | ||
407 | { | ||
408 | /* | ||
409 | * Check that the margin value is within it's range; | ||
410 | * if not reset to the default | ||
411 | */ | ||
412 | if (mpcore_wdt_set_heartbeat(mpcore_margin)) { | ||
413 | mpcore_wdt_set_heartbeat(TIMER_MARGIN); | ||
414 | printk(KERN_INFO "mpcore_margin value must be 0<mpcore_margin<65536, using %d\n", | ||
415 | TIMER_MARGIN); | ||
416 | } | ||
417 | |||
418 | printk(banner, mpcore_noboot, mpcore_margin, nowayout); | ||
419 | |||
420 | return driver_register(&mpcore_wdt_driver); | ||
421 | } | ||
422 | |||
423 | static void __exit mpcore_wdt_exit(void) | ||
424 | { | ||
425 | driver_unregister(&mpcore_wdt_driver); | ||
426 | } | ||
427 | |||
428 | module_init(mpcore_wdt_init); | ||
429 | module_exit(mpcore_wdt_exit); | ||
430 | |||
431 | MODULE_AUTHOR("ARM Limited"); | ||
432 | MODULE_DESCRIPTION("MPcore Watchdog Device Driver"); | ||
433 | MODULE_LICENSE("GPL"); | ||
434 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 138dc50270e3..7e72e922b41c 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -411,6 +411,23 @@ config SENSORS_W83627EHF | |||
411 | This driver can also be built as a module. If so, the module | 411 | This driver can also be built as a module. If so, the module |
412 | will be called w83627ehf. | 412 | will be called w83627ehf. |
413 | 413 | ||
414 | config SENSORS_HDAPS | ||
415 | tristate "IBM Hard Drive Active Protection System (hdaps)" | ||
416 | depends on HWMON && INPUT && X86 | ||
417 | default n | ||
418 | help | ||
419 | This driver provides support for the IBM Hard Drive Active Protection | ||
420 | System (hdaps), which provides an accelerometer and other misc. data. | ||
421 | Supported laptops include the IBM ThinkPad T41, T42, T43, and R51. | ||
422 | The accelerometer data is readable via sysfs. | ||
423 | |||
424 | This driver also provides an input class device, allowing the | ||
425 | laptop to act as a pinball machine-esque mouse. This is off by | ||
426 | default but enabled via sysfs or the module parameter "mousedev". | ||
427 | |||
428 | Say Y here if you have an applicable laptop and want to experience | ||
429 | the awesome power of hdaps. | ||
430 | |||
414 | config HWMON_DEBUG_CHIP | 431 | config HWMON_DEBUG_CHIP |
415 | bool "Hardware Monitoring Chip debugging messages" | 432 | bool "Hardware Monitoring Chip debugging messages" |
416 | depends on HWMON | 433 | depends on HWMON |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 381f1bf04cc5..f7d6a2f61ee7 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -22,6 +22,7 @@ obj-$(CONFIG_SENSORS_FSCHER) += fscher.o | |||
22 | obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o | 22 | obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o |
23 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o | 23 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o |
24 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o | 24 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o |
25 | obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o | ||
25 | obj-$(CONFIG_SENSORS_IT87) += it87.o | 26 | obj-$(CONFIG_SENSORS_IT87) += it87.o |
26 | obj-$(CONFIG_SENSORS_LM63) += lm63.o | 27 | obj-$(CONFIG_SENSORS_LM63) += lm63.o |
27 | obj-$(CONFIG_SENSORS_LM75) += lm75.o | 28 | obj-$(CONFIG_SENSORS_LM75) += lm75.o |
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c new file mode 100644 index 000000000000..eaebfc14c933 --- /dev/null +++ b/drivers/hwmon/hdaps.c | |||
@@ -0,0 +1,739 @@ | |||
1 | /* | ||
2 | * drivers/hwmon/hdaps.c - driver for IBM's Hard Drive Active Protection System | ||
3 | * | ||
4 | * Copyright (C) 2005 Robert Love <rml@novell.com> | ||
5 | * Copyright (C) 2005 Jesper Juhl <jesper.juhl@gmail.com> | ||
6 | * | ||
7 | * The HardDisk Active Protection System (hdaps) is present in the IBM ThinkPad | ||
8 | * T41, T42, T43, R51, and X40, at least. It provides a basic two-axis | ||
9 | * accelerometer and other data, such as the device's temperature. | ||
10 | * | ||
11 | * Based on the document by Mark A. Smith available at | ||
12 | * http://www.almaden.ibm.com/cs/people/marksmith/tpaps.html and a lot of trial | ||
13 | * and error. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License v2 as published by the | ||
17 | * Free Software Foundation. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
20 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
21 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
22 | * more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License along with | ||
25 | * this program; if not, write to the Free Software Foundation, Inc., | ||
26 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | ||
27 | */ | ||
28 | |||
29 | #include <linux/delay.h> | ||
30 | #include <linux/device.h> | ||
31 | #include <linux/input.h> | ||
32 | #include <linux/kernel.h> | ||
33 | #include <linux/module.h> | ||
34 | #include <linux/timer.h> | ||
35 | #include <linux/dmi.h> | ||
36 | #include <asm/io.h> | ||
37 | |||
38 | #define HDAPS_LOW_PORT 0x1600 /* first port used by hdaps */ | ||
39 | #define HDAPS_NR_PORTS 0x30 /* 0x1600 - 0x162f */ | ||
40 | |||
41 | #define STATE_FRESH 0x50 /* accelerometer data is fresh */ | ||
42 | |||
43 | #define REFRESH_ASYNC 0x00 /* do asynchronous refresh */ | ||
44 | #define REFRESH_SYNC 0x01 /* do synchronous refresh */ | ||
45 | |||
46 | #define HDAPS_PORT_STATE 0x1611 /* device state */ | ||
47 | #define HDAPS_PORT_YPOS 0x1612 /* y-axis position */ | ||
48 | #define HDAPS_PORT_XPOS 0x1614 /* x-axis position */ | ||
49 | #define HDAPS_PORT_TEMP1 0x1616 /* device temperature, in celcius */ | ||
50 | #define HDAPS_PORT_YVAR 0x1617 /* y-axis variance (what is this?) */ | ||
51 | #define HDAPS_PORT_XVAR 0x1619 /* x-axis variance (what is this?) */ | ||
52 | #define HDAPS_PORT_TEMP2 0x161b /* device temperature (again?) */ | ||
53 | #define HDAPS_PORT_UNKNOWN 0x161c /* what is this? */ | ||
54 | #define HDAPS_PORT_KMACT 0x161d /* keyboard or mouse activity */ | ||
55 | |||
56 | #define HDAPS_READ_MASK 0xff /* some reads have the low 8 bits set */ | ||
57 | |||
58 | #define KEYBD_MASK 0x20 /* set if keyboard activity */ | ||
59 | #define MOUSE_MASK 0x40 /* set if mouse activity */ | ||
60 | #define KEYBD_ISSET(n) (!! (n & KEYBD_MASK)) /* keyboard used? */ | ||
61 | #define MOUSE_ISSET(n) (!! (n & MOUSE_MASK)) /* mouse used? */ | ||
62 | |||
63 | #define INIT_TIMEOUT_MSECS 4000 /* wait up to 4s for device init ... */ | ||
64 | #define INIT_WAIT_MSECS 200 /* ... in 200ms increments */ | ||
65 | |||
66 | static struct platform_device *pdev; | ||
67 | static struct input_dev hdaps_idev; | ||
68 | static struct timer_list hdaps_timer; | ||
69 | static unsigned int hdaps_mousedev_threshold = 4; | ||
70 | static unsigned long hdaps_poll_ms = 50; | ||
71 | static unsigned int hdaps_mousedev; | ||
72 | static unsigned int hdaps_invert; | ||
73 | static u8 km_activity; | ||
74 | static int rest_x; | ||
75 | static int rest_y; | ||
76 | |||
77 | static DECLARE_MUTEX(hdaps_sem); | ||
78 | |||
79 | /* | ||
80 | * __get_latch - Get the value from a given port. Callers must hold hdaps_sem. | ||
81 | */ | ||
82 | static inline u8 __get_latch(u16 port) | ||
83 | { | ||
84 | return inb(port) & HDAPS_READ_MASK; | ||
85 | } | ||
86 | |||
87 | /* | ||
88 | * __check_latch - Check a port latch for a given value. Callers must hold | ||
89 | * hdaps_sem. Returns zero if the port contains the given value. | ||
90 | */ | ||
91 | static inline unsigned int __check_latch(u16 port, u8 val) | ||
92 | { | ||
93 | if (__get_latch(port) == val) | ||
94 | return 0; | ||
95 | return -EINVAL; | ||
96 | } | ||
97 | |||
98 | /* | ||
99 | * __wait_latch - Wait up to 100us for a port latch to get a certain value, | ||
100 | * returning zero if the value is obtained. Callers must hold hdaps_sem. | ||
101 | */ | ||
102 | static unsigned int __wait_latch(u16 port, u8 val) | ||
103 | { | ||
104 | unsigned int i; | ||
105 | |||
106 | for (i = 0; i < 20; i++) { | ||
107 | if (!__check_latch(port, val)) | ||
108 | return 0; | ||
109 | udelay(5); | ||
110 | } | ||
111 | |||
112 | return -EINVAL; | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * __device_refresh - Request a refresh from the accelerometer. | ||
117 | * | ||
118 | * If sync is REFRESH_SYNC, we perform a synchronous refresh and will wait. | ||
119 | * Returns zero if successful and nonzero on error. | ||
120 | * | ||
121 | * If sync is REFRESH_ASYNC, we merely kick off a new refresh if the device is | ||
122 | * not up-to-date. Always returns zero. | ||
123 | * | ||
124 | * Callers must hold hdaps_sem. | ||
125 | */ | ||
126 | static int __device_refresh(unsigned int sync) | ||
127 | { | ||
128 | u8 state; | ||
129 | |||
130 | udelay(100); | ||
131 | |||
132 | state = inb(0x1604); | ||
133 | if (state == STATE_FRESH) | ||
134 | return 0; | ||
135 | |||
136 | outb(0x11, 0x1610); | ||
137 | outb(0x01, 0x161f); | ||
138 | if (sync == REFRESH_ASYNC) | ||
139 | return 0; | ||
140 | |||
141 | return __wait_latch(0x1604, STATE_FRESH); | ||
142 | } | ||
143 | |||
144 | /* | ||
145 | * __device_complete - Indicate to the accelerometer that we are done reading | ||
146 | * data, and then initiate an async refresh. Callers must hold hdaps_sem. | ||
147 | */ | ||
148 | static inline void __device_complete(void) | ||
149 | { | ||
150 | inb(0x161f); | ||
151 | inb(0x1604); | ||
152 | __device_refresh(REFRESH_ASYNC); | ||
153 | } | ||
154 | |||
155 | static int __hdaps_readb_one(unsigned int port, u8 *val) | ||
156 | { | ||
157 | /* do a sync refresh -- we need to be sure that we read fresh data */ | ||
158 | if (__device_refresh(REFRESH_SYNC)) | ||
159 | return -EIO; | ||
160 | |||
161 | *val = inb(port); | ||
162 | __device_complete(); | ||
163 | |||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | * hdaps_readb_one - reads a byte from a single I/O port, placing the value in | ||
169 | * the given pointer. Returns zero on success or a negative error on failure. | ||
170 | * Can sleep. | ||
171 | */ | ||
172 | static int hdaps_readb_one(unsigned int port, u8 *val) | ||
173 | { | ||
174 | int ret; | ||
175 | |||
176 | down(&hdaps_sem); | ||
177 | ret = __hdaps_readb_one(port, val); | ||
178 | up(&hdaps_sem); | ||
179 | |||
180 | return ret; | ||
181 | } | ||
182 | |||
183 | static int __hdaps_read_pair(unsigned int port1, unsigned int port2, | ||
184 | int *x, int *y) | ||
185 | { | ||
186 | /* do a sync refresh -- we need to be sure that we read fresh data */ | ||
187 | if (__device_refresh(REFRESH_SYNC)) | ||
188 | return -EIO; | ||
189 | |||
190 | *y = inw(port2); | ||
191 | *x = inw(port1); | ||
192 | km_activity = inb(HDAPS_PORT_KMACT); | ||
193 | __device_complete(); | ||
194 | |||
195 | /* if hdaps_invert is set, negate the two values */ | ||
196 | if (hdaps_invert) { | ||
197 | *x = -*x; | ||
198 | *y = -*y; | ||
199 | } | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | /* | ||
205 | * hdaps_read_pair - reads the values from a pair of ports, placing the values | ||
206 | * in the given pointers. Returns zero on success. Can sleep. | ||
207 | */ | ||
208 | static int hdaps_read_pair(unsigned int port1, unsigned int port2, | ||
209 | int *val1, int *val2) | ||
210 | { | ||
211 | int ret; | ||
212 | |||
213 | down(&hdaps_sem); | ||
214 | ret = __hdaps_read_pair(port1, port2, val1, val2); | ||
215 | up(&hdaps_sem); | ||
216 | |||
217 | return ret; | ||
218 | } | ||
219 | |||
220 | /* initialize the accelerometer */ | ||
221 | static int hdaps_device_init(void) | ||
222 | { | ||
223 | unsigned int total_msecs = INIT_TIMEOUT_MSECS; | ||
224 | int ret = -ENXIO; | ||
225 | |||
226 | down(&hdaps_sem); | ||
227 | |||
228 | outb(0x13, 0x1610); | ||
229 | outb(0x01, 0x161f); | ||
230 | if (__wait_latch(0x161f, 0x00)) | ||
231 | goto out; | ||
232 | |||
233 | /* | ||
234 | * The 0x03 value appears to only work on some thinkpads, such as the | ||
235 | * T42p. Others return 0x01. | ||
236 | * | ||
237 | * The 0x02 value occurs when the chip has been previously initialized. | ||
238 | */ | ||
239 | if (__check_latch(0x1611, 0x03) && | ||
240 | __check_latch(0x1611, 0x02) && | ||
241 | __check_latch(0x1611, 0x01)) | ||
242 | goto out; | ||
243 | |||
244 | printk(KERN_DEBUG "hdaps: initial latch check good (0x%02x).\n", | ||
245 | __get_latch(0x1611)); | ||
246 | |||
247 | outb(0x17, 0x1610); | ||
248 | outb(0x81, 0x1611); | ||
249 | outb(0x01, 0x161f); | ||
250 | if (__wait_latch(0x161f, 0x00)) | ||
251 | goto out; | ||
252 | if (__wait_latch(0x1611, 0x00)) | ||
253 | goto out; | ||
254 | if (__wait_latch(0x1612, 0x60)) | ||
255 | goto out; | ||
256 | if (__wait_latch(0x1613, 0x00)) | ||
257 | goto out; | ||
258 | outb(0x14, 0x1610); | ||
259 | outb(0x01, 0x1611); | ||
260 | outb(0x01, 0x161f); | ||
261 | if (__wait_latch(0x161f, 0x00)) | ||
262 | goto out; | ||
263 | outb(0x10, 0x1610); | ||
264 | outb(0xc8, 0x1611); | ||
265 | outb(0x00, 0x1612); | ||
266 | outb(0x02, 0x1613); | ||
267 | outb(0x01, 0x161f); | ||
268 | if (__wait_latch(0x161f, 0x00)) | ||
269 | goto out; | ||
270 | if (__device_refresh(REFRESH_SYNC)) | ||
271 | goto out; | ||
272 | if (__wait_latch(0x1611, 0x00)) | ||
273 | goto out; | ||
274 | |||
275 | /* we have done our dance, now let's wait for the applause */ | ||
276 | while (total_msecs > 0) { | ||
277 | u8 ignored; | ||
278 | |||
279 | /* a read of the device helps push it into action */ | ||
280 | __hdaps_readb_one(HDAPS_PORT_UNKNOWN, &ignored); | ||
281 | if (!__wait_latch(0x1611, 0x02)) { | ||
282 | ret = 0; | ||
283 | break; | ||
284 | } | ||
285 | |||
286 | msleep(INIT_WAIT_MSECS); | ||
287 | total_msecs -= INIT_WAIT_MSECS; | ||
288 | } | ||
289 | |||
290 | out: | ||
291 | up(&hdaps_sem); | ||
292 | return ret; | ||
293 | } | ||
294 | |||
295 | |||
296 | /* Input class stuff */ | ||
297 | |||
298 | /* | ||
299 | * hdaps_calibrate - Zero out our "resting" values. Callers must hold hdaps_sem. | ||
300 | */ | ||
301 | static void hdaps_calibrate(void) | ||
302 | { | ||
303 | int x, y; | ||
304 | |||
305 | if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y)) | ||
306 | return; | ||
307 | |||
308 | rest_x = x; | ||
309 | rest_y = y; | ||
310 | } | ||
311 | |||
312 | static void hdaps_mousedev_poll(unsigned long unused) | ||
313 | { | ||
314 | int x, y; | ||
315 | |||
316 | /* Cannot sleep. Try nonblockingly. If we fail, try again later. */ | ||
317 | if (down_trylock(&hdaps_sem)) { | ||
318 | mod_timer(&hdaps_timer,jiffies+msecs_to_jiffies(hdaps_poll_ms)); | ||
319 | return; | ||
320 | } | ||
321 | |||
322 | if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y)) | ||
323 | goto out; | ||
324 | |||
325 | x -= rest_x; | ||
326 | y -= rest_y; | ||
327 | if (abs(x) > hdaps_mousedev_threshold) | ||
328 | input_report_rel(&hdaps_idev, REL_X, x); | ||
329 | if (abs(y) > hdaps_mousedev_threshold) | ||
330 | input_report_rel(&hdaps_idev, REL_Y, y); | ||
331 | input_sync(&hdaps_idev); | ||
332 | |||
333 | mod_timer(&hdaps_timer, jiffies + msecs_to_jiffies(hdaps_poll_ms)); | ||
334 | |||
335 | out: | ||
336 | up(&hdaps_sem); | ||
337 | } | ||
338 | |||
339 | /* | ||
340 | * hdaps_mousedev_enable - enable the input class device. Can sleep. | ||
341 | */ | ||
342 | static void hdaps_mousedev_enable(void) | ||
343 | { | ||
344 | down(&hdaps_sem); | ||
345 | |||
346 | /* calibrate the device before enabling */ | ||
347 | hdaps_calibrate(); | ||
348 | |||
349 | /* initialize the input class */ | ||
350 | init_input_dev(&hdaps_idev); | ||
351 | hdaps_idev.dev = &pdev->dev; | ||
352 | hdaps_idev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); | ||
353 | hdaps_idev.relbit[0] = BIT(REL_X) | BIT(REL_Y); | ||
354 | hdaps_idev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT); | ||
355 | input_register_device(&hdaps_idev); | ||
356 | |||
357 | /* start up our timer */ | ||
358 | init_timer(&hdaps_timer); | ||
359 | hdaps_timer.function = hdaps_mousedev_poll; | ||
360 | hdaps_timer.expires = jiffies + msecs_to_jiffies(hdaps_poll_ms); | ||
361 | add_timer(&hdaps_timer); | ||
362 | |||
363 | hdaps_mousedev = 1; | ||
364 | |||
365 | up(&hdaps_sem); | ||
366 | |||
367 | printk(KERN_INFO "hdaps: input device enabled.\n"); | ||
368 | } | ||
369 | |||
370 | /* | ||
371 | * hdaps_mousedev_disable - disable the input class device. Caller must hold | ||
372 | * hdaps_sem. | ||
373 | */ | ||
374 | static void hdaps_mousedev_disable(void) | ||
375 | { | ||
376 | down(&hdaps_sem); | ||
377 | if (hdaps_mousedev) { | ||
378 | hdaps_mousedev = 0; | ||
379 | del_timer_sync(&hdaps_timer); | ||
380 | input_unregister_device(&hdaps_idev); | ||
381 | } | ||
382 | up(&hdaps_sem); | ||
383 | } | ||
384 | |||
385 | |||
386 | /* Device model stuff */ | ||
387 | |||
388 | static int hdaps_probe(struct device *dev) | ||
389 | { | ||
390 | int ret; | ||
391 | |||
392 | ret = hdaps_device_init(); | ||
393 | if (ret) | ||
394 | return ret; | ||
395 | |||
396 | printk(KERN_INFO "hdaps: device successfully initialized.\n"); | ||
397 | return 0; | ||
398 | } | ||
399 | |||
400 | static int hdaps_resume(struct device *dev, u32 level) | ||
401 | { | ||
402 | if (level == RESUME_ENABLE) | ||
403 | return hdaps_device_init(); | ||
404 | return 0; | ||
405 | } | ||
406 | |||
407 | static struct device_driver hdaps_driver = { | ||
408 | .name = "hdaps", | ||
409 | .bus = &platform_bus_type, | ||
410 | .owner = THIS_MODULE, | ||
411 | .probe = hdaps_probe, | ||
412 | .resume = hdaps_resume | ||
413 | }; | ||
414 | |||
415 | |||
416 | /* Sysfs Files */ | ||
417 | |||
418 | static ssize_t hdaps_position_show(struct device *dev, | ||
419 | struct device_attribute *attr, char *buf) | ||
420 | { | ||
421 | int ret, x, y; | ||
422 | |||
423 | ret = hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y); | ||
424 | if (ret) | ||
425 | return ret; | ||
426 | |||
427 | return sprintf(buf, "(%d,%d)\n", x, y); | ||
428 | } | ||
429 | |||
430 | static ssize_t hdaps_variance_show(struct device *dev, | ||
431 | struct device_attribute *attr, char *buf) | ||
432 | { | ||
433 | int ret, x, y; | ||
434 | |||
435 | ret = hdaps_read_pair(HDAPS_PORT_XVAR, HDAPS_PORT_YVAR, &x, &y); | ||
436 | if (ret) | ||
437 | return ret; | ||
438 | |||
439 | return sprintf(buf, "(%d,%d)\n", x, y); | ||
440 | } | ||
441 | |||
442 | static ssize_t hdaps_temp1_show(struct device *dev, | ||
443 | struct device_attribute *attr, char *buf) | ||
444 | { | ||
445 | u8 temp; | ||
446 | int ret; | ||
447 | |||
448 | ret = hdaps_readb_one(HDAPS_PORT_TEMP1, &temp); | ||
449 | if (ret < 0) | ||
450 | return ret; | ||
451 | |||
452 | return sprintf(buf, "%u\n", temp); | ||
453 | } | ||
454 | |||
455 | static ssize_t hdaps_temp2_show(struct device *dev, | ||
456 | struct device_attribute *attr, char *buf) | ||
457 | { | ||
458 | u8 temp; | ||
459 | int ret; | ||
460 | |||
461 | ret = hdaps_readb_one(HDAPS_PORT_TEMP2, &temp); | ||
462 | if (ret < 0) | ||
463 | return ret; | ||
464 | |||
465 | return sprintf(buf, "%u\n", temp); | ||
466 | } | ||
467 | |||
468 | static ssize_t hdaps_keyboard_activity_show(struct device *dev, | ||
469 | struct device_attribute *attr, | ||
470 | char *buf) | ||
471 | { | ||
472 | return sprintf(buf, "%u\n", KEYBD_ISSET(km_activity)); | ||
473 | } | ||
474 | |||
475 | static ssize_t hdaps_mouse_activity_show(struct device *dev, | ||
476 | struct device_attribute *attr, | ||
477 | char *buf) | ||
478 | { | ||
479 | return sprintf(buf, "%u\n", MOUSE_ISSET(km_activity)); | ||
480 | } | ||
481 | |||
482 | static ssize_t hdaps_calibrate_show(struct device *dev, | ||
483 | struct device_attribute *attr, char *buf) | ||
484 | { | ||
485 | return sprintf(buf, "(%d,%d)\n", rest_x, rest_y); | ||
486 | } | ||
487 | |||
488 | static ssize_t hdaps_calibrate_store(struct device *dev, | ||
489 | struct device_attribute *attr, | ||
490 | const char *buf, size_t count) | ||
491 | { | ||
492 | down(&hdaps_sem); | ||
493 | hdaps_calibrate(); | ||
494 | up(&hdaps_sem); | ||
495 | |||
496 | return count; | ||
497 | } | ||
498 | |||
499 | static ssize_t hdaps_invert_show(struct device *dev, | ||
500 | struct device_attribute *attr, char *buf) | ||
501 | { | ||
502 | return sprintf(buf, "%u\n", hdaps_invert); | ||
503 | } | ||
504 | |||
505 | static ssize_t hdaps_invert_store(struct device *dev, | ||
506 | struct device_attribute *attr, | ||
507 | const char *buf, size_t count) | ||
508 | { | ||
509 | int invert; | ||
510 | |||
511 | if (sscanf(buf, "%d", &invert) != 1 || (invert != 1 && invert != 0)) | ||
512 | return -EINVAL; | ||
513 | |||
514 | hdaps_invert = invert; | ||
515 | hdaps_calibrate(); | ||
516 | |||
517 | return count; | ||
518 | } | ||
519 | |||
520 | static ssize_t hdaps_mousedev_show(struct device *dev, | ||
521 | struct device_attribute *attr, char *buf) | ||
522 | { | ||
523 | return sprintf(buf, "%d\n", hdaps_mousedev); | ||
524 | } | ||
525 | |||
526 | static ssize_t hdaps_mousedev_store(struct device *dev, | ||
527 | struct device_attribute *attr, | ||
528 | const char *buf, size_t count) | ||
529 | { | ||
530 | int enable; | ||
531 | |||
532 | if (sscanf(buf, "%d", &enable) != 1) | ||
533 | return -EINVAL; | ||
534 | |||
535 | if (enable == 1) | ||
536 | hdaps_mousedev_enable(); | ||
537 | else if (enable == 0) | ||
538 | hdaps_mousedev_disable(); | ||
539 | else | ||
540 | return -EINVAL; | ||
541 | |||
542 | return count; | ||
543 | } | ||
544 | |||
545 | static ssize_t hdaps_poll_show(struct device *dev, | ||
546 | struct device_attribute *attr, char *buf) | ||
547 | { | ||
548 | return sprintf(buf, "%lu\n", hdaps_poll_ms); | ||
549 | } | ||
550 | |||
551 | static ssize_t hdaps_poll_store(struct device *dev, | ||
552 | struct device_attribute *attr, | ||
553 | const char *buf, size_t count) | ||
554 | { | ||
555 | unsigned int poll; | ||
556 | |||
557 | if (sscanf(buf, "%u", &poll) != 1 || poll == 0) | ||
558 | return -EINVAL; | ||
559 | hdaps_poll_ms = poll; | ||
560 | |||
561 | return count; | ||
562 | } | ||
563 | |||
564 | static ssize_t hdaps_threshold_show(struct device *dev, | ||
565 | struct device_attribute *attr, char *buf) | ||
566 | { | ||
567 | return sprintf(buf, "%u\n", hdaps_mousedev_threshold); | ||
568 | } | ||
569 | |||
570 | static ssize_t hdaps_threshold_store(struct device *dev, | ||
571 | struct device_attribute *attr, | ||
572 | const char *buf, size_t count) | ||
573 | { | ||
574 | unsigned int threshold; | ||
575 | |||
576 | if (sscanf(buf, "%u", &threshold) != 1 || threshold == 0) | ||
577 | return -EINVAL; | ||
578 | hdaps_mousedev_threshold = threshold; | ||
579 | |||
580 | return count; | ||
581 | } | ||
582 | |||
583 | static DEVICE_ATTR(position, 0444, hdaps_position_show, NULL); | ||
584 | static DEVICE_ATTR(variance, 0444, hdaps_variance_show, NULL); | ||
585 | static DEVICE_ATTR(temp1, 0444, hdaps_temp1_show, NULL); | ||
586 | static DEVICE_ATTR(temp2, 0444, hdaps_temp2_show, NULL); | ||
587 | static DEVICE_ATTR(keyboard_activity, 0444, hdaps_keyboard_activity_show, NULL); | ||
588 | static DEVICE_ATTR(mouse_activity, 0444, hdaps_mouse_activity_show, NULL); | ||
589 | static DEVICE_ATTR(calibrate, 0644, hdaps_calibrate_show,hdaps_calibrate_store); | ||
590 | static DEVICE_ATTR(invert, 0644, hdaps_invert_show, hdaps_invert_store); | ||
591 | static DEVICE_ATTR(mousedev, 0644, hdaps_mousedev_show, hdaps_mousedev_store); | ||
592 | static DEVICE_ATTR(mousedev_poll_ms, 0644, hdaps_poll_show, hdaps_poll_store); | ||
593 | static DEVICE_ATTR(mousedev_threshold, 0644, hdaps_threshold_show, | ||
594 | hdaps_threshold_store); | ||
595 | |||
596 | static struct attribute *hdaps_attributes[] = { | ||
597 | &dev_attr_position.attr, | ||
598 | &dev_attr_variance.attr, | ||
599 | &dev_attr_temp1.attr, | ||
600 | &dev_attr_temp2.attr, | ||
601 | &dev_attr_keyboard_activity.attr, | ||
602 | &dev_attr_mouse_activity.attr, | ||
603 | &dev_attr_calibrate.attr, | ||
604 | &dev_attr_mousedev.attr, | ||
605 | &dev_attr_mousedev_threshold.attr, | ||
606 | &dev_attr_mousedev_poll_ms.attr, | ||
607 | &dev_attr_invert.attr, | ||
608 | NULL, | ||
609 | }; | ||
610 | |||
611 | static struct attribute_group hdaps_attribute_group = { | ||
612 | .attrs = hdaps_attributes, | ||
613 | }; | ||
614 | |||
615 | |||
616 | /* Module stuff */ | ||
617 | |||
618 | /* | ||
619 | * XXX: We should be able to return nonzero and halt the detection process. | ||
620 | * But there is a bug in dmi_check_system() where a nonzero return from the | ||
621 | * first match will result in a return of failure from dmi_check_system(). | ||
622 | * I fixed this; the patch is in 2.6-mm. Once in Linus's tree we can make | ||
623 | * hdaps_dmi_match_invert() return hdaps_dmi_match(), which in turn returns 1. | ||
624 | */ | ||
625 | static int hdaps_dmi_match(struct dmi_system_id *id) | ||
626 | { | ||
627 | printk(KERN_INFO "hdaps: %s detected.\n", id->ident); | ||
628 | return 0; | ||
629 | } | ||
630 | |||
631 | static int hdaps_dmi_match_invert(struct dmi_system_id *id) | ||
632 | { | ||
633 | hdaps_invert = 1; | ||
634 | printk(KERN_INFO "hdaps: inverting axis readings.\n"); | ||
635 | return 0; | ||
636 | } | ||
637 | |||
638 | #define HDAPS_DMI_MATCH_NORMAL(model) { \ | ||
639 | .ident = "IBM " model, \ | ||
640 | .callback = hdaps_dmi_match, \ | ||
641 | .matches = { \ | ||
642 | DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), \ | ||
643 | DMI_MATCH(DMI_PRODUCT_VERSION, model) \ | ||
644 | } \ | ||
645 | } | ||
646 | |||
647 | #define HDAPS_DMI_MATCH_INVERT(model) { \ | ||
648 | .ident = "IBM " model, \ | ||
649 | .callback = hdaps_dmi_match_invert, \ | ||
650 | .matches = { \ | ||
651 | DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), \ | ||
652 | DMI_MATCH(DMI_PRODUCT_VERSION, model) \ | ||
653 | } \ | ||
654 | } | ||
655 | |||
656 | static int __init hdaps_init(void) | ||
657 | { | ||
658 | int ret; | ||
659 | |||
660 | /* Note that DMI_MATCH(...,"ThinkPad T42") will match "ThinkPad T42p" */ | ||
661 | struct dmi_system_id hdaps_whitelist[] = { | ||
662 | HDAPS_DMI_MATCH_INVERT("ThinkPad R50p"), | ||
663 | HDAPS_DMI_MATCH_NORMAL("ThinkPad R50"), | ||
664 | HDAPS_DMI_MATCH_NORMAL("ThinkPad R51"), | ||
665 | HDAPS_DMI_MATCH_INVERT("ThinkPad T41p"), | ||
666 | HDAPS_DMI_MATCH_NORMAL("ThinkPad T41"), | ||
667 | HDAPS_DMI_MATCH_INVERT("ThinkPad T42p"), | ||
668 | HDAPS_DMI_MATCH_NORMAL("ThinkPad T42"), | ||
669 | HDAPS_DMI_MATCH_NORMAL("ThinkPad T43"), | ||
670 | HDAPS_DMI_MATCH_NORMAL("ThinkPad X40"), | ||
671 | { .ident = NULL } | ||
672 | }; | ||
673 | |||
674 | if (!dmi_check_system(hdaps_whitelist)) { | ||
675 | printk(KERN_WARNING "hdaps: supported laptop not found!\n"); | ||
676 | ret = -ENXIO; | ||
677 | goto out; | ||
678 | } | ||
679 | |||
680 | if (!request_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS, "hdaps")) { | ||
681 | ret = -ENXIO; | ||
682 | goto out; | ||
683 | } | ||
684 | |||
685 | ret = driver_register(&hdaps_driver); | ||
686 | if (ret) | ||
687 | goto out_region; | ||
688 | |||
689 | pdev = platform_device_register_simple("hdaps", -1, NULL, 0); | ||
690 | if (IS_ERR(pdev)) { | ||
691 | ret = PTR_ERR(pdev); | ||
692 | goto out_driver; | ||
693 | } | ||
694 | |||
695 | ret = sysfs_create_group(&pdev->dev.kobj, &hdaps_attribute_group); | ||
696 | if (ret) | ||
697 | goto out_device; | ||
698 | |||
699 | if (hdaps_mousedev) | ||
700 | hdaps_mousedev_enable(); | ||
701 | |||
702 | printk(KERN_INFO "hdaps: driver successfully loaded.\n"); | ||
703 | return 0; | ||
704 | |||
705 | out_device: | ||
706 | platform_device_unregister(pdev); | ||
707 | out_driver: | ||
708 | driver_unregister(&hdaps_driver); | ||
709 | out_region: | ||
710 | release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); | ||
711 | out: | ||
712 | printk(KERN_WARNING "hdaps: driver init failed (ret=%d)!\n", ret); | ||
713 | return ret; | ||
714 | } | ||
715 | |||
716 | static void __exit hdaps_exit(void) | ||
717 | { | ||
718 | hdaps_mousedev_disable(); | ||
719 | |||
720 | sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); | ||
721 | platform_device_unregister(pdev); | ||
722 | driver_unregister(&hdaps_driver); | ||
723 | release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); | ||
724 | |||
725 | printk(KERN_INFO "hdaps: driver unloaded.\n"); | ||
726 | } | ||
727 | |||
728 | module_init(hdaps_init); | ||
729 | module_exit(hdaps_exit); | ||
730 | |||
731 | module_param_named(mousedev, hdaps_mousedev, bool, 0); | ||
732 | MODULE_PARM_DESC(mousedev, "enable the input class device"); | ||
733 | |||
734 | module_param_named(invert, hdaps_invert, bool, 0); | ||
735 | MODULE_PARM_DESC(invert, "invert data along each axis"); | ||
736 | |||
737 | MODULE_AUTHOR("Robert Love"); | ||
738 | MODULE_DESCRIPTION("IBM Hard Drive Active Protection System (HDAPS) driver"); | ||
739 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 8610bce08244..21aa9a41f62c 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -758,11 +758,6 @@ static int __devinit sis5595_pci_probe(struct pci_dev *dev, | |||
758 | return -ENODEV; | 758 | return -ENODEV; |
759 | } | 759 | } |
760 | 760 | ||
761 | if (!address) { | ||
762 | dev_err(&dev->dev,"No SiS 5595 sensors found.\n"); | ||
763 | return -ENODEV; | ||
764 | } | ||
765 | |||
766 | s_bridge = pci_dev_get(dev); | 761 | s_bridge = pci_dev_get(dev); |
767 | if (i2c_isa_add_driver(&sis5595_driver)) { | 762 | if (i2c_isa_add_driver(&sis5595_driver)) { |
768 | pci_dev_put(s_bridge); | 763 | pci_dev_put(s_bridge); |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 7e699a8ede26..c9cc683eba4a 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -2,8 +2,8 @@ | |||
2 | smsc47m1.c - Part of lm_sensors, Linux kernel modules | 2 | smsc47m1.c - Part of lm_sensors, Linux kernel modules |
3 | for hardware monitoring | 3 | for hardware monitoring |
4 | 4 | ||
5 | Supports the SMSC LPC47B27x, LPC47M10x, LPC47M13x and LPC47M14x | 5 | Supports the SMSC LPC47B27x, LPC47M10x, LPC47M13x, LPC47M14x, |
6 | Super-I/O chips. | 6 | LPC47M15x and LPC47M192 Super-I/O chips. |
7 | 7 | ||
8 | Copyright (C) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> | 8 | Copyright (C) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> |
9 | Copyright (C) 2004 Jean Delvare <khali@linux-fr.org> | 9 | Copyright (C) 2004 Jean Delvare <khali@linux-fr.org> |
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index eb84997627c8..05ddc88e7dd2 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -812,11 +812,6 @@ static int __devinit via686a_pci_probe(struct pci_dev *dev, | |||
812 | return -ENODEV; | 812 | return -ENODEV; |
813 | } | 813 | } |
814 | 814 | ||
815 | if (!address) { | ||
816 | dev_err(&dev->dev, "No Via 686A sensors found.\n"); | ||
817 | return -ENODEV; | ||
818 | } | ||
819 | |||
820 | s_bridge = pci_dev_get(dev); | 815 | s_bridge = pci_dev_get(dev); |
821 | if (i2c_isa_add_driver(&via686a_driver)) { | 816 | if (i2c_isa_add_driver(&via686a_driver)) { |
822 | pci_dev_put(s_bridge); | 817 | pci_dev_put(s_bridge); |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 02bd5c0239a2..3479dc5208e2 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -64,6 +64,10 @@ static unsigned short address; | |||
64 | /* Insmod parameters */ | 64 | /* Insmod parameters */ |
65 | enum chips { any_chip, w83627hf, w83627thf, w83697hf, w83637hf }; | 65 | enum chips { any_chip, w83627hf, w83627thf, w83697hf, w83637hf }; |
66 | 66 | ||
67 | static int reset; | ||
68 | module_param(reset, bool, 0); | ||
69 | MODULE_PARM_DESC(reset, "Set to one to reset chip on load"); | ||
70 | |||
67 | static int init = 1; | 71 | static int init = 1; |
68 | module_param(init, bool, 0); | 72 | module_param(init, bool, 0); |
69 | MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization"); | 73 | MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization"); |
@@ -1279,7 +1283,15 @@ static void w83627hf_init_client(struct i2c_client *client) | |||
1279 | int type = data->type; | 1283 | int type = data->type; |
1280 | u8 tmp; | 1284 | u8 tmp; |
1281 | 1285 | ||
1282 | if(init) { | 1286 | if (reset) { |
1287 | /* Resetting the chip has been the default for a long time, | ||
1288 | but repeatedly caused problems (fans going to full | ||
1289 | speed...) so it is now optional. It might even go away if | ||
1290 | nobody reports it as being useful, as I see very little | ||
1291 | reason why this would be needed at all. */ | ||
1292 | dev_info(&client->dev, "If reset=1 solved a problem you were " | ||
1293 | "having, please report!\n"); | ||
1294 | |||
1283 | /* save this register */ | 1295 | /* save this register */ |
1284 | i = w83627hf_read_value(client, W83781D_REG_BEEP_CONFIG); | 1296 | i = w83627hf_read_value(client, W83781D_REG_BEEP_CONFIG); |
1285 | /* Reset all except Watchdog values and last conversion values | 1297 | /* Reset all except Watchdog values and last conversion values |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index e0b7a913431e..fe9c0f42a2b7 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -98,11 +98,6 @@ struct nforce2_smbus { | |||
98 | #define NVIDIA_SMB_PRTCL_PEC 0x80 | 98 | #define NVIDIA_SMB_PRTCL_PEC 0x80 |
99 | 99 | ||
100 | 100 | ||
101 | /* Other settings */ | ||
102 | #define MAX_TIMEOUT 256 | ||
103 | |||
104 | |||
105 | |||
106 | static s32 nforce2_access(struct i2c_adapter *adap, u16 addr, | 101 | static s32 nforce2_access(struct i2c_adapter *adap, u16 addr, |
107 | unsigned short flags, char read_write, | 102 | unsigned short flags, char read_write, |
108 | u8 command, int size, union i2c_smbus_data *data); | 103 | u8 command, int size, union i2c_smbus_data *data); |
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index e11e55dc8924..3cbca7cbea80 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -93,7 +93,7 @@ static int dma = 2; | |||
93 | static inline void wbsd_unlock_config(struct wbsd_host* host) | 93 | static inline void wbsd_unlock_config(struct wbsd_host* host) |
94 | { | 94 | { |
95 | BUG_ON(host->config == 0); | 95 | BUG_ON(host->config == 0); |
96 | 96 | ||
97 | outb(host->unlock_code, host->config); | 97 | outb(host->unlock_code, host->config); |
98 | outb(host->unlock_code, host->config); | 98 | outb(host->unlock_code, host->config); |
99 | } | 99 | } |
@@ -101,14 +101,14 @@ static inline void wbsd_unlock_config(struct wbsd_host* host) | |||
101 | static inline void wbsd_lock_config(struct wbsd_host* host) | 101 | static inline void wbsd_lock_config(struct wbsd_host* host) |
102 | { | 102 | { |
103 | BUG_ON(host->config == 0); | 103 | BUG_ON(host->config == 0); |
104 | 104 | ||
105 | outb(LOCK_CODE, host->config); | 105 | outb(LOCK_CODE, host->config); |
106 | } | 106 | } |
107 | 107 | ||
108 | static inline void wbsd_write_config(struct wbsd_host* host, u8 reg, u8 value) | 108 | static inline void wbsd_write_config(struct wbsd_host* host, u8 reg, u8 value) |
109 | { | 109 | { |
110 | BUG_ON(host->config == 0); | 110 | BUG_ON(host->config == 0); |
111 | 111 | ||
112 | outb(reg, host->config); | 112 | outb(reg, host->config); |
113 | outb(value, host->config + 1); | 113 | outb(value, host->config + 1); |
114 | } | 114 | } |
@@ -116,7 +116,7 @@ static inline void wbsd_write_config(struct wbsd_host* host, u8 reg, u8 value) | |||
116 | static inline u8 wbsd_read_config(struct wbsd_host* host, u8 reg) | 116 | static inline u8 wbsd_read_config(struct wbsd_host* host, u8 reg) |
117 | { | 117 | { |
118 | BUG_ON(host->config == 0); | 118 | BUG_ON(host->config == 0); |
119 | 119 | ||
120 | outb(reg, host->config); | 120 | outb(reg, host->config); |
121 | return inb(host->config + 1); | 121 | return inb(host->config + 1); |
122 | } | 122 | } |
@@ -140,21 +140,21 @@ static inline u8 wbsd_read_index(struct wbsd_host* host, u8 index) | |||
140 | static void wbsd_init_device(struct wbsd_host* host) | 140 | static void wbsd_init_device(struct wbsd_host* host) |
141 | { | 141 | { |
142 | u8 setup, ier; | 142 | u8 setup, ier; |
143 | 143 | ||
144 | /* | 144 | /* |
145 | * Reset chip (SD/MMC part) and fifo. | 145 | * Reset chip (SD/MMC part) and fifo. |
146 | */ | 146 | */ |
147 | setup = wbsd_read_index(host, WBSD_IDX_SETUP); | 147 | setup = wbsd_read_index(host, WBSD_IDX_SETUP); |
148 | setup |= WBSD_FIFO_RESET | WBSD_SOFT_RESET; | 148 | setup |= WBSD_FIFO_RESET | WBSD_SOFT_RESET; |
149 | wbsd_write_index(host, WBSD_IDX_SETUP, setup); | 149 | wbsd_write_index(host, WBSD_IDX_SETUP, setup); |
150 | 150 | ||
151 | /* | 151 | /* |
152 | * Set DAT3 to input | 152 | * Set DAT3 to input |
153 | */ | 153 | */ |
154 | setup &= ~WBSD_DAT3_H; | 154 | setup &= ~WBSD_DAT3_H; |
155 | wbsd_write_index(host, WBSD_IDX_SETUP, setup); | 155 | wbsd_write_index(host, WBSD_IDX_SETUP, setup); |
156 | host->flags &= ~WBSD_FIGNORE_DETECT; | 156 | host->flags &= ~WBSD_FIGNORE_DETECT; |
157 | 157 | ||
158 | /* | 158 | /* |
159 | * Read back default clock. | 159 | * Read back default clock. |
160 | */ | 160 | */ |
@@ -164,12 +164,12 @@ static void wbsd_init_device(struct wbsd_host* host) | |||
164 | * Power down port. | 164 | * Power down port. |
165 | */ | 165 | */ |
166 | outb(WBSD_POWER_N, host->base + WBSD_CSR); | 166 | outb(WBSD_POWER_N, host->base + WBSD_CSR); |
167 | 167 | ||
168 | /* | 168 | /* |
169 | * Set maximum timeout. | 169 | * Set maximum timeout. |
170 | */ | 170 | */ |
171 | wbsd_write_index(host, WBSD_IDX_TAAC, 0x7F); | 171 | wbsd_write_index(host, WBSD_IDX_TAAC, 0x7F); |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * Test for card presence | 174 | * Test for card presence |
175 | */ | 175 | */ |
@@ -177,7 +177,7 @@ static void wbsd_init_device(struct wbsd_host* host) | |||
177 | host->flags |= WBSD_FCARD_PRESENT; | 177 | host->flags |= WBSD_FCARD_PRESENT; |
178 | else | 178 | else |
179 | host->flags &= ~WBSD_FCARD_PRESENT; | 179 | host->flags &= ~WBSD_FCARD_PRESENT; |
180 | 180 | ||
181 | /* | 181 | /* |
182 | * Enable interesting interrupts. | 182 | * Enable interesting interrupts. |
183 | */ | 183 | */ |
@@ -200,9 +200,9 @@ static void wbsd_init_device(struct wbsd_host* host) | |||
200 | static void wbsd_reset(struct wbsd_host* host) | 200 | static void wbsd_reset(struct wbsd_host* host) |
201 | { | 201 | { |
202 | u8 setup; | 202 | u8 setup; |
203 | 203 | ||
204 | printk(KERN_ERR DRIVER_NAME ": Resetting chip\n"); | 204 | printk(KERN_ERR DRIVER_NAME ": Resetting chip\n"); |
205 | 205 | ||
206 | /* | 206 | /* |
207 | * Soft reset of chip (SD/MMC part). | 207 | * Soft reset of chip (SD/MMC part). |
208 | */ | 208 | */ |
@@ -214,9 +214,9 @@ static void wbsd_reset(struct wbsd_host* host) | |||
214 | static void wbsd_request_end(struct wbsd_host* host, struct mmc_request* mrq) | 214 | static void wbsd_request_end(struct wbsd_host* host, struct mmc_request* mrq) |
215 | { | 215 | { |
216 | unsigned long dmaflags; | 216 | unsigned long dmaflags; |
217 | 217 | ||
218 | DBGF("Ending request, cmd (%x)\n", mrq->cmd->opcode); | 218 | DBGF("Ending request, cmd (%x)\n", mrq->cmd->opcode); |
219 | 219 | ||
220 | if (host->dma >= 0) | 220 | if (host->dma >= 0) |
221 | { | 221 | { |
222 | /* | 222 | /* |
@@ -232,7 +232,7 @@ static void wbsd_request_end(struct wbsd_host* host, struct mmc_request* mrq) | |||
232 | */ | 232 | */ |
233 | wbsd_write_index(host, WBSD_IDX_DMA, 0); | 233 | wbsd_write_index(host, WBSD_IDX_DMA, 0); |
234 | } | 234 | } |
235 | 235 | ||
236 | host->mrq = NULL; | 236 | host->mrq = NULL; |
237 | 237 | ||
238 | /* | 238 | /* |
@@ -275,7 +275,7 @@ static inline int wbsd_next_sg(struct wbsd_host* host) | |||
275 | host->offset = 0; | 275 | host->offset = 0; |
276 | host->remain = host->cur_sg->length; | 276 | host->remain = host->cur_sg->length; |
277 | } | 277 | } |
278 | 278 | ||
279 | return host->num_sg; | 279 | return host->num_sg; |
280 | } | 280 | } |
281 | 281 | ||
@@ -297,12 +297,12 @@ static inline void wbsd_sg_to_dma(struct wbsd_host* host, struct mmc_data* data) | |||
297 | struct scatterlist* sg; | 297 | struct scatterlist* sg; |
298 | char* dmabuf = host->dma_buffer; | 298 | char* dmabuf = host->dma_buffer; |
299 | char* sgbuf; | 299 | char* sgbuf; |
300 | 300 | ||
301 | size = host->size; | 301 | size = host->size; |
302 | 302 | ||
303 | sg = data->sg; | 303 | sg = data->sg; |
304 | len = data->sg_len; | 304 | len = data->sg_len; |
305 | 305 | ||
306 | /* | 306 | /* |
307 | * Just loop through all entries. Size might not | 307 | * Just loop through all entries. Size might not |
308 | * be the entire list though so make sure that | 308 | * be the entire list though so make sure that |
@@ -317,23 +317,23 @@ static inline void wbsd_sg_to_dma(struct wbsd_host* host, struct mmc_data* data) | |||
317 | memcpy(dmabuf, sgbuf, sg[i].length); | 317 | memcpy(dmabuf, sgbuf, sg[i].length); |
318 | kunmap_atomic(sgbuf, KM_BIO_SRC_IRQ); | 318 | kunmap_atomic(sgbuf, KM_BIO_SRC_IRQ); |
319 | dmabuf += sg[i].length; | 319 | dmabuf += sg[i].length; |
320 | 320 | ||
321 | if (size < sg[i].length) | 321 | if (size < sg[i].length) |
322 | size = 0; | 322 | size = 0; |
323 | else | 323 | else |
324 | size -= sg[i].length; | 324 | size -= sg[i].length; |
325 | 325 | ||
326 | if (size == 0) | 326 | if (size == 0) |
327 | break; | 327 | break; |
328 | } | 328 | } |
329 | 329 | ||
330 | /* | 330 | /* |
331 | * Check that we didn't get a request to transfer | 331 | * Check that we didn't get a request to transfer |
332 | * more data than can fit into the SG list. | 332 | * more data than can fit into the SG list. |
333 | */ | 333 | */ |
334 | 334 | ||
335 | BUG_ON(size != 0); | 335 | BUG_ON(size != 0); |
336 | 336 | ||
337 | host->size -= size; | 337 | host->size -= size; |
338 | } | 338 | } |
339 | 339 | ||
@@ -343,12 +343,12 @@ static inline void wbsd_dma_to_sg(struct wbsd_host* host, struct mmc_data* data) | |||
343 | struct scatterlist* sg; | 343 | struct scatterlist* sg; |
344 | char* dmabuf = host->dma_buffer; | 344 | char* dmabuf = host->dma_buffer; |
345 | char* sgbuf; | 345 | char* sgbuf; |
346 | 346 | ||
347 | size = host->size; | 347 | size = host->size; |
348 | 348 | ||
349 | sg = data->sg; | 349 | sg = data->sg; |
350 | len = data->sg_len; | 350 | len = data->sg_len; |
351 | 351 | ||
352 | /* | 352 | /* |
353 | * Just loop through all entries. Size might not | 353 | * Just loop through all entries. Size might not |
354 | * be the entire list though so make sure that | 354 | * be the entire list though so make sure that |
@@ -363,30 +363,30 @@ static inline void wbsd_dma_to_sg(struct wbsd_host* host, struct mmc_data* data) | |||
363 | memcpy(sgbuf, dmabuf, sg[i].length); | 363 | memcpy(sgbuf, dmabuf, sg[i].length); |
364 | kunmap_atomic(sgbuf, KM_BIO_SRC_IRQ); | 364 | kunmap_atomic(sgbuf, KM_BIO_SRC_IRQ); |
365 | dmabuf += sg[i].length; | 365 | dmabuf += sg[i].length; |
366 | 366 | ||
367 | if (size < sg[i].length) | 367 | if (size < sg[i].length) |
368 | size = 0; | 368 | size = 0; |
369 | else | 369 | else |
370 | size -= sg[i].length; | 370 | size -= sg[i].length; |
371 | 371 | ||
372 | if (size == 0) | 372 | if (size == 0) |
373 | break; | 373 | break; |
374 | } | 374 | } |
375 | 375 | ||
376 | /* | 376 | /* |
377 | * Check that we didn't get a request to transfer | 377 | * Check that we didn't get a request to transfer |
378 | * more data than can fit into the SG list. | 378 | * more data than can fit into the SG list. |
379 | */ | 379 | */ |
380 | 380 | ||
381 | BUG_ON(size != 0); | 381 | BUG_ON(size != 0); |
382 | 382 | ||
383 | host->size -= size; | 383 | host->size -= size; |
384 | } | 384 | } |
385 | 385 | ||
386 | /* | 386 | /* |
387 | * Command handling | 387 | * Command handling |
388 | */ | 388 | */ |
389 | 389 | ||
390 | static inline void wbsd_get_short_reply(struct wbsd_host* host, | 390 | static inline void wbsd_get_short_reply(struct wbsd_host* host, |
391 | struct mmc_command* cmd) | 391 | struct mmc_command* cmd) |
392 | { | 392 | { |
@@ -398,7 +398,7 @@ static inline void wbsd_get_short_reply(struct wbsd_host* host, | |||
398 | cmd->error = MMC_ERR_INVALID; | 398 | cmd->error = MMC_ERR_INVALID; |
399 | return; | 399 | return; |
400 | } | 400 | } |
401 | 401 | ||
402 | cmd->resp[0] = | 402 | cmd->resp[0] = |
403 | wbsd_read_index(host, WBSD_IDX_RESP12) << 24; | 403 | wbsd_read_index(host, WBSD_IDX_RESP12) << 24; |
404 | cmd->resp[0] |= | 404 | cmd->resp[0] |= |
@@ -415,7 +415,7 @@ static inline void wbsd_get_long_reply(struct wbsd_host* host, | |||
415 | struct mmc_command* cmd) | 415 | struct mmc_command* cmd) |
416 | { | 416 | { |
417 | int i; | 417 | int i; |
418 | 418 | ||
419 | /* | 419 | /* |
420 | * Correct response type? | 420 | * Correct response type? |
421 | */ | 421 | */ |
@@ -424,7 +424,7 @@ static inline void wbsd_get_long_reply(struct wbsd_host* host, | |||
424 | cmd->error = MMC_ERR_INVALID; | 424 | cmd->error = MMC_ERR_INVALID; |
425 | return; | 425 | return; |
426 | } | 426 | } |
427 | 427 | ||
428 | for (i = 0;i < 4;i++) | 428 | for (i = 0;i < 4;i++) |
429 | { | 429 | { |
430 | cmd->resp[i] = | 430 | cmd->resp[i] = |
@@ -442,7 +442,7 @@ static void wbsd_send_command(struct wbsd_host* host, struct mmc_command* cmd) | |||
442 | { | 442 | { |
443 | int i; | 443 | int i; |
444 | u8 status, isr; | 444 | u8 status, isr; |
445 | 445 | ||
446 | DBGF("Sending cmd (%x)\n", cmd->opcode); | 446 | DBGF("Sending cmd (%x)\n", cmd->opcode); |
447 | 447 | ||
448 | /* | 448 | /* |
@@ -451,16 +451,16 @@ static void wbsd_send_command(struct wbsd_host* host, struct mmc_command* cmd) | |||
451 | * transfer. | 451 | * transfer. |
452 | */ | 452 | */ |
453 | host->isr = 0; | 453 | host->isr = 0; |
454 | 454 | ||
455 | /* | 455 | /* |
456 | * Send the command (CRC calculated by host). | 456 | * Send the command (CRC calculated by host). |
457 | */ | 457 | */ |
458 | outb(cmd->opcode, host->base + WBSD_CMDR); | 458 | outb(cmd->opcode, host->base + WBSD_CMDR); |
459 | for (i = 3;i >= 0;i--) | 459 | for (i = 3;i >= 0;i--) |
460 | outb((cmd->arg >> (i * 8)) & 0xff, host->base + WBSD_CMDR); | 460 | outb((cmd->arg >> (i * 8)) & 0xff, host->base + WBSD_CMDR); |
461 | 461 | ||
462 | cmd->error = MMC_ERR_NONE; | 462 | cmd->error = MMC_ERR_NONE; |
463 | 463 | ||
464 | /* | 464 | /* |
465 | * Wait for the request to complete. | 465 | * Wait for the request to complete. |
466 | */ | 466 | */ |
@@ -477,7 +477,7 @@ static void wbsd_send_command(struct wbsd_host* host, struct mmc_command* cmd) | |||
477 | * Read back status. | 477 | * Read back status. |
478 | */ | 478 | */ |
479 | isr = host->isr; | 479 | isr = host->isr; |
480 | 480 | ||
481 | /* Card removed? */ | 481 | /* Card removed? */ |
482 | if (isr & WBSD_INT_CARD) | 482 | if (isr & WBSD_INT_CARD) |
483 | cmd->error = MMC_ERR_TIMEOUT; | 483 | cmd->error = MMC_ERR_TIMEOUT; |
@@ -509,13 +509,13 @@ static void wbsd_empty_fifo(struct wbsd_host* host) | |||
509 | struct mmc_data* data = host->mrq->cmd->data; | 509 | struct mmc_data* data = host->mrq->cmd->data; |
510 | char* buffer; | 510 | char* buffer; |
511 | int i, fsr, fifo; | 511 | int i, fsr, fifo; |
512 | 512 | ||
513 | /* | 513 | /* |
514 | * Handle excessive data. | 514 | * Handle excessive data. |
515 | */ | 515 | */ |
516 | if (data->bytes_xfered == host->size) | 516 | if (data->bytes_xfered == host->size) |
517 | return; | 517 | return; |
518 | 518 | ||
519 | buffer = wbsd_kmap_sg(host) + host->offset; | 519 | buffer = wbsd_kmap_sg(host) + host->offset; |
520 | 520 | ||
521 | /* | 521 | /* |
@@ -527,14 +527,14 @@ static void wbsd_empty_fifo(struct wbsd_host* host) | |||
527 | /* | 527 | /* |
528 | * The size field in the FSR is broken so we have to | 528 | * The size field in the FSR is broken so we have to |
529 | * do some guessing. | 529 | * do some guessing. |
530 | */ | 530 | */ |
531 | if (fsr & WBSD_FIFO_FULL) | 531 | if (fsr & WBSD_FIFO_FULL) |
532 | fifo = 16; | 532 | fifo = 16; |
533 | else if (fsr & WBSD_FIFO_FUTHRE) | 533 | else if (fsr & WBSD_FIFO_FUTHRE) |
534 | fifo = 8; | 534 | fifo = 8; |
535 | else | 535 | else |
536 | fifo = 1; | 536 | fifo = 1; |
537 | 537 | ||
538 | for (i = 0;i < fifo;i++) | 538 | for (i = 0;i < fifo;i++) |
539 | { | 539 | { |
540 | *buffer = inb(host->base + WBSD_DFR); | 540 | *buffer = inb(host->base + WBSD_DFR); |
@@ -543,23 +543,23 @@ static void wbsd_empty_fifo(struct wbsd_host* host) | |||
543 | host->remain--; | 543 | host->remain--; |
544 | 544 | ||
545 | data->bytes_xfered++; | 545 | data->bytes_xfered++; |
546 | 546 | ||
547 | /* | 547 | /* |
548 | * Transfer done? | 548 | * Transfer done? |
549 | */ | 549 | */ |
550 | if (data->bytes_xfered == host->size) | 550 | if (data->bytes_xfered == host->size) |
551 | { | 551 | { |
552 | wbsd_kunmap_sg(host); | 552 | wbsd_kunmap_sg(host); |
553 | return; | 553 | return; |
554 | } | 554 | } |
555 | 555 | ||
556 | /* | 556 | /* |
557 | * End of scatter list entry? | 557 | * End of scatter list entry? |
558 | */ | 558 | */ |
559 | if (host->remain == 0) | 559 | if (host->remain == 0) |
560 | { | 560 | { |
561 | wbsd_kunmap_sg(host); | 561 | wbsd_kunmap_sg(host); |
562 | 562 | ||
563 | /* | 563 | /* |
564 | * Get next entry. Check if last. | 564 | * Get next entry. Check if last. |
565 | */ | 565 | */ |
@@ -572,17 +572,17 @@ static void wbsd_empty_fifo(struct wbsd_host* host) | |||
572 | * into the scatter list. | 572 | * into the scatter list. |
573 | */ | 573 | */ |
574 | BUG_ON(1); | 574 | BUG_ON(1); |
575 | 575 | ||
576 | host->size = data->bytes_xfered; | 576 | host->size = data->bytes_xfered; |
577 | 577 | ||
578 | return; | 578 | return; |
579 | } | 579 | } |
580 | 580 | ||
581 | buffer = wbsd_kmap_sg(host); | 581 | buffer = wbsd_kmap_sg(host); |
582 | } | 582 | } |
583 | } | 583 | } |
584 | } | 584 | } |
585 | 585 | ||
586 | wbsd_kunmap_sg(host); | 586 | wbsd_kunmap_sg(host); |
587 | 587 | ||
588 | /* | 588 | /* |
@@ -599,7 +599,7 @@ static void wbsd_fill_fifo(struct wbsd_host* host) | |||
599 | struct mmc_data* data = host->mrq->cmd->data; | 599 | struct mmc_data* data = host->mrq->cmd->data; |
600 | char* buffer; | 600 | char* buffer; |
601 | int i, fsr, fifo; | 601 | int i, fsr, fifo; |
602 | 602 | ||
603 | /* | 603 | /* |
604 | * Check that we aren't being called after the | 604 | * Check that we aren't being called after the |
605 | * entire buffer has been transfered. | 605 | * entire buffer has been transfered. |
@@ -618,7 +618,7 @@ static void wbsd_fill_fifo(struct wbsd_host* host) | |||
618 | /* | 618 | /* |
619 | * The size field in the FSR is broken so we have to | 619 | * The size field in the FSR is broken so we have to |
620 | * do some guessing. | 620 | * do some guessing. |
621 | */ | 621 | */ |
622 | if (fsr & WBSD_FIFO_EMPTY) | 622 | if (fsr & WBSD_FIFO_EMPTY) |
623 | fifo = 0; | 623 | fifo = 0; |
624 | else if (fsr & WBSD_FIFO_EMTHRE) | 624 | else if (fsr & WBSD_FIFO_EMTHRE) |
@@ -632,9 +632,9 @@ static void wbsd_fill_fifo(struct wbsd_host* host) | |||
632 | buffer++; | 632 | buffer++; |
633 | host->offset++; | 633 | host->offset++; |
634 | host->remain--; | 634 | host->remain--; |
635 | 635 | ||
636 | data->bytes_xfered++; | 636 | data->bytes_xfered++; |
637 | 637 | ||
638 | /* | 638 | /* |
639 | * Transfer done? | 639 | * Transfer done? |
640 | */ | 640 | */ |
@@ -650,7 +650,7 @@ static void wbsd_fill_fifo(struct wbsd_host* host) | |||
650 | if (host->remain == 0) | 650 | if (host->remain == 0) |
651 | { | 651 | { |
652 | wbsd_kunmap_sg(host); | 652 | wbsd_kunmap_sg(host); |
653 | 653 | ||
654 | /* | 654 | /* |
655 | * Get next entry. Check if last. | 655 | * Get next entry. Check if last. |
656 | */ | 656 | */ |
@@ -663,19 +663,19 @@ static void wbsd_fill_fifo(struct wbsd_host* host) | |||
663 | * into the scatter list. | 663 | * into the scatter list. |
664 | */ | 664 | */ |
665 | BUG_ON(1); | 665 | BUG_ON(1); |
666 | 666 | ||
667 | host->size = data->bytes_xfered; | 667 | host->size = data->bytes_xfered; |
668 | 668 | ||
669 | return; | 669 | return; |
670 | } | 670 | } |
671 | 671 | ||
672 | buffer = wbsd_kmap_sg(host); | 672 | buffer = wbsd_kmap_sg(host); |
673 | } | 673 | } |
674 | } | 674 | } |
675 | } | 675 | } |
676 | 676 | ||
677 | wbsd_kunmap_sg(host); | 677 | wbsd_kunmap_sg(host); |
678 | 678 | ||
679 | /* | 679 | /* |
680 | * The controller stops sending interrupts for | 680 | * The controller stops sending interrupts for |
681 | * 'FIFO empty' under certain conditions. So we | 681 | * 'FIFO empty' under certain conditions. So we |
@@ -694,7 +694,7 @@ static void wbsd_prepare_data(struct wbsd_host* host, struct mmc_data* data) | |||
694 | 1 << data->blksz_bits, data->blocks, data->flags); | 694 | 1 << data->blksz_bits, data->blocks, data->flags); |
695 | DBGF("tsac %d ms nsac %d clk\n", | 695 | DBGF("tsac %d ms nsac %d clk\n", |
696 | data->timeout_ns / 1000000, data->timeout_clks); | 696 | data->timeout_ns / 1000000, data->timeout_clks); |
697 | 697 | ||
698 | /* | 698 | /* |
699 | * Calculate size. | 699 | * Calculate size. |
700 | */ | 700 | */ |
@@ -708,12 +708,12 @@ static void wbsd_prepare_data(struct wbsd_host* host, struct mmc_data* data) | |||
708 | wbsd_write_index(host, WBSD_IDX_TAAC, 127); | 708 | wbsd_write_index(host, WBSD_IDX_TAAC, 127); |
709 | else | 709 | else |
710 | wbsd_write_index(host, WBSD_IDX_TAAC, data->timeout_ns/1000000); | 710 | wbsd_write_index(host, WBSD_IDX_TAAC, data->timeout_ns/1000000); |
711 | 711 | ||
712 | if (data->timeout_clks > 255) | 712 | if (data->timeout_clks > 255) |
713 | wbsd_write_index(host, WBSD_IDX_NSAC, 255); | 713 | wbsd_write_index(host, WBSD_IDX_NSAC, 255); |
714 | else | 714 | else |
715 | wbsd_write_index(host, WBSD_IDX_NSAC, data->timeout_clks); | 715 | wbsd_write_index(host, WBSD_IDX_NSAC, data->timeout_clks); |
716 | 716 | ||
717 | /* | 717 | /* |
718 | * Inform the chip of how large blocks will be | 718 | * Inform the chip of how large blocks will be |
719 | * sent. It needs this to determine when to | 719 | * sent. It needs this to determine when to |
@@ -732,7 +732,7 @@ static void wbsd_prepare_data(struct wbsd_host* host, struct mmc_data* data) | |||
732 | else if (host->bus_width == MMC_BUS_WIDTH_4) | 732 | else if (host->bus_width == MMC_BUS_WIDTH_4) |
733 | { | 733 | { |
734 | blksize = (1 << data->blksz_bits) + 2 * 4; | 734 | blksize = (1 << data->blksz_bits) + 2 * 4; |
735 | 735 | ||
736 | wbsd_write_index(host, WBSD_IDX_PBSMSB, ((blksize >> 4) & 0xF0) | 736 | wbsd_write_index(host, WBSD_IDX_PBSMSB, ((blksize >> 4) & 0xF0) |
737 | | WBSD_DATA_WIDTH); | 737 | | WBSD_DATA_WIDTH); |
738 | wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); | 738 | wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF); |
@@ -751,12 +751,12 @@ static void wbsd_prepare_data(struct wbsd_host* host, struct mmc_data* data) | |||
751 | setup = wbsd_read_index(host, WBSD_IDX_SETUP); | 751 | setup = wbsd_read_index(host, WBSD_IDX_SETUP); |
752 | setup |= WBSD_FIFO_RESET; | 752 | setup |= WBSD_FIFO_RESET; |
753 | wbsd_write_index(host, WBSD_IDX_SETUP, setup); | 753 | wbsd_write_index(host, WBSD_IDX_SETUP, setup); |
754 | 754 | ||
755 | /* | 755 | /* |
756 | * DMA transfer? | 756 | * DMA transfer? |
757 | */ | 757 | */ |
758 | if (host->dma >= 0) | 758 | if (host->dma >= 0) |
759 | { | 759 | { |
760 | /* | 760 | /* |
761 | * The buffer for DMA is only 64 kB. | 761 | * The buffer for DMA is only 64 kB. |
762 | */ | 762 | */ |
@@ -766,17 +766,17 @@ static void wbsd_prepare_data(struct wbsd_host* host, struct mmc_data* data) | |||
766 | data->error = MMC_ERR_INVALID; | 766 | data->error = MMC_ERR_INVALID; |
767 | return; | 767 | return; |
768 | } | 768 | } |
769 | 769 | ||
770 | /* | 770 | /* |
771 | * Transfer data from the SG list to | 771 | * Transfer data from the SG list to |
772 | * the DMA buffer. | 772 | * the DMA buffer. |
773 | */ | 773 | */ |
774 | if (data->flags & MMC_DATA_WRITE) | 774 | if (data->flags & MMC_DATA_WRITE) |
775 | wbsd_sg_to_dma(host, data); | 775 | wbsd_sg_to_dma(host, data); |
776 | 776 | ||
777 | /* | 777 | /* |
778 | * Initialise the ISA DMA controller. | 778 | * Initialise the ISA DMA controller. |
779 | */ | 779 | */ |
780 | dmaflags = claim_dma_lock(); | 780 | dmaflags = claim_dma_lock(); |
781 | disable_dma(host->dma); | 781 | disable_dma(host->dma); |
782 | clear_dma_ff(host->dma); | 782 | clear_dma_ff(host->dma); |
@@ -802,17 +802,17 @@ static void wbsd_prepare_data(struct wbsd_host* host, struct mmc_data* data) | |||
802 | * output to a minimum. | 802 | * output to a minimum. |
803 | */ | 803 | */ |
804 | host->firsterr = 1; | 804 | host->firsterr = 1; |
805 | 805 | ||
806 | /* | 806 | /* |
807 | * Initialise the SG list. | 807 | * Initialise the SG list. |
808 | */ | 808 | */ |
809 | wbsd_init_sg(host, data); | 809 | wbsd_init_sg(host, data); |
810 | 810 | ||
811 | /* | 811 | /* |
812 | * Turn off DMA. | 812 | * Turn off DMA. |
813 | */ | 813 | */ |
814 | wbsd_write_index(host, WBSD_IDX_DMA, 0); | 814 | wbsd_write_index(host, WBSD_IDX_DMA, 0); |
815 | 815 | ||
816 | /* | 816 | /* |
817 | * Set up FIFO threshold levels (and fill | 817 | * Set up FIFO threshold levels (and fill |
818 | * buffer if doing a write). | 818 | * buffer if doing a write). |
@@ -828,8 +828,8 @@ static void wbsd_prepare_data(struct wbsd_host* host, struct mmc_data* data) | |||
828 | WBSD_FIFOEN_EMPTY | 8); | 828 | WBSD_FIFOEN_EMPTY | 8); |
829 | wbsd_fill_fifo(host); | 829 | wbsd_fill_fifo(host); |
830 | } | 830 | } |
831 | } | 831 | } |
832 | 832 | ||
833 | data->error = MMC_ERR_NONE; | 833 | data->error = MMC_ERR_NONE; |
834 | } | 834 | } |
835 | 835 | ||
@@ -838,7 +838,7 @@ static void wbsd_finish_data(struct wbsd_host* host, struct mmc_data* data) | |||
838 | unsigned long dmaflags; | 838 | unsigned long dmaflags; |
839 | int count; | 839 | int count; |
840 | u8 status; | 840 | u8 status; |
841 | 841 | ||
842 | WARN_ON(host->mrq == NULL); | 842 | WARN_ON(host->mrq == NULL); |
843 | 843 | ||
844 | /* | 844 | /* |
@@ -855,7 +855,7 @@ static void wbsd_finish_data(struct wbsd_host* host, struct mmc_data* data) | |||
855 | { | 855 | { |
856 | status = wbsd_read_index(host, WBSD_IDX_STATUS); | 856 | status = wbsd_read_index(host, WBSD_IDX_STATUS); |
857 | } while (status & (WBSD_BLOCK_READ | WBSD_BLOCK_WRITE)); | 857 | } while (status & (WBSD_BLOCK_READ | WBSD_BLOCK_WRITE)); |
858 | 858 | ||
859 | /* | 859 | /* |
860 | * DMA transfer? | 860 | * DMA transfer? |
861 | */ | 861 | */ |
@@ -865,7 +865,7 @@ static void wbsd_finish_data(struct wbsd_host* host, struct mmc_data* data) | |||
865 | * Disable DMA on the host. | 865 | * Disable DMA on the host. |
866 | */ | 866 | */ |
867 | wbsd_write_index(host, WBSD_IDX_DMA, 0); | 867 | wbsd_write_index(host, WBSD_IDX_DMA, 0); |
868 | 868 | ||
869 | /* | 869 | /* |
870 | * Turn of ISA DMA controller. | 870 | * Turn of ISA DMA controller. |
871 | */ | 871 | */ |
@@ -874,7 +874,7 @@ static void wbsd_finish_data(struct wbsd_host* host, struct mmc_data* data) | |||
874 | clear_dma_ff(host->dma); | 874 | clear_dma_ff(host->dma); |
875 | count = get_dma_residue(host->dma); | 875 | count = get_dma_residue(host->dma); |
876 | release_dma_lock(dmaflags); | 876 | release_dma_lock(dmaflags); |
877 | 877 | ||
878 | /* | 878 | /* |
879 | * Any leftover data? | 879 | * Any leftover data? |
880 | */ | 880 | */ |
@@ -882,7 +882,7 @@ static void wbsd_finish_data(struct wbsd_host* host, struct mmc_data* data) | |||
882 | { | 882 | { |
883 | printk(KERN_ERR DRIVER_NAME ": Incomplete DMA " | 883 | printk(KERN_ERR DRIVER_NAME ": Incomplete DMA " |
884 | "transfer. %d bytes left.\n", count); | 884 | "transfer. %d bytes left.\n", count); |
885 | 885 | ||
886 | data->error = MMC_ERR_FAILED; | 886 | data->error = MMC_ERR_FAILED; |
887 | } | 887 | } |
888 | else | 888 | else |
@@ -893,13 +893,13 @@ static void wbsd_finish_data(struct wbsd_host* host, struct mmc_data* data) | |||
893 | */ | 893 | */ |
894 | if (data->flags & MMC_DATA_READ) | 894 | if (data->flags & MMC_DATA_READ) |
895 | wbsd_dma_to_sg(host, data); | 895 | wbsd_dma_to_sg(host, data); |
896 | 896 | ||
897 | data->bytes_xfered = host->size; | 897 | data->bytes_xfered = host->size; |
898 | } | 898 | } |
899 | } | 899 | } |
900 | 900 | ||
901 | DBGF("Ending data transfer (%d bytes)\n", data->bytes_xfered); | 901 | DBGF("Ending data transfer (%d bytes)\n", data->bytes_xfered); |
902 | 902 | ||
903 | wbsd_request_end(host, host->mrq); | 903 | wbsd_request_end(host, host->mrq); |
904 | } | 904 | } |
905 | 905 | ||
@@ -924,7 +924,7 @@ static void wbsd_request(struct mmc_host* mmc, struct mmc_request* mrq) | |||
924 | cmd = mrq->cmd; | 924 | cmd = mrq->cmd; |
925 | 925 | ||
926 | host->mrq = mrq; | 926 | host->mrq = mrq; |
927 | 927 | ||
928 | /* | 928 | /* |
929 | * If there is no card in the slot then | 929 | * If there is no card in the slot then |
930 | * timeout immediatly. | 930 | * timeout immediatly. |
@@ -941,18 +941,18 @@ static void wbsd_request(struct mmc_host* mmc, struct mmc_request* mrq) | |||
941 | if (cmd->data) | 941 | if (cmd->data) |
942 | { | 942 | { |
943 | wbsd_prepare_data(host, cmd->data); | 943 | wbsd_prepare_data(host, cmd->data); |
944 | 944 | ||
945 | if (cmd->data->error != MMC_ERR_NONE) | 945 | if (cmd->data->error != MMC_ERR_NONE) |
946 | goto done; | 946 | goto done; |
947 | } | 947 | } |
948 | 948 | ||
949 | wbsd_send_command(host, cmd); | 949 | wbsd_send_command(host, cmd); |
950 | 950 | ||
951 | /* | 951 | /* |
952 | * If this is a data transfer the request | 952 | * If this is a data transfer the request |
953 | * will be finished after the data has | 953 | * will be finished after the data has |
954 | * transfered. | 954 | * transfered. |
955 | */ | 955 | */ |
956 | if (cmd->data && (cmd->error == MMC_ERR_NONE)) | 956 | if (cmd->data && (cmd->error == MMC_ERR_NONE)) |
957 | { | 957 | { |
958 | /* | 958 | /* |
@@ -965,7 +965,7 @@ static void wbsd_request(struct mmc_host* mmc, struct mmc_request* mrq) | |||
965 | 965 | ||
966 | return; | 966 | return; |
967 | } | 967 | } |
968 | 968 | ||
969 | done: | 969 | done: |
970 | wbsd_request_end(host, mrq); | 970 | wbsd_request_end(host, mrq); |
971 | 971 | ||
@@ -976,7 +976,7 @@ static void wbsd_set_ios(struct mmc_host* mmc, struct mmc_ios* ios) | |||
976 | { | 976 | { |
977 | struct wbsd_host* host = mmc_priv(mmc); | 977 | struct wbsd_host* host = mmc_priv(mmc); |
978 | u8 clk, setup, pwr; | 978 | u8 clk, setup, pwr; |
979 | 979 | ||
980 | DBGF("clock %uHz busmode %u powermode %u cs %u Vdd %u width %u\n", | 980 | DBGF("clock %uHz busmode %u powermode %u cs %u Vdd %u width %u\n", |
981 | ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select, | 981 | ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select, |
982 | ios->vdd, ios->bus_width); | 982 | ios->vdd, ios->bus_width); |
@@ -989,7 +989,7 @@ static void wbsd_set_ios(struct mmc_host* mmc, struct mmc_ios* ios) | |||
989 | */ | 989 | */ |
990 | if (ios->power_mode == MMC_POWER_OFF) | 990 | if (ios->power_mode == MMC_POWER_OFF) |
991 | wbsd_init_device(host); | 991 | wbsd_init_device(host); |
992 | 992 | ||
993 | if (ios->clock >= 24000000) | 993 | if (ios->clock >= 24000000) |
994 | clk = WBSD_CLK_24M; | 994 | clk = WBSD_CLK_24M; |
995 | else if (ios->clock >= 16000000) | 995 | else if (ios->clock >= 16000000) |
@@ -1042,7 +1042,7 @@ static void wbsd_set_ios(struct mmc_host* mmc, struct mmc_ios* ios) | |||
1042 | mod_timer(&host->ignore_timer, jiffies + HZ/100); | 1042 | mod_timer(&host->ignore_timer, jiffies + HZ/100); |
1043 | } | 1043 | } |
1044 | wbsd_write_index(host, WBSD_IDX_SETUP, setup); | 1044 | wbsd_write_index(host, WBSD_IDX_SETUP, setup); |
1045 | 1045 | ||
1046 | /* | 1046 | /* |
1047 | * Store bus width for later. Will be used when | 1047 | * Store bus width for later. Will be used when |
1048 | * setting up the data transfer. | 1048 | * setting up the data transfer. |
@@ -1128,7 +1128,7 @@ static inline struct mmc_data* wbsd_get_data(struct wbsd_host* host) | |||
1128 | WARN_ON(!host->mrq->cmd->data); | 1128 | WARN_ON(!host->mrq->cmd->data); |
1129 | if (!host->mrq->cmd->data) | 1129 | if (!host->mrq->cmd->data) |
1130 | return NULL; | 1130 | return NULL; |
1131 | 1131 | ||
1132 | return host->mrq->cmd->data; | 1132 | return host->mrq->cmd->data; |
1133 | } | 1133 | } |
1134 | 1134 | ||
@@ -1136,72 +1136,67 @@ static void wbsd_tasklet_card(unsigned long param) | |||
1136 | { | 1136 | { |
1137 | struct wbsd_host* host = (struct wbsd_host*)param; | 1137 | struct wbsd_host* host = (struct wbsd_host*)param; |
1138 | u8 csr; | 1138 | u8 csr; |
1139 | 1139 | int delay = -1; | |
1140 | |||
1140 | spin_lock(&host->lock); | 1141 | spin_lock(&host->lock); |
1141 | 1142 | ||
1142 | if (host->flags & WBSD_FIGNORE_DETECT) | 1143 | if (host->flags & WBSD_FIGNORE_DETECT) |
1143 | { | 1144 | { |
1144 | spin_unlock(&host->lock); | 1145 | spin_unlock(&host->lock); |
1145 | return; | 1146 | return; |
1146 | } | 1147 | } |
1147 | 1148 | ||
1148 | csr = inb(host->base + WBSD_CSR); | 1149 | csr = inb(host->base + WBSD_CSR); |
1149 | WARN_ON(csr == 0xff); | 1150 | WARN_ON(csr == 0xff); |
1150 | 1151 | ||
1151 | if (csr & WBSD_CARDPRESENT) | 1152 | if (csr & WBSD_CARDPRESENT) |
1152 | { | 1153 | { |
1153 | if (!(host->flags & WBSD_FCARD_PRESENT)) | 1154 | if (!(host->flags & WBSD_FCARD_PRESENT)) |
1154 | { | 1155 | { |
1155 | DBG("Card inserted\n"); | 1156 | DBG("Card inserted\n"); |
1156 | host->flags |= WBSD_FCARD_PRESENT; | 1157 | host->flags |= WBSD_FCARD_PRESENT; |
1157 | |||
1158 | spin_unlock(&host->lock); | ||
1159 | 1158 | ||
1160 | /* | 1159 | delay = 500; |
1161 | * Delay card detection to allow electrical connections | ||
1162 | * to stabilise. | ||
1163 | */ | ||
1164 | mmc_detect_change(host->mmc, msecs_to_jiffies(500)); | ||
1165 | } | 1160 | } |
1166 | else | ||
1167 | spin_unlock(&host->lock); | ||
1168 | } | 1161 | } |
1169 | else if (host->flags & WBSD_FCARD_PRESENT) | 1162 | else if (host->flags & WBSD_FCARD_PRESENT) |
1170 | { | 1163 | { |
1171 | DBG("Card removed\n"); | 1164 | DBG("Card removed\n"); |
1172 | host->flags &= ~WBSD_FCARD_PRESENT; | 1165 | host->flags &= ~WBSD_FCARD_PRESENT; |
1173 | 1166 | ||
1174 | if (host->mrq) | 1167 | if (host->mrq) |
1175 | { | 1168 | { |
1176 | printk(KERN_ERR DRIVER_NAME | 1169 | printk(KERN_ERR DRIVER_NAME |
1177 | ": Card removed during transfer!\n"); | 1170 | ": Card removed during transfer!\n"); |
1178 | wbsd_reset(host); | 1171 | wbsd_reset(host); |
1179 | 1172 | ||
1180 | host->mrq->cmd->error = MMC_ERR_FAILED; | 1173 | host->mrq->cmd->error = MMC_ERR_FAILED; |
1181 | tasklet_schedule(&host->finish_tasklet); | 1174 | tasklet_schedule(&host->finish_tasklet); |
1182 | } | 1175 | } |
1183 | |||
1184 | /* | ||
1185 | * Unlock first since we might get a call back. | ||
1186 | */ | ||
1187 | spin_unlock(&host->lock); | ||
1188 | 1176 | ||
1189 | mmc_detect_change(host->mmc, 0); | 1177 | delay = 0; |
1190 | } | 1178 | } |
1191 | else | 1179 | |
1192 | spin_unlock(&host->lock); | 1180 | /* |
1181 | * Unlock first since we might get a call back. | ||
1182 | */ | ||
1183 | |||
1184 | spin_unlock(&host->lock); | ||
1185 | |||
1186 | if (delay != -1) | ||
1187 | mmc_detect_change(host->mmc, msecs_to_jiffies(delay)); | ||
1193 | } | 1188 | } |
1194 | 1189 | ||
1195 | static void wbsd_tasklet_fifo(unsigned long param) | 1190 | static void wbsd_tasklet_fifo(unsigned long param) |
1196 | { | 1191 | { |
1197 | struct wbsd_host* host = (struct wbsd_host*)param; | 1192 | struct wbsd_host* host = (struct wbsd_host*)param; |
1198 | struct mmc_data* data; | 1193 | struct mmc_data* data; |
1199 | 1194 | ||
1200 | spin_lock(&host->lock); | 1195 | spin_lock(&host->lock); |
1201 | 1196 | ||
1202 | if (!host->mrq) | 1197 | if (!host->mrq) |
1203 | goto end; | 1198 | goto end; |
1204 | 1199 | ||
1205 | data = wbsd_get_data(host); | 1200 | data = wbsd_get_data(host); |
1206 | if (!data) | 1201 | if (!data) |
1207 | goto end; | 1202 | goto end; |
@@ -1220,7 +1215,7 @@ static void wbsd_tasklet_fifo(unsigned long param) | |||
1220 | tasklet_schedule(&host->finish_tasklet); | 1215 | tasklet_schedule(&host->finish_tasklet); |
1221 | } | 1216 | } |
1222 | 1217 | ||
1223 | end: | 1218 | end: |
1224 | spin_unlock(&host->lock); | 1219 | spin_unlock(&host->lock); |
1225 | } | 1220 | } |
1226 | 1221 | ||
@@ -1228,23 +1223,23 @@ static void wbsd_tasklet_crc(unsigned long param) | |||
1228 | { | 1223 | { |
1229 | struct wbsd_host* host = (struct wbsd_host*)param; | 1224 | struct wbsd_host* host = (struct wbsd_host*)param; |
1230 | struct mmc_data* data; | 1225 | struct mmc_data* data; |
1231 | 1226 | ||
1232 | spin_lock(&host->lock); | 1227 | spin_lock(&host->lock); |
1233 | 1228 | ||
1234 | if (!host->mrq) | 1229 | if (!host->mrq) |
1235 | goto end; | 1230 | goto end; |
1236 | 1231 | ||
1237 | data = wbsd_get_data(host); | 1232 | data = wbsd_get_data(host); |
1238 | if (!data) | 1233 | if (!data) |
1239 | goto end; | 1234 | goto end; |
1240 | 1235 | ||
1241 | DBGF("CRC error\n"); | 1236 | DBGF("CRC error\n"); |
1242 | 1237 | ||
1243 | data->error = MMC_ERR_BADCRC; | 1238 | data->error = MMC_ERR_BADCRC; |
1244 | 1239 | ||
1245 | tasklet_schedule(&host->finish_tasklet); | 1240 | tasklet_schedule(&host->finish_tasklet); |
1246 | 1241 | ||
1247 | end: | 1242 | end: |
1248 | spin_unlock(&host->lock); | 1243 | spin_unlock(&host->lock); |
1249 | } | 1244 | } |
1250 | 1245 | ||
@@ -1252,23 +1247,23 @@ static void wbsd_tasklet_timeout(unsigned long param) | |||
1252 | { | 1247 | { |
1253 | struct wbsd_host* host = (struct wbsd_host*)param; | 1248 | struct wbsd_host* host = (struct wbsd_host*)param; |
1254 | struct mmc_data* data; | 1249 | struct mmc_data* data; |
1255 | 1250 | ||
1256 | spin_lock(&host->lock); | 1251 | spin_lock(&host->lock); |
1257 | 1252 | ||
1258 | if (!host->mrq) | 1253 | if (!host->mrq) |
1259 | goto end; | 1254 | goto end; |
1260 | 1255 | ||
1261 | data = wbsd_get_data(host); | 1256 | data = wbsd_get_data(host); |
1262 | if (!data) | 1257 | if (!data) |
1263 | goto end; | 1258 | goto end; |
1264 | 1259 | ||
1265 | DBGF("Timeout\n"); | 1260 | DBGF("Timeout\n"); |
1266 | 1261 | ||
1267 | data->error = MMC_ERR_TIMEOUT; | 1262 | data->error = MMC_ERR_TIMEOUT; |
1268 | 1263 | ||
1269 | tasklet_schedule(&host->finish_tasklet); | 1264 | tasklet_schedule(&host->finish_tasklet); |
1270 | 1265 | ||
1271 | end: | 1266 | end: |
1272 | spin_unlock(&host->lock); | 1267 | spin_unlock(&host->lock); |
1273 | } | 1268 | } |
1274 | 1269 | ||
@@ -1276,20 +1271,20 @@ static void wbsd_tasklet_finish(unsigned long param) | |||
1276 | { | 1271 | { |
1277 | struct wbsd_host* host = (struct wbsd_host*)param; | 1272 | struct wbsd_host* host = (struct wbsd_host*)param; |
1278 | struct mmc_data* data; | 1273 | struct mmc_data* data; |
1279 | 1274 | ||
1280 | spin_lock(&host->lock); | 1275 | spin_lock(&host->lock); |
1281 | 1276 | ||
1282 | WARN_ON(!host->mrq); | 1277 | WARN_ON(!host->mrq); |
1283 | if (!host->mrq) | 1278 | if (!host->mrq) |
1284 | goto end; | 1279 | goto end; |
1285 | 1280 | ||
1286 | data = wbsd_get_data(host); | 1281 | data = wbsd_get_data(host); |
1287 | if (!data) | 1282 | if (!data) |
1288 | goto end; | 1283 | goto end; |
1289 | 1284 | ||
1290 | wbsd_finish_data(host, data); | 1285 | wbsd_finish_data(host, data); |
1291 | 1286 | ||
1292 | end: | 1287 | end: |
1293 | spin_unlock(&host->lock); | 1288 | spin_unlock(&host->lock); |
1294 | } | 1289 | } |
1295 | 1290 | ||
@@ -1297,7 +1292,7 @@ static void wbsd_tasklet_block(unsigned long param) | |||
1297 | { | 1292 | { |
1298 | struct wbsd_host* host = (struct wbsd_host*)param; | 1293 | struct wbsd_host* host = (struct wbsd_host*)param; |
1299 | struct mmc_data* data; | 1294 | struct mmc_data* data; |
1300 | 1295 | ||
1301 | spin_lock(&host->lock); | 1296 | spin_lock(&host->lock); |
1302 | 1297 | ||
1303 | if ((wbsd_read_index(host, WBSD_IDX_CRCSTATUS) & WBSD_CRC_MASK) != | 1298 | if ((wbsd_read_index(host, WBSD_IDX_CRCSTATUS) & WBSD_CRC_MASK) != |
@@ -1306,15 +1301,15 @@ static void wbsd_tasklet_block(unsigned long param) | |||
1306 | data = wbsd_get_data(host); | 1301 | data = wbsd_get_data(host); |
1307 | if (!data) | 1302 | if (!data) |
1308 | goto end; | 1303 | goto end; |
1309 | 1304 | ||
1310 | DBGF("CRC error\n"); | 1305 | DBGF("CRC error\n"); |
1311 | 1306 | ||
1312 | data->error = MMC_ERR_BADCRC; | 1307 | data->error = MMC_ERR_BADCRC; |
1313 | 1308 | ||
1314 | tasklet_schedule(&host->finish_tasklet); | 1309 | tasklet_schedule(&host->finish_tasklet); |
1315 | } | 1310 | } |
1316 | 1311 | ||
1317 | end: | 1312 | end: |
1318 | spin_unlock(&host->lock); | 1313 | spin_unlock(&host->lock); |
1319 | } | 1314 | } |
1320 | 1315 | ||
@@ -1326,7 +1321,7 @@ static irqreturn_t wbsd_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
1326 | { | 1321 | { |
1327 | struct wbsd_host* host = dev_id; | 1322 | struct wbsd_host* host = dev_id; |
1328 | int isr; | 1323 | int isr; |
1329 | 1324 | ||
1330 | isr = inb(host->base + WBSD_ISR); | 1325 | isr = inb(host->base + WBSD_ISR); |
1331 | 1326 | ||
1332 | /* | 1327 | /* |
@@ -1334,7 +1329,7 @@ static irqreturn_t wbsd_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
1334 | */ | 1329 | */ |
1335 | if (isr == 0xff || isr == 0x00) | 1330 | if (isr == 0xff || isr == 0x00) |
1336 | return IRQ_NONE; | 1331 | return IRQ_NONE; |
1337 | 1332 | ||
1338 | host->isr |= isr; | 1333 | host->isr |= isr; |
1339 | 1334 | ||
1340 | /* | 1335 | /* |
@@ -1352,7 +1347,7 @@ static irqreturn_t wbsd_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
1352 | tasklet_hi_schedule(&host->block_tasklet); | 1347 | tasklet_hi_schedule(&host->block_tasklet); |
1353 | if (isr & WBSD_INT_TC) | 1348 | if (isr & WBSD_INT_TC) |
1354 | tasklet_schedule(&host->finish_tasklet); | 1349 | tasklet_schedule(&host->finish_tasklet); |
1355 | 1350 | ||
1356 | return IRQ_HANDLED; | 1351 | return IRQ_HANDLED; |
1357 | } | 1352 | } |
1358 | 1353 | ||
@@ -1370,14 +1365,14 @@ static int __devinit wbsd_alloc_mmc(struct device* dev) | |||
1370 | { | 1365 | { |
1371 | struct mmc_host* mmc; | 1366 | struct mmc_host* mmc; |
1372 | struct wbsd_host* host; | 1367 | struct wbsd_host* host; |
1373 | 1368 | ||
1374 | /* | 1369 | /* |
1375 | * Allocate MMC structure. | 1370 | * Allocate MMC structure. |
1376 | */ | 1371 | */ |
1377 | mmc = mmc_alloc_host(sizeof(struct wbsd_host), dev); | 1372 | mmc = mmc_alloc_host(sizeof(struct wbsd_host), dev); |
1378 | if (!mmc) | 1373 | if (!mmc) |
1379 | return -ENOMEM; | 1374 | return -ENOMEM; |
1380 | 1375 | ||
1381 | host = mmc_priv(mmc); | 1376 | host = mmc_priv(mmc); |
1382 | host->mmc = mmc; | 1377 | host->mmc = mmc; |
1383 | 1378 | ||
@@ -1391,37 +1386,37 @@ static int __devinit wbsd_alloc_mmc(struct device* dev) | |||
1391 | mmc->f_max = 24000000; | 1386 | mmc->f_max = 24000000; |
1392 | mmc->ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34; | 1387 | mmc->ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34; |
1393 | mmc->caps = MMC_CAP_4_BIT_DATA; | 1388 | mmc->caps = MMC_CAP_4_BIT_DATA; |
1394 | 1389 | ||
1395 | spin_lock_init(&host->lock); | 1390 | spin_lock_init(&host->lock); |
1396 | 1391 | ||
1397 | /* | 1392 | /* |
1398 | * Set up timers | 1393 | * Set up timers |
1399 | */ | 1394 | */ |
1400 | init_timer(&host->ignore_timer); | 1395 | init_timer(&host->ignore_timer); |
1401 | host->ignore_timer.data = (unsigned long)host; | 1396 | host->ignore_timer.data = (unsigned long)host; |
1402 | host->ignore_timer.function = wbsd_reset_ignore; | 1397 | host->ignore_timer.function = wbsd_reset_ignore; |
1403 | 1398 | ||
1404 | /* | 1399 | /* |
1405 | * Maximum number of segments. Worst case is one sector per segment | 1400 | * Maximum number of segments. Worst case is one sector per segment |
1406 | * so this will be 64kB/512. | 1401 | * so this will be 64kB/512. |
1407 | */ | 1402 | */ |
1408 | mmc->max_hw_segs = 128; | 1403 | mmc->max_hw_segs = 128; |
1409 | mmc->max_phys_segs = 128; | 1404 | mmc->max_phys_segs = 128; |
1410 | 1405 | ||
1411 | /* | 1406 | /* |
1412 | * Maximum number of sectors in one transfer. Also limited by 64kB | 1407 | * Maximum number of sectors in one transfer. Also limited by 64kB |
1413 | * buffer. | 1408 | * buffer. |
1414 | */ | 1409 | */ |
1415 | mmc->max_sectors = 128; | 1410 | mmc->max_sectors = 128; |
1416 | 1411 | ||
1417 | /* | 1412 | /* |
1418 | * Maximum segment size. Could be one segment with the maximum number | 1413 | * Maximum segment size. Could be one segment with the maximum number |
1419 | * of segments. | 1414 | * of segments. |
1420 | */ | 1415 | */ |
1421 | mmc->max_seg_size = mmc->max_sectors * 512; | 1416 | mmc->max_seg_size = mmc->max_sectors * 512; |
1422 | 1417 | ||
1423 | dev_set_drvdata(dev, mmc); | 1418 | dev_set_drvdata(dev, mmc); |
1424 | 1419 | ||
1425 | return 0; | 1420 | return 0; |
1426 | } | 1421 | } |
1427 | 1422 | ||
@@ -1429,18 +1424,18 @@ static void __devexit wbsd_free_mmc(struct device* dev) | |||
1429 | { | 1424 | { |
1430 | struct mmc_host* mmc; | 1425 | struct mmc_host* mmc; |
1431 | struct wbsd_host* host; | 1426 | struct wbsd_host* host; |
1432 | 1427 | ||
1433 | mmc = dev_get_drvdata(dev); | 1428 | mmc = dev_get_drvdata(dev); |
1434 | if (!mmc) | 1429 | if (!mmc) |
1435 | return; | 1430 | return; |
1436 | 1431 | ||
1437 | host = mmc_priv(mmc); | 1432 | host = mmc_priv(mmc); |
1438 | BUG_ON(host == NULL); | 1433 | BUG_ON(host == NULL); |
1439 | 1434 | ||
1440 | del_timer_sync(&host->ignore_timer); | 1435 | del_timer_sync(&host->ignore_timer); |
1441 | 1436 | ||
1442 | mmc_free_host(mmc); | 1437 | mmc_free_host(mmc); |
1443 | 1438 | ||
1444 | dev_set_drvdata(dev, NULL); | 1439 | dev_set_drvdata(dev, NULL); |
1445 | } | 1440 | } |
1446 | 1441 | ||
@@ -1452,7 +1447,7 @@ static int __devinit wbsd_scan(struct wbsd_host* host) | |||
1452 | { | 1447 | { |
1453 | int i, j, k; | 1448 | int i, j, k; |
1454 | int id; | 1449 | int id; |
1455 | 1450 | ||
1456 | /* | 1451 | /* |
1457 | * Iterate through all ports, all codes to | 1452 | * Iterate through all ports, all codes to |
1458 | * find hardware that is in our known list. | 1453 | * find hardware that is in our known list. |
@@ -1461,32 +1456,32 @@ static int __devinit wbsd_scan(struct wbsd_host* host) | |||
1461 | { | 1456 | { |
1462 | if (!request_region(config_ports[i], 2, DRIVER_NAME)) | 1457 | if (!request_region(config_ports[i], 2, DRIVER_NAME)) |
1463 | continue; | 1458 | continue; |
1464 | 1459 | ||
1465 | for (j = 0;j < sizeof(unlock_codes)/sizeof(int);j++) | 1460 | for (j = 0;j < sizeof(unlock_codes)/sizeof(int);j++) |
1466 | { | 1461 | { |
1467 | id = 0xFFFF; | 1462 | id = 0xFFFF; |
1468 | 1463 | ||
1469 | outb(unlock_codes[j], config_ports[i]); | 1464 | outb(unlock_codes[j], config_ports[i]); |
1470 | outb(unlock_codes[j], config_ports[i]); | 1465 | outb(unlock_codes[j], config_ports[i]); |
1471 | 1466 | ||
1472 | outb(WBSD_CONF_ID_HI, config_ports[i]); | 1467 | outb(WBSD_CONF_ID_HI, config_ports[i]); |
1473 | id = inb(config_ports[i] + 1) << 8; | 1468 | id = inb(config_ports[i] + 1) << 8; |
1474 | 1469 | ||
1475 | outb(WBSD_CONF_ID_LO, config_ports[i]); | 1470 | outb(WBSD_CONF_ID_LO, config_ports[i]); |
1476 | id |= inb(config_ports[i] + 1); | 1471 | id |= inb(config_ports[i] + 1); |
1477 | 1472 | ||
1478 | for (k = 0;k < sizeof(valid_ids)/sizeof(int);k++) | 1473 | for (k = 0;k < sizeof(valid_ids)/sizeof(int);k++) |
1479 | { | 1474 | { |
1480 | if (id == valid_ids[k]) | 1475 | if (id == valid_ids[k]) |
1481 | { | 1476 | { |
1482 | host->chip_id = id; | 1477 | host->chip_id = id; |
1483 | host->config = config_ports[i]; | 1478 | host->config = config_ports[i]; |
1484 | host->unlock_code = unlock_codes[i]; | 1479 | host->unlock_code = unlock_codes[i]; |
1485 | 1480 | ||
1486 | return 0; | 1481 | return 0; |
1487 | } | 1482 | } |
1488 | } | 1483 | } |
1489 | 1484 | ||
1490 | if (id != 0xFFFF) | 1485 | if (id != 0xFFFF) |
1491 | { | 1486 | { |
1492 | DBG("Unknown hardware (id %x) found at %x\n", | 1487 | DBG("Unknown hardware (id %x) found at %x\n", |
@@ -1495,10 +1490,10 @@ static int __devinit wbsd_scan(struct wbsd_host* host) | |||
1495 | 1490 | ||
1496 | outb(LOCK_CODE, config_ports[i]); | 1491 | outb(LOCK_CODE, config_ports[i]); |
1497 | } | 1492 | } |
1498 | 1493 | ||
1499 | release_region(config_ports[i], 2); | 1494 | release_region(config_ports[i], 2); |
1500 | } | 1495 | } |
1501 | 1496 | ||
1502 | return -ENODEV; | 1497 | return -ENODEV; |
1503 | } | 1498 | } |
1504 | 1499 | ||
@@ -1510,12 +1505,12 @@ static int __devinit wbsd_request_region(struct wbsd_host* host, int base) | |||
1510 | { | 1505 | { |
1511 | if (io & 0x7) | 1506 | if (io & 0x7) |
1512 | return -EINVAL; | 1507 | return -EINVAL; |
1513 | 1508 | ||
1514 | if (!request_region(base, 8, DRIVER_NAME)) | 1509 | if (!request_region(base, 8, DRIVER_NAME)) |
1515 | return -EIO; | 1510 | return -EIO; |
1516 | 1511 | ||
1517 | host->base = io; | 1512 | host->base = io; |
1518 | 1513 | ||
1519 | return 0; | 1514 | return 0; |
1520 | } | 1515 | } |
1521 | 1516 | ||
@@ -1523,12 +1518,12 @@ static void __devexit wbsd_release_regions(struct wbsd_host* host) | |||
1523 | { | 1518 | { |
1524 | if (host->base) | 1519 | if (host->base) |
1525 | release_region(host->base, 8); | 1520 | release_region(host->base, 8); |
1526 | 1521 | ||
1527 | host->base = 0; | 1522 | host->base = 0; |
1528 | 1523 | ||
1529 | if (host->config) | 1524 | if (host->config) |
1530 | release_region(host->config, 2); | 1525 | release_region(host->config, 2); |
1531 | 1526 | ||
1532 | host->config = 0; | 1527 | host->config = 0; |
1533 | } | 1528 | } |
1534 | 1529 | ||
@@ -1540,10 +1535,10 @@ static void __devinit wbsd_request_dma(struct wbsd_host* host, int dma) | |||
1540 | { | 1535 | { |
1541 | if (dma < 0) | 1536 | if (dma < 0) |
1542 | return; | 1537 | return; |
1543 | 1538 | ||
1544 | if (request_dma(dma, DRIVER_NAME)) | 1539 | if (request_dma(dma, DRIVER_NAME)) |
1545 | goto err; | 1540 | goto err; |
1546 | 1541 | ||
1547 | /* | 1542 | /* |
1548 | * We need to allocate a special buffer in | 1543 | * We need to allocate a special buffer in |
1549 | * order for ISA to be able to DMA to it. | 1544 | * order for ISA to be able to DMA to it. |
@@ -1558,7 +1553,7 @@ static void __devinit wbsd_request_dma(struct wbsd_host* host, int dma) | |||
1558 | */ | 1553 | */ |
1559 | host->dma_addr = dma_map_single(host->mmc->dev, host->dma_buffer, | 1554 | host->dma_addr = dma_map_single(host->mmc->dev, host->dma_buffer, |
1560 | WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); | 1555 | WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); |
1561 | 1556 | ||
1562 | /* | 1557 | /* |
1563 | * ISA DMA must be aligned on a 64k basis. | 1558 | * ISA DMA must be aligned on a 64k basis. |
1564 | */ | 1559 | */ |
@@ -1571,19 +1566,19 @@ static void __devinit wbsd_request_dma(struct wbsd_host* host, int dma) | |||
1571 | goto kfree; | 1566 | goto kfree; |
1572 | 1567 | ||
1573 | host->dma = dma; | 1568 | host->dma = dma; |
1574 | 1569 | ||
1575 | return; | 1570 | return; |
1576 | 1571 | ||
1577 | kfree: | 1572 | kfree: |
1578 | /* | 1573 | /* |
1579 | * If we've gotten here then there is some kind of alignment bug | 1574 | * If we've gotten here then there is some kind of alignment bug |
1580 | */ | 1575 | */ |
1581 | BUG_ON(1); | 1576 | BUG_ON(1); |
1582 | 1577 | ||
1583 | dma_unmap_single(host->mmc->dev, host->dma_addr, WBSD_DMA_SIZE, | 1578 | dma_unmap_single(host->mmc->dev, host->dma_addr, WBSD_DMA_SIZE, |
1584 | DMA_BIDIRECTIONAL); | 1579 | DMA_BIDIRECTIONAL); |
1585 | host->dma_addr = (dma_addr_t)NULL; | 1580 | host->dma_addr = (dma_addr_t)NULL; |
1586 | 1581 | ||
1587 | kfree(host->dma_buffer); | 1582 | kfree(host->dma_buffer); |
1588 | host->dma_buffer = NULL; | 1583 | host->dma_buffer = NULL; |
1589 | 1584 | ||
@@ -1604,7 +1599,7 @@ static void __devexit wbsd_release_dma(struct wbsd_host* host) | |||
1604 | kfree(host->dma_buffer); | 1599 | kfree(host->dma_buffer); |
1605 | if (host->dma >= 0) | 1600 | if (host->dma >= 0) |
1606 | free_dma(host->dma); | 1601 | free_dma(host->dma); |
1607 | 1602 | ||
1608 | host->dma = -1; | 1603 | host->dma = -1; |
1609 | host->dma_buffer = NULL; | 1604 | host->dma_buffer = NULL; |
1610 | host->dma_addr = (dma_addr_t)NULL; | 1605 | host->dma_addr = (dma_addr_t)NULL; |
@@ -1617,7 +1612,7 @@ static void __devexit wbsd_release_dma(struct wbsd_host* host) | |||
1617 | static int __devinit wbsd_request_irq(struct wbsd_host* host, int irq) | 1612 | static int __devinit wbsd_request_irq(struct wbsd_host* host, int irq) |
1618 | { | 1613 | { |
1619 | int ret; | 1614 | int ret; |
1620 | 1615 | ||
1621 | /* | 1616 | /* |
1622 | * Allocate interrupt. | 1617 | * Allocate interrupt. |
1623 | */ | 1618 | */ |
@@ -1625,7 +1620,7 @@ static int __devinit wbsd_request_irq(struct wbsd_host* host, int irq) | |||
1625 | ret = request_irq(irq, wbsd_irq, SA_SHIRQ, DRIVER_NAME, host); | 1620 | ret = request_irq(irq, wbsd_irq, SA_SHIRQ, DRIVER_NAME, host); |
1626 | if (ret) | 1621 | if (ret) |
1627 | return ret; | 1622 | return ret; |
1628 | 1623 | ||
1629 | host->irq = irq; | 1624 | host->irq = irq; |
1630 | 1625 | ||
1631 | /* | 1626 | /* |
@@ -1637,7 +1632,7 @@ static int __devinit wbsd_request_irq(struct wbsd_host* host, int irq) | |||
1637 | tasklet_init(&host->timeout_tasklet, wbsd_tasklet_timeout, (unsigned long)host); | 1632 | tasklet_init(&host->timeout_tasklet, wbsd_tasklet_timeout, (unsigned long)host); |
1638 | tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish, (unsigned long)host); | 1633 | tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish, (unsigned long)host); |
1639 | tasklet_init(&host->block_tasklet, wbsd_tasklet_block, (unsigned long)host); | 1634 | tasklet_init(&host->block_tasklet, wbsd_tasklet_block, (unsigned long)host); |
1640 | 1635 | ||
1641 | return 0; | 1636 | return 0; |
1642 | } | 1637 | } |
1643 | 1638 | ||
@@ -1647,9 +1642,9 @@ static void __devexit wbsd_release_irq(struct wbsd_host* host) | |||
1647 | return; | 1642 | return; |
1648 | 1643 | ||
1649 | free_irq(host->irq, host); | 1644 | free_irq(host->irq, host); |
1650 | 1645 | ||
1651 | host->irq = 0; | 1646 | host->irq = 0; |
1652 | 1647 | ||
1653 | tasklet_kill(&host->card_tasklet); | 1648 | tasklet_kill(&host->card_tasklet); |
1654 | tasklet_kill(&host->fifo_tasklet); | 1649 | tasklet_kill(&host->fifo_tasklet); |
1655 | tasklet_kill(&host->crc_tasklet); | 1650 | tasklet_kill(&host->crc_tasklet); |
@@ -1666,7 +1661,7 @@ static int __devinit wbsd_request_resources(struct wbsd_host* host, | |||
1666 | int base, int irq, int dma) | 1661 | int base, int irq, int dma) |
1667 | { | 1662 | { |
1668 | int ret; | 1663 | int ret; |
1669 | 1664 | ||
1670 | /* | 1665 | /* |
1671 | * Allocate I/O ports. | 1666 | * Allocate I/O ports. |
1672 | */ | 1667 | */ |
@@ -1685,7 +1680,7 @@ static int __devinit wbsd_request_resources(struct wbsd_host* host, | |||
1685 | * Allocate DMA. | 1680 | * Allocate DMA. |
1686 | */ | 1681 | */ |
1687 | wbsd_request_dma(host, dma); | 1682 | wbsd_request_dma(host, dma); |
1688 | 1683 | ||
1689 | return 0; | 1684 | return 0; |
1690 | } | 1685 | } |
1691 | 1686 | ||
@@ -1708,7 +1703,7 @@ static void __devinit wbsd_chip_config(struct wbsd_host* host) | |||
1708 | { | 1703 | { |
1709 | /* | 1704 | /* |
1710 | * Reset the chip. | 1705 | * Reset the chip. |
1711 | */ | 1706 | */ |
1712 | wbsd_write_config(host, WBSD_CONF_SWRST, 1); | 1707 | wbsd_write_config(host, WBSD_CONF_SWRST, 1); |
1713 | wbsd_write_config(host, WBSD_CONF_SWRST, 0); | 1708 | wbsd_write_config(host, WBSD_CONF_SWRST, 0); |
1714 | 1709 | ||
@@ -1716,23 +1711,23 @@ static void __devinit wbsd_chip_config(struct wbsd_host* host) | |||
1716 | * Select SD/MMC function. | 1711 | * Select SD/MMC function. |
1717 | */ | 1712 | */ |
1718 | wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); | 1713 | wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); |
1719 | 1714 | ||
1720 | /* | 1715 | /* |
1721 | * Set up card detection. | 1716 | * Set up card detection. |
1722 | */ | 1717 | */ |
1723 | wbsd_write_config(host, WBSD_CONF_PINS, WBSD_PINS_DETECT_GP11); | 1718 | wbsd_write_config(host, WBSD_CONF_PINS, WBSD_PINS_DETECT_GP11); |
1724 | 1719 | ||
1725 | /* | 1720 | /* |
1726 | * Configure chip | 1721 | * Configure chip |
1727 | */ | 1722 | */ |
1728 | wbsd_write_config(host, WBSD_CONF_PORT_HI, host->base >> 8); | 1723 | wbsd_write_config(host, WBSD_CONF_PORT_HI, host->base >> 8); |
1729 | wbsd_write_config(host, WBSD_CONF_PORT_LO, host->base & 0xff); | 1724 | wbsd_write_config(host, WBSD_CONF_PORT_LO, host->base & 0xff); |
1730 | 1725 | ||
1731 | wbsd_write_config(host, WBSD_CONF_IRQ, host->irq); | 1726 | wbsd_write_config(host, WBSD_CONF_IRQ, host->irq); |
1732 | 1727 | ||
1733 | if (host->dma >= 0) | 1728 | if (host->dma >= 0) |
1734 | wbsd_write_config(host, WBSD_CONF_DRQ, host->dma); | 1729 | wbsd_write_config(host, WBSD_CONF_DRQ, host->dma); |
1735 | 1730 | ||
1736 | /* | 1731 | /* |
1737 | * Enable and power up chip. | 1732 | * Enable and power up chip. |
1738 | */ | 1733 | */ |
@@ -1743,26 +1738,26 @@ static void __devinit wbsd_chip_config(struct wbsd_host* host) | |||
1743 | /* | 1738 | /* |
1744 | * Check that configured resources are correct. | 1739 | * Check that configured resources are correct. |
1745 | */ | 1740 | */ |
1746 | 1741 | ||
1747 | static int __devinit wbsd_chip_validate(struct wbsd_host* host) | 1742 | static int __devinit wbsd_chip_validate(struct wbsd_host* host) |
1748 | { | 1743 | { |
1749 | int base, irq, dma; | 1744 | int base, irq, dma; |
1750 | 1745 | ||
1751 | /* | 1746 | /* |
1752 | * Select SD/MMC function. | 1747 | * Select SD/MMC function. |
1753 | */ | 1748 | */ |
1754 | wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); | 1749 | wbsd_write_config(host, WBSD_CONF_DEVICE, DEVICE_SD); |
1755 | 1750 | ||
1756 | /* | 1751 | /* |
1757 | * Read configuration. | 1752 | * Read configuration. |
1758 | */ | 1753 | */ |
1759 | base = wbsd_read_config(host, WBSD_CONF_PORT_HI) << 8; | 1754 | base = wbsd_read_config(host, WBSD_CONF_PORT_HI) << 8; |
1760 | base |= wbsd_read_config(host, WBSD_CONF_PORT_LO); | 1755 | base |= wbsd_read_config(host, WBSD_CONF_PORT_LO); |
1761 | 1756 | ||
1762 | irq = wbsd_read_config(host, WBSD_CONF_IRQ); | 1757 | irq = wbsd_read_config(host, WBSD_CONF_IRQ); |
1763 | 1758 | ||
1764 | dma = wbsd_read_config(host, WBSD_CONF_DRQ); | 1759 | dma = wbsd_read_config(host, WBSD_CONF_DRQ); |
1765 | 1760 | ||
1766 | /* | 1761 | /* |
1767 | * Validate against given configuration. | 1762 | * Validate against given configuration. |
1768 | */ | 1763 | */ |
@@ -1772,7 +1767,7 @@ static int __devinit wbsd_chip_validate(struct wbsd_host* host) | |||
1772 | return 0; | 1767 | return 0; |
1773 | if ((dma != host->dma) && (host->dma != -1)) | 1768 | if ((dma != host->dma) && (host->dma != -1)) |
1774 | return 0; | 1769 | return 0; |
1775 | 1770 | ||
1776 | return 1; | 1771 | return 1; |
1777 | } | 1772 | } |
1778 | 1773 | ||
@@ -1788,14 +1783,14 @@ static int __devinit wbsd_init(struct device* dev, int base, int irq, int dma, | |||
1788 | struct wbsd_host* host = NULL; | 1783 | struct wbsd_host* host = NULL; |
1789 | struct mmc_host* mmc = NULL; | 1784 | struct mmc_host* mmc = NULL; |
1790 | int ret; | 1785 | int ret; |
1791 | 1786 | ||
1792 | ret = wbsd_alloc_mmc(dev); | 1787 | ret = wbsd_alloc_mmc(dev); |
1793 | if (ret) | 1788 | if (ret) |
1794 | return ret; | 1789 | return ret; |
1795 | 1790 | ||
1796 | mmc = dev_get_drvdata(dev); | 1791 | mmc = dev_get_drvdata(dev); |
1797 | host = mmc_priv(mmc); | 1792 | host = mmc_priv(mmc); |
1798 | 1793 | ||
1799 | /* | 1794 | /* |
1800 | * Scan for hardware. | 1795 | * Scan for hardware. |
1801 | */ | 1796 | */ |
@@ -1814,7 +1809,7 @@ static int __devinit wbsd_init(struct device* dev, int base, int irq, int dma, | |||
1814 | return ret; | 1809 | return ret; |
1815 | } | 1810 | } |
1816 | } | 1811 | } |
1817 | 1812 | ||
1818 | /* | 1813 | /* |
1819 | * Request resources. | 1814 | * Request resources. |
1820 | */ | 1815 | */ |
@@ -1825,7 +1820,7 @@ static int __devinit wbsd_init(struct device* dev, int base, int irq, int dma, | |||
1825 | wbsd_free_mmc(dev); | 1820 | wbsd_free_mmc(dev); |
1826 | return ret; | 1821 | return ret; |
1827 | } | 1822 | } |
1828 | 1823 | ||
1829 | /* | 1824 | /* |
1830 | * See if chip needs to be configured. | 1825 | * See if chip needs to be configured. |
1831 | */ | 1826 | */ |
@@ -1842,7 +1837,7 @@ static int __devinit wbsd_init(struct device* dev, int base, int irq, int dma, | |||
1842 | } | 1837 | } |
1843 | else | 1838 | else |
1844 | wbsd_chip_config(host); | 1839 | wbsd_chip_config(host); |
1845 | 1840 | ||
1846 | /* | 1841 | /* |
1847 | * Power Management stuff. No idea how this works. | 1842 | * Power Management stuff. No idea how this works. |
1848 | * Not tested. | 1843 | * Not tested. |
@@ -1860,7 +1855,7 @@ static int __devinit wbsd_init(struct device* dev, int base, int irq, int dma, | |||
1860 | * Reset the chip into a known state. | 1855 | * Reset the chip into a known state. |
1861 | */ | 1856 | */ |
1862 | wbsd_init_device(host); | 1857 | wbsd_init_device(host); |
1863 | 1858 | ||
1864 | mmc_add_host(mmc); | 1859 | mmc_add_host(mmc); |
1865 | 1860 | ||
1866 | printk(KERN_INFO "%s: W83L51xD", mmc_hostname(mmc)); | 1861 | printk(KERN_INFO "%s: W83L51xD", mmc_hostname(mmc)); |
@@ -1882,12 +1877,12 @@ static void __devexit wbsd_shutdown(struct device* dev, int pnp) | |||
1882 | { | 1877 | { |
1883 | struct mmc_host* mmc = dev_get_drvdata(dev); | 1878 | struct mmc_host* mmc = dev_get_drvdata(dev); |
1884 | struct wbsd_host* host; | 1879 | struct wbsd_host* host; |
1885 | 1880 | ||
1886 | if (!mmc) | 1881 | if (!mmc) |
1887 | return; | 1882 | return; |
1888 | 1883 | ||
1889 | host = mmc_priv(mmc); | 1884 | host = mmc_priv(mmc); |
1890 | 1885 | ||
1891 | mmc_remove_host(mmc); | 1886 | mmc_remove_host(mmc); |
1892 | 1887 | ||
1893 | if (!pnp) | 1888 | if (!pnp) |
@@ -1900,9 +1895,9 @@ static void __devexit wbsd_shutdown(struct device* dev, int pnp) | |||
1900 | wbsd_write_config(host, WBSD_CONF_ENABLE, 0); | 1895 | wbsd_write_config(host, WBSD_CONF_ENABLE, 0); |
1901 | wbsd_lock_config(host); | 1896 | wbsd_lock_config(host); |
1902 | } | 1897 | } |
1903 | 1898 | ||
1904 | wbsd_release_resources(host); | 1899 | wbsd_release_resources(host); |
1905 | 1900 | ||
1906 | wbsd_free_mmc(dev); | 1901 | wbsd_free_mmc(dev); |
1907 | } | 1902 | } |
1908 | 1903 | ||
@@ -1932,7 +1927,7 @@ static int __devinit | |||
1932 | wbsd_pnp_probe(struct pnp_dev * pnpdev, const struct pnp_device_id *dev_id) | 1927 | wbsd_pnp_probe(struct pnp_dev * pnpdev, const struct pnp_device_id *dev_id) |
1933 | { | 1928 | { |
1934 | int io, irq, dma; | 1929 | int io, irq, dma; |
1935 | 1930 | ||
1936 | /* | 1931 | /* |
1937 | * Get resources from PnP layer. | 1932 | * Get resources from PnP layer. |
1938 | */ | 1933 | */ |
@@ -1942,9 +1937,9 @@ wbsd_pnp_probe(struct pnp_dev * pnpdev, const struct pnp_device_id *dev_id) | |||
1942 | dma = pnp_dma(pnpdev, 0); | 1937 | dma = pnp_dma(pnpdev, 0); |
1943 | else | 1938 | else |
1944 | dma = -1; | 1939 | dma = -1; |
1945 | 1940 | ||
1946 | DBGF("PnP resources: port %3x irq %d dma %d\n", io, irq, dma); | 1941 | DBGF("PnP resources: port %3x irq %d dma %d\n", io, irq, dma); |
1947 | 1942 | ||
1948 | return wbsd_init(&pnpdev->dev, io, irq, dma, 1); | 1943 | return wbsd_init(&pnpdev->dev, io, irq, dma, 1); |
1949 | } | 1944 | } |
1950 | 1945 | ||
@@ -1985,7 +1980,7 @@ static struct device_driver wbsd_driver = { | |||
1985 | .bus = &platform_bus_type, | 1980 | .bus = &platform_bus_type, |
1986 | .probe = wbsd_probe, | 1981 | .probe = wbsd_probe, |
1987 | .remove = wbsd_remove, | 1982 | .remove = wbsd_remove, |
1988 | 1983 | ||
1989 | .suspend = wbsd_suspend, | 1984 | .suspend = wbsd_suspend, |
1990 | .resume = wbsd_resume, | 1985 | .resume = wbsd_resume, |
1991 | }; | 1986 | }; |
@@ -2008,7 +2003,7 @@ static struct pnp_driver wbsd_pnp_driver = { | |||
2008 | static int __init wbsd_drv_init(void) | 2003 | static int __init wbsd_drv_init(void) |
2009 | { | 2004 | { |
2010 | int result; | 2005 | int result; |
2011 | 2006 | ||
2012 | printk(KERN_INFO DRIVER_NAME | 2007 | printk(KERN_INFO DRIVER_NAME |
2013 | ": Winbond W83L51xD SD/MMC card interface driver, " | 2008 | ": Winbond W83L51xD SD/MMC card interface driver, " |
2014 | DRIVER_VERSION "\n"); | 2009 | DRIVER_VERSION "\n"); |
@@ -2023,8 +2018,8 @@ static int __init wbsd_drv_init(void) | |||
2023 | return result; | 2018 | return result; |
2024 | } | 2019 | } |
2025 | 2020 | ||
2026 | #endif /* CONFIG_PNP */ | 2021 | #endif /* CONFIG_PNP */ |
2027 | 2022 | ||
2028 | if (nopnp) | 2023 | if (nopnp) |
2029 | { | 2024 | { |
2030 | result = driver_register(&wbsd_driver); | 2025 | result = driver_register(&wbsd_driver); |
@@ -2046,13 +2041,13 @@ static void __exit wbsd_drv_exit(void) | |||
2046 | 2041 | ||
2047 | if (!nopnp) | 2042 | if (!nopnp) |
2048 | pnp_unregister_driver(&wbsd_pnp_driver); | 2043 | pnp_unregister_driver(&wbsd_pnp_driver); |
2049 | 2044 | ||
2050 | #endif /* CONFIG_PNP */ | 2045 | #endif /* CONFIG_PNP */ |
2051 | 2046 | ||
2052 | if (nopnp) | 2047 | if (nopnp) |
2053 | { | 2048 | { |
2054 | platform_device_unregister(wbsd_device); | 2049 | platform_device_unregister(wbsd_device); |
2055 | 2050 | ||
2056 | driver_unregister(&wbsd_driver); | 2051 | driver_unregister(&wbsd_driver); |
2057 | } | 2052 | } |
2058 | 2053 | ||
diff --git a/drivers/mmc/wbsd.h b/drivers/mmc/wbsd.h index 9005b5241b3c..249baa701cb0 100644 --- a/drivers/mmc/wbsd.h +++ b/drivers/mmc/wbsd.h | |||
@@ -139,51 +139,50 @@ | |||
139 | struct wbsd_host | 139 | struct wbsd_host |
140 | { | 140 | { |
141 | struct mmc_host* mmc; /* MMC structure */ | 141 | struct mmc_host* mmc; /* MMC structure */ |
142 | 142 | ||
143 | spinlock_t lock; /* Mutex */ | 143 | spinlock_t lock; /* Mutex */ |
144 | 144 | ||
145 | int flags; /* Driver states */ | 145 | int flags; /* Driver states */ |
146 | 146 | ||
147 | #define WBSD_FCARD_PRESENT (1<<0) /* Card is present */ | 147 | #define WBSD_FCARD_PRESENT (1<<0) /* Card is present */ |
148 | #define WBSD_FIGNORE_DETECT (1<<1) /* Ignore card detection */ | 148 | #define WBSD_FIGNORE_DETECT (1<<1) /* Ignore card detection */ |
149 | 149 | ||
150 | struct mmc_request* mrq; /* Current request */ | 150 | struct mmc_request* mrq; /* Current request */ |
151 | 151 | ||
152 | u8 isr; /* Accumulated ISR */ | 152 | u8 isr; /* Accumulated ISR */ |
153 | 153 | ||
154 | struct scatterlist* cur_sg; /* Current SG entry */ | 154 | struct scatterlist* cur_sg; /* Current SG entry */ |
155 | unsigned int num_sg; /* Number of entries left */ | 155 | unsigned int num_sg; /* Number of entries left */ |
156 | void* mapped_sg; /* vaddr of mapped sg */ | 156 | void* mapped_sg; /* vaddr of mapped sg */ |
157 | 157 | ||
158 | unsigned int offset; /* Offset into current entry */ | 158 | unsigned int offset; /* Offset into current entry */ |
159 | unsigned int remain; /* Data left in curren entry */ | 159 | unsigned int remain; /* Data left in curren entry */ |
160 | 160 | ||
161 | int size; /* Total size of transfer */ | 161 | int size; /* Total size of transfer */ |
162 | 162 | ||
163 | char* dma_buffer; /* ISA DMA buffer */ | 163 | char* dma_buffer; /* ISA DMA buffer */ |
164 | dma_addr_t dma_addr; /* Physical address for same */ | 164 | dma_addr_t dma_addr; /* Physical address for same */ |
165 | 165 | ||
166 | int firsterr; /* See fifo functions */ | 166 | int firsterr; /* See fifo functions */ |
167 | 167 | ||
168 | u8 clk; /* Current clock speed */ | 168 | u8 clk; /* Current clock speed */ |
169 | unsigned char bus_width; /* Current bus width */ | 169 | unsigned char bus_width; /* Current bus width */ |
170 | 170 | ||
171 | int config; /* Config port */ | 171 | int config; /* Config port */ |
172 | u8 unlock_code; /* Code to unlock config */ | 172 | u8 unlock_code; /* Code to unlock config */ |
173 | 173 | ||
174 | int chip_id; /* ID of controller */ | 174 | int chip_id; /* ID of controller */ |
175 | 175 | ||
176 | int base; /* I/O port base */ | 176 | int base; /* I/O port base */ |
177 | int irq; /* Interrupt */ | 177 | int irq; /* Interrupt */ |
178 | int dma; /* DMA channel */ | 178 | int dma; /* DMA channel */ |
179 | 179 | ||
180 | struct tasklet_struct card_tasklet; /* Tasklet structures */ | 180 | struct tasklet_struct card_tasklet; /* Tasklet structures */ |
181 | struct tasklet_struct fifo_tasklet; | 181 | struct tasklet_struct fifo_tasklet; |
182 | struct tasklet_struct crc_tasklet; | 182 | struct tasklet_struct crc_tasklet; |
183 | struct tasklet_struct timeout_tasklet; | 183 | struct tasklet_struct timeout_tasklet; |
184 | struct tasklet_struct finish_tasklet; | 184 | struct tasklet_struct finish_tasklet; |
185 | struct tasklet_struct block_tasklet; | 185 | struct tasklet_struct block_tasklet; |
186 | 186 | ||
187 | struct timer_list detect_timer; /* Card detection timer */ | ||
188 | struct timer_list ignore_timer; /* Ignore detection timer */ | 187 | struct timer_list ignore_timer; /* Ignore detection timer */ |
189 | }; | 188 | }; |
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c index 811d92e5f5b1..cc372136e852 100644 --- a/drivers/mtd/maps/uclinux.c +++ b/drivers/mtd/maps/uclinux.c | |||
@@ -25,9 +25,6 @@ | |||
25 | 25 | ||
26 | /****************************************************************************/ | 26 | /****************************************************************************/ |
27 | 27 | ||
28 | |||
29 | /****************************************************************************/ | ||
30 | |||
31 | struct map_info uclinux_ram_map = { | 28 | struct map_info uclinux_ram_map = { |
32 | .name = "RAM", | 29 | .name = "RAM", |
33 | }; | 30 | }; |
@@ -60,14 +57,15 @@ int __init uclinux_mtd_init(void) | |||
60 | struct mtd_info *mtd; | 57 | struct mtd_info *mtd; |
61 | struct map_info *mapp; | 58 | struct map_info *mapp; |
62 | extern char _ebss; | 59 | extern char _ebss; |
60 | unsigned long addr = (unsigned long) &_ebss; | ||
63 | 61 | ||
64 | mapp = &uclinux_ram_map; | 62 | mapp = &uclinux_ram_map; |
65 | mapp->phys = (unsigned long) &_ebss; | 63 | mapp->phys = addr; |
66 | mapp->size = PAGE_ALIGN(*((unsigned long *)((&_ebss) + 8))); | 64 | mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(addr + 8)))); |
67 | mapp->bankwidth = 4; | 65 | mapp->bankwidth = 4; |
68 | 66 | ||
69 | printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", | 67 | printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", |
70 | (int) mapp->map_priv_2, (int) mapp->size); | 68 | (int) mapp->phys, (int) mapp->size); |
71 | 69 | ||
72 | mapp->virt = ioremap_nocache(mapp->phys, mapp->size); | 70 | mapp->virt = ioremap_nocache(mapp->phys, mapp->size); |
73 | 71 | ||
@@ -95,7 +93,6 @@ int __init uclinux_mtd_init(void) | |||
95 | printk("uclinux[mtd]: set %s to be root filesystem\n", | 93 | printk("uclinux[mtd]: set %s to be root filesystem\n", |
96 | uclinux_romfs[0].name); | 94 | uclinux_romfs[0].name); |
97 | ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 0); | 95 | ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 0); |
98 | put_mtd_device(mtd); | ||
99 | 96 | ||
100 | return(0); | 97 | return(0); |
101 | } | 98 | } |
@@ -109,7 +106,7 @@ void __exit uclinux_mtd_cleanup(void) | |||
109 | map_destroy(uclinux_ram_mtdinfo); | 106 | map_destroy(uclinux_ram_mtdinfo); |
110 | uclinux_ram_mtdinfo = NULL; | 107 | uclinux_ram_mtdinfo = NULL; |
111 | } | 108 | } |
112 | if (uclinux_ram_map.map_priv_1) { | 109 | if (uclinux_ram_map.virt) { |
113 | iounmap((void *) uclinux_ram_map.virt); | 110 | iounmap((void *) uclinux_ram_map.virt); |
114 | uclinux_ram_map.virt = 0; | 111 | uclinux_ram_map.virt = 0; |
115 | } | 112 | } |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 6bb9232514b4..54fff9c2e802 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1738,11 +1738,18 @@ config 68360_ENET | |||
1738 | the Motorola 68360 processor. | 1738 | the Motorola 68360 processor. |
1739 | 1739 | ||
1740 | config FEC | 1740 | config FEC |
1741 | bool "FEC ethernet controller (of ColdFire 5272)" | 1741 | bool "FEC ethernet controller (of ColdFire CPUs)" |
1742 | depends on M5272 || M5282 | 1742 | depends on M523x || M527x || M5272 || M528x |
1743 | help | 1743 | help |
1744 | Say Y here if you want to use the built-in 10/100 Fast ethernet | 1744 | Say Y here if you want to use the built-in 10/100 Fast ethernet |
1745 | controller on the Motorola ColdFire 5272 processor. | 1745 | controller on some Motorola ColdFire processors. |
1746 | |||
1747 | config FEC2 | ||
1748 | bool "Second FEC ethernet controller (on some ColdFire CPUs)" | ||
1749 | depends on FEC | ||
1750 | help | ||
1751 | Say Y here if you want to use the second built-in 10/100 Fast | ||
1752 | ethernet controller on some Motorola ColdFire processors. | ||
1746 | 1753 | ||
1747 | config NE_H8300 | 1754 | config NE_H8300 |
1748 | tristate "NE2000 compatible support for H8/300" | 1755 | tristate "NE2000 compatible support for H8/300" |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 2c7008491378..85504fb900da 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * describes connections using the internal parallel port I/O, which | 8 | * describes connections using the internal parallel port I/O, which |
9 | * is basically all of Port D. | 9 | * is basically all of Port D. |
10 | * | 10 | * |
11 | * Right now, I am very watseful with the buffers. I allocate memory | 11 | * Right now, I am very wasteful with the buffers. I allocate memory |
12 | * pages and then divide them into 2K frame buffers. This way I know I | 12 | * pages and then divide them into 2K frame buffers. This way I know I |
13 | * have buffers large enough to hold one frame within one buffer descriptor. | 13 | * have buffers large enough to hold one frame within one buffer descriptor. |
14 | * Once I get this working, I will use 64 or 128 byte CPM buffers, which | 14 | * Once I get this working, I will use 64 or 128 byte CPM buffers, which |
@@ -19,7 +19,10 @@ | |||
19 | * Copyright (c) 2000 Ericsson Radio Systems AB. | 19 | * Copyright (c) 2000 Ericsson Radio Systems AB. |
20 | * | 20 | * |
21 | * Support for FEC controller of ColdFire/5270/5271/5272/5274/5275/5280/5282. | 21 | * Support for FEC controller of ColdFire/5270/5271/5272/5274/5275/5280/5282. |
22 | * Copyrught (c) 2001-2004 Greg Ungerer (gerg@snapgear.com) | 22 | * Copyright (c) 2001-2004 Greg Ungerer (gerg@snapgear.com) |
23 | * | ||
24 | * Bug fixes and cleanup by Philippe De Muyter (phdm@macqel.be) | ||
25 | * Copyright (c) 2004-2005 Macq Electronique SA. | ||
23 | */ | 26 | */ |
24 | 27 | ||
25 | #include <linux/config.h> | 28 | #include <linux/config.h> |
@@ -46,7 +49,8 @@ | |||
46 | #include <asm/io.h> | 49 | #include <asm/io.h> |
47 | #include <asm/pgtable.h> | 50 | #include <asm/pgtable.h> |
48 | 51 | ||
49 | #if defined(CONFIG_M527x) || defined(CONFIG_M5272) || defined(CONFIG_M528x) | 52 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || \ |
53 | defined(CONFIG_M5272) || defined(CONFIG_M528x) | ||
50 | #include <asm/coldfire.h> | 54 | #include <asm/coldfire.h> |
51 | #include <asm/mcfsim.h> | 55 | #include <asm/mcfsim.h> |
52 | #include "fec.h" | 56 | #include "fec.h" |
@@ -71,7 +75,7 @@ static unsigned int fec_hw[] = { | |||
71 | #elif defined(CONFIG_M527x) | 75 | #elif defined(CONFIG_M527x) |
72 | (MCF_MBAR + 0x1000), | 76 | (MCF_MBAR + 0x1000), |
73 | (MCF_MBAR + 0x1800), | 77 | (MCF_MBAR + 0x1800), |
74 | #elif defined(CONFIG_M528x) | 78 | #elif defined(CONFIG_M523x) || defined(CONFIG_M528x) |
75 | (MCF_MBAR + 0x1000), | 79 | (MCF_MBAR + 0x1000), |
76 | #else | 80 | #else |
77 | &(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec), | 81 | &(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec), |
@@ -94,12 +98,14 @@ static unsigned char fec_mac_default[] = { | |||
94 | #define FEC_FLASHMAC 0xffe04000 | 98 | #define FEC_FLASHMAC 0xffe04000 |
95 | #elif defined(CONFIG_CANCam) | 99 | #elif defined(CONFIG_CANCam) |
96 | #define FEC_FLASHMAC 0xf0020000 | 100 | #define FEC_FLASHMAC 0xf0020000 |
101 | #elif defined (CONFIG_M5272C3) | ||
102 | #define FEC_FLASHMAC (0xffe04000 + 4) | ||
103 | #elif defined(CONFIG_MOD5272) | ||
104 | #define FEC_FLASHMAC 0xffc0406b | ||
97 | #else | 105 | #else |
98 | #define FEC_FLASHMAC 0 | 106 | #define FEC_FLASHMAC 0 |
99 | #endif | 107 | #endif |
100 | 108 | ||
101 | unsigned char *fec_flashmac = (unsigned char *) FEC_FLASHMAC; | ||
102 | |||
103 | /* Forward declarations of some structures to support different PHYs | 109 | /* Forward declarations of some structures to support different PHYs |
104 | */ | 110 | */ |
105 | 111 | ||
@@ -158,7 +164,7 @@ typedef struct { | |||
158 | * size bits. Other FEC hardware does not, so we need to take that into | 164 | * size bits. Other FEC hardware does not, so we need to take that into |
159 | * account when setting it. | 165 | * account when setting it. |
160 | */ | 166 | */ |
161 | #if defined(CONFIG_M527x) || defined(CONFIG_M528x) | 167 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) |
162 | #define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16) | 168 | #define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16) |
163 | #else | 169 | #else |
164 | #define OPT_FRAME_SIZE 0 | 170 | #define OPT_FRAME_SIZE 0 |
@@ -196,7 +202,7 @@ struct fec_enet_private { | |||
196 | uint phy_id_done; | 202 | uint phy_id_done; |
197 | uint phy_status; | 203 | uint phy_status; |
198 | uint phy_speed; | 204 | uint phy_speed; |
199 | phy_info_t *phy; | 205 | phy_info_t const *phy; |
200 | struct work_struct phy_task; | 206 | struct work_struct phy_task; |
201 | 207 | ||
202 | uint sequence_done; | 208 | uint sequence_done; |
@@ -209,7 +215,6 @@ struct fec_enet_private { | |||
209 | int link; | 215 | int link; |
210 | int old_link; | 216 | int old_link; |
211 | int full_duplex; | 217 | int full_duplex; |
212 | unsigned char mac_addr[ETH_ALEN]; | ||
213 | }; | 218 | }; |
214 | 219 | ||
215 | static int fec_enet_open(struct net_device *dev); | 220 | static int fec_enet_open(struct net_device *dev); |
@@ -237,10 +242,10 @@ typedef struct mii_list { | |||
237 | } mii_list_t; | 242 | } mii_list_t; |
238 | 243 | ||
239 | #define NMII 20 | 244 | #define NMII 20 |
240 | mii_list_t mii_cmds[NMII]; | 245 | static mii_list_t mii_cmds[NMII]; |
241 | mii_list_t *mii_free; | 246 | static mii_list_t *mii_free; |
242 | mii_list_t *mii_head; | 247 | static mii_list_t *mii_head; |
243 | mii_list_t *mii_tail; | 248 | static mii_list_t *mii_tail; |
244 | 249 | ||
245 | static int mii_queue(struct net_device *dev, int request, | 250 | static int mii_queue(struct net_device *dev, int request, |
246 | void (*func)(uint, struct net_device *)); | 251 | void (*func)(uint, struct net_device *)); |
@@ -425,7 +430,7 @@ fec_timeout(struct net_device *dev) | |||
425 | } | 430 | } |
426 | } | 431 | } |
427 | #endif | 432 | #endif |
428 | fec_restart(dev, 0); | 433 | fec_restart(dev, fep->full_duplex); |
429 | netif_wake_queue(dev); | 434 | netif_wake_queue(dev); |
430 | } | 435 | } |
431 | 436 | ||
@@ -757,45 +762,52 @@ static void mii_parse_sr(uint mii_reg, struct net_device *dev) | |||
757 | { | 762 | { |
758 | struct fec_enet_private *fep = netdev_priv(dev); | 763 | struct fec_enet_private *fep = netdev_priv(dev); |
759 | volatile uint *s = &(fep->phy_status); | 764 | volatile uint *s = &(fep->phy_status); |
765 | uint status; | ||
760 | 766 | ||
761 | *s &= ~(PHY_STAT_LINK | PHY_STAT_FAULT | PHY_STAT_ANC); | 767 | status = *s & ~(PHY_STAT_LINK | PHY_STAT_FAULT | PHY_STAT_ANC); |
762 | 768 | ||
763 | if (mii_reg & 0x0004) | 769 | if (mii_reg & 0x0004) |
764 | *s |= PHY_STAT_LINK; | 770 | status |= PHY_STAT_LINK; |
765 | if (mii_reg & 0x0010) | 771 | if (mii_reg & 0x0010) |
766 | *s |= PHY_STAT_FAULT; | 772 | status |= PHY_STAT_FAULT; |
767 | if (mii_reg & 0x0020) | 773 | if (mii_reg & 0x0020) |
768 | *s |= PHY_STAT_ANC; | 774 | status |= PHY_STAT_ANC; |
775 | |||
776 | *s = status; | ||
769 | } | 777 | } |
770 | 778 | ||
771 | static void mii_parse_cr(uint mii_reg, struct net_device *dev) | 779 | static void mii_parse_cr(uint mii_reg, struct net_device *dev) |
772 | { | 780 | { |
773 | struct fec_enet_private *fep = netdev_priv(dev); | 781 | struct fec_enet_private *fep = netdev_priv(dev); |
774 | volatile uint *s = &(fep->phy_status); | 782 | volatile uint *s = &(fep->phy_status); |
783 | uint status; | ||
775 | 784 | ||
776 | *s &= ~(PHY_CONF_ANE | PHY_CONF_LOOP); | 785 | status = *s & ~(PHY_CONF_ANE | PHY_CONF_LOOP); |
777 | 786 | ||
778 | if (mii_reg & 0x1000) | 787 | if (mii_reg & 0x1000) |
779 | *s |= PHY_CONF_ANE; | 788 | status |= PHY_CONF_ANE; |
780 | if (mii_reg & 0x4000) | 789 | if (mii_reg & 0x4000) |
781 | *s |= PHY_CONF_LOOP; | 790 | status |= PHY_CONF_LOOP; |
791 | *s = status; | ||
782 | } | 792 | } |
783 | 793 | ||
784 | static void mii_parse_anar(uint mii_reg, struct net_device *dev) | 794 | static void mii_parse_anar(uint mii_reg, struct net_device *dev) |
785 | { | 795 | { |
786 | struct fec_enet_private *fep = netdev_priv(dev); | 796 | struct fec_enet_private *fep = netdev_priv(dev); |
787 | volatile uint *s = &(fep->phy_status); | 797 | volatile uint *s = &(fep->phy_status); |
798 | uint status; | ||
788 | 799 | ||
789 | *s &= ~(PHY_CONF_SPMASK); | 800 | status = *s & ~(PHY_CONF_SPMASK); |
790 | 801 | ||
791 | if (mii_reg & 0x0020) | 802 | if (mii_reg & 0x0020) |
792 | *s |= PHY_CONF_10HDX; | 803 | status |= PHY_CONF_10HDX; |
793 | if (mii_reg & 0x0040) | 804 | if (mii_reg & 0x0040) |
794 | *s |= PHY_CONF_10FDX; | 805 | status |= PHY_CONF_10FDX; |
795 | if (mii_reg & 0x0080) | 806 | if (mii_reg & 0x0080) |
796 | *s |= PHY_CONF_100HDX; | 807 | status |= PHY_CONF_100HDX; |
797 | if (mii_reg & 0x00100) | 808 | if (mii_reg & 0x00100) |
798 | *s |= PHY_CONF_100FDX; | 809 | status |= PHY_CONF_100FDX; |
810 | *s = status; | ||
799 | } | 811 | } |
800 | 812 | ||
801 | /* ------------------------------------------------------------------------- */ | 813 | /* ------------------------------------------------------------------------- */ |
@@ -811,37 +823,34 @@ static void mii_parse_lxt970_csr(uint mii_reg, struct net_device *dev) | |||
811 | { | 823 | { |
812 | struct fec_enet_private *fep = netdev_priv(dev); | 824 | struct fec_enet_private *fep = netdev_priv(dev); |
813 | volatile uint *s = &(fep->phy_status); | 825 | volatile uint *s = &(fep->phy_status); |
826 | uint status; | ||
814 | 827 | ||
815 | *s &= ~(PHY_STAT_SPMASK); | 828 | status = *s & ~(PHY_STAT_SPMASK); |
816 | |||
817 | if (mii_reg & 0x0800) { | 829 | if (mii_reg & 0x0800) { |
818 | if (mii_reg & 0x1000) | 830 | if (mii_reg & 0x1000) |
819 | *s |= PHY_STAT_100FDX; | 831 | status |= PHY_STAT_100FDX; |
820 | else | 832 | else |
821 | *s |= PHY_STAT_100HDX; | 833 | status |= PHY_STAT_100HDX; |
822 | } else { | 834 | } else { |
823 | if (mii_reg & 0x1000) | 835 | if (mii_reg & 0x1000) |
824 | *s |= PHY_STAT_10FDX; | 836 | status |= PHY_STAT_10FDX; |
825 | else | 837 | else |
826 | *s |= PHY_STAT_10HDX; | 838 | status |= PHY_STAT_10HDX; |
827 | } | 839 | } |
840 | *s = status; | ||
828 | } | 841 | } |
829 | 842 | ||
830 | static phy_info_t phy_info_lxt970 = { | 843 | static phy_cmd_t const phy_cmd_lxt970_config[] = { |
831 | 0x07810000, | ||
832 | "LXT970", | ||
833 | |||
834 | (const phy_cmd_t []) { /* config */ | ||
835 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 844 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
836 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 845 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
837 | { mk_mii_end, } | 846 | { mk_mii_end, } |
838 | }, | 847 | }; |
839 | (const phy_cmd_t []) { /* startup - enable interrupts */ | 848 | static phy_cmd_t const phy_cmd_lxt970_startup[] = { /* enable interrupts */ |
840 | { mk_mii_write(MII_LXT970_IER, 0x0002), NULL }, | 849 | { mk_mii_write(MII_LXT970_IER, 0x0002), NULL }, |
841 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 850 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
842 | { mk_mii_end, } | 851 | { mk_mii_end, } |
843 | }, | 852 | }; |
844 | (const phy_cmd_t []) { /* ack_int */ | 853 | static phy_cmd_t const phy_cmd_lxt970_ack_int[] = { |
845 | /* read SR and ISR to acknowledge */ | 854 | /* read SR and ISR to acknowledge */ |
846 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 855 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
847 | { mk_mii_read(MII_LXT970_ISR), NULL }, | 856 | { mk_mii_read(MII_LXT970_ISR), NULL }, |
@@ -849,11 +858,18 @@ static phy_info_t phy_info_lxt970 = { | |||
849 | /* find out the current status */ | 858 | /* find out the current status */ |
850 | { mk_mii_read(MII_LXT970_CSR), mii_parse_lxt970_csr }, | 859 | { mk_mii_read(MII_LXT970_CSR), mii_parse_lxt970_csr }, |
851 | { mk_mii_end, } | 860 | { mk_mii_end, } |
852 | }, | 861 | }; |
853 | (const phy_cmd_t []) { /* shutdown - disable interrupts */ | 862 | static phy_cmd_t const phy_cmd_lxt970_shutdown[] = { /* disable interrupts */ |
854 | { mk_mii_write(MII_LXT970_IER, 0x0000), NULL }, | 863 | { mk_mii_write(MII_LXT970_IER, 0x0000), NULL }, |
855 | { mk_mii_end, } | 864 | { mk_mii_end, } |
856 | }, | 865 | }; |
866 | static phy_info_t const phy_info_lxt970 = { | ||
867 | .id = 0x07810000, | ||
868 | .name = "LXT970", | ||
869 | .config = phy_cmd_lxt970_config, | ||
870 | .startup = phy_cmd_lxt970_startup, | ||
871 | .ack_int = phy_cmd_lxt970_ack_int, | ||
872 | .shutdown = phy_cmd_lxt970_shutdown | ||
857 | }; | 873 | }; |
858 | 874 | ||
859 | /* ------------------------------------------------------------------------- */ | 875 | /* ------------------------------------------------------------------------- */ |
@@ -878,45 +894,44 @@ static void mii_parse_lxt971_sr2(uint mii_reg, struct net_device *dev) | |||
878 | { | 894 | { |
879 | struct fec_enet_private *fep = netdev_priv(dev); | 895 | struct fec_enet_private *fep = netdev_priv(dev); |
880 | volatile uint *s = &(fep->phy_status); | 896 | volatile uint *s = &(fep->phy_status); |
897 | uint status; | ||
881 | 898 | ||
882 | *s &= ~(PHY_STAT_SPMASK | PHY_STAT_LINK | PHY_STAT_ANC); | 899 | status = *s & ~(PHY_STAT_SPMASK | PHY_STAT_LINK | PHY_STAT_ANC); |
883 | 900 | ||
884 | if (mii_reg & 0x0400) { | 901 | if (mii_reg & 0x0400) { |
885 | fep->link = 1; | 902 | fep->link = 1; |
886 | *s |= PHY_STAT_LINK; | 903 | status |= PHY_STAT_LINK; |
887 | } else { | 904 | } else { |
888 | fep->link = 0; | 905 | fep->link = 0; |
889 | } | 906 | } |
890 | if (mii_reg & 0x0080) | 907 | if (mii_reg & 0x0080) |
891 | *s |= PHY_STAT_ANC; | 908 | status |= PHY_STAT_ANC; |
892 | if (mii_reg & 0x4000) { | 909 | if (mii_reg & 0x4000) { |
893 | if (mii_reg & 0x0200) | 910 | if (mii_reg & 0x0200) |
894 | *s |= PHY_STAT_100FDX; | 911 | status |= PHY_STAT_100FDX; |
895 | else | 912 | else |
896 | *s |= PHY_STAT_100HDX; | 913 | status |= PHY_STAT_100HDX; |
897 | } else { | 914 | } else { |
898 | if (mii_reg & 0x0200) | 915 | if (mii_reg & 0x0200) |
899 | *s |= PHY_STAT_10FDX; | 916 | status |= PHY_STAT_10FDX; |
900 | else | 917 | else |
901 | *s |= PHY_STAT_10HDX; | 918 | status |= PHY_STAT_10HDX; |
902 | } | 919 | } |
903 | if (mii_reg & 0x0008) | 920 | if (mii_reg & 0x0008) |
904 | *s |= PHY_STAT_FAULT; | 921 | status |= PHY_STAT_FAULT; |
905 | } | ||
906 | 922 | ||
907 | static phy_info_t phy_info_lxt971 = { | 923 | *s = status; |
908 | 0x0001378e, | 924 | } |
909 | "LXT971", | ||
910 | 925 | ||
911 | (const phy_cmd_t []) { /* config */ | 926 | static phy_cmd_t const phy_cmd_lxt971_config[] = { |
912 | /* limit to 10MBit because my protorype board | 927 | /* limit to 10MBit because my prototype board |
913 | * doesn't work with 100. */ | 928 | * doesn't work with 100. */ |
914 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 929 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
915 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 930 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
916 | { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 }, | 931 | { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 }, |
917 | { mk_mii_end, } | 932 | { mk_mii_end, } |
918 | }, | 933 | }; |
919 | (const phy_cmd_t []) { /* startup - enable interrupts */ | 934 | static phy_cmd_t const phy_cmd_lxt971_startup[] = { /* enable interrupts */ |
920 | { mk_mii_write(MII_LXT971_IER, 0x00f2), NULL }, | 935 | { mk_mii_write(MII_LXT971_IER, 0x00f2), NULL }, |
921 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 936 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
922 | { mk_mii_write(MII_LXT971_LCR, 0xd422), NULL }, /* LED config */ | 937 | { mk_mii_write(MII_LXT971_LCR, 0xd422), NULL }, /* LED config */ |
@@ -925,19 +940,26 @@ static phy_info_t phy_info_lxt971 = { | |||
925 | * read here to get a valid value in ack_int */ | 940 | * read here to get a valid value in ack_int */ |
926 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 941 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
927 | { mk_mii_end, } | 942 | { mk_mii_end, } |
928 | }, | 943 | }; |
929 | (const phy_cmd_t []) { /* ack_int */ | 944 | static phy_cmd_t const phy_cmd_lxt971_ack_int[] = { |
945 | /* acknowledge the int before reading status ! */ | ||
946 | { mk_mii_read(MII_LXT971_ISR), NULL }, | ||
930 | /* find out the current status */ | 947 | /* find out the current status */ |
931 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 948 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
932 | { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 }, | 949 | { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 }, |
933 | /* we only need to read ISR to acknowledge */ | ||
934 | { mk_mii_read(MII_LXT971_ISR), NULL }, | ||
935 | { mk_mii_end, } | 950 | { mk_mii_end, } |
936 | }, | 951 | }; |
937 | (const phy_cmd_t []) { /* shutdown - disable interrupts */ | 952 | static phy_cmd_t const phy_cmd_lxt971_shutdown[] = { /* disable interrupts */ |
938 | { mk_mii_write(MII_LXT971_IER, 0x0000), NULL }, | 953 | { mk_mii_write(MII_LXT971_IER, 0x0000), NULL }, |
939 | { mk_mii_end, } | 954 | { mk_mii_end, } |
940 | }, | 955 | }; |
956 | static phy_info_t const phy_info_lxt971 = { | ||
957 | .id = 0x0001378e, | ||
958 | .name = "LXT971", | ||
959 | .config = phy_cmd_lxt971_config, | ||
960 | .startup = phy_cmd_lxt971_startup, | ||
961 | .ack_int = phy_cmd_lxt971_ack_int, | ||
962 | .shutdown = phy_cmd_lxt971_shutdown | ||
941 | }; | 963 | }; |
942 | 964 | ||
943 | /* ------------------------------------------------------------------------- */ | 965 | /* ------------------------------------------------------------------------- */ |
@@ -956,22 +978,21 @@ static void mii_parse_qs6612_pcr(uint mii_reg, struct net_device *dev) | |||
956 | { | 978 | { |
957 | struct fec_enet_private *fep = netdev_priv(dev); | 979 | struct fec_enet_private *fep = netdev_priv(dev); |
958 | volatile uint *s = &(fep->phy_status); | 980 | volatile uint *s = &(fep->phy_status); |
981 | uint status; | ||
959 | 982 | ||
960 | *s &= ~(PHY_STAT_SPMASK); | 983 | status = *s & ~(PHY_STAT_SPMASK); |
961 | 984 | ||
962 | switch((mii_reg >> 2) & 7) { | 985 | switch((mii_reg >> 2) & 7) { |
963 | case 1: *s |= PHY_STAT_10HDX; break; | 986 | case 1: status |= PHY_STAT_10HDX; break; |
964 | case 2: *s |= PHY_STAT_100HDX; break; | 987 | case 2: status |= PHY_STAT_100HDX; break; |
965 | case 5: *s |= PHY_STAT_10FDX; break; | 988 | case 5: status |= PHY_STAT_10FDX; break; |
966 | case 6: *s |= PHY_STAT_100FDX; break; | 989 | case 6: status |= PHY_STAT_100FDX; break; |
967 | } | ||
968 | } | 990 | } |
969 | 991 | ||
970 | static phy_info_t phy_info_qs6612 = { | 992 | *s = status; |
971 | 0x00181440, | 993 | } |
972 | "QS6612", | 994 | |
973 | 995 | static phy_cmd_t const phy_cmd_qs6612_config[] = { | |
974 | (const phy_cmd_t []) { /* config */ | ||
975 | /* The PHY powers up isolated on the RPX, | 996 | /* The PHY powers up isolated on the RPX, |
976 | * so send a command to allow operation. | 997 | * so send a command to allow operation. |
977 | */ | 998 | */ |
@@ -981,13 +1002,13 @@ static phy_info_t phy_info_qs6612 = { | |||
981 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 1002 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
982 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 1003 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
983 | { mk_mii_end, } | 1004 | { mk_mii_end, } |
984 | }, | 1005 | }; |
985 | (const phy_cmd_t []) { /* startup - enable interrupts */ | 1006 | static phy_cmd_t const phy_cmd_qs6612_startup[] = { /* enable interrupts */ |
986 | { mk_mii_write(MII_QS6612_IMR, 0x003a), NULL }, | 1007 | { mk_mii_write(MII_QS6612_IMR, 0x003a), NULL }, |
987 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 1008 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
988 | { mk_mii_end, } | 1009 | { mk_mii_end, } |
989 | }, | 1010 | }; |
990 | (const phy_cmd_t []) { /* ack_int */ | 1011 | static phy_cmd_t const phy_cmd_qs6612_ack_int[] = { |
991 | /* we need to read ISR, SR and ANER to acknowledge */ | 1012 | /* we need to read ISR, SR and ANER to acknowledge */ |
992 | { mk_mii_read(MII_QS6612_ISR), NULL }, | 1013 | { mk_mii_read(MII_QS6612_ISR), NULL }, |
993 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1014 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
@@ -996,11 +1017,18 @@ static phy_info_t phy_info_qs6612 = { | |||
996 | /* read pcr to get info */ | 1017 | /* read pcr to get info */ |
997 | { mk_mii_read(MII_QS6612_PCR), mii_parse_qs6612_pcr }, | 1018 | { mk_mii_read(MII_QS6612_PCR), mii_parse_qs6612_pcr }, |
998 | { mk_mii_end, } | 1019 | { mk_mii_end, } |
999 | }, | 1020 | }; |
1000 | (const phy_cmd_t []) { /* shutdown - disable interrupts */ | 1021 | static phy_cmd_t const phy_cmd_qs6612_shutdown[] = { /* disable interrupts */ |
1001 | { mk_mii_write(MII_QS6612_IMR, 0x0000), NULL }, | 1022 | { mk_mii_write(MII_QS6612_IMR, 0x0000), NULL }, |
1002 | { mk_mii_end, } | 1023 | { mk_mii_end, } |
1003 | }, | 1024 | }; |
1025 | static phy_info_t const phy_info_qs6612 = { | ||
1026 | .id = 0x00181440, | ||
1027 | .name = "QS6612", | ||
1028 | .config = phy_cmd_qs6612_config, | ||
1029 | .startup = phy_cmd_qs6612_startup, | ||
1030 | .ack_int = phy_cmd_qs6612_ack_int, | ||
1031 | .shutdown = phy_cmd_qs6612_shutdown | ||
1004 | }; | 1032 | }; |
1005 | 1033 | ||
1006 | /* ------------------------------------------------------------------------- */ | 1034 | /* ------------------------------------------------------------------------- */ |
@@ -1020,49 +1048,54 @@ static void mii_parse_am79c874_dr(uint mii_reg, struct net_device *dev) | |||
1020 | { | 1048 | { |
1021 | struct fec_enet_private *fep = netdev_priv(dev); | 1049 | struct fec_enet_private *fep = netdev_priv(dev); |
1022 | volatile uint *s = &(fep->phy_status); | 1050 | volatile uint *s = &(fep->phy_status); |
1051 | uint status; | ||
1023 | 1052 | ||
1024 | *s &= ~(PHY_STAT_SPMASK | PHY_STAT_ANC); | 1053 | status = *s & ~(PHY_STAT_SPMASK | PHY_STAT_ANC); |
1025 | 1054 | ||
1026 | if (mii_reg & 0x0080) | 1055 | if (mii_reg & 0x0080) |
1027 | *s |= PHY_STAT_ANC; | 1056 | status |= PHY_STAT_ANC; |
1028 | if (mii_reg & 0x0400) | 1057 | if (mii_reg & 0x0400) |
1029 | *s |= ((mii_reg & 0x0800) ? PHY_STAT_100FDX : PHY_STAT_100HDX); | 1058 | status |= ((mii_reg & 0x0800) ? PHY_STAT_100FDX : PHY_STAT_100HDX); |
1030 | else | 1059 | else |
1031 | *s |= ((mii_reg & 0x0800) ? PHY_STAT_10FDX : PHY_STAT_10HDX); | 1060 | status |= ((mii_reg & 0x0800) ? PHY_STAT_10FDX : PHY_STAT_10HDX); |
1061 | |||
1062 | *s = status; | ||
1032 | } | 1063 | } |
1033 | 1064 | ||
1034 | static phy_info_t phy_info_am79c874 = { | 1065 | static phy_cmd_t const phy_cmd_am79c874_config[] = { |
1035 | 0x00022561, | ||
1036 | "AM79C874", | ||
1037 | |||
1038 | (const phy_cmd_t []) { /* config */ | ||
1039 | /* limit to 10MBit because my protorype board | ||
1040 | * doesn't work with 100. */ | ||
1041 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 1066 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
1042 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 1067 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
1043 | { mk_mii_read(MII_AM79C874_DR), mii_parse_am79c874_dr }, | 1068 | { mk_mii_read(MII_AM79C874_DR), mii_parse_am79c874_dr }, |
1044 | { mk_mii_end, } | 1069 | { mk_mii_end, } |
1045 | }, | 1070 | }; |
1046 | (const phy_cmd_t []) { /* startup - enable interrupts */ | 1071 | static phy_cmd_t const phy_cmd_am79c874_startup[] = { /* enable interrupts */ |
1047 | { mk_mii_write(MII_AM79C874_ICSR, 0xff00), NULL }, | 1072 | { mk_mii_write(MII_AM79C874_ICSR, 0xff00), NULL }, |
1048 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 1073 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
1049 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1074 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
1050 | { mk_mii_end, } | 1075 | { mk_mii_end, } |
1051 | }, | 1076 | }; |
1052 | (const phy_cmd_t []) { /* ack_int */ | 1077 | static phy_cmd_t const phy_cmd_am79c874_ack_int[] = { |
1053 | /* find out the current status */ | 1078 | /* find out the current status */ |
1054 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1079 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
1055 | { mk_mii_read(MII_AM79C874_DR), mii_parse_am79c874_dr }, | 1080 | { mk_mii_read(MII_AM79C874_DR), mii_parse_am79c874_dr }, |
1056 | /* we only need to read ISR to acknowledge */ | 1081 | /* we only need to read ISR to acknowledge */ |
1057 | { mk_mii_read(MII_AM79C874_ICSR), NULL }, | 1082 | { mk_mii_read(MII_AM79C874_ICSR), NULL }, |
1058 | { mk_mii_end, } | 1083 | { mk_mii_end, } |
1059 | }, | 1084 | }; |
1060 | (const phy_cmd_t []) { /* shutdown - disable interrupts */ | 1085 | static phy_cmd_t const phy_cmd_am79c874_shutdown[] = { /* disable interrupts */ |
1061 | { mk_mii_write(MII_AM79C874_ICSR, 0x0000), NULL }, | 1086 | { mk_mii_write(MII_AM79C874_ICSR, 0x0000), NULL }, |
1062 | { mk_mii_end, } | 1087 | { mk_mii_end, } |
1063 | }, | 1088 | }; |
1089 | static phy_info_t const phy_info_am79c874 = { | ||
1090 | .id = 0x00022561, | ||
1091 | .name = "AM79C874", | ||
1092 | .config = phy_cmd_am79c874_config, | ||
1093 | .startup = phy_cmd_am79c874_startup, | ||
1094 | .ack_int = phy_cmd_am79c874_ack_int, | ||
1095 | .shutdown = phy_cmd_am79c874_shutdown | ||
1064 | }; | 1096 | }; |
1065 | 1097 | ||
1098 | |||
1066 | /* ------------------------------------------------------------------------- */ | 1099 | /* ------------------------------------------------------------------------- */ |
1067 | /* Kendin KS8721BL phy */ | 1100 | /* Kendin KS8721BL phy */ |
1068 | 1101 | ||
@@ -1072,37 +1105,40 @@ static phy_info_t phy_info_am79c874 = { | |||
1072 | #define MII_KS8721BL_ICSR 22 | 1105 | #define MII_KS8721BL_ICSR 22 |
1073 | #define MII_KS8721BL_PHYCR 31 | 1106 | #define MII_KS8721BL_PHYCR 31 |
1074 | 1107 | ||
1075 | static phy_info_t phy_info_ks8721bl = { | 1108 | static phy_cmd_t const phy_cmd_ks8721bl_config[] = { |
1076 | 0x00022161, | ||
1077 | "KS8721BL", | ||
1078 | |||
1079 | (const phy_cmd_t []) { /* config */ | ||
1080 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 1109 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
1081 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 1110 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
1082 | { mk_mii_end, } | 1111 | { mk_mii_end, } |
1083 | }, | 1112 | }; |
1084 | (const phy_cmd_t []) { /* startup */ | 1113 | static phy_cmd_t const phy_cmd_ks8721bl_startup[] = { /* enable interrupts */ |
1085 | { mk_mii_write(MII_KS8721BL_ICSR, 0xff00), NULL }, | 1114 | { mk_mii_write(MII_KS8721BL_ICSR, 0xff00), NULL }, |
1086 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 1115 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
1087 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1116 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
1088 | { mk_mii_end, } | 1117 | { mk_mii_end, } |
1089 | }, | 1118 | }; |
1090 | (const phy_cmd_t []) { /* ack_int */ | 1119 | static phy_cmd_t const phy_cmd_ks8721bl_ack_int[] = { |
1091 | /* find out the current status */ | 1120 | /* find out the current status */ |
1092 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1121 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
1093 | /* we only need to read ISR to acknowledge */ | 1122 | /* we only need to read ISR to acknowledge */ |
1094 | { mk_mii_read(MII_KS8721BL_ICSR), NULL }, | 1123 | { mk_mii_read(MII_KS8721BL_ICSR), NULL }, |
1095 | { mk_mii_end, } | 1124 | { mk_mii_end, } |
1096 | }, | 1125 | }; |
1097 | (const phy_cmd_t []) { /* shutdown */ | 1126 | static phy_cmd_t const phy_cmd_ks8721bl_shutdown[] = { /* disable interrupts */ |
1098 | { mk_mii_write(MII_KS8721BL_ICSR, 0x0000), NULL }, | 1127 | { mk_mii_write(MII_KS8721BL_ICSR, 0x0000), NULL }, |
1099 | { mk_mii_end, } | 1128 | { mk_mii_end, } |
1100 | }, | 1129 | }; |
1130 | static phy_info_t const phy_info_ks8721bl = { | ||
1131 | .id = 0x00022161, | ||
1132 | .name = "KS8721BL", | ||
1133 | .config = phy_cmd_ks8721bl_config, | ||
1134 | .startup = phy_cmd_ks8721bl_startup, | ||
1135 | .ack_int = phy_cmd_ks8721bl_ack_int, | ||
1136 | .shutdown = phy_cmd_ks8721bl_shutdown | ||
1101 | }; | 1137 | }; |
1102 | 1138 | ||
1103 | /* ------------------------------------------------------------------------- */ | 1139 | /* ------------------------------------------------------------------------- */ |
1104 | 1140 | ||
1105 | static phy_info_t *phy_info[] = { | 1141 | static phy_info_t const * const phy_info[] = { |
1106 | &phy_info_lxt970, | 1142 | &phy_info_lxt970, |
1107 | &phy_info_lxt971, | 1143 | &phy_info_lxt971, |
1108 | &phy_info_qs6612, | 1144 | &phy_info_qs6612, |
@@ -1129,16 +1165,23 @@ mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs); | |||
1129 | static void __inline__ fec_request_intrs(struct net_device *dev) | 1165 | static void __inline__ fec_request_intrs(struct net_device *dev) |
1130 | { | 1166 | { |
1131 | volatile unsigned long *icrp; | 1167 | volatile unsigned long *icrp; |
1168 | static const struct idesc { | ||
1169 | char *name; | ||
1170 | unsigned short irq; | ||
1171 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | ||
1172 | } *idp, id[] = { | ||
1173 | { "fec(RX)", 86, fec_enet_interrupt }, | ||
1174 | { "fec(TX)", 87, fec_enet_interrupt }, | ||
1175 | { "fec(OTHER)", 88, fec_enet_interrupt }, | ||
1176 | { "fec(MII)", 66, mii_link_interrupt }, | ||
1177 | { NULL }, | ||
1178 | }; | ||
1132 | 1179 | ||
1133 | /* Setup interrupt handlers. */ | 1180 | /* Setup interrupt handlers. */ |
1134 | if (request_irq(86, fec_enet_interrupt, 0, "fec(RX)", dev) != 0) | 1181 | for (idp = id; idp->name; idp++) { |
1135 | printk("FEC: Could not allocate FEC(RC) IRQ(86)!\n"); | 1182 | if (request_irq(idp->irq, idp->handler, 0, idp->name, dev) != 0) |
1136 | if (request_irq(87, fec_enet_interrupt, 0, "fec(TX)", dev) != 0) | 1183 | printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, idp->irq); |
1137 | printk("FEC: Could not allocate FEC(RC) IRQ(87)!\n"); | 1184 | } |
1138 | if (request_irq(88, fec_enet_interrupt, 0, "fec(OTHER)", dev) != 0) | ||
1139 | printk("FEC: Could not allocate FEC(OTHER) IRQ(88)!\n"); | ||
1140 | if (request_irq(66, mii_link_interrupt, 0, "fec(MII)", dev) != 0) | ||
1141 | printk("FEC: Could not allocate MII IRQ(66)!\n"); | ||
1142 | 1185 | ||
1143 | /* Unmask interrupt at ColdFire 5272 SIM */ | 1186 | /* Unmask interrupt at ColdFire 5272 SIM */ |
1144 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR3); | 1187 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR3); |
@@ -1169,17 +1212,16 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1169 | { | 1212 | { |
1170 | struct fec_enet_private *fep = netdev_priv(dev); | 1213 | struct fec_enet_private *fep = netdev_priv(dev); |
1171 | volatile fec_t *fecp; | 1214 | volatile fec_t *fecp; |
1172 | unsigned char *iap, tmpaddr[6]; | 1215 | unsigned char *iap, tmpaddr[ETH_ALEN]; |
1173 | int i; | ||
1174 | 1216 | ||
1175 | fecp = fep->hwp; | 1217 | fecp = fep->hwp; |
1176 | 1218 | ||
1177 | if (fec_flashmac) { | 1219 | if (FEC_FLASHMAC) { |
1178 | /* | 1220 | /* |
1179 | * Get MAC address from FLASH. | 1221 | * Get MAC address from FLASH. |
1180 | * If it is all 1's or 0's, use the default. | 1222 | * If it is all 1's or 0's, use the default. |
1181 | */ | 1223 | */ |
1182 | iap = fec_flashmac; | 1224 | iap = (unsigned char *)FEC_FLASHMAC; |
1183 | if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) && | 1225 | if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) && |
1184 | (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0)) | 1226 | (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0)) |
1185 | iap = fec_mac_default; | 1227 | iap = fec_mac_default; |
@@ -1192,14 +1234,11 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1192 | iap = &tmpaddr[0]; | 1234 | iap = &tmpaddr[0]; |
1193 | } | 1235 | } |
1194 | 1236 | ||
1195 | for (i=0; i<ETH_ALEN; i++) | 1237 | memcpy(dev->dev_addr, iap, ETH_ALEN); |
1196 | dev->dev_addr[i] = fep->mac_addr[i] = *iap++; | ||
1197 | 1238 | ||
1198 | /* Adjust MAC if using default MAC address */ | 1239 | /* Adjust MAC if using default MAC address */ |
1199 | if (iap == fec_mac_default) { | 1240 | if (iap == fec_mac_default) |
1200 | dev->dev_addr[ETH_ALEN-1] = fep->mac_addr[ETH_ALEN-1] = | 1241 | dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index; |
1201 | iap[ETH_ALEN-1] + fep->index; | ||
1202 | } | ||
1203 | } | 1242 | } |
1204 | 1243 | ||
1205 | static void __inline__ fec_enable_phy_intr(void) | 1244 | static void __inline__ fec_enable_phy_intr(void) |
@@ -1234,48 +1273,44 @@ static void __inline__ fec_uncache(unsigned long addr) | |||
1234 | 1273 | ||
1235 | /* ------------------------------------------------------------------------- */ | 1274 | /* ------------------------------------------------------------------------- */ |
1236 | 1275 | ||
1237 | #elif defined(CONFIG_M527x) || defined(CONFIG_M528x) | 1276 | #elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) |
1238 | 1277 | ||
1239 | /* | 1278 | /* |
1240 | * Code specific to Coldfire 5270/5271/5274/5275 and 5280/5282 setups. | 1279 | * Code specific to Coldfire 5230/5231/5232/5234/5235, |
1280 | * the 5270/5271/5274/5275 and 5280/5282 setups. | ||
1241 | */ | 1281 | */ |
1242 | static void __inline__ fec_request_intrs(struct net_device *dev) | 1282 | static void __inline__ fec_request_intrs(struct net_device *dev) |
1243 | { | 1283 | { |
1244 | struct fec_enet_private *fep; | 1284 | struct fec_enet_private *fep; |
1245 | int b; | 1285 | int b; |
1286 | static const struct idesc { | ||
1287 | char *name; | ||
1288 | unsigned short irq; | ||
1289 | } *idp, id[] = { | ||
1290 | { "fec(TXF)", 23 }, | ||
1291 | { "fec(TXB)", 24 }, | ||
1292 | { "fec(TXFIFO)", 25 }, | ||
1293 | { "fec(TXCR)", 26 }, | ||
1294 | { "fec(RXF)", 27 }, | ||
1295 | { "fec(RXB)", 28 }, | ||
1296 | { "fec(MII)", 29 }, | ||
1297 | { "fec(LC)", 30 }, | ||
1298 | { "fec(HBERR)", 31 }, | ||
1299 | { "fec(GRA)", 32 }, | ||
1300 | { "fec(EBERR)", 33 }, | ||
1301 | { "fec(BABT)", 34 }, | ||
1302 | { "fec(BABR)", 35 }, | ||
1303 | { NULL }, | ||
1304 | }; | ||
1246 | 1305 | ||
1247 | fep = netdev_priv(dev); | 1306 | fep = netdev_priv(dev); |
1248 | b = (fep->index) ? 128 : 64; | 1307 | b = (fep->index) ? 128 : 64; |
1249 | 1308 | ||
1250 | /* Setup interrupt handlers. */ | 1309 | /* Setup interrupt handlers. */ |
1251 | if (request_irq(b+23, fec_enet_interrupt, 0, "fec(TXF)", dev) != 0) | 1310 | for (idp = id; idp->name; idp++) { |
1252 | printk("FEC: Could not allocate FEC(TXF) IRQ(%d+23)!\n", b); | 1311 | if (request_irq(b+idp->irq, fec_enet_interrupt, 0, idp->name, dev) != 0) |
1253 | if (request_irq(b+24, fec_enet_interrupt, 0, "fec(TXB)", dev) != 0) | 1312 | printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, b+idp->irq); |
1254 | printk("FEC: Could not allocate FEC(TXB) IRQ(%d+24)!\n", b); | 1313 | } |
1255 | if (request_irq(b+25, fec_enet_interrupt, 0, "fec(TXFIFO)", dev) != 0) | ||
1256 | printk("FEC: Could not allocate FEC(TXFIFO) IRQ(%d+25)!\n", b); | ||
1257 | if (request_irq(b+26, fec_enet_interrupt, 0, "fec(TXCR)", dev) != 0) | ||
1258 | printk("FEC: Could not allocate FEC(TXCR) IRQ(%d+26)!\n", b); | ||
1259 | |||
1260 | if (request_irq(b+27, fec_enet_interrupt, 0, "fec(RXF)", dev) != 0) | ||
1261 | printk("FEC: Could not allocate FEC(RXF) IRQ(%d+27)!\n", b); | ||
1262 | if (request_irq(b+28, fec_enet_interrupt, 0, "fec(RXB)", dev) != 0) | ||
1263 | printk("FEC: Could not allocate FEC(RXB) IRQ(%d+28)!\n", b); | ||
1264 | |||
1265 | if (request_irq(b+29, fec_enet_interrupt, 0, "fec(MII)", dev) != 0) | ||
1266 | printk("FEC: Could not allocate FEC(MII) IRQ(%d+29)!\n", b); | ||
1267 | if (request_irq(b+30, fec_enet_interrupt, 0, "fec(LC)", dev) != 0) | ||
1268 | printk("FEC: Could not allocate FEC(LC) IRQ(%d+30)!\n", b); | ||
1269 | if (request_irq(b+31, fec_enet_interrupt, 0, "fec(HBERR)", dev) != 0) | ||
1270 | printk("FEC: Could not allocate FEC(HBERR) IRQ(%d+31)!\n", b); | ||
1271 | if (request_irq(b+32, fec_enet_interrupt, 0, "fec(GRA)", dev) != 0) | ||
1272 | printk("FEC: Could not allocate FEC(GRA) IRQ(%d+32)!\n", b); | ||
1273 | if (request_irq(b+33, fec_enet_interrupt, 0, "fec(EBERR)", dev) != 0) | ||
1274 | printk("FEC: Could not allocate FEC(EBERR) IRQ(%d+33)!\n", b); | ||
1275 | if (request_irq(b+34, fec_enet_interrupt, 0, "fec(BABT)", dev) != 0) | ||
1276 | printk("FEC: Could not allocate FEC(BABT) IRQ(%d+34)!\n", b); | ||
1277 | if (request_irq(b+35, fec_enet_interrupt, 0, "fec(BABR)", dev) != 0) | ||
1278 | printk("FEC: Could not allocate FEC(BABR) IRQ(%d+35)!\n", b); | ||
1279 | 1314 | ||
1280 | /* Unmask interrupts at ColdFire 5280/5282 interrupt controller */ | 1315 | /* Unmask interrupts at ColdFire 5280/5282 interrupt controller */ |
1281 | { | 1316 | { |
@@ -1300,11 +1335,13 @@ static void __inline__ fec_request_intrs(struct net_device *dev) | |||
1300 | #if defined(CONFIG_M528x) | 1335 | #if defined(CONFIG_M528x) |
1301 | /* Set up gpio outputs for MII lines */ | 1336 | /* Set up gpio outputs for MII lines */ |
1302 | { | 1337 | { |
1303 | volatile unsigned short *gpio_paspar; | 1338 | volatile u16 *gpio_paspar; |
1339 | volatile u8 *gpio_pehlpar; | ||
1304 | 1340 | ||
1305 | gpio_paspar = (volatile unsigned short *) (MCF_IPSBAR + | 1341 | gpio_paspar = (volatile u16 *) (MCF_IPSBAR + 0x100056); |
1306 | 0x100056); | 1342 | gpio_pehlpar = (volatile u16 *) (MCF_IPSBAR + 0x100058); |
1307 | *gpio_paspar = 0x0f00; | 1343 | *gpio_paspar |= 0x0f00; |
1344 | *gpio_pehlpar = 0xc0; | ||
1308 | } | 1345 | } |
1309 | #endif | 1346 | #endif |
1310 | } | 1347 | } |
@@ -1331,17 +1368,16 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1331 | { | 1368 | { |
1332 | struct fec_enet_private *fep = netdev_priv(dev); | 1369 | struct fec_enet_private *fep = netdev_priv(dev); |
1333 | volatile fec_t *fecp; | 1370 | volatile fec_t *fecp; |
1334 | unsigned char *iap, tmpaddr[6]; | 1371 | unsigned char *iap, tmpaddr[ETH_ALEN]; |
1335 | int i; | ||
1336 | 1372 | ||
1337 | fecp = fep->hwp; | 1373 | fecp = fep->hwp; |
1338 | 1374 | ||
1339 | if (fec_flashmac) { | 1375 | if (FEC_FLASHMAC) { |
1340 | /* | 1376 | /* |
1341 | * Get MAC address from FLASH. | 1377 | * Get MAC address from FLASH. |
1342 | * If it is all 1's or 0's, use the default. | 1378 | * If it is all 1's or 0's, use the default. |
1343 | */ | 1379 | */ |
1344 | iap = fec_flashmac; | 1380 | iap = FEC_FLASHMAC; |
1345 | if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) && | 1381 | if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) && |
1346 | (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0)) | 1382 | (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0)) |
1347 | iap = fec_mac_default; | 1383 | iap = fec_mac_default; |
@@ -1354,14 +1390,11 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1354 | iap = &tmpaddr[0]; | 1390 | iap = &tmpaddr[0]; |
1355 | } | 1391 | } |
1356 | 1392 | ||
1357 | for (i=0; i<ETH_ALEN; i++) | 1393 | memcpy(dev->dev_addr, iap, ETH_ALEN); |
1358 | dev->dev_addr[i] = fep->mac_addr[i] = *iap++; | ||
1359 | 1394 | ||
1360 | /* Adjust MAC if using default MAC address */ | 1395 | /* Adjust MAC if using default MAC address */ |
1361 | if (iap == fec_mac_default) { | 1396 | if (iap == fec_mac_default) |
1362 | dev->dev_addr[ETH_ALEN-1] = fep->mac_addr[ETH_ALEN-1] = | 1397 | dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index; |
1363 | iap[ETH_ALEN-1] + fep->index; | ||
1364 | } | ||
1365 | } | 1398 | } |
1366 | 1399 | ||
1367 | static void __inline__ fec_enable_phy_intr(void) | 1400 | static void __inline__ fec_enable_phy_intr(void) |
@@ -1392,7 +1425,7 @@ static void __inline__ fec_uncache(unsigned long addr) | |||
1392 | #else | 1425 | #else |
1393 | 1426 | ||
1394 | /* | 1427 | /* |
1395 | * Code sepcific to the MPC860T setup. | 1428 | * Code specific to the MPC860T setup. |
1396 | */ | 1429 | */ |
1397 | static void __inline__ fec_request_intrs(struct net_device *dev) | 1430 | static void __inline__ fec_request_intrs(struct net_device *dev) |
1398 | { | 1431 | { |
@@ -1424,13 +1457,10 @@ static void __inline__ fec_request_intrs(struct net_device *dev) | |||
1424 | 1457 | ||
1425 | static void __inline__ fec_get_mac(struct net_device *dev) | 1458 | static void __inline__ fec_get_mac(struct net_device *dev) |
1426 | { | 1459 | { |
1427 | struct fec_enet_private *fep = netdev_priv(dev); | ||
1428 | unsigned char *iap, tmpaddr[6]; | ||
1429 | bd_t *bd; | 1460 | bd_t *bd; |
1430 | int i; | ||
1431 | 1461 | ||
1432 | iap = bd->bi_enetaddr; | ||
1433 | bd = (bd_t *)__res; | 1462 | bd = (bd_t *)__res; |
1463 | memcpy(dev->dev_addr, bd->bi_enetaddr, ETH_ALEN); | ||
1434 | 1464 | ||
1435 | #ifdef CONFIG_RPXCLASSIC | 1465 | #ifdef CONFIG_RPXCLASSIC |
1436 | /* The Embedded Planet boards have only one MAC address in | 1466 | /* The Embedded Planet boards have only one MAC address in |
@@ -1439,14 +1469,8 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1439 | * the address bits above something that would have (up to | 1469 | * the address bits above something that would have (up to |
1440 | * now) been allocated. | 1470 | * now) been allocated. |
1441 | */ | 1471 | */ |
1442 | for (i=0; i<6; i++) | 1472 | dev->dev_adrd[3] |= 0x80; |
1443 | tmpaddr[i] = *iap++; | ||
1444 | tmpaddr[3] |= 0x80; | ||
1445 | iap = tmpaddr; | ||
1446 | #endif | 1473 | #endif |
1447 | |||
1448 | for (i=0; i<6; i++) | ||
1449 | dev->dev_addr[i] = fep->mac_addr[i] = *iap++; | ||
1450 | } | 1474 | } |
1451 | 1475 | ||
1452 | static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep) | 1476 | static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep) |
@@ -1556,7 +1580,7 @@ static void mii_display_status(struct net_device *dev) | |||
1556 | static void mii_display_config(struct net_device *dev) | 1580 | static void mii_display_config(struct net_device *dev) |
1557 | { | 1581 | { |
1558 | struct fec_enet_private *fep = netdev_priv(dev); | 1582 | struct fec_enet_private *fep = netdev_priv(dev); |
1559 | volatile uint *s = &(fep->phy_status); | 1583 | uint status = fep->phy_status; |
1560 | 1584 | ||
1561 | /* | 1585 | /* |
1562 | ** When we get here, phy_task is already removed from | 1586 | ** When we get here, phy_task is already removed from |
@@ -1565,23 +1589,23 @@ static void mii_display_config(struct net_device *dev) | |||
1565 | fep->mii_phy_task_queued = 0; | 1589 | fep->mii_phy_task_queued = 0; |
1566 | printk("%s: config: auto-negotiation ", dev->name); | 1590 | printk("%s: config: auto-negotiation ", dev->name); |
1567 | 1591 | ||
1568 | if (*s & PHY_CONF_ANE) | 1592 | if (status & PHY_CONF_ANE) |
1569 | printk("on"); | 1593 | printk("on"); |
1570 | else | 1594 | else |
1571 | printk("off"); | 1595 | printk("off"); |
1572 | 1596 | ||
1573 | if (*s & PHY_CONF_100FDX) | 1597 | if (status & PHY_CONF_100FDX) |
1574 | printk(", 100FDX"); | 1598 | printk(", 100FDX"); |
1575 | if (*s & PHY_CONF_100HDX) | 1599 | if (status & PHY_CONF_100HDX) |
1576 | printk(", 100HDX"); | 1600 | printk(", 100HDX"); |
1577 | if (*s & PHY_CONF_10FDX) | 1601 | if (status & PHY_CONF_10FDX) |
1578 | printk(", 10FDX"); | 1602 | printk(", 10FDX"); |
1579 | if (*s & PHY_CONF_10HDX) | 1603 | if (status & PHY_CONF_10HDX) |
1580 | printk(", 10HDX"); | 1604 | printk(", 10HDX"); |
1581 | if (!(*s & PHY_CONF_SPMASK)) | 1605 | if (!(status & PHY_CONF_SPMASK)) |
1582 | printk(", No speed/duplex selected?"); | 1606 | printk(", No speed/duplex selected?"); |
1583 | 1607 | ||
1584 | if (*s & PHY_CONF_LOOP) | 1608 | if (status & PHY_CONF_LOOP) |
1585 | printk(", loopback enabled"); | 1609 | printk(", loopback enabled"); |
1586 | 1610 | ||
1587 | printk(".\n"); | 1611 | printk(".\n"); |
@@ -1639,7 +1663,7 @@ static void mii_queue_relink(uint mii_reg, struct net_device *dev) | |||
1639 | schedule_work(&fep->phy_task); | 1663 | schedule_work(&fep->phy_task); |
1640 | } | 1664 | } |
1641 | 1665 | ||
1642 | /* mii_queue_config is called in user context from fec_enet_open */ | 1666 | /* mii_queue_config is called in interrupt context from fec_enet_mii */ |
1643 | static void mii_queue_config(uint mii_reg, struct net_device *dev) | 1667 | static void mii_queue_config(uint mii_reg, struct net_device *dev) |
1644 | { | 1668 | { |
1645 | struct fec_enet_private *fep = netdev_priv(dev); | 1669 | struct fec_enet_private *fep = netdev_priv(dev); |
@@ -1652,14 +1676,14 @@ static void mii_queue_config(uint mii_reg, struct net_device *dev) | |||
1652 | schedule_work(&fep->phy_task); | 1676 | schedule_work(&fep->phy_task); |
1653 | } | 1677 | } |
1654 | 1678 | ||
1655 | 1679 | phy_cmd_t const phy_cmd_relink[] = { | |
1656 | 1680 | { mk_mii_read(MII_REG_CR), mii_queue_relink }, | |
1657 | phy_cmd_t phy_cmd_relink[] = { { mk_mii_read(MII_REG_CR), mii_queue_relink }, | 1681 | { mk_mii_end, } |
1658 | { mk_mii_end, } }; | 1682 | }; |
1659 | phy_cmd_t phy_cmd_config[] = { { mk_mii_read(MII_REG_CR), mii_queue_config }, | 1683 | phy_cmd_t const phy_cmd_config[] = { |
1660 | { mk_mii_end, } }; | 1684 | { mk_mii_read(MII_REG_CR), mii_queue_config }, |
1661 | 1685 | { mk_mii_end, } | |
1662 | 1686 | }; | |
1663 | 1687 | ||
1664 | /* Read remainder of PHY ID. | 1688 | /* Read remainder of PHY ID. |
1665 | */ | 1689 | */ |
@@ -1897,17 +1921,15 @@ static void set_multicast_list(struct net_device *dev) | |||
1897 | static void | 1921 | static void |
1898 | fec_set_mac_address(struct net_device *dev) | 1922 | fec_set_mac_address(struct net_device *dev) |
1899 | { | 1923 | { |
1900 | struct fec_enet_private *fep; | ||
1901 | volatile fec_t *fecp; | 1924 | volatile fec_t *fecp; |
1902 | 1925 | ||
1903 | fep = netdev_priv(dev); | 1926 | fecp = ((struct fec_enet_private *)netdev_priv(dev))->hwp; |
1904 | fecp = fep->hwp; | ||
1905 | 1927 | ||
1906 | /* Set station address. */ | 1928 | /* Set station address. */ |
1907 | fecp->fec_addr_low = fep->mac_addr[3] | (fep->mac_addr[2] << 8) | | 1929 | fecp->fec_addr_low = dev->dev_addr[3] | (dev->dev_addr[2] << 8) | |
1908 | (fep->mac_addr[1] << 16) | (fep->mac_addr[0] << 24); | 1930 | (dev->dev_addr[1] << 16) | (dev->dev_addr[0] << 24); |
1909 | fecp->fec_addr_high = (fep->mac_addr[5] << 16) | | 1931 | fecp->fec_addr_high = (dev->dev_addr[5] << 16) | |
1910 | (fep->mac_addr[4] << 24); | 1932 | (dev->dev_addr[4] << 24); |
1911 | 1933 | ||
1912 | } | 1934 | } |
1913 | 1935 | ||
@@ -1943,7 +1965,7 @@ int __init fec_enet_init(struct net_device *dev) | |||
1943 | udelay(10); | 1965 | udelay(10); |
1944 | 1966 | ||
1945 | /* Clear and enable interrupts */ | 1967 | /* Clear and enable interrupts */ |
1946 | fecp->fec_ievent = 0xffc0; | 1968 | fecp->fec_ievent = 0xffc00000; |
1947 | fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_TXB | | 1969 | fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_TXB | |
1948 | FEC_ENET_RXF | FEC_ENET_RXB | FEC_ENET_MII); | 1970 | FEC_ENET_RXF | FEC_ENET_RXB | FEC_ENET_MII); |
1949 | fecp->fec_hash_table_high = 0; | 1971 | fecp->fec_hash_table_high = 0; |
@@ -2063,11 +2085,6 @@ int __init fec_enet_init(struct net_device *dev) | |||
2063 | /* setup MII interface */ | 2085 | /* setup MII interface */ |
2064 | fec_set_mii(dev, fep); | 2086 | fec_set_mii(dev, fep); |
2065 | 2087 | ||
2066 | printk("%s: FEC ENET Version 0.2, ", dev->name); | ||
2067 | for (i=0; i<5; i++) | ||
2068 | printk("%02x:", dev->dev_addr[i]); | ||
2069 | printk("%02x\n", dev->dev_addr[5]); | ||
2070 | |||
2071 | /* Queue up command to detect the PHY and initialize the | 2088 | /* Queue up command to detect the PHY and initialize the |
2072 | * remainder of the interface. | 2089 | * remainder of the interface. |
2073 | */ | 2090 | */ |
@@ -2106,18 +2123,12 @@ fec_restart(struct net_device *dev, int duplex) | |||
2106 | 2123 | ||
2107 | /* Clear any outstanding interrupt. | 2124 | /* Clear any outstanding interrupt. |
2108 | */ | 2125 | */ |
2109 | fecp->fec_ievent = 0xffc0; | 2126 | fecp->fec_ievent = 0xffc00000; |
2110 | fec_enable_phy_intr(); | 2127 | fec_enable_phy_intr(); |
2111 | 2128 | ||
2112 | /* Set station address. | 2129 | /* Set station address. |
2113 | */ | 2130 | */ |
2114 | fecp->fec_addr_low = fep->mac_addr[3] | (fep->mac_addr[2] << 8) | | 2131 | fec_set_mac_address(dev); |
2115 | (fep->mac_addr[1] << 16) | (fep->mac_addr[0] << 24); | ||
2116 | fecp->fec_addr_high = (fep->mac_addr[5] << 16) | | ||
2117 | (fep->mac_addr[4] << 24); | ||
2118 | |||
2119 | for (i=0; i<ETH_ALEN; i++) | ||
2120 | dev->dev_addr[i] = fep->mac_addr[i]; | ||
2121 | 2132 | ||
2122 | /* Reset all multicast. | 2133 | /* Reset all multicast. |
2123 | */ | 2134 | */ |
@@ -2215,7 +2226,7 @@ fec_stop(struct net_device *dev) | |||
2215 | 2226 | ||
2216 | fecp->fec_x_cntrl = 0x01; /* Graceful transmit stop */ | 2227 | fecp->fec_x_cntrl = 0x01; /* Graceful transmit stop */ |
2217 | 2228 | ||
2218 | while(!(fecp->fec_ievent & 0x10000000)); | 2229 | while(!(fecp->fec_ievent & FEC_ENET_GRA)); |
2219 | 2230 | ||
2220 | /* Whack a reset. We should wait for this. | 2231 | /* Whack a reset. We should wait for this. |
2221 | */ | 2232 | */ |
@@ -2234,7 +2245,9 @@ fec_stop(struct net_device *dev) | |||
2234 | static int __init fec_enet_module_init(void) | 2245 | static int __init fec_enet_module_init(void) |
2235 | { | 2246 | { |
2236 | struct net_device *dev; | 2247 | struct net_device *dev; |
2237 | int i, err; | 2248 | int i, j, err; |
2249 | |||
2250 | printk("FEC ENET Version 0.2\n"); | ||
2238 | 2251 | ||
2239 | for (i = 0; (i < FEC_MAX_PORTS); i++) { | 2252 | for (i = 0; (i < FEC_MAX_PORTS); i++) { |
2240 | dev = alloc_etherdev(sizeof(struct fec_enet_private)); | 2253 | dev = alloc_etherdev(sizeof(struct fec_enet_private)); |
@@ -2250,6 +2263,11 @@ static int __init fec_enet_module_init(void) | |||
2250 | free_netdev(dev); | 2263 | free_netdev(dev); |
2251 | return -EIO; | 2264 | return -EIO; |
2252 | } | 2265 | } |
2266 | |||
2267 | printk("%s: ethernet ", dev->name); | ||
2268 | for (j = 0; (j < 5); j++) | ||
2269 | printk("%02x:", dev->dev_addr[j]); | ||
2270 | printk("%02x\n", dev->dev_addr[5]); | ||
2253 | } | 2271 | } |
2254 | return 0; | 2272 | return 0; |
2255 | } | 2273 | } |
diff --git a/drivers/net/fec.h b/drivers/net/fec.h index c6e4f979ff5d..045761b8a600 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h | |||
@@ -1,8 +1,9 @@ | |||
1 | /****************************************************************************/ | 1 | /****************************************************************************/ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * fec.h -- Fast Ethernet Controller for Motorola ColdFire 5270, | 4 | * fec.h -- Fast Ethernet Controller for Motorola ColdFire 5230, |
5 | 5271, 5272, 5274, 5275, 5280 and 5282. | 5 | * 5231, 5232, 5234, 5235, 5270, 5271, 5272, 5274, 5275, |
6 | * 5280 and 5282. | ||
6 | * | 7 | * |
7 | * (C) Copyright 2000-2003, Greg Ungerer (gerg@snapgear.com) | 8 | * (C) Copyright 2000-2003, Greg Ungerer (gerg@snapgear.com) |
8 | * (C) Copyright 2000-2001, Lineo (www.lineo.com) | 9 | * (C) Copyright 2000-2001, Lineo (www.lineo.com) |
@@ -13,7 +14,7 @@ | |||
13 | #define FEC_H | 14 | #define FEC_H |
14 | /****************************************************************************/ | 15 | /****************************************************************************/ |
15 | 16 | ||
16 | #if defined(CONFIG_M527x) || defined(CONFIG_M528x) | 17 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) |
17 | /* | 18 | /* |
18 | * Just figures, Motorola would have to change the offsets for | 19 | * Just figures, Motorola would have to change the offsets for |
19 | * registers in the same peripheral device on different models | 20 | * registers in the same peripheral device on different models |
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c index 43b03c55f453..e2ebdcad553c 100644 --- a/drivers/serial/mcfserial.c +++ b/drivers/serial/mcfserial.c | |||
@@ -63,8 +63,13 @@ struct timer_list mcfrs_timer_struct; | |||
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | #if defined(CONFIG_HW_FEITH) | 65 | #if defined(CONFIG_HW_FEITH) |
66 | #define CONSOLE_BAUD_RATE 38400 | 66 | #define CONSOLE_BAUD_RATE 38400 |
67 | #define DEFAULT_CBAUD B38400 | 67 | #define DEFAULT_CBAUD B38400 |
68 | #endif | ||
69 | |||
70 | #if defined(CONFIG_MOD5272) | ||
71 | #define CONSOLE_BAUD_RATE 115200 | ||
72 | #define DEFAULT_CBAUD B115200 | ||
68 | #endif | 73 | #endif |
69 | 74 | ||
70 | #ifndef CONSOLE_BAUD_RATE | 75 | #ifndef CONSOLE_BAUD_RATE |
@@ -90,7 +95,7 @@ static struct tty_driver *mcfrs_serial_driver; | |||
90 | #undef SERIAL_DEBUG_OPEN | 95 | #undef SERIAL_DEBUG_OPEN |
91 | #undef SERIAL_DEBUG_FLOW | 96 | #undef SERIAL_DEBUG_FLOW |
92 | 97 | ||
93 | #if defined(CONFIG_M527x) || defined(CONFIG_M528x) | 98 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) |
94 | #define IRQBASE (MCFINT_VECBASE+MCFINT_UART0) | 99 | #define IRQBASE (MCFINT_VECBASE+MCFINT_UART0) |
95 | #else | 100 | #else |
96 | #define IRQBASE 73 | 101 | #define IRQBASE 73 |
@@ -1510,7 +1515,7 @@ static void mcfrs_irqinit(struct mcf_serial *info) | |||
1510 | *portp = (*portp & ~0x000000ff) | 0x00000055; | 1515 | *portp = (*portp & ~0x000000ff) | 0x00000055; |
1511 | portp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PDCNT); | 1516 | portp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PDCNT); |
1512 | *portp = (*portp & ~0x000003fc) | 0x000002a8; | 1517 | *portp = (*portp & ~0x000003fc) | 0x000002a8; |
1513 | #elif defined(CONFIG_M527x) || defined(CONFIG_M528x) | 1518 | #elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) |
1514 | volatile unsigned char *icrp, *uartp; | 1519 | volatile unsigned char *icrp, *uartp; |
1515 | volatile unsigned long *imrp; | 1520 | volatile unsigned long *imrp; |
1516 | 1521 | ||
diff --git a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c index f8f21567cc22..50858273f8d3 100644 --- a/drivers/usb/class/audio.c +++ b/drivers/usb/class/audio.c | |||
@@ -631,8 +631,10 @@ static void usbin_stop(struct usb_audiodev *as) | |||
631 | i = u->flags; | 631 | i = u->flags; |
632 | spin_unlock_irqrestore(&as->lock, flags); | 632 | spin_unlock_irqrestore(&as->lock, flags); |
633 | while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) { | 633 | while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) { |
634 | set_current_state(notkilled ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); | 634 | if (notkilled) |
635 | schedule_timeout(1); | 635 | schedule_timeout_interruptible(1); |
636 | else | ||
637 | schedule_timeout_uninterruptible(1); | ||
636 | spin_lock_irqsave(&as->lock, flags); | 638 | spin_lock_irqsave(&as->lock, flags); |
637 | i = u->flags; | 639 | i = u->flags; |
638 | spin_unlock_irqrestore(&as->lock, flags); | 640 | spin_unlock_irqrestore(&as->lock, flags); |
@@ -1102,8 +1104,10 @@ static void usbout_stop(struct usb_audiodev *as) | |||
1102 | i = u->flags; | 1104 | i = u->flags; |
1103 | spin_unlock_irqrestore(&as->lock, flags); | 1105 | spin_unlock_irqrestore(&as->lock, flags); |
1104 | while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) { | 1106 | while (i & (FLG_URB0RUNNING|FLG_URB1RUNNING|FLG_SYNC0RUNNING|FLG_SYNC1RUNNING)) { |
1105 | set_current_state(notkilled ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); | 1107 | if (notkilled) |
1106 | schedule_timeout(1); | 1108 | schedule_timeout_interruptible(1); |
1109 | else | ||
1110 | schedule_timeout_uninterruptible(1); | ||
1107 | spin_lock_irqsave(&as->lock, flags); | 1111 | spin_lock_irqsave(&as->lock, flags); |
1108 | i = u->flags; | 1112 | i = u->flags; |
1109 | spin_unlock_irqrestore(&as->lock, flags); | 1113 | spin_unlock_irqrestore(&as->lock, flags); |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 12ecdb03ee5f..1017a97a418b 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1606,7 +1606,7 @@ irqreturn_t usb_hcd_irq (int irq, void *__hcd, struct pt_regs * r) | |||
1606 | return IRQ_NONE; | 1606 | return IRQ_NONE; |
1607 | 1607 | ||
1608 | hcd->saw_irq = 1; | 1608 | hcd->saw_irq = 1; |
1609 | if (hcd->state != start && hcd->state == HC_STATE_HALT) | 1609 | if (hcd->state == HC_STATE_HALT) |
1610 | usb_hc_died (hcd); | 1610 | usb_hc_died (hcd); |
1611 | return IRQ_HANDLED; | 1611 | return IRQ_HANDLED; |
1612 | } | 1612 | } |
@@ -1630,7 +1630,6 @@ void usb_hc_died (struct usb_hcd *hcd) | |||
1630 | spin_lock_irqsave (&hcd_root_hub_lock, flags); | 1630 | spin_lock_irqsave (&hcd_root_hub_lock, flags); |
1631 | if (hcd->rh_registered) { | 1631 | if (hcd->rh_registered) { |
1632 | hcd->poll_rh = 0; | 1632 | hcd->poll_rh = 0; |
1633 | del_timer(&hcd->rh_timer); | ||
1634 | 1633 | ||
1635 | /* make khubd clean up old urbs and devices */ | 1634 | /* make khubd clean up old urbs and devices */ |
1636 | usb_set_device_state (hcd->self.root_hub, | 1635 | usb_set_device_state (hcd->self.root_hub, |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 758c7f0ed159..a12cab5314e9 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -435,6 +435,7 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe) | |||
435 | static void hub_power_on(struct usb_hub *hub) | 435 | static void hub_power_on(struct usb_hub *hub) |
436 | { | 436 | { |
437 | int port1; | 437 | int port1; |
438 | unsigned pgood_delay = hub->descriptor->bPwrOn2PwrGood * 2; | ||
438 | 439 | ||
439 | /* if hub supports power switching, enable power on each port */ | 440 | /* if hub supports power switching, enable power on each port */ |
440 | if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) < 2) { | 441 | if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) < 2) { |
@@ -444,8 +445,8 @@ static void hub_power_on(struct usb_hub *hub) | |||
444 | USB_PORT_FEAT_POWER); | 445 | USB_PORT_FEAT_POWER); |
445 | } | 446 | } |
446 | 447 | ||
447 | /* Wait for power to be enabled */ | 448 | /* Wait at least 100 msec for power to become stable */ |
448 | msleep(hub->descriptor->bPwrOn2PwrGood * 2); | 449 | msleep(max(pgood_delay, (unsigned) 100)); |
449 | } | 450 | } |
450 | 451 | ||
451 | static void hub_quiesce(struct usb_hub *hub) | 452 | static void hub_quiesce(struct usb_hub *hub) |
@@ -1460,7 +1461,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1, | |||
1460 | port1, status); | 1461 | port1, status); |
1461 | else { | 1462 | else { |
1462 | status = hub_port_wait_reset(hub, port1, udev, delay); | 1463 | status = hub_port_wait_reset(hub, port1, udev, delay); |
1463 | if (status) | 1464 | if (status && status != -ENOTCONN) |
1464 | dev_dbg(hub->intfdev, | 1465 | dev_dbg(hub->intfdev, |
1465 | "port_wait_reset: err = %d\n", | 1466 | "port_wait_reset: err = %d\n", |
1466 | status); | 1467 | status); |
@@ -1469,8 +1470,8 @@ static int hub_port_reset(struct usb_hub *hub, int port1, | |||
1469 | /* return on disconnect or reset */ | 1470 | /* return on disconnect or reset */ |
1470 | switch (status) { | 1471 | switch (status) { |
1471 | case 0: | 1472 | case 0: |
1472 | /* TRSTRCY = 10 ms */ | 1473 | /* TRSTRCY = 10 ms; plus some extra */ |
1473 | msleep(10); | 1474 | msleep(10 + 40); |
1474 | /* FALL THROUGH */ | 1475 | /* FALL THROUGH */ |
1475 | case -ENOTCONN: | 1476 | case -ENOTCONN: |
1476 | case -ENODEV: | 1477 | case -ENODEV: |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 020815397a49..5c40980a5bd9 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -483,6 +483,7 @@ ep_release (struct inode *inode, struct file *fd) | |||
483 | data->state = STATE_EP_DISABLED; | 483 | data->state = STATE_EP_DISABLED; |
484 | data->desc.bDescriptorType = 0; | 484 | data->desc.bDescriptorType = 0; |
485 | data->hs_desc.bDescriptorType = 0; | 485 | data->hs_desc.bDescriptorType = 0; |
486 | usb_ep_disable(data->ep); | ||
486 | } | 487 | } |
487 | put_ep (data); | 488 | put_ep (data); |
488 | return 0; | 489 | return 0; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 2507e898af09..b948ffd94f45 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -400,6 +400,23 @@ static int ehci_hc_reset (struct usb_hcd *hcd) | |||
400 | return -EIO; | 400 | return -EIO; |
401 | } | 401 | } |
402 | break; | 402 | break; |
403 | case PCI_VENDOR_ID_NVIDIA: | ||
404 | /* NVidia reports that certain chips don't handle | ||
405 | * QH, ITD, or SITD addresses above 2GB. (But TD, | ||
406 | * data buffer, and periodic schedule are normal.) | ||
407 | */ | ||
408 | switch (pdev->device) { | ||
409 | case 0x003c: /* MCP04 */ | ||
410 | case 0x005b: /* CK804 */ | ||
411 | case 0x00d8: /* CK8 */ | ||
412 | case 0x00e8: /* CK8S */ | ||
413 | if (pci_set_consistent_dma_mask(pdev, | ||
414 | DMA_31BIT_MASK) < 0) | ||
415 | ehci_warn (ehci, "can't enable NVidia " | ||
416 | "workaround for >2GB RAM\n"); | ||
417 | break; | ||
418 | } | ||
419 | break; | ||
403 | } | 420 | } |
404 | 421 | ||
405 | /* optional debug port, normally in the first BAR */ | 422 | /* optional debug port, normally in the first BAR */ |
@@ -759,12 +776,16 @@ static int ehci_resume (struct usb_hcd *hcd) | |||
759 | if (time_before (jiffies, ehci->next_statechange)) | 776 | if (time_before (jiffies, ehci->next_statechange)) |
760 | msleep (100); | 777 | msleep (100); |
761 | 778 | ||
762 | /* If any port is suspended, we know we can/must resume the HC. */ | 779 | /* If any port is suspended (or owned by the companion), |
780 | * we know we can/must resume the HC (and mustn't reset it). | ||
781 | */ | ||
763 | for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) { | 782 | for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) { |
764 | u32 status; | 783 | u32 status; |
765 | port--; | 784 | port--; |
766 | status = readl (&ehci->regs->port_status [port]); | 785 | status = readl (&ehci->regs->port_status [port]); |
767 | if (status & PORT_SUSPEND) { | 786 | if (!(status & PORT_POWER)) |
787 | continue; | ||
788 | if (status & (PORT_SUSPEND | PORT_OWNER)) { | ||
768 | down (&hcd->self.root_hub->serialize); | 789 | down (&hcd->self.root_hub->serialize); |
769 | retval = ehci_hub_resume (hcd); | 790 | retval = ehci_hub_resume (hcd); |
770 | up (&hcd->self.root_hub->serialize); | 791 | up (&hcd->self.root_hub->serialize); |
@@ -1126,8 +1147,7 @@ rescan: | |||
1126 | case QH_STATE_UNLINK: /* wait for hw to finish? */ | 1147 | case QH_STATE_UNLINK: /* wait for hw to finish? */ |
1127 | idle_timeout: | 1148 | idle_timeout: |
1128 | spin_unlock_irqrestore (&ehci->lock, flags); | 1149 | spin_unlock_irqrestore (&ehci->lock, flags); |
1129 | set_current_state (TASK_UNINTERRUPTIBLE); | 1150 | schedule_timeout_uninterruptible(1); |
1130 | schedule_timeout (1); | ||
1131 | goto rescan; | 1151 | goto rescan; |
1132 | case QH_STATE_IDLE: /* fully unlinked */ | 1152 | case QH_STATE_IDLE: /* fully unlinked */ |
1133 | if (list_empty (&qh->qtd_list)) { | 1153 | if (list_empty (&qh->qtd_list)) { |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 36cc1f2218d5..18d3f2270316 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -54,7 +54,7 @@ static int ehci_hub_suspend (struct usb_hcd *hcd) | |||
54 | /* suspend any active/unsuspended ports, maybe allow wakeup */ | 54 | /* suspend any active/unsuspended ports, maybe allow wakeup */ |
55 | while (port--) { | 55 | while (port--) { |
56 | u32 __iomem *reg = &ehci->regs->port_status [port]; | 56 | u32 __iomem *reg = &ehci->regs->port_status [port]; |
57 | u32 t1 = readl (reg); | 57 | u32 t1 = readl (reg) & ~PORT_RWC_BITS; |
58 | u32 t2 = t1; | 58 | u32 t2 = t1; |
59 | 59 | ||
60 | if ((t1 & PORT_PE) && !(t1 & PORT_OWNER)) | 60 | if ((t1 & PORT_PE) && !(t1 & PORT_OWNER)) |
@@ -115,7 +115,8 @@ static int ehci_hub_resume (struct usb_hcd *hcd) | |||
115 | i = HCS_N_PORTS (ehci->hcs_params); | 115 | i = HCS_N_PORTS (ehci->hcs_params); |
116 | while (i--) { | 116 | while (i--) { |
117 | temp = readl (&ehci->regs->port_status [i]); | 117 | temp = readl (&ehci->regs->port_status [i]); |
118 | temp &= ~(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E); | 118 | temp &= ~(PORT_RWC_BITS |
119 | | PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E); | ||
119 | if (temp & PORT_SUSPEND) { | 120 | if (temp & PORT_SUSPEND) { |
120 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); | 121 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); |
121 | temp |= PORT_RESUME; | 122 | temp |= PORT_RESUME; |
@@ -128,7 +129,7 @@ static int ehci_hub_resume (struct usb_hcd *hcd) | |||
128 | temp = readl (&ehci->regs->port_status [i]); | 129 | temp = readl (&ehci->regs->port_status [i]); |
129 | if ((temp & PORT_SUSPEND) == 0) | 130 | if ((temp & PORT_SUSPEND) == 0) |
130 | continue; | 131 | continue; |
131 | temp &= ~PORT_RESUME; | 132 | temp &= ~(PORT_RWC_BITS | PORT_RESUME); |
132 | writel (temp, &ehci->regs->port_status [i]); | 133 | writel (temp, &ehci->regs->port_status [i]); |
133 | ehci_vdbg (ehci, "resumed port %d\n", i + 1); | 134 | ehci_vdbg (ehci, "resumed port %d\n", i + 1); |
134 | } | 135 | } |
@@ -191,6 +192,7 @@ static int check_reset_complete ( | |||
191 | 192 | ||
192 | // what happens if HCS_N_CC(params) == 0 ? | 193 | // what happens if HCS_N_CC(params) == 0 ? |
193 | port_status |= PORT_OWNER; | 194 | port_status |= PORT_OWNER; |
195 | port_status &= ~PORT_RWC_BITS; | ||
194 | writel (port_status, &ehci->regs->port_status [index]); | 196 | writel (port_status, &ehci->regs->port_status [index]); |
195 | 197 | ||
196 | } else | 198 | } else |
@@ -233,7 +235,8 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
233 | if (temp & PORT_OWNER) { | 235 | if (temp & PORT_OWNER) { |
234 | /* don't report this in GetPortStatus */ | 236 | /* don't report this in GetPortStatus */ |
235 | if (temp & PORT_CSC) { | 237 | if (temp & PORT_CSC) { |
236 | temp &= ~PORT_CSC; | 238 | temp &= ~PORT_RWC_BITS; |
239 | temp |= PORT_CSC; | ||
237 | writel (temp, &ehci->regs->port_status [i]); | 240 | writel (temp, &ehci->regs->port_status [i]); |
238 | } | 241 | } |
239 | continue; | 242 | continue; |
@@ -343,7 +346,7 @@ static int ehci_hub_control ( | |||
343 | &ehci->regs->port_status [wIndex]); | 346 | &ehci->regs->port_status [wIndex]); |
344 | break; | 347 | break; |
345 | case USB_PORT_FEAT_C_ENABLE: | 348 | case USB_PORT_FEAT_C_ENABLE: |
346 | writel (temp | PORT_PEC, | 349 | writel((temp & ~PORT_RWC_BITS) | PORT_PEC, |
347 | &ehci->regs->port_status [wIndex]); | 350 | &ehci->regs->port_status [wIndex]); |
348 | break; | 351 | break; |
349 | case USB_PORT_FEAT_SUSPEND: | 352 | case USB_PORT_FEAT_SUSPEND: |
@@ -353,7 +356,8 @@ static int ehci_hub_control ( | |||
353 | if ((temp & PORT_PE) == 0) | 356 | if ((temp & PORT_PE) == 0) |
354 | goto error; | 357 | goto error; |
355 | /* resume signaling for 20 msec */ | 358 | /* resume signaling for 20 msec */ |
356 | writel ((temp & ~PORT_WAKE_BITS) | PORT_RESUME, | 359 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); |
360 | writel (temp | PORT_RESUME, | ||
357 | &ehci->regs->port_status [wIndex]); | 361 | &ehci->regs->port_status [wIndex]); |
358 | ehci->reset_done [wIndex] = jiffies | 362 | ehci->reset_done [wIndex] = jiffies |
359 | + msecs_to_jiffies (20); | 363 | + msecs_to_jiffies (20); |
@@ -364,15 +368,15 @@ static int ehci_hub_control ( | |||
364 | break; | 368 | break; |
365 | case USB_PORT_FEAT_POWER: | 369 | case USB_PORT_FEAT_POWER: |
366 | if (HCS_PPC (ehci->hcs_params)) | 370 | if (HCS_PPC (ehci->hcs_params)) |
367 | writel (temp & ~PORT_POWER, | 371 | writel (temp & ~(PORT_RWC_BITS | PORT_POWER), |
368 | &ehci->regs->port_status [wIndex]); | 372 | &ehci->regs->port_status [wIndex]); |
369 | break; | 373 | break; |
370 | case USB_PORT_FEAT_C_CONNECTION: | 374 | case USB_PORT_FEAT_C_CONNECTION: |
371 | writel (temp | PORT_CSC, | 375 | writel((temp & ~PORT_RWC_BITS) | PORT_CSC, |
372 | &ehci->regs->port_status [wIndex]); | 376 | &ehci->regs->port_status [wIndex]); |
373 | break; | 377 | break; |
374 | case USB_PORT_FEAT_C_OVER_CURRENT: | 378 | case USB_PORT_FEAT_C_OVER_CURRENT: |
375 | writel (temp | PORT_OCC, | 379 | writel((temp & ~PORT_RWC_BITS) | PORT_OCC, |
376 | &ehci->regs->port_status [wIndex]); | 380 | &ehci->regs->port_status [wIndex]); |
377 | break; | 381 | break; |
378 | case USB_PORT_FEAT_C_RESET: | 382 | case USB_PORT_FEAT_C_RESET: |
@@ -416,7 +420,7 @@ static int ehci_hub_control ( | |||
416 | 420 | ||
417 | /* stop resume signaling */ | 421 | /* stop resume signaling */ |
418 | temp = readl (&ehci->regs->port_status [wIndex]); | 422 | temp = readl (&ehci->regs->port_status [wIndex]); |
419 | writel (temp & ~PORT_RESUME, | 423 | writel (temp & ~(PORT_RWC_BITS | PORT_RESUME), |
420 | &ehci->regs->port_status [wIndex]); | 424 | &ehci->regs->port_status [wIndex]); |
421 | retval = handshake ( | 425 | retval = handshake ( |
422 | &ehci->regs->port_status [wIndex], | 426 | &ehci->regs->port_status [wIndex], |
@@ -437,7 +441,7 @@ static int ehci_hub_control ( | |||
437 | ehci->reset_done [wIndex] = 0; | 441 | ehci->reset_done [wIndex] = 0; |
438 | 442 | ||
439 | /* force reset to complete */ | 443 | /* force reset to complete */ |
440 | writel (temp & ~PORT_RESET, | 444 | writel (temp & ~(PORT_RWC_BITS | PORT_RESET), |
441 | &ehci->regs->port_status [wIndex]); | 445 | &ehci->regs->port_status [wIndex]); |
442 | /* REVISIT: some hardware needs 550+ usec to clear | 446 | /* REVISIT: some hardware needs 550+ usec to clear |
443 | * this bit; seems too long to spin routinely... | 447 | * this bit; seems too long to spin routinely... |
@@ -500,6 +504,7 @@ static int ehci_hub_control ( | |||
500 | if (temp & PORT_OWNER) | 504 | if (temp & PORT_OWNER) |
501 | break; | 505 | break; |
502 | 506 | ||
507 | temp &= ~PORT_RWC_BITS; | ||
503 | switch (wValue) { | 508 | switch (wValue) { |
504 | case USB_PORT_FEAT_SUSPEND: | 509 | case USB_PORT_FEAT_SUSPEND: |
505 | if ((temp & PORT_PE) == 0 | 510 | if ((temp & PORT_PE) == 0 |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 20c9b550097d..f34a0516d35f 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -263,6 +263,7 @@ struct ehci_regs { | |||
263 | #define PORT_PE (1<<2) /* port enable */ | 263 | #define PORT_PE (1<<2) /* port enable */ |
264 | #define PORT_CSC (1<<1) /* connect status change */ | 264 | #define PORT_CSC (1<<1) /* connect status change */ |
265 | #define PORT_CONNECT (1<<0) /* device connected */ | 265 | #define PORT_CONNECT (1<<0) /* device connected */ |
266 | #define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC) | ||
266 | } __attribute__ ((packed)); | 267 | } __attribute__ ((packed)); |
267 | 268 | ||
268 | /* Appendix C, Debug port ... intended for use with special "debug devices" | 269 | /* Appendix C, Debug port ... intended for use with special "debug devices" |
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index 447f488f5d93..7924c74f958e 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c | |||
@@ -228,23 +228,22 @@ ohci_dump_roothub ( | |||
228 | char **next, | 228 | char **next, |
229 | unsigned *size) | 229 | unsigned *size) |
230 | { | 230 | { |
231 | u32 temp, ndp, i; | 231 | u32 temp, i; |
232 | 232 | ||
233 | temp = roothub_a (controller); | 233 | temp = roothub_a (controller); |
234 | if (temp == ~(u32)0) | 234 | if (temp == ~(u32)0) |
235 | return; | 235 | return; |
236 | ndp = (temp & RH_A_NDP); | ||
237 | 236 | ||
238 | if (verbose) { | 237 | if (verbose) { |
239 | ohci_dbg_sw (controller, next, size, | 238 | ohci_dbg_sw (controller, next, size, |
240 | "roothub.a %08x POTPGT=%d%s%s%s%s%s NDP=%d\n", temp, | 239 | "roothub.a %08x POTPGT=%d%s%s%s%s%s NDP=%d(%d)\n", temp, |
241 | ((temp & RH_A_POTPGT) >> 24) & 0xff, | 240 | ((temp & RH_A_POTPGT) >> 24) & 0xff, |
242 | (temp & RH_A_NOCP) ? " NOCP" : "", | 241 | (temp & RH_A_NOCP) ? " NOCP" : "", |
243 | (temp & RH_A_OCPM) ? " OCPM" : "", | 242 | (temp & RH_A_OCPM) ? " OCPM" : "", |
244 | (temp & RH_A_DT) ? " DT" : "", | 243 | (temp & RH_A_DT) ? " DT" : "", |
245 | (temp & RH_A_NPS) ? " NPS" : "", | 244 | (temp & RH_A_NPS) ? " NPS" : "", |
246 | (temp & RH_A_PSM) ? " PSM" : "", | 245 | (temp & RH_A_PSM) ? " PSM" : "", |
247 | ndp | 246 | (temp & RH_A_NDP), controller->num_ports |
248 | ); | 247 | ); |
249 | temp = roothub_b (controller); | 248 | temp = roothub_b (controller); |
250 | ohci_dbg_sw (controller, next, size, | 249 | ohci_dbg_sw (controller, next, size, |
@@ -266,7 +265,7 @@ ohci_dump_roothub ( | |||
266 | ); | 265 | ); |
267 | } | 266 | } |
268 | 267 | ||
269 | for (i = 0; i < ndp; i++) { | 268 | for (i = 0; i < controller->num_ports; i++) { |
270 | temp = roothub_portstatus (controller, i); | 269 | temp = roothub_portstatus (controller, i); |
271 | dbg_port_sw (controller, i, temp, next, size); | 270 | dbg_port_sw (controller, i, temp, next, size); |
272 | } | 271 | } |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 56b43f2a0e52..67c1aa5eb1c1 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -382,8 +382,7 @@ sanitize: | |||
382 | goto sanitize; | 382 | goto sanitize; |
383 | } | 383 | } |
384 | spin_unlock_irqrestore (&ohci->lock, flags); | 384 | spin_unlock_irqrestore (&ohci->lock, flags); |
385 | set_current_state (TASK_UNINTERRUPTIBLE); | 385 | schedule_timeout_uninterruptible(1); |
386 | schedule_timeout (1); | ||
387 | goto rescan; | 386 | goto rescan; |
388 | case ED_IDLE: /* fully unlinked */ | 387 | case ED_IDLE: /* fully unlinked */ |
389 | if (list_empty (&ed->td_list)) { | 388 | if (list_empty (&ed->td_list)) { |
@@ -485,6 +484,10 @@ static int ohci_init (struct ohci_hcd *ohci) | |||
485 | // flush the writes | 484 | // flush the writes |
486 | (void) ohci_readl (ohci, &ohci->regs->control); | 485 | (void) ohci_readl (ohci, &ohci->regs->control); |
487 | 486 | ||
487 | /* Read the number of ports unless overridden */ | ||
488 | if (ohci->num_ports == 0) | ||
489 | ohci->num_ports = roothub_a(ohci) & RH_A_NDP; | ||
490 | |||
488 | if (ohci->hcca) | 491 | if (ohci->hcca) |
489 | return 0; | 492 | return 0; |
490 | 493 | ||
@@ -561,10 +564,8 @@ static int ohci_run (struct ohci_hcd *ohci) | |||
561 | msleep(temp); | 564 | msleep(temp); |
562 | temp = roothub_a (ohci); | 565 | temp = roothub_a (ohci); |
563 | if (!(temp & RH_A_NPS)) { | 566 | if (!(temp & RH_A_NPS)) { |
564 | unsigned ports = temp & RH_A_NDP; | ||
565 | |||
566 | /* power down each port */ | 567 | /* power down each port */ |
567 | for (temp = 0; temp < ports; temp++) | 568 | for (temp = 0; temp < ohci->num_ports; temp++) |
568 | ohci_writel (ohci, RH_PS_LSDA, | 569 | ohci_writel (ohci, RH_PS_LSDA, |
569 | &ohci->regs->roothub.portstatus [temp]); | 570 | &ohci->regs->roothub.portstatus [temp]); |
570 | } | 571 | } |
@@ -720,6 +721,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs) | |||
720 | 721 | ||
721 | if (ints & OHCI_INTR_RD) { | 722 | if (ints & OHCI_INTR_RD) { |
722 | ohci_vdbg (ohci, "resume detect\n"); | 723 | ohci_vdbg (ohci, "resume detect\n"); |
724 | ohci_writel (ohci, OHCI_INTR_RD, ®s->intrstatus); | ||
723 | if (hcd->state != HC_STATE_QUIESCING) | 725 | if (hcd->state != HC_STATE_QUIESCING) |
724 | schedule_work(&ohci->rh_resume); | 726 | schedule_work(&ohci->rh_resume); |
725 | } | 727 | } |
@@ -861,7 +863,7 @@ static int ohci_restart (struct ohci_hcd *ohci) | |||
861 | * and that if we try to turn them back on the root hub | 863 | * and that if we try to turn them back on the root hub |
862 | * will respond to CSC processing. | 864 | * will respond to CSC processing. |
863 | */ | 865 | */ |
864 | i = roothub_a (ohci) & RH_A_NDP; | 866 | i = ohci->num_ports; |
865 | while (i--) | 867 | while (i--) |
866 | ohci_writel (ohci, RH_PS_PSS, | 868 | ohci_writel (ohci, RH_PS_PSS, |
867 | &ohci->regs->roothub.portstatus [temp]); | 869 | &ohci->regs->roothub.portstatus [temp]); |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 83ca4549a50e..ce7b28da7a15 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -184,7 +184,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd) | |||
184 | if (status != -EINPROGRESS) | 184 | if (status != -EINPROGRESS) |
185 | return status; | 185 | return status; |
186 | 186 | ||
187 | temp = roothub_a (ohci) & RH_A_NDP; | 187 | temp = ohci->num_ports; |
188 | enables = 0; | 188 | enables = 0; |
189 | while (temp--) { | 189 | while (temp--) { |
190 | u32 stat = ohci_readl (ohci, | 190 | u32 stat = ohci_readl (ohci, |
@@ -304,7 +304,7 @@ static int | |||
304 | ohci_hub_status_data (struct usb_hcd *hcd, char *buf) | 304 | ohci_hub_status_data (struct usb_hcd *hcd, char *buf) |
305 | { | 305 | { |
306 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 306 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
307 | int ports, i, changed = 0, length = 1; | 307 | int i, changed = 0, length = 1; |
308 | int can_suspend = hcd->can_wakeup; | 308 | int can_suspend = hcd->can_wakeup; |
309 | unsigned long flags; | 309 | unsigned long flags; |
310 | 310 | ||
@@ -319,9 +319,10 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
319 | goto done; | 319 | goto done; |
320 | } | 320 | } |
321 | 321 | ||
322 | ports = roothub_a (ohci) & RH_A_NDP; | 322 | /* undocumented erratum seen on at least rev D */ |
323 | if (ports > MAX_ROOT_PORTS) { | 323 | if ((ohci->flags & OHCI_QUIRK_AMD756) |
324 | ohci_err (ohci, "bogus NDP=%d, rereads as NDP=%d\n", ports, | 324 | && (roothub_a (ohci) & RH_A_NDP) > MAX_ROOT_PORTS) { |
325 | ohci_warn (ohci, "bogus NDP, rereads as NDP=%d\n", | ||
325 | ohci_readl (ohci, &ohci->regs->roothub.a) & RH_A_NDP); | 326 | ohci_readl (ohci, &ohci->regs->roothub.a) & RH_A_NDP); |
326 | /* retry later; "should not happen" */ | 327 | /* retry later; "should not happen" */ |
327 | goto done; | 328 | goto done; |
@@ -332,13 +333,13 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
332 | buf [0] = changed = 1; | 333 | buf [0] = changed = 1; |
333 | else | 334 | else |
334 | buf [0] = 0; | 335 | buf [0] = 0; |
335 | if (ports > 7) { | 336 | if (ohci->num_ports > 7) { |
336 | buf [1] = 0; | 337 | buf [1] = 0; |
337 | length++; | 338 | length++; |
338 | } | 339 | } |
339 | 340 | ||
340 | /* look at each port */ | 341 | /* look at each port */ |
341 | for (i = 0; i < ports; i++) { | 342 | for (i = 0; i < ohci->num_ports; i++) { |
342 | u32 status = roothub_portstatus (ohci, i); | 343 | u32 status = roothub_portstatus (ohci, i); |
343 | 344 | ||
344 | if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC | 345 | if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC |
@@ -395,15 +396,14 @@ ohci_hub_descriptor ( | |||
395 | struct usb_hub_descriptor *desc | 396 | struct usb_hub_descriptor *desc |
396 | ) { | 397 | ) { |
397 | u32 rh = roothub_a (ohci); | 398 | u32 rh = roothub_a (ohci); |
398 | int ports = rh & RH_A_NDP; | ||
399 | u16 temp; | 399 | u16 temp; |
400 | 400 | ||
401 | desc->bDescriptorType = 0x29; | 401 | desc->bDescriptorType = 0x29; |
402 | desc->bPwrOn2PwrGood = (rh & RH_A_POTPGT) >> 24; | 402 | desc->bPwrOn2PwrGood = (rh & RH_A_POTPGT) >> 24; |
403 | desc->bHubContrCurrent = 0; | 403 | desc->bHubContrCurrent = 0; |
404 | 404 | ||
405 | desc->bNbrPorts = ports; | 405 | desc->bNbrPorts = ohci->num_ports; |
406 | temp = 1 + (ports / 8); | 406 | temp = 1 + (ohci->num_ports / 8); |
407 | desc->bDescLength = 7 + 2 * temp; | 407 | desc->bDescLength = 7 + 2 * temp; |
408 | 408 | ||
409 | temp = 0; | 409 | temp = 0; |
@@ -421,7 +421,7 @@ ohci_hub_descriptor ( | |||
421 | rh = roothub_b (ohci); | 421 | rh = roothub_b (ohci); |
422 | memset(desc->bitmap, 0xff, sizeof(desc->bitmap)); | 422 | memset(desc->bitmap, 0xff, sizeof(desc->bitmap)); |
423 | desc->bitmap [0] = rh & RH_B_DR; | 423 | desc->bitmap [0] = rh & RH_B_DR; |
424 | if (ports > 7) { | 424 | if (ohci->num_ports > 7) { |
425 | desc->bitmap [1] = (rh & RH_B_DR) >> 8; | 425 | desc->bitmap [1] = (rh & RH_B_DR) >> 8; |
426 | desc->bitmap [2] = 0xff; | 426 | desc->bitmap [2] = 0xff; |
427 | } else | 427 | } else |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e5bc1789d18a..2fdb262d4726 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -75,33 +75,6 @@ static int pxa27x_ohci_select_pmm( int mode ) | |||
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | /* | ||
79 | If you select PMM_PERPORT_MODE, you should set the port power | ||
80 | */ | ||
81 | static int pxa27x_ohci_set_port_power( int port ) | ||
82 | { | ||
83 | if ( (pxa27x_ohci_pmm_state==PMM_PERPORT_MODE) | ||
84 | && (port>0) && (port<PXA_UHC_MAX_PORTNUM) ) { | ||
85 | UHCRHPS(port) |= 0x100; | ||
86 | return 0; | ||
87 | } | ||
88 | return -1; | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | If you select PMM_PERPORT_MODE, you should set the port power | ||
93 | */ | ||
94 | static int pxa27x_ohci_clear_port_power( int port ) | ||
95 | { | ||
96 | if ( (pxa27x_ohci_pmm_state==PMM_PERPORT_MODE) | ||
97 | && (port>0) && (port<PXA_UHC_MAX_PORTNUM) ) { | ||
98 | UHCRHPS(port) |= 0x200; | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | return -1; | ||
103 | } | ||
104 | |||
105 | extern int usb_disabled(void); | 78 | extern int usb_disabled(void); |
106 | 79 | ||
107 | /*-------------------------------------------------------------------------*/ | 80 | /*-------------------------------------------------------------------------*/ |
@@ -130,11 +103,17 @@ static void pxa27x_start_hc(struct platform_device *dev) | |||
130 | Polarity Low to active low. Supply power to USB ports. */ | 103 | Polarity Low to active low. Supply power to USB ports. */ |
131 | UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & | 104 | UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & |
132 | ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE); | 105 | ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE); |
106 | |||
107 | pxa27x_ohci_pmm_state = PMM_PERPORT_MODE; | ||
133 | } | 108 | } |
134 | 109 | ||
135 | UHCHR &= ~UHCHR_SSE; | 110 | UHCHR &= ~UHCHR_SSE; |
136 | 111 | ||
137 | UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE); | 112 | UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE); |
113 | |||
114 | /* Clear any OTG Pin Hold */ | ||
115 | if (PSSR & PSSR_OTGPH) | ||
116 | PSSR |= PSSR_OTGPH; | ||
138 | } | 117 | } |
139 | 118 | ||
140 | static void pxa27x_stop_hc(struct platform_device *dev) | 119 | static void pxa27x_stop_hc(struct platform_device *dev) |
@@ -198,17 +177,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, | |||
198 | pxa27x_start_hc(dev); | 177 | pxa27x_start_hc(dev); |
199 | 178 | ||
200 | /* Select Power Management Mode */ | 179 | /* Select Power Management Mode */ |
201 | pxa27x_ohci_select_pmm( PMM_PERPORT_MODE ); | 180 | pxa27x_ohci_select_pmm(pxa27x_ohci_pmm_state); |
202 | |||
203 | /* If choosing PMM_PERPORT_MODE, we should set the port power before we use it. */ | ||
204 | if (pxa27x_ohci_set_port_power(1) < 0) | ||
205 | printk(KERN_ERR "Setting port 1 power failed.\n"); | ||
206 | |||
207 | if (pxa27x_ohci_clear_port_power(2) < 0) | ||
208 | printk(KERN_ERR "Setting port 2 power failed.\n"); | ||
209 | |||
210 | if (pxa27x_ohci_clear_port_power(3) < 0) | ||
211 | printk(KERN_ERR "Setting port 3 power failed.\n"); | ||
212 | 181 | ||
213 | ohci_hcd_init(hcd_to_ohci(hcd)); | 182 | ohci_hcd_init(hcd_to_ohci(hcd)); |
214 | 183 | ||
@@ -258,6 +227,9 @@ ohci_pxa27x_start (struct usb_hcd *hcd) | |||
258 | 227 | ||
259 | ohci_dbg (ohci, "ohci_pxa27x_start, ohci:%p", ohci); | 228 | ohci_dbg (ohci, "ohci_pxa27x_start, ohci:%p", ohci); |
260 | 229 | ||
230 | /* The value of NDP in roothub_a is incorrect on this hardware */ | ||
231 | ohci->num_ports = 3; | ||
232 | |||
261 | if ((ret = ohci_init(ohci)) < 0) | 233 | if ((ret = ohci_init(ohci)) < 0) |
262 | return ret; | 234 | return ret; |
263 | 235 | ||
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 71cdd2262860..8a9b9d9209e9 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -383,6 +383,7 @@ struct ohci_hcd { | |||
383 | /* | 383 | /* |
384 | * driver state | 384 | * driver state |
385 | */ | 385 | */ |
386 | int num_ports; | ||
386 | int load [NUM_INTS]; | 387 | int load [NUM_INTS]; |
387 | u32 hc_control; /* copy of hc control reg */ | 388 | u32 hc_control; /* copy of hc control reg */ |
388 | unsigned long next_statechange; /* suspend/resume */ | 389 | unsigned long next_statechange; /* suspend/resume */ |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 0d5d2545bf07..0c024898cbea 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -97,14 +97,9 @@ static void uhci_get_current_frame_number(struct uhci_hcd *uhci); | |||
97 | /* to make sure it doesn't hog all of the bandwidth */ | 97 | /* to make sure it doesn't hog all of the bandwidth */ |
98 | #define DEPTH_INTERVAL 5 | 98 | #define DEPTH_INTERVAL 5 |
99 | 99 | ||
100 | static inline void restart_timer(struct uhci_hcd *uhci) | ||
101 | { | ||
102 | mod_timer(&uhci->stall_timer, jiffies + msecs_to_jiffies(100)); | ||
103 | } | ||
104 | |||
105 | #include "uhci-hub.c" | ||
106 | #include "uhci-debug.c" | 100 | #include "uhci-debug.c" |
107 | #include "uhci-q.c" | 101 | #include "uhci-q.c" |
102 | #include "uhci-hub.c" | ||
108 | 103 | ||
109 | /* | 104 | /* |
110 | * Make sure the controller is completely inactive, unable to | 105 | * Make sure the controller is completely inactive, unable to |
@@ -160,7 +155,6 @@ static void hc_died(struct uhci_hcd *uhci) | |||
160 | { | 155 | { |
161 | reset_hc(uhci); | 156 | reset_hc(uhci); |
162 | uhci->hc_inaccessible = 1; | 157 | uhci->hc_inaccessible = 1; |
163 | del_timer(&uhci->stall_timer); | ||
164 | } | 158 | } |
165 | 159 | ||
166 | /* | 160 | /* |
@@ -287,8 +281,11 @@ __acquires(uhci->lock) | |||
287 | /* Enable resume-detect interrupts if they work. | 281 | /* Enable resume-detect interrupts if they work. |
288 | * Then enter Global Suspend mode, still configured. | 282 | * Then enter Global Suspend mode, still configured. |
289 | */ | 283 | */ |
290 | int_enable = (resume_detect_interrupts_are_broken(uhci) ? | 284 | uhci->working_RD = 1; |
291 | 0 : USBINTR_RESUME); | 285 | int_enable = USBINTR_RESUME; |
286 | if (resume_detect_interrupts_are_broken(uhci)) { | ||
287 | uhci->working_RD = int_enable = 0; | ||
288 | } | ||
292 | outw(int_enable, uhci->io_addr + USBINTR); | 289 | outw(int_enable, uhci->io_addr + USBINTR); |
293 | outw(USBCMD_EGSM | USBCMD_CF, uhci->io_addr + USBCMD); | 290 | outw(USBCMD_EGSM | USBCMD_CF, uhci->io_addr + USBCMD); |
294 | mb(); | 291 | mb(); |
@@ -315,7 +312,6 @@ __acquires(uhci->lock) | |||
315 | 312 | ||
316 | uhci->rh_state = new_state; | 313 | uhci->rh_state = new_state; |
317 | uhci->is_stopped = UHCI_IS_STOPPED; | 314 | uhci->is_stopped = UHCI_IS_STOPPED; |
318 | del_timer(&uhci->stall_timer); | ||
319 | uhci_to_hcd(uhci)->poll_rh = !int_enable; | 315 | uhci_to_hcd(uhci)->poll_rh = !int_enable; |
320 | 316 | ||
321 | uhci_scan_schedule(uhci, NULL); | 317 | uhci_scan_schedule(uhci, NULL); |
@@ -335,7 +331,6 @@ static void start_rh(struct uhci_hcd *uhci) | |||
335 | mb(); | 331 | mb(); |
336 | uhci->rh_state = UHCI_RH_RUNNING; | 332 | uhci->rh_state = UHCI_RH_RUNNING; |
337 | uhci_to_hcd(uhci)->poll_rh = 1; | 333 | uhci_to_hcd(uhci)->poll_rh = 1; |
338 | restart_timer(uhci); | ||
339 | } | 334 | } |
340 | 335 | ||
341 | static void wakeup_rh(struct uhci_hcd *uhci) | 336 | static void wakeup_rh(struct uhci_hcd *uhci) |
@@ -374,20 +369,6 @@ __acquires(uhci->lock) | |||
374 | mod_timer(&uhci_to_hcd(uhci)->rh_timer, jiffies); | 369 | mod_timer(&uhci_to_hcd(uhci)->rh_timer, jiffies); |
375 | } | 370 | } |
376 | 371 | ||
377 | static void stall_callback(unsigned long _uhci) | ||
378 | { | ||
379 | struct uhci_hcd *uhci = (struct uhci_hcd *) _uhci; | ||
380 | unsigned long flags; | ||
381 | |||
382 | spin_lock_irqsave(&uhci->lock, flags); | ||
383 | uhci_scan_schedule(uhci, NULL); | ||
384 | check_fsbr(uhci); | ||
385 | |||
386 | if (!uhci->is_stopped) | ||
387 | restart_timer(uhci); | ||
388 | spin_unlock_irqrestore(&uhci->lock, flags); | ||
389 | } | ||
390 | |||
391 | static irqreturn_t uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs) | 372 | static irqreturn_t uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs) |
392 | { | 373 | { |
393 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); | 374 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); |
@@ -418,8 +399,10 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs) | |||
418 | "host controller halted, " | 399 | "host controller halted, " |
419 | "very bad!\n"); | 400 | "very bad!\n"); |
420 | hc_died(uhci); | 401 | hc_died(uhci); |
421 | spin_unlock_irqrestore(&uhci->lock, flags); | 402 | |
422 | return IRQ_HANDLED; | 403 | /* Force a callback in case there are |
404 | * pending unlinks */ | ||
405 | mod_timer(&hcd->rh_timer, jiffies); | ||
423 | } | 406 | } |
424 | spin_unlock_irqrestore(&uhci->lock, flags); | 407 | spin_unlock_irqrestore(&uhci->lock, flags); |
425 | } | 408 | } |
@@ -427,10 +410,11 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs) | |||
427 | 410 | ||
428 | if (status & USBSTS_RD) | 411 | if (status & USBSTS_RD) |
429 | usb_hcd_poll_rh_status(hcd); | 412 | usb_hcd_poll_rh_status(hcd); |
430 | 413 | else { | |
431 | spin_lock_irqsave(&uhci->lock, flags); | 414 | spin_lock_irqsave(&uhci->lock, flags); |
432 | uhci_scan_schedule(uhci, regs); | 415 | uhci_scan_schedule(uhci, regs); |
433 | spin_unlock_irqrestore(&uhci->lock, flags); | 416 | spin_unlock_irqrestore(&uhci->lock, flags); |
417 | } | ||
434 | 418 | ||
435 | return IRQ_HANDLED; | 419 | return IRQ_HANDLED; |
436 | } | 420 | } |
@@ -595,10 +579,6 @@ static int uhci_start(struct usb_hcd *hcd) | |||
595 | 579 | ||
596 | init_waitqueue_head(&uhci->waitqh); | 580 | init_waitqueue_head(&uhci->waitqh); |
597 | 581 | ||
598 | init_timer(&uhci->stall_timer); | ||
599 | uhci->stall_timer.function = stall_callback; | ||
600 | uhci->stall_timer.data = (unsigned long) uhci; | ||
601 | |||
602 | uhci->fl = dma_alloc_coherent(uhci_dev(uhci), sizeof(*uhci->fl), | 582 | uhci->fl = dma_alloc_coherent(uhci_dev(uhci), sizeof(*uhci->fl), |
603 | &dma_handle, 0); | 583 | &dma_handle, 0); |
604 | if (!uhci->fl) { | 584 | if (!uhci->fl) { |
@@ -745,11 +725,11 @@ static void uhci_stop(struct usb_hcd *hcd) | |||
745 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); | 725 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); |
746 | 726 | ||
747 | spin_lock_irq(&uhci->lock); | 727 | spin_lock_irq(&uhci->lock); |
748 | reset_hc(uhci); | 728 | if (!uhci->hc_inaccessible) |
729 | reset_hc(uhci); | ||
749 | uhci_scan_schedule(uhci, NULL); | 730 | uhci_scan_schedule(uhci, NULL); |
750 | spin_unlock_irq(&uhci->lock); | 731 | spin_unlock_irq(&uhci->lock); |
751 | 732 | ||
752 | del_timer_sync(&uhci->stall_timer); | ||
753 | release_uhci(uhci); | 733 | release_uhci(uhci); |
754 | } | 734 | } |
755 | 735 | ||
@@ -811,13 +791,12 @@ static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message) | |||
811 | */ | 791 | */ |
812 | pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); | 792 | pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); |
813 | uhci->hc_inaccessible = 1; | 793 | uhci->hc_inaccessible = 1; |
794 | hcd->poll_rh = 0; | ||
814 | 795 | ||
815 | /* FIXME: Enable non-PME# remote wakeup? */ | 796 | /* FIXME: Enable non-PME# remote wakeup? */ |
816 | 797 | ||
817 | done: | 798 | done: |
818 | spin_unlock_irq(&uhci->lock); | 799 | spin_unlock_irq(&uhci->lock); |
819 | if (rc == 0) | ||
820 | del_timer_sync(&hcd->rh_timer); | ||
821 | return rc; | 800 | return rc; |
822 | } | 801 | } |
823 | 802 | ||
@@ -850,8 +829,11 @@ static int uhci_resume(struct usb_hcd *hcd) | |||
850 | 829 | ||
851 | spin_unlock_irq(&uhci->lock); | 830 | spin_unlock_irq(&uhci->lock); |
852 | 831 | ||
853 | if (hcd->poll_rh) | 832 | if (!uhci->working_RD) { |
833 | /* Suspended root hub needs to be polled */ | ||
834 | hcd->poll_rh = 1; | ||
854 | usb_hcd_poll_rh_status(hcd); | 835 | usb_hcd_poll_rh_status(hcd); |
836 | } | ||
855 | return 0; | 837 | return 0; |
856 | } | 838 | } |
857 | #endif | 839 | #endif |
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h index bf9c5f9b508b..282f40b75881 100644 --- a/drivers/usb/host/uhci-hcd.h +++ b/drivers/usb/host/uhci-hcd.h | |||
@@ -345,9 +345,6 @@ enum uhci_rh_state { | |||
345 | 345 | ||
346 | /* | 346 | /* |
347 | * This describes the full uhci information. | 347 | * This describes the full uhci information. |
348 | * | ||
349 | * Note how the "proper" USB information is just | ||
350 | * a subset of what the full implementation needs. | ||
351 | */ | 348 | */ |
352 | struct uhci_hcd { | 349 | struct uhci_hcd { |
353 | 350 | ||
@@ -360,8 +357,6 @@ struct uhci_hcd { | |||
360 | struct dma_pool *qh_pool; | 357 | struct dma_pool *qh_pool; |
361 | struct dma_pool *td_pool; | 358 | struct dma_pool *td_pool; |
362 | 359 | ||
363 | struct usb_bus *bus; | ||
364 | |||
365 | struct uhci_td *term_td; /* Terminating TD, see UHCI bug */ | 360 | struct uhci_td *term_td; /* Terminating TD, see UHCI bug */ |
366 | struct uhci_qh *skelqh[UHCI_NUM_SKELQH]; /* Skeleton QH's */ | 361 | struct uhci_qh *skelqh[UHCI_NUM_SKELQH]; /* Skeleton QH's */ |
367 | 362 | ||
@@ -380,6 +375,8 @@ struct uhci_hcd { | |||
380 | unsigned int scan_in_progress:1; /* Schedule scan is running */ | 375 | unsigned int scan_in_progress:1; /* Schedule scan is running */ |
381 | unsigned int need_rescan:1; /* Redo the schedule scan */ | 376 | unsigned int need_rescan:1; /* Redo the schedule scan */ |
382 | unsigned int hc_inaccessible:1; /* HC is suspended or dead */ | 377 | unsigned int hc_inaccessible:1; /* HC is suspended or dead */ |
378 | unsigned int working_RD:1; /* Suspended root hub doesn't | ||
379 | need to be polled */ | ||
383 | 380 | ||
384 | /* Support for port suspend/resume/reset */ | 381 | /* Support for port suspend/resume/reset */ |
385 | unsigned long port_c_suspend; /* Bit-arrays of ports */ | 382 | unsigned long port_c_suspend; /* Bit-arrays of ports */ |
@@ -405,9 +402,7 @@ struct uhci_hcd { | |||
405 | /* List of URB's awaiting completion callback */ | 402 | /* List of URB's awaiting completion callback */ |
406 | struct list_head complete_list; /* P: uhci->lock */ | 403 | struct list_head complete_list; /* P: uhci->lock */ |
407 | 404 | ||
408 | int rh_numports; | 405 | int rh_numports; /* Number of root-hub ports */ |
409 | |||
410 | struct timer_list stall_timer; | ||
411 | 406 | ||
412 | wait_queue_head_t waitqh; /* endpoint_disable waiters */ | 407 | wait_queue_head_t waitqh; /* endpoint_disable waiters */ |
413 | }; | 408 | }; |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 4eace2b19ddb..a71e48a66805 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -145,15 +145,16 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
145 | { | 145 | { |
146 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); | 146 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); |
147 | unsigned long flags; | 147 | unsigned long flags; |
148 | int status; | 148 | int status = 0; |
149 | 149 | ||
150 | spin_lock_irqsave(&uhci->lock, flags); | 150 | spin_lock_irqsave(&uhci->lock, flags); |
151 | if (uhci->hc_inaccessible) { | ||
152 | status = 0; | ||
153 | goto done; | ||
154 | } | ||
155 | 151 | ||
152 | uhci_scan_schedule(uhci, NULL); | ||
153 | if (uhci->hc_inaccessible) | ||
154 | goto done; | ||
155 | check_fsbr(uhci); | ||
156 | uhci_check_ports(uhci); | 156 | uhci_check_ports(uhci); |
157 | |||
157 | status = get_hub_status_data(uhci, buf); | 158 | status = get_hub_status_data(uhci, buf); |
158 | 159 | ||
159 | switch (uhci->rh_state) { | 160 | switch (uhci->rh_state) { |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index bbb36cd6ed61..ea0d168a8c67 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -33,7 +33,7 @@ static void uhci_free_pending_tds(struct uhci_hcd *uhci); | |||
33 | static inline void uhci_set_next_interrupt(struct uhci_hcd *uhci) | 33 | static inline void uhci_set_next_interrupt(struct uhci_hcd *uhci) |
34 | { | 34 | { |
35 | if (uhci->is_stopped) | 35 | if (uhci->is_stopped) |
36 | mod_timer(&uhci->stall_timer, jiffies); | 36 | mod_timer(&uhci_to_hcd(uhci)->rh_timer, jiffies); |
37 | uhci->term_td->status |= cpu_to_le32(TD_CTRL_IOC); | 37 | uhci->term_td->status |= cpu_to_le32(TD_CTRL_IOC); |
38 | } | 38 | } |
39 | 39 | ||
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig index 482c4be521f5..1e53934907c0 100644 --- a/drivers/usb/input/Kconfig +++ b/drivers/usb/input/Kconfig | |||
@@ -286,3 +286,23 @@ config USB_KEYSPAN_REMOTE | |||
286 | 286 | ||
287 | To compile this driver as a module, choose M here: the module will | 287 | To compile this driver as a module, choose M here: the module will |
288 | be called keyspan_remote. | 288 | be called keyspan_remote. |
289 | |||
290 | config USB_APPLETOUCH | ||
291 | tristate "Apple USB Touchpad support" | ||
292 | depends on USB && INPUT | ||
293 | ---help--- | ||
294 | Say Y here if you want to use an Apple USB Touchpad. | ||
295 | |||
296 | These are the touchpads that can be found on post-February 2005 | ||
297 | Apple Powerbooks (prior models have a Synaptics touchpad connected | ||
298 | to the ADB bus). | ||
299 | |||
300 | This driver provides a basic mouse driver but can be interfaced | ||
301 | with the synaptics X11 driver to provide acceleration and | ||
302 | scrolling in X11. | ||
303 | |||
304 | For further information, see | ||
305 | <file:Documentation/input/appletouch.txt>. | ||
306 | |||
307 | To compile this driver as a module, choose M here: the | ||
308 | module will be called appletouch. | ||
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile index 43b2f999edfe..5e03b93f29f6 100644 --- a/drivers/usb/input/Makefile +++ b/drivers/usb/input/Makefile | |||
@@ -41,3 +41,4 @@ obj-$(CONFIG_USB_WACOM) += wacom.o | |||
41 | obj-$(CONFIG_USB_ACECAD) += acecad.o | 41 | obj-$(CONFIG_USB_ACECAD) += acecad.o |
42 | obj-$(CONFIG_USB_YEALINK) += yealink.o | 42 | obj-$(CONFIG_USB_YEALINK) += yealink.o |
43 | obj-$(CONFIG_USB_XPAD) += xpad.o | 43 | obj-$(CONFIG_USB_XPAD) += xpad.o |
44 | obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o | ||
diff --git a/drivers/usb/input/appletouch.c b/drivers/usb/input/appletouch.c new file mode 100644 index 000000000000..e03c1c567a14 --- /dev/null +++ b/drivers/usb/input/appletouch.c | |||
@@ -0,0 +1,469 @@ | |||
1 | /* | ||
2 | * Apple USB Touchpad (for post-February 2005 PowerBooks) driver | ||
3 | * | ||
4 | * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com) | ||
5 | * Copyright (C) 2005 Johannes Berg (johannes@sipsolutions.net) | ||
6 | * Copyright (C) 2005 Stelian Pop (stelian@popies.net) | ||
7 | * Copyright (C) 2005 Frank Arnold (frank@scirocco-5v-turbo.de) | ||
8 | * Copyright (C) 2005 Peter Osterlund (petero2@telia.com) | ||
9 | * | ||
10 | * Thanks to Alex Harper <basilisk@foobox.net> for his inputs. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | #include <linux/config.h> | ||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/errno.h> | ||
31 | #include <linux/init.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include <linux/module.h> | ||
34 | #include <linux/usb.h> | ||
35 | #include <linux/input.h> | ||
36 | #include <linux/usb_input.h> | ||
37 | |||
38 | /* Apple has powerbooks which have the keyboard with different Product IDs */ | ||
39 | #define APPLE_VENDOR_ID 0x05AC | ||
40 | |||
41 | #define ATP_DEVICE(prod) \ | ||
42 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | ||
43 | USB_DEVICE_ID_MATCH_INT_CLASS | \ | ||
44 | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ | ||
45 | .idVendor = APPLE_VENDOR_ID, \ | ||
46 | .idProduct = (prod), \ | ||
47 | .bInterfaceClass = 0x03, \ | ||
48 | .bInterfaceProtocol = 0x02 | ||
49 | |||
50 | /* table of devices that work with this driver */ | ||
51 | static struct usb_device_id atp_table [] = { | ||
52 | { ATP_DEVICE(0x020E) }, | ||
53 | { ATP_DEVICE(0x020F) }, | ||
54 | { ATP_DEVICE(0x030A) }, | ||
55 | { ATP_DEVICE(0x030B) }, | ||
56 | { } /* Terminating entry */ | ||
57 | }; | ||
58 | MODULE_DEVICE_TABLE (usb, atp_table); | ||
59 | |||
60 | /* size of a USB urb transfer */ | ||
61 | #define ATP_DATASIZE 81 | ||
62 | |||
63 | /* | ||
64 | * number of sensors. Note that only 16 instead of 26 X (horizontal) | ||
65 | * sensors exist on 12" and 15" PowerBooks. All models have 16 Y | ||
66 | * (vertical) sensors. | ||
67 | */ | ||
68 | #define ATP_XSENSORS 26 | ||
69 | #define ATP_YSENSORS 16 | ||
70 | |||
71 | /* amount of fuzz this touchpad generates */ | ||
72 | #define ATP_FUZZ 16 | ||
73 | |||
74 | /* maximum pressure this driver will report */ | ||
75 | #define ATP_PRESSURE 300 | ||
76 | /* | ||
77 | * multiplication factor for the X and Y coordinates. | ||
78 | * We try to keep the touchpad aspect ratio while still doing only simple | ||
79 | * arithmetics. | ||
80 | * The factors below give coordinates like: | ||
81 | * 0 <= x < 960 on 12" and 15" Powerbooks | ||
82 | * 0 <= x < 1600 on 17" Powerbooks | ||
83 | * 0 <= y < 646 | ||
84 | */ | ||
85 | #define ATP_XFACT 64 | ||
86 | #define ATP_YFACT 43 | ||
87 | |||
88 | /* | ||
89 | * Threshold for the touchpad sensors. Any change less than ATP_THRESHOLD is | ||
90 | * ignored. | ||
91 | */ | ||
92 | #define ATP_THRESHOLD 5 | ||
93 | |||
94 | /* Structure to hold all of our device specific stuff */ | ||
95 | struct atp { | ||
96 | struct usb_device * udev; /* usb device */ | ||
97 | struct urb * urb; /* usb request block */ | ||
98 | signed char * data; /* transferred data */ | ||
99 | int open; /* non-zero if opened */ | ||
100 | struct input_dev input; /* input dev */ | ||
101 | int valid; /* are the sensors valid ? */ | ||
102 | int x_old; /* last reported x/y, */ | ||
103 | int y_old; /* used for smoothing */ | ||
104 | /* current value of the sensors */ | ||
105 | signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS]; | ||
106 | /* last value of the sensors */ | ||
107 | signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; | ||
108 | /* accumulated sensors */ | ||
109 | int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; | ||
110 | }; | ||
111 | |||
112 | #define dbg_dump(msg, tab) \ | ||
113 | if (debug > 1) { \ | ||
114 | int i; \ | ||
115 | printk("appletouch: %s %lld", msg, (long long)jiffies); \ | ||
116 | for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) \ | ||
117 | printk(" %02x", tab[i]); \ | ||
118 | printk("\n"); \ | ||
119 | } | ||
120 | |||
121 | #define dprintk(format, a...) \ | ||
122 | do { \ | ||
123 | if (debug) printk(format, ##a); \ | ||
124 | } while (0) | ||
125 | |||
126 | MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold"); | ||
127 | MODULE_DESCRIPTION("Apple PowerBooks USB touchpad driver"); | ||
128 | MODULE_LICENSE("GPL"); | ||
129 | |||
130 | static int debug = 1; | ||
131 | module_param(debug, int, 0644); | ||
132 | MODULE_PARM_DESC(debug, "Activate debugging output"); | ||
133 | |||
134 | static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, | ||
135 | int *z, int *fingers) | ||
136 | { | ||
137 | int i; | ||
138 | /* values to calculate mean */ | ||
139 | int pcum = 0, psum = 0; | ||
140 | |||
141 | *fingers = 0; | ||
142 | |||
143 | for (i = 0; i < nb_sensors; i++) { | ||
144 | if (xy_sensors[i] < ATP_THRESHOLD) | ||
145 | continue; | ||
146 | if ((i - 1 < 0) || (xy_sensors[i - 1] < ATP_THRESHOLD)) | ||
147 | (*fingers)++; | ||
148 | pcum += xy_sensors[i] * i; | ||
149 | psum += xy_sensors[i]; | ||
150 | } | ||
151 | |||
152 | if (psum > 0) { | ||
153 | *z = psum; | ||
154 | return pcum * fact / psum; | ||
155 | } | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | static inline void atp_report_fingers(struct input_dev *input, int fingers) | ||
161 | { | ||
162 | input_report_key(input, BTN_TOOL_FINGER, fingers == 1); | ||
163 | input_report_key(input, BTN_TOOL_DOUBLETAP, fingers == 2); | ||
164 | input_report_key(input, BTN_TOOL_TRIPLETAP, fingers > 2); | ||
165 | } | ||
166 | |||
167 | static void atp_complete(struct urb* urb, struct pt_regs* regs) | ||
168 | { | ||
169 | int x, y, x_z, y_z, x_f, y_f; | ||
170 | int retval, i; | ||
171 | struct atp *dev = urb->context; | ||
172 | |||
173 | switch (urb->status) { | ||
174 | case 0: | ||
175 | /* success */ | ||
176 | break; | ||
177 | case -ECONNRESET: | ||
178 | case -ENOENT: | ||
179 | case -ESHUTDOWN: | ||
180 | /* This urb is terminated, clean up */ | ||
181 | dbg("%s - urb shutting down with status: %d", | ||
182 | __FUNCTION__, urb->status); | ||
183 | return; | ||
184 | default: | ||
185 | dbg("%s - nonzero urb status received: %d", | ||
186 | __FUNCTION__, urb->status); | ||
187 | goto exit; | ||
188 | } | ||
189 | |||
190 | /* drop incomplete datasets */ | ||
191 | if (dev->urb->actual_length != ATP_DATASIZE) { | ||
192 | dprintk("appletouch: incomplete data package.\n"); | ||
193 | goto exit; | ||
194 | } | ||
195 | |||
196 | /* reorder the sensors values */ | ||
197 | for (i = 0; i < 8; i++) { | ||
198 | /* X values */ | ||
199 | dev->xy_cur[i ] = dev->data[5 * i + 2]; | ||
200 | dev->xy_cur[i + 8] = dev->data[5 * i + 4]; | ||
201 | dev->xy_cur[i + 16] = dev->data[5 * i + 42]; | ||
202 | if (i < 2) | ||
203 | dev->xy_cur[i + 24] = dev->data[5 * i + 44]; | ||
204 | |||
205 | /* Y values */ | ||
206 | dev->xy_cur[i + 26] = dev->data[5 * i + 1]; | ||
207 | dev->xy_cur[i + 34] = dev->data[5 * i + 3]; | ||
208 | } | ||
209 | |||
210 | dbg_dump("sample", dev->xy_cur); | ||
211 | |||
212 | if (!dev->valid) { | ||
213 | /* first sample */ | ||
214 | dev->valid = 1; | ||
215 | dev->x_old = dev->y_old = -1; | ||
216 | memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); | ||
217 | |||
218 | /* 17" Powerbooks have 10 extra X sensors */ | ||
219 | for (i = 16; i < ATP_XSENSORS; i++) | ||
220 | if (dev->xy_cur[i]) { | ||
221 | printk("appletouch: 17\" model detected.\n"); | ||
222 | input_set_abs_params(&dev->input, ABS_X, 0, | ||
223 | (ATP_XSENSORS - 1) * | ||
224 | ATP_XFACT - 1, | ||
225 | ATP_FUZZ, 0); | ||
226 | break; | ||
227 | } | ||
228 | |||
229 | goto exit; | ||
230 | } | ||
231 | |||
232 | for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) { | ||
233 | /* accumulate the change */ | ||
234 | signed char change = dev->xy_old[i] - dev->xy_cur[i]; | ||
235 | dev->xy_acc[i] -= change; | ||
236 | |||
237 | /* prevent down drifting */ | ||
238 | if (dev->xy_acc[i] < 0) | ||
239 | dev->xy_acc[i] = 0; | ||
240 | } | ||
241 | |||
242 | memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); | ||
243 | |||
244 | dbg_dump("accumulator", dev->xy_acc); | ||
245 | |||
246 | x = atp_calculate_abs(dev->xy_acc, ATP_XSENSORS, | ||
247 | ATP_XFACT, &x_z, &x_f); | ||
248 | y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS, | ||
249 | ATP_YFACT, &y_z, &y_f); | ||
250 | |||
251 | if (x && y) { | ||
252 | if (dev->x_old != -1) { | ||
253 | x = (dev->x_old * 3 + x) >> 2; | ||
254 | y = (dev->y_old * 3 + y) >> 2; | ||
255 | dev->x_old = x; | ||
256 | dev->y_old = y; | ||
257 | |||
258 | if (debug > 1) | ||
259 | printk("appletouch: X: %3d Y: %3d " | ||
260 | "Xz: %3d Yz: %3d\n", | ||
261 | x, y, x_z, y_z); | ||
262 | |||
263 | input_report_key(&dev->input, BTN_TOUCH, 1); | ||
264 | input_report_abs(&dev->input, ABS_X, x); | ||
265 | input_report_abs(&dev->input, ABS_Y, y); | ||
266 | input_report_abs(&dev->input, ABS_PRESSURE, | ||
267 | min(ATP_PRESSURE, x_z + y_z)); | ||
268 | atp_report_fingers(&dev->input, max(x_f, y_f)); | ||
269 | } | ||
270 | dev->x_old = x; | ||
271 | dev->y_old = y; | ||
272 | } | ||
273 | else if (!x && !y) { | ||
274 | |||
275 | dev->x_old = dev->y_old = -1; | ||
276 | input_report_key(&dev->input, BTN_TOUCH, 0); | ||
277 | input_report_abs(&dev->input, ABS_PRESSURE, 0); | ||
278 | atp_report_fingers(&dev->input, 0); | ||
279 | |||
280 | /* reset the accumulator on release */ | ||
281 | memset(dev->xy_acc, 0, sizeof(dev->xy_acc)); | ||
282 | } | ||
283 | |||
284 | input_report_key(&dev->input, BTN_LEFT, !!dev->data[80]); | ||
285 | |||
286 | input_sync(&dev->input); | ||
287 | |||
288 | exit: | ||
289 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); | ||
290 | if (retval) { | ||
291 | err("%s - usb_submit_urb failed with result %d", | ||
292 | __FUNCTION__, retval); | ||
293 | } | ||
294 | } | ||
295 | |||
296 | static int atp_open(struct input_dev *input) | ||
297 | { | ||
298 | struct atp *dev = input->private; | ||
299 | |||
300 | if (usb_submit_urb(dev->urb, GFP_ATOMIC)) | ||
301 | return -EIO; | ||
302 | |||
303 | dev->open = 1; | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static void atp_close(struct input_dev *input) | ||
308 | { | ||
309 | struct atp *dev = input->private; | ||
310 | |||
311 | usb_kill_urb(dev->urb); | ||
312 | dev->open = 0; | ||
313 | } | ||
314 | |||
315 | static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id) | ||
316 | { | ||
317 | struct atp *dev = NULL; | ||
318 | struct usb_host_interface *iface_desc; | ||
319 | struct usb_endpoint_descriptor *endpoint; | ||
320 | int int_in_endpointAddr = 0; | ||
321 | int i, retval = -ENOMEM; | ||
322 | |||
323 | /* allocate memory for our device state and initialize it */ | ||
324 | dev = kmalloc(sizeof(struct atp), GFP_KERNEL); | ||
325 | if (dev == NULL) { | ||
326 | err("Out of memory"); | ||
327 | goto err_kmalloc; | ||
328 | } | ||
329 | memset(dev, 0, sizeof(struct atp)); | ||
330 | |||
331 | dev->udev = interface_to_usbdev(iface); | ||
332 | |||
333 | /* set up the endpoint information */ | ||
334 | /* use only the first interrupt-in endpoint */ | ||
335 | iface_desc = iface->cur_altsetting; | ||
336 | for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { | ||
337 | endpoint = &iface_desc->endpoint[i].desc; | ||
338 | if (!int_in_endpointAddr && | ||
339 | (endpoint->bEndpointAddress & USB_DIR_IN) && | ||
340 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
341 | == USB_ENDPOINT_XFER_INT)) { | ||
342 | /* we found an interrupt in endpoint */ | ||
343 | int_in_endpointAddr = endpoint->bEndpointAddress; | ||
344 | break; | ||
345 | } | ||
346 | } | ||
347 | if (!int_in_endpointAddr) { | ||
348 | retval = -EIO; | ||
349 | err("Could not find int-in endpoint"); | ||
350 | goto err_endpoint; | ||
351 | } | ||
352 | |||
353 | /* save our data pointer in this interface device */ | ||
354 | usb_set_intfdata(iface, dev); | ||
355 | |||
356 | dev->urb = usb_alloc_urb(0, GFP_KERNEL); | ||
357 | if (!dev->urb) { | ||
358 | retval = -ENOMEM; | ||
359 | goto err_usballoc; | ||
360 | } | ||
361 | dev->data = usb_buffer_alloc(dev->udev, ATP_DATASIZE, GFP_KERNEL, | ||
362 | &dev->urb->transfer_dma); | ||
363 | if (!dev->data) { | ||
364 | retval = -ENOMEM; | ||
365 | goto err_usbbufalloc; | ||
366 | } | ||
367 | usb_fill_int_urb(dev->urb, dev->udev, | ||
368 | usb_rcvintpipe(dev->udev, int_in_endpointAddr), | ||
369 | dev->data, ATP_DATASIZE, atp_complete, dev, 1); | ||
370 | |||
371 | init_input_dev(&dev->input); | ||
372 | dev->input.name = "appletouch"; | ||
373 | dev->input.dev = &iface->dev; | ||
374 | dev->input.private = dev; | ||
375 | dev->input.open = atp_open; | ||
376 | dev->input.close = atp_close; | ||
377 | |||
378 | usb_to_input_id(dev->udev, &dev->input.id); | ||
379 | |||
380 | set_bit(EV_ABS, dev->input.evbit); | ||
381 | |||
382 | /* | ||
383 | * 12" and 15" Powerbooks only have 16 x sensors, | ||
384 | * 17" models are detected later. | ||
385 | */ | ||
386 | input_set_abs_params(&dev->input, ABS_X, 0, | ||
387 | (16 - 1) * ATP_XFACT - 1, ATP_FUZZ, 0); | ||
388 | input_set_abs_params(&dev->input, ABS_Y, 0, | ||
389 | (ATP_YSENSORS - 1) * ATP_YFACT - 1, ATP_FUZZ, 0); | ||
390 | input_set_abs_params(&dev->input, ABS_PRESSURE, 0, ATP_PRESSURE, 0, 0); | ||
391 | |||
392 | set_bit(EV_KEY, dev->input.evbit); | ||
393 | set_bit(BTN_TOUCH, dev->input.keybit); | ||
394 | set_bit(BTN_TOOL_FINGER, dev->input.keybit); | ||
395 | set_bit(BTN_TOOL_DOUBLETAP, dev->input.keybit); | ||
396 | set_bit(BTN_TOOL_TRIPLETAP, dev->input.keybit); | ||
397 | set_bit(BTN_LEFT, dev->input.keybit); | ||
398 | |||
399 | input_register_device(&dev->input); | ||
400 | |||
401 | printk(KERN_INFO "input: appletouch connected\n"); | ||
402 | |||
403 | return 0; | ||
404 | |||
405 | err_usbbufalloc: | ||
406 | usb_free_urb(dev->urb); | ||
407 | err_usballoc: | ||
408 | usb_set_intfdata(iface, NULL); | ||
409 | err_endpoint: | ||
410 | kfree(dev); | ||
411 | err_kmalloc: | ||
412 | return retval; | ||
413 | } | ||
414 | |||
415 | static void atp_disconnect(struct usb_interface *iface) | ||
416 | { | ||
417 | struct atp *dev = usb_get_intfdata(iface); | ||
418 | |||
419 | usb_set_intfdata(iface, NULL); | ||
420 | if (dev) { | ||
421 | usb_kill_urb(dev->urb); | ||
422 | input_unregister_device(&dev->input); | ||
423 | usb_free_urb(dev->urb); | ||
424 | usb_buffer_free(dev->udev, ATP_DATASIZE, | ||
425 | dev->data, dev->urb->transfer_dma); | ||
426 | kfree(dev); | ||
427 | } | ||
428 | printk(KERN_INFO "input: appletouch disconnected\n"); | ||
429 | } | ||
430 | |||
431 | static int atp_suspend(struct usb_interface *iface, pm_message_t message) | ||
432 | { | ||
433 | struct atp *dev = usb_get_intfdata(iface); | ||
434 | usb_kill_urb(dev->urb); | ||
435 | dev->valid = 0; | ||
436 | return 0; | ||
437 | } | ||
438 | |||
439 | static int atp_resume(struct usb_interface *iface) | ||
440 | { | ||
441 | struct atp *dev = usb_get_intfdata(iface); | ||
442 | if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC)) | ||
443 | return -EIO; | ||
444 | |||
445 | return 0; | ||
446 | } | ||
447 | |||
448 | static struct usb_driver atp_driver = { | ||
449 | .owner = THIS_MODULE, | ||
450 | .name = "appletouch", | ||
451 | .probe = atp_probe, | ||
452 | .disconnect = atp_disconnect, | ||
453 | .suspend = atp_suspend, | ||
454 | .resume = atp_resume, | ||
455 | .id_table = atp_table, | ||
456 | }; | ||
457 | |||
458 | static int __init atp_init(void) | ||
459 | { | ||
460 | return usb_register(&atp_driver); | ||
461 | } | ||
462 | |||
463 | static void __exit atp_exit(void) | ||
464 | { | ||
465 | usb_deregister(&atp_driver); | ||
466 | } | ||
467 | |||
468 | module_init(atp_init); | ||
469 | module_exit(atp_exit); | ||
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index e108e0a36b74..a99865c689c5 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1446,7 +1446,6 @@ void hid_init_reports(struct hid_device *hid) | |||
1446 | 1446 | ||
1447 | #define USB_VENDOR_ID_APPLE 0x05ac | 1447 | #define USB_VENDOR_ID_APPLE 0x05ac |
1448 | #define USB_DEVICE_ID_APPLE_POWERMOUSE 0x0304 | 1448 | #define USB_DEVICE_ID_APPLE_POWERMOUSE 0x0304 |
1449 | #define USB_DEVICE_ID_APPLE_BLUETOOTH 0x1000 | ||
1450 | 1449 | ||
1451 | /* | 1450 | /* |
1452 | * Alphabetically sorted blacklist by quirk type. | 1451 | * Alphabetically sorted blacklist by quirk type. |
@@ -1465,7 +1464,6 @@ static struct hid_blacklist { | |||
1465 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22, HID_QUIRK_IGNORE }, | 1464 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22, HID_QUIRK_IGNORE }, |
1466 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23, HID_QUIRK_IGNORE }, | 1465 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23, HID_QUIRK_IGNORE }, |
1467 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, | 1466 | { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE }, |
1468 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_BLUETOOTH, HID_QUIRK_IGNORE }, | ||
1469 | { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, | 1467 | { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE }, |
1470 | { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40, HID_QUIRK_IGNORE }, | 1468 | { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40, HID_QUIRK_IGNORE }, |
1471 | { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24, HID_QUIRK_IGNORE }, | 1469 | { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24, HID_QUIRK_IGNORE }, |
diff --git a/drivers/usb/misc/sisusbvga/Kconfig b/drivers/usb/misc/sisusbvga/Kconfig index 3957e144caf7..7603cbe0865d 100644 --- a/drivers/usb/misc/sisusbvga/Kconfig +++ b/drivers/usb/misc/sisusbvga/Kconfig | |||
@@ -4,11 +4,43 @@ config USB_SISUSBVGA | |||
4 | depends on USB && USB_EHCI_HCD | 4 | depends on USB && USB_EHCI_HCD |
5 | ---help--- | 5 | ---help--- |
6 | Say Y here if you intend to attach a USB2VGA dongle based on a | 6 | Say Y here if you intend to attach a USB2VGA dongle based on a |
7 | Net2280 and a SiS315 chip. | 7 | Net2280 and a SiS315 chip. |
8 | 8 | ||
9 | Note that this device requires a USB 2.0 host controller. It will not | 9 | Note that this device requires a USB 2.0 host controller. It will not |
10 | work with USB 1.x controllers. | 10 | work with USB 1.x controllers. |
11 | 11 | ||
12 | To compile this driver as a module, choose M here: the module will be | 12 | To compile this driver as a module, choose M here; the module will be |
13 | called sisusb. If unsure, say N. | 13 | called sisusbvga. If unsure, say N. |
14 | |||
15 | config USB_SISUSBVGA_CON | ||
16 | bool "Text console and mode switching support" if USB_SISUSBVGA | ||
17 | depends on VT | ||
18 | select FONT_8x16 | ||
19 | ---help--- | ||
20 | Say Y here if you want a VGA text console via the USB dongle or | ||
21 | want to support userland applications that utilize the driver's | ||
22 | display mode switching capabilities. | ||
23 | |||
24 | Note that this console supports VGA/EGA text mode only. | ||
25 | |||
26 | By default, the console part of the driver will not kick in when | ||
27 | the driver is initialized. If you want the driver to take over | ||
28 | one or more of the consoles, you need to specify the number of | ||
29 | the first and last consoles (starting at 1) as driver parameters. | ||
30 | |||
31 | For example, if the driver is compiled as a module: | ||
32 | |||
33 | modprobe sisusbvga first=1 last=5 | ||
34 | |||
35 | If you use hotplug, add this to your modutils config files with | ||
36 | the "options" keyword, such as eg. | ||
37 | |||
38 | options sisusbvga first=1 last=5 | ||
39 | |||
40 | If the driver is compiled into the kernel image, the parameters | ||
41 | must be given in the kernel command like, such as | ||
42 | |||
43 | sisusbvga.first=1 sisusbvga.last=5 | ||
44 | |||
45 | |||
14 | 46 | ||
diff --git a/drivers/usb/misc/sisusbvga/Makefile b/drivers/usb/misc/sisusbvga/Makefile index 76f1643ceaf8..7f934cfc906c 100644 --- a/drivers/usb/misc/sisusbvga/Makefile +++ b/drivers/usb/misc/sisusbvga/Makefile | |||
@@ -2,5 +2,7 @@ | |||
2 | # Makefile for the sisusb driver (if driver is inside kernel tree). | 2 | # Makefile for the sisusb driver (if driver is inside kernel tree). |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_USB_SISUSBVGA) += sisusb.o | 5 | obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga.o |
6 | |||
7 | sisusbvga-objs := sisusb.o sisusb_init.o sisusb_con.o | ||
6 | 8 | ||
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index d63ce6c030f3..39db3155723a 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -1,6 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * sisusb - usb kernel driver for SiS315(E) based USB2VGA dongles | 2 | * sisusb - usb kernel driver for SiS315(E) based USB2VGA dongles |
3 | * | 3 | * |
4 | * Main part | ||
5 | * | ||
4 | * Copyright (C) 2005 by Thomas Winischhofer, Vienna, Austria | 6 | * Copyright (C) 2005 by Thomas Winischhofer, Vienna, Austria |
5 | * | 7 | * |
6 | * If distributed as part of the Linux kernel, this code is licensed under the | 8 | * If distributed as part of the Linux kernel, this code is licensed under the |
@@ -48,16 +50,60 @@ | |||
48 | #include <linux/kref.h> | 50 | #include <linux/kref.h> |
49 | #include <linux/usb.h> | 51 | #include <linux/usb.h> |
50 | #include <linux/smp_lock.h> | 52 | #include <linux/smp_lock.h> |
53 | #include <linux/vmalloc.h> | ||
51 | 54 | ||
52 | #include "sisusb.h" | 55 | #include "sisusb.h" |
53 | 56 | ||
57 | #ifdef INCL_SISUSB_CON | ||
58 | #include <linux/font.h> | ||
59 | #endif | ||
60 | |||
54 | #define SISUSB_DONTSYNC | 61 | #define SISUSB_DONTSYNC |
55 | 62 | ||
56 | /* Forward declarations / clean-up routines */ | 63 | /* Forward declarations / clean-up routines */ |
57 | 64 | ||
65 | #ifdef INCL_SISUSB_CON | ||
66 | int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data); | ||
67 | int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data); | ||
68 | int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data); | ||
69 | int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data); | ||
70 | int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand, u8 myor); | ||
71 | int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor); | ||
72 | int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand); | ||
73 | |||
74 | int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data); | ||
75 | int sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data); | ||
76 | int sisusb_writew(struct sisusb_usb_data *sisusb, u32 adr, u16 data); | ||
77 | int sisusb_readw(struct sisusb_usb_data *sisusb, u32 adr, u16 *data); | ||
78 | int sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src, | ||
79 | u32 dest, int length, size_t *bytes_written); | ||
80 | |||
81 | int sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init); | ||
82 | |||
83 | extern int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); | ||
84 | extern int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); | ||
85 | |||
86 | extern void sisusb_init_concode(void); | ||
87 | extern int sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last); | ||
88 | extern void sisusb_console_exit(struct sisusb_usb_data *sisusb); | ||
89 | |||
90 | extern void sisusb_set_cursor(struct sisusb_usb_data *sisusb, unsigned int location); | ||
91 | |||
92 | extern int sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot, | ||
93 | u8 *arg, int cmapsz, int ch512, int dorecalc, | ||
94 | struct vc_data *c, int fh, int uplock); | ||
95 | |||
96 | static int sisusb_first_vc = 0; | ||
97 | static int sisusb_last_vc = 0; | ||
98 | module_param_named(first, sisusb_first_vc, int, 0); | ||
99 | module_param_named(last, sisusb_last_vc, int, 0); | ||
100 | MODULE_PARM_DESC(first, "Number of first console to take over (1 - MAX_NR_CONSOLES)"); | ||
101 | MODULE_PARM_DESC(last, "Number of last console to take over (1 - MAX_NR_CONSOLES)"); | ||
102 | #endif | ||
103 | |||
58 | static struct usb_driver sisusb_driver; | 104 | static struct usb_driver sisusb_driver; |
59 | 105 | ||
60 | static DECLARE_MUTEX(disconnect_sem); | 106 | DECLARE_MUTEX(disconnect_sem); |
61 | 107 | ||
62 | static void | 108 | static void |
63 | sisusb_free_buffers(struct sisusb_usb_data *sisusb) | 109 | sisusb_free_buffers(struct sisusb_usb_data *sisusb) |
@@ -639,7 +685,10 @@ static int sisusb_send_bridge_packet(struct sisusb_usb_data *sisusb, int len, | |||
639 | 685 | ||
640 | /* The following routines assume being used to transfer byte, word, | 686 | /* The following routines assume being used to transfer byte, word, |
641 | * long etc. | 687 | * long etc. |
642 | * This means that they assume "data" in machine endianness format. | 688 | * This means that |
689 | * - the write routines expect "data" in machine endianness format. | ||
690 | * The data will be converted to leXX in sisusb_xxx_packet. | ||
691 | * - the read routines can expect read data in machine-endianess. | ||
643 | */ | 692 | */ |
644 | 693 | ||
645 | static int sisusb_write_memio_byte(struct sisusb_usb_data *sisusb, int type, | 694 | static int sisusb_write_memio_byte(struct sisusb_usb_data *sisusb, int type, |
@@ -839,7 +888,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, | |||
839 | if (get_user(swap16, (u16 __user *)userbuffer)) | 888 | if (get_user(swap16, (u16 __user *)userbuffer)) |
840 | return -EFAULT; | 889 | return -EFAULT; |
841 | } else | 890 | } else |
842 | swap16 = (kernbuffer[0] << 8) | kernbuffer[1]; | 891 | swap16 = *((u16 *)kernbuffer); |
843 | 892 | ||
844 | ret = sisusb_write_memio_word(sisusb, | 893 | ret = sisusb_write_memio_word(sisusb, |
845 | SISUSB_TYPE_MEM, | 894 | SISUSB_TYPE_MEM, |
@@ -855,14 +904,25 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, | |||
855 | if (userbuffer) { | 904 | if (userbuffer) { |
856 | if (copy_from_user(&buf, userbuffer, 3)) | 905 | if (copy_from_user(&buf, userbuffer, 3)) |
857 | return -EFAULT; | 906 | return -EFAULT; |
858 | 907 | #ifdef __BIG_ENDIAN | |
859 | swap32 = (buf[0] << 16) | | 908 | swap32 = (buf[0] << 16) | |
860 | (buf[1] << 8) | | 909 | (buf[1] << 8) | |
861 | buf[2]; | 910 | buf[2]; |
911 | #else | ||
912 | swap32 = (buf[2] << 16) | | ||
913 | (buf[1] << 8) | | ||
914 | buf[0]; | ||
915 | #endif | ||
862 | } else | 916 | } else |
917 | #ifdef __BIG_ENDIAN | ||
863 | swap32 = (kernbuffer[0] << 16) | | 918 | swap32 = (kernbuffer[0] << 16) | |
864 | (kernbuffer[1] << 8) | | 919 | (kernbuffer[1] << 8) | |
865 | kernbuffer[2]; | 920 | kernbuffer[2]; |
921 | #else | ||
922 | swap32 = (kernbuffer[2] << 16) | | ||
923 | (kernbuffer[1] << 8) | | ||
924 | kernbuffer[0]; | ||
925 | #endif | ||
866 | 926 | ||
867 | ret = sisusb_write_memio_24bit(sisusb, | 927 | ret = sisusb_write_memio_24bit(sisusb, |
868 | SISUSB_TYPE_MEM, | 928 | SISUSB_TYPE_MEM, |
@@ -879,10 +939,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, | |||
879 | if (get_user(swap32, (u32 __user *)userbuffer)) | 939 | if (get_user(swap32, (u32 __user *)userbuffer)) |
880 | return -EFAULT; | 940 | return -EFAULT; |
881 | } else | 941 | } else |
882 | swap32 = (kernbuffer[0] << 24) | | 942 | swap32 = *((u32 *)kernbuffer); |
883 | (kernbuffer[1] << 16) | | ||
884 | (kernbuffer[2] << 8) | | ||
885 | kernbuffer[3]; | ||
886 | 943 | ||
887 | ret = sisusb_write_memio_long(sisusb, | 944 | ret = sisusb_write_memio_long(sisusb, |
888 | SISUSB_TYPE_MEM, | 945 | SISUSB_TYPE_MEM, |
@@ -1005,6 +1062,10 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, | |||
1005 | return ret ? -EIO : 0; | 1062 | return ret ? -EIO : 0; |
1006 | } | 1063 | } |
1007 | 1064 | ||
1065 | /* Remember: Read data in packet is in machine-endianess! So for | ||
1066 | * byte, word, 24bit, long no endian correction is necessary. | ||
1067 | */ | ||
1068 | |||
1008 | static int sisusb_read_memio_byte(struct sisusb_usb_data *sisusb, int type, | 1069 | static int sisusb_read_memio_byte(struct sisusb_usb_data *sisusb, int type, |
1009 | u32 addr, u8 *data) | 1070 | u32 addr, u8 *data) |
1010 | { | 1071 | { |
@@ -1191,8 +1252,7 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, | |||
1191 | (u16 __user *)userbuffer)) | 1252 | (u16 __user *)userbuffer)) |
1192 | return -EFAULT; | 1253 | return -EFAULT; |
1193 | } else { | 1254 | } else { |
1194 | kernbuffer[0] = swap16 >> 8; | 1255 | *((u16 *)kernbuffer) = swap16; |
1195 | kernbuffer[1] = swap16 & 0xff; | ||
1196 | } | 1256 | } |
1197 | } | 1257 | } |
1198 | return ret; | 1258 | return ret; |
@@ -1202,9 +1262,15 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, | |||
1202 | addr, &swap32); | 1262 | addr, &swap32); |
1203 | if (!ret) { | 1263 | if (!ret) { |
1204 | (*bytes_read) += 3; | 1264 | (*bytes_read) += 3; |
1265 | #ifdef __BIG_ENDIAN | ||
1205 | buf[0] = (swap32 >> 16) & 0xff; | 1266 | buf[0] = (swap32 >> 16) & 0xff; |
1206 | buf[1] = (swap32 >> 8) & 0xff; | 1267 | buf[1] = (swap32 >> 8) & 0xff; |
1207 | buf[2] = swap32 & 0xff; | 1268 | buf[2] = swap32 & 0xff; |
1269 | #else | ||
1270 | buf[2] = (swap32 >> 16) & 0xff; | ||
1271 | buf[1] = (swap32 >> 8) & 0xff; | ||
1272 | buf[0] = swap32 & 0xff; | ||
1273 | #endif | ||
1208 | if (userbuffer) { | 1274 | if (userbuffer) { |
1209 | if (copy_to_user(userbuffer, &buf[0], 3)) | 1275 | if (copy_to_user(userbuffer, &buf[0], 3)) |
1210 | return -EFAULT; | 1276 | return -EFAULT; |
@@ -1228,10 +1294,7 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, | |||
1228 | 1294 | ||
1229 | userbuffer += 4; | 1295 | userbuffer += 4; |
1230 | } else { | 1296 | } else { |
1231 | kernbuffer[0] = (swap32 >> 24) & 0xff; | 1297 | *((u32 *)kernbuffer) = swap32; |
1232 | kernbuffer[1] = (swap32 >> 16) & 0xff; | ||
1233 | kernbuffer[2] = (swap32 >> 8) & 0xff; | ||
1234 | kernbuffer[3] = swap32 & 0xff; | ||
1235 | kernbuffer += 4; | 1298 | kernbuffer += 4; |
1236 | } | 1299 | } |
1237 | addr += 4; | 1300 | addr += 4; |
@@ -1289,7 +1352,24 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, | |||
1289 | 1352 | ||
1290 | /* High level: Gfx (indexed) register access */ | 1353 | /* High level: Gfx (indexed) register access */ |
1291 | 1354 | ||
1292 | static int | 1355 | #ifdef INCL_SISUSB_CON |
1356 | int | ||
1357 | sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data) | ||
1358 | { | ||
1359 | return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); | ||
1360 | } | ||
1361 | |||
1362 | int | ||
1363 | sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data) | ||
1364 | { | ||
1365 | return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); | ||
1366 | } | ||
1367 | #endif | ||
1368 | |||
1369 | #ifndef INCL_SISUSB_CON | ||
1370 | static | ||
1371 | #endif | ||
1372 | int | ||
1293 | sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data) | 1373 | sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data) |
1294 | { | 1374 | { |
1295 | int ret; | 1375 | int ret; |
@@ -1298,7 +1378,10 @@ sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data) | |||
1298 | return ret; | 1378 | return ret; |
1299 | } | 1379 | } |
1300 | 1380 | ||
1301 | static int | 1381 | #ifndef INCL_SISUSB_CON |
1382 | static | ||
1383 | #endif | ||
1384 | int | ||
1302 | sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data) | 1385 | sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data) |
1303 | { | 1386 | { |
1304 | int ret; | 1387 | int ret; |
@@ -1307,7 +1390,10 @@ sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data) | |||
1307 | return ret; | 1390 | return ret; |
1308 | } | 1391 | } |
1309 | 1392 | ||
1310 | static int | 1393 | #ifndef INCL_SISUSB_CON |
1394 | static | ||
1395 | #endif | ||
1396 | int | ||
1311 | sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, | 1397 | sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, |
1312 | u8 myand, u8 myor) | 1398 | u8 myand, u8 myor) |
1313 | { | 1399 | { |
@@ -1336,18 +1422,89 @@ sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx, | |||
1336 | return ret; | 1422 | return ret; |
1337 | } | 1423 | } |
1338 | 1424 | ||
1339 | static int | 1425 | #ifndef INCL_SISUSB_CON |
1426 | static | ||
1427 | #endif | ||
1428 | int | ||
1340 | sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor) | 1429 | sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor) |
1341 | { | 1430 | { |
1342 | return(sisusb_setidxregandor(sisusb, port, index, 0xff, myor)); | 1431 | return(sisusb_setidxregandor(sisusb, port, index, 0xff, myor)); |
1343 | } | 1432 | } |
1344 | 1433 | ||
1345 | static int | 1434 | #ifndef INCL_SISUSB_CON |
1435 | static | ||
1436 | #endif | ||
1437 | int | ||
1346 | sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand) | 1438 | sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand) |
1347 | { | 1439 | { |
1348 | return(sisusb_setidxregandor(sisusb, port, idx, myand, 0x00)); | 1440 | return(sisusb_setidxregandor(sisusb, port, idx, myand, 0x00)); |
1349 | } | 1441 | } |
1350 | 1442 | ||
1443 | /* Write/read video ram */ | ||
1444 | |||
1445 | #ifdef INCL_SISUSB_CON | ||
1446 | int | ||
1447 | sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data) | ||
1448 | { | ||
1449 | return(sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data)); | ||
1450 | } | ||
1451 | |||
1452 | int | ||
1453 | sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data) | ||
1454 | { | ||
1455 | return(sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data)); | ||
1456 | } | ||
1457 | |||
1458 | int | ||
1459 | sisusb_writew(struct sisusb_usb_data *sisusb, u32 adr, u16 data) | ||
1460 | { | ||
1461 | return(sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, adr, data)); | ||
1462 | } | ||
1463 | |||
1464 | int | ||
1465 | sisusb_readw(struct sisusb_usb_data *sisusb, u32 adr, u16 *data) | ||
1466 | { | ||
1467 | return(sisusb_read_memio_word(sisusb, SISUSB_TYPE_MEM, adr, data)); | ||
1468 | } | ||
1469 | |||
1470 | int | ||
1471 | sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src, | ||
1472 | u32 dest, int length, size_t *bytes_written) | ||
1473 | { | ||
1474 | return(sisusb_write_mem_bulk(sisusb, dest, src, length, NULL, 0, bytes_written)); | ||
1475 | } | ||
1476 | |||
1477 | #ifdef SISUSBENDIANTEST | ||
1478 | int | ||
1479 | sisusb_read_memory(struct sisusb_usb_data *sisusb, char *dest, | ||
1480 | u32 src, int length, size_t *bytes_written) | ||
1481 | { | ||
1482 | return(sisusb_read_mem_bulk(sisusb, src, dest, length, NULL, bytes_written)); | ||
1483 | } | ||
1484 | #endif | ||
1485 | #endif | ||
1486 | |||
1487 | #ifdef SISUSBENDIANTEST | ||
1488 | static void | ||
1489 | sisusb_testreadwrite(struct sisusb_usb_data *sisusb) | ||
1490 | { | ||
1491 | static char srcbuffer[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }; | ||
1492 | char destbuffer[10]; | ||
1493 | size_t dummy; | ||
1494 | int i,j; | ||
1495 | |||
1496 | sisusb_copy_memory(sisusb, srcbuffer, sisusb->vrambase, 7, &dummy); | ||
1497 | |||
1498 | for(i = 1; i <= 7; i++) { | ||
1499 | printk(KERN_DEBUG "sisusb: rwtest %d bytes\n", i); | ||
1500 | sisusb_read_memory(sisusb, destbuffer, sisusb->vrambase, i, &dummy); | ||
1501 | for(j = 0; j < i; j++) { | ||
1502 | printk(KERN_DEBUG "sisusb: rwtest read[%d] = %x\n", j, destbuffer[j]); | ||
1503 | } | ||
1504 | } | ||
1505 | } | ||
1506 | #endif | ||
1507 | |||
1351 | /* access pci config registers (reg numbers 0, 4, 8, etc) */ | 1508 | /* access pci config registers (reg numbers 0, 4, 8, etc) */ |
1352 | 1509 | ||
1353 | static int | 1510 | static int |
@@ -2270,6 +2427,129 @@ sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen) | |||
2270 | return ret; | 2427 | return ret; |
2271 | } | 2428 | } |
2272 | 2429 | ||
2430 | |||
2431 | #ifdef INCL_SISUSB_CON | ||
2432 | |||
2433 | /* Set up default text mode: | ||
2434 | - Set text mode (0x03) | ||
2435 | - Upload default font | ||
2436 | - Upload user font (if available) | ||
2437 | */ | ||
2438 | |||
2439 | int | ||
2440 | sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init) | ||
2441 | { | ||
2442 | int ret = 0, slot = sisusb->font_slot, i; | ||
2443 | struct font_desc *myfont; | ||
2444 | u8 *tempbuf; | ||
2445 | u16 *tempbufb; | ||
2446 | size_t written; | ||
2447 | static char bootstring[] = "SiSUSB VGA text console, (C) 2005 Thomas Winischhofer."; | ||
2448 | static char bootlogo[] = "(o_ //\\ V_/_"; | ||
2449 | |||
2450 | /* sisusb->lock is down */ | ||
2451 | |||
2452 | if (!sisusb->SiS_Pr) | ||
2453 | return 1; | ||
2454 | |||
2455 | sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30; | ||
2456 | sisusb->SiS_Pr->sisusb = (void *)sisusb; | ||
2457 | |||
2458 | /* Set mode 0x03 */ | ||
2459 | SiSUSBSetMode(sisusb->SiS_Pr, 0x03); | ||
2460 | |||
2461 | if (!(myfont = find_font("VGA8x16"))) | ||
2462 | return 1; | ||
2463 | |||
2464 | if (!(tempbuf = vmalloc(8192))) | ||
2465 | return 1; | ||
2466 | |||
2467 | for (i = 0; i < 256; i++) | ||
2468 | memcpy(tempbuf + (i * 32), myfont->data + (i * 16), 16); | ||
2469 | |||
2470 | /* Upload default font */ | ||
2471 | ret = sisusbcon_do_font_op(sisusb, 1, 0, tempbuf, 8192, 0, 1, NULL, 16, 0); | ||
2472 | |||
2473 | vfree(tempbuf); | ||
2474 | |||
2475 | /* Upload user font (and reset current slot) */ | ||
2476 | if (sisusb->font_backup) { | ||
2477 | ret |= sisusbcon_do_font_op(sisusb, 1, 2, sisusb->font_backup, | ||
2478 | 8192, sisusb->font_backup_512, 1, NULL, | ||
2479 | sisusb->font_backup_height, 0); | ||
2480 | if (slot != 2) | ||
2481 | sisusbcon_do_font_op(sisusb, 1, 0, NULL, 0, 0, 1, | ||
2482 | NULL, 16, 0); | ||
2483 | } | ||
2484 | |||
2485 | if (init && !sisusb->scrbuf) { | ||
2486 | |||
2487 | if ((tempbuf = vmalloc(8192))) { | ||
2488 | |||
2489 | i = 4096; | ||
2490 | tempbufb = (u16 *)tempbuf; | ||
2491 | while (i--) | ||
2492 | *(tempbufb++) = 0x0720; | ||
2493 | |||
2494 | i = 0; | ||
2495 | tempbufb = (u16 *)tempbuf; | ||
2496 | while (bootlogo[i]) { | ||
2497 | *(tempbufb++) = 0x0700 | bootlogo[i++]; | ||
2498 | if (!(i % 4)) | ||
2499 | tempbufb += 76; | ||
2500 | } | ||
2501 | |||
2502 | i = 0; | ||
2503 | tempbufb = (u16 *)tempbuf + 6; | ||
2504 | while (bootstring[i]) | ||
2505 | *(tempbufb++) = 0x0700 | bootstring[i++]; | ||
2506 | |||
2507 | ret |= sisusb_copy_memory(sisusb, tempbuf, | ||
2508 | sisusb->vrambase, 8192, &written); | ||
2509 | |||
2510 | vfree(tempbuf); | ||
2511 | |||
2512 | } | ||
2513 | |||
2514 | } else if (sisusb->scrbuf) { | ||
2515 | |||
2516 | ret |= sisusb_copy_memory(sisusb, (char *)sisusb->scrbuf, | ||
2517 | sisusb->vrambase, sisusb->scrbuf_size, &written); | ||
2518 | |||
2519 | } | ||
2520 | |||
2521 | if (sisusb->sisusb_cursor_size_from >= 0 && | ||
2522 | sisusb->sisusb_cursor_size_to >= 0) { | ||
2523 | sisusb_setidxreg(sisusb, SISCR, 0x0a, | ||
2524 | sisusb->sisusb_cursor_size_from); | ||
2525 | sisusb_setidxregandor(sisusb, SISCR, 0x0b, 0xe0, | ||
2526 | sisusb->sisusb_cursor_size_to); | ||
2527 | } else { | ||
2528 | sisusb_setidxreg(sisusb, SISCR, 0x0a, 0x2d); | ||
2529 | sisusb_setidxreg(sisusb, SISCR, 0x0b, 0x0e); | ||
2530 | sisusb->sisusb_cursor_size_to = -1; | ||
2531 | } | ||
2532 | |||
2533 | slot = sisusb->sisusb_cursor_loc; | ||
2534 | if(slot < 0) slot = 0; | ||
2535 | |||
2536 | sisusb->sisusb_cursor_loc = -1; | ||
2537 | sisusb->bad_cursor_pos = 1; | ||
2538 | |||
2539 | sisusb_set_cursor(sisusb, slot); | ||
2540 | |||
2541 | sisusb_setidxreg(sisusb, SISCR, 0x0c, (sisusb->cur_start_addr >> 8)); | ||
2542 | sisusb_setidxreg(sisusb, SISCR, 0x0d, (sisusb->cur_start_addr & 0xff)); | ||
2543 | |||
2544 | sisusb->textmodedestroyed = 0; | ||
2545 | |||
2546 | /* sisusb->lock is down */ | ||
2547 | |||
2548 | return ret; | ||
2549 | } | ||
2550 | |||
2551 | #endif | ||
2552 | |||
2273 | /* fops */ | 2553 | /* fops */ |
2274 | 2554 | ||
2275 | static int | 2555 | static int |
@@ -2329,7 +2609,7 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2329 | } | 2609 | } |
2330 | } | 2610 | } |
2331 | 2611 | ||
2332 | /* increment usage count for the device */ | 2612 | /* Increment usage count for our sisusb */ |
2333 | kref_get(&sisusb->kref); | 2613 | kref_get(&sisusb->kref); |
2334 | 2614 | ||
2335 | sisusb->isopen = 1; | 2615 | sisusb->isopen = 1; |
@@ -2340,12 +2620,10 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2340 | 2620 | ||
2341 | up(&disconnect_sem); | 2621 | up(&disconnect_sem); |
2342 | 2622 | ||
2343 | printk(KERN_DEBUG "sisusbvga[%d]: opened", sisusb->minor); | ||
2344 | |||
2345 | return 0; | 2623 | return 0; |
2346 | } | 2624 | } |
2347 | 2625 | ||
2348 | static void | 2626 | void |
2349 | sisusb_delete(struct kref *kref) | 2627 | sisusb_delete(struct kref *kref) |
2350 | { | 2628 | { |
2351 | struct sisusb_usb_data *sisusb = to_sisusb_dev(kref); | 2629 | struct sisusb_usb_data *sisusb = to_sisusb_dev(kref); |
@@ -2359,6 +2637,9 @@ sisusb_delete(struct kref *kref) | |||
2359 | sisusb->sisusb_dev = NULL; | 2637 | sisusb->sisusb_dev = NULL; |
2360 | sisusb_free_buffers(sisusb); | 2638 | sisusb_free_buffers(sisusb); |
2361 | sisusb_free_urbs(sisusb); | 2639 | sisusb_free_urbs(sisusb); |
2640 | #ifdef INCL_SISUSB_CON | ||
2641 | kfree(sisusb->SiS_Pr); | ||
2642 | #endif | ||
2362 | kfree(sisusb); | 2643 | kfree(sisusb); |
2363 | } | 2644 | } |
2364 | 2645 | ||
@@ -2395,8 +2676,6 @@ sisusb_release(struct inode *inode, struct file *file) | |||
2395 | 2676 | ||
2396 | up(&disconnect_sem); | 2677 | up(&disconnect_sem); |
2397 | 2678 | ||
2398 | printk(KERN_DEBUG "sisusbvga[%d]: released", myminor); | ||
2399 | |||
2400 | return 0; | 2679 | return 0; |
2401 | } | 2680 | } |
2402 | 2681 | ||
@@ -2733,6 +3012,12 @@ sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y, | |||
2733 | int retval, port, length; | 3012 | int retval, port, length; |
2734 | u32 address; | 3013 | u32 address; |
2735 | 3014 | ||
3015 | /* All our commands require the device | ||
3016 | * to be initialized. | ||
3017 | */ | ||
3018 | if (!sisusb->devinit) | ||
3019 | return -ENODEV; | ||
3020 | |||
2736 | port = y->data3 - | 3021 | port = y->data3 - |
2737 | SISUSB_PCI_PSEUDO_IOPORTBASE + | 3022 | SISUSB_PCI_PSEUDO_IOPORTBASE + |
2738 | SISUSB_PCI_IOPORTBASE; | 3023 | SISUSB_PCI_IOPORTBASE; |
@@ -2774,6 +3059,10 @@ sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y, | |||
2774 | break; | 3059 | break; |
2775 | 3060 | ||
2776 | case SUCMD_CLRSCR: | 3061 | case SUCMD_CLRSCR: |
3062 | /* Gfx core must be initialized */ | ||
3063 | if (!sisusb->gfxinit) | ||
3064 | return -ENODEV; | ||
3065 | |||
2777 | length = (y->data0 << 16) | (y->data1 << 8) | y->data2; | 3066 | length = (y->data0 << 16) | (y->data1 << 8) | y->data2; |
2778 | address = y->data3 - | 3067 | address = y->data3 - |
2779 | SISUSB_PCI_PSEUDO_MEMBASE + | 3068 | SISUSB_PCI_PSEUDO_MEMBASE + |
@@ -2781,11 +3070,61 @@ sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y, | |||
2781 | retval = sisusb_clear_vram(sisusb, address, length); | 3070 | retval = sisusb_clear_vram(sisusb, address, length); |
2782 | break; | 3071 | break; |
2783 | 3072 | ||
3073 | case SUCMD_HANDLETEXTMODE: | ||
3074 | retval = 0; | ||
3075 | #ifdef INCL_SISUSB_CON | ||
3076 | /* Gfx core must be initialized, SiS_Pr must exist */ | ||
3077 | if (!sisusb->gfxinit || !sisusb->SiS_Pr) | ||
3078 | return -ENODEV; | ||
3079 | |||
3080 | switch (y->data0) { | ||
3081 | case 0: | ||
3082 | retval = sisusb_reset_text_mode(sisusb, 0); | ||
3083 | break; | ||
3084 | case 1: | ||
3085 | sisusb->textmodedestroyed = 1; | ||
3086 | break; | ||
3087 | } | ||
3088 | #endif | ||
3089 | break; | ||
3090 | |||
3091 | #ifdef INCL_SISUSB_CON | ||
3092 | case SUCMD_SETMODE: | ||
3093 | /* Gfx core must be initialized, SiS_Pr must exist */ | ||
3094 | if (!sisusb->gfxinit || !sisusb->SiS_Pr) | ||
3095 | return -ENODEV; | ||
3096 | |||
3097 | retval = 0; | ||
3098 | |||
3099 | sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30; | ||
3100 | sisusb->SiS_Pr->sisusb = (void *)sisusb; | ||
3101 | |||
3102 | if (SiSUSBSetMode(sisusb->SiS_Pr, y->data3)) | ||
3103 | retval = -EINVAL; | ||
3104 | |||
3105 | break; | ||
3106 | |||
3107 | case SUCMD_SETVESAMODE: | ||
3108 | /* Gfx core must be initialized, SiS_Pr must exist */ | ||
3109 | if (!sisusb->gfxinit || !sisusb->SiS_Pr) | ||
3110 | return -ENODEV; | ||
3111 | |||
3112 | retval = 0; | ||
3113 | |||
3114 | sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30; | ||
3115 | sisusb->SiS_Pr->sisusb = (void *)sisusb; | ||
3116 | |||
3117 | if (SiSUSBSetVESAMode(sisusb->SiS_Pr, y->data3)) | ||
3118 | retval = -EINVAL; | ||
3119 | |||
3120 | break; | ||
3121 | #endif | ||
3122 | |||
2784 | default: | 3123 | default: |
2785 | retval = -EINVAL; | 3124 | retval = -EINVAL; |
2786 | } | 3125 | } |
2787 | 3126 | ||
2788 | if(retval > 0) | 3127 | if (retval > 0) |
2789 | retval = -EIO; | 3128 | retval = -EIO; |
2790 | 3129 | ||
2791 | return retval; | 3130 | return retval; |
@@ -2835,6 +3174,11 @@ sisusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
2835 | x.sisusb_vramsize = sisusb->vramsize; | 3174 | x.sisusb_vramsize = sisusb->vramsize; |
2836 | x.sisusb_minor = sisusb->minor; | 3175 | x.sisusb_minor = sisusb->minor; |
2837 | x.sisusb_fbdevactive= 0; | 3176 | x.sisusb_fbdevactive= 0; |
3177 | #ifdef INCL_SISUSB_CON | ||
3178 | x.sisusb_conactive = sisusb->haveconsole ? 1 : 0; | ||
3179 | #else | ||
3180 | x.sisusb_conactive = 0; | ||
3181 | #endif | ||
2838 | 3182 | ||
2839 | if (copy_to_user((void __user *)arg, &x, sizeof(x))) | 3183 | if (copy_to_user((void __user *)arg, &x, sizeof(x))) |
2840 | retval = -EFAULT; | 3184 | retval = -EFAULT; |
@@ -2895,9 +3239,13 @@ static struct file_operations usb_sisusb_fops = { | |||
2895 | }; | 3239 | }; |
2896 | 3240 | ||
2897 | static struct usb_class_driver usb_sisusb_class = { | 3241 | static struct usb_class_driver usb_sisusb_class = { |
3242 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13) | ||
2898 | .name = "usb/sisusbvga%d", | 3243 | .name = "usb/sisusbvga%d", |
2899 | .fops = &usb_sisusb_fops, | ||
2900 | .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, | 3244 | .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, |
3245 | #else | ||
3246 | .name = "sisusbvga%d", | ||
3247 | #endif | ||
3248 | .fops = &usb_sisusb_fops, | ||
2901 | .minor_base = SISUSB_MINOR | 3249 | .minor_base = SISUSB_MINOR |
2902 | }; | 3250 | }; |
2903 | 3251 | ||
@@ -2994,12 +3342,25 @@ static int sisusb_probe(struct usb_interface *intf, | |||
2994 | printk(KERN_INFO "sisusbvga[%d]: Allocated %d output buffers\n", | 3342 | printk(KERN_INFO "sisusbvga[%d]: Allocated %d output buffers\n", |
2995 | sisusb->minor, sisusb->numobufs); | 3343 | sisusb->minor, sisusb->numobufs); |
2996 | 3344 | ||
3345 | #ifdef INCL_SISUSB_CON | ||
3346 | /* Allocate our SiS_Pr */ | ||
3347 | if (!(sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL))) { | ||
3348 | printk(KERN_ERR | ||
3349 | "sisusbvga[%d]: Failed to allocate SiS_Pr\n", | ||
3350 | sisusb->minor); | ||
3351 | } | ||
3352 | #endif | ||
3353 | |||
2997 | /* Do remaining init stuff */ | 3354 | /* Do remaining init stuff */ |
2998 | 3355 | ||
2999 | init_waitqueue_head(&sisusb->wait_q); | 3356 | init_waitqueue_head(&sisusb->wait_q); |
3000 | 3357 | ||
3001 | usb_set_intfdata(intf, sisusb); | 3358 | usb_set_intfdata(intf, sisusb); |
3002 | 3359 | ||
3360 | usb_get_dev(sisusb->sisusb_dev); | ||
3361 | |||
3362 | sisusb->present = 1; | ||
3363 | |||
3003 | #ifdef SISUSB_OLD_CONFIG_COMPAT | 3364 | #ifdef SISUSB_OLD_CONFIG_COMPAT |
3004 | { | 3365 | { |
3005 | int ret; | 3366 | int ret; |
@@ -3014,14 +3375,19 @@ static int sisusb_probe(struct usb_interface *intf, | |||
3014 | sisusb->minor); | 3375 | sisusb->minor); |
3015 | else | 3376 | else |
3016 | sisusb->ioctl32registered = 1; | 3377 | sisusb->ioctl32registered = 1; |
3017 | |||
3018 | } | 3378 | } |
3019 | #endif | 3379 | #endif |
3020 | 3380 | ||
3021 | sisusb->present = 1; | ||
3022 | |||
3023 | if (dev->speed == USB_SPEED_HIGH) { | 3381 | if (dev->speed == USB_SPEED_HIGH) { |
3024 | if (sisusb_init_gfxdevice(sisusb, 1)) | 3382 | int initscreen = 1; |
3383 | #ifdef INCL_SISUSB_CON | ||
3384 | if (sisusb_first_vc > 0 && | ||
3385 | sisusb_last_vc > 0 && | ||
3386 | sisusb_first_vc <= sisusb_last_vc && | ||
3387 | sisusb_last_vc <= MAX_NR_CONSOLES) | ||
3388 | initscreen = 0; | ||
3389 | #endif | ||
3390 | if (sisusb_init_gfxdevice(sisusb, initscreen)) | ||
3025 | printk(KERN_ERR | 3391 | printk(KERN_ERR |
3026 | "sisusbvga[%d]: Failed to early " | 3392 | "sisusbvga[%d]: Failed to early " |
3027 | "initialize device\n", | 3393 | "initialize device\n", |
@@ -3035,6 +3401,16 @@ static int sisusb_probe(struct usb_interface *intf, | |||
3035 | 3401 | ||
3036 | sisusb->ready = 1; | 3402 | sisusb->ready = 1; |
3037 | 3403 | ||
3404 | #ifdef SISUSBENDIANTEST | ||
3405 | printk(KERN_DEBUG "sisusb: *** RWTEST ***\n"); | ||
3406 | sisusb_testreadwrite(sisusb); | ||
3407 | printk(KERN_DEBUG "sisusb: *** RWTEST END ***\n"); | ||
3408 | #endif | ||
3409 | |||
3410 | #ifdef INCL_SISUSB_CON | ||
3411 | sisusb_console_init(sisusb, sisusb_first_vc, sisusb_last_vc); | ||
3412 | #endif | ||
3413 | |||
3038 | return 0; | 3414 | return 0; |
3039 | 3415 | ||
3040 | error_4: | 3416 | error_4: |
@@ -3053,13 +3429,20 @@ static void sisusb_disconnect(struct usb_interface *intf) | |||
3053 | struct sisusb_usb_data *sisusb; | 3429 | struct sisusb_usb_data *sisusb; |
3054 | int minor; | 3430 | int minor; |
3055 | 3431 | ||
3056 | down(&disconnect_sem); | ||
3057 | |||
3058 | /* This should *not* happen */ | 3432 | /* This should *not* happen */ |
3059 | if (!(sisusb = usb_get_intfdata(intf))) { | 3433 | if (!(sisusb = usb_get_intfdata(intf))) |
3060 | up(&disconnect_sem); | ||
3061 | return; | 3434 | return; |
3062 | } | 3435 | |
3436 | #ifdef INCL_SISUSB_CON | ||
3437 | sisusb_console_exit(sisusb); | ||
3438 | #endif | ||
3439 | |||
3440 | /* The above code doesn't need the disconnect | ||
3441 | * semaphore to be down; its meaning is to | ||
3442 | * protect all other routines from the disconnect | ||
3443 | * case, not the other way round. | ||
3444 | */ | ||
3445 | down(&disconnect_sem); | ||
3063 | 3446 | ||
3064 | down(&sisusb->lock); | 3447 | down(&sisusb->lock); |
3065 | 3448 | ||
@@ -3123,11 +3506,17 @@ static int __init usb_sisusb_init(void) | |||
3123 | { | 3506 | { |
3124 | int retval; | 3507 | int retval; |
3125 | 3508 | ||
3509 | #ifdef INCL_SISUSB_CON | ||
3510 | sisusb_init_concode(); | ||
3511 | #endif | ||
3512 | |||
3126 | if (!(retval = usb_register(&sisusb_driver))) { | 3513 | if (!(retval = usb_register(&sisusb_driver))) { |
3514 | |||
3127 | printk(KERN_INFO "sisusb: Driver version %d.%d.%d\n", | 3515 | printk(KERN_INFO "sisusb: Driver version %d.%d.%d\n", |
3128 | SISUSB_VERSION, SISUSB_REVISION, SISUSB_PATCHLEVEL); | 3516 | SISUSB_VERSION, SISUSB_REVISION, SISUSB_PATCHLEVEL); |
3129 | printk(KERN_INFO | 3517 | printk(KERN_INFO |
3130 | "sisusb: Copyright (C) 2005 Thomas Winischhofer\n"); | 3518 | "sisusb: Copyright (C) 2005 Thomas Winischhofer\n"); |
3519 | |||
3131 | } | 3520 | } |
3132 | 3521 | ||
3133 | return retval; | 3522 | return retval; |
@@ -3142,6 +3531,6 @@ module_init(usb_sisusb_init); | |||
3142 | module_exit(usb_sisusb_exit); | 3531 | module_exit(usb_sisusb_exit); |
3143 | 3532 | ||
3144 | MODULE_AUTHOR("Thomas Winischhofer <thomas@winischhofer.net>"); | 3533 | MODULE_AUTHOR("Thomas Winischhofer <thomas@winischhofer.net>"); |
3145 | MODULE_DESCRIPTION("sisusb - Driver for Net2280/SiS315-based USB2VGA dongles"); | 3534 | MODULE_DESCRIPTION("sisusbvga - Driver for Net2280/SiS315-based USB2VGA dongles"); |
3146 | MODULE_LICENSE("GPL"); | 3535 | MODULE_LICENSE("GPL"); |
3147 | 3536 | ||
diff --git a/drivers/usb/misc/sisusbvga/sisusb.h b/drivers/usb/misc/sisusbvga/sisusb.h index 1306d006a25a..401ff21d7881 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.h +++ b/drivers/usb/misc/sisusbvga/sisusb.h | |||
@@ -46,15 +46,36 @@ | |||
46 | #endif | 46 | #endif |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | /* For older kernels, support for text consoles is by default | ||
50 | * off. To ensable text console support, change the following: | ||
51 | */ | ||
52 | #if 0 | ||
53 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13) | ||
54 | #define CONFIG_USB_SISUSBVGA_CON | ||
55 | #endif | ||
56 | #endif | ||
57 | |||
49 | /* Version Information */ | 58 | /* Version Information */ |
50 | 59 | ||
51 | #define SISUSB_VERSION 0 | 60 | #define SISUSB_VERSION 0 |
52 | #define SISUSB_REVISION 0 | 61 | #define SISUSB_REVISION 0 |
53 | #define SISUSB_PATCHLEVEL 7 | 62 | #define SISUSB_PATCHLEVEL 8 |
63 | |||
64 | /* Include console and mode switching code? */ | ||
65 | |||
66 | #ifdef CONFIG_USB_SISUSBVGA_CON | ||
67 | #define INCL_SISUSB_CON 1 | ||
68 | #endif | ||
69 | |||
70 | #ifdef INCL_SISUSB_CON | ||
71 | #include <linux/console.h> | ||
72 | #include <linux/vt_kern.h> | ||
73 | #include "sisusb_struct.h" | ||
74 | #endif | ||
54 | 75 | ||
55 | /* USB related */ | 76 | /* USB related */ |
56 | 77 | ||
57 | #define SISUSB_MINOR 133 /* FIXME */ | 78 | #define SISUSB_MINOR 133 /* official */ |
58 | 79 | ||
59 | /* Size of the sisusb input/output buffers */ | 80 | /* Size of the sisusb input/output buffers */ |
60 | #define SISUSB_IBUF_SIZE 0x01000 | 81 | #define SISUSB_IBUF_SIZE 0x01000 |
@@ -131,6 +152,26 @@ struct sisusb_usb_data { | |||
131 | unsigned char gfxinit; /* graphics core initialized? */ | 152 | unsigned char gfxinit; /* graphics core initialized? */ |
132 | unsigned short chipid, chipvendor; | 153 | unsigned short chipid, chipvendor; |
133 | unsigned short chiprevision; | 154 | unsigned short chiprevision; |
155 | #ifdef INCL_SISUSB_CON | ||
156 | struct SiS_Private *SiS_Pr; | ||
157 | unsigned long scrbuf; | ||
158 | unsigned int scrbuf_size; | ||
159 | int haveconsole, con_first, con_last; | ||
160 | int havethisconsole[MAX_NR_CONSOLES]; | ||
161 | int textmodedestroyed; | ||
162 | unsigned int sisusb_num_columns; /* real number, not vt's idea */ | ||
163 | int cur_start_addr, con_rolled_over; | ||
164 | int sisusb_cursor_loc, bad_cursor_pos; | ||
165 | int sisusb_cursor_size_from; | ||
166 | int sisusb_cursor_size_to; | ||
167 | int current_font_height, current_font_512; | ||
168 | int font_backup_size, font_backup_height, font_backup_512; | ||
169 | char *font_backup; | ||
170 | int font_slot; | ||
171 | struct vc_data *sisusb_display_fg; | ||
172 | int is_gfx; | ||
173 | int con_blanked; | ||
174 | #endif | ||
134 | }; | 175 | }; |
135 | 176 | ||
136 | #define to_sisusb_dev(d) container_of(d, struct sisusb_usb_data, kref) | 177 | #define to_sisusb_dev(d) container_of(d, struct sisusb_usb_data, kref) |
@@ -249,7 +290,9 @@ struct sisusb_info { | |||
249 | 290 | ||
250 | __u32 sisusb_fbdevactive; /* != 0 if framebuffer device active */ | 291 | __u32 sisusb_fbdevactive; /* != 0 if framebuffer device active */ |
251 | 292 | ||
252 | __u8 sisusb_reserved[32]; /* for future use */ | 293 | __u32 sisusb_conactive; /* != 0 if console driver active */ |
294 | |||
295 | __u8 sisusb_reserved[28]; /* for future use */ | ||
253 | }; | 296 | }; |
254 | 297 | ||
255 | struct sisusb_command { | 298 | struct sisusb_command { |
@@ -261,18 +304,24 @@ struct sisusb_command { | |||
261 | __u32 data4; /* for future use */ | 304 | __u32 data4; /* for future use */ |
262 | }; | 305 | }; |
263 | 306 | ||
264 | #define SUCMD_GET 0x01 /* for all: data0 = index, data3 = port */ | 307 | #define SUCMD_GET 0x01 /* for all: data0 = index, data3 = port */ |
265 | #define SUCMD_SET 0x02 /* data1 = value */ | 308 | #define SUCMD_SET 0x02 /* data1 = value */ |
266 | #define SUCMD_SETOR 0x03 /* data1 = or */ | 309 | #define SUCMD_SETOR 0x03 /* data1 = or */ |
267 | #define SUCMD_SETAND 0x04 /* data1 = and */ | 310 | #define SUCMD_SETAND 0x04 /* data1 = and */ |
268 | #define SUCMD_SETANDOR 0x05 /* data1 = and, data2 = or */ | 311 | #define SUCMD_SETANDOR 0x05 /* data1 = and, data2 = or */ |
269 | #define SUCMD_SETMASK 0x06 /* data1 = data, data2 = mask */ | 312 | #define SUCMD_SETMASK 0x06 /* data1 = data, data2 = mask */ |
270 | 313 | ||
271 | #define SUCMD_CLRSCR 0x07 /* data0:1:2 = length, data3 = address */ | 314 | #define SUCMD_CLRSCR 0x07 /* data0:1:2 = length, data3 = address */ |
315 | |||
316 | #define SUCMD_HANDLETEXTMODE 0x08 /* Reset/destroy text mode */ | ||
317 | |||
318 | #define SUCMD_SETMODE 0x09 /* Set a display mode (data3 = SiS mode) */ | ||
319 | #define SUCMD_SETVESAMODE 0x0a /* Set a display mode (data3 = VESA mode) */ | ||
272 | 320 | ||
273 | #define SISUSB_COMMAND _IOWR(0xF3,0x3D,struct sisusb_command) | 321 | #define SISUSB_COMMAND _IOWR(0xF3,0x3D,struct sisusb_command) |
274 | #define SISUSB_GET_CONFIG_SIZE _IOR(0xF3,0x3E,__u32) | 322 | #define SISUSB_GET_CONFIG_SIZE _IOR(0xF3,0x3E,__u32) |
275 | #define SISUSB_GET_CONFIG _IOR(0xF3,0x3F,struct sisusb_info) | 323 | #define SISUSB_GET_CONFIG _IOR(0xF3,0x3F,struct sisusb_info) |
324 | |||
276 | 325 | ||
277 | #endif /* SISUSB_H */ | 326 | #endif /* SISUSB_H */ |
278 | 327 | ||
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c b/drivers/usb/misc/sisusbvga/sisusb_con.c new file mode 100644 index 000000000000..24584463553d --- /dev/null +++ b/drivers/usb/misc/sisusbvga/sisusb_con.c | |||
@@ -0,0 +1,1658 @@ | |||
1 | /* | ||
2 | * sisusb - usb kernel driver for SiS315(E) based USB2VGA dongles | ||
3 | * | ||
4 | * VGA text mode console part | ||
5 | * | ||
6 | * Copyright (C) 2005 by Thomas Winischhofer, Vienna, Austria | ||
7 | * | ||
8 | * If distributed as part of the Linux kernel, this code is licensed under the | ||
9 | * terms of the GPL v2. | ||
10 | * | ||
11 | * Otherwise, the following license terms apply: | ||
12 | * | ||
13 | * * Redistribution and use in source and binary forms, with or without | ||
14 | * * modification, are permitted provided that the following conditions | ||
15 | * * are met: | ||
16 | * * 1) Redistributions of source code must retain the above copyright | ||
17 | * * notice, this list of conditions and the following disclaimer. | ||
18 | * * 2) Redistributions in binary form must reproduce the above copyright | ||
19 | * * notice, this list of conditions and the following disclaimer in the | ||
20 | * * documentation and/or other materials provided with the distribution. | ||
21 | * * 3) The name of the author may not be used to endorse or promote products | ||
22 | * * derived from this software without specific psisusbr written permission. | ||
23 | * * | ||
24 | * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR | ||
25 | * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
26 | * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
27 | * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
28 | * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
29 | * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
30 | * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
31 | * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
32 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
33 | * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
34 | * | ||
35 | * Author: Thomas Winischhofer <thomas@winischhofer.net> | ||
36 | * | ||
37 | * Portions based on vgacon.c which are | ||
38 | * Created 28 Sep 1997 by Geert Uytterhoeven | ||
39 | * Rewritten by Martin Mares <mj@ucw.cz>, July 1998 | ||
40 | * based on code Copyright (C) 1991, 1992 Linus Torvalds | ||
41 | * 1995 Jay Estabrook | ||
42 | * | ||
43 | * A note on using in_atomic() in here: We can't handle console | ||
44 | * calls from non-schedulable context due to our USB-dependend | ||
45 | * nature. For now, this driver just ignores any calls if it | ||
46 | * detects this state. | ||
47 | * | ||
48 | */ | ||
49 | |||
50 | #include <linux/config.h> | ||
51 | #include <linux/version.h> | ||
52 | #include <linux/module.h> | ||
53 | #include <linux/kernel.h> | ||
54 | #include <linux/signal.h> | ||
55 | #include <linux/sched.h> | ||
56 | #include <linux/fs.h> | ||
57 | #include <linux/tty.h> | ||
58 | #include <linux/console.h> | ||
59 | #include <linux/string.h> | ||
60 | #include <linux/kd.h> | ||
61 | #include <linux/init.h> | ||
62 | #include <linux/slab.h> | ||
63 | #include <linux/vt_kern.h> | ||
64 | #include <linux/selection.h> | ||
65 | #include <linux/spinlock.h> | ||
66 | #include <linux/kref.h> | ||
67 | #include <linux/smp_lock.h> | ||
68 | #include <linux/ioport.h> | ||
69 | #include <linux/interrupt.h> | ||
70 | #include <linux/vmalloc.h> | ||
71 | |||
72 | #include "sisusb.h" | ||
73 | |||
74 | #ifdef INCL_SISUSB_CON | ||
75 | extern int sisusb_setreg(struct sisusb_usb_data *, int, u8); | ||
76 | extern int sisusb_getreg(struct sisusb_usb_data *, int, u8 *); | ||
77 | extern int sisusb_setidxreg(struct sisusb_usb_data *, int, u8, u8); | ||
78 | extern int sisusb_getidxreg(struct sisusb_usb_data *, int, u8, u8 *); | ||
79 | extern int sisusb_setidxregor(struct sisusb_usb_data *, int, u8, u8); | ||
80 | extern int sisusb_setidxregand(struct sisusb_usb_data *, int, u8, u8); | ||
81 | extern int sisusb_setidxregandor(struct sisusb_usb_data *, int, u8, u8, u8); | ||
82 | |||
83 | extern int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data); | ||
84 | extern int sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data); | ||
85 | extern int sisusb_writew(struct sisusb_usb_data *sisusb, u32 adr, u16 data); | ||
86 | extern int sisusb_readw(struct sisusb_usb_data *sisusb, u32 adr, u16 *data); | ||
87 | extern int sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src, | ||
88 | u32 dest, int length, size_t *bytes_written); | ||
89 | |||
90 | extern void sisusb_delete(struct kref *kref); | ||
91 | extern int sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init); | ||
92 | |||
93 | extern int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); | ||
94 | |||
95 | #define sisusbcon_writew(val, addr) (*(addr) = (val)) | ||
96 | #define sisusbcon_readw(addr) (*(addr)) | ||
97 | #define sisusbcon_memmovew(d, s, c) memmove(d, s, c) | ||
98 | #define sisusbcon_memcpyw(d, s, c) memcpy(d, s, c) | ||
99 | |||
100 | /* vc_data -> sisusb conversion table */ | ||
101 | static struct sisusb_usb_data *mysisusbs[MAX_NR_CONSOLES]; | ||
102 | |||
103 | /* Forward declaration */ | ||
104 | static const struct consw sisusb_con; | ||
105 | |||
106 | extern struct semaphore disconnect_sem; | ||
107 | |||
108 | static inline void | ||
109 | sisusbcon_memsetw(u16 *s, u16 c, unsigned int count) | ||
110 | { | ||
111 | count /= 2; | ||
112 | while (count--) | ||
113 | sisusbcon_writew(c, s++); | ||
114 | } | ||
115 | |||
116 | static inline void | ||
117 | sisusb_initialize(struct sisusb_usb_data *sisusb) | ||
118 | { | ||
119 | /* Reset cursor and start address */ | ||
120 | if (sisusb_setidxreg(sisusb, SISCR, 0x0c, 0x00)) | ||
121 | return; | ||
122 | if (sisusb_setidxreg(sisusb, SISCR, 0x0d, 0x00)) | ||
123 | return; | ||
124 | if (sisusb_setidxreg(sisusb, SISCR, 0x0e, 0x00)) | ||
125 | return; | ||
126 | sisusb_setidxreg(sisusb, SISCR, 0x0f, 0x00); | ||
127 | } | ||
128 | |||
129 | static inline void | ||
130 | sisusbcon_set_start_address(struct sisusb_usb_data *sisusb, struct vc_data *c) | ||
131 | { | ||
132 | sisusb->cur_start_addr = (c->vc_visible_origin - sisusb->scrbuf) / 2; | ||
133 | |||
134 | sisusb_setidxreg(sisusb, SISCR, 0x0c, (sisusb->cur_start_addr >> 8)); | ||
135 | sisusb_setidxreg(sisusb, SISCR, 0x0d, (sisusb->cur_start_addr & 0xff)); | ||
136 | } | ||
137 | |||
138 | void | ||
139 | sisusb_set_cursor(struct sisusb_usb_data *sisusb, unsigned int location) | ||
140 | { | ||
141 | if (sisusb->sisusb_cursor_loc == location) | ||
142 | return; | ||
143 | |||
144 | sisusb->sisusb_cursor_loc = location; | ||
145 | |||
146 | /* Hardware bug: Text cursor appears twice or not at all | ||
147 | * at some positions. Work around it with the cursor skew | ||
148 | * bits. | ||
149 | */ | ||
150 | |||
151 | if ((location & 0x0007) == 0x0007) { | ||
152 | sisusb->bad_cursor_pos = 1; | ||
153 | location--; | ||
154 | if (sisusb_setidxregandor(sisusb, SISCR, 0x0b, 0x1f, 0x20)) | ||
155 | return; | ||
156 | } else if (sisusb->bad_cursor_pos) { | ||
157 | if (sisusb_setidxregand(sisusb, SISCR, 0x0b, 0x1f)) | ||
158 | return; | ||
159 | sisusb->bad_cursor_pos = 0; | ||
160 | } | ||
161 | |||
162 | if (sisusb_setidxreg(sisusb, SISCR, 0x0e, (location >> 8))) | ||
163 | return; | ||
164 | sisusb_setidxreg(sisusb, SISCR, 0x0f, (location & 0xff)); | ||
165 | } | ||
166 | |||
167 | static inline struct sisusb_usb_data * | ||
168 | sisusb_get_sisusb(unsigned short console) | ||
169 | { | ||
170 | return mysisusbs[console]; | ||
171 | } | ||
172 | |||
173 | static inline int | ||
174 | sisusb_sisusb_valid(struct sisusb_usb_data *sisusb) | ||
175 | { | ||
176 | if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) | ||
177 | return 0; | ||
178 | |||
179 | return 1; | ||
180 | } | ||
181 | |||
182 | static struct sisusb_usb_data * | ||
183 | sisusb_get_sisusb_lock_and_check(unsigned short console) | ||
184 | { | ||
185 | struct sisusb_usb_data *sisusb; | ||
186 | |||
187 | /* We can't handle console calls in non-schedulable | ||
188 | * context due to our locks and the USB transport. | ||
189 | * So we simply ignore them. This should only affect | ||
190 | * some calls to printk. | ||
191 | */ | ||
192 | if (in_atomic()) | ||
193 | return NULL; | ||
194 | |||
195 | if (!(sisusb = sisusb_get_sisusb(console))) | ||
196 | return NULL; | ||
197 | |||
198 | down(&sisusb->lock); | ||
199 | |||
200 | if (!sisusb_sisusb_valid(sisusb) || | ||
201 | !sisusb->havethisconsole[console]) { | ||
202 | up(&sisusb->lock); | ||
203 | return NULL; | ||
204 | } | ||
205 | |||
206 | return sisusb; | ||
207 | } | ||
208 | |||
209 | static int | ||
210 | sisusb_is_inactive(struct vc_data *c, struct sisusb_usb_data *sisusb) | ||
211 | { | ||
212 | if (sisusb->is_gfx || | ||
213 | sisusb->textmodedestroyed || | ||
214 | c->vc_mode != KD_TEXT) | ||
215 | return 1; | ||
216 | |||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | /* con_startup console interface routine */ | ||
221 | static const char * | ||
222 | sisusbcon_startup(void) | ||
223 | { | ||
224 | return "SISUSBCON"; | ||
225 | } | ||
226 | |||
227 | /* con_init console interface routine */ | ||
228 | static void | ||
229 | sisusbcon_init(struct vc_data *c, int init) | ||
230 | { | ||
231 | struct sisusb_usb_data *sisusb; | ||
232 | int cols, rows; | ||
233 | |||
234 | /* This is called by take_over_console(), | ||
235 | * ie by us/under our control. It is | ||
236 | * only called after text mode and fonts | ||
237 | * are set up/restored. | ||
238 | */ | ||
239 | |||
240 | down(&disconnect_sem); | ||
241 | |||
242 | if (!(sisusb = sisusb_get_sisusb(c->vc_num))) { | ||
243 | up(&disconnect_sem); | ||
244 | return; | ||
245 | } | ||
246 | |||
247 | down(&sisusb->lock); | ||
248 | |||
249 | if (!sisusb_sisusb_valid(sisusb)) { | ||
250 | up(&sisusb->lock); | ||
251 | up(&disconnect_sem); | ||
252 | return; | ||
253 | } | ||
254 | |||
255 | c->vc_can_do_color = 1; | ||
256 | |||
257 | c->vc_complement_mask = 0x7700; | ||
258 | |||
259 | c->vc_hi_font_mask = sisusb->current_font_512 ? 0x0800 : 0; | ||
260 | |||
261 | sisusb->haveconsole = 1; | ||
262 | |||
263 | sisusb->havethisconsole[c->vc_num] = 1; | ||
264 | |||
265 | /* We only support 640x400 */ | ||
266 | c->vc_scan_lines = 400; | ||
267 | |||
268 | c->vc_font.height = sisusb->current_font_height; | ||
269 | |||
270 | /* We only support width = 8 */ | ||
271 | cols = 80; | ||
272 | rows = c->vc_scan_lines / c->vc_font.height; | ||
273 | |||
274 | /* Increment usage count for our sisusb. | ||
275 | * Doing so saves us from upping/downing | ||
276 | * the disconnect semaphore; we can't | ||
277 | * lose our sisusb until this is undone | ||
278 | * in con_deinit. For all other console | ||
279 | * interface functions, it suffices to | ||
280 | * use sisusb->lock and do a quick check | ||
281 | * of sisusb for device disconnection. | ||
282 | */ | ||
283 | kref_get(&sisusb->kref); | ||
284 | |||
285 | if (!*c->vc_uni_pagedir_loc) | ||
286 | con_set_default_unimap(c); | ||
287 | |||
288 | up(&sisusb->lock); | ||
289 | |||
290 | up(&disconnect_sem); | ||
291 | |||
292 | if (init) { | ||
293 | c->vc_cols = cols; | ||
294 | c->vc_rows = rows; | ||
295 | } else | ||
296 | vc_resize(c, cols, rows); | ||
297 | } | ||
298 | |||
299 | /* con_deinit console interface routine */ | ||
300 | static void | ||
301 | sisusbcon_deinit(struct vc_data *c) | ||
302 | { | ||
303 | struct sisusb_usb_data *sisusb; | ||
304 | int i; | ||
305 | |||
306 | /* This is called by take_over_console() | ||
307 | * and others, ie not under our control. | ||
308 | */ | ||
309 | |||
310 | down(&disconnect_sem); | ||
311 | |||
312 | if (!(sisusb = sisusb_get_sisusb(c->vc_num))) { | ||
313 | up(&disconnect_sem); | ||
314 | return; | ||
315 | } | ||
316 | |||
317 | down(&sisusb->lock); | ||
318 | |||
319 | /* Clear ourselves in mysisusbs */ | ||
320 | mysisusbs[c->vc_num] = NULL; | ||
321 | |||
322 | sisusb->havethisconsole[c->vc_num] = 0; | ||
323 | |||
324 | /* Free our font buffer if all consoles are gone */ | ||
325 | if (sisusb->font_backup) { | ||
326 | for(i = 0; i < MAX_NR_CONSOLES; i++) { | ||
327 | if (sisusb->havethisconsole[c->vc_num]) | ||
328 | break; | ||
329 | } | ||
330 | if (i == MAX_NR_CONSOLES) { | ||
331 | vfree(sisusb->font_backup); | ||
332 | sisusb->font_backup = NULL; | ||
333 | } | ||
334 | } | ||
335 | |||
336 | up(&sisusb->lock); | ||
337 | |||
338 | /* decrement the usage count on our sisusb */ | ||
339 | kref_put(&sisusb->kref, sisusb_delete); | ||
340 | |||
341 | up(&disconnect_sem); | ||
342 | } | ||
343 | |||
344 | /* interface routine */ | ||
345 | static u8 | ||
346 | sisusbcon_build_attr(struct vc_data *c, u8 color, u8 intensity, | ||
347 | u8 blink, u8 underline, u8 reverse) | ||
348 | { | ||
349 | u8 attr = color; | ||
350 | |||
351 | if (underline) | ||
352 | attr = (attr & 0xf0) | c->vc_ulcolor; | ||
353 | else if (intensity == 0) | ||
354 | attr = (attr & 0xf0) | c->vc_halfcolor; | ||
355 | |||
356 | if (reverse) | ||
357 | attr = ((attr) & 0x88) | | ||
358 | ((((attr) >> 4) | | ||
359 | ((attr) << 4)) & 0x77); | ||
360 | |||
361 | if (blink) | ||
362 | attr ^= 0x80; | ||
363 | |||
364 | if (intensity == 2) | ||
365 | attr ^= 0x08; | ||
366 | |||
367 | return attr; | ||
368 | } | ||
369 | |||
370 | /* Interface routine */ | ||
371 | static void | ||
372 | sisusbcon_invert_region(struct vc_data *vc, u16 *p, int count) | ||
373 | { | ||
374 | /* Invert a region. This is called with a pointer | ||
375 | * to the console's internal screen buffer. So we | ||
376 | * simply do the inversion there and rely on | ||
377 | * a call to putc(s) to update the real screen. | ||
378 | */ | ||
379 | |||
380 | while (count--) { | ||
381 | u16 a = sisusbcon_readw(p); | ||
382 | |||
383 | a = ((a) & 0x88ff) | | ||
384 | (((a) & 0x7000) >> 4) | | ||
385 | (((a) & 0x0700) << 4); | ||
386 | |||
387 | sisusbcon_writew(a, p++); | ||
388 | } | ||
389 | } | ||
390 | |||
391 | #define SISUSB_VADDR(x,y) \ | ||
392 | ((u16 *)c->vc_origin + \ | ||
393 | (y) * sisusb->sisusb_num_columns + \ | ||
394 | (x)) | ||
395 | |||
396 | #define SISUSB_HADDR(x,y) \ | ||
397 | ((u16 *)(sisusb->vrambase + (c->vc_origin - sisusb->scrbuf)) + \ | ||
398 | (y) * sisusb->sisusb_num_columns + \ | ||
399 | (x)) | ||
400 | |||
401 | /* Interface routine */ | ||
402 | static void | ||
403 | sisusbcon_putc(struct vc_data *c, int ch, int y, int x) | ||
404 | { | ||
405 | struct sisusb_usb_data *sisusb; | ||
406 | ssize_t written; | ||
407 | |||
408 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
409 | return; | ||
410 | |||
411 | /* sisusb->lock is down */ | ||
412 | |||
413 | /* Don't need to put the character into buffer ourselves, | ||
414 | * because the vt does this BEFORE calling us. | ||
415 | */ | ||
416 | #if 0 | ||
417 | sisusbcon_writew(ch, SISUSB_VADDR(x, y)); | ||
418 | #endif | ||
419 | |||
420 | if (sisusb_is_inactive(c, sisusb)) { | ||
421 | up(&sisusb->lock); | ||
422 | return; | ||
423 | } | ||
424 | |||
425 | |||
426 | sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(x, y), | ||
427 | (u32)SISUSB_HADDR(x, y), 2, &written); | ||
428 | |||
429 | up(&sisusb->lock); | ||
430 | } | ||
431 | |||
432 | /* Interface routine */ | ||
433 | static void | ||
434 | sisusbcon_putcs(struct vc_data *c, const unsigned short *s, | ||
435 | int count, int y, int x) | ||
436 | { | ||
437 | struct sisusb_usb_data *sisusb; | ||
438 | ssize_t written; | ||
439 | u16 *dest; | ||
440 | int i; | ||
441 | |||
442 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
443 | return; | ||
444 | |||
445 | /* sisusb->lock is down */ | ||
446 | |||
447 | /* Need to put the characters into the buffer ourselves, | ||
448 | * because the vt does this AFTER calling us. | ||
449 | */ | ||
450 | |||
451 | dest = SISUSB_VADDR(x, y); | ||
452 | |||
453 | for (i = count; i > 0; i--) | ||
454 | sisusbcon_writew(sisusbcon_readw(s++), dest++); | ||
455 | |||
456 | if (sisusb_is_inactive(c, sisusb)) { | ||
457 | up(&sisusb->lock); | ||
458 | return; | ||
459 | } | ||
460 | |||
461 | sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(x, y), | ||
462 | (u32)SISUSB_HADDR(x, y), count * 2, &written); | ||
463 | |||
464 | up(&sisusb->lock); | ||
465 | } | ||
466 | |||
467 | /* Interface routine */ | ||
468 | static void | ||
469 | sisusbcon_clear(struct vc_data *c, int y, int x, int height, int width) | ||
470 | { | ||
471 | struct sisusb_usb_data *sisusb; | ||
472 | u16 eattr = c->vc_video_erase_char; | ||
473 | ssize_t written; | ||
474 | int i, length, cols; | ||
475 | u16 *dest; | ||
476 | |||
477 | if (width <= 0 || height <= 0) | ||
478 | return; | ||
479 | |||
480 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
481 | return; | ||
482 | |||
483 | /* sisusb->lock is down */ | ||
484 | |||
485 | /* Need to clear buffer ourselves, because the vt does | ||
486 | * this AFTER calling us. | ||
487 | */ | ||
488 | |||
489 | dest = SISUSB_VADDR(x, y); | ||
490 | |||
491 | cols = sisusb->sisusb_num_columns; | ||
492 | |||
493 | if (width > cols) | ||
494 | width = cols; | ||
495 | |||
496 | if (x == 0 && width >= c->vc_cols) { | ||
497 | |||
498 | sisusbcon_memsetw(dest, eattr, height * cols * 2); | ||
499 | |||
500 | } else { | ||
501 | |||
502 | for (i = height; i > 0; i--, dest += cols) | ||
503 | sisusbcon_memsetw(dest, eattr, width * 2); | ||
504 | |||
505 | } | ||
506 | |||
507 | if (sisusb_is_inactive(c, sisusb)) { | ||
508 | up(&sisusb->lock); | ||
509 | return; | ||
510 | } | ||
511 | |||
512 | length = ((height * cols) - x - (cols - width - x)) * 2; | ||
513 | |||
514 | |||
515 | sisusb_copy_memory(sisusb, (unsigned char *)SISUSB_VADDR(x, y), | ||
516 | (u32)SISUSB_HADDR(x, y), length, &written); | ||
517 | |||
518 | up(&sisusb->lock); | ||
519 | } | ||
520 | |||
521 | /* Interface routine */ | ||
522 | static void | ||
523 | sisusbcon_bmove(struct vc_data *c, int sy, int sx, | ||
524 | int dy, int dx, int height, int width) | ||
525 | { | ||
526 | struct sisusb_usb_data *sisusb; | ||
527 | ssize_t written; | ||
528 | int cols, length; | ||
529 | #if 0 | ||
530 | u16 *src, *dest; | ||
531 | int i; | ||
532 | #endif | ||
533 | |||
534 | if (width <= 0 || height <= 0) | ||
535 | return; | ||
536 | |||
537 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
538 | return; | ||
539 | |||
540 | /* sisusb->lock is down */ | ||
541 | |||
542 | cols = sisusb->sisusb_num_columns; | ||
543 | |||
544 | /* Don't need to move data outselves, because | ||
545 | * vt does this BEFORE calling us. | ||
546 | * This is only used by vt's insert/deletechar. | ||
547 | */ | ||
548 | #if 0 | ||
549 | if (sx == 0 && dx == 0 && width >= c->vc_cols && width <= cols) { | ||
550 | |||
551 | sisusbcon_memmovew(SISUSB_VADDR(0, dy), SISUSB_VADDR(0, sy), | ||
552 | height * width * 2); | ||
553 | |||
554 | } else if (dy < sy || (dy == sy && dx < sx)) { | ||
555 | |||
556 | src = SISUSB_VADDR(sx, sy); | ||
557 | dest = SISUSB_VADDR(dx, dy); | ||
558 | |||
559 | for (i = height; i > 0; i--) { | ||
560 | sisusbcon_memmovew(dest, src, width * 2); | ||
561 | src += cols; | ||
562 | dest += cols; | ||
563 | } | ||
564 | |||
565 | } else { | ||
566 | |||
567 | src = SISUSB_VADDR(sx, sy + height - 1); | ||
568 | dest = SISUSB_VADDR(dx, dy + height - 1); | ||
569 | |||
570 | for (i = height; i > 0; i--) { | ||
571 | sisusbcon_memmovew(dest, src, width * 2); | ||
572 | src -= cols; | ||
573 | dest -= cols; | ||
574 | } | ||
575 | |||
576 | } | ||
577 | #endif | ||
578 | |||
579 | if (sisusb_is_inactive(c, sisusb)) { | ||
580 | up(&sisusb->lock); | ||
581 | return; | ||
582 | } | ||
583 | |||
584 | length = ((height * cols) - dx - (cols - width - dx)) * 2; | ||
585 | |||
586 | |||
587 | sisusb_copy_memory(sisusb, (unsigned char *)SISUSB_VADDR(dx, dy), | ||
588 | (u32)SISUSB_HADDR(dx, dy), length, &written); | ||
589 | |||
590 | up(&sisusb->lock); | ||
591 | } | ||
592 | |||
593 | /* interface routine */ | ||
594 | static int | ||
595 | sisusbcon_switch(struct vc_data *c) | ||
596 | { | ||
597 | struct sisusb_usb_data *sisusb; | ||
598 | ssize_t written; | ||
599 | int length; | ||
600 | |||
601 | /* Returnvalue 0 means we have fully restored screen, | ||
602 | * and vt doesn't need to call do_update_region(). | ||
603 | * Returnvalue != 0 naturally means the opposite. | ||
604 | */ | ||
605 | |||
606 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
607 | return 0; | ||
608 | |||
609 | /* sisusb->lock is down */ | ||
610 | |||
611 | /* Don't write to screen if in gfx mode */ | ||
612 | if (sisusb_is_inactive(c, sisusb)) { | ||
613 | up(&sisusb->lock); | ||
614 | return 0; | ||
615 | } | ||
616 | |||
617 | /* That really should not happen. It would mean we are | ||
618 | * being called while the vc is using its private buffer | ||
619 | * as origin. | ||
620 | */ | ||
621 | if (c->vc_origin == (unsigned long)c->vc_screenbuf) { | ||
622 | up(&sisusb->lock); | ||
623 | printk(KERN_DEBUG "sisusb: ASSERT ORIGIN != SCREENBUF!\n"); | ||
624 | return 0; | ||
625 | } | ||
626 | |||
627 | /* Check that we don't copy too much */ | ||
628 | length = min((int)c->vc_screenbuf_size, | ||
629 | (int)(sisusb->scrbuf + sisusb->scrbuf_size - c->vc_origin)); | ||
630 | |||
631 | /* Restore the screen contents */ | ||
632 | sisusbcon_memcpyw((u16 *)c->vc_origin, (u16 *)c->vc_screenbuf, | ||
633 | length); | ||
634 | |||
635 | sisusb_copy_memory(sisusb, (unsigned char *)c->vc_origin, | ||
636 | (u32)SISUSB_HADDR(0, 0), | ||
637 | length, &written); | ||
638 | |||
639 | up(&sisusb->lock); | ||
640 | |||
641 | return 0; | ||
642 | } | ||
643 | |||
644 | /* interface routine */ | ||
645 | static void | ||
646 | sisusbcon_save_screen(struct vc_data *c) | ||
647 | { | ||
648 | struct sisusb_usb_data *sisusb; | ||
649 | int length; | ||
650 | |||
651 | /* Save the current screen contents to vc's private | ||
652 | * buffer. | ||
653 | */ | ||
654 | |||
655 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
656 | return; | ||
657 | |||
658 | /* sisusb->lock is down */ | ||
659 | |||
660 | if (sisusb_is_inactive(c, sisusb)) { | ||
661 | up(&sisusb->lock); | ||
662 | return; | ||
663 | } | ||
664 | |||
665 | /* Check that we don't copy too much */ | ||
666 | length = min((int)c->vc_screenbuf_size, | ||
667 | (int)(sisusb->scrbuf + sisusb->scrbuf_size - c->vc_origin)); | ||
668 | |||
669 | /* Save the screen contents to vc's private buffer */ | ||
670 | sisusbcon_memcpyw((u16 *)c->vc_screenbuf, (u16 *)c->vc_origin, | ||
671 | length); | ||
672 | |||
673 | up(&sisusb->lock); | ||
674 | } | ||
675 | |||
676 | /* interface routine */ | ||
677 | static int | ||
678 | sisusbcon_set_palette(struct vc_data *c, unsigned char *table) | ||
679 | { | ||
680 | struct sisusb_usb_data *sisusb; | ||
681 | int i, j; | ||
682 | |||
683 | /* Return value not used by vt */ | ||
684 | |||
685 | if (!CON_IS_VISIBLE(c)) | ||
686 | return -EINVAL; | ||
687 | |||
688 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
689 | return -EINVAL; | ||
690 | |||
691 | /* sisusb->lock is down */ | ||
692 | |||
693 | if (sisusb_is_inactive(c, sisusb)) { | ||
694 | up(&sisusb->lock); | ||
695 | return -EINVAL; | ||
696 | } | ||
697 | |||
698 | for (i = j = 0; i < 16; i++) { | ||
699 | if (sisusb_setreg(sisusb, SISCOLIDX, table[i])) | ||
700 | break; | ||
701 | if (sisusb_setreg(sisusb, SISCOLDATA, c->vc_palette[j++] >> 2)) | ||
702 | break; | ||
703 | if (sisusb_setreg(sisusb, SISCOLDATA, c->vc_palette[j++] >> 2)) | ||
704 | break; | ||
705 | if (sisusb_setreg(sisusb, SISCOLDATA, c->vc_palette[j++] >> 2)) | ||
706 | break; | ||
707 | } | ||
708 | |||
709 | up(&sisusb->lock); | ||
710 | |||
711 | return 0; | ||
712 | } | ||
713 | |||
714 | /* interface routine */ | ||
715 | static int | ||
716 | sisusbcon_blank(struct vc_data *c, int blank, int mode_switch) | ||
717 | { | ||
718 | struct sisusb_usb_data *sisusb; | ||
719 | u8 sr1, cr17, pmreg, cr63; | ||
720 | ssize_t written; | ||
721 | int ret = 0; | ||
722 | |||
723 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
724 | return 0; | ||
725 | |||
726 | /* sisusb->lock is down */ | ||
727 | |||
728 | if (mode_switch) | ||
729 | sisusb->is_gfx = blank ? 1 : 0; | ||
730 | |||
731 | if (sisusb_is_inactive(c, sisusb)) { | ||
732 | up(&sisusb->lock); | ||
733 | return 0; | ||
734 | } | ||
735 | |||
736 | switch (blank) { | ||
737 | |||
738 | case 1: /* Normal blanking: Clear screen */ | ||
739 | case -1: | ||
740 | sisusbcon_memsetw((u16 *)c->vc_origin, | ||
741 | c->vc_video_erase_char, | ||
742 | c->vc_screenbuf_size); | ||
743 | sisusb_copy_memory(sisusb, | ||
744 | (unsigned char *)c->vc_origin, | ||
745 | (u32)(sisusb->vrambase + | ||
746 | (c->vc_origin - sisusb->scrbuf)), | ||
747 | c->vc_screenbuf_size, &written); | ||
748 | sisusb->con_blanked = 1; | ||
749 | ret = 1; | ||
750 | break; | ||
751 | |||
752 | default: /* VESA blanking */ | ||
753 | switch (blank) { | ||
754 | case 0: /* Unblank */ | ||
755 | sr1 = 0x00; | ||
756 | cr17 = 0x80; | ||
757 | pmreg = 0x00; | ||
758 | cr63 = 0x00; | ||
759 | ret = 1; | ||
760 | sisusb->con_blanked = 0; | ||
761 | break; | ||
762 | case VESA_VSYNC_SUSPEND + 1: | ||
763 | sr1 = 0x20; | ||
764 | cr17 = 0x80; | ||
765 | pmreg = 0x80; | ||
766 | cr63 = 0x40; | ||
767 | break; | ||
768 | case VESA_HSYNC_SUSPEND + 1: | ||
769 | sr1 = 0x20; | ||
770 | cr17 = 0x80; | ||
771 | pmreg = 0x40; | ||
772 | cr63 = 0x40; | ||
773 | break; | ||
774 | case VESA_POWERDOWN + 1: | ||
775 | sr1 = 0x20; | ||
776 | cr17 = 0x00; | ||
777 | pmreg = 0xc0; | ||
778 | cr63 = 0x40; | ||
779 | break; | ||
780 | default: | ||
781 | up(&sisusb->lock); | ||
782 | return -EINVAL; | ||
783 | } | ||
784 | |||
785 | sisusb_setidxregandor(sisusb, SISSR, 0x01, ~0x20, sr1); | ||
786 | sisusb_setidxregandor(sisusb, SISCR, 0x17, 0x7f, cr17); | ||
787 | sisusb_setidxregandor(sisusb, SISSR, 0x1f, 0x3f, pmreg); | ||
788 | sisusb_setidxregandor(sisusb, SISCR, 0x63, 0xbf, cr63); | ||
789 | |||
790 | } | ||
791 | |||
792 | up(&sisusb->lock); | ||
793 | |||
794 | return ret; | ||
795 | } | ||
796 | |||
797 | /* interface routine */ | ||
798 | static int | ||
799 | sisusbcon_scrolldelta(struct vc_data *c, int lines) | ||
800 | { | ||
801 | struct sisusb_usb_data *sisusb; | ||
802 | int margin = c->vc_size_row * 4; | ||
803 | int ul, we, p, st; | ||
804 | |||
805 | /* The return value does not seem to be used */ | ||
806 | |||
807 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
808 | return 0; | ||
809 | |||
810 | /* sisusb->lock is down */ | ||
811 | |||
812 | if (sisusb_is_inactive(c, sisusb)) { | ||
813 | up(&sisusb->lock); | ||
814 | return 0; | ||
815 | } | ||
816 | |||
817 | if (!lines) /* Turn scrollback off */ | ||
818 | c->vc_visible_origin = c->vc_origin; | ||
819 | else { | ||
820 | |||
821 | if (sisusb->con_rolled_over > | ||
822 | (c->vc_scr_end - sisusb->scrbuf) + margin) { | ||
823 | |||
824 | ul = c->vc_scr_end - sisusb->scrbuf; | ||
825 | we = sisusb->con_rolled_over + c->vc_size_row; | ||
826 | |||
827 | } else { | ||
828 | |||
829 | ul = 0; | ||
830 | we = sisusb->scrbuf_size; | ||
831 | |||
832 | } | ||
833 | |||
834 | p = (c->vc_visible_origin - sisusb->scrbuf - ul + we) % we + | ||
835 | lines * c->vc_size_row; | ||
836 | |||
837 | st = (c->vc_origin - sisusb->scrbuf - ul + we) % we; | ||
838 | |||
839 | if (st < 2 * margin) | ||
840 | margin = 0; | ||
841 | |||
842 | if (p < margin) | ||
843 | p = 0; | ||
844 | |||
845 | if (p > st - margin) | ||
846 | p = st; | ||
847 | |||
848 | c->vc_visible_origin = sisusb->scrbuf + (p + ul) % we; | ||
849 | } | ||
850 | |||
851 | sisusbcon_set_start_address(sisusb, c); | ||
852 | |||
853 | up(&sisusb->lock); | ||
854 | |||
855 | return 1; | ||
856 | } | ||
857 | |||
858 | /* Interface routine */ | ||
859 | static void | ||
860 | sisusbcon_cursor(struct vc_data *c, int mode) | ||
861 | { | ||
862 | struct sisusb_usb_data *sisusb; | ||
863 | int from, to, baseline; | ||
864 | |||
865 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
866 | return; | ||
867 | |||
868 | /* sisusb->lock is down */ | ||
869 | |||
870 | if (sisusb_is_inactive(c, sisusb)) { | ||
871 | up(&sisusb->lock); | ||
872 | return; | ||
873 | } | ||
874 | |||
875 | if (c->vc_origin != c->vc_visible_origin) { | ||
876 | c->vc_visible_origin = c->vc_origin; | ||
877 | sisusbcon_set_start_address(sisusb, c); | ||
878 | } | ||
879 | |||
880 | if (mode == CM_ERASE) { | ||
881 | sisusb_setidxregor(sisusb, SISCR, 0x0a, 0x20); | ||
882 | sisusb->sisusb_cursor_size_to = -1; | ||
883 | up(&sisusb->lock); | ||
884 | return; | ||
885 | } | ||
886 | |||
887 | sisusb_set_cursor(sisusb, (c->vc_pos - sisusb->scrbuf) / 2); | ||
888 | |||
889 | baseline = c->vc_font.height - (c->vc_font.height < 10 ? 1 : 2); | ||
890 | |||
891 | switch (c->vc_cursor_type & 0x0f) { | ||
892 | case CUR_BLOCK: from = 1; | ||
893 | to = c->vc_font.height; | ||
894 | break; | ||
895 | case CUR_TWO_THIRDS: from = c->vc_font.height / 3; | ||
896 | to = baseline; | ||
897 | break; | ||
898 | case CUR_LOWER_HALF: from = c->vc_font.height / 2; | ||
899 | to = baseline; | ||
900 | break; | ||
901 | case CUR_LOWER_THIRD: from = (c->vc_font.height * 2) / 3; | ||
902 | to = baseline; | ||
903 | break; | ||
904 | case CUR_NONE: from = 31; | ||
905 | to = 30; | ||
906 | break; | ||
907 | default: | ||
908 | case CUR_UNDERLINE: from = baseline - 1; | ||
909 | to = baseline; | ||
910 | break; | ||
911 | } | ||
912 | |||
913 | if (sisusb->sisusb_cursor_size_from != from || | ||
914 | sisusb->sisusb_cursor_size_to != to) { | ||
915 | |||
916 | sisusb_setidxreg(sisusb, SISCR, 0x0a, from); | ||
917 | sisusb_setidxregandor(sisusb, SISCR, 0x0b, 0xe0, to); | ||
918 | |||
919 | sisusb->sisusb_cursor_size_from = from; | ||
920 | sisusb->sisusb_cursor_size_to = to; | ||
921 | } | ||
922 | |||
923 | up(&sisusb->lock); | ||
924 | } | ||
925 | |||
926 | static int | ||
927 | sisusbcon_scroll_area(struct vc_data *c, struct sisusb_usb_data *sisusb, | ||
928 | int t, int b, int dir, int lines) | ||
929 | { | ||
930 | int cols = sisusb->sisusb_num_columns; | ||
931 | int length = ((b - t) * cols) * 2; | ||
932 | u16 eattr = c->vc_video_erase_char; | ||
933 | ssize_t written; | ||
934 | |||
935 | /* sisusb->lock is down */ | ||
936 | |||
937 | /* Scroll an area which does not match the | ||
938 | * visible screen's dimensions. This needs | ||
939 | * to be done separately, as it does not | ||
940 | * use hardware panning. | ||
941 | */ | ||
942 | |||
943 | switch (dir) { | ||
944 | |||
945 | case SM_UP: | ||
946 | sisusbcon_memmovew(SISUSB_VADDR(0, t), | ||
947 | SISUSB_VADDR(0, t + lines), | ||
948 | (b - t - lines) * cols * 2); | ||
949 | sisusbcon_memsetw(SISUSB_VADDR(0, b - lines), eattr, | ||
950 | lines * cols * 2); | ||
951 | break; | ||
952 | |||
953 | case SM_DOWN: | ||
954 | sisusbcon_memmovew(SISUSB_VADDR(0, t + lines), | ||
955 | SISUSB_VADDR(0, t), | ||
956 | (b - t - lines) * cols * 2); | ||
957 | sisusbcon_memsetw(SISUSB_VADDR(0, t), eattr, | ||
958 | lines * cols * 2); | ||
959 | break; | ||
960 | } | ||
961 | |||
962 | sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(0, t), | ||
963 | (u32)SISUSB_HADDR(0, t), length, &written); | ||
964 | |||
965 | up(&sisusb->lock); | ||
966 | |||
967 | return 1; | ||
968 | } | ||
969 | |||
970 | /* Interface routine */ | ||
971 | static int | ||
972 | sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines) | ||
973 | { | ||
974 | struct sisusb_usb_data *sisusb; | ||
975 | u16 eattr = c->vc_video_erase_char; | ||
976 | ssize_t written; | ||
977 | int copyall = 0; | ||
978 | unsigned long oldorigin; | ||
979 | unsigned int delta = lines * c->vc_size_row; | ||
980 | u32 originoffset; | ||
981 | |||
982 | /* Returning != 0 means we have done the scrolling successfully. | ||
983 | * Returning 0 makes vt do the scrolling on its own. | ||
984 | * Note that con_scroll is only called if the console is | ||
985 | * visible. In that case, the origin should be our buffer, | ||
986 | * not the vt's private one. | ||
987 | */ | ||
988 | |||
989 | if (!lines) | ||
990 | return 1; | ||
991 | |||
992 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
993 | return 0; | ||
994 | |||
995 | /* sisusb->lock is down */ | ||
996 | |||
997 | if (sisusb_is_inactive(c, sisusb)) { | ||
998 | up(&sisusb->lock); | ||
999 | return 0; | ||
1000 | } | ||
1001 | |||
1002 | /* Special case */ | ||
1003 | if (t || b != c->vc_rows) | ||
1004 | return sisusbcon_scroll_area(c, sisusb, t, b, dir, lines); | ||
1005 | |||
1006 | if (c->vc_origin != c->vc_visible_origin) { | ||
1007 | c->vc_visible_origin = c->vc_origin; | ||
1008 | sisusbcon_set_start_address(sisusb, c); | ||
1009 | } | ||
1010 | |||
1011 | /* limit amount to maximum realistic size */ | ||
1012 | if (lines > c->vc_rows) | ||
1013 | lines = c->vc_rows; | ||
1014 | |||
1015 | oldorigin = c->vc_origin; | ||
1016 | |||
1017 | switch (dir) { | ||
1018 | |||
1019 | case SM_UP: | ||
1020 | |||
1021 | if (c->vc_scr_end + delta >= | ||
1022 | sisusb->scrbuf + sisusb->scrbuf_size) { | ||
1023 | sisusbcon_memcpyw((u16 *)sisusb->scrbuf, | ||
1024 | (u16 *)(oldorigin + delta), | ||
1025 | c->vc_screenbuf_size - delta); | ||
1026 | c->vc_origin = sisusb->scrbuf; | ||
1027 | sisusb->con_rolled_over = oldorigin - sisusb->scrbuf; | ||
1028 | copyall = 1; | ||
1029 | } else | ||
1030 | c->vc_origin += delta; | ||
1031 | |||
1032 | sisusbcon_memsetw( | ||
1033 | (u16 *)(c->vc_origin + c->vc_screenbuf_size - delta), | ||
1034 | eattr, delta); | ||
1035 | |||
1036 | break; | ||
1037 | |||
1038 | case SM_DOWN: | ||
1039 | |||
1040 | if (oldorigin - delta < sisusb->scrbuf) { | ||
1041 | sisusbcon_memmovew((u16 *)(sisusb->scrbuf + | ||
1042 | sisusb->scrbuf_size - | ||
1043 | c->vc_screenbuf_size + | ||
1044 | delta), | ||
1045 | (u16 *)oldorigin, | ||
1046 | c->vc_screenbuf_size - delta); | ||
1047 | c->vc_origin = sisusb->scrbuf + | ||
1048 | sisusb->scrbuf_size - | ||
1049 | c->vc_screenbuf_size; | ||
1050 | sisusb->con_rolled_over = 0; | ||
1051 | copyall = 1; | ||
1052 | } else | ||
1053 | c->vc_origin -= delta; | ||
1054 | |||
1055 | c->vc_scr_end = c->vc_origin + c->vc_screenbuf_size; | ||
1056 | |||
1057 | scr_memsetw((u16 *)(c->vc_origin), eattr, delta); | ||
1058 | |||
1059 | break; | ||
1060 | } | ||
1061 | |||
1062 | originoffset = (u32)(c->vc_origin - sisusb->scrbuf); | ||
1063 | |||
1064 | if (copyall) | ||
1065 | sisusb_copy_memory(sisusb, | ||
1066 | (char *)c->vc_origin, | ||
1067 | (u32)(sisusb->vrambase + originoffset), | ||
1068 | c->vc_screenbuf_size, &written); | ||
1069 | else if (dir == SM_UP) | ||
1070 | sisusb_copy_memory(sisusb, | ||
1071 | (char *)c->vc_origin + c->vc_screenbuf_size - delta, | ||
1072 | (u32)sisusb->vrambase + originoffset + | ||
1073 | c->vc_screenbuf_size - delta, | ||
1074 | delta, &written); | ||
1075 | else | ||
1076 | sisusb_copy_memory(sisusb, | ||
1077 | (char *)c->vc_origin, | ||
1078 | (u32)(sisusb->vrambase + originoffset), | ||
1079 | delta, &written); | ||
1080 | |||
1081 | c->vc_scr_end = c->vc_origin + c->vc_screenbuf_size; | ||
1082 | c->vc_visible_origin = c->vc_origin; | ||
1083 | |||
1084 | sisusbcon_set_start_address(sisusb, c); | ||
1085 | |||
1086 | c->vc_pos = c->vc_pos - oldorigin + c->vc_origin; | ||
1087 | |||
1088 | up(&sisusb->lock); | ||
1089 | |||
1090 | return 1; | ||
1091 | } | ||
1092 | |||
1093 | /* Interface routine */ | ||
1094 | static int | ||
1095 | sisusbcon_set_origin(struct vc_data *c) | ||
1096 | { | ||
1097 | struct sisusb_usb_data *sisusb; | ||
1098 | |||
1099 | /* Returning != 0 means we were successful. | ||
1100 | * Returning 0 will vt make to use its own | ||
1101 | * screenbuffer as the origin. | ||
1102 | */ | ||
1103 | |||
1104 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
1105 | return 0; | ||
1106 | |||
1107 | /* sisusb->lock is down */ | ||
1108 | |||
1109 | if (sisusb_is_inactive(c, sisusb) || sisusb->con_blanked) { | ||
1110 | up(&sisusb->lock); | ||
1111 | return 0; | ||
1112 | } | ||
1113 | |||
1114 | c->vc_origin = c->vc_visible_origin = sisusb->scrbuf; | ||
1115 | |||
1116 | sisusbcon_set_start_address(sisusb, c); | ||
1117 | |||
1118 | sisusb->con_rolled_over = 0; | ||
1119 | |||
1120 | up(&sisusb->lock); | ||
1121 | |||
1122 | return 1; | ||
1123 | } | ||
1124 | |||
1125 | /* Interface routine */ | ||
1126 | static int | ||
1127 | sisusbcon_resize(struct vc_data *c, unsigned int newcols, unsigned int newrows) | ||
1128 | { | ||
1129 | struct sisusb_usb_data *sisusb; | ||
1130 | int fh; | ||
1131 | |||
1132 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
1133 | return -ENODEV; | ||
1134 | |||
1135 | fh = sisusb->current_font_height; | ||
1136 | |||
1137 | up(&sisusb->lock); | ||
1138 | |||
1139 | /* We are quite unflexible as regards resizing. The vt code | ||
1140 | * handles sizes where the line length isn't equal the pitch | ||
1141 | * quite badly. As regards the rows, our panning tricks only | ||
1142 | * work well if the number of rows equals the visible number | ||
1143 | * of rows. | ||
1144 | */ | ||
1145 | |||
1146 | if (newcols != 80 || c->vc_scan_lines / fh != newrows) | ||
1147 | return -EINVAL; | ||
1148 | |||
1149 | return 0; | ||
1150 | } | ||
1151 | |||
1152 | int | ||
1153 | sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot, | ||
1154 | u8 *arg, int cmapsz, int ch512, int dorecalc, | ||
1155 | struct vc_data *c, int fh, int uplock) | ||
1156 | { | ||
1157 | int font_select = 0x00, i, err = 0; | ||
1158 | u32 offset = 0; | ||
1159 | u8 dummy; | ||
1160 | |||
1161 | /* sisusb->lock is down */ | ||
1162 | |||
1163 | /* | ||
1164 | * The default font is kept in slot 0. | ||
1165 | * A user font is loaded in slot 2 (256 ch) | ||
1166 | * or 2+3 (512 ch). | ||
1167 | */ | ||
1168 | |||
1169 | if ((slot != 0 && slot != 2) || !fh) { | ||
1170 | if (uplock) | ||
1171 | up(&sisusb->lock); | ||
1172 | return -EINVAL; | ||
1173 | } | ||
1174 | |||
1175 | if (set) | ||
1176 | sisusb->font_slot = slot; | ||
1177 | |||
1178 | /* Default font is always 256 */ | ||
1179 | if (slot == 0) | ||
1180 | ch512 = 0; | ||
1181 | else | ||
1182 | offset = 4 * cmapsz; | ||
1183 | |||
1184 | font_select = (slot == 0) ? 0x00 : (ch512 ? 0x0e : 0x0a); | ||
1185 | |||
1186 | err |= sisusb_setidxreg(sisusb, SISSR, 0x00, 0x01); /* Reset */ | ||
1187 | err |= sisusb_setidxreg(sisusb, SISSR, 0x02, 0x04); /* Write to plane 2 */ | ||
1188 | err |= sisusb_setidxreg(sisusb, SISSR, 0x04, 0x07); /* Memory mode a0-bf */ | ||
1189 | err |= sisusb_setidxreg(sisusb, SISSR, 0x00, 0x03); /* Reset */ | ||
1190 | |||
1191 | if (err) | ||
1192 | goto font_op_error; | ||
1193 | |||
1194 | err |= sisusb_setidxreg(sisusb, SISGR, 0x04, 0x03); /* Select plane read 2 */ | ||
1195 | err |= sisusb_setidxreg(sisusb, SISGR, 0x05, 0x00); /* Disable odd/even */ | ||
1196 | err |= sisusb_setidxreg(sisusb, SISGR, 0x06, 0x00); /* Address range a0-bf */ | ||
1197 | |||
1198 | if (err) | ||
1199 | goto font_op_error; | ||
1200 | |||
1201 | if (arg) { | ||
1202 | if (set) | ||
1203 | for (i = 0; i < cmapsz; i++) { | ||
1204 | err |= sisusb_writeb(sisusb, | ||
1205 | sisusb->vrambase + offset + i, | ||
1206 | arg[i]); | ||
1207 | if (err) | ||
1208 | break; | ||
1209 | } | ||
1210 | else | ||
1211 | for (i = 0; i < cmapsz; i++) { | ||
1212 | err |= sisusb_readb(sisusb, | ||
1213 | sisusb->vrambase + offset + i, | ||
1214 | &arg[i]); | ||
1215 | if (err) | ||
1216 | break; | ||
1217 | } | ||
1218 | |||
1219 | /* | ||
1220 | * In 512-character mode, the character map is not contiguous if | ||
1221 | * we want to remain EGA compatible -- which we do | ||
1222 | */ | ||
1223 | |||
1224 | if (ch512) { | ||
1225 | if (set) | ||
1226 | for (i = 0; i < cmapsz; i++) { | ||
1227 | err |= sisusb_writeb(sisusb, | ||
1228 | sisusb->vrambase + offset + | ||
1229 | (2 * cmapsz) + i, | ||
1230 | arg[cmapsz + i]); | ||
1231 | if (err) | ||
1232 | break; | ||
1233 | } | ||
1234 | else | ||
1235 | for (i = 0; i < cmapsz; i++) { | ||
1236 | err |= sisusb_readb(sisusb, | ||
1237 | sisusb->vrambase + offset + | ||
1238 | (2 * cmapsz) + i, | ||
1239 | &arg[cmapsz + i]); | ||
1240 | if (err) | ||
1241 | break; | ||
1242 | } | ||
1243 | } | ||
1244 | } | ||
1245 | |||
1246 | if (err) | ||
1247 | goto font_op_error; | ||
1248 | |||
1249 | err |= sisusb_setidxreg(sisusb, SISSR, 0x00, 0x01); /* Reset */ | ||
1250 | err |= sisusb_setidxreg(sisusb, SISSR, 0x02, 0x03); /* Write to planes 0+1 */ | ||
1251 | err |= sisusb_setidxreg(sisusb, SISSR, 0x04, 0x03); /* Memory mode a0-bf */ | ||
1252 | if (set) | ||
1253 | sisusb_setidxreg(sisusb, SISSR, 0x03, font_select); | ||
1254 | err |= sisusb_setidxreg(sisusb, SISSR, 0x00, 0x03); /* Reset end */ | ||
1255 | |||
1256 | if (err) | ||
1257 | goto font_op_error; | ||
1258 | |||
1259 | err |= sisusb_setidxreg(sisusb, SISGR, 0x04, 0x00); /* Select plane read 0 */ | ||
1260 | err |= sisusb_setidxreg(sisusb, SISGR, 0x05, 0x10); /* Enable odd/even */ | ||
1261 | err |= sisusb_setidxreg(sisusb, SISGR, 0x06, 0x06); /* Address range b8-bf */ | ||
1262 | |||
1263 | if (err) | ||
1264 | goto font_op_error; | ||
1265 | |||
1266 | if ((set) && (ch512 != sisusb->current_font_512)) { | ||
1267 | |||
1268 | /* Font is shared among all our consoles. | ||
1269 | * And so is the hi_font_mask. | ||
1270 | */ | ||
1271 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | ||
1272 | struct vc_data *c = vc_cons[i].d; | ||
1273 | if (c && c->vc_sw == &sisusb_con) | ||
1274 | c->vc_hi_font_mask = ch512 ? 0x0800 : 0; | ||
1275 | } | ||
1276 | |||
1277 | sisusb->current_font_512 = ch512; | ||
1278 | |||
1279 | /* color plane enable register: | ||
1280 | 256-char: enable intensity bit | ||
1281 | 512-char: disable intensity bit */ | ||
1282 | sisusb_getreg(sisusb, SISINPSTAT, &dummy); | ||
1283 | sisusb_setreg(sisusb, SISAR, 0x12); | ||
1284 | sisusb_setreg(sisusb, SISAR, ch512 ? 0x07 : 0x0f); | ||
1285 | |||
1286 | sisusb_getreg(sisusb, SISINPSTAT, &dummy); | ||
1287 | sisusb_setreg(sisusb, SISAR, 0x20); | ||
1288 | sisusb_getreg(sisusb, SISINPSTAT, &dummy); | ||
1289 | } | ||
1290 | |||
1291 | if (dorecalc) { | ||
1292 | |||
1293 | /* | ||
1294 | * Adjust the screen to fit a font of a certain height | ||
1295 | */ | ||
1296 | |||
1297 | unsigned char ovr, vde, fsr; | ||
1298 | int rows = 0, maxscan = 0; | ||
1299 | |||
1300 | if (c) { | ||
1301 | |||
1302 | /* Number of video rows */ | ||
1303 | rows = c->vc_scan_lines / fh; | ||
1304 | /* Scan lines to actually display-1 */ | ||
1305 | maxscan = rows * fh - 1; | ||
1306 | |||
1307 | /*printk(KERN_DEBUG "sisusb recalc rows %d maxscan %d fh %d sl %d\n", | ||
1308 | rows, maxscan, fh, c->vc_scan_lines);*/ | ||
1309 | |||
1310 | sisusb_getidxreg(sisusb, SISCR, 0x07, &ovr); | ||
1311 | vde = maxscan & 0xff; | ||
1312 | ovr = (ovr & 0xbd) | | ||
1313 | ((maxscan & 0x100) >> 7) | | ||
1314 | ((maxscan & 0x200) >> 3); | ||
1315 | sisusb_setidxreg(sisusb, SISCR, 0x07, ovr); | ||
1316 | sisusb_setidxreg(sisusb, SISCR, 0x12, vde); | ||
1317 | |||
1318 | } | ||
1319 | |||
1320 | sisusb_getidxreg(sisusb, SISCR, 0x09, &fsr); | ||
1321 | fsr = (fsr & 0xe0) | (fh - 1); | ||
1322 | sisusb_setidxreg(sisusb, SISCR, 0x09, fsr); | ||
1323 | sisusb->current_font_height = fh; | ||
1324 | |||
1325 | sisusb->sisusb_cursor_size_from = -1; | ||
1326 | sisusb->sisusb_cursor_size_to = -1; | ||
1327 | |||
1328 | } | ||
1329 | |||
1330 | if (uplock) | ||
1331 | up(&sisusb->lock); | ||
1332 | |||
1333 | if (dorecalc && c) { | ||
1334 | int i, rows = c->vc_scan_lines / fh; | ||
1335 | |||
1336 | /* Now adjust our consoles' size */ | ||
1337 | |||
1338 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | ||
1339 | struct vc_data *vc = vc_cons[i].d; | ||
1340 | |||
1341 | if (vc && vc->vc_sw == &sisusb_con) { | ||
1342 | if (CON_IS_VISIBLE(vc)) { | ||
1343 | vc->vc_sw->con_cursor(vc, CM_DRAW); | ||
1344 | } | ||
1345 | vc->vc_font.height = fh; | ||
1346 | vc_resize(vc, 0, rows); | ||
1347 | } | ||
1348 | } | ||
1349 | } | ||
1350 | |||
1351 | return 0; | ||
1352 | |||
1353 | font_op_error: | ||
1354 | if (uplock) | ||
1355 | up(&sisusb->lock); | ||
1356 | |||
1357 | return -EIO; | ||
1358 | } | ||
1359 | |||
1360 | /* Interface routine */ | ||
1361 | static int | ||
1362 | sisusbcon_font_set(struct vc_data *c, struct console_font *font, | ||
1363 | unsigned flags) | ||
1364 | { | ||
1365 | struct sisusb_usb_data *sisusb; | ||
1366 | unsigned charcount = font->charcount; | ||
1367 | |||
1368 | if (font->width != 8 || (charcount != 256 && charcount != 512)) | ||
1369 | return -EINVAL; | ||
1370 | |||
1371 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
1372 | return -ENODEV; | ||
1373 | |||
1374 | /* sisusb->lock is down */ | ||
1375 | |||
1376 | /* Save the user-provided font into a buffer. This | ||
1377 | * is used for restoring text mode after quitting | ||
1378 | * from X and for the con_getfont routine. | ||
1379 | */ | ||
1380 | if (sisusb->font_backup) { | ||
1381 | if (sisusb->font_backup_size < charcount) { | ||
1382 | vfree(sisusb->font_backup); | ||
1383 | sisusb->font_backup = NULL; | ||
1384 | } | ||
1385 | } | ||
1386 | |||
1387 | if (!sisusb->font_backup) | ||
1388 | sisusb->font_backup = vmalloc(charcount * 32); | ||
1389 | |||
1390 | if (sisusb->font_backup) { | ||
1391 | memcpy(sisusb->font_backup, font->data, charcount * 32); | ||
1392 | sisusb->font_backup_size = charcount; | ||
1393 | sisusb->font_backup_height = font->height; | ||
1394 | sisusb->font_backup_512 = (charcount == 512) ? 1 : 0; | ||
1395 | } | ||
1396 | |||
1397 | /* do_font_op ups sisusb->lock */ | ||
1398 | |||
1399 | return sisusbcon_do_font_op(sisusb, 1, 2, font->data, | ||
1400 | 8192, (charcount == 512), | ||
1401 | (!(flags & KD_FONT_FLAG_DONT_RECALC)) ? 1 : 0, | ||
1402 | c, font->height, 1); | ||
1403 | } | ||
1404 | |||
1405 | /* Interface routine */ | ||
1406 | static int | ||
1407 | sisusbcon_font_get(struct vc_data *c, struct console_font *font) | ||
1408 | { | ||
1409 | struct sisusb_usb_data *sisusb; | ||
1410 | |||
1411 | if (!(sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num))) | ||
1412 | return -ENODEV; | ||
1413 | |||
1414 | /* sisusb->lock is down */ | ||
1415 | |||
1416 | font->width = 8; | ||
1417 | font->height = c->vc_font.height; | ||
1418 | font->charcount = 256; | ||
1419 | |||
1420 | if (!font->data) { | ||
1421 | up(&sisusb->lock); | ||
1422 | return 0; | ||
1423 | } | ||
1424 | |||
1425 | if (!sisusb->font_backup) { | ||
1426 | up(&sisusb->lock); | ||
1427 | return -ENODEV; | ||
1428 | } | ||
1429 | |||
1430 | /* Copy 256 chars only, like vgacon */ | ||
1431 | memcpy(font->data, sisusb->font_backup, 256 * 32); | ||
1432 | |||
1433 | up(&sisusb->lock); | ||
1434 | |||
1435 | return 0; | ||
1436 | } | ||
1437 | |||
1438 | /* | ||
1439 | * The console `switch' structure for the sisusb console | ||
1440 | */ | ||
1441 | |||
1442 | static const struct consw sisusb_con = { | ||
1443 | .owner = THIS_MODULE, | ||
1444 | .con_startup = sisusbcon_startup, | ||
1445 | .con_init = sisusbcon_init, | ||
1446 | .con_deinit = sisusbcon_deinit, | ||
1447 | .con_clear = sisusbcon_clear, | ||
1448 | .con_putc = sisusbcon_putc, | ||
1449 | .con_putcs = sisusbcon_putcs, | ||
1450 | .con_cursor = sisusbcon_cursor, | ||
1451 | .con_scroll = sisusbcon_scroll, | ||
1452 | .con_bmove = sisusbcon_bmove, | ||
1453 | .con_switch = sisusbcon_switch, | ||
1454 | .con_blank = sisusbcon_blank, | ||
1455 | .con_font_set = sisusbcon_font_set, | ||
1456 | .con_font_get = sisusbcon_font_get, | ||
1457 | .con_set_palette = sisusbcon_set_palette, | ||
1458 | .con_scrolldelta = sisusbcon_scrolldelta, | ||
1459 | .con_build_attr = sisusbcon_build_attr, | ||
1460 | .con_invert_region = sisusbcon_invert_region, | ||
1461 | .con_set_origin = sisusbcon_set_origin, | ||
1462 | .con_save_screen = sisusbcon_save_screen, | ||
1463 | .con_resize = sisusbcon_resize, | ||
1464 | }; | ||
1465 | |||
1466 | /* Our very own dummy console driver */ | ||
1467 | |||
1468 | static const char *sisusbdummycon_startup(void) | ||
1469 | { | ||
1470 | return "SISUSBVGADUMMY"; | ||
1471 | } | ||
1472 | |||
1473 | static void sisusbdummycon_init(struct vc_data *vc, int init) | ||
1474 | { | ||
1475 | vc->vc_can_do_color = 1; | ||
1476 | if (init) { | ||
1477 | vc->vc_cols = 80; | ||
1478 | vc->vc_rows = 25; | ||
1479 | } else | ||
1480 | vc_resize(vc, 80, 25); | ||
1481 | } | ||
1482 | |||
1483 | static int sisusbdummycon_dummy(void) | ||
1484 | { | ||
1485 | return 0; | ||
1486 | } | ||
1487 | |||
1488 | #define SISUSBCONDUMMY (void *)sisusbdummycon_dummy | ||
1489 | |||
1490 | const struct consw sisusb_dummy_con = { | ||
1491 | .owner = THIS_MODULE, | ||
1492 | .con_startup = sisusbdummycon_startup, | ||
1493 | .con_init = sisusbdummycon_init, | ||
1494 | .con_deinit = SISUSBCONDUMMY, | ||
1495 | .con_clear = SISUSBCONDUMMY, | ||
1496 | .con_putc = SISUSBCONDUMMY, | ||
1497 | .con_putcs = SISUSBCONDUMMY, | ||
1498 | .con_cursor = SISUSBCONDUMMY, | ||
1499 | .con_scroll = SISUSBCONDUMMY, | ||
1500 | .con_bmove = SISUSBCONDUMMY, | ||
1501 | .con_switch = SISUSBCONDUMMY, | ||
1502 | .con_blank = SISUSBCONDUMMY, | ||
1503 | .con_font_set = SISUSBCONDUMMY, | ||
1504 | .con_font_get = SISUSBCONDUMMY, | ||
1505 | .con_font_default = SISUSBCONDUMMY, | ||
1506 | .con_font_copy = SISUSBCONDUMMY, | ||
1507 | .con_set_palette = SISUSBCONDUMMY, | ||
1508 | .con_scrolldelta = SISUSBCONDUMMY, | ||
1509 | }; | ||
1510 | |||
1511 | int | ||
1512 | sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last) | ||
1513 | { | ||
1514 | int i, ret, minor = sisusb->minor; | ||
1515 | |||
1516 | down(&disconnect_sem); | ||
1517 | |||
1518 | down(&sisusb->lock); | ||
1519 | |||
1520 | /* Erm.. that should not happen */ | ||
1521 | if (sisusb->haveconsole || !sisusb->SiS_Pr) { | ||
1522 | up(&sisusb->lock); | ||
1523 | up(&disconnect_sem); | ||
1524 | return 1; | ||
1525 | } | ||
1526 | |||
1527 | sisusb->con_first = first; | ||
1528 | sisusb->con_last = last; | ||
1529 | |||
1530 | if (first > last || | ||
1531 | first > MAX_NR_CONSOLES || | ||
1532 | last > MAX_NR_CONSOLES) { | ||
1533 | up(&sisusb->lock); | ||
1534 | up(&disconnect_sem); | ||
1535 | return 1; | ||
1536 | } | ||
1537 | |||
1538 | /* If gfxcore not initialized or no consoles given, quit graciously */ | ||
1539 | if (!sisusb->gfxinit || first < 1 || last < 1) { | ||
1540 | up(&sisusb->lock); | ||
1541 | up(&disconnect_sem); | ||
1542 | return 0; | ||
1543 | } | ||
1544 | |||
1545 | sisusb->sisusb_cursor_loc = -1; | ||
1546 | sisusb->sisusb_cursor_size_from = -1; | ||
1547 | sisusb->sisusb_cursor_size_to = -1; | ||
1548 | |||
1549 | /* Set up text mode (and upload default font) */ | ||
1550 | if (sisusb_reset_text_mode(sisusb, 1)) { | ||
1551 | up(&sisusb->lock); | ||
1552 | up(&disconnect_sem); | ||
1553 | printk(KERN_ERR | ||
1554 | "sisusbvga[%d]: Failed to set up text mode\n", | ||
1555 | minor); | ||
1556 | return 1; | ||
1557 | } | ||
1558 | |||
1559 | /* Initialize some gfx registers */ | ||
1560 | sisusb_initialize(sisusb); | ||
1561 | |||
1562 | for (i = first - 1; i <= last - 1; i++) { | ||
1563 | /* Save sisusb for our interface routines */ | ||
1564 | mysisusbs[i] = sisusb; | ||
1565 | } | ||
1566 | |||
1567 | /* Initial console setup */ | ||
1568 | sisusb->sisusb_num_columns = 80; | ||
1569 | |||
1570 | /* Use a 32K buffer (matches b8000-bffff area) */ | ||
1571 | sisusb->scrbuf_size = 32 * 1024; | ||
1572 | |||
1573 | /* Allocate screen buffer */ | ||
1574 | if (!(sisusb->scrbuf = (unsigned long)vmalloc(sisusb->scrbuf_size))) { | ||
1575 | up(&sisusb->lock); | ||
1576 | up(&disconnect_sem); | ||
1577 | printk(KERN_ERR | ||
1578 | "sisusbvga[%d]: Failed to allocate screen buffer\n", | ||
1579 | minor); | ||
1580 | return 1; | ||
1581 | } | ||
1582 | |||
1583 | up(&sisusb->lock); | ||
1584 | up(&disconnect_sem); | ||
1585 | |||
1586 | /* Now grab the desired console(s) */ | ||
1587 | ret = take_over_console(&sisusb_con, first - 1, last - 1, 0); | ||
1588 | |||
1589 | if (!ret) | ||
1590 | sisusb->haveconsole = 1; | ||
1591 | else { | ||
1592 | for (i = first - 1; i <= last - 1; i++) | ||
1593 | mysisusbs[i] = NULL; | ||
1594 | } | ||
1595 | |||
1596 | return ret; | ||
1597 | } | ||
1598 | |||
1599 | void | ||
1600 | sisusb_console_exit(struct sisusb_usb_data *sisusb) | ||
1601 | { | ||
1602 | int i; | ||
1603 | |||
1604 | /* This is called if the device is disconnected | ||
1605 | * and while disconnect and lock semaphores | ||
1606 | * are up. This should be save because we | ||
1607 | * can't lose our sisusb any other way but by | ||
1608 | * disconnection (and hence, the disconnect | ||
1609 | * sema is for protecting all other access | ||
1610 | * functions from disconnection, not the | ||
1611 | * other way round). | ||
1612 | */ | ||
1613 | |||
1614 | /* Now what do we do in case of disconnection: | ||
1615 | * One alternative would be to simply call | ||
1616 | * give_up_console(). Nah, not a good idea. | ||
1617 | * give_up_console() is obviously buggy as it | ||
1618 | * only discards the consw pointer from the | ||
1619 | * driver_map, but doesn't adapt vc->vc_sw | ||
1620 | * of the affected consoles. Hence, the next | ||
1621 | * call to any of the console functions will | ||
1622 | * eventually take a trip to oops county. | ||
1623 | * Also, give_up_console for some reason | ||
1624 | * doesn't decrement our module refcount. | ||
1625 | * Instead, we switch our consoles to a private | ||
1626 | * dummy console. This, of course, keeps our | ||
1627 | * refcount up as well, but it works perfectly. | ||
1628 | */ | ||
1629 | |||
1630 | if (sisusb->haveconsole) { | ||
1631 | for (i = 0; i < MAX_NR_CONSOLES; i++) | ||
1632 | if (sisusb->havethisconsole[i]) | ||
1633 | take_over_console(&sisusb_dummy_con, i, i, 0); | ||
1634 | /* At this point, con_deinit for all our | ||
1635 | * consoles is executed by take_over_console(). | ||
1636 | */ | ||
1637 | sisusb->haveconsole = 0; | ||
1638 | } | ||
1639 | |||
1640 | vfree((void *)sisusb->scrbuf); | ||
1641 | sisusb->scrbuf = 0; | ||
1642 | |||
1643 | vfree(sisusb->font_backup); | ||
1644 | sisusb->font_backup = NULL; | ||
1645 | } | ||
1646 | |||
1647 | void __init sisusb_init_concode(void) | ||
1648 | { | ||
1649 | int i; | ||
1650 | |||
1651 | for (i = 0; i < MAX_NR_CONSOLES; i++) | ||
1652 | mysisusbs[i] = NULL; | ||
1653 | } | ||
1654 | |||
1655 | #endif /* INCL_CON */ | ||
1656 | |||
1657 | |||
1658 | |||
diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.c b/drivers/usb/misc/sisusbvga/sisusb_init.c new file mode 100644 index 000000000000..f28bc240f9b6 --- /dev/null +++ b/drivers/usb/misc/sisusbvga/sisusb_init.c | |||
@@ -0,0 +1,1047 @@ | |||
1 | /* | ||
2 | * sisusb - usb kernel driver for SiS315(E) based USB2VGA dongles | ||
3 | * | ||
4 | * Display mode initializing code | ||
5 | * | ||
6 | * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria | ||
7 | * | ||
8 | * If distributed as part of the Linux kernel, this code is licensed under the | ||
9 | * terms of the GPL v2. | ||
10 | * | ||
11 | * Otherwise, the following license terms apply: | ||
12 | * | ||
13 | * * Redistribution and use in source and binary forms, with or without | ||
14 | * * modification, are permitted provided that the following conditions | ||
15 | * * are met: | ||
16 | * * 1) Redistributions of source code must retain the above copyright | ||
17 | * * notice, this list of conditions and the following disclaimer. | ||
18 | * * 2) Redistributions in binary form must reproduce the above copyright | ||
19 | * * notice, this list of conditions and the following disclaimer in the | ||
20 | * * documentation and/or other materials provided with the distribution. | ||
21 | * * 3) The name of the author may not be used to endorse or promote products | ||
22 | * * derived from this software without specific prior written permission. | ||
23 | * * | ||
24 | * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
25 | * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
26 | * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
27 | * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
28 | * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
29 | * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
30 | * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
31 | * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
32 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
33 | * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
34 | * | ||
35 | * Author: Thomas Winischhofer <thomas@winischhofer.net> | ||
36 | * | ||
37 | */ | ||
38 | |||
39 | #include <linux/config.h> | ||
40 | #include <linux/version.h> | ||
41 | #include <linux/module.h> | ||
42 | #include <linux/kernel.h> | ||
43 | #include <linux/errno.h> | ||
44 | #include <linux/poll.h> | ||
45 | #include <linux/init.h> | ||
46 | #include <linux/slab.h> | ||
47 | #include <linux/spinlock.h> | ||
48 | #include <linux/kref.h> | ||
49 | |||
50 | #include "sisusb.h" | ||
51 | |||
52 | #ifdef INCL_SISUSB_CON | ||
53 | |||
54 | #include "sisusb_init.h" | ||
55 | |||
56 | /*********************************************/ | ||
57 | /* POINTER INITIALIZATION */ | ||
58 | /*********************************************/ | ||
59 | |||
60 | static void | ||
61 | SiSUSB_InitPtr(struct SiS_Private *SiS_Pr) | ||
62 | { | ||
63 | SiS_Pr->SiS_ModeResInfo = SiSUSB_ModeResInfo; | ||
64 | SiS_Pr->SiS_StandTable = SiSUSB_StandTable; | ||
65 | |||
66 | SiS_Pr->SiS_SModeIDTable = SiSUSB_SModeIDTable; | ||
67 | SiS_Pr->SiS_EModeIDTable = SiSUSB_EModeIDTable; | ||
68 | SiS_Pr->SiS_RefIndex = SiSUSB_RefIndex; | ||
69 | SiS_Pr->SiS_CRT1Table = SiSUSB_CRT1Table; | ||
70 | |||
71 | SiS_Pr->SiS_VCLKData = SiSUSB_VCLKData; | ||
72 | } | ||
73 | |||
74 | /*********************************************/ | ||
75 | /* HELPER: Get ModeID */ | ||
76 | /*********************************************/ | ||
77 | |||
78 | unsigned short | ||
79 | SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth) | ||
80 | { | ||
81 | unsigned short ModeIndex = 0; | ||
82 | |||
83 | switch (HDisplay) | ||
84 | { | ||
85 | case 320: | ||
86 | if (VDisplay == 200) | ||
87 | ModeIndex = ModeIndex_320x200[Depth]; | ||
88 | else if (VDisplay == 240) | ||
89 | ModeIndex = ModeIndex_320x240[Depth]; | ||
90 | break; | ||
91 | case 400: | ||
92 | if (VDisplay == 300) | ||
93 | ModeIndex = ModeIndex_400x300[Depth]; | ||
94 | break; | ||
95 | case 512: | ||
96 | if (VDisplay == 384) | ||
97 | ModeIndex = ModeIndex_512x384[Depth]; | ||
98 | break; | ||
99 | case 640: | ||
100 | if (VDisplay == 480) | ||
101 | ModeIndex = ModeIndex_640x480[Depth]; | ||
102 | else if (VDisplay == 400) | ||
103 | ModeIndex = ModeIndex_640x400[Depth]; | ||
104 | break; | ||
105 | case 720: | ||
106 | if (VDisplay == 480) | ||
107 | ModeIndex = ModeIndex_720x480[Depth]; | ||
108 | else if (VDisplay == 576) | ||
109 | ModeIndex = ModeIndex_720x576[Depth]; | ||
110 | break; | ||
111 | case 768: | ||
112 | if (VDisplay == 576) | ||
113 | ModeIndex = ModeIndex_768x576[Depth]; | ||
114 | break; | ||
115 | case 800: | ||
116 | if (VDisplay == 600) | ||
117 | ModeIndex = ModeIndex_800x600[Depth]; | ||
118 | else if (VDisplay == 480) | ||
119 | ModeIndex = ModeIndex_800x480[Depth]; | ||
120 | break; | ||
121 | case 848: | ||
122 | if (VDisplay == 480) | ||
123 | ModeIndex = ModeIndex_848x480[Depth]; | ||
124 | break; | ||
125 | case 856: | ||
126 | if (VDisplay == 480) | ||
127 | ModeIndex = ModeIndex_856x480[Depth]; | ||
128 | break; | ||
129 | case 960: | ||
130 | if (VDisplay == 540) | ||
131 | ModeIndex = ModeIndex_960x540[Depth]; | ||
132 | else if (VDisplay == 600) | ||
133 | ModeIndex = ModeIndex_960x600[Depth]; | ||
134 | break; | ||
135 | case 1024: | ||
136 | if (VDisplay == 576) | ||
137 | ModeIndex = ModeIndex_1024x576[Depth]; | ||
138 | else if (VDisplay == 768) | ||
139 | ModeIndex = ModeIndex_1024x768[Depth]; | ||
140 | break; | ||
141 | case 1152: | ||
142 | if (VDisplay == 864) | ||
143 | ModeIndex = ModeIndex_1152x864[Depth]; | ||
144 | break; | ||
145 | case 1280: | ||
146 | switch (VDisplay) { | ||
147 | case 720: | ||
148 | ModeIndex = ModeIndex_1280x720[Depth]; | ||
149 | break; | ||
150 | case 768: | ||
151 | ModeIndex = ModeIndex_1280x768[Depth]; | ||
152 | break; | ||
153 | case 1024: | ||
154 | ModeIndex = ModeIndex_1280x1024[Depth]; | ||
155 | break; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | return ModeIndex; | ||
160 | } | ||
161 | |||
162 | /*********************************************/ | ||
163 | /* HELPER: SetReg, GetReg */ | ||
164 | /*********************************************/ | ||
165 | |||
166 | static void | ||
167 | SiS_SetReg(struct SiS_Private *SiS_Pr, unsigned long port, | ||
168 | unsigned short index, unsigned short data) | ||
169 | { | ||
170 | sisusb_setidxreg(SiS_Pr->sisusb, port, index, data); | ||
171 | } | ||
172 | |||
173 | static void | ||
174 | SiS_SetRegByte(struct SiS_Private *SiS_Pr, unsigned long port, | ||
175 | unsigned short data) | ||
176 | { | ||
177 | sisusb_setreg(SiS_Pr->sisusb, port, data); | ||
178 | } | ||
179 | |||
180 | static unsigned char | ||
181 | SiS_GetReg(struct SiS_Private *SiS_Pr, unsigned long port, | ||
182 | unsigned short index) | ||
183 | { | ||
184 | u8 data; | ||
185 | |||
186 | sisusb_getidxreg(SiS_Pr->sisusb, port, index, &data); | ||
187 | |||
188 | return data; | ||
189 | } | ||
190 | |||
191 | static unsigned char | ||
192 | SiS_GetRegByte(struct SiS_Private *SiS_Pr, unsigned long port) | ||
193 | { | ||
194 | u8 data; | ||
195 | |||
196 | sisusb_getreg(SiS_Pr->sisusb, port, &data); | ||
197 | |||
198 | return data; | ||
199 | } | ||
200 | |||
201 | static void | ||
202 | SiS_SetRegANDOR(struct SiS_Private *SiS_Pr, unsigned long port, | ||
203 | unsigned short index, unsigned short DataAND, | ||
204 | unsigned short DataOR) | ||
205 | { | ||
206 | sisusb_setidxregandor(SiS_Pr->sisusb, port, index, DataAND, DataOR); | ||
207 | } | ||
208 | |||
209 | static void | ||
210 | SiS_SetRegAND(struct SiS_Private *SiS_Pr, unsigned long port, | ||
211 | unsigned short index, unsigned short DataAND) | ||
212 | { | ||
213 | sisusb_setidxregand(SiS_Pr->sisusb, port, index, DataAND); | ||
214 | } | ||
215 | |||
216 | static void | ||
217 | SiS_SetRegOR(struct SiS_Private *SiS_Pr,unsigned long port, | ||
218 | unsigned short index, unsigned short DataOR) | ||
219 | { | ||
220 | sisusb_setidxregor(SiS_Pr->sisusb, port, index, DataOR); | ||
221 | } | ||
222 | |||
223 | /*********************************************/ | ||
224 | /* HELPER: DisplayOn, DisplayOff */ | ||
225 | /*********************************************/ | ||
226 | |||
227 | static void | ||
228 | SiS_DisplayOn(struct SiS_Private *SiS_Pr) | ||
229 | { | ||
230 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4, 0x01, 0xDF); | ||
231 | } | ||
232 | |||
233 | /*********************************************/ | ||
234 | /* HELPER: Init Port Addresses */ | ||
235 | /*********************************************/ | ||
236 | |||
237 | void | ||
238 | SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr) | ||
239 | { | ||
240 | SiS_Pr->SiS_P3c4 = BaseAddr + 0x14; | ||
241 | SiS_Pr->SiS_P3d4 = BaseAddr + 0x24; | ||
242 | SiS_Pr->SiS_P3c0 = BaseAddr + 0x10; | ||
243 | SiS_Pr->SiS_P3ce = BaseAddr + 0x1e; | ||
244 | SiS_Pr->SiS_P3c2 = BaseAddr + 0x12; | ||
245 | SiS_Pr->SiS_P3ca = BaseAddr + 0x1a; | ||
246 | SiS_Pr->SiS_P3c6 = BaseAddr + 0x16; | ||
247 | SiS_Pr->SiS_P3c7 = BaseAddr + 0x17; | ||
248 | SiS_Pr->SiS_P3c8 = BaseAddr + 0x18; | ||
249 | SiS_Pr->SiS_P3c9 = BaseAddr + 0x19; | ||
250 | SiS_Pr->SiS_P3cb = BaseAddr + 0x1b; | ||
251 | SiS_Pr->SiS_P3cc = BaseAddr + 0x1c; | ||
252 | SiS_Pr->SiS_P3cd = BaseAddr + 0x1d; | ||
253 | SiS_Pr->SiS_P3da = BaseAddr + 0x2a; | ||
254 | SiS_Pr->SiS_Part1Port = BaseAddr + SIS_CRT2_PORT_04; | ||
255 | } | ||
256 | |||
257 | /*********************************************/ | ||
258 | /* HELPER: GetSysFlags */ | ||
259 | /*********************************************/ | ||
260 | |||
261 | static void | ||
262 | SiS_GetSysFlags(struct SiS_Private *SiS_Pr) | ||
263 | { | ||
264 | SiS_Pr->SiS_MyCR63 = 0x63; | ||
265 | } | ||
266 | |||
267 | /*********************************************/ | ||
268 | /* HELPER: Init PCI & Engines */ | ||
269 | /*********************************************/ | ||
270 | |||
271 | static void | ||
272 | SiSInitPCIetc(struct SiS_Private *SiS_Pr) | ||
273 | { | ||
274 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x20, 0xa1); | ||
275 | /* - Enable 2D (0x40) | ||
276 | * - Enable 3D (0x02) | ||
277 | * - Enable 3D vertex command fetch (0x10) | ||
278 | * - Enable 3D command parser (0x08) | ||
279 | * - Enable 3D G/L transformation engine (0x80) | ||
280 | */ | ||
281 | SiS_SetRegOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x1E, 0xDA); | ||
282 | } | ||
283 | |||
284 | /*********************************************/ | ||
285 | /* HELPER: SET SEGMENT REGISTERS */ | ||
286 | /*********************************************/ | ||
287 | |||
288 | static void | ||
289 | SiS_SetSegRegLower(struct SiS_Private *SiS_Pr, unsigned short value) | ||
290 | { | ||
291 | unsigned short temp; | ||
292 | |||
293 | value &= 0x00ff; | ||
294 | temp = SiS_GetRegByte(SiS_Pr, SiS_Pr->SiS_P3cb) & 0xf0; | ||
295 | temp |= (value >> 4); | ||
296 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3cb, temp); | ||
297 | temp = SiS_GetRegByte(SiS_Pr, SiS_Pr->SiS_P3cd) & 0xf0; | ||
298 | temp |= (value & 0x0f); | ||
299 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3cd, temp); | ||
300 | } | ||
301 | |||
302 | static void | ||
303 | SiS_SetSegRegUpper(struct SiS_Private *SiS_Pr, unsigned short value) | ||
304 | { | ||
305 | unsigned short temp; | ||
306 | |||
307 | value &= 0x00ff; | ||
308 | temp = SiS_GetRegByte(SiS_Pr, SiS_Pr->SiS_P3cb) & 0x0f; | ||
309 | temp |= (value & 0xf0); | ||
310 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3cb, temp); | ||
311 | temp = SiS_GetRegByte(SiS_Pr, SiS_Pr->SiS_P3cd) & 0x0f; | ||
312 | temp |= (value << 4); | ||
313 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3cd, temp); | ||
314 | } | ||
315 | |||
316 | static void | ||
317 | SiS_SetSegmentReg(struct SiS_Private *SiS_Pr, unsigned short value) | ||
318 | { | ||
319 | SiS_SetSegRegLower(SiS_Pr, value); | ||
320 | SiS_SetSegRegUpper(SiS_Pr, value); | ||
321 | } | ||
322 | |||
323 | static void | ||
324 | SiS_ResetSegmentReg(struct SiS_Private *SiS_Pr) | ||
325 | { | ||
326 | SiS_SetSegmentReg(SiS_Pr, 0); | ||
327 | } | ||
328 | |||
329 | static void | ||
330 | SiS_SetSegmentRegOver(struct SiS_Private *SiS_Pr, unsigned short value) | ||
331 | { | ||
332 | unsigned short temp = value >> 8; | ||
333 | |||
334 | temp &= 0x07; | ||
335 | temp |= (temp << 4); | ||
336 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x1d, temp); | ||
337 | SiS_SetSegmentReg(SiS_Pr, value); | ||
338 | } | ||
339 | |||
340 | static void | ||
341 | SiS_ResetSegmentRegOver(struct SiS_Private *SiS_Pr) | ||
342 | { | ||
343 | SiS_SetSegmentRegOver(SiS_Pr, 0); | ||
344 | } | ||
345 | |||
346 | static void | ||
347 | SiS_ResetSegmentRegisters(struct SiS_Private *SiS_Pr) | ||
348 | { | ||
349 | SiS_ResetSegmentReg(SiS_Pr); | ||
350 | SiS_ResetSegmentRegOver(SiS_Pr); | ||
351 | } | ||
352 | |||
353 | /*********************************************/ | ||
354 | /* HELPER: SearchModeID */ | ||
355 | /*********************************************/ | ||
356 | |||
357 | static int | ||
358 | SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo, | ||
359 | unsigned short *ModeIdIndex) | ||
360 | { | ||
361 | if ((*ModeNo) <= 0x13) { | ||
362 | |||
363 | if ((*ModeNo) != 0x03) | ||
364 | return 0; | ||
365 | |||
366 | (*ModeIdIndex) = 0; | ||
367 | |||
368 | } else { | ||
369 | |||
370 | for(*ModeIdIndex = 0; ;(*ModeIdIndex)++) { | ||
371 | |||
372 | if (SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == (*ModeNo)) | ||
373 | break; | ||
374 | |||
375 | if (SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) | ||
376 | return 0; | ||
377 | } | ||
378 | |||
379 | } | ||
380 | |||
381 | return 1; | ||
382 | } | ||
383 | |||
384 | /*********************************************/ | ||
385 | /* HELPER: ENABLE CRT1 */ | ||
386 | /*********************************************/ | ||
387 | |||
388 | static void | ||
389 | SiS_HandleCRT1(struct SiS_Private *SiS_Pr) | ||
390 | { | ||
391 | /* Enable CRT1 gating */ | ||
392 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3d4, SiS_Pr->SiS_MyCR63, 0xbf); | ||
393 | } | ||
394 | |||
395 | /*********************************************/ | ||
396 | /* HELPER: GetColorDepth */ | ||
397 | /*********************************************/ | ||
398 | |||
399 | static unsigned short | ||
400 | SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
401 | unsigned short ModeIdIndex) | ||
402 | { | ||
403 | static const unsigned short ColorDepth[6] = { 1, 2, 4, 4, 6, 8}; | ||
404 | unsigned short modeflag; | ||
405 | short index; | ||
406 | |||
407 | if (ModeNo <= 0x13) { | ||
408 | modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; | ||
409 | } else { | ||
410 | modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; | ||
411 | } | ||
412 | |||
413 | index = (modeflag & ModeTypeMask) - ModeEGA; | ||
414 | if (index < 0) index = 0; | ||
415 | return ColorDepth[index]; | ||
416 | } | ||
417 | |||
418 | /*********************************************/ | ||
419 | /* HELPER: GetOffset */ | ||
420 | /*********************************************/ | ||
421 | |||
422 | static unsigned short | ||
423 | SiS_GetOffset(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
424 | unsigned short ModeIdIndex, unsigned short rrti) | ||
425 | { | ||
426 | unsigned short xres, temp, colordepth, infoflag; | ||
427 | |||
428 | infoflag = SiS_Pr->SiS_RefIndex[rrti].Ext_InfoFlag; | ||
429 | xres = SiS_Pr->SiS_RefIndex[rrti].XRes; | ||
430 | |||
431 | colordepth = SiS_GetColorDepth(SiS_Pr, ModeNo, ModeIdIndex); | ||
432 | |||
433 | temp = xres / 16; | ||
434 | |||
435 | if (infoflag & InterlaceMode) | ||
436 | temp <<= 1; | ||
437 | |||
438 | temp *= colordepth; | ||
439 | |||
440 | if (xres % 16) | ||
441 | temp += (colordepth >> 1); | ||
442 | |||
443 | return temp; | ||
444 | } | ||
445 | |||
446 | /*********************************************/ | ||
447 | /* SEQ */ | ||
448 | /*********************************************/ | ||
449 | |||
450 | static void | ||
451 | SiS_SetSeqRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) | ||
452 | { | ||
453 | unsigned char SRdata; | ||
454 | int i; | ||
455 | |||
456 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x00, 0x03); | ||
457 | |||
458 | SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0] | 0x20; | ||
459 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x01, SRdata); | ||
460 | |||
461 | for(i = 2; i <= 4; i++) { | ||
462 | SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[i-1]; | ||
463 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, i, SRdata); | ||
464 | } | ||
465 | } | ||
466 | |||
467 | /*********************************************/ | ||
468 | /* MISC */ | ||
469 | /*********************************************/ | ||
470 | |||
471 | static void | ||
472 | SiS_SetMiscRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) | ||
473 | { | ||
474 | unsigned char Miscdata = SiS_Pr->SiS_StandTable[StandTableIndex].MISC; | ||
475 | |||
476 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3c2, Miscdata); | ||
477 | } | ||
478 | |||
479 | /*********************************************/ | ||
480 | /* CRTC */ | ||
481 | /*********************************************/ | ||
482 | |||
483 | static void | ||
484 | SiS_SetCRTCRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) | ||
485 | { | ||
486 | unsigned char CRTCdata; | ||
487 | unsigned short i; | ||
488 | |||
489 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3d4, 0x11, 0x7f); | ||
490 | |||
491 | for(i = 0; i <= 0x18; i++) { | ||
492 | CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i]; | ||
493 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, i, CRTCdata); | ||
494 | } | ||
495 | } | ||
496 | |||
497 | /*********************************************/ | ||
498 | /* ATT */ | ||
499 | /*********************************************/ | ||
500 | |||
501 | static void | ||
502 | SiS_SetATTRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) | ||
503 | { | ||
504 | unsigned char ARdata; | ||
505 | unsigned short i; | ||
506 | |||
507 | for(i = 0; i <= 0x13; i++) { | ||
508 | ARdata = SiS_Pr->SiS_StandTable[StandTableIndex].ATTR[i]; | ||
509 | SiS_GetRegByte(SiS_Pr, SiS_Pr->SiS_P3da); | ||
510 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3c0, i); | ||
511 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3c0, ARdata); | ||
512 | } | ||
513 | SiS_GetRegByte(SiS_Pr, SiS_Pr->SiS_P3da); | ||
514 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3c0, 0x14); | ||
515 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3c0, 0x00); | ||
516 | |||
517 | SiS_GetRegByte(SiS_Pr, SiS_Pr->SiS_P3da); | ||
518 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3c0, 0x20); | ||
519 | SiS_GetRegByte(SiS_Pr, SiS_Pr->SiS_P3da); | ||
520 | } | ||
521 | |||
522 | /*********************************************/ | ||
523 | /* GRC */ | ||
524 | /*********************************************/ | ||
525 | |||
526 | static void | ||
527 | SiS_SetGRCRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) | ||
528 | { | ||
529 | unsigned char GRdata; | ||
530 | unsigned short i; | ||
531 | |||
532 | for(i = 0; i <= 0x08; i++) { | ||
533 | GRdata = SiS_Pr->SiS_StandTable[StandTableIndex].GRC[i]; | ||
534 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3ce, i, GRdata); | ||
535 | } | ||
536 | |||
537 | if (SiS_Pr->SiS_ModeType > ModeVGA) { | ||
538 | /* 256 color disable */ | ||
539 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3ce, 0x05, 0xBF); | ||
540 | } | ||
541 | } | ||
542 | |||
543 | /*********************************************/ | ||
544 | /* CLEAR EXTENDED REGISTERS */ | ||
545 | /*********************************************/ | ||
546 | |||
547 | static void | ||
548 | SiS_ClearExt1Regs(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | ||
549 | { | ||
550 | int i; | ||
551 | |||
552 | for(i = 0x0A; i <= 0x0E; i++) { | ||
553 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, i, 0x00); | ||
554 | } | ||
555 | |||
556 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4, 0x37, 0xFE); | ||
557 | } | ||
558 | |||
559 | /*********************************************/ | ||
560 | /* Get rate index */ | ||
561 | /*********************************************/ | ||
562 | |||
563 | static unsigned short | ||
564 | SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
565 | unsigned short ModeIdIndex) | ||
566 | { | ||
567 | unsigned short rrti, i, index, temp; | ||
568 | |||
569 | if (ModeNo <= 0x13) | ||
570 | return 0xFFFF; | ||
571 | |||
572 | index = SiS_GetReg(SiS_Pr,SiS_Pr->SiS_P3d4, 0x33) & 0x0F; | ||
573 | if (index > 0) index--; | ||
574 | |||
575 | rrti = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex; | ||
576 | ModeNo = SiS_Pr->SiS_RefIndex[rrti].ModeID; | ||
577 | |||
578 | i = 0; | ||
579 | do { | ||
580 | if (SiS_Pr->SiS_RefIndex[rrti + i].ModeID != ModeNo) | ||
581 | break; | ||
582 | |||
583 | temp = SiS_Pr->SiS_RefIndex[rrti + i].Ext_InfoFlag & ModeTypeMask; | ||
584 | if (temp < SiS_Pr->SiS_ModeType) | ||
585 | break; | ||
586 | |||
587 | i++; | ||
588 | index--; | ||
589 | } while(index != 0xFFFF); | ||
590 | |||
591 | i--; | ||
592 | |||
593 | return (rrti + i); | ||
594 | } | ||
595 | |||
596 | /*********************************************/ | ||
597 | /* SYNC */ | ||
598 | /*********************************************/ | ||
599 | |||
600 | static void | ||
601 | SiS_SetCRT1Sync(struct SiS_Private *SiS_Pr, unsigned short rrti) | ||
602 | { | ||
603 | unsigned short sync = SiS_Pr->SiS_RefIndex[rrti].Ext_InfoFlag >> 8; | ||
604 | sync &= 0xC0; | ||
605 | sync |= 0x2f; | ||
606 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3c2, sync); | ||
607 | } | ||
608 | |||
609 | /*********************************************/ | ||
610 | /* CRTC/2 */ | ||
611 | /*********************************************/ | ||
612 | |||
613 | static void | ||
614 | SiS_SetCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
615 | unsigned short ModeIdIndex, unsigned short rrti) | ||
616 | { | ||
617 | unsigned char index; | ||
618 | unsigned short temp, i, j, modeflag; | ||
619 | |||
620 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3d4,0x11,0x7f); | ||
621 | |||
622 | modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; | ||
623 | |||
624 | index = SiS_Pr->SiS_RefIndex[rrti].Ext_CRT1CRTC; | ||
625 | |||
626 | for(i = 0,j = 0; i <= 7; i++, j++) { | ||
627 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, j, | ||
628 | SiS_Pr->SiS_CRT1Table[index].CR[i]); | ||
629 | } | ||
630 | for(j = 0x10; i <= 10; i++, j++) { | ||
631 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, j, | ||
632 | SiS_Pr->SiS_CRT1Table[index].CR[i]); | ||
633 | } | ||
634 | for(j = 0x15; i <= 12; i++, j++) { | ||
635 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, j, | ||
636 | SiS_Pr->SiS_CRT1Table[index].CR[i]); | ||
637 | } | ||
638 | for(j = 0x0A; i <= 15; i++, j++) { | ||
639 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, j, | ||
640 | SiS_Pr->SiS_CRT1Table[index].CR[i]); | ||
641 | } | ||
642 | |||
643 | temp = SiS_Pr->SiS_CRT1Table[index].CR[16] & 0xE0; | ||
644 | SiS_SetReg(SiS_Pr,SiS_Pr->SiS_P3c4, 0x0E, temp); | ||
645 | |||
646 | temp = ((SiS_Pr->SiS_CRT1Table[index].CR[16]) & 0x01) << 5; | ||
647 | if (modeflag & DoubleScanMode) temp |= 0x80; | ||
648 | SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3d4, 0x09, 0x5F, temp); | ||
649 | |||
650 | if (SiS_Pr->SiS_ModeType > ModeVGA) | ||
651 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x14, 0x4F); | ||
652 | } | ||
653 | |||
654 | /*********************************************/ | ||
655 | /* OFFSET & PITCH */ | ||
656 | /*********************************************/ | ||
657 | /* (partly overruled by SetPitch() in XF86) */ | ||
658 | /*********************************************/ | ||
659 | |||
660 | static void | ||
661 | SiS_SetCRT1Offset(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
662 | unsigned short ModeIdIndex, unsigned short rrti) | ||
663 | { | ||
664 | unsigned short du = SiS_GetOffset(SiS_Pr, ModeNo, ModeIdIndex, rrti); | ||
665 | unsigned short infoflag = SiS_Pr->SiS_RefIndex[rrti].Ext_InfoFlag; | ||
666 | unsigned short temp; | ||
667 | |||
668 | temp = (du >> 8) & 0x0f; | ||
669 | SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0E, 0xF0, temp); | ||
670 | |||
671 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x13, (du & 0xFF)); | ||
672 | |||
673 | if (infoflag & InterlaceMode) du >>= 1; | ||
674 | |||
675 | du <<= 5; | ||
676 | temp = (du >> 8) & 0xff; | ||
677 | if (du & 0xff) temp++; | ||
678 | temp++; | ||
679 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x10, temp); | ||
680 | } | ||
681 | |||
682 | /*********************************************/ | ||
683 | /* VCLK */ | ||
684 | /*********************************************/ | ||
685 | |||
686 | static void | ||
687 | SiS_SetCRT1VCLK(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
688 | unsigned short rrti) | ||
689 | { | ||
690 | unsigned short index = SiS_Pr->SiS_RefIndex[rrti].Ext_CRTVCLK; | ||
691 | unsigned short clka = SiS_Pr->SiS_VCLKData[index].SR2B; | ||
692 | unsigned short clkb = SiS_Pr->SiS_VCLKData[index].SR2C; | ||
693 | |||
694 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4,0x31,0xCF); | ||
695 | |||
696 | SiS_SetReg(SiS_Pr,SiS_Pr->SiS_P3c4,0x2B,clka); | ||
697 | SiS_SetReg(SiS_Pr,SiS_Pr->SiS_P3c4,0x2C,clkb); | ||
698 | SiS_SetReg(SiS_Pr,SiS_Pr->SiS_P3c4,0x2D,0x01); | ||
699 | } | ||
700 | |||
701 | /*********************************************/ | ||
702 | /* FIFO */ | ||
703 | /*********************************************/ | ||
704 | |||
705 | static void | ||
706 | SiS_SetCRT1FIFO_310(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
707 | unsigned short mi) | ||
708 | { | ||
709 | unsigned short modeflag = SiS_Pr->SiS_EModeIDTable[mi].Ext_ModeFlag; | ||
710 | |||
711 | /* disable auto-threshold */ | ||
712 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4, 0x3D, 0xFE); | ||
713 | |||
714 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x08, 0xAE); | ||
715 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4, 0x09, 0xF0); | ||
716 | |||
717 | if (ModeNo <= 0x13) | ||
718 | return; | ||
719 | |||
720 | if ((!(modeflag & DoubleScanMode)) || (!(modeflag & HalfDCLK))) { | ||
721 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x08, 0x34); | ||
722 | SiS_SetRegOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x3D, 0x01); | ||
723 | } | ||
724 | } | ||
725 | |||
726 | /*********************************************/ | ||
727 | /* MODE REGISTERS */ | ||
728 | /*********************************************/ | ||
729 | |||
730 | static void | ||
731 | SiS_SetVCLKState(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
732 | unsigned short rrti) | ||
733 | { | ||
734 | unsigned short data = 0, VCLK = 0, index = 0; | ||
735 | |||
736 | if (ModeNo > 0x13) { | ||
737 | index = SiS_Pr->SiS_RefIndex[rrti].Ext_CRTVCLK; | ||
738 | VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; | ||
739 | } | ||
740 | |||
741 | if (VCLK >= 166) data |= 0x0c; | ||
742 | SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x32, 0xf3, data); | ||
743 | |||
744 | if (VCLK >= 166) | ||
745 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4, 0x1f, 0xe7); | ||
746 | |||
747 | /* DAC speed */ | ||
748 | data = 0x03; | ||
749 | if (VCLK >= 260) | ||
750 | data = 0x00; | ||
751 | else if (VCLK >= 160) | ||
752 | data = 0x01; | ||
753 | else if (VCLK >= 135) | ||
754 | data = 0x02; | ||
755 | |||
756 | SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x07, 0xF8, data); | ||
757 | } | ||
758 | |||
759 | static void | ||
760 | SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
761 | unsigned short ModeIdIndex, unsigned short rrti) | ||
762 | { | ||
763 | unsigned short data, infoflag = 0, modeflag; | ||
764 | |||
765 | if (ModeNo <= 0x13) | ||
766 | modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; | ||
767 | else { | ||
768 | modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; | ||
769 | infoflag = SiS_Pr->SiS_RefIndex[rrti].Ext_InfoFlag; | ||
770 | } | ||
771 | |||
772 | /* Disable DPMS */ | ||
773 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4, 0x1F, 0x3F); | ||
774 | |||
775 | data = 0; | ||
776 | if (ModeNo > 0x13) { | ||
777 | if (SiS_Pr->SiS_ModeType > ModeEGA) { | ||
778 | data |= 0x02; | ||
779 | data |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2); | ||
780 | } | ||
781 | if (infoflag & InterlaceMode) data |= 0x20; | ||
782 | } | ||
783 | SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x06, 0xC0, data); | ||
784 | |||
785 | data = 0; | ||
786 | if (infoflag & InterlaceMode) { | ||
787 | /* data = (Hsync / 8) - ((Htotal / 8) / 2) + 3 */ | ||
788 | unsigned short hrs = (SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x04) | | ||
789 | ((SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0b) & 0xc0) << 2)) - 3; | ||
790 | unsigned short hto = (SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x00) | | ||
791 | ((SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0b) & 0x03) << 8)) + 5; | ||
792 | data = hrs - (hto >> 1) + 3; | ||
793 | } | ||
794 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x19, (data & 0xFF)); | ||
795 | SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3d4, 0x1a, 0xFC, (data >> 8)); | ||
796 | |||
797 | if (modeflag & HalfDCLK) | ||
798 | SiS_SetRegOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x01, 0x08); | ||
799 | |||
800 | data = 0; | ||
801 | if (modeflag & LineCompareOff) | ||
802 | data = 0x08; | ||
803 | SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0F, 0xB7, data); | ||
804 | |||
805 | if ((SiS_Pr->SiS_ModeType == ModeEGA) && (ModeNo > 0x13)) | ||
806 | SiS_SetRegOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0F, 0x40); | ||
807 | |||
808 | SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4, 0x31, 0xfb); | ||
809 | |||
810 | data = 0x60; | ||
811 | if (SiS_Pr->SiS_ModeType != ModeText) { | ||
812 | data ^= 0x60; | ||
813 | if (SiS_Pr->SiS_ModeType != ModeEGA) | ||
814 | data ^= 0xA0; | ||
815 | } | ||
816 | SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x21, 0x1F, data); | ||
817 | |||
818 | SiS_SetVCLKState(SiS_Pr, ModeNo, rrti); | ||
819 | |||
820 | if (SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x31) & 0x40) | ||
821 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x52, 0x2c); | ||
822 | else | ||
823 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x52, 0x6c); | ||
824 | } | ||
825 | |||
826 | /*********************************************/ | ||
827 | /* LOAD DAC */ | ||
828 | /*********************************************/ | ||
829 | |||
830 | static void | ||
831 | SiS_WriteDAC(struct SiS_Private *SiS_Pr, unsigned long DACData, | ||
832 | unsigned short shiftflag, unsigned short dl, unsigned short ah, | ||
833 | unsigned short al, unsigned short dh) | ||
834 | { | ||
835 | unsigned short d1, d2, d3; | ||
836 | |||
837 | switch (dl) { | ||
838 | case 0: | ||
839 | d1 = dh; d2 = ah; d3 = al; | ||
840 | break; | ||
841 | case 1: | ||
842 | d1 = ah; d2 = al; d3 = dh; | ||
843 | break; | ||
844 | default: | ||
845 | d1 = al; d2 = dh; d3 = ah; | ||
846 | } | ||
847 | SiS_SetRegByte(SiS_Pr, DACData, (d1 << shiftflag)); | ||
848 | SiS_SetRegByte(SiS_Pr, DACData, (d2 << shiftflag)); | ||
849 | SiS_SetRegByte(SiS_Pr, DACData, (d3 << shiftflag)); | ||
850 | } | ||
851 | |||
852 | static void | ||
853 | SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short mi) | ||
854 | { | ||
855 | unsigned short data, data2, time, i, j, k, m, n, o; | ||
856 | unsigned short si, di, bx, sf; | ||
857 | unsigned long DACAddr, DACData; | ||
858 | const unsigned char *table = NULL; | ||
859 | |||
860 | if (ModeNo < 0x13) | ||
861 | data = SiS_Pr->SiS_SModeIDTable[mi].St_ModeFlag; | ||
862 | else | ||
863 | data = SiS_Pr->SiS_EModeIDTable[mi].Ext_ModeFlag; | ||
864 | |||
865 | data &= DACInfoFlag; | ||
866 | |||
867 | j = time = 64; | ||
868 | if (data == 0x00) | ||
869 | table = SiS_MDA_DAC; | ||
870 | else if (data == 0x08) | ||
871 | table = SiS_CGA_DAC; | ||
872 | else if (data == 0x10) | ||
873 | table = SiS_EGA_DAC; | ||
874 | else { | ||
875 | j = 16; | ||
876 | time = 256; | ||
877 | table = SiS_VGA_DAC; | ||
878 | } | ||
879 | |||
880 | DACAddr = SiS_Pr->SiS_P3c8; | ||
881 | DACData = SiS_Pr->SiS_P3c9; | ||
882 | sf = 0; | ||
883 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3c6, 0xFF); | ||
884 | |||
885 | SiS_SetRegByte(SiS_Pr, DACAddr, 0x00); | ||
886 | |||
887 | for(i = 0; i < j; i++) { | ||
888 | data = table[i]; | ||
889 | for(k = 0; k < 3; k++) { | ||
890 | data2 = 0; | ||
891 | if (data & 0x01) data2 += 0x2A; | ||
892 | if (data & 0x02) data2 += 0x15; | ||
893 | SiS_SetRegByte(SiS_Pr, DACData, (data2 << sf)); | ||
894 | data >>= 2; | ||
895 | } | ||
896 | } | ||
897 | |||
898 | if (time == 256) { | ||
899 | for(i = 16; i < 32; i++) { | ||
900 | data = table[i] << sf; | ||
901 | for(k = 0; k < 3; k++) | ||
902 | SiS_SetRegByte(SiS_Pr, DACData, data); | ||
903 | } | ||
904 | si = 32; | ||
905 | for(m = 0; m < 9; m++) { | ||
906 | di = si; | ||
907 | bx = si + 4; | ||
908 | for(n = 0; n < 3; n++) { | ||
909 | for(o = 0; o < 5; o++) { | ||
910 | SiS_WriteDAC(SiS_Pr, DACData, sf, n, | ||
911 | table[di], table[bx], table[si]); | ||
912 | si++; | ||
913 | } | ||
914 | si -= 2; | ||
915 | for(o = 0; o < 3; o++) { | ||
916 | SiS_WriteDAC(SiS_Pr, DACData, sf, n, | ||
917 | table[di], table[si], table[bx]); | ||
918 | si--; | ||
919 | } | ||
920 | } | ||
921 | si += 5; | ||
922 | } | ||
923 | } | ||
924 | } | ||
925 | |||
926 | /*********************************************/ | ||
927 | /* SET CRT1 REGISTER GROUP */ | ||
928 | /*********************************************/ | ||
929 | |||
930 | static void | ||
931 | SiS_SetCRT1Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | ||
932 | unsigned short ModeIdIndex) | ||
933 | { | ||
934 | unsigned short StandTableIndex, rrti; | ||
935 | |||
936 | SiS_Pr->SiS_CRT1Mode = ModeNo; | ||
937 | |||
938 | if (ModeNo <= 0x13) | ||
939 | StandTableIndex = 0; | ||
940 | else | ||
941 | StandTableIndex = 1; | ||
942 | |||
943 | SiS_ResetSegmentRegisters(SiS_Pr); | ||
944 | SiS_SetSeqRegs(SiS_Pr, StandTableIndex); | ||
945 | SiS_SetMiscRegs(SiS_Pr, StandTableIndex); | ||
946 | SiS_SetCRTCRegs(SiS_Pr, StandTableIndex); | ||
947 | SiS_SetATTRegs(SiS_Pr, StandTableIndex); | ||
948 | SiS_SetGRCRegs(SiS_Pr, StandTableIndex); | ||
949 | SiS_ClearExt1Regs(SiS_Pr, ModeNo); | ||
950 | |||
951 | rrti = SiS_GetRatePtr(SiS_Pr, ModeNo, ModeIdIndex); | ||
952 | |||
953 | if (rrti != 0xFFFF) { | ||
954 | SiS_SetCRT1Sync(SiS_Pr, rrti); | ||
955 | SiS_SetCRT1CRTC(SiS_Pr, ModeNo, ModeIdIndex, rrti); | ||
956 | SiS_SetCRT1Offset(SiS_Pr, ModeNo, ModeIdIndex, rrti); | ||
957 | SiS_SetCRT1VCLK(SiS_Pr, ModeNo, rrti); | ||
958 | } | ||
959 | |||
960 | SiS_SetCRT1FIFO_310(SiS_Pr, ModeNo, ModeIdIndex); | ||
961 | |||
962 | SiS_SetCRT1ModeRegs(SiS_Pr, ModeNo, ModeIdIndex, rrti); | ||
963 | |||
964 | SiS_LoadDAC(SiS_Pr, ModeNo, ModeIdIndex); | ||
965 | |||
966 | SiS_DisplayOn(SiS_Pr); | ||
967 | } | ||
968 | |||
969 | /*********************************************/ | ||
970 | /* SiSSetMode() */ | ||
971 | /*********************************************/ | ||
972 | |||
973 | int | ||
974 | SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | ||
975 | { | ||
976 | unsigned short ModeIdIndex; | ||
977 | unsigned long BaseAddr = SiS_Pr->IOAddress; | ||
978 | |||
979 | SiSUSB_InitPtr(SiS_Pr); | ||
980 | SiSUSBRegInit(SiS_Pr, BaseAddr); | ||
981 | SiS_GetSysFlags(SiS_Pr); | ||
982 | |||
983 | if (!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) | ||
984 | return 0; | ||
985 | |||
986 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x05, 0x86); | ||
987 | |||
988 | SiSInitPCIetc(SiS_Pr); | ||
989 | |||
990 | ModeNo &= 0x7f; | ||
991 | |||
992 | SiS_Pr->SiS_ModeType = | ||
993 | SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag & ModeTypeMask; | ||
994 | |||
995 | SiS_Pr->SiS_SetFlag = LowModeTests; | ||
996 | |||
997 | /* Set mode on CRT1 */ | ||
998 | SiS_SetCRT1Group(SiS_Pr, ModeNo, ModeIdIndex); | ||
999 | |||
1000 | SiS_HandleCRT1(SiS_Pr); | ||
1001 | |||
1002 | SiS_DisplayOn(SiS_Pr); | ||
1003 | SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3c6, 0xFF); | ||
1004 | |||
1005 | /* Store mode number */ | ||
1006 | SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x34, ModeNo); | ||
1007 | |||
1008 | return 1; | ||
1009 | } | ||
1010 | |||
1011 | int | ||
1012 | SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo) | ||
1013 | { | ||
1014 | unsigned short ModeNo = 0; | ||
1015 | int i; | ||
1016 | |||
1017 | SiSUSB_InitPtr(SiS_Pr); | ||
1018 | |||
1019 | if (VModeNo == 0x03) { | ||
1020 | |||
1021 | ModeNo = 0x03; | ||
1022 | |||
1023 | } else { | ||
1024 | |||
1025 | i = 0; | ||
1026 | do { | ||
1027 | |||
1028 | if (SiS_Pr->SiS_EModeIDTable[i].Ext_VESAID == VModeNo) { | ||
1029 | ModeNo = SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID; | ||
1030 | break; | ||
1031 | } | ||
1032 | |||
1033 | } while (SiS_Pr->SiS_EModeIDTable[i++].Ext_ModeID != 0xff); | ||
1034 | |||
1035 | } | ||
1036 | |||
1037 | if (!ModeNo) | ||
1038 | return 0; | ||
1039 | |||
1040 | return SiSUSBSetMode(SiS_Pr, ModeNo); | ||
1041 | } | ||
1042 | |||
1043 | #endif /* INCL_SISUSB_CON */ | ||
1044 | |||
1045 | |||
1046 | |||
1047 | |||
diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.h b/drivers/usb/misc/sisusbvga/sisusb_init.h new file mode 100644 index 000000000000..5b11577835c8 --- /dev/null +++ b/drivers/usb/misc/sisusbvga/sisusb_init.h | |||
@@ -0,0 +1,830 @@ | |||
1 | /* $XFree86$ */ | ||
2 | /* $XdotOrg$ */ | ||
3 | /* | ||
4 | * Data and prototypes for init.c | ||
5 | * | ||
6 | * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria | ||
7 | * | ||
8 | * If distributed as part of the Linux kernel, the following license terms | ||
9 | * apply: | ||
10 | * | ||
11 | * * This program is free software; you can redistribute it and/or modify | ||
12 | * * it under the terms of the GNU General Public License as published by | ||
13 | * * the Free Software Foundation; either version 2 of the named License, | ||
14 | * * or any later version. | ||
15 | * * | ||
16 | * * This program is distributed in the hope that it will be useful, | ||
17 | * * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * * GNU General Public License for more details. | ||
20 | * * | ||
21 | * * You should have received a copy of the GNU General Public License | ||
22 | * * along with this program; if not, write to the Free Software | ||
23 | * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA | ||
24 | * | ||
25 | * Otherwise, the following license terms apply: | ||
26 | * | ||
27 | * * Redistribution and use in source and binary forms, with or without | ||
28 | * * modification, are permitted provided that the following conditions | ||
29 | * * are met: | ||
30 | * * 1) Redistributions of source code must retain the above copyright | ||
31 | * * notice, this list of conditions and the following disclaimer. | ||
32 | * * 2) Redistributions in binary form must reproduce the above copyright | ||
33 | * * notice, this list of conditions and the following disclaimer in the | ||
34 | * * documentation and/or other materials provided with the distribution. | ||
35 | * * 3) The name of the author may not be used to endorse or promote products | ||
36 | * * derived from this software without specific prior written permission. | ||
37 | * * | ||
38 | * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
39 | * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
40 | * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
41 | * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
42 | * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
43 | * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
44 | * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
45 | * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
46 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
47 | * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | * | ||
49 | * Author: Thomas Winischhofer <thomas@winischhofer.net> | ||
50 | * | ||
51 | */ | ||
52 | |||
53 | #ifndef _SISUSB_INIT_H_ | ||
54 | #define _SISUSB_INIT_H_ | ||
55 | |||
56 | /* SiS_ModeType */ | ||
57 | #define ModeText 0x00 | ||
58 | #define ModeCGA 0x01 | ||
59 | #define ModeEGA 0x02 | ||
60 | #define ModeVGA 0x03 | ||
61 | #define Mode15Bpp 0x04 | ||
62 | #define Mode16Bpp 0x05 | ||
63 | #define Mode24Bpp 0x06 | ||
64 | #define Mode32Bpp 0x07 | ||
65 | |||
66 | #define ModeTypeMask 0x07 | ||
67 | #define IsTextMode 0x07 | ||
68 | |||
69 | #define DACInfoFlag 0x0018 | ||
70 | #define MemoryInfoFlag 0x01E0 | ||
71 | #define MemorySizeShift 5 | ||
72 | |||
73 | /* modeflag */ | ||
74 | #define Charx8Dot 0x0200 | ||
75 | #define LineCompareOff 0x0400 | ||
76 | #define CRT2Mode 0x0800 | ||
77 | #define HalfDCLK 0x1000 | ||
78 | #define NoSupportSimuTV 0x2000 | ||
79 | #define NoSupportLCDScale 0x4000 /* SiS bridge: No scaling possible (no matter what panel) */ | ||
80 | #define DoubleScanMode 0x8000 | ||
81 | |||
82 | /* Infoflag */ | ||
83 | #define SupportTV 0x0008 | ||
84 | #define SupportTV1024 0x0800 | ||
85 | #define SupportCHTV 0x0800 | ||
86 | #define Support64048060Hz 0x0800 /* Special for 640x480 LCD */ | ||
87 | #define SupportHiVision 0x0010 | ||
88 | #define SupportYPbPr750p 0x1000 | ||
89 | #define SupportLCD 0x0020 | ||
90 | #define SupportRAMDAC2 0x0040 /* All (<= 100Mhz) */ | ||
91 | #define SupportRAMDAC2_135 0x0100 /* All except DH (<= 135Mhz) */ | ||
92 | #define SupportRAMDAC2_162 0x0200 /* B, C (<= 162Mhz) */ | ||
93 | #define SupportRAMDAC2_202 0x0400 /* C (<= 202Mhz) */ | ||
94 | #define InterlaceMode 0x0080 | ||
95 | #define SyncPP 0x0000 | ||
96 | #define SyncPN 0x4000 | ||
97 | #define SyncNP 0x8000 | ||
98 | #define SyncNN 0xc000 | ||
99 | |||
100 | /* SetFlag */ | ||
101 | #define ProgrammingCRT2 0x0001 | ||
102 | #define LowModeTests 0x0002 | ||
103 | #define LCDVESATiming 0x0008 | ||
104 | #define EnableLVDSDDA 0x0010 | ||
105 | #define SetDispDevSwitchFlag 0x0020 | ||
106 | #define CheckWinDos 0x0040 | ||
107 | #define SetDOSMode 0x0080 | ||
108 | |||
109 | /* Index in ModeResInfo table */ | ||
110 | #define SIS_RI_320x200 0 | ||
111 | #define SIS_RI_320x240 1 | ||
112 | #define SIS_RI_320x400 2 | ||
113 | #define SIS_RI_400x300 3 | ||
114 | #define SIS_RI_512x384 4 | ||
115 | #define SIS_RI_640x400 5 | ||
116 | #define SIS_RI_640x480 6 | ||
117 | #define SIS_RI_800x600 7 | ||
118 | #define SIS_RI_1024x768 8 | ||
119 | #define SIS_RI_1280x1024 9 | ||
120 | #define SIS_RI_1600x1200 10 | ||
121 | #define SIS_RI_1920x1440 11 | ||
122 | #define SIS_RI_2048x1536 12 | ||
123 | #define SIS_RI_720x480 13 | ||
124 | #define SIS_RI_720x576 14 | ||
125 | #define SIS_RI_1280x960 15 | ||
126 | #define SIS_RI_800x480 16 | ||
127 | #define SIS_RI_1024x576 17 | ||
128 | #define SIS_RI_1280x720 18 | ||
129 | #define SIS_RI_856x480 19 | ||
130 | #define SIS_RI_1280x768 20 | ||
131 | #define SIS_RI_1400x1050 21 | ||
132 | #define SIS_RI_1152x864 22 /* Up to here SiS conforming */ | ||
133 | #define SIS_RI_848x480 23 | ||
134 | #define SIS_RI_1360x768 24 | ||
135 | #define SIS_RI_1024x600 25 | ||
136 | #define SIS_RI_1152x768 26 | ||
137 | #define SIS_RI_768x576 27 | ||
138 | #define SIS_RI_1360x1024 28 | ||
139 | #define SIS_RI_1680x1050 29 | ||
140 | #define SIS_RI_1280x800 30 | ||
141 | #define SIS_RI_1920x1080 31 | ||
142 | #define SIS_RI_960x540 32 | ||
143 | #define SIS_RI_960x600 33 | ||
144 | |||
145 | #define SIS_VIDEO_CAPTURE 0x00 - 0x30 | ||
146 | #define SIS_VIDEO_PLAYBACK 0x02 - 0x30 | ||
147 | #define SIS_CRT2_PORT_04 0x04 - 0x30 | ||
148 | |||
149 | /* Mode numbers */ | ||
150 | static const unsigned short ModeIndex_320x200[] = {0x59, 0x41, 0x00, 0x4f}; | ||
151 | static const unsigned short ModeIndex_320x240[] = {0x50, 0x56, 0x00, 0x53}; | ||
152 | static const unsigned short ModeIndex_400x300[] = {0x51, 0x57, 0x00, 0x54}; | ||
153 | static const unsigned short ModeIndex_512x384[] = {0x52, 0x58, 0x00, 0x5c}; | ||
154 | static const unsigned short ModeIndex_640x400[] = {0x2f, 0x5d, 0x00, 0x5e}; | ||
155 | static const unsigned short ModeIndex_640x480[] = {0x2e, 0x44, 0x00, 0x62}; | ||
156 | static const unsigned short ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35}; | ||
157 | static const unsigned short ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36}; | ||
158 | static const unsigned short ModeIndex_768x576[] = {0x5f, 0x60, 0x00, 0x61}; | ||
159 | static const unsigned short ModeIndex_800x480[] = {0x70, 0x7a, 0x00, 0x76}; | ||
160 | static const unsigned short ModeIndex_800x600[] = {0x30, 0x47, 0x00, 0x63}; | ||
161 | static const unsigned short ModeIndex_848x480[] = {0x39, 0x3b, 0x00, 0x3e}; | ||
162 | static const unsigned short ModeIndex_856x480[] = {0x3f, 0x42, 0x00, 0x45}; | ||
163 | static const unsigned short ModeIndex_960x540[] = {0x1d, 0x1e, 0x00, 0x1f}; | ||
164 | static const unsigned short ModeIndex_960x600[] = {0x20, 0x21, 0x00, 0x22}; | ||
165 | static const unsigned short ModeIndex_1024x768[] = {0x38, 0x4a, 0x00, 0x64}; | ||
166 | static const unsigned short ModeIndex_1024x576[] = {0x71, 0x74, 0x00, 0x77}; | ||
167 | static const unsigned short ModeIndex_1152x864[] = {0x29, 0x2a, 0x00, 0x2b}; | ||
168 | static const unsigned short ModeIndex_1280x720[] = {0x79, 0x75, 0x00, 0x78}; | ||
169 | static const unsigned short ModeIndex_1280x768[] = {0x23, 0x24, 0x00, 0x25}; | ||
170 | static const unsigned short ModeIndex_1280x1024[] = {0x3a, 0x4d, 0x00, 0x65}; | ||
171 | |||
172 | static const unsigned char SiS_MDA_DAC[] = | ||
173 | { | ||
174 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
175 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, | ||
176 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, | ||
177 | 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, | ||
178 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
179 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, | ||
180 | 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, | ||
181 | 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F | ||
182 | }; | ||
183 | |||
184 | static const unsigned char SiS_CGA_DAC[] = | ||
185 | { | ||
186 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, | ||
187 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, | ||
188 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, | ||
189 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, | ||
190 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, | ||
191 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, | ||
192 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, | ||
193 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F | ||
194 | }; | ||
195 | |||
196 | static const unsigned char SiS_EGA_DAC[] = | ||
197 | { | ||
198 | 0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, | ||
199 | 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, | ||
200 | 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, | ||
201 | 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, | ||
202 | 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, | ||
203 | 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, | ||
204 | 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, | ||
205 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F | ||
206 | }; | ||
207 | |||
208 | static const unsigned char SiS_VGA_DAC[] = | ||
209 | { | ||
210 | 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, | ||
211 | 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, | ||
212 | 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, | ||
213 | 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, | ||
214 | 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, | ||
215 | 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, | ||
216 | 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, | ||
217 | 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, | ||
218 | 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, | ||
219 | 0x0B,0x0C,0x0D,0x0F,0x10 | ||
220 | }; | ||
221 | |||
222 | static const struct SiS_St SiSUSB_SModeIDTable[] = | ||
223 | { | ||
224 | {0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03,0x40}, | ||
225 | {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00} | ||
226 | }; | ||
227 | |||
228 | static const struct SiS_StResInfo_S SiSUSB_StResInfo[] = | ||
229 | { | ||
230 | { 640,400}, | ||
231 | { 640,350}, | ||
232 | { 720,400}, | ||
233 | { 720,350}, | ||
234 | { 640,480} | ||
235 | }; | ||
236 | |||
237 | static const struct SiS_ModeResInfo SiSUSB_ModeResInfo[] = | ||
238 | { | ||
239 | { 320, 200, 8, 8}, /* 0x00 */ | ||
240 | { 320, 240, 8, 8}, /* 0x01 */ | ||
241 | { 320, 400, 8, 8}, /* 0x02 */ | ||
242 | { 400, 300, 8, 8}, /* 0x03 */ | ||
243 | { 512, 384, 8, 8}, /* 0x04 */ | ||
244 | { 640, 400, 8,16}, /* 0x05 */ | ||
245 | { 640, 480, 8,16}, /* 0x06 */ | ||
246 | { 800, 600, 8,16}, /* 0x07 */ | ||
247 | { 1024, 768, 8,16}, /* 0x08 */ | ||
248 | { 1280,1024, 8,16}, /* 0x09 */ | ||
249 | { 1600,1200, 8,16}, /* 0x0a */ | ||
250 | { 1920,1440, 8,16}, /* 0x0b */ | ||
251 | { 2048,1536, 8,16}, /* 0x0c */ | ||
252 | { 720, 480, 8,16}, /* 0x0d */ | ||
253 | { 720, 576, 8,16}, /* 0x0e */ | ||
254 | { 1280, 960, 8,16}, /* 0x0f */ | ||
255 | { 800, 480, 8,16}, /* 0x10 */ | ||
256 | { 1024, 576, 8,16}, /* 0x11 */ | ||
257 | { 1280, 720, 8,16}, /* 0x12 */ | ||
258 | { 856, 480, 8,16}, /* 0x13 */ | ||
259 | { 1280, 768, 8,16}, /* 0x14 */ | ||
260 | { 1400,1050, 8,16}, /* 0x15 */ | ||
261 | { 1152, 864, 8,16}, /* 0x16 */ | ||
262 | { 848, 480, 8,16}, /* 0x17 */ | ||
263 | { 1360, 768, 8,16}, /* 0x18 */ | ||
264 | { 1024, 600, 8,16}, /* 0x19 */ | ||
265 | { 1152, 768, 8,16}, /* 0x1a */ | ||
266 | { 768, 576, 8,16}, /* 0x1b */ | ||
267 | { 1360,1024, 8,16}, /* 0x1c */ | ||
268 | { 1680,1050, 8,16}, /* 0x1d */ | ||
269 | { 1280, 800, 8,16}, /* 0x1e */ | ||
270 | { 1920,1080, 8,16}, /* 0x1f */ | ||
271 | { 960, 540, 8,16}, /* 0x20 */ | ||
272 | { 960, 600, 8,16} /* 0x21 */ | ||
273 | }; | ||
274 | |||
275 | static const struct SiS_StandTable SiSUSB_StandTable[] = | ||
276 | { | ||
277 | /* MD_3_400 - mode 0x03 - 400 */ | ||
278 | { | ||
279 | 0x50,0x18,0x10,0x1000, | ||
280 | { 0x00,0x03,0x00,0x02 }, | ||
281 | 0x67, | ||
282 | { 0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, | ||
283 | 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, | ||
284 | 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, | ||
285 | 0xff }, | ||
286 | { 0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, | ||
287 | 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, | ||
288 | 0x0c,0x00,0x0f,0x08 }, | ||
289 | { 0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, 0xff } | ||
290 | }, | ||
291 | /* Generic for VGA and higher */ | ||
292 | { | ||
293 | 0x00,0x00,0x00,0x0000, | ||
294 | { 0x01,0x0f,0x00,0x0e }, | ||
295 | 0x23, | ||
296 | { 0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, | ||
297 | 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, | ||
298 | 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, | ||
299 | 0xff }, | ||
300 | { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, | ||
301 | 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, | ||
302 | 0x01,0x00,0x00,0x00 }, | ||
303 | { 0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, 0xff } | ||
304 | } | ||
305 | }; | ||
306 | |||
307 | static const struct SiS_Ext SiSUSB_EModeIDTable[] = | ||
308 | { | ||
309 | {0x2e,0x0a1b,0x0101,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08, 2}, /* 640x480x8 */ | ||
310 | {0x2f,0x0a1b,0x0100,SIS_RI_640x400, 0x00,0x00,0x05,0x05,0x10, 0}, /* 640x400x8 */ | ||
311 | {0x30,0x2a1b,0x0103,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x8 */ | ||
312 | {0x31,0x4a1b,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11,-1}, /* 720x480x8 */ | ||
313 | {0x32,0x4a1b,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12,-1}, /* 720x576x8 */ | ||
314 | {0x33,0x4a1d,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11,-1}, /* 720x480x16 */ | ||
315 | {0x34,0x6a1d,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12,-1}, /* 720x576x16 */ | ||
316 | {0x35,0x4a1f,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11,-1}, /* 720x480x32 */ | ||
317 | {0x36,0x6a1f,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12,-1}, /* 720x576x32 */ | ||
318 | {0x38,0x0a1b,0x0105,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13, 4}, /* 1024x768x8 */ | ||
319 | {0x3a,0x0e3b,0x0107,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x2f, 8}, /* 1280x1024x8 */ | ||
320 | {0x41,0x9a1d,0x010e,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x1a, 0}, /* 320x200x16 */ | ||
321 | {0x44,0x0a1d,0x0111,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08, 2}, /* 640x480x16 */ | ||
322 | {0x47,0x2a1d,0x0114,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x16 */ | ||
323 | {0x4a,0x0a3d,0x0117,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13, 4}, /* 1024x768x16 */ | ||
324 | {0x4d,0x0e7d,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x2f, 8}, /* 1280x1024x16 */ | ||
325 | {0x50,0x9a1b,0x0132,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x1b, 2}, /* 320x240x8 */ | ||
326 | {0x51,0xba1b,0x0133,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x1c, 3}, /* 400x300x8 */ | ||
327 | {0x52,0xba1b,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x1d, 4}, /* 512x384x8 */ | ||
328 | {0x56,0x9a1d,0x0135,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x1b, 2}, /* 320x240x16 */ | ||
329 | {0x57,0xba1d,0x0136,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x1c, 3}, /* 400x300x16 */ | ||
330 | {0x58,0xba1d,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x1d, 4}, /* 512x384x16 */ | ||
331 | {0x59,0x9a1b,0x0138,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x1a, 0}, /* 320x200x8 */ | ||
332 | {0x5c,0xba1f,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x1d, 4}, /* 512x384x32 */ | ||
333 | {0x5d,0x0a1d,0x0139,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10, 0}, /* 640x400x16 */ | ||
334 | {0x5e,0x0a1f,0x0000,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10, 0}, /* 640x400x32 */ | ||
335 | {0x62,0x0a3f,0x013a,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08, 2}, /* 640x480x32 */ | ||
336 | {0x63,0x2a3f,0x013b,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x32 */ | ||
337 | {0x64,0x0a7f,0x013c,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13, 4}, /* 1024x768x32 */ | ||
338 | {0x65,0x0eff,0x013d,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x2f, 8}, /* 1280x1024x32 */ | ||
339 | {0x70,0x6a1b,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x1e,-1}, /* 800x480x8 */ | ||
340 | {0x71,0x4a1b,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x21,-1}, /* 1024x576x8 */ | ||
341 | {0x74,0x4a1d,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x21,-1}, /* 1024x576x16 */ | ||
342 | {0x75,0x0a3d,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x24, 5}, /* 1280x720x16 */ | ||
343 | {0x76,0x6a1f,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x1e,-1}, /* 800x480x32 */ | ||
344 | {0x77,0x4a1f,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x21,-1}, /* 1024x576x32 */ | ||
345 | {0x78,0x0a3f,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x24, 5}, /* 1280x720x32 */ | ||
346 | {0x79,0x0a3b,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x24, 5}, /* 1280x720x8 */ | ||
347 | {0x7a,0x6a1d,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x1e,-1}, /* 800x480x16 */ | ||
348 | {0x23,0x0e3b,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x27, 6}, /* 1280x768x8 */ | ||
349 | {0x24,0x0e7d,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x27, 6}, /* 1280x768x16 */ | ||
350 | {0x25,0x0eff,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x27, 6}, /* 1280x768x32 */ | ||
351 | {0x39,0x6a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x28,-1}, /* 848x480 */ | ||
352 | {0x3b,0x6a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x28,-1}, | ||
353 | {0x3e,0x6a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x28,-1}, | ||
354 | {0x3f,0x6a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x2a,-1}, /* 856x480 */ | ||
355 | {0x42,0x6a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x2a,-1}, | ||
356 | {0x45,0x6a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x2a,-1}, | ||
357 | {0x4f,0x9a1f,0x0000,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x1a, 0}, /* 320x200x32 */ | ||
358 | {0x53,0x9a1f,0x0000,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x1b, 2}, /* 320x240x32 */ | ||
359 | {0x54,0xba1f,0x0000,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x1c, 3}, /* 400x300x32 */ | ||
360 | {0x5f,0x6a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x2c,-1}, /* 768x576 */ | ||
361 | {0x60,0x6a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x2c,-1}, | ||
362 | {0x61,0x6a3f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x2c,-1}, | ||
363 | {0x1d,0x6a1b,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x2d,-1}, /* 960x540 */ | ||
364 | {0x1e,0x6a3d,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x2d,-1}, | ||
365 | {0x1f,0x6a7f,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x2d,-1}, | ||
366 | {0x20,0x6a1b,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x2e,-1}, /* 960x600 */ | ||
367 | {0x21,0x6a3d,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x2e,-1}, | ||
368 | {0x22,0x6a7f,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x2e,-1}, | ||
369 | {0x29,0x4e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x33,-1}, /* 1152x864 */ | ||
370 | {0x2a,0x4e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x33,-1}, | ||
371 | {0x2b,0x4e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x33,-1}, | ||
372 | {0xff,0x0000,0x0000,0, 0x00,0x00,0x00,0x00,0x00,-1} | ||
373 | }; | ||
374 | |||
375 | static const struct SiS_Ext2 SiSUSB_RefIndex[] = | ||
376 | { | ||
377 | {0x085f,0x0d,0x03,0x05,0x05,0x30, 800, 600, 0x40, 0x00, 0x00}, /* 0x0 */ | ||
378 | {0x0067,0x0e,0x04,0x05,0x05,0x30, 800, 600, 0x40, 0x00, 0x00}, /* 0x1 */ | ||
379 | {0x0067,0x0f,0x08,0x48,0x05,0x30, 800, 600, 0x40, 0x00, 0x00}, /* 0x2 */ | ||
380 | {0x0067,0x10,0x07,0x8b,0x05,0x30, 800, 600, 0x40, 0x00, 0x00}, /* 0x3 */ | ||
381 | {0x0047,0x11,0x0a,0x00,0x05,0x30, 800, 600, 0x40, 0x00, 0x00}, /* 0x4 */ | ||
382 | {0x0047,0x12,0x0d,0x00,0x05,0x30, 800, 600, 0x40, 0x00, 0x00}, /* 0x5 */ | ||
383 | {0x0047,0x13,0x13,0x00,0x05,0x30, 800, 600, 0x20, 0x00, 0x00}, /* 0x6 */ | ||
384 | {0x0107,0x14,0x1c,0x00,0x05,0x30, 800, 600, 0x20, 0x00, 0x00}, /* 0x7 */ | ||
385 | {0xc85f,0x05,0x00,0x04,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0x8 */ | ||
386 | {0xc067,0x06,0x02,0x04,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0x9 */ | ||
387 | {0xc067,0x07,0x02,0x47,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xa */ | ||
388 | {0xc067,0x08,0x03,0x8a,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xb */ | ||
389 | {0xc047,0x09,0x05,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xc */ | ||
390 | {0xc047,0x0a,0x09,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xd */ | ||
391 | {0xc047,0x0b,0x0e,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xe */ | ||
392 | {0xc047,0x0c,0x15,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xf */ | ||
393 | {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0x30, 0x55, 0x6e}, /* 0x10 */ | ||
394 | {0xc06f,0x3c,0x01,0x06,0x13,0x31, 720, 480, 0x30, 0x00, 0x00}, /* 0x11 */ | ||
395 | {0x006f,0x3d,0x6f,0x06,0x14,0x32, 720, 576, 0x30, 0x00, 0x00}, /* 0x12 (6f was 03) */ | ||
396 | {0x0087,0x15,0x06,0x00,0x06,0x38,1024, 768, 0x30, 0x00, 0x00}, /* 0x13 */ | ||
397 | {0xc877,0x16,0x0b,0x06,0x06,0x38,1024, 768, 0x20, 0x00, 0x00}, /* 0x14 */ | ||
398 | {0xc067,0x17,0x0f,0x49,0x06,0x38,1024, 768, 0x20, 0x00, 0x00}, /* 0x15 */ | ||
399 | {0x0067,0x18,0x11,0x00,0x06,0x38,1024, 768, 0x20, 0x00, 0x00}, /* 0x16 */ | ||
400 | {0x0047,0x19,0x16,0x8c,0x06,0x38,1024, 768, 0x20, 0x00, 0x00}, /* 0x17 */ | ||
401 | {0x0107,0x1a,0x1b,0x00,0x06,0x38,1024, 768, 0x10, 0x00, 0x00}, /* 0x18 */ | ||
402 | {0x0107,0x1b,0x1f,0x00,0x06,0x38,1024, 768, 0x10, 0x00, 0x00}, /* 0x19 */ | ||
403 | {0x407f,0x00,0x00,0x00,0x00,0x41, 320, 200, 0x30, 0x56, 0x4e}, /* 0x1a */ | ||
404 | {0xc07f,0x01,0x00,0x04,0x04,0x50, 320, 240, 0x30, 0x00, 0x00}, /* 0x1b */ | ||
405 | {0x007f,0x02,0x04,0x05,0x05,0x51, 400, 300, 0x30, 0x00, 0x00}, /* 0x1c */ | ||
406 | {0xc077,0x03,0x0b,0x06,0x06,0x52, 512, 384, 0x30, 0x00, 0x00}, /* 0x1d */ | ||
407 | {0x0077,0x32,0x40,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00}, /* 0x1e */ | ||
408 | {0x0047,0x33,0x07,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00}, /* 0x1f */ | ||
409 | {0x0047,0x34,0x0a,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00}, /* 0x20 */ | ||
410 | {0x0077,0x35,0x0b,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00}, /* 0x21 */ | ||
411 | {0x0047,0x36,0x11,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00}, /* 0x22 */ | ||
412 | {0x0047,0x37,0x16,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00}, /* 0x23 */ | ||
413 | {0x1137,0x38,0x19,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00}, /* 0x24 */ | ||
414 | {0x1107,0x39,0x1e,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00}, /* 0x25 */ | ||
415 | {0x1307,0x3a,0x20,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00}, /* 0x26 */ | ||
416 | {0x0077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30, 0x00, 0x00}, /* 0x27 */ | ||
417 | {0x0087,0x45,0x57,0x00,0x16,0x39, 848, 480, 0x30, 0x00, 0x00}, /* 0x28 38Hzi */ | ||
418 | {0xc067,0x46,0x55,0x0b,0x16,0x39, 848, 480, 0x30, 0x00, 0x00}, /* 0x29 848x480-60Hz */ | ||
419 | {0x0087,0x47,0x57,0x00,0x17,0x3f, 856, 480, 0x30, 0x00, 0x00}, /* 0x2a 856x480-38Hzi */ | ||
420 | {0xc067,0x48,0x57,0x00,0x17,0x3f, 856, 480, 0x30, 0x00, 0x00}, /* 0x2b 856x480-60Hz */ | ||
421 | {0x006f,0x4d,0x71,0x06,0x15,0x5f, 768, 576, 0x30, 0x00, 0x00}, /* 0x2c 768x576-56Hz */ | ||
422 | {0x0067,0x52,0x6a,0x00,0x1c,0x1d, 960, 540, 0x30, 0x00, 0x00}, /* 0x2d 960x540 60Hz */ | ||
423 | {0x0077,0x53,0x6b,0x0b,0x1d,0x20, 960, 600, 0x30, 0x00, 0x00}, /* 0x2e 960x600 60Hz */ | ||
424 | {0x0087,0x1c,0x11,0x00,0x07,0x3a,1280,1024, 0x30, 0x00, 0x00}, /* 0x2f */ | ||
425 | {0x0137,0x1d,0x19,0x07,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00}, /* 0x30 */ | ||
426 | {0x0107,0x1e,0x1e,0x00,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00}, /* 0x31 */ | ||
427 | {0x0207,0x1f,0x20,0x00,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00}, /* 0x32 */ | ||
428 | {0x0127,0x54,0x6d,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00}, /* 0x33 1152x864-60Hz */ | ||
429 | {0x0127,0x44,0x19,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00}, /* 0x34 1152x864-75Hz */ | ||
430 | {0x0127,0x4a,0x1e,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00}, /* 0x35 1152x864-85Hz */ | ||
431 | {0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0, 0x00, 0x00} | ||
432 | }; | ||
433 | |||
434 | static const struct SiS_CRT1Table SiSUSB_CRT1Table[] = | ||
435 | { | ||
436 | {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, | ||
437 | 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, | ||
438 | 0x00}}, /* 0x0 */ | ||
439 | {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, | ||
440 | 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, | ||
441 | 0x00}}, /* 0x1 */ | ||
442 | {{0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, | ||
443 | 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x05, | ||
444 | 0x01}}, /* 0x2 */ | ||
445 | {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, | ||
446 | 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, | ||
447 | 0x01}}, /* 0x3 */ | ||
448 | {{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, | ||
449 | 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x05, | ||
450 | 0x00}}, /* 0x4 */ | ||
451 | {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, | ||
452 | 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05, | ||
453 | 0x00}}, /* 0x5 */ | ||
454 | {{0x63,0x4f,0x4f,0x87,0x56,0x9b,0x06,0x3e, | ||
455 | 0xe8,0x8a,0xdf,0xe7,0x07,0x00,0x00,0x01, | ||
456 | 0x00}}, /* 0x6 */ | ||
457 | {{0x64,0x4f,0x4f,0x88,0x55,0x9d,0xf2,0x1f, | ||
458 | 0xe0,0x83,0xdf,0xdf,0xf3,0x10,0x00,0x01, | ||
459 | 0x00}}, /* 0x7 */ | ||
460 | {{0x63,0x4f,0x4f,0x87,0x5a,0x81,0xfb,0x1f, | ||
461 | 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, | ||
462 | 0x00}}, /* 0x8 */ | ||
463 | {{0x65,0x4f,0x4f,0x89,0x58,0x80,0xfb,0x1f, | ||
464 | 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, | ||
465 | 0x61}}, /* 0x9 */ | ||
466 | {{0x65,0x4f,0x4f,0x89,0x58,0x80,0x01,0x3e, | ||
467 | 0xe0,0x83,0xdf,0xdf,0x02,0x00,0x00,0x05, | ||
468 | 0x61}}, /* 0xa */ | ||
469 | {{0x67,0x4f,0x4f,0x8b,0x58,0x81,0x0d,0x3e, | ||
470 | 0xe0,0x83,0xdf,0xdf,0x0e,0x00,0x00,0x05, | ||
471 | 0x61}}, /* 0xb */ | ||
472 | {{0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f, | ||
473 | 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, | ||
474 | 0x00}}, /* 0xc */ | ||
475 | {{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0, | ||
476 | 0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05, | ||
477 | 0x01}}, /* 0xd */ | ||
478 | {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xf0, | ||
479 | 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x06, | ||
480 | 0x01}}, /* 0xe */ | ||
481 | {{0x7d,0x63,0x63,0x81,0x6e,0x1d,0x98,0xf0, | ||
482 | 0x7c,0x82,0x57,0x57,0x99,0x00,0x00,0x06, | ||
483 | 0x01}}, /* 0xf */ | ||
484 | {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xf0, | ||
485 | 0x58,0x8b,0x57,0x57,0x70,0x20,0x00,0x06, | ||
486 | 0x01}}, /* 0x10 */ | ||
487 | {{0x7e,0x63,0x63,0x82,0x6b,0x13,0x75,0xf0, | ||
488 | 0x58,0x8b,0x57,0x57,0x76,0x20,0x00,0x06, | ||
489 | 0x01}}, /* 0x11 */ | ||
490 | {{0x81,0x63,0x63,0x85,0x6d,0x18,0x7a,0xf0, | ||
491 | 0x58,0x8b,0x57,0x57,0x7b,0x20,0x00,0x06, | ||
492 | 0x61}}, /* 0x12 */ | ||
493 | {{0x83,0x63,0x63,0x87,0x6e,0x19,0x81,0xf0, | ||
494 | 0x58,0x8b,0x57,0x57,0x82,0x20,0x00,0x06, | ||
495 | 0x61}}, /* 0x13 */ | ||
496 | {{0x85,0x63,0x63,0x89,0x6f,0x1a,0x91,0xf0, | ||
497 | 0x58,0x8b,0x57,0x57,0x92,0x20,0x00,0x06, | ||
498 | 0x61}}, /* 0x14 */ | ||
499 | {{0x99,0x7f,0x7f,0x9d,0x84,0x1a,0x96,0x1f, | ||
500 | 0x7f,0x83,0x7f,0x7f,0x97,0x10,0x00,0x02, | ||
501 | 0x00}}, /* 0x15 */ | ||
502 | {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, | ||
503 | 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, | ||
504 | 0x01}}, /* 0x16 */ | ||
505 | {{0xa1,0x7f,0x7f,0x85,0x86,0x97,0x24,0xf5, | ||
506 | 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, | ||
507 | 0x01}}, /* 0x17 */ | ||
508 | {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf5, | ||
509 | 0x00,0x83,0xff,0xff,0x1f,0x10,0x00,0x02, | ||
510 | 0x01}}, /* 0x18 */ | ||
511 | {{0xa7,0x7f,0x7f,0x8b,0x89,0x95,0x26,0xf5, | ||
512 | 0x00,0x83,0xff,0xff,0x27,0x10,0x00,0x02, | ||
513 | 0x01}}, /* 0x19 */ | ||
514 | {{0xa9,0x7f,0x7f,0x8d,0x8c,0x9a,0x2c,0xf5, | ||
515 | 0x00,0x83,0xff,0xff,0x2d,0x14,0x00,0x02, | ||
516 | 0x62}}, /* 0x1a */ | ||
517 | {{0xab,0x7f,0x7f,0x8f,0x8d,0x9b,0x35,0xf5, | ||
518 | 0x00,0x83,0xff,0xff,0x36,0x14,0x00,0x02, | ||
519 | 0x62}}, /* 0x1b */ | ||
520 | {{0xcf,0x9f,0x9f,0x93,0xb2,0x01,0x14,0xba, | ||
521 | 0x00,0x83,0xff,0xff,0x15,0x00,0x00,0x03, | ||
522 | 0x00}}, /* 0x1c */ | ||
523 | {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0x5a, | ||
524 | 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, | ||
525 | 0x01}}, /* 0x1d */ | ||
526 | {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0x5a, | ||
527 | 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, | ||
528 | 0x01}}, /* 0x1e */ | ||
529 | {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0x5a, | ||
530 | 0x00,0x83,0xff,0xff,0x2f,0x09,0x00,0x07, | ||
531 | 0x01}}, /* 0x1f */ | ||
532 | {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, | ||
533 | 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, | ||
534 | 0x00}}, /* 0x20 */ | ||
535 | {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, | ||
536 | 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, | ||
537 | 0x00}}, /* 0x21 */ | ||
538 | {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, | ||
539 | 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, | ||
540 | 0x00}}, /* 0x22 */ | ||
541 | {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, | ||
542 | 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, | ||
543 | 0x00}}, /* 0x23 */ | ||
544 | {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, | ||
545 | 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, | ||
546 | 0x00}}, /* 0x24 */ | ||
547 | {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, | ||
548 | 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, | ||
549 | 0x00}}, /* 0x25 */ | ||
550 | {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, | ||
551 | 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, | ||
552 | 0x00}}, /* 0x26 */ | ||
553 | {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, | ||
554 | 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, | ||
555 | 0x00}}, /* 0x27 */ | ||
556 | {{0x43,0xef,0xef,0x87,0x06,0x00,0xd4,0x1f, | ||
557 | 0xa0,0x83,0x9f,0x9f,0xd5,0x1f,0x41,0x05, | ||
558 | 0x63}}, /* 0x28 */ | ||
559 | {{0x45,0xef,0xef,0x89,0x07,0x01,0xd9,0x1f, | ||
560 | 0xa0,0x83,0x9f,0x9f,0xda,0x1f,0x41,0x05, | ||
561 | 0x63}}, /* 0x29 */ | ||
562 | {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, | ||
563 | 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, | ||
564 | 0x00}}, /* 0x2a */ | ||
565 | {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, | ||
566 | 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, | ||
567 | 0x00}}, /* 0x2b */ | ||
568 | {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, | ||
569 | 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, | ||
570 | 0x00}}, /* 0x2c */ | ||
571 | {{0x59,0xff,0xff,0x9d,0x17,0x13,0x33,0xba, | ||
572 | 0x00,0x83,0xff,0xff,0x34,0x0f,0x41,0x05, | ||
573 | 0x44}}, /* 0x2d */ | ||
574 | {{0x5b,0xff,0xff,0x9f,0x18,0x14,0x38,0xba, | ||
575 | 0x00,0x83,0xff,0xff,0x39,0x0f,0x41,0x05, | ||
576 | 0x44}}, /* 0x2e */ | ||
577 | {{0x5b,0xff,0xff,0x9f,0x18,0x14,0x3d,0xba, | ||
578 | 0x00,0x83,0xff,0xff,0x3e,0x0f,0x41,0x05, | ||
579 | 0x44}}, /* 0x2f */ | ||
580 | {{0x5d,0xff,0xff,0x81,0x19,0x95,0x41,0xba, | ||
581 | 0x00,0x84,0xff,0xff,0x42,0x0f,0x41,0x05, | ||
582 | 0x44}}, /* 0x30 */ | ||
583 | {{0x55,0xff,0xff,0x99,0x0d,0x0c,0x3e,0xba, | ||
584 | 0x00,0x84,0xff,0xff,0x3f,0x0f,0x41,0x05, | ||
585 | 0x00}}, /* 0x31 */ | ||
586 | {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba, | ||
587 | 0x27,0x8b,0xdf,0xdf,0x73,0x00,0x00,0x06, | ||
588 | 0x01}}, /* 0x32 */ | ||
589 | {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba, | ||
590 | 0x26,0x89,0xdf,0xdf,0x6f,0x00,0x00,0x06, | ||
591 | 0x01}}, /* 0x33 */ | ||
592 | {{0x7f,0x63,0x63,0x82,0x6b,0x13,0x75,0xba, | ||
593 | 0x29,0x8c,0xdf,0xdf,0x75,0x00,0x00,0x06, | ||
594 | 0x01}}, /* 0x34 */ | ||
595 | {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf1, | ||
596 | 0xaf,0x85,0x3f,0x3f,0x25,0x30,0x00,0x02, | ||
597 | 0x01}}, /* 0x35 */ | ||
598 | {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1, | ||
599 | 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02, | ||
600 | 0x01}}, /* 0x36 */ | ||
601 | {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, | ||
602 | 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, | ||
603 | 0x01}}, /* 0x37 */ | ||
604 | {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, | ||
605 | 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, | ||
606 | 0x01}}, /* 0x38 */ | ||
607 | {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xd4, | ||
608 | 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, | ||
609 | 0x01}}, /* 0x39 */ | ||
610 | {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4, | ||
611 | 0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07, | ||
612 | 0x01}}, /* 0x3a */ | ||
613 | {{0xdc,0x9f,0x9f,0x80,0xaf,0x9d,0xe6,0xff, | ||
614 | 0xc0,0x83,0xbf,0xbf,0xe7,0x10,0x00,0x07, | ||
615 | 0x01}}, /* 0x3b */ | ||
616 | {{0x6b,0x59,0x59,0x8f,0x5e,0x8c,0x0b,0x3e, | ||
617 | 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, | ||
618 | 0x00}}, /* 0x3c */ | ||
619 | {{0x6d,0x59,0x59,0x91,0x60,0x89,0x53,0xf0, | ||
620 | 0x41,0x84,0x3f,0x3f,0x54,0x00,0x00,0x05, | ||
621 | 0x41}}, /* 0x3d */ | ||
622 | {{0x86,0x6a,0x6a,0x8a,0x74,0x06,0x8c,0x15, | ||
623 | 0x4f,0x83,0xef,0xef,0x8d,0x30,0x00,0x02, | ||
624 | 0x00}}, /* 0x3e */ | ||
625 | {{0x81,0x6a,0x6a,0x85,0x70,0x00,0x0f,0x3e, | ||
626 | 0xeb,0x8e,0xdf,0xdf,0x10,0x00,0x00,0x02, | ||
627 | 0x00}}, /* 0x3f */ | ||
628 | {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, | ||
629 | 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, | ||
630 | 0x01}}, /* 0x40 */ | ||
631 | {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, | ||
632 | 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, | ||
633 | 0x01}}, /* 0x41 */ | ||
634 | {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x20,0xf5, | ||
635 | 0x03,0x88,0xff,0xff,0x21,0x10,0x00,0x07, | ||
636 | 0x01}}, /* 0x42 */ | ||
637 | {{0xe6,0xae,0xae,0x8a,0xbd,0x90,0x3d,0x10, | ||
638 | 0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x00,0x03, | ||
639 | 0x00}}, /* 0x43 */ | ||
640 | {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, | ||
641 | 0x60,0x83,0x5f,0x5f,0x83,0x10,0x00,0x07, | ||
642 | 0x01}}, /* 0x44 */ | ||
643 | {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, | ||
644 | 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, | ||
645 | 0x00}}, /* 0x45 */ | ||
646 | {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, | ||
647 | 0xE5,0x8d,0xDF,0xe4,0x04,0x00,0x00,0x06, | ||
648 | 0x00}}, /* 0x46 */ | ||
649 | {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, | ||
650 | 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, | ||
651 | 0x00}}, /* 0x47 */ | ||
652 | {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, | ||
653 | 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, | ||
654 | 0x00}}, /* 0x48 */ | ||
655 | {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, | ||
656 | 0x01,0x8d,0xff,0x00,0x27,0x10,0x00,0x03, | ||
657 | 0x01}}, /* 0x49 */ | ||
658 | {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, | ||
659 | 0x60,0x8b,0x5f,0x5f,0x8b,0x10,0x00,0x03, | ||
660 | 0x01}}, /* 0x4a */ | ||
661 | {{0xea,0xae,0xae,0x8e,0xba,0x82,0x40,0x10, | ||
662 | 0x1b,0x87,0x19,0x1a,0x41,0x0f,0x00,0x03, | ||
663 | 0x00}}, /* 0x4b */ | ||
664 | {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, | ||
665 | 0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07, | ||
666 | 0x01}}, /* 0x4c */ | ||
667 | {{0x75,0x5f,0x5f,0x99,0x66,0x90,0x53,0xf0, | ||
668 | 0x41,0x84,0x3f,0x3f,0x54,0x00,0x00,0x05, | ||
669 | 0x41}}, | ||
670 | {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, | ||
671 | 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, | ||
672 | 0x00}}, /* 0x4e */ | ||
673 | {{0xcd,0x9f,0x9f,0x91,0xab,0x1c,0x3a,0xff, | ||
674 | 0x20,0x83,0x1f,0x1f,0x3b,0x10,0x00,0x07, | ||
675 | 0x21}}, /* 0x4f */ | ||
676 | {{0x15,0xd1,0xd1,0x99,0xe2,0x19,0x3d,0x10, | ||
677 | 0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x01,0x0c, | ||
678 | 0x20}}, /* 0x50 */ | ||
679 | {{0x0e,0xef,0xef,0x92,0xfe,0x03,0x30,0xf0, | ||
680 | 0x1e,0x83,0x1b,0x1c,0x31,0x00,0x01,0x00, | ||
681 | 0x61}}, /* 0x51 */ | ||
682 | {{0x85,0x77,0x77,0x89,0x7d,0x01,0x31,0xf0, | ||
683 | 0x1e,0x84,0x1b,0x1c,0x32,0x00,0x00,0x02, | ||
684 | 0x41}}, /* 0x52 */ | ||
685 | {{0x87,0x77,0x77,0x8b,0x81,0x0b,0x68,0xf0, | ||
686 | 0x5a,0x80,0x57,0x57,0x69,0x00,0x00,0x02, | ||
687 | 0x01}}, /* 0x53 */ | ||
688 | {{0xcd,0x8f,0x8f,0x91,0x9b,0x1b,0x7a,0xff, | ||
689 | 0x64,0x8c,0x5f,0x62,0x7b,0x10,0x00,0x07, | ||
690 | 0x41}} /* 0x54 */ | ||
691 | }; | ||
692 | |||
693 | static struct SiS_VCLKData SiSUSB_VCLKData[] = | ||
694 | { | ||
695 | { 0x1b,0xe1, 25}, /* 0x00 */ | ||
696 | { 0x4e,0xe4, 28}, /* 0x01 */ | ||
697 | { 0x57,0xe4, 31}, /* 0x02 */ | ||
698 | { 0xc3,0xc8, 36}, /* 0x03 */ | ||
699 | { 0x42,0xe2, 40}, /* 0x04 */ | ||
700 | { 0xfe,0xcd, 43}, /* 0x05 */ | ||
701 | { 0x5d,0xc4, 44}, /* 0x06 */ | ||
702 | { 0x52,0xe2, 49}, /* 0x07 */ | ||
703 | { 0x53,0xe2, 50}, /* 0x08 */ | ||
704 | { 0x74,0x67, 52}, /* 0x09 */ | ||
705 | { 0x6d,0x66, 56}, /* 0x0a */ | ||
706 | { 0x5a,0x64, 65}, /* 0x0b */ | ||
707 | { 0x46,0x44, 67}, /* 0x0c */ | ||
708 | { 0xb1,0x46, 68}, /* 0x0d */ | ||
709 | { 0xd3,0x4a, 72}, /* 0x0e */ | ||
710 | { 0x29,0x61, 75}, /* 0x0f */ | ||
711 | { 0x6e,0x46, 76}, /* 0x10 */ | ||
712 | { 0x2b,0x61, 78}, /* 0x11 */ | ||
713 | { 0x31,0x42, 79}, /* 0x12 */ | ||
714 | { 0xab,0x44, 83}, /* 0x13 */ | ||
715 | { 0x46,0x25, 84}, /* 0x14 */ | ||
716 | { 0x78,0x29, 86}, /* 0x15 */ | ||
717 | { 0x62,0x44, 94}, /* 0x16 */ | ||
718 | { 0x2b,0x41,104}, /* 0x17 */ | ||
719 | { 0x3a,0x23,105}, /* 0x18 */ | ||
720 | { 0x70,0x44,108}, /* 0x19 */ | ||
721 | { 0x3c,0x23,109}, /* 0x1a */ | ||
722 | { 0x5e,0x43,113}, /* 0x1b */ | ||
723 | { 0xbc,0x44,116}, /* 0x1c */ | ||
724 | { 0xe0,0x46,132}, /* 0x1d */ | ||
725 | { 0x54,0x42,135}, /* 0x1e */ | ||
726 | { 0xea,0x2a,139}, /* 0x1f */ | ||
727 | { 0x41,0x22,157}, /* 0x20 */ | ||
728 | { 0x70,0x24,162}, /* 0x21 */ | ||
729 | { 0x30,0x21,175}, /* 0x22 */ | ||
730 | { 0x4e,0x22,189}, /* 0x23 */ | ||
731 | { 0xde,0x26,194}, /* 0x24 */ | ||
732 | { 0x62,0x06,202}, /* 0x25 */ | ||
733 | { 0x3f,0x03,229}, /* 0x26 */ | ||
734 | { 0xb8,0x06,234}, /* 0x27 */ | ||
735 | { 0x34,0x02,253}, /* 0x28 */ | ||
736 | { 0x58,0x04,255}, /* 0x29 */ | ||
737 | { 0x24,0x01,265}, /* 0x2a */ | ||
738 | { 0x9b,0x02,267}, /* 0x2b */ | ||
739 | { 0x70,0x05,270}, /* 0x2c */ | ||
740 | { 0x25,0x01,272}, /* 0x2d */ | ||
741 | { 0x9c,0x02,277}, /* 0x2e */ | ||
742 | { 0x27,0x01,286}, /* 0x2f */ | ||
743 | { 0x3c,0x02,291}, /* 0x30 */ | ||
744 | { 0xef,0x0a,292}, /* 0x31 */ | ||
745 | { 0xf6,0x0a,310}, /* 0x32 */ | ||
746 | { 0x95,0x01,315}, /* 0x33 */ | ||
747 | { 0xf0,0x09,324}, /* 0x34 */ | ||
748 | { 0xfe,0x0a,331}, /* 0x35 */ | ||
749 | { 0xf3,0x09,332}, /* 0x36 */ | ||
750 | { 0xea,0x08,340}, /* 0x37 */ | ||
751 | { 0xe8,0x07,376}, /* 0x38 */ | ||
752 | { 0xde,0x06,389}, /* 0x39 */ | ||
753 | { 0x52,0x2a, 54}, /* 0x3a 301 TV */ | ||
754 | { 0x52,0x6a, 27}, /* 0x3b 301 TV */ | ||
755 | { 0x62,0x24, 70}, /* 0x3c 301 TV */ | ||
756 | { 0x62,0x64, 70}, /* 0x3d 301 TV */ | ||
757 | { 0xa8,0x4c, 30}, /* 0x3e 301 TV */ | ||
758 | { 0x20,0x26, 33}, /* 0x3f 301 TV */ | ||
759 | { 0x31,0xc2, 39}, /* 0x40 */ | ||
760 | { 0x60,0x36, 30}, /* 0x41 Chrontel */ | ||
761 | { 0x40,0x4a, 28}, /* 0x42 Chrontel */ | ||
762 | { 0x9f,0x46, 44}, /* 0x43 Chrontel */ | ||
763 | { 0x97,0x2c, 26}, /* 0x44 */ | ||
764 | { 0x44,0xe4, 25}, /* 0x45 Chrontel */ | ||
765 | { 0x7e,0x32, 47}, /* 0x46 Chrontel */ | ||
766 | { 0x8a,0x24, 31}, /* 0x47 Chrontel */ | ||
767 | { 0x97,0x2c, 26}, /* 0x48 Chrontel */ | ||
768 | { 0xce,0x3c, 39}, /* 0x49 */ | ||
769 | { 0x52,0x4a, 36}, /* 0x4a Chrontel */ | ||
770 | { 0x34,0x61, 95}, /* 0x4b */ | ||
771 | { 0x78,0x27,108}, /* 0x4c - was 102 */ | ||
772 | { 0x66,0x43,123}, /* 0x4d Modes 0x26-0x28 (1400x1050) */ | ||
773 | { 0x41,0x4e, 21}, /* 0x4e */ | ||
774 | { 0xa1,0x4a, 29}, /* 0x4f Chrontel */ | ||
775 | { 0x19,0x42, 42}, /* 0x50 */ | ||
776 | { 0x54,0x46, 58}, /* 0x51 Chrontel */ | ||
777 | { 0x25,0x42, 61}, /* 0x52 */ | ||
778 | { 0x44,0x44, 66}, /* 0x53 Chrontel */ | ||
779 | { 0x3a,0x62, 70}, /* 0x54 Chrontel */ | ||
780 | { 0x62,0xc6, 34}, /* 0x55 848x480-60 */ | ||
781 | { 0x6a,0xc6, 37}, /* 0x56 848x480-75 - TEMP */ | ||
782 | { 0xbf,0xc8, 35}, /* 0x57 856x480-38i,60 */ | ||
783 | { 0x30,0x23, 88}, /* 0x58 1360x768-62 (is 60Hz!) */ | ||
784 | { 0x52,0x07,149}, /* 0x59 1280x960-85 */ | ||
785 | { 0x56,0x07,156}, /* 0x5a 1400x1050-75 */ | ||
786 | { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD */ | ||
787 | { 0x45,0x25, 83}, /* 0x5c 1280x800 */ | ||
788 | { 0x70,0x0a,147}, /* 0x5d 1680x1050 */ | ||
789 | { 0x70,0x24,162}, /* 0x5e 1600x1200 */ | ||
790 | { 0x5a,0x64, 65}, /* 0x5f 1280x720 - temp */ | ||
791 | { 0x63,0x46, 68}, /* 0x60 1280x768_2 */ | ||
792 | { 0x31,0x42, 79}, /* 0x61 1280x768_3 - temp */ | ||
793 | { 0, 0, 0}, /* 0x62 - custom (will be filled out at run-time) */ | ||
794 | { 0x5a,0x64, 65}, /* 0x63 1280x720 (LCD LVDS) */ | ||
795 | { 0x70,0x28, 90}, /* 0x64 1152x864@60 */ | ||
796 | { 0x41,0xc4, 32}, /* 0x65 848x480@60 */ | ||
797 | { 0x5c,0xc6, 32}, /* 0x66 856x480@60 */ | ||
798 | { 0x76,0xe7, 27}, /* 0x67 720x480@60 */ | ||
799 | { 0x5f,0xc6, 33}, /* 0x68 720/768x576@60 */ | ||
800 | { 0x52,0x27, 75}, /* 0x69 1920x1080i 60Hz interlaced */ | ||
801 | { 0x7c,0x6b, 38}, /* 0x6a 960x540@60 */ | ||
802 | { 0xe3,0x56, 41}, /* 0x6b 960x600@60 */ | ||
803 | { 0x45,0x25, 83}, /* 0x6c 1280x800 */ | ||
804 | { 0x70,0x28, 90}, /* 0x6d 1152x864@60 */ | ||
805 | { 0x15,0xe1, 20}, /* 0x6e 640x400@60 (fake, not actually used) */ | ||
806 | { 0x5f,0xc6, 33}, /* 0x6f 720x576@60 */ | ||
807 | { 0x37,0x5a, 10}, /* 0x70 320x200@60 (fake, not actually used) */ | ||
808 | { 0x2b,0xc2, 35} /* 0x71 768@576@60 */ | ||
809 | }; | ||
810 | |||
811 | void SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr); | ||
812 | unsigned short SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth); | ||
813 | int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); | ||
814 | int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); | ||
815 | |||
816 | extern int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data); | ||
817 | extern int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data); | ||
818 | extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, | ||
819 | u8 index, u8 data); | ||
820 | extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, | ||
821 | u8 index, u8 *data); | ||
822 | extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, | ||
823 | u8 idx, u8 myand, u8 myor); | ||
824 | extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, | ||
825 | u8 index, u8 myor); | ||
826 | extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, | ||
827 | u8 idx, u8 myand); | ||
828 | |||
829 | #endif | ||
830 | |||
diff --git a/drivers/usb/misc/sisusbvga/sisusb_struct.h b/drivers/usb/misc/sisusbvga/sisusb_struct.h new file mode 100644 index 000000000000..94edd4726c42 --- /dev/null +++ b/drivers/usb/misc/sisusbvga/sisusb_struct.h | |||
@@ -0,0 +1,169 @@ | |||
1 | /* | ||
2 | * General structure definitions for universal mode switching modules | ||
3 | * | ||
4 | * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria | ||
5 | * | ||
6 | * If distributed as part of the Linux kernel, the following license terms | ||
7 | * apply: | ||
8 | * | ||
9 | * * This program is free software; you can redistribute it and/or modify | ||
10 | * * it under the terms of the GNU General Public License as published by | ||
11 | * * the Free Software Foundation; either version 2 of the named License, | ||
12 | * * or any later version. | ||
13 | * * | ||
14 | * * This program is distributed in the hope that it will be useful, | ||
15 | * * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * * GNU General Public License for more details. | ||
18 | * * | ||
19 | * * You should have received a copy of the GNU General Public License | ||
20 | * * along with this program; if not, write to the Free Software | ||
21 | * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA | ||
22 | * | ||
23 | * Otherwise, the following license terms apply: | ||
24 | * | ||
25 | * * Redistribution and use in source and binary forms, with or without | ||
26 | * * modification, are permitted provided that the following conditions | ||
27 | * * are met: | ||
28 | * * 1) Redistributions of source code must retain the above copyright | ||
29 | * * notice, this list of conditions and the following disclaimer. | ||
30 | * * 2) Redistributions in binary form must reproduce the above copyright | ||
31 | * * notice, this list of conditions and the following disclaimer in the | ||
32 | * * documentation and/or other materials provided with the distribution. | ||
33 | * * 3) The name of the author may not be used to endorse or promote products | ||
34 | * * derived from this software without specific prior written permission. | ||
35 | * * | ||
36 | * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
37 | * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
38 | * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
39 | * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
40 | * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
41 | * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
42 | * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
43 | * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
44 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
45 | * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
46 | * | ||
47 | * Author: Thomas Winischhofer <thomas@winischhofer.net> | ||
48 | * | ||
49 | */ | ||
50 | |||
51 | #ifndef _SISUSB_STRUCT_H_ | ||
52 | #define _SISUSB_STRUCT_H_ | ||
53 | |||
54 | struct SiS_St { | ||
55 | unsigned char St_ModeID; | ||
56 | unsigned short St_ModeFlag; | ||
57 | unsigned char St_StTableIndex; | ||
58 | unsigned char St_CRT2CRTC; | ||
59 | unsigned char St_ResInfo; | ||
60 | unsigned char VB_StTVFlickerIndex; | ||
61 | unsigned char VB_StTVEdgeIndex; | ||
62 | unsigned char VB_StTVYFilterIndex; | ||
63 | unsigned char St_PDC; | ||
64 | }; | ||
65 | |||
66 | struct SiS_StandTable | ||
67 | { | ||
68 | unsigned char CRT_COLS; | ||
69 | unsigned char ROWS; | ||
70 | unsigned char CHAR_HEIGHT; | ||
71 | unsigned short CRT_LEN; | ||
72 | unsigned char SR[4]; | ||
73 | unsigned char MISC; | ||
74 | unsigned char CRTC[0x19]; | ||
75 | unsigned char ATTR[0x14]; | ||
76 | unsigned char GRC[9]; | ||
77 | }; | ||
78 | |||
79 | struct SiS_StResInfo_S { | ||
80 | unsigned short HTotal; | ||
81 | unsigned short VTotal; | ||
82 | }; | ||
83 | |||
84 | struct SiS_Ext | ||
85 | { | ||
86 | unsigned char Ext_ModeID; | ||
87 | unsigned short Ext_ModeFlag; | ||
88 | unsigned short Ext_VESAID; | ||
89 | unsigned char Ext_RESINFO; | ||
90 | unsigned char VB_ExtTVFlickerIndex; | ||
91 | unsigned char VB_ExtTVEdgeIndex; | ||
92 | unsigned char VB_ExtTVYFilterIndex; | ||
93 | unsigned char VB_ExtTVYFilterIndexROM661; | ||
94 | unsigned char REFindex; | ||
95 | char ROMMODEIDX661; | ||
96 | }; | ||
97 | |||
98 | struct SiS_Ext2 | ||
99 | { | ||
100 | unsigned short Ext_InfoFlag; | ||
101 | unsigned char Ext_CRT1CRTC; | ||
102 | unsigned char Ext_CRTVCLK; | ||
103 | unsigned char Ext_CRT2CRTC; | ||
104 | unsigned char Ext_CRT2CRTC_NS; | ||
105 | unsigned char ModeID; | ||
106 | unsigned short XRes; | ||
107 | unsigned short YRes; | ||
108 | unsigned char Ext_PDC; | ||
109 | unsigned char Ext_FakeCRT2CRTC; | ||
110 | unsigned char Ext_FakeCRT2Clk; | ||
111 | }; | ||
112 | |||
113 | struct SiS_CRT1Table | ||
114 | { | ||
115 | unsigned char CR[17]; | ||
116 | }; | ||
117 | |||
118 | struct SiS_VCLKData | ||
119 | { | ||
120 | unsigned char SR2B,SR2C; | ||
121 | unsigned short CLOCK; | ||
122 | }; | ||
123 | |||
124 | struct SiS_ModeResInfo | ||
125 | { | ||
126 | unsigned short HTotal; | ||
127 | unsigned short VTotal; | ||
128 | unsigned char XChar; | ||
129 | unsigned char YChar; | ||
130 | }; | ||
131 | |||
132 | struct SiS_Private | ||
133 | { | ||
134 | void *sisusb; | ||
135 | |||
136 | unsigned long IOAddress; | ||
137 | |||
138 | unsigned long SiS_P3c4; | ||
139 | unsigned long SiS_P3d4; | ||
140 | unsigned long SiS_P3c0; | ||
141 | unsigned long SiS_P3ce; | ||
142 | unsigned long SiS_P3c2; | ||
143 | unsigned long SiS_P3ca; | ||
144 | unsigned long SiS_P3c6; | ||
145 | unsigned long SiS_P3c7; | ||
146 | unsigned long SiS_P3c8; | ||
147 | unsigned long SiS_P3c9; | ||
148 | unsigned long SiS_P3cb; | ||
149 | unsigned long SiS_P3cc; | ||
150 | unsigned long SiS_P3cd; | ||
151 | unsigned long SiS_P3da; | ||
152 | unsigned long SiS_Part1Port; | ||
153 | |||
154 | unsigned char SiS_MyCR63; | ||
155 | unsigned short SiS_CRT1Mode; | ||
156 | unsigned short SiS_ModeType; | ||
157 | unsigned short SiS_SetFlag; | ||
158 | |||
159 | const struct SiS_StandTable *SiS_StandTable; | ||
160 | const struct SiS_St *SiS_SModeIDTable; | ||
161 | const struct SiS_Ext *SiS_EModeIDTable; | ||
162 | const struct SiS_Ext2 *SiS_RefIndex; | ||
163 | const struct SiS_CRT1Table *SiS_CRT1Table; | ||
164 | struct SiS_VCLKData *SiS_VCLKData; | ||
165 | const struct SiS_ModeResInfo *SiS_ModeResInfo; | ||
166 | }; | ||
167 | |||
168 | #endif | ||
169 | |||
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index faa74436de52..03fb70ef2eb3 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -3,8 +3,8 @@ | |||
3 | /* | 3 | /* |
4 | * uss720.c -- USS720 USB Parport Cable. | 4 | * uss720.c -- USS720 USB Parport Cable. |
5 | * | 5 | * |
6 | * Copyright (C) 1999 | 6 | * Copyright (C) 1999, 2005 |
7 | * Thomas Sailer (sailer@ife.ee.ethz.ch) | 7 | * Thomas Sailer (t.sailer@alumni.ethz.ch) |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
@@ -23,103 +23,240 @@ | |||
23 | * Based on parport_pc.c | 23 | * Based on parport_pc.c |
24 | * | 24 | * |
25 | * History: | 25 | * History: |
26 | * 0.1 04.08.99 Created | 26 | * 0.1 04.08.1999 Created |
27 | * 0.2 07.08.99 Some fixes mainly suggested by Tim Waugh | 27 | * 0.2 07.08.1999 Some fixes mainly suggested by Tim Waugh |
28 | * Interrupt handling currently disabled because | 28 | * Interrupt handling currently disabled because |
29 | * usb_request_irq crashes somewhere within ohci.c | 29 | * usb_request_irq crashes somewhere within ohci.c |
30 | * for no apparent reason (that is for me, anyway) | 30 | * for no apparent reason (that is for me, anyway) |
31 | * ECP currently untested | 31 | * ECP currently untested |
32 | * 0.3 10.08.99 fixing merge errors | 32 | * 0.3 10.08.1999 fixing merge errors |
33 | * 0.4 13.08.99 Added Vendor/Product ID of Brad Hard's cable | 33 | * 0.4 13.08.1999 Added Vendor/Product ID of Brad Hard's cable |
34 | * 0.5 20.09.99 usb_control_msg wrapper used | 34 | * 0.5 20.09.1999 usb_control_msg wrapper used |
35 | * Nov01.00 usb_device_table support by Adam J. Richter | 35 | * Nov01.2000 usb_device_table support by Adam J. Richter |
36 | * 08.04.01 Identify version on module load. gb | 36 | * 08.04.2001 Identify version on module load. gb |
37 | * 0.6 02.09.2005 Fix "scheduling in interrupt" problem by making save/restore | ||
38 | * context asynchronous | ||
37 | * | 39 | * |
38 | */ | 40 | */ |
39 | 41 | ||
40 | /*****************************************************************************/ | 42 | /*****************************************************************************/ |
41 | 43 | ||
44 | #define DEBUG | ||
45 | |||
42 | #include <linux/module.h> | 46 | #include <linux/module.h> |
43 | #include <linux/socket.h> | 47 | #include <linux/socket.h> |
44 | #include <linux/parport.h> | 48 | #include <linux/parport.h> |
45 | #include <linux/init.h> | 49 | #include <linux/init.h> |
46 | #include <linux/usb.h> | 50 | #include <linux/usb.h> |
47 | #include <linux/delay.h> | 51 | #include <linux/delay.h> |
52 | #include <linux/completion.h> | ||
53 | #include <linux/kref.h> | ||
48 | 54 | ||
49 | /* | 55 | /* |
50 | * Version Information | 56 | * Version Information |
51 | */ | 57 | */ |
52 | #define DRIVER_VERSION "v0.5" | 58 | #define DRIVER_VERSION "v0.6" |
53 | #define DRIVER_AUTHOR "Thomas M. Sailer, sailer@ife.ee.ethz.ch" | 59 | #define DRIVER_AUTHOR "Thomas M. Sailer, t.sailer@alumni.ethz.ch" |
54 | #define DRIVER_DESC "USB Parport Cable driver for Cables using the Lucent Technologies USS720 Chip" | 60 | #define DRIVER_DESC "USB Parport Cable driver for Cables using the Lucent Technologies USS720 Chip" |
55 | 61 | ||
56 | /* --------------------------------------------------------------------- */ | 62 | /* --------------------------------------------------------------------- */ |
57 | 63 | ||
58 | struct parport_uss720_private { | 64 | struct parport_uss720_private { |
59 | struct usb_device *usbdev; | 65 | struct usb_device *usbdev; |
60 | void *irqhandle; | 66 | struct parport *pp; |
61 | unsigned int irqpipe; | 67 | struct kref ref_count; |
62 | unsigned char reg[7]; /* USB registers */ | 68 | __u8 reg[7]; /* USB registers */ |
69 | struct list_head asynclist; | ||
70 | spinlock_t asynclock; | ||
71 | }; | ||
72 | |||
73 | struct uss720_async_request { | ||
74 | struct parport_uss720_private *priv; | ||
75 | struct kref ref_count; | ||
76 | struct list_head asynclist; | ||
77 | struct completion compl; | ||
78 | struct urb *urb; | ||
79 | struct usb_ctrlrequest dr; | ||
80 | __u8 reg[7]; | ||
63 | }; | 81 | }; |
64 | 82 | ||
65 | /* --------------------------------------------------------------------- */ | 83 | /* --------------------------------------------------------------------- */ |
66 | 84 | ||
67 | static int get_1284_register(struct parport *pp, unsigned char reg, unsigned char *val) | 85 | static void destroy_priv(struct kref *kref) |
68 | { | 86 | { |
69 | struct parport_uss720_private *priv = pp->private_data; | 87 | struct parport_uss720_private *priv = container_of(kref, struct parport_uss720_private, ref_count); |
70 | struct usb_device *usbdev = priv->usbdev; | ||
71 | static const unsigned char regindex[9] = { | ||
72 | 4, 0, 1, 5, 5, 0, 2, 3, 6 | ||
73 | }; | ||
74 | int ret; | ||
75 | 88 | ||
76 | if (!usbdev) | 89 | usb_put_dev(priv->usbdev); |
77 | return -1; | 90 | kfree(priv); |
78 | ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev,0), 3, 0xc0, ((unsigned int)reg) << 8, 0, priv->reg, 7, 1000); | 91 | dbg("destroying priv datastructure"); |
79 | if (ret != 7) { | 92 | } |
80 | printk(KERN_DEBUG "uss720: get_1284_register(%d) failed, status 0x%x expected 7\n", | 93 | |
81 | (unsigned int)reg, ret); | 94 | static void destroy_async(struct kref *kref) |
82 | ret = -1; | 95 | { |
83 | } else { | 96 | struct uss720_async_request *rq = container_of(kref, struct uss720_async_request, ref_count); |
97 | struct parport_uss720_private *priv = rq->priv; | ||
98 | unsigned long flags; | ||
99 | |||
100 | if (likely(rq->urb)) | ||
101 | usb_free_urb(rq->urb); | ||
102 | spin_lock_irqsave(&priv->asynclock, flags); | ||
103 | list_del_init(&rq->asynclist); | ||
104 | spin_unlock_irqrestore(&priv->asynclock, flags); | ||
105 | kfree(rq); | ||
106 | kref_put(&priv->ref_count, destroy_priv); | ||
107 | } | ||
108 | |||
109 | /* --------------------------------------------------------------------- */ | ||
110 | |||
111 | static void async_complete(struct urb *urb, struct pt_regs *ptregs) | ||
112 | { | ||
113 | struct uss720_async_request *rq; | ||
114 | struct parport *pp; | ||
115 | struct parport_uss720_private *priv; | ||
116 | |||
117 | rq = urb->context; | ||
118 | priv = rq->priv; | ||
119 | pp = priv->pp; | ||
120 | if (urb->status) { | ||
121 | err("async_complete: urb error %d", urb->status); | ||
122 | } else if (rq->dr.bRequest == 3) { | ||
123 | memcpy(priv->reg, rq->reg, sizeof(priv->reg)); | ||
84 | #if 0 | 124 | #if 0 |
85 | printk(KERN_DEBUG "uss720: get_1284_register(%d) return %02x %02x %02x %02x %02x %02x %02x\n", | 125 | dbg("async_complete regs %02x %02x %02x %02x %02x %02x %02x", |
86 | (unsigned int)reg, (unsigned int)priv->reg[0], (unsigned int)priv->reg[1], | 126 | (unsigned int)priv->reg[0], (unsigned int)priv->reg[1], (unsigned int)priv->reg[2], |
87 | (unsigned int)priv->reg[2], (unsigned int)priv->reg[3], (unsigned int)priv->reg[4], | 127 | (unsigned int)priv->reg[3], (unsigned int)priv->reg[4], (unsigned int)priv->reg[5], |
88 | (unsigned int)priv->reg[5], (unsigned int)priv->reg[6]); | 128 | (unsigned int)priv->reg[6]); |
89 | #endif | 129 | #endif |
90 | /* if nAck interrupts are enabled and we have an interrupt, call the interrupt procedure */ | 130 | /* if nAck interrupts are enabled and we have an interrupt, call the interrupt procedure */ |
91 | if (priv->reg[2] & priv->reg[1] & 0x10) | 131 | if (rq->reg[2] & rq->reg[1] & 0x10 && pp) |
92 | parport_generic_irq(0, pp, NULL); | 132 | parport_generic_irq(0, pp, NULL); |
93 | ret = 0; | ||
94 | } | 133 | } |
95 | if (val) | 134 | complete(&rq->compl); |
96 | *val = priv->reg[(reg >= 9) ? 0 : regindex[reg]]; | 135 | kref_put(&rq->ref_count, destroy_async); |
97 | return ret; | ||
98 | } | 136 | } |
99 | 137 | ||
100 | static int set_1284_register(struct parport *pp, unsigned char reg, unsigned char val) | 138 | static struct uss720_async_request *submit_async_request(struct parport_uss720_private *priv, |
139 | __u8 request, __u8 requesttype, __u16 value, __u16 index, | ||
140 | unsigned int mem_flags) | ||
101 | { | 141 | { |
102 | struct parport_uss720_private *priv = pp->private_data; | 142 | struct usb_device *usbdev; |
103 | struct usb_device *usbdev = priv->usbdev; | 143 | struct uss720_async_request *rq; |
144 | unsigned long flags; | ||
104 | int ret; | 145 | int ret; |
105 | 146 | ||
147 | if (!priv) | ||
148 | return NULL; | ||
149 | usbdev = priv->usbdev; | ||
106 | if (!usbdev) | 150 | if (!usbdev) |
107 | return -1; | 151 | return NULL; |
108 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev,0), 4, 0x40, (((unsigned int)reg) << 8) | val, 0, NULL, 0, 1000); | 152 | rq = kmalloc(sizeof(struct uss720_async_request), mem_flags); |
109 | if (ret) { | 153 | if (!rq) { |
110 | printk(KERN_DEBUG "uss720: set_1284_register(%u,0x%02x) failed, status 0x%x\n", | 154 | err("submit_async_request out of memory"); |
111 | (unsigned int)reg, (unsigned int)val, ret); | 155 | return NULL; |
112 | } else { | 156 | } |
113 | #if 0 | 157 | kref_init(&rq->ref_count); |
114 | printk(KERN_DEBUG "uss720: set_1284_register(%u,0x%02x)\n", | 158 | INIT_LIST_HEAD(&rq->asynclist); |
115 | (unsigned int)reg, (unsigned int)val); | 159 | init_completion(&rq->compl); |
116 | #endif | 160 | kref_get(&priv->ref_count); |
161 | rq->priv = priv; | ||
162 | rq->urb = usb_alloc_urb(0, mem_flags); | ||
163 | if (!rq->urb) { | ||
164 | kref_put(&rq->ref_count, destroy_async); | ||
165 | err("submit_async_request out of memory"); | ||
166 | return NULL; | ||
167 | } | ||
168 | rq->dr.bRequestType = requesttype; | ||
169 | rq->dr.bRequest = request; | ||
170 | rq->dr.wValue = cpu_to_le16(value); | ||
171 | rq->dr.wIndex = cpu_to_le16(index); | ||
172 | rq->dr.wLength = cpu_to_le16((request == 3) ? sizeof(rq->reg) : 0); | ||
173 | usb_fill_control_urb(rq->urb, usbdev, (requesttype & 0x80) ? usb_rcvctrlpipe(usbdev, 0) : usb_sndctrlpipe(usbdev, 0), | ||
174 | (unsigned char *)&rq->dr, | ||
175 | (request == 3) ? rq->reg : NULL, (request == 3) ? sizeof(rq->reg) : 0, async_complete, rq); | ||
176 | /* rq->urb->transfer_flags |= URB_ASYNC_UNLINK; */ | ||
177 | spin_lock_irqsave(&priv->asynclock, flags); | ||
178 | list_add_tail(&rq->asynclist, &priv->asynclist); | ||
179 | spin_unlock_irqrestore(&priv->asynclock, flags); | ||
180 | ret = usb_submit_urb(rq->urb, mem_flags); | ||
181 | if (!ret) { | ||
182 | kref_get(&rq->ref_count); | ||
183 | return rq; | ||
117 | } | 184 | } |
185 | kref_put(&rq->ref_count, destroy_async); | ||
186 | err("submit_async_request submit_urb failed with %d", ret); | ||
187 | return NULL; | ||
188 | } | ||
189 | |||
190 | static unsigned int kill_all_async_requests_priv(struct parport_uss720_private *priv) | ||
191 | { | ||
192 | struct uss720_async_request *rq; | ||
193 | unsigned long flags; | ||
194 | unsigned int ret = 0; | ||
195 | |||
196 | spin_lock_irqsave(&priv->asynclock, flags); | ||
197 | list_for_each_entry(rq, &priv->asynclist, asynclist) { | ||
198 | usb_unlink_urb(rq->urb); | ||
199 | ret++; | ||
200 | } | ||
201 | spin_unlock_irqrestore(&priv->asynclock, flags); | ||
118 | return ret; | 202 | return ret; |
119 | } | 203 | } |
120 | 204 | ||
121 | /* --------------------------------------------------------------------- */ | 205 | /* --------------------------------------------------------------------- */ |
122 | 206 | ||
207 | static int get_1284_register(struct parport *pp, unsigned char reg, unsigned char *val, unsigned int mem_flags) | ||
208 | { | ||
209 | struct parport_uss720_private *priv; | ||
210 | struct uss720_async_request *rq; | ||
211 | static const unsigned char regindex[9] = { | ||
212 | 4, 0, 1, 5, 5, 0, 2, 3, 6 | ||
213 | }; | ||
214 | int ret; | ||
215 | |||
216 | if (!pp) | ||
217 | return -EIO; | ||
218 | priv = pp->private_data; | ||
219 | rq = submit_async_request(priv, 3, 0xc0, ((unsigned int)reg) << 8, 0, mem_flags); | ||
220 | if (!rq) { | ||
221 | err("get_1284_register(%u) failed", (unsigned int)reg); | ||
222 | return -EIO; | ||
223 | } | ||
224 | if (!val) { | ||
225 | kref_put(&rq->ref_count, destroy_async); | ||
226 | return 0; | ||
227 | } | ||
228 | if (wait_for_completion_timeout(&rq->compl, HZ)) { | ||
229 | ret = rq->urb->status; | ||
230 | *val = priv->reg[(reg >= 9) ? 0 : regindex[reg]]; | ||
231 | if (ret) | ||
232 | warn("get_1284_register: usb error %d", ret); | ||
233 | kref_put(&rq->ref_count, destroy_async); | ||
234 | return ret; | ||
235 | } | ||
236 | warn("get_1284_register timeout"); | ||
237 | kill_all_async_requests_priv(priv); | ||
238 | return -EIO; | ||
239 | } | ||
240 | |||
241 | static int set_1284_register(struct parport *pp, unsigned char reg, unsigned char val, unsigned int mem_flags) | ||
242 | { | ||
243 | struct parport_uss720_private *priv; | ||
244 | struct uss720_async_request *rq; | ||
245 | |||
246 | if (!pp) | ||
247 | return -EIO; | ||
248 | priv = pp->private_data; | ||
249 | rq = submit_async_request(priv, 4, 0x40, (((unsigned int)reg) << 8) | val, 0, mem_flags); | ||
250 | if (!rq) { | ||
251 | err("set_1284_register(%u,%u) failed", (unsigned int)reg, (unsigned int)val); | ||
252 | return -EIO; | ||
253 | } | ||
254 | kref_put(&rq->ref_count, destroy_async); | ||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | /* --------------------------------------------------------------------- */ | ||
259 | |||
123 | /* ECR modes */ | 260 | /* ECR modes */ |
124 | #define ECR_SPP 00 | 261 | #define ECR_SPP 00 |
125 | #define ECR_PS2 01 | 262 | #define ECR_PS2 01 |
@@ -132,8 +269,9 @@ static int change_mode(struct parport *pp, int m) | |||
132 | { | 269 | { |
133 | struct parport_uss720_private *priv = pp->private_data; | 270 | struct parport_uss720_private *priv = pp->private_data; |
134 | int mode; | 271 | int mode; |
272 | __u8 reg; | ||
135 | 273 | ||
136 | if (get_1284_register(pp, 6, NULL)) | 274 | if (get_1284_register(pp, 6, ®, GFP_KERNEL)) |
137 | return -EIO; | 275 | return -EIO; |
138 | /* Bits <7:5> contain the mode. */ | 276 | /* Bits <7:5> contain the mode. */ |
139 | mode = (priv->reg[2] >> 5) & 0x7; | 277 | mode = (priv->reg[2] >> 5) & 0x7; |
@@ -153,7 +291,7 @@ static int change_mode(struct parport *pp, int m) | |||
153 | case ECR_ECP: /* ECP Parallel Port mode */ | 291 | case ECR_ECP: /* ECP Parallel Port mode */ |
154 | /* Poll slowly. */ | 292 | /* Poll slowly. */ |
155 | for (;;) { | 293 | for (;;) { |
156 | if (get_1284_register(pp, 6, NULL)) | 294 | if (get_1284_register(pp, 6, ®, GFP_KERNEL)) |
157 | return -EIO; | 295 | return -EIO; |
158 | if (priv->reg[2] & 0x01) | 296 | if (priv->reg[2] & 0x01) |
159 | break; | 297 | break; |
@@ -167,7 +305,9 @@ static int change_mode(struct parport *pp, int m) | |||
167 | } | 305 | } |
168 | } | 306 | } |
169 | /* Set the mode. */ | 307 | /* Set the mode. */ |
170 | if (set_1284_register(pp, 6, m << 5)) | 308 | if (set_1284_register(pp, 6, m << 5, GFP_KERNEL)) |
309 | return -EIO; | ||
310 | if (get_1284_register(pp, 6, ®, GFP_KERNEL)) | ||
171 | return -EIO; | 311 | return -EIO; |
172 | return 0; | 312 | return 0; |
173 | } | 313 | } |
@@ -179,7 +319,7 @@ static int clear_epp_timeout(struct parport *pp) | |||
179 | { | 319 | { |
180 | unsigned char stat; | 320 | unsigned char stat; |
181 | 321 | ||
182 | if (get_1284_register(pp, 1, &stat)) | 322 | if (get_1284_register(pp, 1, &stat, GFP_KERNEL)) |
183 | return 1; | 323 | return 1; |
184 | return stat & 1; | 324 | return stat & 1; |
185 | } | 325 | } |
@@ -205,14 +345,14 @@ static int uss720_irq(int usbstatus, void *buffer, int len, void *dev_id) | |||
205 | 345 | ||
206 | static void parport_uss720_write_data(struct parport *pp, unsigned char d) | 346 | static void parport_uss720_write_data(struct parport *pp, unsigned char d) |
207 | { | 347 | { |
208 | set_1284_register(pp, 0, d); | 348 | set_1284_register(pp, 0, d, GFP_KERNEL); |
209 | } | 349 | } |
210 | 350 | ||
211 | static unsigned char parport_uss720_read_data(struct parport *pp) | 351 | static unsigned char parport_uss720_read_data(struct parport *pp) |
212 | { | 352 | { |
213 | unsigned char ret; | 353 | unsigned char ret; |
214 | 354 | ||
215 | if (get_1284_register(pp, 0, &ret)) | 355 | if (get_1284_register(pp, 0, &ret, GFP_KERNEL)) |
216 | return 0; | 356 | return 0; |
217 | return ret; | 357 | return ret; |
218 | } | 358 | } |
@@ -222,7 +362,7 @@ static void parport_uss720_write_control(struct parport *pp, unsigned char d) | |||
222 | struct parport_uss720_private *priv = pp->private_data; | 362 | struct parport_uss720_private *priv = pp->private_data; |
223 | 363 | ||
224 | d = (d & 0xf) | (priv->reg[1] & 0xf0); | 364 | d = (d & 0xf) | (priv->reg[1] & 0xf0); |
225 | if (set_1284_register(pp, 2, d)) | 365 | if (set_1284_register(pp, 2, d, GFP_KERNEL)) |
226 | return; | 366 | return; |
227 | priv->reg[1] = d; | 367 | priv->reg[1] = d; |
228 | } | 368 | } |
@@ -241,7 +381,7 @@ static unsigned char parport_uss720_frob_control(struct parport *pp, unsigned ch | |||
241 | mask &= 0x0f; | 381 | mask &= 0x0f; |
242 | val &= 0x0f; | 382 | val &= 0x0f; |
243 | d = (priv->reg[1] & (~mask)) ^ val; | 383 | d = (priv->reg[1] & (~mask)) ^ val; |
244 | if (set_1284_register(pp, 2, d)) | 384 | if (set_1284_register(pp, 2, d, GFP_KERNEL)) |
245 | return 0; | 385 | return 0; |
246 | priv->reg[1] = d; | 386 | priv->reg[1] = d; |
247 | return d & 0xf; | 387 | return d & 0xf; |
@@ -251,7 +391,7 @@ static unsigned char parport_uss720_read_status(struct parport *pp) | |||
251 | { | 391 | { |
252 | unsigned char ret; | 392 | unsigned char ret; |
253 | 393 | ||
254 | if (get_1284_register(pp, 1, &ret)) | 394 | if (get_1284_register(pp, 1, &ret, GFP_KERNEL)) |
255 | return 0; | 395 | return 0; |
256 | return ret & 0xf8; | 396 | return ret & 0xf8; |
257 | } | 397 | } |
@@ -262,7 +402,7 @@ static void parport_uss720_disable_irq(struct parport *pp) | |||
262 | unsigned char d; | 402 | unsigned char d; |
263 | 403 | ||
264 | d = priv->reg[1] & ~0x10; | 404 | d = priv->reg[1] & ~0x10; |
265 | if (set_1284_register(pp, 2, d)) | 405 | if (set_1284_register(pp, 2, d, GFP_KERNEL)) |
266 | return; | 406 | return; |
267 | priv->reg[1] = d; | 407 | priv->reg[1] = d; |
268 | } | 408 | } |
@@ -273,7 +413,7 @@ static void parport_uss720_enable_irq(struct parport *pp) | |||
273 | unsigned char d; | 413 | unsigned char d; |
274 | 414 | ||
275 | d = priv->reg[1] | 0x10; | 415 | d = priv->reg[1] | 0x10; |
276 | if (set_1284_register(pp, 2, d)) | 416 | if (set_1284_register(pp, 2, d, GFP_KERNEL)) |
277 | return; | 417 | return; |
278 | priv->reg[1] = d; | 418 | priv->reg[1] = d; |
279 | } | 419 | } |
@@ -284,7 +424,7 @@ static void parport_uss720_data_forward (struct parport *pp) | |||
284 | unsigned char d; | 424 | unsigned char d; |
285 | 425 | ||
286 | d = priv->reg[1] & ~0x20; | 426 | d = priv->reg[1] & ~0x20; |
287 | if (set_1284_register(pp, 2, d)) | 427 | if (set_1284_register(pp, 2, d, GFP_KERNEL)) |
288 | return; | 428 | return; |
289 | priv->reg[1] = d; | 429 | priv->reg[1] = d; |
290 | } | 430 | } |
@@ -295,7 +435,7 @@ static void parport_uss720_data_reverse (struct parport *pp) | |||
295 | unsigned char d; | 435 | unsigned char d; |
296 | 436 | ||
297 | d = priv->reg[1] | 0x20; | 437 | d = priv->reg[1] | 0x20; |
298 | if (set_1284_register(pp, 2, d)) | 438 | if (set_1284_register(pp, 2, d, GFP_KERNEL)) |
299 | return; | 439 | return; |
300 | priv->reg[1] = d; | 440 | priv->reg[1] = d; |
301 | } | 441 | } |
@@ -310,17 +450,23 @@ static void parport_uss720_save_state(struct parport *pp, struct parport_state * | |||
310 | { | 450 | { |
311 | struct parport_uss720_private *priv = pp->private_data; | 451 | struct parport_uss720_private *priv = pp->private_data; |
312 | 452 | ||
313 | if (get_1284_register(pp, 2, NULL)) | 453 | #if 0 |
454 | if (get_1284_register(pp, 2, NULL, GFP_ATOMIC)) | ||
314 | return; | 455 | return; |
456 | #endif | ||
315 | s->u.pc.ctr = priv->reg[1]; | 457 | s->u.pc.ctr = priv->reg[1]; |
316 | s->u.pc.ecr = priv->reg[2]; | 458 | s->u.pc.ecr = priv->reg[2]; |
317 | } | 459 | } |
318 | 460 | ||
319 | static void parport_uss720_restore_state(struct parport *pp, struct parport_state *s) | 461 | static void parport_uss720_restore_state(struct parport *pp, struct parport_state *s) |
320 | { | 462 | { |
321 | set_1284_register(pp, 2, s->u.pc.ctr); | 463 | struct parport_uss720_private *priv = pp->private_data; |
322 | set_1284_register(pp, 6, s->u.pc.ecr); | 464 | |
323 | get_1284_register(pp, 2, NULL); | 465 | set_1284_register(pp, 2, s->u.pc.ctr, GFP_ATOMIC); |
466 | set_1284_register(pp, 6, s->u.pc.ecr, GFP_ATOMIC); | ||
467 | get_1284_register(pp, 2, NULL, GFP_ATOMIC); | ||
468 | priv->reg[1] = s->u.pc.ctr; | ||
469 | priv->reg[2] = s->u.pc.ecr; | ||
324 | } | 470 | } |
325 | 471 | ||
326 | static size_t parport_uss720_epp_read_data(struct parport *pp, void *buf, size_t length, int flags) | 472 | static size_t parport_uss720_epp_read_data(struct parport *pp, void *buf, size_t length, int flags) |
@@ -331,7 +477,7 @@ static size_t parport_uss720_epp_read_data(struct parport *pp, void *buf, size_t | |||
331 | if (change_mode(pp, ECR_EPP)) | 477 | if (change_mode(pp, ECR_EPP)) |
332 | return 0; | 478 | return 0; |
333 | for (; got < length; got++) { | 479 | for (; got < length; got++) { |
334 | if (get_1284_register(pp, 4, (char *)buf)) | 480 | if (get_1284_register(pp, 4, (char *)buf, GFP_KERNEL)) |
335 | break; | 481 | break; |
336 | buf++; | 482 | buf++; |
337 | if (priv->reg[0] & 0x01) { | 483 | if (priv->reg[0] & 0x01) { |
@@ -352,10 +498,10 @@ static size_t parport_uss720_epp_write_data(struct parport *pp, const void *buf, | |||
352 | if (change_mode(pp, ECR_EPP)) | 498 | if (change_mode(pp, ECR_EPP)) |
353 | return 0; | 499 | return 0; |
354 | for (; written < length; written++) { | 500 | for (; written < length; written++) { |
355 | if (set_1284_register(pp, 4, (char *)buf)) | 501 | if (set_1284_register(pp, 4, (char *)buf, GFP_KERNEL)) |
356 | break; | 502 | break; |
357 | ((char*)buf)++; | 503 | ((char*)buf)++; |
358 | if (get_1284_register(pp, 1, NULL)) | 504 | if (get_1284_register(pp, 1, NULL, GFP_KERNEL)) |
359 | break; | 505 | break; |
360 | if (priv->reg[0] & 0x01) { | 506 | if (priv->reg[0] & 0x01) { |
361 | clear_epp_timeout(pp); | 507 | clear_epp_timeout(pp); |
@@ -390,7 +536,7 @@ static size_t parport_uss720_epp_read_addr(struct parport *pp, void *buf, size_t | |||
390 | if (change_mode(pp, ECR_EPP)) | 536 | if (change_mode(pp, ECR_EPP)) |
391 | return 0; | 537 | return 0; |
392 | for (; got < length; got++) { | 538 | for (; got < length; got++) { |
393 | if (get_1284_register(pp, 3, (char *)buf)) | 539 | if (get_1284_register(pp, 3, (char *)buf, GFP_KERNEL)) |
394 | break; | 540 | break; |
395 | buf++; | 541 | buf++; |
396 | if (priv->reg[0] & 0x01) { | 542 | if (priv->reg[0] & 0x01) { |
@@ -410,10 +556,10 @@ static size_t parport_uss720_epp_write_addr(struct parport *pp, const void *buf, | |||
410 | if (change_mode(pp, ECR_EPP)) | 556 | if (change_mode(pp, ECR_EPP)) |
411 | return 0; | 557 | return 0; |
412 | for (; written < length; written++) { | 558 | for (; written < length; written++) { |
413 | if (set_1284_register(pp, 3, *(char *)buf)) | 559 | if (set_1284_register(pp, 3, *(char *)buf, GFP_KERNEL)) |
414 | break; | 560 | break; |
415 | buf++; | 561 | buf++; |
416 | if (get_1284_register(pp, 1, NULL)) | 562 | if (get_1284_register(pp, 1, NULL, GFP_KERNEL)) |
417 | break; | 563 | break; |
418 | if (priv->reg[0] & 0x01) { | 564 | if (priv->reg[0] & 0x01) { |
419 | clear_epp_timeout(pp); | 565 | clear_epp_timeout(pp); |
@@ -467,7 +613,7 @@ static size_t parport_uss720_ecp_write_addr(struct parport *pp, const void *buff | |||
467 | if (change_mode(pp, ECR_ECP)) | 613 | if (change_mode(pp, ECR_ECP)) |
468 | return 0; | 614 | return 0; |
469 | for (; written < len; written++) { | 615 | for (; written < len; written++) { |
470 | if (set_1284_register(pp, 5, *(char *)buffer)) | 616 | if (set_1284_register(pp, 5, *(char *)buffer, GFP_KERNEL)) |
471 | break; | 617 | break; |
472 | buffer++; | 618 | buffer++; |
473 | } | 619 | } |
@@ -536,93 +682,91 @@ static struct parport_operations parport_uss720_ops = | |||
536 | static int uss720_probe(struct usb_interface *intf, | 682 | static int uss720_probe(struct usb_interface *intf, |
537 | const struct usb_device_id *id) | 683 | const struct usb_device_id *id) |
538 | { | 684 | { |
539 | struct usb_device *usbdev = interface_to_usbdev(intf); | 685 | struct usb_device *usbdev = usb_get_dev(interface_to_usbdev(intf)); |
540 | struct usb_host_interface *interface; | 686 | struct usb_host_interface *interface; |
541 | struct usb_host_endpoint *endpoint; | 687 | struct usb_host_endpoint *endpoint; |
542 | struct parport_uss720_private *priv; | 688 | struct parport_uss720_private *priv; |
543 | struct parport *pp; | 689 | struct parport *pp; |
690 | unsigned char reg; | ||
544 | int i; | 691 | int i; |
545 | 692 | ||
546 | printk(KERN_DEBUG "uss720: probe: vendor id 0x%x, device id 0x%x\n", | 693 | dbg("probe: vendor id 0x%x, device id 0x%x\n", |
547 | le16_to_cpu(usbdev->descriptor.idVendor), | 694 | le16_to_cpu(usbdev->descriptor.idVendor), |
548 | le16_to_cpu(usbdev->descriptor.idProduct)); | 695 | le16_to_cpu(usbdev->descriptor.idProduct)); |
549 | 696 | ||
550 | /* our known interfaces have 3 alternate settings */ | 697 | /* our known interfaces have 3 alternate settings */ |
551 | if (intf->num_altsetting != 3) | 698 | if (intf->num_altsetting != 3) { |
699 | usb_put_dev(usbdev); | ||
552 | return -ENODEV; | 700 | return -ENODEV; |
553 | 701 | } | |
554 | i = usb_set_interface(usbdev, intf->altsetting->desc.bInterfaceNumber, 2); | 702 | i = usb_set_interface(usbdev, intf->altsetting->desc.bInterfaceNumber, 2); |
555 | printk(KERN_DEBUG "uss720: set inteface result %d\n", i); | 703 | dbg("set inteface result %d", i); |
556 | 704 | ||
557 | interface = intf->cur_altsetting; | 705 | interface = intf->cur_altsetting; |
558 | 706 | ||
559 | /* | 707 | /* |
560 | * Allocate parport interface | 708 | * Allocate parport interface |
561 | */ | 709 | */ |
562 | printk(KERN_INFO "uss720: (C) 1999 by Thomas Sailer, <sailer@ife.ee.ethz.ch>\n"); | 710 | if (!(priv = kcalloc(sizeof(struct parport_uss720_private), 1, GFP_KERNEL))) { |
563 | 711 | usb_put_dev(usbdev); | |
564 | if (!(priv = kmalloc(sizeof(struct parport_uss720_private), GFP_KERNEL))) | ||
565 | return -ENOMEM; | 712 | return -ENOMEM; |
713 | } | ||
714 | priv->pp = NULL; | ||
715 | priv->usbdev = usbdev; | ||
716 | kref_init(&priv->ref_count); | ||
717 | spin_lock_init(&priv->asynclock); | ||
718 | INIT_LIST_HEAD(&priv->asynclist); | ||
566 | if (!(pp = parport_register_port(0, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &parport_uss720_ops))) { | 719 | if (!(pp = parport_register_port(0, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &parport_uss720_ops))) { |
567 | printk(KERN_WARNING "usb-uss720: could not register parport\n"); | 720 | warn("could not register parport"); |
568 | goto probe_abort; | 721 | goto probe_abort; |
569 | } | 722 | } |
570 | 723 | ||
724 | priv->pp = pp; | ||
571 | pp->private_data = priv; | 725 | pp->private_data = priv; |
572 | priv->usbdev = usbdev; | ||
573 | pp->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_TRISTATE | PARPORT_MODE_EPP | PARPORT_MODE_ECP | PARPORT_MODE_COMPAT; | 726 | pp->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_TRISTATE | PARPORT_MODE_EPP | PARPORT_MODE_ECP | PARPORT_MODE_COMPAT; |
574 | 727 | ||
575 | /* set the USS720 control register to manual mode, no ECP compression, enable all ints */ | 728 | /* set the USS720 control register to manual mode, no ECP compression, enable all ints */ |
576 | set_1284_register(pp, 7, 0x00); | 729 | set_1284_register(pp, 7, 0x00, GFP_KERNEL); |
577 | set_1284_register(pp, 6, 0x30); /* PS/2 mode */ | 730 | set_1284_register(pp, 6, 0x30, GFP_KERNEL); /* PS/2 mode */ |
578 | set_1284_register(pp, 2, 0x0c); | 731 | set_1284_register(pp, 2, 0x0c, GFP_KERNEL); |
579 | /* debugging */ | 732 | /* debugging */ |
580 | get_1284_register(pp, 0, NULL); | 733 | get_1284_register(pp, 0, ®, GFP_KERNEL); |
581 | printk("uss720: reg: %02x %02x %02x %02x %02x %02x %02x\n", | 734 | dbg("reg: %02x %02x %02x %02x %02x %02x %02x", |
582 | priv->reg[0], priv->reg[1], priv->reg[2], priv->reg[3], priv->reg[4], priv->reg[5], priv->reg[6]); | 735 | priv->reg[0], priv->reg[1], priv->reg[2], priv->reg[3], priv->reg[4], priv->reg[5], priv->reg[6]); |
583 | 736 | ||
584 | endpoint = &interface->endpoint[2]; | 737 | endpoint = &interface->endpoint[2]; |
585 | printk(KERN_DEBUG "uss720: epaddr %d interval %d\n", endpoint->desc.bEndpointAddress, endpoint->desc.bInterval); | 738 | dbg("epaddr %d interval %d", endpoint->desc.bEndpointAddress, endpoint->desc.bInterval); |
586 | #if 0 | ||
587 | priv->irqpipe = usb_rcvctrlpipe(usbdev, endpoint->bEndpointAddress); | ||
588 | i = usb_request_irq(usbdev, priv->irqpipe, | ||
589 | uss720_irq, endpoint->bInterval, | ||
590 | pp, &priv->irqhandle); | ||
591 | if (i) { | ||
592 | printk (KERN_WARNING "usb-uss720: usb_request_irq failed (0x%x)\n", i); | ||
593 | goto probe_abort_port; | ||
594 | } | ||
595 | #endif | ||
596 | parport_announce_port(pp); | 739 | parport_announce_port(pp); |
597 | 740 | ||
598 | usb_set_intfdata (intf, pp); | 741 | usb_set_intfdata(intf, pp); |
599 | return 0; | 742 | return 0; |
600 | 743 | ||
601 | #if 0 | ||
602 | probe_abort_port: | ||
603 | parport_put_port(pp); | ||
604 | #endif | ||
605 | probe_abort: | 744 | probe_abort: |
606 | kfree(priv); | 745 | kill_all_async_requests_priv(priv); |
746 | kref_put(&priv->ref_count, destroy_priv); | ||
607 | return -ENODEV; | 747 | return -ENODEV; |
608 | } | 748 | } |
609 | 749 | ||
610 | static void uss720_disconnect(struct usb_interface *intf) | 750 | static void uss720_disconnect(struct usb_interface *intf) |
611 | { | 751 | { |
612 | struct parport *pp = usb_get_intfdata (intf); | 752 | struct parport *pp = usb_get_intfdata(intf); |
613 | struct parport_uss720_private *priv; | 753 | struct parport_uss720_private *priv; |
754 | struct usb_device *usbdev; | ||
614 | 755 | ||
615 | usb_set_intfdata (intf, NULL); | 756 | dbg("disconnect"); |
757 | usb_set_intfdata(intf, NULL); | ||
616 | if (pp) { | 758 | if (pp) { |
617 | priv = pp->private_data; | 759 | priv = pp->private_data; |
618 | parport_remove_port(pp); | 760 | usbdev = priv->usbdev; |
619 | #if 0 | ||
620 | usb_release_irq(usbdev, priv->irqhandle, priv->irqpipe); | ||
621 | #endif | ||
622 | priv->usbdev = NULL; | 761 | priv->usbdev = NULL; |
762 | priv->pp = NULL; | ||
763 | dbg("parport_remove_port"); | ||
764 | parport_remove_port(pp); | ||
623 | parport_put_port(pp); | 765 | parport_put_port(pp); |
624 | kfree(priv); | 766 | kill_all_async_requests_priv(priv); |
767 | kref_put(&priv->ref_count, destroy_priv); | ||
625 | } | 768 | } |
769 | dbg("disconnect done"); | ||
626 | } | 770 | } |
627 | 771 | ||
628 | /* table of cables that work through this driver */ | 772 | /* table of cables that work through this driver */ |
@@ -647,8 +791,8 @@ static struct usb_driver uss720_driver = { | |||
647 | 791 | ||
648 | /* --------------------------------------------------------------------- */ | 792 | /* --------------------------------------------------------------------- */ |
649 | 793 | ||
650 | MODULE_AUTHOR( DRIVER_AUTHOR ); | 794 | MODULE_AUTHOR(DRIVER_AUTHOR); |
651 | MODULE_DESCRIPTION( DRIVER_DESC ); | 795 | MODULE_DESCRIPTION(DRIVER_DESC); |
652 | MODULE_LICENSE("GPL"); | 796 | MODULE_LICENSE("GPL"); |
653 | 797 | ||
654 | static int __init uss720_init(void) | 798 | static int __init uss720_init(void) |
@@ -659,6 +803,9 @@ static int __init uss720_init(void) | |||
659 | goto out; | 803 | goto out; |
660 | 804 | ||
661 | info(DRIVER_VERSION ":" DRIVER_DESC); | 805 | info(DRIVER_VERSION ":" DRIVER_DESC); |
806 | info("NOTE: this is a special purpose driver to allow nonstandard"); | ||
807 | info("protocols (eg. bitbang) over USS720 usb to parallel cables"); | ||
808 | info("If you just want to connect to a printer, use usblp instead"); | ||
662 | out: | 809 | out: |
663 | return retval; | 810 | return retval; |
664 | } | 811 | } |
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index 417464dea9f6..17d0190ef64e 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -79,7 +79,7 @@ static inline char mon_text_get_setup(struct mon_event_text *ep, | |||
79 | return '-'; | 79 | return '-'; |
80 | 80 | ||
81 | if (urb->transfer_flags & URB_NO_SETUP_DMA_MAP) | 81 | if (urb->transfer_flags & URB_NO_SETUP_DMA_MAP) |
82 | return 'D'; | 82 | return mon_dmapeek(ep->setup, urb->setup_dma, SETUP_MAX); |
83 | if (urb->setup_packet == NULL) | 83 | if (urb->setup_packet == NULL) |
84 | return 'Z'; /* '0' would be not as pretty. */ | 84 | return 'Z'; /* '0' would be not as pretty. */ |
85 | 85 | ||
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index 4ace9964fc6b..97c78c21e8d1 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -32,7 +32,7 @@ | |||
32 | /* | 32 | /* |
33 | * Version Information | 33 | * Version Information |
34 | */ | 34 | */ |
35 | #define DRIVER_VERSION "v0.04" | 35 | #define DRIVER_VERSION "v0.05" |
36 | #define DRIVER_DESC "Silicon Labs CP2101/CP2102 RS232 serial adaptor driver" | 36 | #define DRIVER_DESC "Silicon Labs CP2101/CP2102 RS232 serial adaptor driver" |
37 | 37 | ||
38 | /* | 38 | /* |
@@ -54,8 +54,11 @@ static void cp2101_shutdown(struct usb_serial*); | |||
54 | static int debug; | 54 | static int debug; |
55 | 55 | ||
56 | static struct usb_device_id id_table [] = { | 56 | static struct usb_device_id id_table [] = { |
57 | { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ | ||
57 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 58 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
58 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ | 59 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ |
60 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ | ||
61 | { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ | ||
59 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ | 62 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ |
60 | { } /* Terminating Entry */ | 63 | { } /* Terminating Entry */ |
61 | }; | 64 | }; |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 05c44ae3ed32..9ee1aaff2fcd 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -610,8 +610,7 @@ static void cypress_close(struct usb_serial_port *port, struct file * filp) | |||
610 | timeout = max((HZ*2560)/bps,HZ/10); | 610 | timeout = max((HZ*2560)/bps,HZ/10); |
611 | else | 611 | else |
612 | timeout = 2*HZ; | 612 | timeout = 2*HZ; |
613 | set_current_state(TASK_INTERRUPTIBLE); | 613 | schedule_timeout_interruptible(timeout); |
614 | schedule_timeout(timeout); | ||
615 | 614 | ||
616 | dbg("%s - stopping urbs", __FUNCTION__); | 615 | dbg("%s - stopping urbs", __FUNCTION__); |
617 | usb_kill_urb (port->interrupt_in_urb); | 616 | usb_kill_urb (port->interrupt_in_urb); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 0a6e8b474b1f..4e434cb10bb1 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -914,7 +914,7 @@ static void ftdi_determine_type(struct usb_serial_port *port) | |||
914 | unsigned interfaces; | 914 | unsigned interfaces; |
915 | 915 | ||
916 | /* Assume it is not the original SIO device for now. */ | 916 | /* Assume it is not the original SIO device for now. */ |
917 | priv->baud_base = 48000000 / 16; | 917 | priv->baud_base = 48000000 / 2; |
918 | priv->write_offset = 0; | 918 | priv->write_offset = 0; |
919 | 919 | ||
920 | version = le16_to_cpu(udev->descriptor.bcdDevice); | 920 | version = le16_to_cpu(udev->descriptor.bcdDevice); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 461474176cfb..3cf245bdda54 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -95,6 +95,7 @@ static struct usb_device_id id_table [] = { | |||
95 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, | 95 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, |
96 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, | 96 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, |
97 | { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, | 97 | { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, |
98 | { USB_DEVICE( NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, | ||
98 | { } /* Terminating entry */ | 99 | { } /* Terminating entry */ |
99 | }; | 100 | }; |
100 | 101 | ||
@@ -652,8 +653,7 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp) | |||
652 | timeout = max((HZ*2560)/bps,HZ/10); | 653 | timeout = max((HZ*2560)/bps,HZ/10); |
653 | else | 654 | else |
654 | timeout = 2*HZ; | 655 | timeout = 2*HZ; |
655 | set_current_state(TASK_INTERRUPTIBLE); | 656 | schedule_timeout_interruptible(timeout); |
656 | schedule_timeout(timeout); | ||
657 | 657 | ||
658 | /* shutdown our urbs */ | 658 | /* shutdown our urbs */ |
659 | dbg("%s - shutting down urbs", __FUNCTION__); | 659 | dbg("%s - shutting down urbs", __FUNCTION__); |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index b734c4003c5a..7be9644f5a03 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -58,3 +58,7 @@ | |||
58 | 58 | ||
59 | #define SYNTECH_VENDOR_ID 0x0745 | 59 | #define SYNTECH_VENDOR_ID 0x0745 |
60 | #define SYNTECH_PRODUCT_ID 0x0001 | 60 | #define SYNTECH_PRODUCT_ID 0x0001 |
61 | |||
62 | /* Nokia CA-42 Cable */ | ||
63 | #define NOKIA_CA42_VENDOR_ID 0x078b | ||
64 | #define NOKIA_CA42_PRODUCT_ID 0x1234 | ||
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index d34dc9f417f0..4837524eada7 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -227,42 +227,42 @@ static int queuecommand(struct scsi_cmnd *srb, | |||
227 | ***********************************************************************/ | 227 | ***********************************************************************/ |
228 | 228 | ||
229 | /* Command timeout and abort */ | 229 | /* Command timeout and abort */ |
230 | /* This is always called with scsi_lock(host) held */ | ||
231 | static int command_abort(struct scsi_cmnd *srb) | 230 | static int command_abort(struct scsi_cmnd *srb) |
232 | { | 231 | { |
233 | struct us_data *us = host_to_us(srb->device->host); | 232 | struct us_data *us = host_to_us(srb->device->host); |
234 | 233 | ||
235 | US_DEBUGP("%s called\n", __FUNCTION__); | 234 | US_DEBUGP("%s called\n", __FUNCTION__); |
236 | 235 | ||
236 | /* us->srb together with the TIMED_OUT, RESETTING, and ABORTING | ||
237 | * bits are protected by the host lock. */ | ||
238 | scsi_lock(us_to_host(us)); | ||
239 | |||
237 | /* Is this command still active? */ | 240 | /* Is this command still active? */ |
238 | if (us->srb != srb) { | 241 | if (us->srb != srb) { |
242 | scsi_unlock(us_to_host(us)); | ||
239 | US_DEBUGP ("-- nothing to abort\n"); | 243 | US_DEBUGP ("-- nothing to abort\n"); |
240 | return FAILED; | 244 | return FAILED; |
241 | } | 245 | } |
242 | 246 | ||
243 | /* Set the TIMED_OUT bit. Also set the ABORTING bit, but only if | 247 | /* Set the TIMED_OUT bit. Also set the ABORTING bit, but only if |
244 | * a device reset isn't already in progress (to avoid interfering | 248 | * a device reset isn't already in progress (to avoid interfering |
245 | * with the reset). To prevent races with auto-reset, we must | 249 | * with the reset). Note that we must retain the host lock while |
246 | * stop any ongoing USB transfers while still holding the host | 250 | * calling usb_stor_stop_transport(); otherwise it might interfere |
247 | * lock. */ | 251 | * with an auto-reset that begins as soon as we release the lock. */ |
248 | set_bit(US_FLIDX_TIMED_OUT, &us->flags); | 252 | set_bit(US_FLIDX_TIMED_OUT, &us->flags); |
249 | if (!test_bit(US_FLIDX_RESETTING, &us->flags)) { | 253 | if (!test_bit(US_FLIDX_RESETTING, &us->flags)) { |
250 | set_bit(US_FLIDX_ABORTING, &us->flags); | 254 | set_bit(US_FLIDX_ABORTING, &us->flags); |
251 | usb_stor_stop_transport(us); | 255 | usb_stor_stop_transport(us); |
252 | } | 256 | } |
257 | scsi_unlock(us_to_host(us)); | ||
253 | 258 | ||
254 | /* Wait for the aborted command to finish */ | 259 | /* Wait for the aborted command to finish */ |
255 | wait_for_completion(&us->notify); | 260 | wait_for_completion(&us->notify); |
256 | |||
257 | /* Reacquire the lock and allow USB transfers to resume */ | ||
258 | clear_bit(US_FLIDX_ABORTING, &us->flags); | ||
259 | clear_bit(US_FLIDX_TIMED_OUT, &us->flags); | ||
260 | return SUCCESS; | 261 | return SUCCESS; |
261 | } | 262 | } |
262 | 263 | ||
263 | /* This invokes the transport reset mechanism to reset the state of the | 264 | /* This invokes the transport reset mechanism to reset the state of the |
264 | * device */ | 265 | * device */ |
265 | /* This is always called with scsi_lock(host) held */ | ||
266 | static int device_reset(struct scsi_cmnd *srb) | 266 | static int device_reset(struct scsi_cmnd *srb) |
267 | { | 267 | { |
268 | struct us_data *us = host_to_us(srb->device->host); | 268 | struct us_data *us = host_to_us(srb->device->host); |
@@ -279,7 +279,6 @@ static int device_reset(struct scsi_cmnd *srb) | |||
279 | } | 279 | } |
280 | 280 | ||
281 | /* Simulate a SCSI bus reset by resetting the device's USB port. */ | 281 | /* Simulate a SCSI bus reset by resetting the device's USB port. */ |
282 | /* This is always called with scsi_lock(host) held */ | ||
283 | static int bus_reset(struct scsi_cmnd *srb) | 282 | static int bus_reset(struct scsi_cmnd *srb) |
284 | { | 283 | { |
285 | struct us_data *us = host_to_us(srb->device->host); | 284 | struct us_data *us = host_to_us(srb->device->host); |
@@ -291,7 +290,6 @@ static int bus_reset(struct scsi_cmnd *srb) | |||
291 | result = usb_stor_port_reset(us); | 290 | result = usb_stor_port_reset(us); |
292 | up(&(us->dev_semaphore)); | 291 | up(&(us->dev_semaphore)); |
293 | 292 | ||
294 | /* lock the host for the return */ | ||
295 | return result < 0 ? FAILED : SUCCESS; | 293 | return result < 0 ? FAILED : SUCCESS; |
296 | } | 294 | } |
297 | 295 | ||
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index ad0cfd7a782f..b79dad1b598c 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -86,6 +86,16 @@ UNUSUAL_DEV( 0x040d, 0x6205, 0x0003, 0x0003, | |||
86 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 86 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
87 | US_FL_IGNORE_RESIDUE ), | 87 | US_FL_IGNORE_RESIDUE ), |
88 | 88 | ||
89 | /* Reported by Sebastian Kapfer <sebastian_kapfer@gmx.net> | ||
90 | * and Olaf Hering <olh@suse.de> (different bcd's, same vendor/product) | ||
91 | * for USB floppies that need the SINGLE_LUN enforcement. | ||
92 | */ | ||
93 | UNUSUAL_DEV( 0x0409, 0x0040, 0x0000, 0x9999, | ||
94 | "NEC", | ||
95 | "NEC USB UF000x", | ||
96 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
97 | US_FL_SINGLE_LUN ), | ||
98 | |||
89 | /* Deduced by Jonathan Woithe <jwoithe@physics.adelaide.edu.au> | 99 | /* Deduced by Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
90 | * Entry needed for flags: US_FL_FIX_INQUIRY because initial inquiry message | 100 | * Entry needed for flags: US_FL_FIX_INQUIRY because initial inquiry message |
91 | * always fails and confuses drive. | 101 | * always fails and confuses drive. |
@@ -96,6 +106,13 @@ UNUSUAL_DEV( 0x0411, 0x001c, 0x0113, 0x0113, | |||
96 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 106 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
97 | US_FL_FIX_INQUIRY ), | 107 | US_FL_FIX_INQUIRY ), |
98 | 108 | ||
109 | /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ | ||
110 | UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, | ||
111 | "SMSC", | ||
112 | "FDC GOLD-2.30", | ||
113 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
114 | US_FL_SINGLE_LUN ), | ||
115 | |||
99 | #ifdef CONFIG_USB_STORAGE_DPCM | 116 | #ifdef CONFIG_USB_STORAGE_DPCM |
100 | UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100, | 117 | UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100, |
101 | "Microtech", | 118 | "Microtech", |
@@ -103,6 +120,24 @@ UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100, | |||
103 | US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ), | 120 | US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ), |
104 | #endif | 121 | #endif |
105 | 122 | ||
123 | /* | ||
124 | * Pete Zaitcev <zaitcev@yahoo.com>, from Patrick C. F. Ernzer, bz#162559. | ||
125 | * The key does not actually break, but it returns zero sense which | ||
126 | * makes our SCSI stack to print confusing messages. | ||
127 | */ | ||
128 | UNUSUAL_DEV( 0x0457, 0x0150, 0x0100, 0x0100, | ||
129 | "USBest Technology", /* sold by Transcend */ | ||
130 | "USB Mass Storage Device", | ||
131 | US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), | ||
132 | |||
133 | /* Patch submitted by Daniel Drake <dsd@gentoo.org> | ||
134 | * Device reports nonsense bInterfaceProtocol 6 when connected over USB2 */ | ||
135 | UNUSUAL_DEV( 0x0451, 0x5416, 0x0100, 0x0100, | ||
136 | "Neuros Audio", | ||
137 | "USB 2.0 HD 2.5", | ||
138 | US_SC_DEVICE, US_PR_BULK, NULL, | ||
139 | US_FL_NEED_OVERRIDE ), | ||
140 | |||
106 | /* Patch submitted by Philipp Friedrich <philipp@void.at> */ | 141 | /* Patch submitted by Philipp Friedrich <philipp@void.at> */ |
107 | UNUSUAL_DEV( 0x0482, 0x0100, 0x0100, 0x0100, | 142 | UNUSUAL_DEV( 0x0482, 0x0100, 0x0100, 0x0100, |
108 | "Kyocera", | 143 | "Kyocera", |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index cb4c770baf32..f9a9bfa1aef5 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -392,11 +392,16 @@ SkipForAbort: | |||
392 | /* If an abort request was received we need to signal that | 392 | /* If an abort request was received we need to signal that |
393 | * the abort has finished. The proper test for this is | 393 | * the abort has finished. The proper test for this is |
394 | * the TIMED_OUT flag, not srb->result == DID_ABORT, because | 394 | * the TIMED_OUT flag, not srb->result == DID_ABORT, because |
395 | * a timeout/abort request might be received after all the | 395 | * the timeout might have occurred after the command had |
396 | * USB processing was complete. */ | 396 | * already completed with a different result code. */ |
397 | if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) | 397 | if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { |
398 | complete(&(us->notify)); | 398 | complete(&(us->notify)); |
399 | 399 | ||
400 | /* Allow USB transfers to resume */ | ||
401 | clear_bit(US_FLIDX_ABORTING, &us->flags); | ||
402 | clear_bit(US_FLIDX_TIMED_OUT, &us->flags); | ||
403 | } | ||
404 | |||
400 | /* finished working on this command */ | 405 | /* finished working on this command */ |
401 | us->srb = NULL; | 406 | us->srb = NULL; |
402 | scsi_unlock(host); | 407 | scsi_unlock(host); |
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 5fe182d6e4ab..eb83a7874c71 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig | |||
@@ -137,7 +137,7 @@ config FONT_8x8 | |||
137 | 137 | ||
138 | config FONT_8x16 | 138 | config FONT_8x16 |
139 | bool "VGA 8x16 font" if FONTS | 139 | bool "VGA 8x16 font" if FONTS |
140 | depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y | 140 | depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y || USB_SISUSBVGA_CON |
141 | default y if !SPARC32 && !SPARC64 && !FONTS | 141 | default y if !SPARC32 && !SPARC64 && !FONTS |
142 | help | 142 | help |
143 | This is the "high resolution" font for the VGA frame buffer (the one | 143 | This is the "high resolution" font for the VGA frame buffer (the one |
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile index b562f6bb9d31..42c7b8dcd220 100644 --- a/drivers/video/console/Makefile +++ b/drivers/video/console/Makefile | |||
@@ -33,6 +33,10 @@ endif | |||
33 | 33 | ||
34 | obj-$(CONFIG_FB_STI) += sticore.o font.o | 34 | obj-$(CONFIG_FB_STI) += sticore.o font.o |
35 | 35 | ||
36 | ifeq ($(CONFIG_USB_SISUSBVGA_CON),y) | ||
37 | obj-$(CONFIG_USB_SISUSBVGA) += font.o | ||
38 | endif | ||
39 | |||
36 | # Targets that kbuild needs to know about | 40 | # Targets that kbuild needs to know about |
37 | targets := promcon_tbl.c | 41 | targets := promcon_tbl.c |
38 | 42 | ||
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 7018ffffcbc4..0dbc9ddb6766 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -95,18 +95,18 @@ static struct pci_driver i810fb_driver = { | |||
95 | static char *mode_option __devinitdata = NULL; | 95 | static char *mode_option __devinitdata = NULL; |
96 | static int vram __devinitdata = 4; | 96 | static int vram __devinitdata = 4; |
97 | static int bpp __devinitdata = 8; | 97 | static int bpp __devinitdata = 8; |
98 | static int mtrr __devinitdata = 0; | 98 | static int mtrr __devinitdata; |
99 | static int accel __devinitdata = 0; | 99 | static int accel __devinitdata; |
100 | static int hsync1 __devinitdata = 0; | 100 | static int hsync1 __devinitdata; |
101 | static int hsync2 __devinitdata = 0; | 101 | static int hsync2 __devinitdata; |
102 | static int vsync1 __devinitdata = 0; | 102 | static int vsync1 __devinitdata; |
103 | static int vsync2 __devinitdata = 0; | 103 | static int vsync2 __devinitdata; |
104 | static int xres __devinitdata = 640; | 104 | static int xres __devinitdata; |
105 | static int yres __devinitdata = 480; | 105 | static int yres __devinitdata; |
106 | static int vyres __devinitdata = 0; | 106 | static int vyres __devinitdata; |
107 | static int sync __devinitdata = 0; | 107 | static int sync __devinitdata; |
108 | static int ext_vga __devinitdata = 0; | 108 | static int extvga __devinitdata; |
109 | static int dcolor __devinitdata = 0; | 109 | static int dcolor __devinitdata; |
110 | 110 | ||
111 | /*------------------------------------------------------------*/ | 111 | /*------------------------------------------------------------*/ |
112 | 112 | ||
@@ -950,7 +950,7 @@ static int i810_check_params(struct fb_var_screeninfo *var, | |||
950 | struct fb_info *info) | 950 | struct fb_info *info) |
951 | { | 951 | { |
952 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 952 | struct i810fb_par *par = (struct i810fb_par *) info->par; |
953 | int line_length, vidmem, mode_valid = 0; | 953 | int line_length, vidmem, mode_valid = 0, retval = 0; |
954 | u32 vyres = var->yres_virtual, vxres = var->xres_virtual; | 954 | u32 vyres = var->yres_virtual, vxres = var->xres_virtual; |
955 | /* | 955 | /* |
956 | * Memory limit | 956 | * Memory limit |
@@ -1026,10 +1026,11 @@ static int i810_check_params(struct fb_var_screeninfo *var, | |||
1026 | printk("i810fb: invalid video mode%s\n", | 1026 | printk("i810fb: invalid video mode%s\n", |
1027 | default_sync ? "" : ". Specifying " | 1027 | default_sync ? "" : ". Specifying " |
1028 | "vsyncN/hsyncN parameters may help"); | 1028 | "vsyncN/hsyncN parameters may help"); |
1029 | retval = -EINVAL; | ||
1029 | } | 1030 | } |
1030 | } | 1031 | } |
1031 | 1032 | ||
1032 | return 0; | 1033 | return retval; |
1033 | } | 1034 | } |
1034 | 1035 | ||
1035 | /** | 1036 | /** |
@@ -1724,12 +1725,21 @@ static void __devinit i810_init_defaults(struct i810fb_par *par, | |||
1724 | if (bpp < 8) | 1725 | if (bpp < 8) |
1725 | bpp = 8; | 1726 | bpp = 8; |
1726 | 1727 | ||
1728 | par->i810fb_ops = i810fb_ops; | ||
1729 | |||
1730 | if (xres) | ||
1731 | info->var.xres = xres; | ||
1732 | else | ||
1733 | info->var.xres = 640; | ||
1734 | |||
1735 | if (yres) | ||
1736 | info->var.yres = yres; | ||
1737 | else | ||
1738 | info->var.yres = 480; | ||
1739 | |||
1727 | if (!vyres) | 1740 | if (!vyres) |
1728 | vyres = (vram << 20)/(xres*bpp >> 3); | 1741 | vyres = (vram << 20)/(info->var.xres*bpp >> 3); |
1729 | 1742 | ||
1730 | par->i810fb_ops = i810fb_ops; | ||
1731 | info->var.xres = xres; | ||
1732 | info->var.yres = yres; | ||
1733 | info->var.yres_virtual = vyres; | 1743 | info->var.yres_virtual = vyres; |
1734 | info->var.bits_per_pixel = bpp; | 1744 | info->var.bits_per_pixel = bpp; |
1735 | 1745 | ||
@@ -1756,7 +1766,7 @@ static void __devinit i810_init_device(struct i810fb_par *par) | |||
1756 | i810_init_cursor(par); | 1766 | i810_init_cursor(par); |
1757 | 1767 | ||
1758 | /* mvo: enable external vga-connector (for laptops) */ | 1768 | /* mvo: enable external vga-connector (for laptops) */ |
1759 | if (ext_vga) { | 1769 | if (extvga) { |
1760 | i810_writel(HVSYNC, mmio, 0); | 1770 | i810_writel(HVSYNC, mmio, 0); |
1761 | i810_writel(PWR_CLKC, mmio, 3); | 1771 | i810_writel(PWR_CLKC, mmio, 3); |
1762 | } | 1772 | } |
@@ -1830,7 +1840,7 @@ static void __devinit i810fb_find_init_mode(struct fb_info *info) | |||
1830 | { | 1840 | { |
1831 | struct fb_videomode mode; | 1841 | struct fb_videomode mode; |
1832 | struct fb_var_screeninfo var; | 1842 | struct fb_var_screeninfo var; |
1833 | struct fb_monspecs *specs = NULL; | 1843 | struct fb_monspecs *specs = &info->monspecs; |
1834 | int found = 0; | 1844 | int found = 0; |
1835 | #ifdef CONFIG_FB_I810_I2C | 1845 | #ifdef CONFIG_FB_I810_I2C |
1836 | int i; | 1846 | int i; |
@@ -1853,16 +1863,24 @@ static void __devinit i810fb_find_init_mode(struct fb_info *info) | |||
1853 | if (!err) | 1863 | if (!err) |
1854 | printk("i810fb_init_pci: DDC probe successful\n"); | 1864 | printk("i810fb_init_pci: DDC probe successful\n"); |
1855 | 1865 | ||
1856 | fb_edid_to_monspecs(par->edid, &info->monspecs); | 1866 | fb_edid_to_monspecs(par->edid, specs); |
1857 | 1867 | ||
1858 | if (info->monspecs.modedb == NULL) | 1868 | if (specs->modedb == NULL) |
1859 | printk("i810fb_init_pci: Unable to get Mode Database\n"); | 1869 | printk("i810fb_init_pci: Unable to get Mode Database\n"); |
1860 | 1870 | ||
1861 | specs = &info->monspecs; | ||
1862 | fb_videomode_to_modelist(specs->modedb, specs->modedb_len, | 1871 | fb_videomode_to_modelist(specs->modedb, specs->modedb_len, |
1863 | &info->modelist); | 1872 | &info->modelist); |
1864 | if (specs->modedb != NULL) { | 1873 | if (specs->modedb != NULL) { |
1865 | if (specs->misc & FB_MISC_1ST_DETAIL) { | 1874 | if (xres && yres) { |
1875 | struct fb_videomode *m; | ||
1876 | |||
1877 | if ((m = fb_find_best_mode(&var, &info->modelist))) { | ||
1878 | mode = *m; | ||
1879 | found = 1; | ||
1880 | } | ||
1881 | } | ||
1882 | |||
1883 | if (!found && specs->misc & FB_MISC_1ST_DETAIL) { | ||
1866 | for (i = 0; i < specs->modedb_len; i++) { | 1884 | for (i = 0; i < specs->modedb_len; i++) { |
1867 | if (specs->modedb[i].flag & FB_MODE_IS_FIRST) { | 1885 | if (specs->modedb[i].flag & FB_MODE_IS_FIRST) { |
1868 | mode = specs->modedb[i]; | 1886 | mode = specs->modedb[i]; |
@@ -1903,8 +1921,8 @@ static int __devinit i810fb_setup(char *options) | |||
1903 | mtrr = 1; | 1921 | mtrr = 1; |
1904 | else if (!strncmp(this_opt, "accel", 5)) | 1922 | else if (!strncmp(this_opt, "accel", 5)) |
1905 | accel = 1; | 1923 | accel = 1; |
1906 | else if (!strncmp(this_opt, "ext_vga", 7)) | 1924 | else if (!strncmp(this_opt, "extvga", 6)) |
1907 | ext_vga = 1; | 1925 | extvga = 1; |
1908 | else if (!strncmp(this_opt, "sync", 4)) | 1926 | else if (!strncmp(this_opt, "sync", 4)) |
1909 | sync = 1; | 1927 | sync = 1; |
1910 | else if (!strncmp(this_opt, "vram:", 5)) | 1928 | else if (!strncmp(this_opt, "vram:", 5)) |
@@ -2133,8 +2151,8 @@ module_param(accel, bool, 0); | |||
2133 | MODULE_PARM_DESC(accel, "Use Acceleration (BLIT) engine (default = 0)"); | 2151 | MODULE_PARM_DESC(accel, "Use Acceleration (BLIT) engine (default = 0)"); |
2134 | module_param(mtrr, bool, 0); | 2152 | module_param(mtrr, bool, 0); |
2135 | MODULE_PARM_DESC(mtrr, "Use MTRR (default = 0)"); | 2153 | MODULE_PARM_DESC(mtrr, "Use MTRR (default = 0)"); |
2136 | module_param(ext_vga, bool, 0); | 2154 | module_param(extvga, bool, 0); |
2137 | MODULE_PARM_DESC(ext_vga, "Enable external VGA connector (default = 0)"); | 2155 | MODULE_PARM_DESC(extvga, "Enable external VGA connector (default = 0)"); |
2138 | module_param(sync, bool, 0); | 2156 | module_param(sync, bool, 0); |
2139 | MODULE_PARM_DESC(sync, "wait for accel engine to finish drawing" | 2157 | MODULE_PARM_DESC(sync, "wait for accel engine to finish drawing" |
2140 | " (default = 0)"); | 2158 | " (default = 0)"); |
diff --git a/drivers/w1/w1_ds2433.c b/drivers/w1/w1_ds2433.c index b7c24b34d270..279e0e0363d6 100644 --- a/drivers/w1/w1_ds2433.c +++ b/drivers/w1/w1_ds2433.c | |||
@@ -15,6 +15,10 @@ | |||
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #ifdef CONFIG_W1_F23_CRC | 16 | #ifdef CONFIG_W1_F23_CRC |
17 | #include <linux/crc16.h> | 17 | #include <linux/crc16.h> |
18 | |||
19 | #define CRC16_INIT 0 | ||
20 | #define CRC16_VALID 0xb001 | ||
21 | |||
18 | #endif | 22 | #endif |
19 | 23 | ||
20 | #include "w1.h" | 24 | #include "w1.h" |
@@ -214,7 +218,7 @@ static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, | |||
214 | #ifdef CONFIG_W1_F23_CRC | 218 | #ifdef CONFIG_W1_F23_CRC |
215 | /* can only write full blocks in cached mode */ | 219 | /* can only write full blocks in cached mode */ |
216 | if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) { | 220 | if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) { |
217 | dev_err(&sl->dev, "invalid offset/count off=%d cnt=%d\n", | 221 | dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n", |
218 | (int)off, count); | 222 | (int)off, count); |
219 | return -EINVAL; | 223 | return -EINVAL; |
220 | } | 224 | } |
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index e4fd6134244d..49eafbdb15c1 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
@@ -34,9 +34,6 @@ ToDo/Notes: | |||
34 | journals with two different restart pages. We sanity check both and | 34 | journals with two different restart pages. We sanity check both and |
35 | either use the only sane one or the more recent one of the two in the | 35 | either use the only sane one or the more recent one of the two in the |
36 | case that both are valid. | 36 | case that both are valid. |
37 | - Modify fs/ntfs/malloc.h::ntfs_malloc_nofs() to do the kmalloc() based | ||
38 | allocations with __GFP_HIGHMEM, analogous to how the vmalloc() based | ||
39 | allocations are done. | ||
40 | - Add fs/ntfs/malloc.h::ntfs_malloc_nofs_nofail() which is analogous to | 37 | - Add fs/ntfs/malloc.h::ntfs_malloc_nofs_nofail() which is analogous to |
41 | ntfs_malloc_nofs() but it performs allocations with __GFP_NOFAIL and | 38 | ntfs_malloc_nofs() but it performs allocations with __GFP_NOFAIL and |
42 | hence cannot fail. | 39 | hence cannot fail. |
@@ -90,7 +87,11 @@ ToDo/Notes: | |||
90 | in the first buffer head instead of a driver global spin lock to | 87 | in the first buffer head instead of a driver global spin lock to |
91 | improve scalability. | 88 | improve scalability. |
92 | - Minor fix to error handling and error message display in | 89 | - Minor fix to error handling and error message display in |
93 | fs/ntfs/aops.c::ntfs_prepare_nonresident_write(). | 90 | fs/ntfs/aops.c::ntfs_prepare_nonresident_write(). |
91 | - Change the mount options {u,f,d}mask to always parse the number as | ||
92 | an octal number to conform to how chmod(1) works, too. Thanks to | ||
93 | Giuseppe Bilotta and Horst von Brand for pointing out the errors of | ||
94 | my ways. | ||
94 | 95 | ||
95 | 2.1.23 - Implement extension of resident files and make writing safe as well as | 96 | 2.1.23 - Implement extension of resident files and make writing safe as well as |
96 | many bug fixes, cleanups, and enhancements... | 97 | many bug fixes, cleanups, and enhancements... |
diff --git a/fs/ntfs/malloc.h b/fs/ntfs/malloc.h index 9994e019a3cf..3288bcc2c4aa 100644 --- a/fs/ntfs/malloc.h +++ b/fs/ntfs/malloc.h | |||
@@ -45,7 +45,7 @@ static inline void *__ntfs_malloc(unsigned long size, | |||
45 | if (likely(size <= PAGE_SIZE)) { | 45 | if (likely(size <= PAGE_SIZE)) { |
46 | BUG_ON(!size); | 46 | BUG_ON(!size); |
47 | /* kmalloc() has per-CPU caches so is faster for now. */ | 47 | /* kmalloc() has per-CPU caches so is faster for now. */ |
48 | return kmalloc(PAGE_SIZE, gfp_mask); | 48 | return kmalloc(PAGE_SIZE, gfp_mask & ~__GFP_HIGHMEM); |
49 | /* return (void *)__get_free_page(gfp_mask); */ | 49 | /* return (void *)__get_free_page(gfp_mask); */ |
50 | } | 50 | } |
51 | if (likely(size >> PAGE_SHIFT < num_physpages)) | 51 | if (likely(size >> PAGE_SHIFT < num_physpages)) |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index b2b392961268..453d0d51ea4b 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -126,6 +126,14 @@ static BOOL parse_options(ntfs_volume *vol, char *opt) | |||
126 | if (*v) \ | 126 | if (*v) \ |
127 | goto needs_val; \ | 127 | goto needs_val; \ |
128 | } | 128 | } |
129 | #define NTFS_GETOPT_OCTAL(option, variable) \ | ||
130 | if (!strcmp(p, option)) { \ | ||
131 | if (!v || !*v) \ | ||
132 | goto needs_arg; \ | ||
133 | variable = simple_strtoul(ov = v, &v, 8); \ | ||
134 | if (*v) \ | ||
135 | goto needs_val; \ | ||
136 | } | ||
129 | #define NTFS_GETOPT_BOOL(option, variable) \ | 137 | #define NTFS_GETOPT_BOOL(option, variable) \ |
130 | if (!strcmp(p, option)) { \ | 138 | if (!strcmp(p, option)) { \ |
131 | BOOL val; \ | 139 | BOOL val; \ |
@@ -157,9 +165,9 @@ static BOOL parse_options(ntfs_volume *vol, char *opt) | |||
157 | *v++ = 0; | 165 | *v++ = 0; |
158 | NTFS_GETOPT("uid", uid) | 166 | NTFS_GETOPT("uid", uid) |
159 | else NTFS_GETOPT("gid", gid) | 167 | else NTFS_GETOPT("gid", gid) |
160 | else NTFS_GETOPT("umask", fmask = dmask) | 168 | else NTFS_GETOPT_OCTAL("umask", fmask = dmask) |
161 | else NTFS_GETOPT("fmask", fmask) | 169 | else NTFS_GETOPT_OCTAL("fmask", fmask) |
162 | else NTFS_GETOPT("dmask", dmask) | 170 | else NTFS_GETOPT_OCTAL("dmask", dmask) |
163 | else NTFS_GETOPT("mft_zone_multiplier", mft_zone_multiplier) | 171 | else NTFS_GETOPT("mft_zone_multiplier", mft_zone_multiplier) |
164 | else NTFS_GETOPT_WITH_DEFAULT("sloppy", sloppy, TRUE) | 172 | else NTFS_GETOPT_WITH_DEFAULT("sloppy", sloppy, TRUE) |
165 | else NTFS_GETOPT_BOOL("show_sys_files", show_sys_files) | 173 | else NTFS_GETOPT_BOOL("show_sys_files", show_sys_files) |
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index faff403e1061..7d0298347ee7 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h | |||
@@ -23,7 +23,11 @@ | |||
23 | * and page free order so much.. | 23 | * and page free order so much.. |
24 | */ | 24 | */ |
25 | #ifdef CONFIG_SMP | 25 | #ifdef CONFIG_SMP |
26 | #define FREE_PTE_NR 506 | 26 | #ifdef ARCH_FREE_PTR_NR |
27 | #define FREE_PTR_NR ARCH_FREE_PTR_NR | ||
28 | #else | ||
29 | #define FREE_PTE_NR 506 | ||
30 | #endif | ||
27 | #define tlb_fast_mode(tlb) ((tlb)->nr == ~0U) | 31 | #define tlb_fast_mode(tlb) ((tlb)->nr == ~0U) |
28 | #else | 32 | #else |
29 | #define FREE_PTE_NR 1 | 33 | #define FREE_PTE_NR 1 |
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h index 6a1b1882285c..8c454aa58ac6 100644 --- a/include/asm-i386/apic.h +++ b/include/asm-i386/apic.h | |||
@@ -130,6 +130,8 @@ extern unsigned int nmi_watchdog; | |||
130 | #define NMI_LOCAL_APIC 2 | 130 | #define NMI_LOCAL_APIC 2 |
131 | #define NMI_INVALID 3 | 131 | #define NMI_INVALID 3 |
132 | 132 | ||
133 | extern int disable_timer_pin_1; | ||
134 | |||
133 | #else /* !CONFIG_X86_LOCAL_APIC */ | 135 | #else /* !CONFIG_X86_LOCAL_APIC */ |
134 | static inline void lapic_shutdown(void) { } | 136 | static inline void lapic_shutdown(void) { } |
135 | 137 | ||
diff --git a/include/asm-i386/numa.h b/include/asm-i386/numa.h new file mode 100644 index 000000000000..96fcb157db1d --- /dev/null +++ b/include/asm-i386/numa.h | |||
@@ -0,0 +1,3 @@ | |||
1 | |||
2 | int pxm_to_nid(int pxm); | ||
3 | |||
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h index 2461b731781e..0ec27c9e8e45 100644 --- a/include/asm-i386/topology.h +++ b/include/asm-i386/topology.h | |||
@@ -60,7 +60,7 @@ static inline int node_to_first_cpu(int node) | |||
60 | return first_cpu(mask); | 60 | return first_cpu(mask); |
61 | } | 61 | } |
62 | 62 | ||
63 | #define pcibus_to_node(bus) mp_bus_id_to_node[(bus)->number] | 63 | #define pcibus_to_node(bus) ((long) (bus)->sysdata) |
64 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) | 64 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)) |
65 | 65 | ||
66 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ | 66 | /* sched_domains SD_NODE_INIT for NUMAQ machines */ |
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index a7cb377745bf..fbaf90a3968c 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h | |||
@@ -332,7 +332,7 @@ type name(type1 arg1) \ | |||
332 | long __res; \ | 332 | long __res; \ |
333 | __asm__ volatile ("int $0x80" \ | 333 | __asm__ volatile ("int $0x80" \ |
334 | : "=a" (__res) \ | 334 | : "=a" (__res) \ |
335 | : "0" (__NR_##name),"b" ((long)(arg1))); \ | 335 | : "0" (__NR_##name),"b" ((long)(arg1)) : "memory"); \ |
336 | __syscall_return(type,__res); \ | 336 | __syscall_return(type,__res); \ |
337 | } | 337 | } |
338 | 338 | ||
@@ -342,7 +342,7 @@ type name(type1 arg1,type2 arg2) \ | |||
342 | long __res; \ | 342 | long __res; \ |
343 | __asm__ volatile ("int $0x80" \ | 343 | __asm__ volatile ("int $0x80" \ |
344 | : "=a" (__res) \ | 344 | : "=a" (__res) \ |
345 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ | 345 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)) : "memory"); \ |
346 | __syscall_return(type,__res); \ | 346 | __syscall_return(type,__res); \ |
347 | } | 347 | } |
348 | 348 | ||
@@ -353,7 +353,7 @@ long __res; \ | |||
353 | __asm__ volatile ("int $0x80" \ | 353 | __asm__ volatile ("int $0x80" \ |
354 | : "=a" (__res) \ | 354 | : "=a" (__res) \ |
355 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ | 355 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ |
356 | "d" ((long)(arg3))); \ | 356 | "d" ((long)(arg3)) : "memory"); \ |
357 | __syscall_return(type,__res); \ | 357 | __syscall_return(type,__res); \ |
358 | } | 358 | } |
359 | 359 | ||
@@ -364,7 +364,7 @@ long __res; \ | |||
364 | __asm__ volatile ("int $0x80" \ | 364 | __asm__ volatile ("int $0x80" \ |
365 | : "=a" (__res) \ | 365 | : "=a" (__res) \ |
366 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ | 366 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ |
367 | "d" ((long)(arg3)),"S" ((long)(arg4))); \ | 367 | "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \ |
368 | __syscall_return(type,__res); \ | 368 | __syscall_return(type,__res); \ |
369 | } | 369 | } |
370 | 370 | ||
@@ -376,7 +376,7 @@ long __res; \ | |||
376 | __asm__ volatile ("int $0x80" \ | 376 | __asm__ volatile ("int $0x80" \ |
377 | : "=a" (__res) \ | 377 | : "=a" (__res) \ |
378 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ | 378 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ |
379 | "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ | 379 | "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) : "memory"); \ |
380 | __syscall_return(type,__res); \ | 380 | __syscall_return(type,__res); \ |
381 | } | 381 | } |
382 | 382 | ||
@@ -389,7 +389,7 @@ __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; p | |||
389 | : "=a" (__res) \ | 389 | : "=a" (__res) \ |
390 | : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ | 390 | : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ |
391 | "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ | 391 | "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ |
392 | "0" ((long)(arg6))); \ | 392 | "0" ((long)(arg6)) : "memory"); \ |
393 | __syscall_return(type,__res); \ | 393 | __syscall_return(type,__res); \ |
394 | } | 394 | } |
395 | 395 | ||
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h index f95e32b40425..c42f88a9b9f9 100644 --- a/include/asm-m68knommu/bitops.h +++ b/include/asm-m68knommu/bitops.h | |||
@@ -259,7 +259,7 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr) | |||
259 | #define find_first_bit(addr, size) \ | 259 | #define find_first_bit(addr, size) \ |
260 | find_next_bit((addr), (size), 0) | 260 | find_next_bit((addr), (size), 0) |
261 | 261 | ||
262 | static __inline__ int find_next_zero_bit (void * addr, int size, int offset) | 262 | static __inline__ int find_next_zero_bit (const void * addr, int size, int offset) |
263 | { | 263 | { |
264 | unsigned long *p = ((unsigned long *) addr) + (offset >> 5); | 264 | unsigned long *p = ((unsigned long *) addr) + (offset >> 5); |
265 | unsigned long result = offset & ~31UL; | 265 | unsigned long result = offset & ~31UL; |
diff --git a/include/asm-m68knommu/checksum.h b/include/asm-m68knommu/checksum.h index 92cf102c2534..294ec7583ac9 100644 --- a/include/asm-m68knommu/checksum.h +++ b/include/asm-m68knommu/checksum.h | |||
@@ -25,7 +25,8 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) | |||
25 | * better 64-bit) boundary | 25 | * better 64-bit) boundary |
26 | */ | 26 | */ |
27 | 27 | ||
28 | unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); | 28 | unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, |
29 | int len, int sum); | ||
29 | 30 | ||
30 | 31 | ||
31 | /* | 32 | /* |
@@ -35,8 +36,8 @@ unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); | |||
35 | * better 64-bit) boundary | 36 | * better 64-bit) boundary |
36 | */ | 37 | */ |
37 | 38 | ||
38 | extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, | 39 | extern unsigned int csum_partial_copy_from_user(const unsigned char *src, |
39 | int len, int sum, int *csum_err); | 40 | unsigned char *dst, int len, int sum, int *csum_err); |
40 | 41 | ||
41 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ | 42 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ |
42 | csum_partial_copy((src), (dst), (len), (sum)) | 43 | csum_partial_copy((src), (dst), (len), (sum)) |
diff --git a/include/asm-m68knommu/m527xsim.h b/include/asm-m68knommu/m527xsim.h index d280d013da03..e7878d0f7d7a 100644 --- a/include/asm-m68knommu/m527xsim.h +++ b/include/asm-m68knommu/m527xsim.h | |||
@@ -37,13 +37,14 @@ | |||
37 | /* | 37 | /* |
38 | * SDRAM configuration registers. | 38 | * SDRAM configuration registers. |
39 | */ | 39 | */ |
40 | #ifdef CONFIG_M5271EVB | 40 | #ifdef CONFIG_M5271 |
41 | #define MCFSIM_DCR 0x40 /* SDRAM control */ | 41 | #define MCFSIM_DCR 0x40 /* SDRAM control */ |
42 | #define MCFSIM_DACR0 0x48 /* SDRAM base address 0 */ | 42 | #define MCFSIM_DACR0 0x48 /* SDRAM base address 0 */ |
43 | #define MCFSIM_DMR0 0x4c /* SDRAM address mask 0 */ | 43 | #define MCFSIM_DMR0 0x4c /* SDRAM address mask 0 */ |
44 | #define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */ | 44 | #define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */ |
45 | #define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */ | 45 | #define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */ |
46 | #else | 46 | #endif |
47 | #ifdef CONFIG_M5275 | ||
47 | #define MCFSIM_DMR 0x40 /* SDRAM mode */ | 48 | #define MCFSIM_DMR 0x40 /* SDRAM mode */ |
48 | #define MCFSIM_DCR 0x44 /* SDRAM control */ | 49 | #define MCFSIM_DCR 0x44 /* SDRAM control */ |
49 | #define MCFSIM_DCFG1 0x48 /* SDRAM configuration 1 */ | 50 | #define MCFSIM_DCFG1 0x48 /* SDRAM configuration 1 */ |
@@ -54,5 +55,21 @@ | |||
54 | #define MCFSIM_DMR1 0x5c /* SDRAM address mask 1 */ | 55 | #define MCFSIM_DMR1 0x5c /* SDRAM address mask 1 */ |
55 | #endif | 56 | #endif |
56 | 57 | ||
58 | /* | ||
59 | * GPIO pins setups to enable the UARTs. | ||
60 | */ | ||
61 | #ifdef CONFIG_M5271 | ||
62 | #define MCF_GPIO_PAR_UART 0x100048 /* PAR UART address */ | ||
63 | #define UART0_ENABLE_MASK 0x000f | ||
64 | #define UART1_ENABLE_MASK 0x0ff0 | ||
65 | #define UART2_ENABLE_MASK 0x3000 | ||
66 | #endif | ||
67 | #ifdef CONFIG_M5275 | ||
68 | #define MCF_GPIO_PAR_UART 0x10007c /* PAR UART address */ | ||
69 | #define UART0_ENABLE_MASK 0x000f | ||
70 | #define UART1_ENABLE_MASK 0x00f0 | ||
71 | #define UART2_ENABLE_MASK 0x3f00 | ||
72 | #endif | ||
73 | |||
57 | /****************************************************************************/ | 74 | /****************************************************************************/ |
58 | #endif /* m527xsim_h */ | 75 | #endif /* m527xsim_h */ |
diff --git a/include/asm-m68knommu/m528xsim.h b/include/asm-m68knommu/m528xsim.h index 371993a206ac..610774a17f70 100644 --- a/include/asm-m68knommu/m528xsim.h +++ b/include/asm-m68knommu/m528xsim.h | |||
@@ -41,5 +41,117 @@ | |||
41 | #define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */ | 41 | #define MCFSIM_DACR1 0x50 /* SDRAM base address 1 */ |
42 | #define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */ | 42 | #define MCFSIM_DMR1 0x54 /* SDRAM address mask 1 */ |
43 | 43 | ||
44 | /* | ||
45 | * Derek Cheung - 6 Feb 2005 | ||
46 | * add I2C and QSPI register definition using Freescale's MCF5282 | ||
47 | */ | ||
48 | /* set Port AS pin for I2C or UART */ | ||
49 | #define MCF5282_GPIO_PASPAR (volatile u16 *) (MCF_IPSBAR + 0x00100056) | ||
50 | |||
51 | /* Interrupt Mask Register Register Low */ | ||
52 | #define MCF5282_INTC0_IMRL (volatile u32 *) (MCF_IPSBAR + 0x0C0C) | ||
53 | /* Interrupt Control Register 7 */ | ||
54 | #define MCF5282_INTC0_ICR17 (volatile u8 *) (MCF_IPSBAR + 0x0C51) | ||
55 | |||
56 | |||
57 | |||
58 | /********************************************************************* | ||
59 | * | ||
60 | * Inter-IC (I2C) Module | ||
61 | * | ||
62 | *********************************************************************/ | ||
63 | /* Read/Write access macros for general use */ | ||
64 | #define MCF5282_I2C_I2ADR (volatile u8 *) (MCF_IPSBAR + 0x0300) // Address | ||
65 | #define MCF5282_I2C_I2FDR (volatile u8 *) (MCF_IPSBAR + 0x0304) // Freq Divider | ||
66 | #define MCF5282_I2C_I2CR (volatile u8 *) (MCF_IPSBAR + 0x0308) // Control | ||
67 | #define MCF5282_I2C_I2SR (volatile u8 *) (MCF_IPSBAR + 0x030C) // Status | ||
68 | #define MCF5282_I2C_I2DR (volatile u8 *) (MCF_IPSBAR + 0x0310) // Data I/O | ||
69 | |||
70 | /* Bit level definitions and macros */ | ||
71 | #define MCF5282_I2C_I2ADR_ADDR(x) (((x)&0x7F)<<0x01) | ||
72 | |||
73 | #define MCF5282_I2C_I2FDR_IC(x) (((x)&0x3F)) | ||
74 | |||
75 | #define MCF5282_I2C_I2CR_IEN (0x80) // I2C enable | ||
76 | #define MCF5282_I2C_I2CR_IIEN (0x40) // interrupt enable | ||
77 | #define MCF5282_I2C_I2CR_MSTA (0x20) // master/slave mode | ||
78 | #define MCF5282_I2C_I2CR_MTX (0x10) // transmit/receive mode | ||
79 | #define MCF5282_I2C_I2CR_TXAK (0x08) // transmit acknowledge enable | ||
80 | #define MCF5282_I2C_I2CR_RSTA (0x04) // repeat start | ||
81 | |||
82 | #define MCF5282_I2C_I2SR_ICF (0x80) // data transfer bit | ||
83 | #define MCF5282_I2C_I2SR_IAAS (0x40) // I2C addressed as a slave | ||
84 | #define MCF5282_I2C_I2SR_IBB (0x20) // I2C bus busy | ||
85 | #define MCF5282_I2C_I2SR_IAL (0x10) // aribitration lost | ||
86 | #define MCF5282_I2C_I2SR_SRW (0x04) // slave read/write | ||
87 | #define MCF5282_I2C_I2SR_IIF (0x02) // I2C interrupt | ||
88 | #define MCF5282_I2C_I2SR_RXAK (0x01) // received acknowledge | ||
89 | |||
90 | |||
91 | |||
92 | /********************************************************************* | ||
93 | * | ||
94 | * Queued Serial Peripheral Interface (QSPI) Module | ||
95 | * | ||
96 | *********************************************************************/ | ||
97 | /* Derek - 21 Feb 2005 */ | ||
98 | /* change to the format used in I2C */ | ||
99 | /* Read/Write access macros for general use */ | ||
100 | #define MCF5282_QSPI_QMR MCF_IPSBAR + 0x0340 | ||
101 | #define MCF5282_QSPI_QDLYR MCF_IPSBAR + 0x0344 | ||
102 | #define MCF5282_QSPI_QWR MCF_IPSBAR + 0x0348 | ||
103 | #define MCF5282_QSPI_QIR MCF_IPSBAR + 0x034C | ||
104 | #define MCF5282_QSPI_QAR MCF_IPSBAR + 0x0350 | ||
105 | #define MCF5282_QSPI_QDR MCF_IPSBAR + 0x0354 | ||
106 | #define MCF5282_QSPI_QCR MCF_IPSBAR + 0x0354 | ||
107 | |||
108 | /* Bit level definitions and macros */ | ||
109 | #define MCF5282_QSPI_QMR_MSTR (0x8000) | ||
110 | #define MCF5282_QSPI_QMR_DOHIE (0x4000) | ||
111 | #define MCF5282_QSPI_QMR_BITS_16 (0x0000) | ||
112 | #define MCF5282_QSPI_QMR_BITS_8 (0x2000) | ||
113 | #define MCF5282_QSPI_QMR_BITS_9 (0x2400) | ||
114 | #define MCF5282_QSPI_QMR_BITS_10 (0x2800) | ||
115 | #define MCF5282_QSPI_QMR_BITS_11 (0x2C00) | ||
116 | #define MCF5282_QSPI_QMR_BITS_12 (0x3000) | ||
117 | #define MCF5282_QSPI_QMR_BITS_13 (0x3400) | ||
118 | #define MCF5282_QSPI_QMR_BITS_14 (0x3800) | ||
119 | #define MCF5282_QSPI_QMR_BITS_15 (0x3C00) | ||
120 | #define MCF5282_QSPI_QMR_CPOL (0x0200) | ||
121 | #define MCF5282_QSPI_QMR_CPHA (0x0100) | ||
122 | #define MCF5282_QSPI_QMR_BAUD(x) (((x)&0x00FF)) | ||
123 | |||
124 | #define MCF5282_QSPI_QDLYR_SPE (0x80) | ||
125 | #define MCF5282_QSPI_QDLYR_QCD(x) (((x)&0x007F)<<8) | ||
126 | #define MCF5282_QSPI_QDLYR_DTL(x) (((x)&0x00FF)) | ||
127 | |||
128 | #define MCF5282_QSPI_QWR_HALT (0x8000) | ||
129 | #define MCF5282_QSPI_QWR_WREN (0x4000) | ||
130 | #define MCF5282_QSPI_QWR_WRTO (0x2000) | ||
131 | #define MCF5282_QSPI_QWR_CSIV (0x1000) | ||
132 | #define MCF5282_QSPI_QWR_ENDQP(x) (((x)&0x000F)<<8) | ||
133 | #define MCF5282_QSPI_QWR_CPTQP(x) (((x)&0x000F)<<4) | ||
134 | #define MCF5282_QSPI_QWR_NEWQP(x) (((x)&0x000F)) | ||
135 | |||
136 | #define MCF5282_QSPI_QIR_WCEFB (0x8000) | ||
137 | #define MCF5282_QSPI_QIR_ABRTB (0x4000) | ||
138 | #define MCF5282_QSPI_QIR_ABRTL (0x1000) | ||
139 | #define MCF5282_QSPI_QIR_WCEFE (0x0800) | ||
140 | #define MCF5282_QSPI_QIR_ABRTE (0x0400) | ||
141 | #define MCF5282_QSPI_QIR_SPIFE (0x0100) | ||
142 | #define MCF5282_QSPI_QIR_WCEF (0x0008) | ||
143 | #define MCF5282_QSPI_QIR_ABRT (0x0004) | ||
144 | #define MCF5282_QSPI_QIR_SPIF (0x0001) | ||
145 | |||
146 | #define MCF5282_QSPI_QAR_ADDR(x) (((x)&0x003F)) | ||
147 | |||
148 | #define MCF5282_QSPI_QDR_COMMAND(x) (((x)&0xFF00)) | ||
149 | #define MCF5282_QSPI_QCR_DATA(x) (((x)&0x00FF)<<8) | ||
150 | #define MCF5282_QSPI_QCR_CONT (0x8000) | ||
151 | #define MCF5282_QSPI_QCR_BITSE (0x4000) | ||
152 | #define MCF5282_QSPI_QCR_DT (0x2000) | ||
153 | #define MCF5282_QSPI_QCR_DSCK (0x1000) | ||
154 | #define MCF5282_QSPI_QCR_CS (((x)&0x000F)<<8) | ||
155 | |||
44 | /****************************************************************************/ | 156 | /****************************************************************************/ |
45 | #endif /* m528xsim_h */ | 157 | #endif /* m528xsim_h */ |
diff --git a/include/asm-m68knommu/mcfcache.h b/include/asm-m68knommu/mcfcache.h index bdd8c53ef34c..b17cd920977f 100644 --- a/include/asm-m68knommu/mcfcache.h +++ b/include/asm-m68knommu/mcfcache.h | |||
@@ -33,7 +33,7 @@ | |||
33 | .endm | 33 | .endm |
34 | #endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */ | 34 | #endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */ |
35 | 35 | ||
36 | #if defined(CONFIG_M527x) | 36 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) |
37 | /* | 37 | /* |
38 | * New version 2 cores have a configurable split cache arrangement. | 38 | * New version 2 cores have a configurable split cache arrangement. |
39 | * For now I am just enabling instruction cache - but ultimately I | 39 | * For now I am just enabling instruction cache - but ultimately I |
@@ -51,23 +51,20 @@ | |||
51 | movec %d0,%CACR /* enable cache */ | 51 | movec %d0,%CACR /* enable cache */ |
52 | nop | 52 | nop |
53 | .endm | 53 | .endm |
54 | #endif /* CONFIG_M527x */ | 54 | #endif /* CONFIG_M523x || CONFIG_M527x */ |
55 | 55 | ||
56 | #if defined(CONFIG_M528x) | 56 | #if defined(CONFIG_M528x) |
57 | /* | ||
58 | * Cache is totally broken on early 5282 silicon. So far now we | ||
59 | * disable its cache all together. | ||
60 | */ | ||
61 | .macro CACHE_ENABLE | 57 | .macro CACHE_ENABLE |
62 | movel #0x01000000,%d0 | ||
63 | movec %d0,%CACR /* invalidate cache */ | ||
64 | nop | 58 | nop |
65 | movel #0x0000c000,%d0 /* set SDRAM cached only */ | 59 | movel #0x01000000, %d0 |
66 | movec %d0,%ACR0 | 60 | movec %d0, %CACR /* Invalidate cache */ |
67 | movel #0x00000000,%d0 /* no other regions cached */ | 61 | nop |
68 | movec %d0,%ACR1 | 62 | movel #0x0000c020, %d0 /* Set SDRAM cached only */ |
69 | movel #0x00000000,%d0 /* configure cache */ | 63 | movec %d0, %ACR0 |
70 | movec %d0,%CACR /* enable cache */ | 64 | movel #0xff00c000, %d0 /* Cache Flash also */ |
65 | movec %d0, %ACR1 | ||
66 | movel #0x80000200, %d0 /* Setup cache mask */ | ||
67 | movec %d0, %CACR /* Enable cache */ | ||
71 | nop | 68 | nop |
72 | .endm | 69 | .endm |
73 | #endif /* CONFIG_M528x */ | 70 | #endif /* CONFIG_M528x */ |
diff --git a/include/asm-m68knommu/mcfdma.h b/include/asm-m68knommu/mcfdma.h index 350c6090b5c1..b93f8ba8a248 100644 --- a/include/asm-m68knommu/mcfdma.h +++ b/include/asm-m68knommu/mcfdma.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #define MCFDMA_BASE1 0x240 /* Base address of DMA 1 */ | 21 | #define MCFDMA_BASE1 0x240 /* Base address of DMA 1 */ |
22 | #elif defined(CONFIG_M5272) | 22 | #elif defined(CONFIG_M5272) |
23 | #define MCFDMA_BASE0 0x0e0 /* Base address of DMA 0 */ | 23 | #define MCFDMA_BASE0 0x0e0 /* Base address of DMA 0 */ |
24 | #elif defined(CONFIG_M527x) || defined(CONFIG_M528x) | 24 | #elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) |
25 | /* These are relative to the IPSBAR, not MBAR */ | 25 | /* These are relative to the IPSBAR, not MBAR */ |
26 | #define MCFDMA_BASE0 0x100 /* Base address of DMA 0 */ | 26 | #define MCFDMA_BASE0 0x100 /* Base address of DMA 0 */ |
27 | #define MCFDMA_BASE1 0x140 /* Base address of DMA 1 */ | 27 | #define MCFDMA_BASE1 0x140 /* Base address of DMA 1 */ |
diff --git a/include/asm-powerpc/siginfo.h b/include/asm-powerpc/siginfo.h index 538ea8ef509b..12f1bce037be 100644 --- a/include/asm-powerpc/siginfo.h +++ b/include/asm-powerpc/siginfo.h | |||
@@ -15,4 +15,12 @@ | |||
15 | 15 | ||
16 | #include <asm-generic/siginfo.h> | 16 | #include <asm-generic/siginfo.h> |
17 | 17 | ||
18 | /* | ||
19 | * SIGTRAP si_codes | ||
20 | */ | ||
21 | #define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */ | ||
22 | #define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */ | ||
23 | #undef NSIGTRAP | ||
24 | #define NSIGTRAP 4 | ||
25 | |||
18 | #endif /* _ASM_POWERPC_SIGINFO_H */ | 26 | #endif /* _ASM_POWERPC_SIGINFO_H */ |
diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h index 9d4e4ea530c3..7043c164b537 100644 --- a/include/asm-ppc/ptrace.h +++ b/include/asm-ppc/ptrace.h | |||
@@ -142,4 +142,11 @@ do { \ | |||
142 | #define PTRACE_GETEVRREGS 20 | 142 | #define PTRACE_GETEVRREGS 20 |
143 | #define PTRACE_SETEVRREGS 21 | 143 | #define PTRACE_SETEVRREGS 21 |
144 | 144 | ||
145 | /* | ||
146 | * Get or set a debug register. The first 16 are DABR registers and the | ||
147 | * second 16 are IABR registers. | ||
148 | */ | ||
149 | #define PTRACE_GET_DEBUGREG 25 | ||
150 | #define PTRACE_SET_DEBUGREG 26 | ||
151 | |||
145 | #endif | 152 | #endif |
diff --git a/include/asm-ppc64/hvcall.h b/include/asm-ppc64/hvcall.h index 4f668a4baff0..ab7c3cf24888 100644 --- a/include/asm-ppc64/hvcall.h +++ b/include/asm-ppc64/hvcall.h | |||
@@ -56,6 +56,11 @@ | |||
56 | #define H_PP1 (1UL<<(63-62)) | 56 | #define H_PP1 (1UL<<(63-62)) |
57 | #define H_PP2 (1UL<<(63-63)) | 57 | #define H_PP2 (1UL<<(63-63)) |
58 | 58 | ||
59 | /* DABRX flags */ | ||
60 | #define H_DABRX_HYPERVISOR (1UL<<(63-61)) | ||
61 | #define H_DABRX_KERNEL (1UL<<(63-62)) | ||
62 | #define H_DABRX_USER (1UL<<(63-63)) | ||
63 | |||
59 | /* pSeries hypervisor opcodes */ | 64 | /* pSeries hypervisor opcodes */ |
60 | #define H_REMOVE 0x04 | 65 | #define H_REMOVE 0x04 |
61 | #define H_ENTER 0x08 | 66 | #define H_ENTER 0x08 |
@@ -101,6 +106,7 @@ | |||
101 | #define H_VIO_SIGNAL 0x104 | 106 | #define H_VIO_SIGNAL 0x104 |
102 | #define H_SEND_CRQ 0x108 | 107 | #define H_SEND_CRQ 0x108 |
103 | #define H_COPY_RDMA 0x110 | 108 | #define H_COPY_RDMA 0x110 |
109 | #define H_SET_XDABR 0x134 | ||
104 | #define H_STUFF_TCE 0x138 | 110 | #define H_STUFF_TCE 0x138 |
105 | #define H_PUT_TCE_INDIRECT 0x13C | 111 | #define H_PUT_TCE_INDIRECT 0x13C |
106 | #define H_VTERM_PARTNER_INFO 0x150 | 112 | #define H_VTERM_PARTNER_INFO 0x150 |
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index 9a1ef4427ed2..8027160ec96d 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h | |||
@@ -88,6 +88,7 @@ struct machdep_calls { | |||
88 | 88 | ||
89 | /* PCI stuff */ | 89 | /* PCI stuff */ |
90 | void (*pcibios_fixup)(void); | 90 | void (*pcibios_fixup)(void); |
91 | int (*pci_probe_mode)(struct pci_bus *); | ||
91 | 92 | ||
92 | void (*restart)(char *cmd); | 93 | void (*restart)(char *cmd); |
93 | void (*power_off)(void); | 94 | void (*power_off)(void); |
@@ -173,10 +174,6 @@ extern sys_ctrler_t sys_ctrler; | |||
173 | void ppc64_boot_msg(unsigned int src, const char *msg); | 174 | void ppc64_boot_msg(unsigned int src, const char *msg); |
174 | /* Print a termination message (print only -- does not stop the kernel) */ | 175 | /* Print a termination message (print only -- does not stop the kernel) */ |
175 | void ppc64_terminate_msg(unsigned int src, const char *msg); | 176 | void ppc64_terminate_msg(unsigned int src, const char *msg); |
176 | /* Print something that needs attention (device error, etc) */ | ||
177 | void ppc64_attention_msg(unsigned int src, const char *msg); | ||
178 | /* Print a dump progress message. */ | ||
179 | void ppc64_dump_msg(unsigned int src, const char *msg); | ||
180 | 177 | ||
181 | static inline void log_error(char *buf, unsigned int err_type, int fatal) | 178 | static inline void log_error(char *buf, unsigned int err_type, int fatal) |
182 | { | 179 | { |
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h index 6b4a5b1f695e..d8991389ab39 100644 --- a/include/asm-ppc64/pci-bridge.h +++ b/include/asm-ppc64/pci-bridge.h | |||
@@ -119,5 +119,10 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) | |||
119 | return PCI_DN(busdn)->phb; | 119 | return PCI_DN(busdn)->phb; |
120 | } | 120 | } |
121 | 121 | ||
122 | /* Return values for ppc_md.pci_probe_mode function */ | ||
123 | #define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ | ||
124 | #define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ | ||
125 | #define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ | ||
126 | |||
122 | #endif | 127 | #endif |
123 | #endif /* __KERNEL__ */ | 128 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-ppc64/plpar_wrappers.h b/include/asm-ppc64/plpar_wrappers.h index f4a5fb7d67c7..72dd2449ee76 100644 --- a/include/asm-ppc64/plpar_wrappers.h +++ b/include/asm-ppc64/plpar_wrappers.h | |||
@@ -107,5 +107,14 @@ static inline long plpar_put_term_char(unsigned long termno, | |||
107 | lbuf[1]); | 107 | lbuf[1]); |
108 | } | 108 | } |
109 | 109 | ||
110 | static inline long plpar_set_xdabr(unsigned long address, unsigned long flags) | ||
111 | { | ||
112 | return plpar_hcall_norets(H_SET_XDABR, address, flags); | ||
113 | } | ||
114 | |||
115 | static inline long plpar_set_dabr(unsigned long val) | ||
116 | { | ||
117 | return plpar_hcall_norets(H_SET_DABR, val); | ||
118 | } | ||
110 | 119 | ||
111 | #endif /* _PPC64_PLPAR_WRAPPERS_H */ | 120 | #endif /* _PPC64_PLPAR_WRAPPERS_H */ |
diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h index 8bd7aa959385..4146189006e3 100644 --- a/include/asm-ppc64/processor.h +++ b/include/asm-ppc64/processor.h | |||
@@ -433,6 +433,7 @@ struct thread_struct { | |||
433 | unsigned long start_tb; /* Start purr when proc switched in */ | 433 | unsigned long start_tb; /* Start purr when proc switched in */ |
434 | unsigned long accum_tb; /* Total accumilated purr for process */ | 434 | unsigned long accum_tb; /* Total accumilated purr for process */ |
435 | unsigned long vdso_base; /* base of the vDSO library */ | 435 | unsigned long vdso_base; /* base of the vDSO library */ |
436 | unsigned long dabr; /* Data address breakpoint register */ | ||
436 | #ifdef CONFIG_ALTIVEC | 437 | #ifdef CONFIG_ALTIVEC |
437 | /* Complete AltiVec register set */ | 438 | /* Complete AltiVec register set */ |
438 | vector128 vr[32] __attribute((aligned(16))); | 439 | vector128 vr[32] __attribute((aligned(16))); |
diff --git a/include/asm-ppc64/ptrace-common.h b/include/asm-ppc64/ptrace-common.h index af03547f9c7e..b1babb729673 100644 --- a/include/asm-ppc64/ptrace-common.h +++ b/include/asm-ppc64/ptrace-common.h | |||
@@ -11,6 +11,10 @@ | |||
11 | 11 | ||
12 | #ifndef _PPC64_PTRACE_COMMON_H | 12 | #ifndef _PPC64_PTRACE_COMMON_H |
13 | #define _PPC64_PTRACE_COMMON_H | 13 | #define _PPC64_PTRACE_COMMON_H |
14 | |||
15 | #include <linux/config.h> | ||
16 | #include <asm/system.h> | ||
17 | |||
14 | /* | 18 | /* |
15 | * Set of msr bits that gdb can change on behalf of a process. | 19 | * Set of msr bits that gdb can change on behalf of a process. |
16 | */ | 20 | */ |
@@ -69,4 +73,92 @@ static inline void clear_single_step(struct task_struct *task) | |||
69 | clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); | 73 | clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); |
70 | } | 74 | } |
71 | 75 | ||
76 | #ifdef CONFIG_ALTIVEC | ||
77 | /* | ||
78 | * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go. | ||
79 | * The transfer totals 34 quadword. Quadwords 0-31 contain the | ||
80 | * corresponding vector registers. Quadword 32 contains the vscr as the | ||
81 | * last word (offset 12) within that quadword. Quadword 33 contains the | ||
82 | * vrsave as the first word (offset 0) within the quadword. | ||
83 | * | ||
84 | * This definition of the VMX state is compatible with the current PPC32 | ||
85 | * ptrace interface. This allows signal handling and ptrace to use the | ||
86 | * same structures. This also simplifies the implementation of a bi-arch | ||
87 | * (combined (32- and 64-bit) gdb. | ||
88 | */ | ||
89 | |||
90 | /* | ||
91 | * Get contents of AltiVec register state in task TASK | ||
92 | */ | ||
93 | static inline int get_vrregs(unsigned long __user *data, | ||
94 | struct task_struct *task) | ||
95 | { | ||
96 | unsigned long regsize; | ||
97 | |||
98 | /* copy AltiVec registers VR[0] .. VR[31] */ | ||
99 | regsize = 32 * sizeof(vector128); | ||
100 | if (copy_to_user(data, task->thread.vr, regsize)) | ||
101 | return -EFAULT; | ||
102 | data += (regsize / sizeof(unsigned long)); | ||
103 | |||
104 | /* copy VSCR */ | ||
105 | regsize = 1 * sizeof(vector128); | ||
106 | if (copy_to_user(data, &task->thread.vscr, regsize)) | ||
107 | return -EFAULT; | ||
108 | data += (regsize / sizeof(unsigned long)); | ||
109 | |||
110 | /* copy VRSAVE */ | ||
111 | if (put_user(task->thread.vrsave, (u32 __user *)data)) | ||
112 | return -EFAULT; | ||
113 | |||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | /* | ||
118 | * Write contents of AltiVec register state into task TASK. | ||
119 | */ | ||
120 | static inline int set_vrregs(struct task_struct *task, | ||
121 | unsigned long __user *data) | ||
122 | { | ||
123 | unsigned long regsize; | ||
124 | |||
125 | /* copy AltiVec registers VR[0] .. VR[31] */ | ||
126 | regsize = 32 * sizeof(vector128); | ||
127 | if (copy_from_user(task->thread.vr, data, regsize)) | ||
128 | return -EFAULT; | ||
129 | data += (regsize / sizeof(unsigned long)); | ||
130 | |||
131 | /* copy VSCR */ | ||
132 | regsize = 1 * sizeof(vector128); | ||
133 | if (copy_from_user(&task->thread.vscr, data, regsize)) | ||
134 | return -EFAULT; | ||
135 | data += (regsize / sizeof(unsigned long)); | ||
136 | |||
137 | /* copy VRSAVE */ | ||
138 | if (get_user(task->thread.vrsave, (u32 __user *)data)) | ||
139 | return -EFAULT; | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | #endif | ||
144 | |||
145 | static inline int ptrace_set_debugreg(struct task_struct *task, | ||
146 | unsigned long addr, unsigned long data) | ||
147 | { | ||
148 | /* We only support one DABR and no IABRS at the moment */ | ||
149 | if (addr > 0) | ||
150 | return -EINVAL; | ||
151 | |||
152 | /* The bottom 3 bits are flags */ | ||
153 | if ((data & ~0x7UL) >= TASK_SIZE) | ||
154 | return -EIO; | ||
155 | |||
156 | /* Ensure translation is on */ | ||
157 | if (data && !(data & DABR_TRANSLATION)) | ||
158 | return -EIO; | ||
159 | |||
160 | task->thread.dabr = data; | ||
161 | return 0; | ||
162 | } | ||
163 | |||
72 | #endif /* _PPC64_PTRACE_COMMON_H */ | 164 | #endif /* _PPC64_PTRACE_COMMON_H */ |
diff --git a/include/asm-ppc64/ptrace.h b/include/asm-ppc64/ptrace.h index c96aad28fc08..3a55377f1fd3 100644 --- a/include/asm-ppc64/ptrace.h +++ b/include/asm-ppc64/ptrace.h | |||
@@ -25,56 +25,49 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef __ASSEMBLY__ | 27 | #ifndef __ASSEMBLY__ |
28 | #define PPC_REG unsigned long | 28 | |
29 | struct pt_regs { | 29 | struct pt_regs { |
30 | PPC_REG gpr[32]; | 30 | unsigned long gpr[32]; |
31 | PPC_REG nip; | 31 | unsigned long nip; |
32 | PPC_REG msr; | 32 | unsigned long msr; |
33 | PPC_REG orig_gpr3; /* Used for restarting system calls */ | 33 | unsigned long orig_gpr3; /* Used for restarting system calls */ |
34 | PPC_REG ctr; | 34 | unsigned long ctr; |
35 | PPC_REG link; | 35 | unsigned long link; |
36 | PPC_REG xer; | 36 | unsigned long xer; |
37 | PPC_REG ccr; | 37 | unsigned long ccr; |
38 | PPC_REG softe; /* Soft enabled/disabled */ | 38 | unsigned long softe; /* Soft enabled/disabled */ |
39 | PPC_REG trap; /* Reason for being here */ | 39 | unsigned long trap; /* Reason for being here */ |
40 | PPC_REG dar; /* Fault registers */ | 40 | unsigned long dar; /* Fault registers */ |
41 | PPC_REG dsisr; | 41 | unsigned long dsisr; |
42 | PPC_REG result; /* Result of a system call */ | 42 | unsigned long result; /* Result of a system call */ |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #define PPC_REG_32 unsigned int | ||
46 | struct pt_regs32 { | 45 | struct pt_regs32 { |
47 | PPC_REG_32 gpr[32]; | 46 | unsigned int gpr[32]; |
48 | PPC_REG_32 nip; | 47 | unsigned int nip; |
49 | PPC_REG_32 msr; | 48 | unsigned int msr; |
50 | PPC_REG_32 orig_gpr3; /* Used for restarting system calls */ | 49 | unsigned int orig_gpr3; /* Used for restarting system calls */ |
51 | PPC_REG_32 ctr; | 50 | unsigned int ctr; |
52 | PPC_REG_32 link; | 51 | unsigned int link; |
53 | PPC_REG_32 xer; | 52 | unsigned int xer; |
54 | PPC_REG_32 ccr; | 53 | unsigned int ccr; |
55 | PPC_REG_32 mq; /* 601 only (not used at present) */ | 54 | unsigned int mq; /* 601 only (not used at present) */ |
56 | /* Used on APUS to hold IPL value. */ | 55 | unsigned int trap; /* Reason for being here */ |
57 | PPC_REG_32 trap; /* Reason for being here */ | 56 | unsigned int dar; /* Fault registers */ |
58 | PPC_REG_32 dar; /* Fault registers */ | 57 | unsigned int dsisr; |
59 | PPC_REG_32 dsisr; | 58 | unsigned int result; /* Result of a system call */ |
60 | PPC_REG_32 result; /* Result of a system call */ | ||
61 | }; | 59 | }; |
62 | 60 | ||
61 | #ifdef __KERNEL__ | ||
62 | |||
63 | #define instruction_pointer(regs) ((regs)->nip) | 63 | #define instruction_pointer(regs) ((regs)->nip) |
64 | |||
64 | #ifdef CONFIG_SMP | 65 | #ifdef CONFIG_SMP |
65 | extern unsigned long profile_pc(struct pt_regs *regs); | 66 | extern unsigned long profile_pc(struct pt_regs *regs); |
66 | #else | 67 | #else |
67 | #define profile_pc(regs) instruction_pointer(regs) | 68 | #define profile_pc(regs) instruction_pointer(regs) |
68 | #endif | 69 | #endif |
69 | 70 | ||
70 | #endif /* __ASSEMBLY__ */ | ||
71 | |||
72 | #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ | ||
73 | |||
74 | /* Size of dummy stack frame allocated when calling signal handler. */ | ||
75 | #define __SIGNAL_FRAMESIZE 128 | ||
76 | #define __SIGNAL_FRAMESIZE32 64 | ||
77 | |||
78 | #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) | 71 | #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) |
79 | 72 | ||
80 | #define force_successful_syscall_return() \ | 73 | #define force_successful_syscall_return() \ |
@@ -89,6 +82,16 @@ extern unsigned long profile_pc(struct pt_regs *regs); | |||
89 | #define TRAP(regs) ((regs)->trap & ~0xF) | 82 | #define TRAP(regs) ((regs)->trap & ~0xF) |
90 | #define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) | 83 | #define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) |
91 | 84 | ||
85 | #endif /* __KERNEL__ */ | ||
86 | |||
87 | #endif /* __ASSEMBLY__ */ | ||
88 | |||
89 | #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ | ||
90 | |||
91 | /* Size of dummy stack frame allocated when calling signal handler. */ | ||
92 | #define __SIGNAL_FRAMESIZE 128 | ||
93 | #define __SIGNAL_FRAMESIZE32 64 | ||
94 | |||
92 | /* | 95 | /* |
93 | * Offsets used by 'ptrace' system call interface. | 96 | * Offsets used by 'ptrace' system call interface. |
94 | */ | 97 | */ |
@@ -135,17 +138,21 @@ extern unsigned long profile_pc(struct pt_regs *regs); | |||
135 | #define PT_XER 37 | 138 | #define PT_XER 37 |
136 | #define PT_CCR 38 | 139 | #define PT_CCR 38 |
137 | #define PT_SOFTE 39 | 140 | #define PT_SOFTE 39 |
141 | #define PT_TRAP 40 | ||
142 | #define PT_DAR 41 | ||
143 | #define PT_DSISR 42 | ||
138 | #define PT_RESULT 43 | 144 | #define PT_RESULT 43 |
139 | 145 | ||
140 | #define PT_FPR0 48 | 146 | #define PT_FPR0 48 |
141 | 147 | ||
142 | /* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have | 148 | /* |
143 | * visibility to the asm-ppc/ptrace.h header instead of this one. | 149 | * Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will |
150 | * have visibility to the asm-ppc/ptrace.h header instead of this one. | ||
144 | */ | 151 | */ |
145 | #define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ | 152 | #define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ |
146 | 153 | ||
147 | #ifdef __KERNEL__ | 154 | #ifdef __KERNEL__ |
148 | #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ | 155 | #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ |
149 | #endif | 156 | #endif |
150 | 157 | ||
151 | #define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ | 158 | #define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ |
@@ -173,17 +180,34 @@ extern unsigned long profile_pc(struct pt_regs *regs); | |||
173 | #define PTRACE_GETVRREGS 18 | 180 | #define PTRACE_GETVRREGS 18 |
174 | #define PTRACE_SETVRREGS 19 | 181 | #define PTRACE_SETVRREGS 19 |
175 | 182 | ||
176 | /* Additional PTRACE requests implemented on PowerPC. */ | 183 | /* |
177 | #define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ | 184 | * While we dont have 64bit book E processors, we need to reserve the |
178 | #define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ | 185 | * relevant ptrace calls for 32bit compatibility. |
179 | #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ | 186 | */ |
180 | #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ | 187 | #if 0 |
181 | #define PPC_PTRACE_PEEKTEXT_3264 0x95 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ | 188 | #define PTRACE_GETEVRREGS 20 |
182 | #define PPC_PTRACE_PEEKDATA_3264 0x94 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ | 189 | #define PTRACE_SETEVRREGS 21 |
183 | #define PPC_PTRACE_POKETEXT_3264 0x93 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ | 190 | #endif |
184 | #define PPC_PTRACE_POKEDATA_3264 0x92 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ | ||
185 | #define PPC_PTRACE_PEEKUSR_3264 0x91 /* Read a register (specified by ADDR) out of the "user area" on a 64-bit process from a 32-bit process. */ | ||
186 | #define PPC_PTRACE_POKEUSR_3264 0x90 /* Write DATA into location ADDR within the "user area" on a 64-bit process from a 32-bit process. */ | ||
187 | 191 | ||
192 | /* | ||
193 | * Get or set a debug register. The first 16 are DABR registers and the | ||
194 | * second 16 are IABR registers. | ||
195 | */ | ||
196 | #define PTRACE_GET_DEBUGREG 25 | ||
197 | #define PTRACE_SET_DEBUGREG 26 | ||
198 | |||
199 | /* Additional PTRACE requests implemented on PowerPC. */ | ||
200 | #define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ | ||
201 | #define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ | ||
202 | #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ | ||
203 | #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ | ||
204 | |||
205 | /* Calls to trace a 64bit program from a 32bit program */ | ||
206 | #define PPC_PTRACE_PEEKTEXT_3264 0x95 | ||
207 | #define PPC_PTRACE_PEEKDATA_3264 0x94 | ||
208 | #define PPC_PTRACE_POKETEXT_3264 0x93 | ||
209 | #define PPC_PTRACE_POKEDATA_3264 0x92 | ||
210 | #define PPC_PTRACE_PEEKUSR_3264 0x91 | ||
211 | #define PPC_PTRACE_POKEUSR_3264 0x90 | ||
188 | 212 | ||
189 | #endif /* _PPC64_PTRACE_H */ | 213 | #endif /* _PPC64_PTRACE_H */ |
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h index c0396428cc3c..375015c62f20 100644 --- a/include/asm-ppc64/system.h +++ b/include/asm-ppc64/system.h | |||
@@ -101,6 +101,9 @@ static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; } | |||
101 | static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } | 101 | static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } |
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | extern int set_dabr(unsigned long dabr); | ||
105 | extern void _exception(int signr, struct pt_regs *regs, int code, | ||
106 | unsigned long addr); | ||
104 | extern int fix_alignment(struct pt_regs *regs); | 107 | extern int fix_alignment(struct pt_regs *regs); |
105 | extern void bad_page_fault(struct pt_regs *regs, unsigned long address, | 108 | extern void bad_page_fault(struct pt_regs *regs, unsigned long address, |
106 | int sig); | 109 | int sig); |
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h index 16ec82e16b21..6c5d5ca8383a 100644 --- a/include/asm-x86_64/apic.h +++ b/include/asm-x86_64/apic.h | |||
@@ -109,9 +109,10 @@ extern unsigned int nmi_watchdog; | |||
109 | #define NMI_LOCAL_APIC 2 | 109 | #define NMI_LOCAL_APIC 2 |
110 | #define NMI_INVALID 3 | 110 | #define NMI_INVALID 3 |
111 | 111 | ||
112 | extern int disable_timer_pin_1; | ||
113 | |||
112 | #endif /* CONFIG_X86_LOCAL_APIC */ | 114 | #endif /* CONFIG_X86_LOCAL_APIC */ |
113 | 115 | ||
114 | #define esr_disable 0 | ||
115 | extern unsigned boot_cpu_id; | 116 | extern unsigned boot_cpu_id; |
116 | 117 | ||
117 | #endif /* __ASM_APIC_H */ | 118 | #endif /* __ASM_APIC_H */ |
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h index 9388062c4f6e..fb1c99ac669f 100644 --- a/include/asm-x86_64/apicdef.h +++ b/include/asm-x86_64/apicdef.h | |||
@@ -113,6 +113,7 @@ | |||
113 | #define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) | 113 | #define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) |
114 | 114 | ||
115 | #define MAX_IO_APICS 128 | 115 | #define MAX_IO_APICS 128 |
116 | #define MAX_LOCAL_APIC 256 | ||
116 | 117 | ||
117 | /* | 118 | /* |
118 | * All x86-64 systems are xAPIC compatible. | 119 | * All x86-64 systems are xAPIC compatible. |
diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h index eed785667289..80ac1fe966ac 100644 --- a/include/asm-x86_64/bug.h +++ b/include/asm-x86_64/bug.h | |||
@@ -9,10 +9,8 @@ | |||
9 | */ | 9 | */ |
10 | struct bug_frame { | 10 | struct bug_frame { |
11 | unsigned char ud2[2]; | 11 | unsigned char ud2[2]; |
12 | unsigned char mov; | 12 | unsigned char push; |
13 | /* should use 32bit offset instead, but the assembler doesn't | 13 | signed int filename; |
14 | like it */ | ||
15 | char *filename; | ||
16 | unsigned char ret; | 14 | unsigned char ret; |
17 | unsigned short line; | 15 | unsigned short line; |
18 | } __attribute__((packed)); | 16 | } __attribute__((packed)); |
@@ -25,8 +23,8 @@ struct bug_frame { | |||
25 | The magic numbers generate mov $64bitimm,%eax ; ret $offset. */ | 23 | The magic numbers generate mov $64bitimm,%eax ; ret $offset. */ |
26 | #define BUG() \ | 24 | #define BUG() \ |
27 | asm volatile( \ | 25 | asm volatile( \ |
28 | "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" :: \ | 26 | "ud2 ; pushq $%c1 ; ret $%c0" :: \ |
29 | "i"(__LINE__), "i" (__stringify(__FILE__))) | 27 | "i"(__LINE__), "i" (__FILE__)) |
30 | void out_of_line_bug(void); | 28 | void out_of_line_bug(void); |
31 | #else | 29 | #else |
32 | static inline void out_of_line_bug(void) { } | 30 | static inline void out_of_line_bug(void) { } |
diff --git a/include/asm-x86_64/calling.h b/include/asm-x86_64/calling.h index 0bc12655fa5b..fc2c5a6c262a 100644 --- a/include/asm-x86_64/calling.h +++ b/include/asm-x86_64/calling.h | |||
@@ -65,27 +65,36 @@ | |||
65 | .if \skipr11 | 65 | .if \skipr11 |
66 | .else | 66 | .else |
67 | movq (%rsp),%r11 | 67 | movq (%rsp),%r11 |
68 | CFI_RESTORE r11 | ||
68 | .endif | 69 | .endif |
69 | .if \skipr8910 | 70 | .if \skipr8910 |
70 | .else | 71 | .else |
71 | movq 1*8(%rsp),%r10 | 72 | movq 1*8(%rsp),%r10 |
73 | CFI_RESTORE r10 | ||
72 | movq 2*8(%rsp),%r9 | 74 | movq 2*8(%rsp),%r9 |
75 | CFI_RESTORE r9 | ||
73 | movq 3*8(%rsp),%r8 | 76 | movq 3*8(%rsp),%r8 |
77 | CFI_RESTORE r8 | ||
74 | .endif | 78 | .endif |
75 | .if \skiprax | 79 | .if \skiprax |
76 | .else | 80 | .else |
77 | movq 4*8(%rsp),%rax | 81 | movq 4*8(%rsp),%rax |
82 | CFI_RESTORE rax | ||
78 | .endif | 83 | .endif |
79 | .if \skiprcx | 84 | .if \skiprcx |
80 | .else | 85 | .else |
81 | movq 5*8(%rsp),%rcx | 86 | movq 5*8(%rsp),%rcx |
87 | CFI_RESTORE rcx | ||
82 | .endif | 88 | .endif |
83 | .if \skiprdx | 89 | .if \skiprdx |
84 | .else | 90 | .else |
85 | movq 6*8(%rsp),%rdx | 91 | movq 6*8(%rsp),%rdx |
92 | CFI_RESTORE rdx | ||
86 | .endif | 93 | .endif |
87 | movq 7*8(%rsp),%rsi | 94 | movq 7*8(%rsp),%rsi |
95 | CFI_RESTORE rsi | ||
88 | movq 8*8(%rsp),%rdi | 96 | movq 8*8(%rsp),%rdi |
97 | CFI_RESTORE rdi | ||
89 | .if ARG_SKIP+\addskip > 0 | 98 | .if ARG_SKIP+\addskip > 0 |
90 | addq $ARG_SKIP+\addskip,%rsp | 99 | addq $ARG_SKIP+\addskip,%rsp |
91 | CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip) | 100 | CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip) |
@@ -124,11 +133,17 @@ | |||
124 | 133 | ||
125 | .macro RESTORE_REST | 134 | .macro RESTORE_REST |
126 | movq (%rsp),%r15 | 135 | movq (%rsp),%r15 |
136 | CFI_RESTORE r15 | ||
127 | movq 1*8(%rsp),%r14 | 137 | movq 1*8(%rsp),%r14 |
138 | CFI_RESTORE r14 | ||
128 | movq 2*8(%rsp),%r13 | 139 | movq 2*8(%rsp),%r13 |
140 | CFI_RESTORE r13 | ||
129 | movq 3*8(%rsp),%r12 | 141 | movq 3*8(%rsp),%r12 |
142 | CFI_RESTORE r12 | ||
130 | movq 4*8(%rsp),%rbp | 143 | movq 4*8(%rsp),%rbp |
144 | CFI_RESTORE rbp | ||
131 | movq 5*8(%rsp),%rbx | 145 | movq 5*8(%rsp),%rbx |
146 | CFI_RESTORE rbx | ||
132 | addq $REST_SKIP,%rsp | 147 | addq $REST_SKIP,%rsp |
133 | CFI_ADJUST_CFA_OFFSET -(REST_SKIP) | 148 | CFI_ADJUST_CFA_OFFSET -(REST_SKIP) |
134 | .endm | 149 | .endm |
@@ -146,11 +161,3 @@ | |||
146 | .macro icebp | 161 | .macro icebp |
147 | .byte 0xf1 | 162 | .byte 0xf1 |
148 | .endm | 163 | .endm |
149 | |||
150 | #ifdef CONFIG_FRAME_POINTER | ||
151 | #define ENTER enter | ||
152 | #define LEAVE leave | ||
153 | #else | ||
154 | #define ENTER | ||
155 | #define LEAVE | ||
156 | #endif | ||
diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h index c89b58bebee2..594e610f4a1e 100644 --- a/include/asm-x86_64/desc.h +++ b/include/asm-x86_64/desc.h | |||
@@ -191,7 +191,7 @@ static inline void load_TLS(struct thread_struct *t, unsigned int cpu) | |||
191 | /* | 191 | /* |
192 | * load one particular LDT into the current CPU | 192 | * load one particular LDT into the current CPU |
193 | */ | 193 | */ |
194 | extern inline void load_LDT_nolock (mm_context_t *pc, int cpu) | 194 | static inline void load_LDT_nolock (mm_context_t *pc, int cpu) |
195 | { | 195 | { |
196 | int count = pc->size; | 196 | int count = pc->size; |
197 | 197 | ||
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h index a416dc31634a..e784fdc524f1 100644 --- a/include/asm-x86_64/dma-mapping.h +++ b/include/asm-x86_64/dma-mapping.h | |||
@@ -85,6 +85,11 @@ static inline void dma_sync_single_for_device(struct device *hwdev, | |||
85 | flush_write_buffers(); | 85 | flush_write_buffers(); |
86 | } | 86 | } |
87 | 87 | ||
88 | #define dma_sync_single_range_for_cpu(dev, dma_handle, offset, size, dir) \ | ||
89 | dma_sync_single_for_cpu(dev, dma_handle, size, dir) | ||
90 | #define dma_sync_single_range_for_device(dev, dma_handle, offset, size, dir) \ | ||
91 | dma_sync_single_for_device(dev, dma_handle, size, dir) | ||
92 | |||
88 | static inline void dma_sync_sg_for_cpu(struct device *hwdev, | 93 | static inline void dma_sync_sg_for_cpu(struct device *hwdev, |
89 | struct scatterlist *sg, | 94 | struct scatterlist *sg, |
90 | int nelems, int direction) | 95 | int nelems, int direction) |
diff --git a/include/asm-x86_64/dwarf2.h b/include/asm-x86_64/dwarf2.h index afd4212e860b..582757fc0365 100644 --- a/include/asm-x86_64/dwarf2.h +++ b/include/asm-x86_64/dwarf2.h | |||
@@ -24,6 +24,10 @@ | |||
24 | #define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset | 24 | #define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset |
25 | #define CFI_OFFSET .cfi_offset | 25 | #define CFI_OFFSET .cfi_offset |
26 | #define CFI_REL_OFFSET .cfi_rel_offset | 26 | #define CFI_REL_OFFSET .cfi_rel_offset |
27 | #define CFI_REGISTER .cfi_register | ||
28 | #define CFI_RESTORE .cfi_restore | ||
29 | #define CFI_REMEMBER_STATE .cfi_remember_state | ||
30 | #define CFI_RESTORE_STATE .cfi_restore_state | ||
27 | 31 | ||
28 | #else | 32 | #else |
29 | 33 | ||
@@ -36,6 +40,10 @@ | |||
36 | #define CFI_ADJUST_CFA_OFFSET # | 40 | #define CFI_ADJUST_CFA_OFFSET # |
37 | #define CFI_OFFSET # | 41 | #define CFI_OFFSET # |
38 | #define CFI_REL_OFFSET # | 42 | #define CFI_REL_OFFSET # |
43 | #define CFI_REGISTER # | ||
44 | #define CFI_RESTORE # | ||
45 | #define CFI_REMEMBER_STATE # | ||
46 | #define CFI_RESTORE_STATE # | ||
39 | 47 | ||
40 | #endif | 48 | #endif |
41 | 49 | ||
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h index cf8b16cbe8db..a582cfcf2231 100644 --- a/include/asm-x86_64/fixmap.h +++ b/include/asm-x86_64/fixmap.h | |||
@@ -76,7 +76,7 @@ extern void __this_fixmap_does_not_exist(void); | |||
76 | * directly without translation, we catch the bug with a NULL-deference | 76 | * directly without translation, we catch the bug with a NULL-deference |
77 | * kernel oops. Illegal ranges of incoming indices are caught too. | 77 | * kernel oops. Illegal ranges of incoming indices are caught too. |
78 | */ | 78 | */ |
79 | extern inline unsigned long fix_to_virt(const unsigned int idx) | 79 | static inline unsigned long fix_to_virt(const unsigned int idx) |
80 | { | 80 | { |
81 | /* | 81 | /* |
82 | * this branch gets completely eliminated after inlining, | 82 | * this branch gets completely eliminated after inlining, |
diff --git a/include/asm-x86_64/hardirq.h b/include/asm-x86_64/hardirq.h index 27c381fa1c9d..8661b476fb40 100644 --- a/include/asm-x86_64/hardirq.h +++ b/include/asm-x86_64/hardirq.h | |||
@@ -9,11 +9,12 @@ | |||
9 | 9 | ||
10 | #define __ARCH_IRQ_STAT 1 | 10 | #define __ARCH_IRQ_STAT 1 |
11 | 11 | ||
12 | /* Generate a lvalue for a pda member. Should fix softirq.c instead to use | 12 | #define local_softirq_pending() read_pda(__softirq_pending) |
13 | special access macros. This would generate better code. */ | ||
14 | #define __IRQ_STAT(cpu,member) (read_pda(me)->member) | ||
15 | 13 | ||
16 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | 14 | #define __ARCH_SET_SOFTIRQ_PENDING 1 |
15 | |||
16 | #define set_softirq_pending(x) write_pda(__softirq_pending, (x)) | ||
17 | #define or_softirq_pending(x) or_pda(__softirq_pending, (x)) | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * 'what should we do if we get a hw irq event on an illegal vector'. | 20 | * 'what should we do if we get a hw irq event on an illegal vector'. |
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h index 2b5cb2865d21..dc97668ea0f9 100644 --- a/include/asm-x86_64/hw_irq.h +++ b/include/asm-x86_64/hw_irq.h | |||
@@ -26,6 +26,7 @@ | |||
26 | struct hw_interrupt_type; | 26 | struct hw_interrupt_type; |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #define NMI_VECTOR 0x02 | ||
29 | /* | 30 | /* |
30 | * IDT vectors usable for external interrupt sources start | 31 | * IDT vectors usable for external interrupt sources start |
31 | * at 0x20: | 32 | * at 0x20: |
@@ -50,14 +51,15 @@ struct hw_interrupt_type; | |||
50 | */ | 51 | */ |
51 | #define SPURIOUS_APIC_VECTOR 0xff | 52 | #define SPURIOUS_APIC_VECTOR 0xff |
52 | #define ERROR_APIC_VECTOR 0xfe | 53 | #define ERROR_APIC_VECTOR 0xfe |
53 | #define INVALIDATE_TLB_VECTOR 0xfd | 54 | #define RESCHEDULE_VECTOR 0xfd |
54 | #define RESCHEDULE_VECTOR 0xfc | 55 | #define CALL_FUNCTION_VECTOR 0xfc |
55 | #define TASK_MIGRATION_VECTOR 0xfb | 56 | #define KDB_VECTOR 0xfb /* reserved for KDB */ |
56 | #define CALL_FUNCTION_VECTOR 0xfa | 57 | #define THERMAL_APIC_VECTOR 0xfa |
57 | #define KDB_VECTOR 0xf9 | 58 | /* 0xf9 free */ |
58 | 59 | #define INVALIDATE_TLB_VECTOR_END 0xf8 | |
59 | #define THERMAL_APIC_VECTOR 0xf0 | 60 | #define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f8 used for TLB flush */ |
60 | 61 | ||
62 | #define NUM_INVALIDATE_TLB_VECTORS 8 | ||
61 | 63 | ||
62 | /* | 64 | /* |
63 | * Local APIC timer IRQ vector is on a different priority level, | 65 | * Local APIC timer IRQ vector is on a different priority level, |
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h index 37fc3f149a5a..52ff269fe054 100644 --- a/include/asm-x86_64/io.h +++ b/include/asm-x86_64/io.h | |||
@@ -48,7 +48,7 @@ | |||
48 | * Talk about misusing macros.. | 48 | * Talk about misusing macros.. |
49 | */ | 49 | */ |
50 | #define __OUT1(s,x) \ | 50 | #define __OUT1(s,x) \ |
51 | extern inline void out##s(unsigned x value, unsigned short port) { | 51 | static inline void out##s(unsigned x value, unsigned short port) { |
52 | 52 | ||
53 | #define __OUT2(s,s1,s2) \ | 53 | #define __OUT2(s,s1,s2) \ |
54 | __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" | 54 | __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" |
@@ -58,7 +58,7 @@ __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \ | |||
58 | __OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ | 58 | __OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ |
59 | 59 | ||
60 | #define __IN1(s) \ | 60 | #define __IN1(s) \ |
61 | extern inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; | 61 | static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; |
62 | 62 | ||
63 | #define __IN2(s,s1,s2) \ | 63 | #define __IN2(s,s1,s2) \ |
64 | __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" | 64 | __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" |
@@ -68,12 +68,12 @@ __IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ | |||
68 | __IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ | 68 | __IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ |
69 | 69 | ||
70 | #define __INS(s) \ | 70 | #define __INS(s) \ |
71 | extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ | 71 | static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ |
72 | { __asm__ __volatile__ ("rep ; ins" #s \ | 72 | { __asm__ __volatile__ ("rep ; ins" #s \ |
73 | : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } | 73 | : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } |
74 | 74 | ||
75 | #define __OUTS(s) \ | 75 | #define __OUTS(s) \ |
76 | extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ | 76 | static inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ |
77 | { __asm__ __volatile__ ("rep ; outs" #s \ | 77 | { __asm__ __volatile__ ("rep ; outs" #s \ |
78 | : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } | 78 | : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } |
79 | 79 | ||
@@ -110,12 +110,12 @@ __OUTS(l) | |||
110 | * Change virtual addresses to physical addresses and vv. | 110 | * Change virtual addresses to physical addresses and vv. |
111 | * These are pretty trivial | 111 | * These are pretty trivial |
112 | */ | 112 | */ |
113 | extern inline unsigned long virt_to_phys(volatile void * address) | 113 | static inline unsigned long virt_to_phys(volatile void * address) |
114 | { | 114 | { |
115 | return __pa(address); | 115 | return __pa(address); |
116 | } | 116 | } |
117 | 117 | ||
118 | extern inline void * phys_to_virt(unsigned long address) | 118 | static inline void * phys_to_virt(unsigned long address) |
119 | { | 119 | { |
120 | return __va(address); | 120 | return __va(address); |
121 | } | 121 | } |
@@ -130,7 +130,7 @@ extern inline void * phys_to_virt(unsigned long address) | |||
130 | 130 | ||
131 | extern void __iomem *__ioremap(unsigned long offset, unsigned long size, unsigned long flags); | 131 | extern void __iomem *__ioremap(unsigned long offset, unsigned long size, unsigned long flags); |
132 | 132 | ||
133 | extern inline void __iomem * ioremap (unsigned long offset, unsigned long size) | 133 | static inline void __iomem * ioremap (unsigned long offset, unsigned long size) |
134 | { | 134 | { |
135 | return __ioremap(offset, size, 0); | 135 | return __ioremap(offset, size, 0); |
136 | } | 136 | } |
diff --git a/include/asm-x86_64/ipi.h b/include/asm-x86_64/ipi.h index 5e166b9d3bde..022e9d340ad7 100644 --- a/include/asm-x86_64/ipi.h +++ b/include/asm-x86_64/ipi.h | |||
@@ -31,9 +31,20 @@ | |||
31 | 31 | ||
32 | static inline unsigned int __prepare_ICR (unsigned int shortcut, int vector, unsigned int dest) | 32 | static inline unsigned int __prepare_ICR (unsigned int shortcut, int vector, unsigned int dest) |
33 | { | 33 | { |
34 | unsigned int icr = APIC_DM_FIXED | shortcut | vector | dest; | 34 | unsigned int icr = shortcut | dest; |
35 | if (vector == KDB_VECTOR) | 35 | |
36 | icr = (icr & (~APIC_VECTOR_MASK)) | APIC_DM_NMI; | 36 | switch (vector) { |
37 | default: | ||
38 | icr |= APIC_DM_FIXED | vector; | ||
39 | break; | ||
40 | case NMI_VECTOR: | ||
41 | /* | ||
42 | * Setup KDB IPI to be delivered as an NMI | ||
43 | */ | ||
44 | case KDB_VECTOR: | ||
45 | icr |= APIC_DM_NMI; | ||
46 | break; | ||
47 | } | ||
37 | return icr; | 48 | return icr; |
38 | } | 49 | } |
39 | 50 | ||
@@ -66,7 +77,7 @@ static inline void __send_IPI_shortcut(unsigned int shortcut, int vector, unsign | |||
66 | /* | 77 | /* |
67 | * Send the IPI. The write to APIC_ICR fires this off. | 78 | * Send the IPI. The write to APIC_ICR fires this off. |
68 | */ | 79 | */ |
69 | apic_write_around(APIC_ICR, cfg); | 80 | apic_write(APIC_ICR, cfg); |
70 | } | 81 | } |
71 | 82 | ||
72 | 83 | ||
@@ -92,7 +103,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) | |||
92 | * prepare target chip field | 103 | * prepare target chip field |
93 | */ | 104 | */ |
94 | cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]); | 105 | cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]); |
95 | apic_write_around(APIC_ICR2, cfg); | 106 | apic_write(APIC_ICR2, cfg); |
96 | 107 | ||
97 | /* | 108 | /* |
98 | * program the ICR | 109 | * program the ICR |
@@ -102,7 +113,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) | |||
102 | /* | 113 | /* |
103 | * Send the IPI. The write to APIC_ICR fires this off. | 114 | * Send the IPI. The write to APIC_ICR fires this off. |
104 | */ | 115 | */ |
105 | apic_write_around(APIC_ICR, cfg); | 116 | apic_write(APIC_ICR, cfg); |
106 | } | 117 | } |
107 | local_irq_restore(flags); | 118 | local_irq_restore(flags); |
108 | } | 119 | } |
diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h index b90341994d80..f604e84c5303 100644 --- a/include/asm-x86_64/kdebug.h +++ b/include/asm-x86_64/kdebug.h | |||
@@ -46,7 +46,7 @@ extern void die(const char *,struct pt_regs *,long); | |||
46 | extern void __die(const char *,struct pt_regs *,long); | 46 | extern void __die(const char *,struct pt_regs *,long); |
47 | extern void show_registers(struct pt_regs *regs); | 47 | extern void show_registers(struct pt_regs *regs); |
48 | extern void dump_pagetable(unsigned long); | 48 | extern void dump_pagetable(unsigned long); |
49 | extern void oops_begin(void); | 49 | extern unsigned long oops_begin(void); |
50 | extern void oops_end(void); | 50 | extern void oops_end(unsigned long); |
51 | 51 | ||
52 | #endif | 52 | #endif |
diff --git a/include/asm-x86_64/local.h b/include/asm-x86_64/local.h index c954f15c1a75..3e72c41727c5 100644 --- a/include/asm-x86_64/local.h +++ b/include/asm-x86_64/local.h | |||
@@ -29,7 +29,7 @@ static __inline__ void local_dec(local_t *v) | |||
29 | :"m" (v->counter)); | 29 | :"m" (v->counter)); |
30 | } | 30 | } |
31 | 31 | ||
32 | static __inline__ void local_add(unsigned long i, local_t *v) | 32 | static __inline__ void local_add(unsigned int i, local_t *v) |
33 | { | 33 | { |
34 | __asm__ __volatile__( | 34 | __asm__ __volatile__( |
35 | "addl %1,%0" | 35 | "addl %1,%0" |
@@ -37,7 +37,7 @@ static __inline__ void local_add(unsigned long i, local_t *v) | |||
37 | :"ir" (i), "m" (v->counter)); | 37 | :"ir" (i), "m" (v->counter)); |
38 | } | 38 | } |
39 | 39 | ||
40 | static __inline__ void local_sub(unsigned long i, local_t *v) | 40 | static __inline__ void local_sub(unsigned int i, local_t *v) |
41 | { | 41 | { |
42 | __asm__ __volatile__( | 42 | __asm__ __volatile__( |
43 | "subl %1,%0" | 43 | "subl %1,%0" |
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h index 768413751b34..b40c661f111e 100644 --- a/include/asm-x86_64/mmzone.h +++ b/include/asm-x86_64/mmzone.h | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | #include <asm/smp.h> | 13 | #include <asm/smp.h> |
14 | 14 | ||
15 | #define NODEMAPSIZE 0xff | 15 | #define NODEMAPSIZE 0xfff |
16 | 16 | ||
17 | /* Simple perfect hash to map physical addresses to node numbers */ | 17 | /* Simple perfect hash to map physical addresses to node numbers */ |
18 | extern int memnode_shift; | 18 | extern int memnode_shift; |
@@ -54,7 +54,7 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) | |||
54 | 54 | ||
55 | #define pfn_valid(pfn) ((pfn) >= num_physpages ? 0 : \ | 55 | #define pfn_valid(pfn) ((pfn) >= num_physpages ? 0 : \ |
56 | ({ u8 nid__ = pfn_to_nid(pfn); \ | 56 | ({ u8 nid__ = pfn_to_nid(pfn); \ |
57 | nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) <= node_end_pfn(nid__); })) | 57 | nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) < node_end_pfn(nid__); })) |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #define local_mapnr(kvaddr) \ | 60 | #define local_mapnr(kvaddr) \ |
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index ba15279a79d0..4d727f3f5550 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h | |||
@@ -29,22 +29,37 @@ | |||
29 | #define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32) | 29 | #define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32) |
30 | 30 | ||
31 | /* wrmsr with exception handling */ | 31 | /* wrmsr with exception handling */ |
32 | #define wrmsr_safe(msr,a,b) ({ int ret__; \ | 32 | #define wrmsr_safe(msr,a,b) ({ int ret__; \ |
33 | asm volatile("2: wrmsr ; xorl %0,%0\n" \ | 33 | asm volatile("2: wrmsr ; xorl %0,%0\n" \ |
34 | "1:\n\t" \ | 34 | "1:\n\t" \ |
35 | ".section .fixup,\"ax\"\n\t" \ | 35 | ".section .fixup,\"ax\"\n\t" \ |
36 | "3: movl %4,%0 ; jmp 1b\n\t" \ | 36 | "3: movl %4,%0 ; jmp 1b\n\t" \ |
37 | ".previous\n\t" \ | 37 | ".previous\n\t" \ |
38 | ".section __ex_table,\"a\"\n" \ | 38 | ".section __ex_table,\"a\"\n" \ |
39 | " .align 8\n\t" \ | 39 | " .align 8\n\t" \ |
40 | " .quad 2b,3b\n\t" \ | 40 | " .quad 2b,3b\n\t" \ |
41 | ".previous" \ | 41 | ".previous" \ |
42 | : "=a" (ret__) \ | 42 | : "=a" (ret__) \ |
43 | : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT));\ | 43 | : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \ |
44 | ret__; }) | 44 | ret__; }) |
45 | 45 | ||
46 | #define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32)) | 46 | #define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32)) |
47 | 47 | ||
48 | #define rdmsr_safe(msr,a,b) \ | ||
49 | ({ int ret__; \ | ||
50 | asm volatile ("1: rdmsr\n" \ | ||
51 | "2:\n" \ | ||
52 | ".section .fixup,\"ax\"\n" \ | ||
53 | "3: movl %4,%0\n" \ | ||
54 | " jmp 2b\n" \ | ||
55 | ".previous\n" \ | ||
56 | ".section __ex_table,\"a\"\n" \ | ||
57 | " .align 8\n" \ | ||
58 | " .quad 1b,3b\n" \ | ||
59 | ".previous":"=&bDS" (ret__), "=a"(a), "=d"(b)\ | ||
60 | :"c"(msr), "i"(-EIO), "0"(0)); \ | ||
61 | ret__; }) | ||
62 | |||
48 | #define rdtsc(low,high) \ | 63 | #define rdtsc(low,high) \ |
49 | __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) | 64 | __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) |
50 | 65 | ||
@@ -64,7 +79,7 @@ | |||
64 | : "=a" (low), "=d" (high) \ | 79 | : "=a" (low), "=d" (high) \ |
65 | : "c" (counter)) | 80 | : "c" (counter)) |
66 | 81 | ||
67 | extern inline void cpuid(int op, unsigned int *eax, unsigned int *ebx, | 82 | static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx, |
68 | unsigned int *ecx, unsigned int *edx) | 83 | unsigned int *ecx, unsigned int *edx) |
69 | { | 84 | { |
70 | __asm__("cpuid" | 85 | __asm__("cpuid" |
@@ -90,7 +105,7 @@ static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, | |||
90 | /* | 105 | /* |
91 | * CPUID functions returning a single datum | 106 | * CPUID functions returning a single datum |
92 | */ | 107 | */ |
93 | extern inline unsigned int cpuid_eax(unsigned int op) | 108 | static inline unsigned int cpuid_eax(unsigned int op) |
94 | { | 109 | { |
95 | unsigned int eax; | 110 | unsigned int eax; |
96 | 111 | ||
@@ -100,7 +115,7 @@ extern inline unsigned int cpuid_eax(unsigned int op) | |||
100 | : "bx", "cx", "dx"); | 115 | : "bx", "cx", "dx"); |
101 | return eax; | 116 | return eax; |
102 | } | 117 | } |
103 | extern inline unsigned int cpuid_ebx(unsigned int op) | 118 | static inline unsigned int cpuid_ebx(unsigned int op) |
104 | { | 119 | { |
105 | unsigned int eax, ebx; | 120 | unsigned int eax, ebx; |
106 | 121 | ||
@@ -110,7 +125,7 @@ extern inline unsigned int cpuid_ebx(unsigned int op) | |||
110 | : "cx", "dx" ); | 125 | : "cx", "dx" ); |
111 | return ebx; | 126 | return ebx; |
112 | } | 127 | } |
113 | extern inline unsigned int cpuid_ecx(unsigned int op) | 128 | static inline unsigned int cpuid_ecx(unsigned int op) |
114 | { | 129 | { |
115 | unsigned int eax, ecx; | 130 | unsigned int eax, ecx; |
116 | 131 | ||
@@ -120,7 +135,7 @@ extern inline unsigned int cpuid_ecx(unsigned int op) | |||
120 | : "bx", "dx" ); | 135 | : "bx", "dx" ); |
121 | return ecx; | 136 | return ecx; |
122 | } | 137 | } |
123 | extern inline unsigned int cpuid_edx(unsigned int op) | 138 | static inline unsigned int cpuid_edx(unsigned int op) |
124 | { | 139 | { |
125 | unsigned int eax, edx; | 140 | unsigned int eax, edx; |
126 | 141 | ||
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h index 5c363a1482e4..bcf55c3f7f7f 100644 --- a/include/asm-x86_64/numa.h +++ b/include/asm-x86_64/numa.h | |||
@@ -9,6 +9,7 @@ struct node { | |||
9 | }; | 9 | }; |
10 | 10 | ||
11 | extern int compute_hash_shift(struct node *nodes, int numnodes); | 11 | extern int compute_hash_shift(struct node *nodes, int numnodes); |
12 | extern int pxm_to_node(int nid); | ||
12 | 13 | ||
13 | #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) | 14 | #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) |
14 | 15 | ||
@@ -16,6 +17,8 @@ extern void numa_add_cpu(int cpu); | |||
16 | extern void numa_init_array(void); | 17 | extern void numa_init_array(void); |
17 | extern int numa_off; | 18 | extern int numa_off; |
18 | 19 | ||
20 | extern unsigned char apicid_to_node[256]; | ||
21 | |||
19 | #define NUMA_NO_NODE 0xff | 22 | #define NUMA_NO_NODE 0xff |
20 | 23 | ||
21 | #endif | 24 | #endif |
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index 135ffaa0393b..e5ab4d231f2c 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h | |||
@@ -32,6 +32,8 @@ | |||
32 | #ifdef __KERNEL__ | 32 | #ifdef __KERNEL__ |
33 | #ifndef __ASSEMBLY__ | 33 | #ifndef __ASSEMBLY__ |
34 | 34 | ||
35 | extern unsigned long end_pfn; | ||
36 | |||
35 | void clear_page(void *); | 37 | void clear_page(void *); |
36 | void copy_page(void *, void *); | 38 | void copy_page(void *, void *); |
37 | 39 | ||
@@ -111,7 +113,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
111 | #ifdef CONFIG_FLATMEM | 113 | #ifdef CONFIG_FLATMEM |
112 | #define pfn_to_page(pfn) (mem_map + (pfn)) | 114 | #define pfn_to_page(pfn) (mem_map + (pfn)) |
113 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) | 115 | #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) |
114 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 116 | #define pfn_valid(pfn) ((pfn) < end_pfn) |
115 | #endif | 117 | #endif |
116 | 118 | ||
117 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 119 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h index eeb3088a1c9e..5a82a6762c21 100644 --- a/include/asm-x86_64/pci.h +++ b/include/asm-x86_64/pci.h | |||
@@ -50,10 +50,10 @@ extern int iommu_setup(char *opt); | |||
50 | * address space. The networking and block device layers use | 50 | * address space. The networking and block device layers use |
51 | * this boolean for bounce buffer decisions | 51 | * this boolean for bounce buffer decisions |
52 | * | 52 | * |
53 | * On AMD64 it mostly equals, but we set it to zero to tell some subsystems | 53 | * On x86-64 it mostly equals, but we set it to zero to tell some subsystems |
54 | * that an IOMMU is available. | 54 | * that an hard or soft IOMMU is available. |
55 | */ | 55 | */ |
56 | #define PCI_DMA_BUS_IS_PHYS (no_iommu ? 1 : 0) | 56 | #define PCI_DMA_BUS_IS_PHYS 0 |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * x86-64 always supports DAC, but sometimes it is useful to force | 59 | * x86-64 always supports DAC, but sometimes it is useful to force |
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h index 36b766cfc4d5..bbf89aa8a1af 100644 --- a/include/asm-x86_64/pda.h +++ b/include/asm-x86_64/pda.h | |||
@@ -10,10 +10,8 @@ | |||
10 | struct x8664_pda { | 10 | struct x8664_pda { |
11 | struct task_struct *pcurrent; /* Current process */ | 11 | struct task_struct *pcurrent; /* Current process */ |
12 | unsigned long data_offset; /* Per cpu data offset from linker address */ | 12 | unsigned long data_offset; /* Per cpu data offset from linker address */ |
13 | struct x8664_pda *me; /* Pointer to itself */ | ||
14 | unsigned long kernelstack; /* top of kernel stack for current */ | 13 | unsigned long kernelstack; /* top of kernel stack for current */ |
15 | unsigned long oldrsp; /* user rsp for system call */ | 14 | unsigned long oldrsp; /* user rsp for system call */ |
16 | unsigned long irqrsp; /* Old rsp for interrupts. */ | ||
17 | int irqcount; /* Irq nesting counter. Starts with -1 */ | 15 | int irqcount; /* Irq nesting counter. Starts with -1 */ |
18 | int cpunumber; /* Logical CPU number */ | 16 | int cpunumber; /* Logical CPU number */ |
19 | char *irqstackptr; /* top of irqstack */ | 17 | char *irqstackptr; /* top of irqstack */ |
@@ -22,7 +20,7 @@ struct x8664_pda { | |||
22 | struct mm_struct *active_mm; | 20 | struct mm_struct *active_mm; |
23 | int mmu_state; | 21 | int mmu_state; |
24 | unsigned apic_timer_irqs; | 22 | unsigned apic_timer_irqs; |
25 | } ____cacheline_aligned; | 23 | } ____cacheline_aligned_in_smp; |
26 | 24 | ||
27 | 25 | ||
28 | #define IRQSTACK_ORDER 2 | 26 | #define IRQSTACK_ORDER 2 |
@@ -42,13 +40,14 @@ extern void __bad_pda_field(void); | |||
42 | #define pda_offset(field) offsetof(struct x8664_pda, field) | 40 | #define pda_offset(field) offsetof(struct x8664_pda, field) |
43 | 41 | ||
44 | #define pda_to_op(op,field,val) do { \ | 42 | #define pda_to_op(op,field,val) do { \ |
43 | typedef typeof_field(struct x8664_pda, field) T__; \ | ||
45 | switch (sizeof_field(struct x8664_pda, field)) { \ | 44 | switch (sizeof_field(struct x8664_pda, field)) { \ |
46 | case 2: \ | 45 | case 2: \ |
47 | asm volatile(op "w %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ | 46 | asm volatile(op "w %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ |
48 | case 4: \ | 47 | case 4: \ |
49 | asm volatile(op "l %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ | 48 | asm volatile(op "l %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ |
50 | case 8: \ | 49 | case 8: \ |
51 | asm volatile(op "q %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ | 50 | asm volatile(op "q %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ |
52 | default: __bad_pda_field(); \ | 51 | default: __bad_pda_field(); \ |
53 | } \ | 52 | } \ |
54 | } while (0) | 53 | } while (0) |
@@ -58,7 +57,7 @@ asm volatile(op "q %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); bre | |||
58 | * Unfortunately removing them causes all hell to break lose currently. | 57 | * Unfortunately removing them causes all hell to break lose currently. |
59 | */ | 58 | */ |
60 | #define pda_from_op(op,field) ({ \ | 59 | #define pda_from_op(op,field) ({ \ |
61 | typedef typeof_field(struct x8664_pda, field) T__; T__ ret__; \ | 60 | typeof_field(struct x8664_pda, field) ret__; \ |
62 | switch (sizeof_field(struct x8664_pda, field)) { \ | 61 | switch (sizeof_field(struct x8664_pda, field)) { \ |
63 | case 2: \ | 62 | case 2: \ |
64 | asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ | 63 | asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ |
@@ -75,6 +74,7 @@ asm volatile(op "q %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); b | |||
75 | #define write_pda(field,val) pda_to_op("mov",field,val) | 74 | #define write_pda(field,val) pda_to_op("mov",field,val) |
76 | #define add_pda(field,val) pda_to_op("add",field,val) | 75 | #define add_pda(field,val) pda_to_op("add",field,val) |
77 | #define sub_pda(field,val) pda_to_op("sub",field,val) | 76 | #define sub_pda(field,val) pda_to_op("sub",field,val) |
77 | #define or_pda(field,val) pda_to_op("or",field,val) | ||
78 | 78 | ||
79 | #endif | 79 | #endif |
80 | 80 | ||
diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h index deadd146978b..08cad2482bcb 100644 --- a/include/asm-x86_64/pgalloc.h +++ b/include/asm-x86_64/pgalloc.h | |||
@@ -18,12 +18,12 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p | |||
18 | set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); | 18 | set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); |
19 | } | 19 | } |
20 | 20 | ||
21 | extern __inline__ pmd_t *get_pmd(void) | 21 | static inline pmd_t *get_pmd(void) |
22 | { | 22 | { |
23 | return (pmd_t *)get_zeroed_page(GFP_KERNEL); | 23 | return (pmd_t *)get_zeroed_page(GFP_KERNEL); |
24 | } | 24 | } |
25 | 25 | ||
26 | extern __inline__ void pmd_free(pmd_t *pmd) | 26 | static inline void pmd_free(pmd_t *pmd) |
27 | { | 27 | { |
28 | BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); | 28 | BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); |
29 | free_page((unsigned long)pmd); | 29 | free_page((unsigned long)pmd); |
@@ -86,13 +86,13 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add | |||
86 | /* Should really implement gc for free page table pages. This could be | 86 | /* Should really implement gc for free page table pages. This could be |
87 | done with a reference count in struct page. */ | 87 | done with a reference count in struct page. */ |
88 | 88 | ||
89 | extern __inline__ void pte_free_kernel(pte_t *pte) | 89 | static inline void pte_free_kernel(pte_t *pte) |
90 | { | 90 | { |
91 | BUG_ON((unsigned long)pte & (PAGE_SIZE-1)); | 91 | BUG_ON((unsigned long)pte & (PAGE_SIZE-1)); |
92 | free_page((unsigned long)pte); | 92 | free_page((unsigned long)pte); |
93 | } | 93 | } |
94 | 94 | ||
95 | extern inline void pte_free(struct page *pte) | 95 | static inline void pte_free(struct page *pte) |
96 | { | 96 | { |
97 | __free_page(pte); | 97 | __free_page(pte); |
98 | } | 98 | } |
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 5e0f2fdab0d3..1dc110ba82d6 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
@@ -85,7 +85,7 @@ static inline void set_pud(pud_t *dst, pud_t val) | |||
85 | pud_val(*dst) = pud_val(val); | 85 | pud_val(*dst) = pud_val(val); |
86 | } | 86 | } |
87 | 87 | ||
88 | extern inline void pud_clear (pud_t *pud) | 88 | static inline void pud_clear (pud_t *pud) |
89 | { | 89 | { |
90 | set_pud(pud, __pud(0)); | 90 | set_pud(pud, __pud(0)); |
91 | } | 91 | } |
@@ -95,7 +95,7 @@ static inline void set_pgd(pgd_t *dst, pgd_t val) | |||
95 | pgd_val(*dst) = pgd_val(val); | 95 | pgd_val(*dst) = pgd_val(val); |
96 | } | 96 | } |
97 | 97 | ||
98 | extern inline void pgd_clear (pgd_t * pgd) | 98 | static inline void pgd_clear (pgd_t * pgd) |
99 | { | 99 | { |
100 | set_pgd(pgd, __pgd(0)); | 100 | set_pgd(pgd, __pgd(0)); |
101 | } | 101 | } |
@@ -375,7 +375,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) | |||
375 | } | 375 | } |
376 | 376 | ||
377 | /* Change flags of a PTE */ | 377 | /* Change flags of a PTE */ |
378 | extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 378 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
379 | { | 379 | { |
380 | pte_val(pte) &= _PAGE_CHG_MASK; | 380 | pte_val(pte) &= _PAGE_CHG_MASK; |
381 | pte_val(pte) |= pgprot_val(newprot); | 381 | pte_val(pte) |= pgprot_val(newprot); |
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index a8321999448f..03837d34fba0 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h | |||
@@ -254,7 +254,13 @@ struct thread_struct { | |||
254 | u64 tls_array[GDT_ENTRY_TLS_ENTRIES]; | 254 | u64 tls_array[GDT_ENTRY_TLS_ENTRIES]; |
255 | } __attribute__((aligned(16))); | 255 | } __attribute__((aligned(16))); |
256 | 256 | ||
257 | #define INIT_THREAD {} | 257 | #define INIT_THREAD { \ |
258 | .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \ | ||
259 | } | ||
260 | |||
261 | #define INIT_TSS { \ | ||
262 | .rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \ | ||
263 | } | ||
258 | 264 | ||
259 | #define INIT_MMAP \ | 265 | #define INIT_MMAP \ |
260 | { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } | 266 | { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } |
@@ -375,13 +381,13 @@ struct extended_sigtable { | |||
375 | #define ASM_NOP_MAX 8 | 381 | #define ASM_NOP_MAX 8 |
376 | 382 | ||
377 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ | 383 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ |
378 | extern inline void rep_nop(void) | 384 | static inline void rep_nop(void) |
379 | { | 385 | { |
380 | __asm__ __volatile__("rep;nop": : :"memory"); | 386 | __asm__ __volatile__("rep;nop": : :"memory"); |
381 | } | 387 | } |
382 | 388 | ||
383 | /* Stop speculative execution */ | 389 | /* Stop speculative execution */ |
384 | extern inline void sync_core(void) | 390 | static inline void sync_core(void) |
385 | { | 391 | { |
386 | int tmp; | 392 | int tmp; |
387 | asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); | 393 | asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); |
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index f7574196424e..dbb37b0adb43 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h | |||
@@ -74,9 +74,6 @@ extern void acpi_reserve_bootmem(void); | |||
74 | 74 | ||
75 | extern void swap_low_mappings(void); | 75 | extern void swap_low_mappings(void); |
76 | 76 | ||
77 | extern void oops_begin(void); | ||
78 | extern void die(const char *,struct pt_regs *,long); | ||
79 | extern void __die(const char * str, struct pt_regs * regs, long err); | ||
80 | extern void __show_regs(struct pt_regs * regs); | 77 | extern void __show_regs(struct pt_regs * regs); |
81 | extern void show_regs(struct pt_regs * regs); | 78 | extern void show_regs(struct pt_regs * regs); |
82 | 79 | ||
@@ -93,8 +90,6 @@ extern int unhandled_signal(struct task_struct *tsk, int sig); | |||
93 | extern void select_idle_routine(const struct cpuinfo_x86 *c); | 90 | extern void select_idle_routine(const struct cpuinfo_x86 *c); |
94 | extern void swiotlb_init(void); | 91 | extern void swiotlb_init(void); |
95 | 92 | ||
96 | extern unsigned long max_mapnr; | ||
97 | extern unsigned long end_pfn; | ||
98 | extern unsigned long table_start, table_end; | 93 | extern unsigned long table_start, table_end; |
99 | 94 | ||
100 | extern int exception_trace; | 95 | extern int exception_trace; |
diff --git a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h index fe9b96d94815..f8d55798535a 100644 --- a/include/asm-x86_64/signal.h +++ b/include/asm-x86_64/signal.h | |||
@@ -143,23 +143,23 @@ typedef struct sigaltstack { | |||
143 | #undef __HAVE_ARCH_SIG_BITOPS | 143 | #undef __HAVE_ARCH_SIG_BITOPS |
144 | #if 0 | 144 | #if 0 |
145 | 145 | ||
146 | extern __inline__ void sigaddset(sigset_t *set, int _sig) | 146 | static inline void sigaddset(sigset_t *set, int _sig) |
147 | { | 147 | { |
148 | __asm__("btsq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); | 148 | __asm__("btsq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); |
149 | } | 149 | } |
150 | 150 | ||
151 | extern __inline__ void sigdelset(sigset_t *set, int _sig) | 151 | static inline void sigdelset(sigset_t *set, int _sig) |
152 | { | 152 | { |
153 | __asm__("btrq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); | 153 | __asm__("btrq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); |
154 | } | 154 | } |
155 | 155 | ||
156 | extern __inline__ int __const_sigismember(sigset_t *set, int _sig) | 156 | static inline int __const_sigismember(sigset_t *set, int _sig) |
157 | { | 157 | { |
158 | unsigned long sig = _sig - 1; | 158 | unsigned long sig = _sig - 1; |
159 | return 1 & (set->sig[sig / _NSIG_BPW] >> (sig & ~(_NSIG_BPW-1))); | 159 | return 1 & (set->sig[sig / _NSIG_BPW] >> (sig & ~(_NSIG_BPW-1))); |
160 | } | 160 | } |
161 | 161 | ||
162 | extern __inline__ int __gen_sigismember(sigset_t *set, int _sig) | 162 | static inline int __gen_sigismember(sigset_t *set, int _sig) |
163 | { | 163 | { |
164 | int ret; | 164 | int ret; |
165 | __asm__("btq %2,%1\n\tsbbq %0,%0" | 165 | __asm__("btq %2,%1\n\tsbbq %0,%0" |
@@ -172,7 +172,7 @@ extern __inline__ int __gen_sigismember(sigset_t *set, int _sig) | |||
172 | __const_sigismember((set),(sig)) : \ | 172 | __const_sigismember((set),(sig)) : \ |
173 | __gen_sigismember((set),(sig))) | 173 | __gen_sigismember((set),(sig))) |
174 | 174 | ||
175 | extern __inline__ int sigfindinword(unsigned long word) | 175 | static inline int sigfindinword(unsigned long word) |
176 | { | 176 | { |
177 | __asm__("bsfq %1,%0" : "=r"(word) : "rm"(word) : "cc"); | 177 | __asm__("bsfq %1,%0" : "=r"(word) : "rm"(word) : "cc"); |
178 | return word; | 178 | return word; |
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index de8b57b2b62b..24e32611f0bf 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h | |||
@@ -72,7 +72,7 @@ static inline int num_booting_cpus(void) | |||
72 | 72 | ||
73 | #define raw_smp_processor_id() read_pda(cpunumber) | 73 | #define raw_smp_processor_id() read_pda(cpunumber) |
74 | 74 | ||
75 | extern __inline int hard_smp_processor_id(void) | 75 | static inline int hard_smp_processor_id(void) |
76 | { | 76 | { |
77 | /* we don't want to mark this access volatile - bad code generation */ | 77 | /* we don't want to mark this access volatile - bad code generation */ |
78 | return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); | 78 | return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); |
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 8606e170a7dc..85348e02ad2e 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h | |||
@@ -188,7 +188,7 @@ static inline void write_cr4(unsigned long val) | |||
188 | 188 | ||
189 | #define __xg(x) ((volatile long *)(x)) | 189 | #define __xg(x) ((volatile long *)(x)) |
190 | 190 | ||
191 | extern inline void set_64bit(volatile unsigned long *ptr, unsigned long val) | 191 | static inline void set_64bit(volatile unsigned long *ptr, unsigned long val) |
192 | { | 192 | { |
193 | *ptr = val; | 193 | *ptr = val; |
194 | } | 194 | } |
@@ -253,19 +253,19 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | |||
253 | case 2: | 253 | case 2: |
254 | __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" | 254 | __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" |
255 | : "=a"(prev) | 255 | : "=a"(prev) |
256 | : "q"(new), "m"(*__xg(ptr)), "0"(old) | 256 | : "r"(new), "m"(*__xg(ptr)), "0"(old) |
257 | : "memory"); | 257 | : "memory"); |
258 | return prev; | 258 | return prev; |
259 | case 4: | 259 | case 4: |
260 | __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2" | 260 | __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2" |
261 | : "=a"(prev) | 261 | : "=a"(prev) |
262 | : "q"(new), "m"(*__xg(ptr)), "0"(old) | 262 | : "r"(new), "m"(*__xg(ptr)), "0"(old) |
263 | : "memory"); | 263 | : "memory"); |
264 | return prev; | 264 | return prev; |
265 | case 8: | 265 | case 8: |
266 | __asm__ __volatile__(LOCK_PREFIX "cmpxchgq %1,%2" | 266 | __asm__ __volatile__(LOCK_PREFIX "cmpxchgq %1,%2" |
267 | : "=a"(prev) | 267 | : "=a"(prev) |
268 | : "q"(new), "m"(*__xg(ptr)), "0"(old) | 268 | : "r"(new), "m"(*__xg(ptr)), "0"(old) |
269 | : "memory"); | 269 | : "memory"); |
270 | return prev; | 270 | return prev; |
271 | } | 271 | } |
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h index 24ecf6a637cb..f971f45d6d78 100644 --- a/include/asm-x86_64/timex.h +++ b/include/asm-x86_64/timex.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifndef _ASMx8664_TIMEX_H | 6 | #ifndef _ASMx8664_TIMEX_H |
7 | #define _ASMx8664_TIMEX_H | 7 | #define _ASMx8664_TIMEX_H |
8 | 8 | ||
9 | #include <linux/config.h> | ||
10 | #include <asm/8253pit.h> | 9 | #include <asm/8253pit.h> |
11 | #include <asm/msr.h> | 10 | #include <asm/msr.h> |
12 | #include <asm/vsyscall.h> | 11 | #include <asm/vsyscall.h> |
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h index 505b0cf906de..4a9c20ea9b10 100644 --- a/include/asm-x86_64/tlbflush.h +++ b/include/asm-x86_64/tlbflush.h | |||
@@ -109,6 +109,10 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st | |||
109 | #define TLBSTATE_OK 1 | 109 | #define TLBSTATE_OK 1 |
110 | #define TLBSTATE_LAZY 2 | 110 | #define TLBSTATE_LAZY 2 |
111 | 111 | ||
112 | /* Roughly an IPI every 20MB with 4k pages for freeing page table | ||
113 | ranges. Cost is about 42k of memory for each CPU. */ | ||
114 | #define ARCH_FREE_PTE_NR 5350 | ||
115 | |||
112 | #endif | 116 | #endif |
113 | 117 | ||
114 | #define flush_tlb_kernel_range(start, end) flush_tlb_all() | 118 | #define flush_tlb_kernel_range(start, end) flush_tlb_all() |
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h index c1bc3fad482e..1c603cd7e4d0 100644 --- a/include/asm-x86_64/topology.h +++ b/include/asm-x86_64/topology.h | |||
@@ -13,7 +13,6 @@ | |||
13 | extern cpumask_t cpu_online_map; | 13 | extern cpumask_t cpu_online_map; |
14 | 14 | ||
15 | extern unsigned char cpu_to_node[]; | 15 | extern unsigned char cpu_to_node[]; |
16 | extern unsigned char pci_bus_to_node[]; | ||
17 | extern cpumask_t node_to_cpumask[]; | 16 | extern cpumask_t node_to_cpumask[]; |
18 | 17 | ||
19 | #ifdef CONFIG_ACPI_NUMA | 18 | #ifdef CONFIG_ACPI_NUMA |
@@ -26,7 +25,7 @@ extern int __node_distance(int, int); | |||
26 | #define parent_node(node) (node) | 25 | #define parent_node(node) (node) |
27 | #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) | 26 | #define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) |
28 | #define node_to_cpumask(node) (node_to_cpumask[node]) | 27 | #define node_to_cpumask(node) (node_to_cpumask[node]) |
29 | #define pcibus_to_node(bus) pci_bus_to_node[(bus)->number] | 28 | #define pcibus_to_node(bus) ((long)(bus->sysdata)) |
30 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); | 29 | #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); |
31 | 30 | ||
32 | /* sched_domains SD_NODE_INIT for x86_64 machines */ | 31 | /* sched_domains SD_NODE_INIT for x86_64 machines */ |
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h index 2872da23fc7e..438a3f52f839 100644 --- a/include/asm-x86_64/vsyscall.h +++ b/include/asm-x86_64/vsyscall.h | |||
@@ -29,7 +29,6 @@ enum vsyscall_num { | |||
29 | 29 | ||
30 | struct vxtime_data { | 30 | struct vxtime_data { |
31 | long hpet_address; /* HPET base address */ | 31 | long hpet_address; /* HPET base address */ |
32 | unsigned long hz; /* HPET clocks / sec */ | ||
33 | int last; | 32 | int last; |
34 | unsigned long last_tsc; | 33 | unsigned long last_tsc; |
35 | long quot; | 34 | long quot; |
diff --git a/include/linux/crc16.h b/include/linux/crc16.h index bdedf825b04a..9443c084f881 100644 --- a/include/linux/crc16.h +++ b/include/linux/crc16.h | |||
@@ -1,22 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * crc16.h - CRC-16 routine | 2 | * crc16.h - CRC-16 routine |
3 | * | 3 | * |
4 | * Implements the standard CRC-16, as used with 1-wire devices: | 4 | * Implements the standard CRC-16: |
5 | * Width 16 | 5 | * Width 16 |
6 | * Poly 0x8005 (x^16 + x^15 + x^2 + 1) | 6 | * Poly 0x8005 (x^16 + x^15 + x^2 + 1) |
7 | * Init 0 | 7 | * Init 0 |
8 | * | 8 | * |
9 | * For 1-wire devices, the CRC is stored inverted, LSB-first | ||
10 | * | ||
11 | * Example buffer with the CRC attached: | ||
12 | * 31 32 33 34 35 36 37 38 39 C2 44 | ||
13 | * | ||
14 | * The CRC over a buffer with the CRC attached is 0xB001. | ||
15 | * So, if (crc16(0, buf, size) == 0xB001) then the buffer is valid. | ||
16 | * | ||
17 | * Refer to "Application Note 937: Book of iButton Standards" for details. | ||
18 | * http://www.maxim-ic.com/appnotes.cfm/appnote_number/937 | ||
19 | * | ||
20 | * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com> | 9 | * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com> |
21 | * | 10 | * |
22 | * This source code is licensed under the GNU General Public License, | 11 | * This source code is licensed under the GNU General Public License, |
@@ -28,9 +17,6 @@ | |||
28 | 17 | ||
29 | #include <linux/types.h> | 18 | #include <linux/types.h> |
30 | 19 | ||
31 | #define CRC16_INIT 0 | ||
32 | #define CRC16_VALID 0xb001 | ||
33 | |||
34 | extern u16 const crc16_table[256]; | 20 | extern u16 const crc16_table[256]; |
35 | 21 | ||
36 | extern u16 crc16(u16 crc, const u8 *buffer, size_t len); | 22 | extern u16 crc16(u16 crc, const u8 *buffer, size_t len); |
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index c30175e8dec6..a415f1d93e9a 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -70,7 +70,7 @@ extern struct dmi_device * dmi_find_device(int type, const char *name, | |||
70 | 70 | ||
71 | static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } | 71 | static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } |
72 | static inline char * dmi_get_system_info(int field) { return NULL; } | 72 | static inline char * dmi_get_system_info(int field) { return NULL; } |
73 | static struct dmi_device * dmi_find_device(int type, const char *name, | 73 | static inline struct dmi_device * dmi_find_device(int type, const char *name, |
74 | struct dmi_device *from) { return NULL; } | 74 | struct dmi_device *from) { return NULL; } |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index d99e7aeb7d33..0a90205184b0 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -57,6 +57,11 @@ extern void disable_irq(unsigned int irq); | |||
57 | extern void enable_irq(unsigned int irq); | 57 | extern void enable_irq(unsigned int irq); |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifndef __ARCH_SET_SOFTIRQ_PENDING | ||
61 | #define set_softirq_pending(x) (local_softirq_pending() = (x)) | ||
62 | #define or_softirq_pending(x) (local_softirq_pending() |= (x)) | ||
63 | #endif | ||
64 | |||
60 | /* | 65 | /* |
61 | * Temporary defines for UP kernels, until all code gets fixed. | 66 | * Temporary defines for UP kernels, until all code gets fixed. |
62 | */ | 67 | */ |
@@ -123,7 +128,7 @@ struct softirq_action | |||
123 | asmlinkage void do_softirq(void); | 128 | asmlinkage void do_softirq(void); |
124 | extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); | 129 | extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); |
125 | extern void softirq_init(void); | 130 | extern void softirq_init(void); |
126 | #define __raise_softirq_irqoff(nr) do { local_softirq_pending() |= 1UL << (nr); } while (0) | 131 | #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) |
127 | extern void FASTCALL(raise_softirq_irqoff(unsigned int nr)); | 132 | extern void FASTCALL(raise_softirq_irqoff(unsigned int nr)); |
128 | extern void FASTCALL(raise_softirq(unsigned int nr)); | 133 | extern void FASTCALL(raise_softirq(unsigned int nr)); |
129 | 134 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index ed3bb19d1337..38c8654aaa96 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -785,7 +785,6 @@ struct task_struct { | |||
785 | short il_next; | 785 | short il_next; |
786 | #endif | 786 | #endif |
787 | #ifdef CONFIG_CPUSETS | 787 | #ifdef CONFIG_CPUSETS |
788 | short cpuset_sem_nest_depth; | ||
789 | struct cpuset *cpuset; | 788 | struct cpuset *cpuset; |
790 | nodemask_t mems_allowed; | 789 | nodemask_t mems_allowed; |
791 | int cpuset_mems_generation; | 790 | int cpuset_mems_generation; |
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index fb57c2217468..9facf733800c 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h | |||
@@ -32,7 +32,6 @@ | |||
32 | #define _LINUX_USBDEVICE_FS_H | 32 | #define _LINUX_USBDEVICE_FS_H |
33 | 33 | ||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/compat.h> | ||
36 | 35 | ||
37 | /* --------------------------------------------------------------------- */ | 36 | /* --------------------------------------------------------------------- */ |
38 | 37 | ||
@@ -125,6 +124,7 @@ struct usbdevfs_hub_portinfo { | |||
125 | }; | 124 | }; |
126 | 125 | ||
127 | #ifdef CONFIG_COMPAT | 126 | #ifdef CONFIG_COMPAT |
127 | #include <linux/compat.h> | ||
128 | struct usbdevfs_urb32 { | 128 | struct usbdevfs_urb32 { |
129 | unsigned char type; | 129 | unsigned char type; |
130 | unsigned char endpoint; | 130 | unsigned char endpoint; |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 407b5f0a8c8e..79866bc6b3a1 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -180,6 +180,8 @@ static struct super_block *cpuset_sb = NULL; | |||
180 | */ | 180 | */ |
181 | 181 | ||
182 | static DECLARE_MUTEX(cpuset_sem); | 182 | static DECLARE_MUTEX(cpuset_sem); |
183 | static struct task_struct *cpuset_sem_owner; | ||
184 | static int cpuset_sem_depth; | ||
183 | 185 | ||
184 | /* | 186 | /* |
185 | * The global cpuset semaphore cpuset_sem can be needed by the | 187 | * The global cpuset semaphore cpuset_sem can be needed by the |
@@ -200,16 +202,19 @@ static DECLARE_MUTEX(cpuset_sem); | |||
200 | 202 | ||
201 | static inline void cpuset_down(struct semaphore *psem) | 203 | static inline void cpuset_down(struct semaphore *psem) |
202 | { | 204 | { |
203 | if (current->cpuset_sem_nest_depth == 0) | 205 | if (cpuset_sem_owner != current) { |
204 | down(psem); | 206 | down(psem); |
205 | current->cpuset_sem_nest_depth++; | 207 | cpuset_sem_owner = current; |
208 | } | ||
209 | cpuset_sem_depth++; | ||
206 | } | 210 | } |
207 | 211 | ||
208 | static inline void cpuset_up(struct semaphore *psem) | 212 | static inline void cpuset_up(struct semaphore *psem) |
209 | { | 213 | { |
210 | current->cpuset_sem_nest_depth--; | 214 | if (--cpuset_sem_depth == 0) { |
211 | if (current->cpuset_sem_nest_depth == 0) | 215 | cpuset_sem_owner = NULL; |
212 | up(psem); | 216 | up(psem); |
217 | } | ||
213 | } | 218 | } |
214 | 219 | ||
215 | /* | 220 | /* |
diff --git a/kernel/sched.c b/kernel/sched.c index e9ff04a9b56d..81b3a96ed2d0 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3577,32 +3577,6 @@ task_t *idle_task(int cpu) | |||
3577 | } | 3577 | } |
3578 | 3578 | ||
3579 | /** | 3579 | /** |
3580 | * curr_task - return the current task for a given cpu. | ||
3581 | * @cpu: the processor in question. | ||
3582 | */ | ||
3583 | task_t *curr_task(int cpu) | ||
3584 | { | ||
3585 | return cpu_curr(cpu); | ||
3586 | } | ||
3587 | |||
3588 | /** | ||
3589 | * set_curr_task - set the current task for a given cpu. | ||
3590 | * @cpu: the processor in question. | ||
3591 | * @p: the task pointer to set. | ||
3592 | * | ||
3593 | * Description: This function must only be used when non-maskable interrupts | ||
3594 | * are serviced on a separate stack. It allows the architecture to switch the | ||
3595 | * notion of the current task on a cpu in a non-blocking manner. This function | ||
3596 | * must be called with interrupts disabled, the caller must save the original | ||
3597 | * value of the current task (see curr_task() above) and restore that value | ||
3598 | * before reenabling interrupts. | ||
3599 | */ | ||
3600 | void set_curr_task(int cpu, task_t *p) | ||
3601 | { | ||
3602 | cpu_curr(cpu) = p; | ||
3603 | } | ||
3604 | |||
3605 | /** | ||
3606 | * find_process_by_pid - find a process with a matching PID value. | 3580 | * find_process_by_pid - find a process with a matching PID value. |
3607 | * @pid: the pid in question. | 3581 | * @pid: the pid in question. |
3608 | */ | 3582 | */ |
@@ -5628,3 +5602,47 @@ void normalize_rt_tasks(void) | |||
5628 | } | 5602 | } |
5629 | 5603 | ||
5630 | #endif /* CONFIG_MAGIC_SYSRQ */ | 5604 | #endif /* CONFIG_MAGIC_SYSRQ */ |
5605 | |||
5606 | #ifdef CONFIG_IA64 | ||
5607 | /* | ||
5608 | * These functions are only useful for the IA64 MCA handling. | ||
5609 | * | ||
5610 | * They can only be called when the whole system has been | ||
5611 | * stopped - every CPU needs to be quiescent, and no scheduling | ||
5612 | * activity can take place. Using them for anything else would | ||
5613 | * be a serious bug, and as a result, they aren't even visible | ||
5614 | * under any other configuration. | ||
5615 | */ | ||
5616 | |||
5617 | /** | ||
5618 | * curr_task - return the current task for a given cpu. | ||
5619 | * @cpu: the processor in question. | ||
5620 | * | ||
5621 | * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED! | ||
5622 | */ | ||
5623 | task_t *curr_task(int cpu) | ||
5624 | { | ||
5625 | return cpu_curr(cpu); | ||
5626 | } | ||
5627 | |||
5628 | /** | ||
5629 | * set_curr_task - set the current task for a given cpu. | ||
5630 | * @cpu: the processor in question. | ||
5631 | * @p: the task pointer to set. | ||
5632 | * | ||
5633 | * Description: This function must only be used when non-maskable interrupts | ||
5634 | * are serviced on a separate stack. It allows the architecture to switch the | ||
5635 | * notion of the current task on a cpu in a non-blocking manner. This function | ||
5636 | * must be called with all CPU's synchronized, and interrupts disabled, the | ||
5637 | * and caller must save the original value of the current task (see | ||
5638 | * curr_task() above) and restore that value before reenabling interrupts and | ||
5639 | * re-starting the system. | ||
5640 | * | ||
5641 | * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED! | ||
5642 | */ | ||
5643 | void set_curr_task(int cpu, task_t *p) | ||
5644 | { | ||
5645 | cpu_curr(cpu) = p; | ||
5646 | } | ||
5647 | |||
5648 | #endif | ||
diff --git a/kernel/softirq.c b/kernel/softirq.c index b4ab6af1dea8..f766b2fc48be 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
@@ -84,7 +84,7 @@ asmlinkage void __do_softirq(void) | |||
84 | cpu = smp_processor_id(); | 84 | cpu = smp_processor_id(); |
85 | restart: | 85 | restart: |
86 | /* Reset the pending bitmask before enabling irqs */ | 86 | /* Reset the pending bitmask before enabling irqs */ |
87 | local_softirq_pending() = 0; | 87 | set_softirq_pending(0); |
88 | 88 | ||
89 | local_irq_enable(); | 89 | local_irq_enable(); |
90 | 90 | ||
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 3754c9a8f5c8..016e89a44ac8 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -170,11 +170,11 @@ config DEBUG_FS | |||
170 | 170 | ||
171 | config FRAME_POINTER | 171 | config FRAME_POINTER |
172 | bool "Compile the kernel with frame pointers" | 172 | bool "Compile the kernel with frame pointers" |
173 | depends on DEBUG_KERNEL && ((X86 && !X86_64) || CRIS || M68K || M68KNOMMU || FRV || UML) | 173 | depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML) |
174 | default y if DEBUG_INFO && UML | 174 | default y if DEBUG_INFO && UML |
175 | help | 175 | help |
176 | If you say Y here the resulting kernel image will be slightly larger | 176 | If you say Y here the resulting kernel image will be slightly larger |
177 | and slower, but it will give very useful debugging information. | 177 | and slower, but it might give very useful debugging information |
178 | If you don't debug the kernel, you can say N, but we may not be able | 178 | on some architectures or you use external debuggers. |
179 | to solve problems without frame pointers. | 179 | If you don't debug the kernel, you can say N. |
180 | 180 | ||
diff --git a/mm/bootmem.c b/mm/bootmem.c index c1330cc19783..8ec4e4c2a179 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -61,9 +61,17 @@ static unsigned long __init init_bootmem_core (pg_data_t *pgdat, | |||
61 | { | 61 | { |
62 | bootmem_data_t *bdata = pgdat->bdata; | 62 | bootmem_data_t *bdata = pgdat->bdata; |
63 | unsigned long mapsize = ((end - start)+7)/8; | 63 | unsigned long mapsize = ((end - start)+7)/8; |
64 | 64 | static struct pglist_data *pgdat_last; | |
65 | pgdat->pgdat_next = pgdat_list; | 65 | |
66 | pgdat_list = pgdat; | 66 | pgdat->pgdat_next = NULL; |
67 | /* Add new nodes last so that bootmem always starts | ||
68 | searching in the first nodes, not the last ones */ | ||
69 | if (pgdat_last) | ||
70 | pgdat_last->pgdat_next = pgdat; | ||
71 | else { | ||
72 | pgdat_list = pgdat; | ||
73 | pgdat_last = pgdat; | ||
74 | } | ||
67 | 75 | ||
68 | mapsize = ALIGN(mapsize, sizeof(long)); | 76 | mapsize = ALIGN(mapsize, sizeof(long)); |
69 | bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT); | 77 | bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT); |
diff --git a/mm/nommu.c b/mm/nommu.c index fd4e8df0f02d..064d70442895 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -57,6 +57,11 @@ DECLARE_RWSEM(nommu_vma_sem); | |||
57 | struct vm_operations_struct generic_file_vm_ops = { | 57 | struct vm_operations_struct generic_file_vm_ops = { |
58 | }; | 58 | }; |
59 | 59 | ||
60 | EXPORT_SYMBOL(vmalloc); | ||
61 | EXPORT_SYMBOL(vfree); | ||
62 | EXPORT_SYMBOL(vmalloc_to_page); | ||
63 | EXPORT_SYMBOL(vmalloc_32); | ||
64 | |||
60 | /* | 65 | /* |
61 | * Handle all mappings that got truncated by a "truncate()" | 66 | * Handle all mappings that got truncated by a "truncate()" |
62 | * system call. | 67 | * system call. |
@@ -142,6 +147,8 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
142 | return(i); | 147 | return(i); |
143 | } | 148 | } |
144 | 149 | ||
150 | EXPORT_SYMBOL(get_user_pages); | ||
151 | |||
145 | DEFINE_RWLOCK(vmlist_lock); | 152 | DEFINE_RWLOCK(vmlist_lock); |
146 | struct vm_struct *vmlist; | 153 | struct vm_struct *vmlist; |
147 | 154 | ||
@@ -852,7 +859,7 @@ unsigned long do_mmap_pgoff(struct file *file, | |||
852 | error_getting_vma: | 859 | error_getting_vma: |
853 | up_write(&nommu_vma_sem); | 860 | up_write(&nommu_vma_sem); |
854 | kfree(vml); | 861 | kfree(vml); |
855 | printk("Allocation of vml for %lu byte allocation from process %d failed\n", | 862 | printk("Allocation of vma for %lu byte allocation from process %d failed\n", |
856 | len, current->pid); | 863 | len, current->pid); |
857 | show_free_areas(); | 864 | show_free_areas(); |
858 | return -ENOMEM; | 865 | return -ENOMEM; |
@@ -909,7 +916,7 @@ int do_munmap(struct mm_struct *mm, unsigned long addr, size_t len) | |||
909 | 916 | ||
910 | for (parent = &mm->context.vmlist; *parent; parent = &(*parent)->next) | 917 | for (parent = &mm->context.vmlist; *parent; parent = &(*parent)->next) |
911 | if ((*parent)->vma->vm_start == addr && | 918 | if ((*parent)->vma->vm_start == addr && |
912 | (*parent)->vma->vm_end == end) | 919 | ((len == 0) || ((*parent)->vma->vm_end == end))) |
913 | goto found; | 920 | goto found; |
914 | 921 | ||
915 | printk("munmap of non-mmaped memory by process %d (%s): %p\n", | 922 | printk("munmap of non-mmaped memory by process %d (%s): %p\n", |
@@ -1054,7 +1061,8 @@ struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr) | |||
1054 | int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, | 1061 | int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, |
1055 | unsigned long to, unsigned long size, pgprot_t prot) | 1062 | unsigned long to, unsigned long size, pgprot_t prot) |
1056 | { | 1063 | { |
1057 | return -EPERM; | 1064 | vma->vm_start = vma->vm_pgoff << PAGE_SHIFT; |
1065 | return 0; | ||
1058 | } | 1066 | } |
1059 | 1067 | ||
1060 | void swap_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) | 1068 | void swap_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) |
@@ -1073,9 +1081,10 @@ void arch_unmap_area(struct mm_struct *mm, unsigned long addr) | |||
1073 | 1081 | ||
1074 | void update_mem_hiwater(struct task_struct *tsk) | 1082 | void update_mem_hiwater(struct task_struct *tsk) |
1075 | { | 1083 | { |
1076 | unsigned long rss = get_mm_counter(tsk->mm, rss); | 1084 | unsigned long rss; |
1077 | 1085 | ||
1078 | if (likely(tsk->mm)) { | 1086 | if (likely(tsk->mm)) { |
1087 | rss = get_mm_counter(tsk->mm, rss); | ||
1079 | if (tsk->mm->hiwater_rss < rss) | 1088 | if (tsk->mm->hiwater_rss < rss) |
1080 | tsk->mm->hiwater_rss = rss; | 1089 | tsk->mm->hiwater_rss = rss; |
1081 | if (tsk->mm->hiwater_vm < tsk->mm->total_vm) | 1090 | if (tsk->mm->hiwater_vm < tsk->mm->total_vm) |