Unified · Split
| @@ -1,3 +1,46 @@ | ||
| 1 | +What: /sys/bus/pci/drivers/.../bind | |
| 2 | +Date: December 2003 | |
| 3 | +Contact: linux-pci@vger.kernel.org | |
| 4 | +Description: | |
| 5 | + Writing a device location to this file will cause | |
| 6 | + the driver to attempt to bind to the device found at | |
| 7 | + this location. This is useful for overriding default | |
| 8 | + bindings. The format for the location is: DDDD:BB:DD.F. | |
| 9 | + That is Domain:Bus:Device.Function and is the same as | |
| 10 | + found in /sys/bus/pci/devices/. For example: | |
| 11 | + # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/bind | |
| 12 | + (Note: kernels before 2.6.28 may require echo -n). | |
| 13 | + | |
| 14 | +What: /sys/bus/pci/drivers/.../unbind | |
| 15 | +Date: December 2003 | |
| 16 | +Contact: linux-pci@vger.kernel.org | |
| 17 | +Description: | |
| 18 | + Writing a device location to this file will cause the | |
| 19 | + driver to attempt to unbind from the device found at | |
| 20 | + this location. This may be useful when overriding default | |
| 21 | + bindings. The format for the location is: DDDD:BB:DD.F. | |
| 22 | + That is Domain:Bus:Device.Function and is the same as | |
| 23 | + found in /sys/bus/pci/devices/. For example: | |
| 24 | + # echo 0000:00:19.0 > /sys/bus/pci/drivers/foo/unbind | |
| 25 | + (Note: kernels before 2.6.28 may require echo -n). | |
| 26 | + | |
| 27 | +What: /sys/bus/pci/drivers/.../new_id | |
| 28 | +Date: December 2003 | |
| 29 | +Contact: linux-pci@vger.kernel.org | |
| 30 | +Description: | |
| 31 | + Writing a device ID to this file will attempt to | |
| 32 | + dynamically add a new device ID to a PCI device driver. | |
| 33 | + This may allow the driver to support more hardware than | |
| 34 | + was included in the driver's static device ID support | |
| 35 | + table at compile time. The format for the device ID is: | |
| 36 | + VVVV DDDD SVVV SDDD CCCC MMMM PPPP. That is Vendor ID, | |
| 37 | + Device ID, Subsystem Vendor ID, Subsystem Device ID, | |
| 38 | + Class, Class Mask, and Private Driver Data. The Vendor ID | |
| 39 | + and Device ID fields are required, the rest are optional. | |
| 40 | + Upon successfully adding an ID, the driver will probe | |
| 41 | + for the device and attempt to bind to it. For example: | |
| 42 | + # echo "8086 10f5" > /sys/bus/pci/drivers/foo/new_id | |
| 43 | + | |
| 1 | 44 | What: /sys/bus/pci/devices/.../vpd |
| 2 | 45 | Date: February 2008 |
| 3 | 46 | Contact: Ben Hutchings <bhutchings@solarflare.com> |
| @@ -1,205 +0,0 @@ | ||
| 1 | −This README escorted the skystar2-driver rewriting procedure. It describes the | |
| 2 | −state of the new flexcop-driver set and some internals are written down here | |
| 3 | −too. | |
| 4 | − | |
| 5 | −This document hopefully describes things about the flexcop and its | |
| 6 | −device-offsprings. Goal was to write an easy-to-write and easy-to-read set of | |
| 7 | −drivers based on the skystar2.c and other information. | |
| 8 | − | |
| 9 | −Remark: flexcop-pci.c was a copy of skystar2.c, but every line has been | |
| 10 | −touched and rewritten. | |
| 11 | − | |
| 12 | −History & News | |
| 13 | −============== | |
| 14 | − 2005-04-01 - correct USB ISOC transfers (thanks to Vadim Catana) | |
| 15 | − | |
| 16 | − | |
| 17 | − | |
| 18 | − | |
| 19 | −General coding processing | |
| 20 | −========================= | |
| 21 | − | |
| 22 | −We should proceed as follows (as long as no one complains): | |
| 23 | − | |
| 24 | −0) Think before start writing code! | |
| 25 | − | |
| 26 | −1) rewriting the skystar2.c with the help of the flexcop register descriptions | |
| 27 | −and splitting up the files to a pci-bus-part and a flexcop-part. | |
| 28 | −The new driver will be called b2c2-flexcop-pci.ko/b2c2-flexcop-usb.ko for the | |
| 29 | −device-specific part and b2c2-flexcop.ko for the common flexcop-functions. | |
| 30 | − | |
| 31 | −2) Search for errors in the leftover of flexcop-pci.c (compare with pluto2.c | |
| 32 | −and other pci drivers) | |
| 33 | − | |
| 34 | −3) make some beautification (see 'Improvements when rewriting (refactoring) is | |
| 35 | −done') | |
| 36 | − | |
| 37 | −4) Testing the new driver and maybe substitute the skystar2.c with it, to reach | |
| 38 | −a wider tester audience. | |
| 39 | − | |
| 40 | −5) creating an usb-bus-part using the already written flexcop code for the pci | |
| 41 | −card. | |
| 42 | − | |
| 43 | −Idea: create a kernel-object for the flexcop and export all important | |
| 44 | −functions. This option saves kernel-memory, but maybe a lot of functions have | |
| 45 | −to be exported to kernel namespace. | |
| 46 | − | |
| 47 | − | |
| 48 | −Current situation | |
| 49 | −================= | |
| 50 | − | |
| 51 | −0) Done :) | |
| 52 | −1) Done (some minor issues left) | |
| 53 | −2) Done | |
| 54 | −3) Not ready yet, more information is necessary | |
| 55 | −4) next to be done (see the table below) | |
| 56 | −5) USB driver is working (yes, there are some minor issues) | |
| 57 | − | |
| 58 | −What seems to be ready? | |
| 59 | −----------------------- | |
| 60 | − | |
| 61 | −1) Rewriting | |
| 62 | −1a) i2c is cut off from the flexcop-pci.c and seems to work | |
| 63 | −1b) moved tuner and demod stuff from flexcop-pci.c to flexcop-tuner-fe.c | |
| 64 | −1c) moved lnb and diseqc stuff from flexcop-pci.c to flexcop-tuner-fe.c | |
| 65 | −1e) eeprom (reading MAC address) | |
| 66 | −1d) sram (no dynamic sll size detection (commented out) (using default as JJ told me)) | |
| 67 | −1f) misc. register accesses for reading parameters (e.g. resetting, revision) | |
| 68 | −1g) pid/mac filter (flexcop-hw-filter.c) | |
| 69 | −1i) dvb-stuff initialization in flexcop.c (done) | |
| 70 | −1h) dma stuff (now just using the size-irq, instead of all-together, to be done) | |
| 71 | −1j) remove flexcop initialization from flexcop-pci.c completely (done) | |
| 72 | −1l) use a well working dma IRQ method (done, see 'Known bugs and problems and TODO') | |
| 73 | −1k) cleanup flexcop-files (remove unused EXPORT_SYMBOLs, make static from | |
| 74 | −non-static where possible, moved code to proper places) | |
| 75 | − | |
| 76 | −2) Search for errors in the leftover of flexcop-pci.c (partially done) | |
| 77 | −5a) add MAC address reading | |
| 78 | −5c) feeding of ISOC data to the software demux (format of the isochronous data | |
| 79 | −and speed optimization, no real error) (thanks to Vadim Catana) | |
| 80 | − | |
| 81 | −What to do in the near future? | |
| 82 | −-------------------------------------- | |
| 83 | −(no special order here) | |
| 84 | − | |
| 85 | −5) USB driver | |
| 86 | −5b) optimize isoc-transfer (submitting/killing isoc URBs when transfer is starting) | |
| 87 | − | |
| 88 | −Testing changes | |
| 89 | −--------------- | |
| 90 | − | |
| 91 | −O = item is working | |
| 92 | −P = item is partially working | |
| 93 | −X = item is not working | |
| 94 | −N = item does not apply here | |
| 95 | −<empty field> = item need to be examined | |
| 96 | − | |
| 97 | − | PCI | USB | |
| 98 | −item | mt352 | nxt2002 | stv0299 | mt312 | mt352 | nxt2002 | stv0299 | mt312 | |
| 99 | −-------+-------+---------+---------+-------+-------+---------+---------+------- | |
| 100 | −1a) | O | | | | N | N | N | N | |
| 101 | −1b) | O | | | | | | O | | |
| 102 | −1c) | N | N | | | N | N | O | | |
| 103 | −1d) | O | O | |
| 104 | −1e) | O | O | |
| 105 | −1f) | P | |
| 106 | −1g) | O | |
| 107 | −1h) | P | | |
| 108 | −1i) | O | N | |
| 109 | −1j) | O | N | |
| 110 | −1l) | O | N | |
| 111 | −2) | O | N | |
| 112 | −5a) | N | O | |
| 113 | −5b)* | N | | |
| 114 | −5c) | N | O | |
| 115 | − | |
| 116 | −* - not done yet | |
| 117 | − | |
| 118 | −Known bugs and problems and TODO | |
| 119 | −-------------------------------- | |
| 120 | − | |
| 121 | −1g/h/l) when pid filtering is enabled on the pci card | |
| 122 | − | |
| 123 | −DMA usage currently: | |
| 124 | − The DMA is splitted in 2 equal-sized subbuffers. The Flexcop writes to first | |
| 125 | − address and triggers an IRQ when it's full and starts writing to the second | |
| 126 | − address. When the second address is full, the IRQ is triggered again, and | |
| 127 | − the flexcop writes to first address again, and so on. | |
| 128 | − The buffersize of each address is currently 640*188 bytes. | |
| 129 | − | |
| 130 | − Problem is, when using hw-pid-filtering and doing some low-bandwidth | |
| 131 | − operation (like scanning) the buffers won't be filled enough to trigger | |
| 132 | − the IRQ. That's why: | |
| 133 | − | |
| 134 | − When PID filtering is activated, the timer IRQ is used. Every 1.97 ms the IRQ | |
| 135 | − is triggered. Is the current write address of DMA1 different to the one | |
| 136 | − during the last IRQ, then the data is passed to the demuxer. | |
| 137 | − | |
| 138 | − There is an additional DMA-IRQ-method: packet count IRQ. This isn't | |
| 139 | − implemented correctly yet. | |
| 140 | − | |
| 141 | − The solution is to disable HW PID filtering, but I don't know how the DVB | |
| 142 | − API software demux behaves on slow systems with 45MBit/s TS. | |
| 143 | − | |
| 144 | −Solved bugs :) | |
| 145 | −-------------- | |
| 146 | −1g) pid-filtering (somehow pid index 4 and 5 (EMM_PID and ECM_PID) aren't | |
| 147 | −working) | |
| 148 | −SOLUTION: also index 0 was affected, because net_translation is done for | |
| 149 | −these indexes by default | |
| 150 | − | |
| 151 | −5b) isochronous transfer does only work in the first attempt (for the Sky2PC | |
| 152 | −USB, Air2PC is working) SOLUTION: the flexcop was going asleep and never really | |
| 153 | −woke up again (don't know if this need fixes, see | |
| 154 | −flexcop-fe-tuner.c:flexcop_sleep) | |
| 155 | − | |
| 156 | −NEWS: when the driver is loaded and unloaded and loaded again (w/o doing | |
| 157 | −anything in the while the driver is loaded the first time), no transfers take | |
| 158 | −place anymore. | |
| 159 | − | |
| 160 | −Improvements when rewriting (refactoring) is done | |
| 161 | −================================================= | |
| 162 | − | |
| 163 | −- split sleeping of the flexcop (misc_204.ACPI3_sig = 1;) from lnb_control | |
| 164 | − (enable sleeping for other demods than dvb-s) | |
| 165 | −- add support for CableStar (stv0297 Microtune 203x/ALPS) (almost done, incompatibilities with the Nexus-CA) | |
| 166 | − | |
| 167 | −Debugging | |
| 168 | −--------- | |
| 169 | −- add verbose debugging to skystar2.c (dump the reg_dw_data) and compare it | |
| 170 | − with this flexcop, this is important, because i2c is now using the | |
| 171 | − flexcop_ibi_value union from flexcop-reg.h (do you have a better idea for | |
| 172 | − that, please tell us so). | |
| 173 | − | |
| 174 | −Everything which is identical in the following table, can be put into a common | |
| 175 | −flexcop-module. | |
| 176 | − | |
| 177 | − PCI USB | |
| 178 | −------------------------------------------------------------------------------- | |
| 179 | −Different: | |
| 180 | −Register access: accessing IO memory USB control message | |
| 181 | −I2C bus: I2C bus of the FC USB control message | |
| 182 | −Data transfer: DMA isochronous transfer | |
| 183 | −EEPROM transfer: through i2c bus not clear yet | |
| 184 | − | |
| 185 | −Identical: | |
| 186 | −Streaming: accessing registers | |
| 187 | −PID Filtering: accessing registers | |
| 188 | −Sram destinations: accessing registers | |
| 189 | −Tuner/Demod: I2C bus | |
| 190 | −DVB-stuff: can be written for common use | |
| 191 | − | |
| 192 | −Acknowledgements (just for the rewriting part) | |
| 193 | −================ | |
| 194 | − | |
| 195 | −Bjarne Steinsbo thought a lot in the first place of the pci part for this code | |
| 196 | −sharing idea. | |
| 197 | − | |
| 198 | −Andreas Oberritter for providing a recent PCI initialization template | |
| 199 | −(pluto2.c). | |
| 200 | − | |
| 201 | −Boleslaw Ciesielski for pointing out a problem with firmware loader. | |
| 202 | − | |
| 203 | −Vadim Catana for correcting the USB transfer. | |
| 204 | − | |
| 205 | −comments, critics and ideas to linux-dvb@linuxtv.org. | |
| @@ -1,5 +1,5 @@ | ||
| 1 | −How to set up the Technisat devices | |
| 2 | −=================================== | |
| 1 | +How to set up the Technisat/B2C2 Flexcop devices | |
| 2 | +================================================ | |
| 3 | 3 | |
| 4 | 4 | 1) Find out what device you have |
| 5 | 5 | ================================ |
| @@ -16,54 +16,60 @@ DVB: registering frontend 0 (Conexant CX24123/CX24109)... · 10 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | If the Technisat is the only TV device in your box get rid of unnecessary modules and check this one: |
| 18 | 18 | "Multimedia devices" => "Customise analog and hybrid tuner modules to build" |
| 19 | −In this directory uncheck every driver which is activated there. | |
| 19 | +In this directory uncheck every driver which is activated there (except "Simple tuner support" for case 9 only). | |
| 20 | 20 | |
| 21 | 21 | Then please activate: |
| 22 | 22 | 2a) Main module part: |
| 23 | 23 | |
| 24 | 24 | a.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" |
| 25 | −b.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Technisat/B2C2 Air/Sky/Cable2PC PCI" in case of a PCI card OR | |
| 25 | +b.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Technisat/B2C2 Air/Sky/Cable2PC PCI" in case of a PCI card | |
| 26 | +OR | |
| 26 | 27 | c.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Technisat/B2C2 Air/Sky/Cable2PC USB" in case of an USB 1.1 adapter |
| 27 | 28 | d.)"Multimedia devices" => "DVB/ATSC adapters" => "Technisat/B2C2 FlexcopII(b) and FlexCopIII adapters" => "Enable debug for the B2C2 FlexCop drivers" |
| 28 | 29 | Notice: d.) is helpful for troubleshooting |
| 29 | 30 | |
| 30 | 31 | 2b) Frontend module part: |
| 31 | 32 | |
| 32 | −1.) Revision 2.3: | |
| 33 | +1.) SkyStar DVB-S Revision 2.3: | |
| 33 | 34 | a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" |
| 34 | 35 | b.)"Multimedia devices" => "Customise DVB frontends" => "Zarlink VP310/MT312/ZL10313 based" |
| 35 | 36 | |
| 36 | −2.) Revision 2.6: | |
| 37 | +2.) SkyStar DVB-S Revision 2.6: | |
| 37 | 38 | a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" |
| 38 | 39 | b.)"Multimedia devices" => "Customise DVB frontends" => "ST STV0299 based" |
| 39 | 40 | |
| 40 | −3.) Revision 2.7: | |
| 41 | +3.) SkyStar DVB-S Revision 2.7: | |
| 41 | 42 | a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" |
| 42 | 43 | b.)"Multimedia devices" => "Customise DVB frontends" => "Samsung S5H1420 based" |
| 43 | 44 | c.)"Multimedia devices" => "Customise DVB frontends" => "Integrant ITD1000 Zero IF tuner for DVB-S/DSS" |
| 44 | 45 | d.)"Multimedia devices" => "Customise DVB frontends" => "ISL6421 SEC controller" |
| 45 | 46 | |
| 46 | −4.) Revision 2.8: | |
| 47 | +4.) SkyStar DVB-S Revision 2.8: | |
| 47 | 48 | a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" |
| 48 | 49 | b.)"Multimedia devices" => "Customise DVB frontends" => "Conexant CX24113/CX24128 tuner for DVB-S/DSS" |
| 49 | 50 | c.)"Multimedia devices" => "Customise DVB frontends" => "Conexant CX24123 based" |
| 50 | 51 | d.)"Multimedia devices" => "Customise DVB frontends" => "ISL6421 SEC controller" |
| 51 | 52 | |
| 52 | −5.) DVB-T card: | |
| 53 | +5.) AirStar DVB-T card: | |
| 53 | 54 | a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" |
| 54 | 55 | b.)"Multimedia devices" => "Customise DVB frontends" => "Zarlink MT352 based" |
| 55 | 56 | |
| 56 | −6.) DVB-C card: | |
| 57 | +6.) CableStar DVB-C card: | |
| 57 | 58 | a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" |
| 58 | 59 | b.)"Multimedia devices" => "Customise DVB frontends" => "ST STV0297 based" |
| 59 | 60 | |
| 60 | −7.) ATSC card 1st generation: | |
| 61 | +7.) AirStar ATSC card 1st generation: | |
| 61 | 62 | a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" |
| 62 | 63 | b.)"Multimedia devices" => "Customise DVB frontends" => "Broadcom BCM3510" |
| 63 | 64 | |
| 64 | −8.) ATSC card 2nd generation: | |
| 65 | +8.) AirStar ATSC card 2nd generation: | |
| 65 | 66 | a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" |
| 66 | 67 | b.)"Multimedia devices" => "Customise DVB frontends" => "NxtWave Communications NXT2002/NXT2004 based" |
| 67 | −c.)"Multimedia devices" => "Customise DVB frontends" => "LG Electronics LGDT3302/LGDT3303 based" | |
| 68 | +c.)"Multimedia devices" => "Customise DVB frontends" => "Generic I2C PLL based tuners" | |
| 68 | 69 | |
| 69 | −Author: Uwe Bugla <uwe.bugla@gmx.de> December 2008 | |
| 70 | +9.) AirStar ATSC card 3rd generation: | |
| 71 | +a.)"Multimedia devices" => "Customise DVB frontends" => "Customise the frontend modules to build" | |
| 72 | +b.)"Multimedia devices" => "Customise DVB frontends" => "LG Electronics LGDT3302/LGDT3303 based" | |
| 73 | +c.)"Multimedia devices" => "Customise analog and hybrid tuner modules to build" => "Simple tuner support" | |
| 74 | + | |
| 75 | +Author: Uwe Bugla <uwe.bugla@gmx.de> February 2009 | |
| @@ -868,8 +868,10 @@ and is between 256 and 4096 characters. It is defined in the file · 867 unmodified lines | ||
| 868 | 868 | icn= [HW,ISDN] |
| 869 | 869 | Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]] |
| 870 | 870 | |
| 871 | − ide= [HW] (E)IDE subsystem | |
| 872 | − Format: ide=nodma or ide=doubler | |
| 871 | + ide-core.nodma= [HW] (E)IDE subsystem | |
| 872 | + Format: =0.0 to prevent dma on hda, =0.1 hdb =1.0 hdc | |
| 873 | + .vlb_clock .pci_clock .noflush .noprobe .nowerr .cdrom | |
| 874 | + .chs .ignore_cable are additional options | |
| 873 | 875 | See Documentation/ide/ide.txt. |
| 874 | 876 | |
| 875 | 877 | idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed |
| @@ -311,6 +311,9 @@ evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c) · 310 unmodified lines | ||
| 311 | 311 | gpio_request(gpio + 7, "nCF_SEL"); |
| 312 | 312 | gpio_direction_output(gpio + 7, 1); |
| 313 | 313 | |
| 314 | + /* irlml6401 sustains over 3A, switches 5V in under 8 msec */ | |
| 315 | + setup_usb(500, 8); | |
| 316 | + | |
| 314 | 317 | return 0; |
| 315 | 318 | } |
| 316 | 319 | |
| @@ -417,9 +420,6 @@ static __init void davinci_evm_init(void) · 100 unmodified lines | ||
| 417 | 420 | platform_add_devices(davinci_evm_devices, |
| 418 | 421 | ARRAY_SIZE(davinci_evm_devices)); |
| 419 | 422 | evm_init_i2c(); |
| 420 | − | |
| 421 | − /* irlml6401 sustains over 3A, switches 5V in under 8 msec */ | |
| 422 | − setup_usb(500, 8); | |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | static __init void davinci_evm_irq_init(void) |
| @@ -230,6 +230,11 @@ static struct clk davinci_clks[] = { · 229 unmodified lines | ||
| 230 | 230 | .rate = &commonrate, |
| 231 | 231 | .lpsc = DAVINCI_LPSC_GPIO, |
| 232 | 232 | }, |
| 233 | + { | |
| 234 | + .name = "usb", | |
| 235 | + .rate = &commonrate, | |
| 236 | + .lpsc = DAVINCI_LPSC_USB, | |
| 237 | + }, | |
| 233 | 238 | { |
| 234 | 239 | .name = "AEMIFCLK", |
| 235 | 240 | .rate = &commonrate, |
| @@ -47,6 +47,7 @@ static struct musb_hdrc_platform_data usb_data = { · 46 unmodified lines | ||
| 47 | 47 | #elif defined(CONFIG_USB_MUSB_HOST) |
| 48 | 48 | .mode = MUSB_HOST, |
| 49 | 49 | #endif |
| 50 | + .clock = "usb", | |
| 50 | 51 | .config = &musb_config, |
| 51 | 52 | }; |
| 52 | 53 | |
| @@ -638,6 +638,17 @@ config DMAR · 637 unmodified lines | ||
| 638 | 638 | and include PCI device scope covered by these DMA |
| 639 | 639 | remapping devices. |
| 640 | 640 | |
| 641 | +config DMAR_DEFAULT_ON | |
| 642 | + def_bool y | |
| 643 | + prompt "Enable DMA Remapping Devices by default" | |
| 644 | + depends on DMAR | |
| 645 | + help | |
| 646 | + Selecting this option will enable a DMAR device at boot time if | |
| 647 | + one is found. If this option is not selected, DMAR support can | |
| 648 | + be enabled by passing intel_iommu=on to the kernel. It is | |
| 649 | + recommended you say N here while the DMAR code remains | |
| 650 | + experimental. | |
| 651 | + | |
| 641 | 652 | endmenu |
| 642 | 653 | |
| 643 | 654 | endif |
| @@ -507,7 +507,7 @@ static int iosapic_find_sharable_irq(unsigned long trigger, unsigned long pol) · 506 unmodified lines | ||
| 507 | 507 | if (trigger == IOSAPIC_EDGE) |
| 508 | 508 | return -EINVAL; |
| 509 | 509 | |
| 510 | − for (i = 0; i <= NR_IRQS; i++) { | |
| 510 | + for (i = 0; i < NR_IRQS; i++) { | |
| 511 | 511 | info = &iosapic_intr_info[i]; |
| 512 | 512 | if (info->trigger == trigger && info->polarity == pol && |
| 513 | 513 | (info->dmode == IOSAPIC_FIXED || |
| @@ -2149,7 +2149,7 @@ unw_remove_unwind_table (void *handle) · 2148 unmodified lines | ||
| 2149 | 2149 | |
| 2150 | 2150 | /* next, remove hash table entries for this table */ |
| 2151 | 2151 | |
| 2152 | − for (index = 0; index <= UNW_HASH_SIZE; ++index) { | |
| 2152 | + for (index = 0; index < UNW_HASH_SIZE; ++index) { | |
| 2153 | 2153 | tmp = unw.cache + unw.hash[index]; |
| 2154 | 2154 | if (unw.hash[index] >= UNW_CACHE_SIZE |
| 2155 | 2155 | || tmp->ip < table->start || tmp->ip >= table->end) |
| @@ -603,7 +603,7 @@ config CAVIUM_OCTEON_SIMULATOR · 602 unmodified lines | ||
| 603 | 603 | select SYS_SUPPORTS_64BIT_KERNEL |
| 604 | 604 | select SYS_SUPPORTS_BIG_ENDIAN |
| 605 | 605 | select SYS_SUPPORTS_HIGHMEM |
| 606 | − select CPU_CAVIUM_OCTEON | |
| 606 | + select SYS_HAS_CPU_CAVIUM_OCTEON | |
| 607 | 607 | help |
| 608 | 608 | The Octeon simulator is software performance model of the Cavium |
| 609 | 609 | Octeon Processor. It supports simulating Octeon processors on x86 |
| @@ -618,7 +618,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD · 8 unmodified lines | ||
| 618 | 618 | select SYS_SUPPORTS_BIG_ENDIAN |
| 619 | 619 | select SYS_SUPPORTS_HIGHMEM |
| 620 | 620 | select SYS_HAS_EARLY_PRINTK |
| 621 | − select CPU_CAVIUM_OCTEON | |
| 621 | + select SYS_HAS_CPU_CAVIUM_OCTEON | |
| 622 | 622 | select SWAP_IO_SPACE |
| 623 | 623 | help |
| 624 | 624 | This option supports all of the Octeon reference boards from Cavium |
| @@ -1234,6 +1234,7 @@ config CPU_SB1 · 609 unmodified lines | ||
| 1234 | 1234 | |
| 1235 | 1235 | config CPU_CAVIUM_OCTEON |
| 1236 | 1236 | bool "Cavium Octeon processor" |
| 1237 | + depends on SYS_HAS_CPU_CAVIUM_OCTEON | |
| 1237 | 1238 | select IRQ_CPU |
| 1238 | 1239 | select IRQ_CPU_OCTEON |
| 1239 | 1240 | select CPU_HAS_PREFETCH |
| @@ -1314,6 +1315,9 @@ config SYS_HAS_CPU_RM9000 · 74 unmodified lines | ||
| 1314 | 1315 | config SYS_HAS_CPU_SB1 |
| 1315 | 1316 | bool |
| 1316 | 1317 | |
| 1318 | +config SYS_HAS_CPU_CAVIUM_OCTEON | |
| 1319 | + bool | |
| 1320 | + | |
| 1317 | 1321 | # |
| 1318 | 1322 | # CPU may reorder R->R, R->W, W->R, W->W |
| 1319 | 1323 | # Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC |
| @@ -1387,6 +1391,7 @@ config 32BIT · 67 unmodified lines | ||
| 1387 | 1391 | config 64BIT |
| 1388 | 1392 | bool "64-bit kernel" |
| 1389 | 1393 | depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL |
| 1394 | + select HAVE_SYSCALL_WRAPPERS | |
| 1390 | 1395 | help |
| 1391 | 1396 | Select this option if you want to build a 64-bit kernel. |
| 1392 | 1397 | |
| @@ -118,7 +118,7 @@ void __init plat_time_init(void) · 117 unmodified lines | ||
| 118 | 118 | * setup counter 1 (RTC) to tick at full speed |
| 119 | 119 | */ |
| 120 | 120 | t = 0xffffff; |
| 121 | − while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S) && t--) | |
| 121 | + while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S) && --t) | |
| 122 | 122 | asm volatile ("nop"); |
| 123 | 123 | if (!t) |
| 124 | 124 | goto cntr_err; |
| @@ -127,7 +127,7 @@ void __init plat_time_init(void) · 2 unmodified lines | ||
| 127 | 127 | au_sync(); |
| 128 | 128 | |
| 129 | 129 | t = 0xffffff; |
| 130 | − while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && t--) | |
| 130 | + while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t) | |
| 131 | 131 | asm volatile ("nop"); |
| 132 | 132 | if (!t) |
| 133 | 133 | goto cntr_err; |
| @@ -135,7 +135,7 @@ void __init plat_time_init(void) · 1 unmodified line | ||
| 135 | 135 | au_sync(); |
| 136 | 136 | |
| 137 | 137 | t = 0xffffff; |
| 138 | − while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && t--) | |
| 138 | + while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t) | |
| 139 | 139 | asm volatile ("nop"); |
| 140 | 140 | if (!t) |
| 141 | 141 | goto cntr_err; |
| @@ -111,7 +111,6 @@ int show_interrupts(struct seq_file *p, void *v) · 110 unmodified lines | ||
| 111 | 111 | seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); |
| 112 | 112 | #endif |
| 113 | 113 | seq_printf(p, " %14s", irq_desc[i].chip->name); |
| 114 | − seq_printf(p, "-%-8s", irq_desc[i].name); | |
| 115 | 114 | seq_printf(p, " %s", action->name); |
| 116 | 115 | |
| 117 | 116 | for (action=action->next; action; action = action->next) |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | #include <linux/module.h> |
| 33 | 33 | #include <linux/binfmts.h> |
| 34 | 34 | #include <linux/security.h> |
| 35 | +#include <linux/syscalls.h> | |
| 35 | 36 | #include <linux/compat.h> |
| 36 | 37 | #include <linux/vfs.h> |
| 37 | 38 | #include <linux/ipc.h> |
| @@ -63,9 +64,9 @@ · 25 unmodified lines | ||
| 63 | 64 | #define merge_64(r1, r2) ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL)) |
| 64 | 65 | #endif |
| 65 | 66 | |
| 66 | −asmlinkage unsigned long | |
| 67 | −sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot, | |
| 68 | − unsigned long flags, unsigned long fd, unsigned long pgoff) | |
| 67 | +SYSCALL_DEFINE6(32_mmap2, unsigned long, addr, unsigned long, len, | |
| 68 | + unsigned long, prot, unsigned long, flags, unsigned long, fd, | |
| 69 | + unsigned long, pgoff) | |
| 69 | 70 | { |
| 70 | 71 | struct file * file = NULL; |
| 71 | 72 | unsigned long error; |
| @@ -121,21 +122,21 @@ struct rlimit32 { · 49 unmodified lines | ||
| 121 | 122 | int rlim_max; |
| 122 | 123 | }; |
| 123 | 124 | |
| 124 | −asmlinkage long sys32_truncate64(const char __user * path, | |
| 125 | − unsigned long __dummy, int a2, int a3) | |
| 125 | +SYSCALL_DEFINE4(32_truncate64, const char __user *, path, | |
| 126 | + unsigned long, __dummy, unsigned long, a2, unsigned long, a3) | |
| 126 | 127 | { |
| 127 | 128 | return sys_truncate(path, merge_64(a2, a3)); |
| 128 | 129 | } |
| 129 | 130 | |
| 130 | −asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long __dummy, | |
| 131 | − int a2, int a3) | |
| 131 | +SYSCALL_DEFINE4(32_ftruncate64, unsigned long, fd, unsigned long, __dummy, | |
| 132 | + unsigned long, a2, unsigned long, a3) | |
| 132 | 133 | { |
| 133 | 134 | return sys_ftruncate(fd, merge_64(a2, a3)); |
| 134 | 135 | } |
| 135 | 136 | |
| 136 | −asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, | |
| 137 | − unsigned int offset_low, loff_t __user * result, | |
| 138 | − unsigned int origin) | |
| 137 | +SYSCALL_DEFINE5(32_llseek, unsigned long, fd, unsigned long, offset_high, | |
| 138 | + unsigned long, offset_low, loff_t __user *, result, | |
| 139 | + unsigned long, origin) | |
| 139 | 140 | { |
| 140 | 141 | return sys_llseek(fd, offset_high, offset_low, result, origin); |
| 141 | 142 | } |
| @@ -144,20 +145,20 @@ asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, · 2 unmodified lines | ||
| 144 | 145 | lseek back to original location. They fail just like lseek does on |
| 145 | 146 | non-seekable files. */ |
| 146 | 147 | |
| 147 | −asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf, | |
| 148 | − size_t count, u32 unused, u64 a4, u64 a5) | |
| 148 | +SYSCALL_DEFINE6(32_pread, unsigned long, fd, char __user *, buf, size_t, count, | |
| 149 | + unsigned long, unused, unsigned long, a4, unsigned long, a5) | |
| 149 | 150 | { |
| 150 | 151 | return sys_pread64(fd, buf, count, merge_64(a4, a5)); |
| 151 | 152 | } |
| 152 | 153 | |
| 153 | −asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf, | |
| 154 | − size_t count, u32 unused, u64 a4, u64 a5) | |
| 154 | +SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf, | |
| 155 | + size_t, count, u32, unused, u64, a4, u64, a5) | |
| 155 | 156 | { |
| 156 | 157 | return sys_pwrite64(fd, buf, count, merge_64(a4, a5)); |
| 157 | 158 | } |
| 158 | 159 | |
| 159 | −asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, | |
| 160 | − struct compat_timespec __user *interval) | |
| 160 | +SYSCALL_DEFINE2(32_sched_rr_get_interval, compat_pid_t, pid, | |
| 161 | + struct compat_timespec __user *, interval) | |
| 161 | 162 | { |
| 162 | 163 | struct timespec t; |
| 163 | 164 | int ret; |
| @@ -174,8 +175,8 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, · 10 unmodified lines | ||
| 174 | 175 | |
| 175 | 176 | #ifdef CONFIG_SYSVIPC |
| 176 | 177 | |
| 177 | −asmlinkage long | |
| 178 | −sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth) | |
| 178 | +SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third, | |
| 179 | + unsigned long, ptr, unsigned long, fifth) | |
| 179 | 180 | { |
| 180 | 181 | int version, err; |
| 181 | 182 | |
| @@ -233,8 +234,8 @@ sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth) · 51 unmodified lines | ||
| 233 | 234 | |
| 234 | 235 | #else |
| 235 | 236 | |
| 236 | −asmlinkage long | |
| 237 | −sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth) | |
| 237 | +SYSCALL_DEFINE6(32_ipc, u32, call, int, first, int, second, int, third, | |
| 238 | + u32, ptr, u32 fifth) | |
| 238 | 239 | { |
| 239 | 240 | return -ENOSYS; |
| 240 | 241 | } |
| @@ -242,7 +243,7 @@ sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth) · 1 unmodified line | ||
| 242 | 243 | #endif /* CONFIG_SYSVIPC */ |
| 243 | 244 | |
| 244 | 245 | #ifdef CONFIG_MIPS32_N32 |
| 245 | −asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg) | |
| 246 | +SYSCALL_DEFINE4(n32_semctl, int, semid, int, semnum, int, cmd, u32, arg) | |
| 246 | 247 | { |
| 247 | 248 | /* compat_sys_semctl expects a pointer to union semun */ |
| 248 | 249 | u32 __user *uptr = compat_alloc_user_space(sizeof(u32)); |
| @@ -251,13 +252,14 @@ asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg) · 2 unmodified lines | ||
| 251 | 252 | return compat_sys_semctl(semid, semnum, cmd, uptr); |
| 252 | 253 | } |
| 253 | 254 | |
| 254 | −asmlinkage long sysn32_msgsnd(int msqid, u32 msgp, unsigned msgsz, int msgflg) | |
| 255 | +SYSCALL_DEFINE4(n32_msgsnd, int, msqid, u32, msgp, unsigned int, msgsz, | |
| 256 | + int, msgflg) | |
| 255 | 257 | { |
| 256 | 258 | return compat_sys_msgsnd(msqid, msgsz, msgflg, compat_ptr(msgp)); |
| 257 | 259 | } |
| 258 | 260 | |
| 259 | −asmlinkage long sysn32_msgrcv(int msqid, u32 msgp, size_t msgsz, int msgtyp, | |
| 260 | − int msgflg) | |
| 261 | +SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz, | |
| 262 | + int, msgtyp, int, msgflg) | |
| 261 | 263 | { |
| 262 | 264 | return compat_sys_msgrcv(msqid, msgsz, msgtyp, msgflg, IPC_64, |
| 263 | 265 | compat_ptr(msgp)); |
| @@ -277,7 +279,7 @@ struct sysctl_args32 · 13 unmodified lines | ||
| 277 | 279 | |
| 278 | 280 | #ifdef CONFIG_SYSCTL_SYSCALL |
| 279 | 281 | |
| 280 | −asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args) | |
| 282 | +SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args) | |
| 281 | 283 | { |
| 282 | 284 | struct sysctl_args32 tmp; |
| 283 | 285 | int error; |
| @@ -316,9 +318,16 @@ asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args) · 32 unmodified lines | ||
| 316 | 318 | return error; |
| 317 | 319 | } |
| 318 | 320 | |
| 321 | +#else | |
| 322 | + | |
| 323 | +SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args) | |
| 324 | +{ | |
| 325 | + return -ENOSYS; | |
| 326 | +} | |
| 327 | + | |
| 319 | 328 | #endif /* CONFIG_SYSCTL_SYSCALL */ |
| 320 | 329 | |
| 321 | −asmlinkage long sys32_newuname(struct new_utsname __user * name) | |
| 330 | +SYSCALL_DEFINE1(32_newuname, struct new_utsname __user *, name) | |
| 322 | 331 | { |
| 323 | 332 | int ret = 0; |
| 324 | 333 | |
| @@ -334,7 +343,7 @@ asmlinkage long sys32_newuname(struct new_utsname __user * name) · 9 unmodified lines | ||
| 334 | 343 | return ret; |
| 335 | 344 | } |
| 336 | 345 | |
| 337 | −asmlinkage int sys32_personality(unsigned long personality) | |
| 346 | +SYSCALL_DEFINE1(32_personality, unsigned long, personality) | |
| 338 | 347 | { |
| 339 | 348 | int ret; |
| 340 | 349 | personality &= 0xffffffff; |
| @@ -357,7 +366,7 @@ struct ustat32 { · 16 unmodified lines | ||
| 357 | 366 | |
| 358 | 367 | extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf); |
| 359 | 368 | |
| 360 | −asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32) | |
| 369 | +SYSCALL_DEFINE2(32_ustat, dev_t, dev, struct ustat32 __user *, ubuf32) | |
| 361 | 370 | { |
| 362 | 371 | int err; |
| 363 | 372 | struct ustat tmp; |
| @@ -381,8 +390,8 @@ out: · 17 unmodified lines | ||
| 381 | 390 | return err; |
| 382 | 391 | } |
| 383 | 392 | |
| 384 | −asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, | |
| 385 | − s32 count) | |
| 393 | +SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd, | |
| 394 | + compat_off_t __user *, offset, s32, count) | |
| 386 | 395 | { |
| 387 | 396 | mm_segment_t old_fs = get_fs(); |
| 388 | 397 | int ret; |
| @@ -399,7 +399,7 @@ einval: li v0, -ENOSYS · 398 unmodified lines | ||
| 399 | 399 | sys sys_swapon 2 |
| 400 | 400 | sys sys_reboot 3 |
| 401 | 401 | sys sys_old_readdir 3 |
| 402 | − sys old_mmap 6 /* 4090 */ | |
| 402 | + sys sys_mips_mmap 6 /* 4090 */ | |
| 403 | 403 | sys sys_munmap 2 |
| 404 | 404 | sys sys_truncate 2 |
| 405 | 405 | sys sys_ftruncate 2 |
| @@ -519,7 +519,7 @@ einval: li v0, -ENOSYS · 113 unmodified lines | ||
| 519 | 519 | sys sys_sendfile 4 |
| 520 | 520 | sys sys_ni_syscall 0 |
| 521 | 521 | sys sys_ni_syscall 0 |
| 522 | − sys sys_mmap2 6 /* 4210 */ | |
| 522 | + sys sys_mips_mmap2 6 /* 4210 */ | |
| 523 | 523 | sys sys_truncate64 4 |
| 524 | 524 | sys sys_ftruncate64 4 |
| 525 | 525 | sys sys_stat64 2 |
| @@ -207,7 +207,7 @@ sys_call_table: · 206 unmodified lines | ||
| 207 | 207 | PTR sys_newlstat |
| 208 | 208 | PTR sys_poll |
| 209 | 209 | PTR sys_lseek |
| 210 | − PTR old_mmap | |
| 210 | + PTR sys_mips_mmap | |
| 211 | 211 | PTR sys_mprotect /* 5010 */ |
| 212 | 212 | PTR sys_munmap |
| 213 | 213 | PTR sys_brk |
| @@ -129,12 +129,12 @@ EXPORT(sysn32_call_table) · 128 unmodified lines | ||
| 129 | 129 | PTR sys_newlstat |
| 130 | 130 | PTR sys_poll |
| 131 | 131 | PTR sys_lseek |
| 132 | − PTR old_mmap | |
| 132 | + PTR sys_mips_mmap | |
| 133 | 133 | PTR sys_mprotect /* 6010 */ |
| 134 | 134 | PTR sys_munmap |
| 135 | 135 | PTR sys_brk |
| 136 | − PTR sys32_rt_sigaction | |
| 137 | − PTR sys32_rt_sigprocmask | |
| 136 | + PTR sys_32_rt_sigaction | |
| 137 | + PTR sys_32_rt_sigprocmask | |
| 138 | 138 | PTR compat_sys_ioctl /* 6015 */ |
| 139 | 139 | PTR sys_pread64 |
| 140 | 140 | PTR sys_pwrite64 |
| @@ -159,7 +159,7 @@ EXPORT(sysn32_call_table) · 18 unmodified lines | ||
| 159 | 159 | PTR compat_sys_setitimer |
| 160 | 160 | PTR sys_alarm |
| 161 | 161 | PTR sys_getpid |
| 162 | − PTR sys32_sendfile | |
| 162 | + PTR sys_32_sendfile | |
| 163 | 163 | PTR sys_socket /* 6040 */ |
| 164 | 164 | PTR sys_connect |
| 165 | 165 | PTR sys_accept |
| @@ -181,14 +181,14 @@ EXPORT(sysn32_call_table) · 15 unmodified lines | ||
| 181 | 181 | PTR sys_exit |
| 182 | 182 | PTR compat_sys_wait4 |
| 183 | 183 | PTR sys_kill /* 6060 */ |
| 184 | − PTR sys32_newuname | |
| 184 | + PTR sys_32_newuname | |
| 185 | 185 | PTR sys_semget |
| 186 | 186 | PTR sys_semop |
| 187 | − PTR sysn32_semctl | |
| 187 | + PTR sys_n32_semctl | |
| 188 | 188 | PTR sys_shmdt /* 6065 */ |
| 189 | 189 | PTR sys_msgget |
| 190 | − PTR sysn32_msgsnd | |
| 191 | − PTR sysn32_msgrcv | |
| 190 | + PTR sys_n32_msgsnd | |
| 191 | + PTR sys_n32_msgrcv | |
| 192 | 192 | PTR compat_sys_msgctl |
| 193 | 193 | PTR compat_sys_fcntl /* 6070 */ |
| 194 | 194 | PTR sys_flock |
| @@ -245,15 +245,15 @@ EXPORT(sysn32_call_table) · 50 unmodified lines | ||
| 245 | 245 | PTR sys_getsid |
| 246 | 246 | PTR sys_capget |
| 247 | 247 | PTR sys_capset |
| 248 | − PTR sys32_rt_sigpending /* 6125 */ | |
| 248 | + PTR sys_32_rt_sigpending /* 6125 */ | |
| 249 | 249 | PTR compat_sys_rt_sigtimedwait |
| 250 | − PTR sys32_rt_sigqueueinfo | |
| 250 | + PTR sys_32_rt_sigqueueinfo | |
| 251 | 251 | PTR sysn32_rt_sigsuspend |
| 252 | 252 | PTR sys32_sigaltstack |
| 253 | 253 | PTR compat_sys_utime /* 6130 */ |
| 254 | 254 | PTR sys_mknod |
| 255 | − PTR sys32_personality | |
| 256 | − PTR sys32_ustat | |
| 255 | + PTR sys_32_personality | |
| 256 | + PTR sys_32_ustat | |
| 257 | 257 | PTR compat_sys_statfs |
| 258 | 258 | PTR compat_sys_fstatfs /* 6135 */ |
| 259 | 259 | PTR sys_sysfs |
| @@ -265,14 +265,14 @@ EXPORT(sysn32_call_table) · 5 unmodified lines | ||
| 265 | 265 | PTR sys_sched_getscheduler |
| 266 | 266 | PTR sys_sched_get_priority_max |
| 267 | 267 | PTR sys_sched_get_priority_min |
| 268 | − PTR sys32_sched_rr_get_interval /* 6145 */ | |
| 268 | + PTR sys_32_sched_rr_get_interval /* 6145 */ | |
| 269 | 269 | PTR sys_mlock |
| 270 | 270 | PTR sys_munlock |
| 271 | 271 | PTR sys_mlockall |
| 272 | 272 | PTR sys_munlockall |
| 273 | 273 | PTR sys_vhangup /* 6150 */ |
| 274 | 274 | PTR sys_pivot_root |
| 275 | − PTR sys32_sysctl | |
| 275 | + PTR sys_32_sysctl | |
| 276 | 276 | PTR sys_prctl |
| 277 | 277 | PTR compat_sys_adjtimex |
| 278 | 278 | PTR compat_sys_setrlimit /* 6155 */ |
| @@ -265,12 +265,12 @@ sys_call_table: · 264 unmodified lines | ||
| 265 | 265 | PTR sys_olduname |
| 266 | 266 | PTR sys_umask /* 4060 */ |
| 267 | 267 | PTR sys_chroot |
| 268 | − PTR sys32_ustat | |
| 268 | + PTR sys_32_ustat | |
| 269 | 269 | PTR sys_dup2 |
| 270 | 270 | PTR sys_getppid |
| 271 | 271 | PTR sys_getpgrp /* 4065 */ |
| 272 | 272 | PTR sys_setsid |
| 273 | − PTR sys32_sigaction | |
| 273 | + PTR sys_32_sigaction | |
| 274 | 274 | PTR sys_sgetmask |
| 275 | 275 | PTR sys_ssetmask |
| 276 | 276 | PTR sys_setreuid /* 4070 */ |
| @@ -293,7 +293,7 @@ sys_call_table: · 16 unmodified lines | ||
| 293 | 293 | PTR sys_swapon |
| 294 | 294 | PTR sys_reboot |
| 295 | 295 | PTR compat_sys_old_readdir |
| 296 | − PTR old_mmap /* 4090 */ | |
| 296 | + PTR sys_mips_mmap /* 4090 */ | |
| 297 | 297 | PTR sys_munmap |
| 298 | 298 | PTR sys_truncate |
| 299 | 299 | PTR sys_ftruncate |
| @@ -320,12 +320,12 @@ sys_call_table: · 20 unmodified lines | ||
| 320 | 320 | PTR compat_sys_wait4 |
| 321 | 321 | PTR sys_swapoff /* 4115 */ |
| 322 | 322 | PTR compat_sys_sysinfo |
| 323 | − PTR sys32_ipc | |
| 323 | + PTR sys_32_ipc | |
| 324 | 324 | PTR sys_fsync |
| 325 | 325 | PTR sys32_sigreturn |
| 326 | 326 | PTR sys32_clone /* 4120 */ |
| 327 | 327 | PTR sys_setdomainname |
| 328 | − PTR sys32_newuname | |
| 328 | + PTR sys_32_newuname | |
| 329 | 329 | PTR sys_ni_syscall /* sys_modify_ldt */ |
| 330 | 330 | PTR compat_sys_adjtimex |
| 331 | 331 | PTR sys_mprotect /* 4125 */ |
| @@ -339,11 +339,11 @@ sys_call_table: · 7 unmodified lines | ||
| 339 | 339 | PTR sys_fchdir |
| 340 | 340 | PTR sys_bdflush |
| 341 | 341 | PTR sys_sysfs /* 4135 */ |
| 342 | − PTR sys32_personality | |
| 342 | + PTR sys_32_personality | |
| 343 | 343 | PTR sys_ni_syscall /* for afs_syscall */ |
| 344 | 344 | PTR sys_setfsuid |
| 345 | 345 | PTR sys_setfsgid |
| 346 | − PTR sys32_llseek /* 4140 */ | |
| 346 | + PTR sys_32_llseek /* 4140 */ | |
| 347 | 347 | PTR compat_sys_getdents |
| 348 | 348 | PTR compat_sys_select |
| 349 | 349 | PTR sys_flock |
| @@ -356,7 +356,7 @@ sys_call_table: · 6 unmodified lines | ||
| 356 | 356 | PTR sys_ni_syscall /* 4150 */ |
| 357 | 357 | PTR sys_getsid |
| 358 | 358 | PTR sys_fdatasync |
| 359 | − PTR sys32_sysctl | |
| 359 | + PTR sys_32_sysctl | |
| 360 | 360 | PTR sys_mlock |
| 361 | 361 | PTR sys_munlock /* 4155 */ |
| 362 | 362 | PTR sys_mlockall |
| @@ -368,7 +368,7 @@ sys_call_table: · 5 unmodified lines | ||
| 368 | 368 | PTR sys_sched_yield |
| 369 | 369 | PTR sys_sched_get_priority_max |
| 370 | 370 | PTR sys_sched_get_priority_min |
| 371 | − PTR sys32_sched_rr_get_interval /* 4165 */ | |
| 371 | + PTR sys_32_sched_rr_get_interval /* 4165 */ | |
| 372 | 372 | PTR compat_sys_nanosleep |
| 373 | 373 | PTR sys_mremap |
| 374 | 374 | PTR sys_accept |
| @@ -397,25 +397,25 @@ sys_call_table: · 22 unmodified lines | ||
| 397 | 397 | PTR sys_getresgid |
| 398 | 398 | PTR sys_prctl |
| 399 | 399 | PTR sys32_rt_sigreturn |
| 400 | − PTR sys32_rt_sigaction | |
| 401 | − PTR sys32_rt_sigprocmask /* 4195 */ | |
| 402 | − PTR sys32_rt_sigpending | |
| 400 | + PTR sys_32_rt_sigaction | |
| 401 | + PTR sys_32_rt_sigprocmask /* 4195 */ | |
| 402 | + PTR sys_32_rt_sigpending | |
| 403 | 403 | PTR compat_sys_rt_sigtimedwait |
| 404 | − PTR sys32_rt_sigqueueinfo | |
| 404 | + PTR sys_32_rt_sigqueueinfo | |
| 405 | 405 | PTR sys32_rt_sigsuspend |
| 406 | − PTR sys32_pread /* 4200 */ | |
| 407 | − PTR sys32_pwrite | |
| 406 | + PTR sys_32_pread /* 4200 */ | |
| 407 | + PTR sys_32_pwrite | |
| 408 | 408 | PTR sys_chown |
| 409 | 409 | PTR sys_getcwd |
| 410 | 410 | PTR sys_capget |
| 411 | 411 | PTR sys_capset /* 4205 */ |
| 412 | 412 | PTR sys32_sigaltstack |
| 413 | − PTR sys32_sendfile | |
| 413 | + PTR sys_32_sendfile | |
| 414 | 414 | PTR sys_ni_syscall |
| 415 | 415 | PTR sys_ni_syscall |
| 416 | − PTR sys32_mmap2 /* 4210 */ | |
| 417 | − PTR sys32_truncate64 | |
| 418 | − PTR sys32_ftruncate64 | |
| 416 | + PTR sys_mips_mmap2 /* 4210 */ | |
| 417 | + PTR sys_32_truncate64 | |
| 418 | + PTR sys_32_ftruncate64 | |
| 419 | 419 | PTR sys_newstat |
| 420 | 420 | PTR sys_newlstat |
| 421 | 421 | PTR sys_newfstat /* 4215 */ |
| @@ -481,7 +481,7 @@ sys_call_table: · 59 unmodified lines | ||
| 481 | 481 | PTR compat_sys_mq_notify /* 4275 */ |
| 482 | 482 | PTR compat_sys_mq_getsetattr |
| 483 | 483 | PTR sys_ni_syscall /* sys_vserver */ |
| 484 | − PTR sys32_waitid | |
| 484 | + PTR sys_32_waitid | |
| 485 | 485 | PTR sys_ni_syscall /* available, was setaltroot */ |
| 486 | 486 | PTR sys_add_key /* 4280 */ |
| 487 | 487 | PTR sys_request_key |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <linux/ptrace.h> |
| 20 | 20 | #include <linux/unistd.h> |
| 21 | 21 | #include <linux/compiler.h> |
| 22 | +#include <linux/syscalls.h> | |
| 22 | 23 | #include <linux/uaccess.h> |
| 23 | 24 | |
| 24 | 25 | #include <asm/abi.h> |
| @@ -338,8 +339,8 @@ asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) · 313 unmodified lines | ||
| 338 | 339 | } |
| 339 | 340 | |
| 340 | 341 | #ifdef CONFIG_TRAD_SIGNALS |
| 341 | −asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act, | |
| 342 | − struct sigaction __user *oact) | |
| 342 | +SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act, | |
| 343 | + struct sigaction __user *, oact) | |
| 343 | 344 | { |
| 344 | 345 | struct k_sigaction new_ka, old_ka; |
| 345 | 346 | int ret; |
| @@ -349,8 +349,8 @@ asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) · 348 unmodified lines | ||
| 349 | 349 | return -ERESTARTNOHAND; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | −asmlinkage int sys32_sigaction(int sig, const struct sigaction32 __user *act, | |
| 353 | − struct sigaction32 __user *oact) | |
| 352 | +SYSCALL_DEFINE3(32_sigaction, long, sig, const struct sigaction32 __user *, act, | |
| 353 | + struct sigaction32 __user *, oact) | |
| 354 | 354 | { |
| 355 | 355 | struct k_sigaction new_ka, old_ka; |
| 356 | 356 | int ret; |
| @@ -704,9 +704,9 @@ struct mips_abi mips_abi_32 = { · 347 unmodified lines | ||
| 704 | 704 | .restart = __NR_O32_restart_syscall |
| 705 | 705 | }; |
| 706 | 706 | |
| 707 | −asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, | |
| 708 | − struct sigaction32 __user *oact, | |
| 709 | − unsigned int sigsetsize) | |
| 707 | +SYSCALL_DEFINE4(32_rt_sigaction, int, sig, | |
| 708 | + const struct sigaction32 __user *, act, | |
| 709 | + struct sigaction32 __user *, oact, unsigned int, sigsetsize) | |
| 710 | 710 | { |
| 711 | 711 | struct k_sigaction new_sa, old_sa; |
| 712 | 712 | int ret = -EINVAL; |
| @@ -748,8 +748,8 @@ out: · 35 unmodified lines | ||
| 748 | 748 | return ret; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | −asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, | |
| 752 | − compat_sigset_t __user *oset, unsigned int sigsetsize) | |
| 751 | +SYSCALL_DEFINE4(32_rt_sigprocmask, int, how, compat_sigset_t __user *, set, | |
| 752 | + compat_sigset_t __user *, oset, unsigned int, sigsetsize) | |
| 753 | 753 | { |
| 754 | 754 | sigset_t old_set, new_set; |
| 755 | 755 | int ret; |
| @@ -770,8 +770,8 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, · 14 unmodified lines | ||
| 770 | 770 | return ret; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | −asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset, | |
| 774 | − unsigned int sigsetsize) | |
| 773 | +SYSCALL_DEFINE2(32_rt_sigpending, compat_sigset_t __user *, uset, | |
| 774 | + unsigned int, sigsetsize) | |
| 775 | 775 | { |
| 776 | 776 | int ret; |
| 777 | 777 | sigset_t set; |
| @@ -787,7 +787,8 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset, · 9 unmodified lines | ||
| 787 | 787 | return ret; |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | −asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo) | |
| 790 | +SYSCALL_DEFINE3(32_rt_sigqueueinfo, int, pid, int, sig, | |
| 791 | + compat_siginfo_t __user *, uinfo) | |
| 791 | 792 | { |
| 792 | 793 | siginfo_t info; |
| 793 | 794 | int ret; |
| @@ -802,10 +803,9 @@ asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user * · 8 unmodified lines | ||
| 802 | 803 | return ret; |
| 803 | 804 | } |
| 804 | 805 | |
| 805 | −asmlinkage long | |
| 806 | −sys32_waitid(int which, compat_pid_t pid, | |
| 807 | − compat_siginfo_t __user *uinfo, int options, | |
| 808 | − struct compat_rusage __user *uru) | |
| 806 | +SYSCALL_DEFINE5(32_waitid, int, which, compat_pid_t, pid, | |
| 807 | + compat_siginfo_t __user *, uinfo, int, options, | |
| 808 | + struct compat_rusage __user *, uru) | |
| 809 | 809 | { |
| 810 | 810 | siginfo_t info; |
| 811 | 811 | struct rusage ru; |
| @@ -152,9 +152,9 @@ out: · 151 unmodified lines | ||
| 152 | 152 | return error; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | −asmlinkage unsigned long | |
| 156 | −old_mmap(unsigned long addr, unsigned long len, int prot, | |
| 157 | − int flags, int fd, off_t offset) | |
| 155 | +SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len, | |
| 156 | + unsigned long, prot, unsigned long, flags, unsigned long, | |
| 157 | + fd, off_t, offset) | |
| 158 | 158 | { |
| 159 | 159 | unsigned long result; |
| 160 | 160 | |
| @@ -168,9 +168,9 @@ out: · 7 unmodified lines | ||
| 168 | 168 | return result; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | −asmlinkage unsigned long | |
| 172 | −sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, | |
| 173 | − unsigned long flags, unsigned long fd, unsigned long pgoff) | |
| 171 | +SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len, | |
| 172 | + unsigned long, prot, unsigned long, flags, unsigned long, fd, | |
| 173 | + unsigned long, pgoff) | |
| 174 | 174 | { |
| 175 | 175 | if (pgoff & (~PAGE_MASK >> 12)) |
| 176 | 176 | return -EINVAL; |
| @@ -240,7 +240,7 @@ out: · 63 unmodified lines | ||
| 240 | 240 | /* |
| 241 | 241 | * Compacrapability ... |
| 242 | 242 | */ |
| 243 | −asmlinkage int sys_uname(struct old_utsname __user * name) | |
| 243 | +SYSCALL_DEFINE1(uname, struct old_utsname __user *, name) | |
| 244 | 244 | { |
| 245 | 245 | if (name && !copy_to_user(name, utsname(), sizeof (*name))) |
| 246 | 246 | return 0; |
| @@ -250,7 +250,7 @@ asmlinkage int sys_uname(struct old_utsname __user * name) · 3 unmodified lines | ||
| 250 | 250 | /* |
| 251 | 251 | * Compacrapability ... |
| 252 | 252 | */ |
| 253 | −asmlinkage int sys_olduname(struct oldold_utsname __user * name) | |
| 253 | +SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name) | |
| 254 | 254 | { |
| 255 | 255 | int error; |
| 256 | 256 | |
| @@ -279,7 +279,7 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name) · 22 unmodified lines | ||
| 279 | 279 | return error; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | −asmlinkage int sys_set_thread_area(unsigned long addr) | |
| 282 | +SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) | |
| 283 | 283 | { |
| 284 | 284 | struct thread_info *ti = task_thread_info(current); |
| 285 | 285 | |
| @@ -290,7 +290,7 @@ asmlinkage int sys_set_thread_area(unsigned long addr) · 4 unmodified lines | ||
| 290 | 290 | return 0; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | −asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) | |
| 293 | +asmlinkage int _sys_sysmips(long cmd, long arg1, long arg2, long arg3) | |
| 294 | 294 | { |
| 295 | 295 | switch (cmd) { |
| 296 | 296 | case MIPS_ATOMIC_SET: |
| @@ -325,8 +325,8 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) · 28 unmodified lines | ||
| 325 | 325 | * |
| 326 | 326 | * This is really horribly ugly. |
| 327 | 327 | */ |
| 328 | −asmlinkage int sys_ipc(unsigned int call, int first, int second, | |
| 329 | − unsigned long third, void __user *ptr, long fifth) | |
| 328 | +SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, int, second, | |
| 329 | + unsigned long, third, void __user *, ptr, long, fifth) | |
| 330 | 330 | { |
| 331 | 331 | int version, ret; |
| 332 | 332 | |
| @@ -411,7 +411,7 @@ asmlinkage int sys_ipc(unsigned int call, int first, int second, · 78 unmodified lines | ||
| 411 | 411 | /* |
| 412 | 412 | * No implemented yet ... |
| 413 | 413 | */ |
| 414 | −asmlinkage int sys_cachectl(char *addr, int nbytes, int op) | |
| 414 | +SYSCALL_DEFINE3(cachectl, char *, addr, int, nbytes, int, op) | |
| 415 | 415 | { |
| 416 | 416 | return -ENOSYS; |
| 417 | 417 | } |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/linkage.h> |
| 14 | 14 | #include <linux/module.h> |
| 15 | 15 | #include <linux/sched.h> |
| 16 | +#include <linux/syscalls.h> | |
| 16 | 17 | #include <linux/mm.h> |
| 17 | 18 | |
| 18 | 19 | #include <asm/cacheflush.h> |
| @@ -58,8 +59,8 @@ EXPORT_SYMBOL(_dma_cache_wback_inv); · 39 unmodified lines | ||
| 58 | 59 | * We could optimize the case where the cache argument is not BCACHE but |
| 59 | 60 | * that seems very atypical use ... |
| 60 | 61 | */ |
| 61 | −asmlinkage int sys_cacheflush(unsigned long addr, | |
| 62 | − unsigned long bytes, unsigned int cache) | |
| 62 | +SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, bytes, | |
| 63 | + unsigned int, cache) | |
| 63 | 64 | { |
| 64 | 65 | if (bytes == 0) |
| 65 | 66 | return 0; |
| @@ -367,27 +367,24 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr, · 366 unmodified lines | ||
| 367 | 367 | static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg, |
| 368 | 368 | unsigned int flags) |
| 369 | 369 | { |
| 370 | − char *ptr = (char *) ¤t->thread.TS_FPR(reg); | |
| 371 | − int i, ret; | |
| 370 | + char *ptr0 = (char *) ¤t->thread.TS_FPR(reg); | |
| 371 | + char *ptr1 = (char *) ¤t->thread.TS_FPR(reg+1); | |
| 372 | + int i, ret, sw = 0; | |
| 372 | 373 | |
| 373 | 374 | if (!(flags & F)) |
| 374 | 375 | return 0; |
| 375 | 376 | if (reg & 1) |
| 376 | 377 | return 0; /* invalid form: FRS/FRT must be even */ |
| 377 | − if (!(flags & SW)) { | |
| 378 | − /* not byte-swapped - easy */ | |
| 379 | − if (!(flags & ST)) | |
| 380 | − ret = __copy_from_user(ptr, addr, 16); | |
| 381 | − else | |
| 382 | − ret = __copy_to_user(addr, ptr, 16); | |
| 383 | − } else { | |
| 384 | − /* each FPR value is byte-swapped separately */ | |
| 385 | − ret = 0; | |
| 386 | − for (i = 0; i < 16; ++i) { | |
| 387 | − if (!(flags & ST)) | |
| 388 | − ret |= __get_user(ptr[i^7], addr + i); | |
| 389 | − else | |
| 390 | − ret |= __put_user(ptr[i^7], addr + i); | |
| 378 | + if (flags & SW) | |
| 379 | + sw = 7; | |
| 380 | + ret = 0; | |
| 381 | + for (i = 0; i < 8; ++i) { | |
| 382 | + if (!(flags & ST)) { | |
| 383 | + ret |= __get_user(ptr0[i^sw], addr + i); | |
| 384 | + ret |= __get_user(ptr1[i^sw], addr + i + 8); | |
| 385 | + } else { | |
| 386 | + ret |= __put_user(ptr0[i^sw], addr + i); | |
| 387 | + ret |= __put_user(ptr1[i^sw], addr + i + 8); | |
| 391 | 388 | } |
| 392 | 389 | } |
| 393 | 390 | if (ret) |
| @@ -62,18 +62,19 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 61 unmodified lines | ||
| 62 | 62 | 72: std r8,8(r3) |
| 63 | 63 | beq+ 3f |
| 64 | 64 | addi r3,r3,16 |
| 65 | −23: ld r9,8(r4) | |
| 66 | 65 | .Ldo_tail: |
| 67 | 66 | bf cr7*4+1,1f |
| 68 | − rotldi r9,r9,32 | |
| 67 | +23: lwz r9,8(r4) | |
| 68 | + addi r4,r4,4 | |
| 69 | 69 | 73: stw r9,0(r3) |
| 70 | 70 | addi r3,r3,4 |
| 71 | 71 | 1: bf cr7*4+2,2f |
| 72 | − rotldi r9,r9,16 | |
| 72 | +44: lhz r9,8(r4) | |
| 73 | + addi r4,r4,2 | |
| 73 | 74 | 74: sth r9,0(r3) |
| 74 | 75 | addi r3,r3,2 |
| 75 | 76 | 2: bf cr7*4+3,3f |
| 76 | − rotldi r9,r9,8 | |
| 77 | +45: lbz r9,8(r4) | |
| 77 | 78 | 75: stb r9,0(r3) |
| 78 | 79 | 3: li r3,0 |
| 79 | 80 | blr |
| @@ -141,11 +142,24 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 61 unmodified lines | ||
| 141 | 142 | 6: cmpwi cr1,r5,8 |
| 142 | 143 | addi r3,r3,32 |
| 143 | 144 | sld r9,r9,r10 |
| 144 | − ble cr1,.Ldo_tail | |
| 145 | + ble cr1,7f | |
| 145 | 146 | 34: ld r0,8(r4) |
| 146 | 147 | srd r7,r0,r11 |
| 147 | 148 | or r9,r7,r9 |
| 148 | − b .Ldo_tail | |
| 149 | +7: | |
| 150 | + bf cr7*4+1,1f | |
| 151 | + rotldi r9,r9,32 | |
| 152 | +94: stw r9,0(r3) | |
| 153 | + addi r3,r3,4 | |
| 154 | +1: bf cr7*4+2,2f | |
| 155 | + rotldi r9,r9,16 | |
| 156 | +95: sth r9,0(r3) | |
| 157 | + addi r3,r3,2 | |
| 158 | +2: bf cr7*4+3,3f | |
| 159 | + rotldi r9,r9,8 | |
| 160 | +96: stb r9,0(r3) | |
| 161 | +3: li r3,0 | |
| 162 | + blr | |
| 149 | 163 | |
| 150 | 164 | .Ldst_unaligned: |
| 151 | 165 | PPC_MTOCRF 0x01,r6 /* put #bytes to 8B bdry into cr7 */ |
| @@ -218,7 +232,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 66 unmodified lines | ||
| 218 | 232 | 121: |
| 219 | 233 | 132: |
| 220 | 234 | addi r3,r3,8 |
| 221 | −123: | |
| 222 | 235 | 134: |
| 223 | 236 | 135: |
| 224 | 237 | 138: |
| @@ -226,6 +239,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 1 unmodified line | ||
| 226 | 239 | 140: |
| 227 | 240 | 141: |
| 228 | 241 | 142: |
| 242 | +123: | |
| 243 | +144: | |
| 244 | +145: | |
| 229 | 245 | |
| 230 | 246 | /* |
| 231 | 247 | * here we have had a fault on a load and r3 points to the first |
| @@ -309,6 +325,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 77 unmodified lines | ||
| 309 | 325 | 187: |
| 310 | 326 | 188: |
| 311 | 327 | 189: |
| 328 | +194: | |
| 329 | +195: | |
| 330 | +196: | |
| 312 | 331 | 1: |
| 313 | 332 | ld r6,-24(r1) |
| 314 | 333 | ld r5,-8(r1) |
| @@ -329,7 +348,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 14 unmodified lines | ||
| 329 | 348 | .llong 72b,172b |
| 330 | 349 | .llong 23b,123b |
| 331 | 350 | .llong 73b,173b |
| 351 | + .llong 44b,144b | |
| 332 | 352 | .llong 74b,174b |
| 353 | + .llong 45b,145b | |
| 333 | 354 | .llong 75b,175b |
| 334 | 355 | .llong 24b,124b |
| 335 | 356 | .llong 25b,125b |
| @@ -347,6 +368,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 11 unmodified lines | ||
| 347 | 368 | .llong 79b,179b |
| 348 | 369 | .llong 80b,180b |
| 349 | 370 | .llong 34b,134b |
| 371 | + .llong 94b,194b | |
| 372 | + .llong 95b,195b | |
| 373 | + .llong 96b,196b | |
| 350 | 374 | .llong 35b,135b |
| 351 | 375 | .llong 81b,181b |
| 352 | 376 | .llong 36b,136b |
| @@ -53,18 +53,19 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 52 unmodified lines | ||
| 53 | 53 | 3: std r8,8(r3) |
| 54 | 54 | beq 3f |
| 55 | 55 | addi r3,r3,16 |
| 56 | − ld r9,8(r4) | |
| 57 | 56 | .Ldo_tail: |
| 58 | 57 | bf cr7*4+1,1f |
| 59 | − rotldi r9,r9,32 | |
| 58 | + lwz r9,8(r4) | |
| 59 | + addi r4,r4,4 | |
| 60 | 60 | stw r9,0(r3) |
| 61 | 61 | addi r3,r3,4 |
| 62 | 62 | 1: bf cr7*4+2,2f |
| 63 | − rotldi r9,r9,16 | |
| 63 | + lhz r9,8(r4) | |
| 64 | + addi r4,r4,2 | |
| 64 | 65 | sth r9,0(r3) |
| 65 | 66 | addi r3,r3,2 |
| 66 | 67 | 2: bf cr7*4+3,3f |
| 67 | − rotldi r9,r9,8 | |
| 68 | + lbz r9,8(r4) | |
| 68 | 69 | stb r9,0(r3) |
| 69 | 70 | 3: ld r3,48(r1) /* return dest pointer */ |
| 70 | 71 | blr |
| @@ -133,11 +134,24 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 62 unmodified lines | ||
| 133 | 134 | cmpwi cr1,r5,8 |
| 134 | 135 | addi r3,r3,32 |
| 135 | 136 | sld r9,r9,r10 |
| 136 | − ble cr1,.Ldo_tail | |
| 137 | + ble cr1,6f | |
| 137 | 138 | ld r0,8(r4) |
| 138 | 139 | srd r7,r0,r11 |
| 139 | 140 | or r9,r7,r9 |
| 140 | − b .Ldo_tail | |
| 141 | +6: | |
| 142 | + bf cr7*4+1,1f | |
| 143 | + rotldi r9,r9,32 | |
| 144 | + stw r9,0(r3) | |
| 145 | + addi r3,r3,4 | |
| 146 | +1: bf cr7*4+2,2f | |
| 147 | + rotldi r9,r9,16 | |
| 148 | + sth r9,0(r3) | |
| 149 | + addi r3,r3,2 | |
| 150 | +2: bf cr7*4+3,3f | |
| 151 | + rotldi r9,r9,8 | |
| 152 | + stb r9,0(r3) | |
| 153 | +3: ld r3,48(r1) /* return dest pointer */ | |
| 154 | + blr | |
| 141 | 155 | |
| 142 | 156 | .Ldst_unaligned: |
| 143 | 157 | PPC_MTOCRF 0x01,r6 # put #bytes to 8B bdry into cr7 |
| @@ -204,6 +204,23 @@ static int __init ppc4xx_setup_one_pci_PMM(struct pci_controller *hose, · 203 unmodified lines | ||
| 204 | 204 | { |
| 205 | 205 | u32 ma, pcila, pciha; |
| 206 | 206 | |
| 207 | + /* Hack warning ! The "old" PCI 2.x cell only let us configure the low | |
| 208 | + * 32-bit of incoming PLB addresses. The top 4 bits of the 36-bit | |
| 209 | + * address are actually hard wired to a value that appears to depend | |
| 210 | + * on the specific SoC. For example, it's 0 on 440EP and 1 on 440EPx. | |
| 211 | + * | |
| 212 | + * The trick here is we just crop those top bits and ignore them when | |
| 213 | + * programming the chip. That means the device-tree has to be right | |
| 214 | + * for the specific part used (we don't print a warning if it's wrong | |
| 215 | + * but on the other hand, you'll crash quickly enough), but at least | |
| 216 | + * this code should work whatever the hard coded value is | |
| 217 | + */ | |
| 218 | + plb_addr &= 0xffffffffull; | |
| 219 | + | |
| 220 | + /* Note: Due to the above hack, the test below doesn't actually test | |
| 221 | + * if you address is above 4G, but it tests that address and | |
| 222 | + * (address + size) are both contained in the same 4G | |
| 223 | + */ | |
| 207 | 224 | if ((plb_addr + size) > 0xffffffffull || !is_power_of_2(size) || |
| 208 | 225 | size < 0x1000 || (plb_addr & (size - 1)) != 0) { |
| 209 | 226 | printk(KERN_WARNING "%s: Resource out of range\n", |
| @@ -22,7 +22,6 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/gpio.h> |
| 23 | 23 | #include <linux/spi/spi.h> |
| 24 | 24 | #include <linux/spi/spi_gpio.h> |
| 25 | −#include <media/ov772x.h> | |
| 26 | 25 | #include <media/soc_camera_platform.h> |
| 27 | 26 | #include <media/sh_mobile_ceu.h> |
| 28 | 27 | #include <video/sh_mobile_lcdc.h> |
| @@ -224,7 +223,6 @@ static void camera_power(int val) · 195 unmodified lines | ||
| 224 | 223 | } |
| 225 | 224 | |
| 226 | 225 | #ifdef CONFIG_I2C |
| 227 | −/* support for the old ncm03j camera */ | |
| 228 | 226 | static unsigned char camera_ncm03j_magic[] = |
| 229 | 227 | { |
| 230 | 228 | 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8, |
| @@ -245,23 +243,6 @@ static unsigned char camera_ncm03j_magic[] = · 14 unmodified lines | ||
| 245 | 243 | 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F, |
| 246 | 244 | }; |
| 247 | 245 | |
| 248 | −static int camera_probe(void) | |
| 249 | −{ | |
| 250 | − struct i2c_adapter *a = i2c_get_adapter(0); | |
| 251 | − struct i2c_msg msg; | |
| 252 | − int ret; | |
| 253 | − | |
| 254 | − camera_power(1); | |
| 255 | − msg.addr = 0x6e; | |
| 256 | − msg.buf = camera_ncm03j_magic; | |
| 257 | − msg.len = 2; | |
| 258 | − msg.flags = 0; | |
| 259 | − ret = i2c_transfer(a, &msg, 1); | |
| 260 | − camera_power(0); | |
| 261 | − | |
| 262 | − return ret; | |
| 263 | −} | |
| 264 | − | |
| 265 | 246 | static int camera_set_capture(struct soc_camera_platform_info *info, |
| 266 | 247 | int enable) |
| 267 | 248 | { |
| @@ -313,35 +294,8 @@ static struct platform_device camera_device = { · 45 unmodified lines | ||
| 313 | 294 | .platform_data = &camera_info, |
| 314 | 295 | }, |
| 315 | 296 | }; |
| 316 | − | |
| 317 | −static int __init camera_setup(void) | |
| 318 | −{ | |
| 319 | − if (camera_probe() > 0) | |
| 320 | − platform_device_register(&camera_device); | |
| 321 | − | |
| 322 | − return 0; | |
| 323 | −} | |
| 324 | −late_initcall(camera_setup); | |
| 325 | − | |
| 326 | 297 | #endif /* CONFIG_I2C */ |
| 327 | 298 | |
| 328 | −static int ov7725_power(struct device *dev, int mode) | |
| 329 | −{ | |
| 330 | − camera_power(0); | |
| 331 | − if (mode) | |
| 332 | − camera_power(1); | |
| 333 | − | |
| 334 | − return 0; | |
| 335 | −} | |
| 336 | − | |
| 337 | −static struct ov772x_camera_info ov7725_info = { | |
| 338 | − .buswidth = SOCAM_DATAWIDTH_8, | |
| 339 | − .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP, | |
| 340 | − .link = { | |
| 341 | − .power = ov7725_power, | |
| 342 | − }, | |
| 343 | −}; | |
| 344 | − | |
| 345 | 299 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { |
| 346 | 300 | .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | |
| 347 | 301 | SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8, |
| @@ -392,6 +346,9 @@ static struct platform_device *ap325rxa_devices[] __initdata = { · 44 unmodified lines | ||
| 392 | 346 | &ap325rxa_nor_flash_device, |
| 393 | 347 | &lcdc_device, |
| 394 | 348 | &ceu_device, |
| 349 | +#ifdef CONFIG_I2C | |
| 350 | + &camera_device, | |
| 351 | +#endif | |
| 395 | 352 | &nand_flash_device, |
| 396 | 353 | &sdcard_cn3_device, |
| 397 | 354 | }; |
| @@ -400,10 +357,6 @@ static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = { · 2 unmodified lines | ||
| 400 | 357 | { |
| 401 | 358 | I2C_BOARD_INFO("pcf8563", 0x51), |
| 402 | 359 | }, |
| 403 | − { | |
| 404 | − I2C_BOARD_INFO("ov772x", 0x21), | |
| 405 | − .platform_data = &ov7725_info, | |
| 406 | − }, | |
| 407 | 360 | }; |
| 408 | 361 | |
| 409 | 362 | static struct spi_board_info ap325rxa_spi_devices[] = { |
| @@ -18,8 +18,8 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <asm/freq.h> |
| 19 | 19 | #include <asm/io.h> |
| 20 | 20 | |
| 21 | −const static int pll1rate[]={1,2,3,4,6,8}; | |
| 22 | −const static int pfc_divisors[]={1,2,3,4,6,8,12}; | |
| 21 | +static const int pll1rate[]={1,2,3,4,6,8}; | |
| 22 | +static const int pfc_divisors[]={1,2,3,4,6,8,12}; | |
| 23 | 23 | #define ifc_divisors pfc_divisors |
| 24 | 24 | |
| 25 | 25 | #if (CONFIG_SH_CLK_MD == 0) |
| @@ -306,6 +306,7 @@ static int jbusmc_print_dimm(int syndrome_code, · 305 unmodified lines | ||
| 306 | 306 | buf[1] = '?'; |
| 307 | 307 | buf[2] = '?'; |
| 308 | 308 | buf[3] = '\0'; |
| 309 | + return 0; | |
| 309 | 310 | } |
| 310 | 311 | p = dp->controller; |
| 311 | 312 | prop = &p->layout; |
| @@ -1822,7 +1822,7 @@ config DMAR · 1821 unmodified lines | ||
| 1822 | 1822 | remapping devices. |
| 1823 | 1823 | |
| 1824 | 1824 | config DMAR_DEFAULT_ON |
| 1825 | − def_bool n | |
| 1825 | + def_bool y | |
| 1826 | 1826 | prompt "Enable DMA Remapping Devices by default" |
| 1827 | 1827 | depends on DMAR |
| 1828 | 1828 | help |
| @@ -20,23 +20,16 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <asm/pat.h> |
| 21 | 21 | #include <linux/module.h> |
| 22 | 22 | |
| 23 | −#ifdef CONFIG_X86_PAE | |
| 24 | −int | |
| 25 | −is_io_mapping_possible(resource_size_t base, unsigned long size) | |
| 26 | −{ | |
| 27 | − return 1; | |
| 28 | −} | |
| 29 | −#else | |
| 30 | −int | |
| 31 | −is_io_mapping_possible(resource_size_t base, unsigned long size) | |
| 23 | +int is_io_mapping_possible(resource_size_t base, unsigned long size) | |
| 32 | 24 | { |
| 25 | +#ifndef CONFIG_X86_PAE | |
| 33 | 26 | /* There is no way to map greater than 1 << 32 address without PAE */ |
| 34 | 27 | if (base + size > 0x100000000ULL) |
| 35 | 28 | return 0; |
| 36 | − | |
| 29 | +#endif | |
| 37 | 30 | return 1; |
| 38 | 31 | } |
| 39 | −#endif | |
| 32 | +EXPORT_SYMBOL_GPL(is_io_mapping_possible); | |
| 40 | 33 | |
| 41 | 34 | /* Map 'pfn' using fixed map 'type' and protections 'prot' |
| 42 | 35 | */ |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/bootmem.h> |
| 12 | 12 | #include <linux/debugfs.h> |
| 13 | 13 | #include <linux/kernel.h> |
| 14 | +#include <linux/module.h> | |
| 14 | 15 | #include <linux/gfp.h> |
| 15 | 16 | #include <linux/mm.h> |
| 16 | 17 | #include <linux/fs.h> |
| @@ -889,6 +890,7 @@ pgprot_t pgprot_writecombine(pgprot_t prot) · 872 unmodified lines | ||
| 889 | 890 | else |
| 890 | 891 | return pgprot_noncached(prot); |
| 891 | 892 | } |
| 893 | +EXPORT_SYMBOL_GPL(pgprot_writecombine); | |
| 892 | 894 | |
| 893 | 895 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT) |
| 894 | 896 | |
| @@ -38,72 +38,84 @@ void blk_recalc_rq_sectors(struct request *rq, int nsect) · 37 unmodified lines | ||
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | −void blk_recalc_rq_segments(struct request *rq) | |
| 41 | +static unsigned int __blk_recalc_rq_segments(struct request_queue *q, | |
| 42 | + struct bio *bio, | |
| 43 | + unsigned int *seg_size_ptr) | |
| 42 | 44 | { |
| 43 | − int nr_phys_segs; | |
| 44 | 45 | unsigned int phys_size; |
| 45 | 46 | struct bio_vec *bv, *bvprv = NULL; |
| 46 | − int seg_size; | |
| 47 | − int cluster; | |
| 48 | − struct req_iterator iter; | |
| 49 | − int high, highprv = 1; | |
| 50 | − struct request_queue *q = rq->q; | |
| 47 | + int cluster, i, high, highprv = 1; | |
| 48 | + unsigned int seg_size, nr_phys_segs; | |
| 49 | + struct bio *fbio; | |
| 51 | 50 | |
| 52 | − if (!rq->bio) | |
| 53 | − return; | |
| 51 | + if (!bio) | |
| 52 | + return 0; | |
| 54 | 53 | |
| 54 | + fbio = bio; | |
| 55 | 55 | cluster = test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); |
| 56 | 56 | seg_size = 0; |
| 57 | 57 | phys_size = nr_phys_segs = 0; |
| 58 | − rq_for_each_segment(bv, rq, iter) { | |
| 59 | − /* | |
| 60 | − * the trick here is making sure that a high page is never | |
| 61 | − * considered part of another segment, since that might | |
| 62 | − * change with the bounce page. | |
| 63 | − */ | |
| 64 | − high = page_to_pfn(bv->bv_page) > q->bounce_pfn; | |
| 65 | − if (high || highprv) | |
| 66 | − goto new_segment; | |
| 67 | − if (cluster) { | |
| 68 | − if (seg_size + bv->bv_len > q->max_segment_size) | |
| 69 | − goto new_segment; | |
| 70 | − if (!BIOVEC_PHYS_MERGEABLE(bvprv, bv)) | |
| 71 | − goto new_segment; | |
| 72 | − if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bv)) | |
| 58 | + for_each_bio(bio) { | |
| 59 | + bio_for_each_segment(bv, bio, i) { | |
| 60 | + /* | |
| 61 | + * the trick here is making sure that a high page is | |
| 62 | + * never considered part of another segment, since that | |
| 63 | + * might change with the bounce page. | |
| 64 | + */ | |
| 65 | + high = page_to_pfn(bv->bv_page) > q->bounce_pfn; | |
| 66 | + if (high || highprv) | |
| 73 | 67 | goto new_segment; |
| 68 | + if (cluster) { | |
| 69 | + if (seg_size + bv->bv_len > q->max_segment_size) | |
| 70 | + goto new_segment; | |
| 71 | + if (!BIOVEC_PHYS_MERGEABLE(bvprv, bv)) | |
| 72 | + goto new_segment; | |
| 73 | + if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bv)) | |
| 74 | + goto new_segment; | |
| 75 | + | |
| 76 | + seg_size += bv->bv_len; | |
| 77 | + bvprv = bv; | |
| 78 | + continue; | |
| 79 | + } | |
| 80 | +new_segment: | |
| 81 | + if (nr_phys_segs == 1 && seg_size > | |
| 82 | + fbio->bi_seg_front_size) | |
| 83 | + fbio->bi_seg_front_size = seg_size; | |
| 74 | 84 | |
| 75 | − seg_size += bv->bv_len; | |
| 85 | + nr_phys_segs++; | |
| 76 | 86 | bvprv = bv; |
| 77 | − continue; | |
| 87 | + seg_size = bv->bv_len; | |
| 88 | + highprv = high; | |
| 78 | 89 | } |
| 79 | −new_segment: | |
| 80 | − if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size) | |
| 81 | − rq->bio->bi_seg_front_size = seg_size; | |
| 82 | − | |
| 83 | − nr_phys_segs++; | |
| 84 | − bvprv = bv; | |
| 85 | − seg_size = bv->bv_len; | |
| 86 | − highprv = high; | |
| 87 | 90 | } |
| 88 | 91 | |
| 89 | − if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size) | |
| 92 | + if (seg_size_ptr) | |
| 93 | + *seg_size_ptr = seg_size; | |
| 94 | + | |
| 95 | + return nr_phys_segs; | |
| 96 | +} | |
| 97 | + | |
| 98 | +void blk_recalc_rq_segments(struct request *rq) | |
| 99 | +{ | |
| 100 | + unsigned int seg_size = 0, phys_segs; | |
| 101 | + | |
| 102 | + phys_segs = __blk_recalc_rq_segments(rq->q, rq->bio, &seg_size); | |
| 103 | + | |
| 104 | + if (phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size) | |
| 90 | 105 | rq->bio->bi_seg_front_size = seg_size; |
| 91 | 106 | if (seg_size > rq->biotail->bi_seg_back_size) |
| 92 | 107 | rq->biotail->bi_seg_back_size = seg_size; |
| 93 | 108 | |
| 94 | − rq->nr_phys_segments = nr_phys_segs; | |
| 109 | + rq->nr_phys_segments = phys_segs; | |
| 95 | 110 | } |
| 96 | 111 | |
| 97 | 112 | void blk_recount_segments(struct request_queue *q, struct bio *bio) |
| 98 | 113 | { |
| 99 | − struct request rq; | |
| 100 | 114 | struct bio *nxt = bio->bi_next; |
| 101 | − rq.q = q; | |
| 102 | − rq.bio = rq.biotail = bio; | |
| 115 | + | |
| 103 | 116 | bio->bi_next = NULL; |
| 104 | − blk_recalc_rq_segments(&rq); | |
| 117 | + bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, NULL); | |
| 105 | 118 | bio->bi_next = nxt; |
| 106 | − bio->bi_phys_segments = rq.nr_phys_segments; | |
| 107 | 119 | bio->bi_flags |= (1 << BIO_SEG_VALID); |
| 108 | 120 | } |
| 109 | 121 | EXPORT_SYMBOL(blk_recount_segments); |
| @@ -256,6 +256,22 @@ void blkdev_show(struct seq_file *seqf, off_t offset) · 255 unmodified lines | ||
| 256 | 256 | } |
| 257 | 257 | #endif /* CONFIG_PROC_FS */ |
| 258 | 258 | |
| 259 | +/** | |
| 260 | + * register_blkdev - register a new block device | |
| 261 | + * | |
| 262 | + * @major: the requested major device number [1..255]. If @major=0, try to | |
| 263 | + * allocate any unused major number. | |
| 264 | + * @name: the name of the new block device as a zero terminated string | |
| 265 | + * | |
| 266 | + * The @name must be unique within the system. | |
| 267 | + * | |
| 268 | + * The return value depends on the @major input parameter. | |
| 269 | + * - if a major device number was requested in range [1..255] then the | |
| 270 | + * function returns zero on success, or a negative error code | |
| 271 | + * - if any unused major number was requested with @major=0 parameter | |
| 272 | + * then the return value is the allocated major number in range | |
| 273 | + * [1..255] or a negative error code otherwise | |
| 274 | + */ | |
| 259 | 275 | int register_blkdev(unsigned int major, const char *name) |
| 260 | 276 | { |
| 261 | 277 | struct blk_major_name **n, *p; |
| @@ -24,7 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/libata.h> |
| 25 | 25 | |
| 26 | 26 | #define DRV_NAME "pata_amd" |
| 27 | −#define DRV_VERSION "0.3.11" | |
| 27 | +#define DRV_VERSION "0.4.1" | |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * timing_setup - shared timing computation and load |
| @@ -145,6 +145,13 @@ static int amd_pre_reset(struct ata_link *link, unsigned long deadline) · 114 unmodified lines | ||
| 145 | 145 | return ata_sff_prereset(link, deadline); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | +/** | |
| 149 | + * amd_cable_detect - report cable type | |
| 150 | + * @ap: port | |
| 151 | + * | |
| 152 | + * AMD controller/BIOS setups record the cable type in word 0x42 | |
| 153 | + */ | |
| 154 | + | |
| 148 | 155 | static int amd_cable_detect(struct ata_port *ap) |
| 149 | 156 | { |
| 150 | 157 | static const u32 bitmask[2] = {0x03, 0x0C}; |
| @@ -157,6 +164,40 @@ static int amd_cable_detect(struct ata_port *ap) · 6 unmodified lines | ||
| 157 | 164 | return ATA_CBL_PATA40; |
| 158 | 165 | } |
| 159 | 166 | |
| 167 | +/** | |
| 168 | + * amd_fifo_setup - set the PIO FIFO for ATA/ATAPI | |
| 169 | + * @ap: ATA interface | |
| 170 | + * @adev: ATA device | |
| 171 | + * | |
| 172 | + * Set the PCI fifo for this device according to the devices present | |
| 173 | + * on the bus at this point in time. We need to turn the post write buffer | |
| 174 | + * off for ATAPI devices as we may need to issue a word sized write to the | |
| 175 | + * device as the final I/O | |
| 176 | + */ | |
| 177 | + | |
| 178 | +static void amd_fifo_setup(struct ata_port *ap) | |
| 179 | +{ | |
| 180 | + struct ata_device *adev; | |
| 181 | + struct pci_dev *pdev = to_pci_dev(ap->host->dev); | |
| 182 | + static const u8 fifobit[2] = { 0xC0, 0x30}; | |
| 183 | + u8 fifo = fifobit[ap->port_no]; | |
| 184 | + u8 r; | |
| 185 | + | |
| 186 | + | |
| 187 | + ata_for_each_dev(adev, &ap->link, ENABLED) { | |
| 188 | + if (adev->class == ATA_DEV_ATAPI) | |
| 189 | + fifo = 0; | |
| 190 | + } | |
| 191 | + if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7411) /* FIFO is broken */ | |
| 192 | + fifo = 0; | |
| 193 | + | |
| 194 | + /* On the later chips the read prefetch bits become no-op bits */ | |
| 195 | + pci_read_config_byte(pdev, 0x41, &r); | |
| 196 | + r &= ~fifobit[ap->port_no]; | |
| 197 | + r |= fifo; | |
| 198 | + pci_write_config_byte(pdev, 0x41, r); | |
| 199 | +} | |
| 200 | + | |
| 160 | 201 | /** |
| 161 | 202 | * amd33_set_piomode - set initial PIO mode data |
| 162 | 203 | * @ap: ATA interface |
| @@ -167,21 +208,25 @@ static int amd_cable_detect(struct ata_port *ap) · 4 unmodified lines | ||
| 167 | 208 | |
| 168 | 209 | static void amd33_set_piomode(struct ata_port *ap, struct ata_device *adev) |
| 169 | 210 | { |
| 211 | + amd_fifo_setup(ap); | |
| 170 | 212 | timing_setup(ap, adev, 0x40, adev->pio_mode, 1); |
| 171 | 213 | } |
| 172 | 214 | |
| 173 | 215 | static void amd66_set_piomode(struct ata_port *ap, struct ata_device *adev) |
| 174 | 216 | { |
| 217 | + amd_fifo_setup(ap); | |
| 175 | 218 | timing_setup(ap, adev, 0x40, adev->pio_mode, 2); |
| 176 | 219 | } |
| 177 | 220 | |
| 178 | 221 | static void amd100_set_piomode(struct ata_port *ap, struct ata_device *adev) |
| 179 | 222 | { |
| 223 | + amd_fifo_setup(ap); | |
| 180 | 224 | timing_setup(ap, adev, 0x40, adev->pio_mode, 3); |
| 181 | 225 | } |
| 182 | 226 | |
| 183 | 227 | static void amd133_set_piomode(struct ata_port *ap, struct ata_device *adev) |
| 184 | 228 | { |
| 229 | + amd_fifo_setup(ap); | |
| 185 | 230 | timing_setup(ap, adev, 0x40, adev->pio_mode, 4); |
| 186 | 231 | } |
| 187 | 232 | |
| @@ -397,6 +442,16 @@ static struct ata_port_operations nv133_port_ops = { · 209 unmodified lines | ||
| 397 | 442 | .set_dmamode = nv133_set_dmamode, |
| 398 | 443 | }; |
| 399 | 444 | |
| 445 | +static void amd_clear_fifo(struct pci_dev *pdev) | |
| 446 | +{ | |
| 447 | + u8 fifo; | |
| 448 | + /* Disable the FIFO, the FIFO logic will re-enable it as | |
| 449 | + appropriate */ | |
| 450 | + pci_read_config_byte(pdev, 0x41, &fifo); | |
| 451 | + fifo &= 0x0F; | |
| 452 | + pci_write_config_byte(pdev, 0x41, fifo); | |
| 453 | +} | |
| 454 | + | |
| 400 | 455 | static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
| 401 | 456 | { |
| 402 | 457 | static const struct ata_port_info info[10] = { |
| @@ -503,14 +558,8 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) · 100 unmodified lines | ||
| 503 | 558 | |
| 504 | 559 | if (type < 3) |
| 505 | 560 | ata_pci_bmdma_clear_simplex(pdev); |
| 506 | − | |
| 507 | − /* Check for AMD7411 */ | |
| 508 | − if (type == 3) | |
| 509 | − /* FIFO is broken */ | |
| 510 | − pci_write_config_byte(pdev, 0x41, fifo & 0x0F); | |
| 511 | − else | |
| 512 | − pci_write_config_byte(pdev, 0x41, fifo | 0xF0); | |
| 513 | − | |
| 561 | + if (pdev->vendor == PCI_VENDOR_ID_AMD) | |
| 562 | + amd_clear_fifo(pdev); | |
| 514 | 563 | /* Cable detection on Nvidia chips doesn't work too well, |
| 515 | 564 | * cache BIOS programmed UDMA mode. |
| 516 | 565 | */ |
| @@ -536,18 +585,11 @@ static int amd_reinit_one(struct pci_dev *pdev) · 19 unmodified lines | ||
| 536 | 585 | return rc; |
| 537 | 586 | |
| 538 | 587 | if (pdev->vendor == PCI_VENDOR_ID_AMD) { |
| 539 | − u8 fifo; | |
| 540 | − pci_read_config_byte(pdev, 0x41, &fifo); | |
| 541 | − if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7411) | |
| 542 | − /* FIFO is broken */ | |
| 543 | − pci_write_config_byte(pdev, 0x41, fifo & 0x0F); | |
| 544 | − else | |
| 545 | − pci_write_config_byte(pdev, 0x41, fifo | 0xF0); | |
| 588 | + amd_clear_fifo(pdev); | |
| 546 | 589 | if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7409 || |
| 547 | 590 | pdev->device == PCI_DEVICE_ID_AMD_COBRA_7401) |
| 548 | 591 | ata_pci_bmdma_clear_simplex(pdev); |
| 549 | 592 | } |
| 550 | − | |
| 551 | 593 | ata_host_resume(host); |
| 552 | 594 | return 0; |
| 553 | 595 | } |
| @@ -557,6 +557,9 @@ static unsigned int it821x_read_id(struct ata_device *adev, · 556 unmodified lines | ||
| 557 | 557 | id[83] |= 0x4400; /* Word 83 is valid and LBA48 */ |
| 558 | 558 | id[86] |= 0x0400; /* LBA48 on */ |
| 559 | 559 | id[ATA_ID_MAJOR_VER] |= 0x1F; |
| 560 | + /* Clear the serial number because it's different each boot | |
| 561 | + which breaks validation on resume */ | |
| 562 | + memset(&id[ATA_ID_SERNO], 0x20, ATA_ID_SERNO_LEN); | |
| 560 | 563 | } |
| 561 | 564 | return err_mask; |
| 562 | 565 | } |
| @@ -283,9 +283,10 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev) · 282 unmodified lines | ||
| 283 | 283 | static unsigned int pdc_data_xfer_vlb(struct ata_device *dev, |
| 284 | 284 | unsigned char *buf, unsigned int buflen, int rw) |
| 285 | 285 | { |
| 286 | − if (ata_id_has_dword_io(dev->id)) { | |
| 286 | + int slop = buflen & 3; | |
| 287 | + /* 32bit I/O capable *and* we need to write a whole number of dwords */ | |
| 288 | + if (ata_id_has_dword_io(dev->id) && (slop == 0 || slop == 3)) { | |
| 287 | 289 | struct ata_port *ap = dev->link->ap; |
| 288 | − int slop = buflen & 3; | |
| 289 | 290 | unsigned long flags; |
| 290 | 291 | |
| 291 | 292 | local_irq_save(flags); |
| @@ -735,7 +736,7 @@ static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf, · 443 unmodified lines | ||
| 735 | 736 | struct ata_port *ap = adev->link->ap; |
| 736 | 737 | int slop = buflen & 3; |
| 737 | 738 | |
| 738 | − if (ata_id_has_dword_io(adev->id)) { | |
| 739 | + if (ata_id_has_dword_io(adev->id) && (slop == 0 || slop == 3)) { | |
| 739 | 740 | if (rw == WRITE) |
| 740 | 741 | iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); |
| 741 | 742 | else |
| @@ -3114,19 +3114,17 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) · 3113 unmodified lines | ||
| 3114 | 3114 | writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); |
| 3115 | 3115 | } |
| 3116 | 3116 | |
| 3117 | − if (!IS_SOC(hpriv)) { | |
| 3118 | − /* Clear any currently outstanding host interrupt conditions */ | |
| 3119 | − writelfl(0, mmio + hpriv->irq_cause_ofs); | |
| 3117 | + /* Clear any currently outstanding host interrupt conditions */ | |
| 3118 | + writelfl(0, mmio + hpriv->irq_cause_ofs); | |
| 3120 | 3119 | |
| 3121 | − /* and unmask interrupt generation for host regs */ | |
| 3122 | − writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); | |
| 3120 | + /* and unmask interrupt generation for host regs */ | |
| 3121 | + writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); | |
| 3123 | 3122 | |
| 3124 | − /* | |
| 3125 | − * enable only global host interrupts for now. | |
| 3126 | − * The per-port interrupts get done later as ports are set up. | |
| 3127 | − */ | |
| 3128 | − mv_set_main_irq_mask(host, 0, PCI_ERR); | |
| 3129 | − } | |
| 3123 | + /* | |
| 3124 | + * enable only global host interrupts for now. | |
| 3125 | + * The per-port interrupts get done later as ports are set up. | |
| 3126 | + */ | |
| 3127 | + mv_set_main_irq_mask(host, 0, PCI_ERR); | |
| 3130 | 3128 | done: |
| 3131 | 3129 | return rc; |
| 3132 | 3130 | } |
| @@ -3611,11 +3611,15 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, · 3610 unmodified lines | ||
| 3611 | 3611 | schedule_timeout_uninterruptible(30*HZ); |
| 3612 | 3612 | |
| 3613 | 3613 | /* Now try to get the controller to respond to a no-op */ |
| 3614 | − for (i=0; i<12; i++) { | |
| 3614 | + for (i=0; i<30; i++) { | |
| 3615 | 3615 | if (cciss_noop(pdev) == 0) |
| 3616 | 3616 | break; |
| 3617 | − else | |
| 3618 | − printk("cciss: no-op failed%s\n", (i < 11 ? "; re-trying" : "")); | |
| 3617 | + | |
| 3618 | + schedule_timeout_uninterruptible(HZ); | |
| 3619 | + } | |
| 3620 | + if (i == 30) { | |
| 3621 | + printk(KERN_ERR "cciss: controller seems dead\n"); | |
| 3622 | + return -EBUSY; | |
| 3619 | 3623 | } |
| 3620 | 3624 | } |
| 3621 | 3625 | |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | #include <linux/hdreg.h> |
| 41 | 41 | #include <linux/cdrom.h> |
| 42 | 42 | #include <linux/module.h> |
| 43 | +#include <linux/scatterlist.h> | |
| 43 | 44 | |
| 44 | 45 | #include <xen/xenbus.h> |
| 45 | 46 | #include <xen/grant_table.h> |
| @@ -82,6 +83,7 @@ struct blkfront_info · 36 unmodified lines | ||
| 82 | 83 | enum blkif_state connected; |
| 83 | 84 | int ring_ref; |
| 84 | 85 | struct blkif_front_ring ring; |
| 86 | + struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | |
| 85 | 87 | unsigned int evtchn, irq; |
| 86 | 88 | struct request_queue *rq; |
| 87 | 89 | struct work_struct work; |
| @@ -204,12 +206,11 @@ static int blkif_queue_request(struct request *req) · 116 unmodified lines | ||
| 204 | 206 | struct blkfront_info *info = req->rq_disk->private_data; |
| 205 | 207 | unsigned long buffer_mfn; |
| 206 | 208 | struct blkif_request *ring_req; |
| 207 | − struct req_iterator iter; | |
| 208 | − struct bio_vec *bvec; | |
| 209 | 209 | unsigned long id; |
| 210 | 210 | unsigned int fsect, lsect; |
| 211 | − int ref; | |
| 211 | + int i, ref; | |
| 212 | 212 | grant_ref_t gref_head; |
| 213 | + struct scatterlist *sg; | |
| 213 | 214 | |
| 214 | 215 | if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) |
| 215 | 216 | return 1; |
| @@ -238,12 +239,13 @@ static int blkif_queue_request(struct request *req) · 22 unmodified lines | ||
| 238 | 239 | if (blk_barrier_rq(req)) |
| 239 | 240 | ring_req->operation = BLKIF_OP_WRITE_BARRIER; |
| 240 | 241 | |
| 241 | − ring_req->nr_segments = 0; | |
| 242 | − rq_for_each_segment(bvec, req, iter) { | |
| 243 | − BUG_ON(ring_req->nr_segments == BLKIF_MAX_SEGMENTS_PER_REQUEST); | |
| 244 | − buffer_mfn = pfn_to_mfn(page_to_pfn(bvec->bv_page)); | |
| 245 | − fsect = bvec->bv_offset >> 9; | |
| 246 | − lsect = fsect + (bvec->bv_len >> 9) - 1; | |
| 242 | + ring_req->nr_segments = blk_rq_map_sg(req->q, req, info->sg); | |
| 243 | + BUG_ON(ring_req->nr_segments > BLKIF_MAX_SEGMENTS_PER_REQUEST); | |
| 244 | + | |
| 245 | + for_each_sg(info->sg, sg, ring_req->nr_segments, i) { | |
| 246 | + buffer_mfn = pfn_to_mfn(page_to_pfn(sg_page(sg))); | |
| 247 | + fsect = sg->offset >> 9; | |
| 248 | + lsect = fsect + (sg->length >> 9) - 1; | |
| 247 | 249 | /* install a grant reference. */ |
| 248 | 250 | ref = gnttab_claim_grant_reference(&gref_head); |
| 249 | 251 | BUG_ON(ref == -ENOSPC); |
| @@ -254,16 +256,12 @@ static int blkif_queue_request(struct request *req) · 4 unmodified lines | ||
| 254 | 256 | buffer_mfn, |
| 255 | 257 | rq_data_dir(req) ); |
| 256 | 258 | |
| 257 | − info->shadow[id].frame[ring_req->nr_segments] = | |
| 258 | − mfn_to_pfn(buffer_mfn); | |
| 259 | − | |
| 260 | − ring_req->seg[ring_req->nr_segments] = | |
| 259 | + info->shadow[id].frame[i] = mfn_to_pfn(buffer_mfn); | |
| 260 | + ring_req->seg[i] = | |
| 261 | 261 | (struct blkif_request_segment) { |
| 262 | 262 | .gref = ref, |
| 263 | 263 | .first_sect = fsect, |
| 264 | 264 | .last_sect = lsect }; |
| 265 | − | |
| 266 | − ring_req->nr_segments++; | |
| 267 | 265 | } |
| 268 | 266 | |
| 269 | 267 | info->ring.req_prod_pvt++; |
| @@ -622,6 +620,8 @@ static int setup_blkring(struct xenbus_device *dev, · 352 unmodified lines | ||
| 622 | 620 | SHARED_RING_INIT(sring); |
| 623 | 621 | FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE); |
| 624 | 622 | |
| 623 | + sg_init_table(info->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST); | |
| 624 | + | |
| 625 | 625 | err = xenbus_grant_ring(dev, virt_to_mfn(info->ring.sring)); |
| 626 | 626 | if (err < 0) { |
| 627 | 627 | free_page((unsigned long)sring); |
| @@ -452,6 +452,59 @@ static void drm_setup_crtcs(struct drm_device *dev) · 451 unmodified lines | ||
| 452 | 452 | kfree(modes); |
| 453 | 453 | kfree(enabled); |
| 454 | 454 | } |
| 455 | + | |
| 456 | +/** | |
| 457 | + * drm_encoder_crtc_ok - can a given crtc drive a given encoder? | |
| 458 | + * @encoder: encoder to test | |
| 459 | + * @crtc: crtc to test | |
| 460 | + * | |
| 461 | + * Return false if @encoder can't be driven by @crtc, true otherwise. | |
| 462 | + */ | |
| 463 | +static bool drm_encoder_crtc_ok(struct drm_encoder *encoder, | |
| 464 | + struct drm_crtc *crtc) | |
| 465 | +{ | |
| 466 | + struct drm_device *dev; | |
| 467 | + struct drm_crtc *tmp; | |
| 468 | + int crtc_mask = 1; | |
| 469 | + | |
| 470 | + WARN(!crtc, "checking null crtc?"); | |
| 471 | + | |
| 472 | + dev = crtc->dev; | |
| 473 | + | |
| 474 | + list_for_each_entry(tmp, &dev->mode_config.crtc_list, head) { | |
| 475 | + if (tmp == crtc) | |
| 476 | + break; | |
| 477 | + crtc_mask <<= 1; | |
| 478 | + } | |
| 479 | + | |
| 480 | + if (encoder->possible_crtcs & crtc_mask) | |
| 481 | + return true; | |
| 482 | + return false; | |
| 483 | +} | |
| 484 | + | |
| 485 | +/* | |
| 486 | + * Check the CRTC we're going to map each output to vs. its current | |
| 487 | + * CRTC. If they don't match, we have to disable the output and the CRTC | |
| 488 | + * since the driver will have to re-route things. | |
| 489 | + */ | |
| 490 | +static void | |
| 491 | +drm_crtc_prepare_encoders(struct drm_device *dev) | |
| 492 | +{ | |
| 493 | + struct drm_encoder_helper_funcs *encoder_funcs; | |
| 494 | + struct drm_encoder *encoder; | |
| 495 | + | |
| 496 | + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | |
| 497 | + encoder_funcs = encoder->helper_private; | |
| 498 | + /* Disable unused encoders */ | |
| 499 | + if (encoder->crtc == NULL) | |
| 500 | + (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF); | |
| 501 | + /* Disable encoders whose CRTC is about to change */ | |
| 502 | + if (encoder_funcs->get_crtc && | |
| 503 | + encoder->crtc != (*encoder_funcs->get_crtc)(encoder)) | |
| 504 | + (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF); | |
| 505 | + } | |
| 506 | +} | |
| 507 | + | |
| 455 | 508 | /** |
| 456 | 509 | * drm_crtc_set_mode - set a mode |
| 457 | 510 | * @crtc: CRTC to program |
| @@ -547,6 +600,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, · 89 unmodified lines | ||
| 547 | 600 | encoder_funcs->prepare(encoder); |
| 548 | 601 | } |
| 549 | 602 | |
| 603 | + drm_crtc_prepare_encoders(dev); | |
| 604 | + | |
| 550 | 605 | crtc_funcs->prepare(crtc); |
| 551 | 606 | |
| 552 | 607 | /* Set up the DPLL and any encoders state that needs to adjust or depend |
| @@ -617,7 +672,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 64 unmodified lines | ||
| 617 | 672 | struct drm_device *dev; |
| 618 | 673 | struct drm_crtc **save_crtcs, *new_crtc; |
| 619 | 674 | struct drm_encoder **save_encoders, *new_encoder; |
| 620 | − struct drm_framebuffer *old_fb; | |
| 675 | + struct drm_framebuffer *old_fb = NULL; | |
| 621 | 676 | bool save_enabled; |
| 622 | 677 | bool mode_changed = false; |
| 623 | 678 | bool fb_changed = false; |
| @@ -668,9 +723,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 44 unmodified lines | ||
| 668 | 723 | * and then just flip_or_move it */ |
| 669 | 724 | if (set->crtc->fb != set->fb) { |
| 670 | 725 | /* If we have no fb then treat it as a full mode set */ |
| 671 | − if (set->crtc->fb == NULL) | |
| 726 | + if (set->crtc->fb == NULL) { | |
| 727 | + DRM_DEBUG("crtc has no fb, full mode set\n"); | |
| 672 | 728 | mode_changed = true; |
| 673 | − else if ((set->fb->bits_per_pixel != | |
| 729 | + } else if ((set->fb->bits_per_pixel != | |
| 674 | 730 | set->crtc->fb->bits_per_pixel) || |
| 675 | 731 | set->fb->depth != set->crtc->fb->depth) |
| 676 | 732 | fb_changed = true; |
| @@ -682,7 +738,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 5 unmodified lines | ||
| 682 | 738 | fb_changed = true; |
| 683 | 739 | |
| 684 | 740 | if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) { |
| 685 | − DRM_DEBUG("modes are different\n"); | |
| 741 | + DRM_DEBUG("modes are different, full mode set\n"); | |
| 686 | 742 | drm_mode_debug_printmodeline(&set->crtc->mode); |
| 687 | 743 | drm_mode_debug_printmodeline(set->mode); |
| 688 | 744 | mode_changed = true; |
| @@ -708,6 +764,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 19 unmodified lines | ||
| 708 | 764 | } |
| 709 | 765 | |
| 710 | 766 | if (new_encoder != connector->encoder) { |
| 767 | + DRM_DEBUG("encoder changed, full mode switch\n"); | |
| 711 | 768 | mode_changed = true; |
| 712 | 769 | connector->encoder = new_encoder; |
| 713 | 770 | } |
| @@ -734,10 +791,20 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 20 unmodified lines | ||
| 734 | 791 | if (set->connectors[ro] == connector) |
| 735 | 792 | new_crtc = set->crtc; |
| 736 | 793 | } |
| 794 | + | |
| 795 | + /* Make sure the new CRTC will work with the encoder */ | |
| 796 | + if (new_crtc && | |
| 797 | + !drm_encoder_crtc_ok(connector->encoder, new_crtc)) { | |
| 798 | + ret = -EINVAL; | |
| 799 | + goto fail_set_mode; | |
| 800 | + } | |
| 737 | 801 | if (new_crtc != connector->encoder->crtc) { |
| 802 | + DRM_DEBUG("crtc changed, full mode switch\n"); | |
| 738 | 803 | mode_changed = true; |
| 739 | 804 | connector->encoder->crtc = new_crtc; |
| 740 | 805 | } |
| 806 | + DRM_DEBUG("setting connector %d crtc to %p\n", | |
| 807 | + connector->base.id, new_crtc); | |
| 741 | 808 | } |
| 742 | 809 | |
| 743 | 810 | /* mode_set_base is not a required function */ |
| @@ -781,6 +848,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 37 unmodified lines | ||
| 781 | 848 | |
| 782 | 849 | fail_set_mode: |
| 783 | 850 | set->crtc->enabled = save_enabled; |
| 851 | + set->crtc->fb = old_fb; | |
| 784 | 852 | count = 0; |
| 785 | 853 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 786 | 854 | if (!connector->encoder) |
| @@ -125,7 +125,7 @@ static bool edid_is_valid(struct edid *edid) · 124 unmodified lines | ||
| 125 | 125 | DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version); |
| 126 | 126 | goto bad; |
| 127 | 127 | } |
| 128 | − if (edid->revision <= 0 || edid->revision > 3) { | |
| 128 | + if (edid->revision > 3) { | |
| 129 | 129 | DRM_ERROR("EDID has minor version %d, which is not between 0-3\n", edid->revision); |
| 130 | 130 | goto bad; |
| 131 | 131 | } |
| @@ -320,10 +320,10 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, · 188 unmodified lines | ||
| 320 | 320 | mode->htotal = mode->hdisplay + ((pt->hblank_hi << 8) | pt->hblank_lo); |
| 321 | 321 | |
| 322 | 322 | mode->vdisplay = (pt->vactive_hi << 8) | pt->vactive_lo; |
| 323 | − mode->vsync_start = mode->vdisplay + ((pt->vsync_offset_hi << 8) | | |
| 323 | + mode->vsync_start = mode->vdisplay + ((pt->vsync_offset_hi << 4) | | |
| 324 | 324 | pt->vsync_offset_lo); |
| 325 | 325 | mode->vsync_end = mode->vsync_start + |
| 326 | − ((pt->vsync_pulse_width_hi << 8) | | |
| 326 | + ((pt->vsync_pulse_width_hi << 4) | | |
| 327 | 327 | pt->vsync_pulse_width_lo); |
| 328 | 328 | mode->vtotal = mode->vdisplay + ((pt->vblank_hi << 8) | pt->vblank_lo); |
| 329 | 329 | |
| @@ -435,6 +435,8 @@ EXPORT_SYMBOL(drm_vblank_get); · 434 unmodified lines | ||
| 435 | 435 | */ |
| 436 | 436 | void drm_vblank_put(struct drm_device *dev, int crtc) |
| 437 | 437 | { |
| 438 | + BUG_ON (atomic_read (&dev->vblank_refcount[crtc]) == 0); | |
| 439 | + | |
| 438 | 440 | /* Last user schedules interrupt disable */ |
| 439 | 441 | if (atomic_dec_and_test(&dev->vblank_refcount[crtc])) |
| 440 | 442 | mod_timer(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ); |
| @@ -460,8 +462,9 @@ void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) · 19 unmodified lines | ||
| 460 | 462 | * so that interrupts remain enabled in the interim. |
| 461 | 463 | */ |
| 462 | 464 | if (!dev->vblank_inmodeset[crtc]) { |
| 463 | − dev->vblank_inmodeset[crtc] = 1; | |
| 464 | − drm_vblank_get(dev, crtc); | |
| 465 | + dev->vblank_inmodeset[crtc] = 0x1; | |
| 466 | + if (drm_vblank_get(dev, crtc) == 0) | |
| 467 | + dev->vblank_inmodeset[crtc] |= 0x2; | |
| 465 | 468 | } |
| 466 | 469 | } |
| 467 | 470 | EXPORT_SYMBOL(drm_vblank_pre_modeset); |
| @@ -473,9 +476,12 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc) · 5 unmodified lines | ||
| 473 | 476 | if (dev->vblank_inmodeset[crtc]) { |
| 474 | 477 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
| 475 | 478 | dev->vblank_disable_allowed = 1; |
| 476 | − dev->vblank_inmodeset[crtc] = 0; | |
| 477 | 479 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); |
| 478 | − drm_vblank_put(dev, crtc); | |
| 480 | + | |
| 481 | + if (dev->vblank_inmodeset[crtc] & 0x2) | |
| 482 | + drm_vblank_put(dev, crtc); | |
| 483 | + | |
| 484 | + dev->vblank_inmodeset[crtc] = 0; | |
| 479 | 485 | } |
| 480 | 486 | } |
| 481 | 487 | EXPORT_SYMBOL(drm_vblank_post_modeset); |
| @@ -811,7 +811,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data, · 810 unmodified lines | ||
| 811 | 811 | dev_priv->hws_map.flags = 0; |
| 812 | 812 | dev_priv->hws_map.mtrr = 0; |
| 813 | 813 | |
| 814 | − drm_core_ioremap(&dev_priv->hws_map, dev); | |
| 814 | + drm_core_ioremap_wc(&dev_priv->hws_map, dev); | |
| 815 | 815 | if (dev_priv->hws_map.handle == NULL) { |
| 816 | 816 | i915_dma_cleanup(dev); |
| 817 | 817 | dev_priv->status_gfx_addr = 0; |
| @@ -3548,7 +3548,7 @@ i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj, · 3547 unmodified lines | ||
| 3548 | 3548 | user_data = (char __user *) (uintptr_t) args->data_ptr; |
| 3549 | 3549 | obj_addr = obj_priv->phys_obj->handle->vaddr + args->offset; |
| 3550 | 3550 | |
| 3551 | − DRM_ERROR("obj_addr %p, %lld\n", obj_addr, args->size); | |
| 3551 | + DRM_DEBUG("obj_addr %p, %lld\n", obj_addr, args->size); | |
| 3552 | 3552 | ret = copy_from_user(obj_addr, user_data, args->size); |
| 3553 | 3553 | if (ret) |
| 3554 | 3554 | return -EFAULT; |
| @@ -111,6 +111,12 @@ parse_panel_data(struct drm_i915_private *dev_priv, struct bdb_header *bdb) · 110 unmodified lines | ||
| 111 | 111 | panel_fixed_mode->clock = dvo_timing->clock * 10; |
| 112 | 112 | panel_fixed_mode->type = DRM_MODE_TYPE_PREFERRED; |
| 113 | 113 | |
| 114 | + /* Some VBTs have bogus h/vtotal values */ | |
| 115 | + if (panel_fixed_mode->hsync_end > panel_fixed_mode->htotal) | |
| 116 | + panel_fixed_mode->htotal = panel_fixed_mode->hsync_end + 1; | |
| 117 | + if (panel_fixed_mode->vsync_end > panel_fixed_mode->vtotal) | |
| 118 | + panel_fixed_mode->vtotal = panel_fixed_mode->vsync_end + 1; | |
| 119 | + | |
| 114 | 120 | drm_mode_set_name(panel_fixed_mode); |
| 115 | 121 | |
| 116 | 122 | dev_priv->vbt_mode = panel_fixed_mode; |
| @@ -217,7 +217,7 @@ bool intel_pipe_has_type (struct drm_crtc *crtc, int type) · 216 unmodified lines | ||
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | −#define INTELPllInvalid(s) do { DRM_DEBUG(s); return false; } while (0) | |
| 220 | +#define INTELPllInvalid(s) do { /* DRM_DEBUG(s); */ return false; } while (0) | |
| 221 | 221 | /** |
| 222 | 222 | * Returns whether the given set of divisors are valid for a given refclk with |
| 223 | 223 | * the given connectors. |
| @@ -46,7 +46,7 @@ menuconfig IDE · 45 unmodified lines | ||
| 46 | 46 | SMART parameters from disk drives. |
| 47 | 47 | |
| 48 | 48 | To compile this driver as a module, choose M here: the |
| 49 | − module will be called ide. | |
| 49 | + module will be called ide-core.ko. | |
| 50 | 50 | |
| 51 | 51 | For further information, please read <file:Documentation/ide/ide.txt>. |
| 52 | 52 | |
| @@ -166,7 +166,7 @@ static unsigned int init_chipset_amd74xx(struct pci_dev *dev) · 165 unmodified lines | ||
| 166 | 166 | * Check for broken FIFO support. |
| 167 | 167 | */ |
| 168 | 168 | if (dev->vendor == PCI_VENDOR_ID_AMD && |
| 169 | − dev->vendor == PCI_DEVICE_ID_AMD_VIPER_7411) | |
| 169 | + dev->device == PCI_DEVICE_ID_AMD_VIPER_7411) | |
| 170 | 170 | t &= 0x0f; |
| 171 | 171 | else |
| 172 | 172 | t |= 0xf0; |
| @@ -52,7 +52,7 @@ static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio) · 51 unmodified lines | ||
| 52 | 52 | { |
| 53 | 53 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
| 54 | 54 | unsigned long flags; |
| 55 | − int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | |
| 55 | + int timing_shift = (drive->dn ^ 1) * 8; | |
| 56 | 56 | u32 pio_timing_data; |
| 57 | 57 | u16 pio_mode_data; |
| 58 | 58 | |
| @@ -85,7 +85,7 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) · 26 unmodified lines | ||
| 85 | 85 | { |
| 86 | 86 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
| 87 | 87 | unsigned long flags; |
| 88 | − int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | |
| 88 | + int timing_shift = (drive->dn ^ 1) * 8; | |
| 89 | 89 | u32 tmp32; |
| 90 | 90 | u16 tmp16; |
| 91 | 91 | u16 udma_ctl = 0; |
| @@ -55,7 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | static DEFINE_MUTEX(idecd_ref_mutex); |
| 57 | 57 | |
| 58 | −static void ide_cd_release(struct kref *); | |
| 58 | +static void ide_cd_release(struct device *); | |
| 59 | 59 | |
| 60 | 60 | static struct cdrom_info *ide_cd_get(struct gendisk *disk) |
| 61 | 61 | { |
| @@ -67,7 +67,7 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk) · 5 unmodified lines | ||
| 67 | 67 | if (ide_device_get(cd->drive)) |
| 68 | 68 | cd = NULL; |
| 69 | 69 | else |
| 70 | − kref_get(&cd->kref); | |
| 70 | + get_device(&cd->dev); | |
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | mutex_unlock(&idecd_ref_mutex); |
| @@ -79,7 +79,7 @@ static void ide_cd_put(struct cdrom_info *cd) · 5 unmodified lines | ||
| 79 | 79 | ide_drive_t *drive = cd->drive; |
| 80 | 80 | |
| 81 | 81 | mutex_lock(&idecd_ref_mutex); |
| 82 | − kref_put(&cd->kref, ide_cd_release); | |
| 82 | + put_device(&cd->dev); | |
| 83 | 83 | ide_device_put(drive); |
| 84 | 84 | mutex_unlock(&idecd_ref_mutex); |
| 85 | 85 | } |
| @@ -194,6 +194,14 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, · 108 unmodified lines | ||
| 194 | 194 | bio_sectors = max(bio_sectors(failed_command->bio), 4U); |
| 195 | 195 | sector &= ~(bio_sectors - 1); |
| 196 | 196 | |
| 197 | + /* | |
| 198 | + * The SCSI specification allows for the value | |
| 199 | + * returned by READ CAPACITY to be up to 75 2K | |
| 200 | + * sectors past the last readable block. | |
| 201 | + * Therefore, if we hit a medium error within the | |
| 202 | + * last 75 2K sectors, we decrease the saved size | |
| 203 | + * value. | |
| 204 | + */ | |
| 197 | 205 | if (sector < get_capacity(info->disk) && |
| 198 | 206 | drive->probed_capacity - sector < 4 * 75) |
| 199 | 207 | set_capacity(info->disk, sector); |
| @@ -1790,15 +1798,17 @@ static void ide_cd_remove(ide_drive_t *drive) · 1590 unmodified lines | ||
| 1790 | 1798 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); |
| 1791 | 1799 | |
| 1792 | 1800 | ide_proc_unregister_driver(drive, info->driver); |
| 1793 | − | |
| 1801 | + device_del(&info->dev); | |
| 1794 | 1802 | del_gendisk(info->disk); |
| 1795 | 1803 | |
| 1796 | − ide_cd_put(info); | |
| 1804 | + mutex_lock(&idecd_ref_mutex); | |
| 1805 | + put_device(&info->dev); | |
| 1806 | + mutex_unlock(&idecd_ref_mutex); | |
| 1797 | 1807 | } |
| 1798 | 1808 | |
| 1799 | −static void ide_cd_release(struct kref *kref) | |
| 1809 | +static void ide_cd_release(struct device *dev) | |
| 1800 | 1810 | { |
| 1801 | − struct cdrom_info *info = to_ide_drv(kref, cdrom_info); | |
| 1811 | + struct cdrom_info *info = to_ide_drv(dev, cdrom_info); | |
| 1802 | 1812 | struct cdrom_device_info *devinfo = &info->devinfo; |
| 1803 | 1813 | ide_drive_t *drive = info->drive; |
| 1804 | 1814 | struct gendisk *g = info->disk; |
| @@ -1997,7 +2007,12 @@ static int ide_cd_probe(ide_drive_t *drive) · 192 unmodified lines | ||
| 1997 | 2007 | |
| 1998 | 2008 | ide_init_disk(g, drive); |
| 1999 | 2009 | |
| 2000 | − kref_init(&info->kref); | |
| 2010 | + info->dev.parent = &drive->gendev; | |
| 2011 | + info->dev.release = ide_cd_release; | |
| 2012 | + dev_set_name(&info->dev, dev_name(&drive->gendev)); | |
| 2013 | + | |
| 2014 | + if (device_register(&info->dev)) | |
| 2015 | + goto out_free_disk; | |
| 2001 | 2016 | |
| 2002 | 2017 | info->drive = drive; |
| 2003 | 2018 | info->driver = &ide_cdrom_driver; |
| @@ -2011,7 +2026,7 @@ static int ide_cd_probe(ide_drive_t *drive) · 7 unmodified lines | ||
| 2011 | 2026 | g->driverfs_dev = &drive->gendev; |
| 2012 | 2027 | g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; |
| 2013 | 2028 | if (ide_cdrom_setup(drive)) { |
| 2014 | − ide_cd_release(&info->kref); | |
| 2029 | + put_device(&info->dev); | |
| 2015 | 2030 | goto failed; |
| 2016 | 2031 | } |
| 2017 | 2032 | |
| @@ -2021,6 +2036,8 @@ static int ide_cd_probe(ide_drive_t *drive) · 3 unmodified lines | ||
| 2021 | 2036 | add_disk(g); |
| 2022 | 2037 | return 0; |
| 2023 | 2038 | |
| 2039 | +out_free_disk: | |
| 2040 | + put_disk(g); | |
| 2024 | 2041 | out_free_cd: |
| 2025 | 2042 | kfree(info); |
| 2026 | 2043 | failed: |
| @@ -80,7 +80,7 @@ struct cdrom_info { · 79 unmodified lines | ||
| 80 | 80 | ide_drive_t *drive; |
| 81 | 81 | struct ide_driver *driver; |
| 82 | 82 | struct gendisk *disk; |
| 83 | − struct kref kref; | |
| 83 | + struct device dev; | |
| 84 | 84 | |
| 85 | 85 | /* Buffer for table of contents. NULL if we haven't allocated |
| 86 | 86 | a TOC buffer for this device yet. */ |
| @@ -25,7 +25,7 @@ module_param(debug_mask, ulong, 0644); · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | static DEFINE_MUTEX(ide_disk_ref_mutex); |
| 27 | 27 | |
| 28 | −static void ide_disk_release(struct kref *); | |
| 28 | +static void ide_disk_release(struct device *); | |
| 29 | 29 | |
| 30 | 30 | static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) |
| 31 | 31 | { |
| @@ -37,7 +37,7 @@ static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) · 5 unmodified lines | ||
| 37 | 37 | if (ide_device_get(idkp->drive)) |
| 38 | 38 | idkp = NULL; |
| 39 | 39 | else |
| 40 | − kref_get(&idkp->kref); | |
| 40 | + get_device(&idkp->dev); | |
| 41 | 41 | } |
| 42 | 42 | mutex_unlock(&ide_disk_ref_mutex); |
| 43 | 43 | return idkp; |
| @@ -48,7 +48,7 @@ static void ide_disk_put(struct ide_disk_obj *idkp) · 4 unmodified lines | ||
| 48 | 48 | ide_drive_t *drive = idkp->drive; |
| 49 | 49 | |
| 50 | 50 | mutex_lock(&ide_disk_ref_mutex); |
| 51 | − kref_put(&idkp->kref, ide_disk_release); | |
| 51 | + put_device(&idkp->dev); | |
| 52 | 52 | ide_device_put(drive); |
| 53 | 53 | mutex_unlock(&ide_disk_ref_mutex); |
| 54 | 54 | } |
| @@ -66,17 +66,18 @@ static void ide_gd_remove(ide_drive_t *drive) · 11 unmodified lines | ||
| 66 | 66 | struct gendisk *g = idkp->disk; |
| 67 | 67 | |
| 68 | 68 | ide_proc_unregister_driver(drive, idkp->driver); |
| 69 | − | |
| 69 | + device_del(&idkp->dev); | |
| 70 | 70 | del_gendisk(g); |
| 71 | − | |
| 72 | 71 | drive->disk_ops->flush(drive); |
| 73 | 72 | |
| 74 | − ide_disk_put(idkp); | |
| 73 | + mutex_lock(&ide_disk_ref_mutex); | |
| 74 | + put_device(&idkp->dev); | |
| 75 | + mutex_unlock(&ide_disk_ref_mutex); | |
| 75 | 76 | } |
| 76 | 77 | |
| 77 | −static void ide_disk_release(struct kref *kref) | |
| 78 | +static void ide_disk_release(struct device *dev) | |
| 78 | 79 | { |
| 79 | − struct ide_disk_obj *idkp = to_ide_drv(kref, ide_disk_obj); | |
| 80 | + struct ide_disk_obj *idkp = to_ide_drv(dev, ide_disk_obj); | |
| 80 | 81 | ide_drive_t *drive = idkp->drive; |
| 81 | 82 | struct gendisk *g = idkp->disk; |
| 82 | 83 | |
| @@ -348,7 +349,12 @@ static int ide_gd_probe(ide_drive_t *drive) · 265 unmodified lines | ||
| 348 | 349 | |
| 349 | 350 | ide_init_disk(g, drive); |
| 350 | 351 | |
| 351 | − kref_init(&idkp->kref); | |
| 352 | + idkp->dev.parent = &drive->gendev; | |
| 353 | + idkp->dev.release = ide_disk_release; | |
| 354 | + dev_set_name(&idkp->dev, dev_name(&drive->gendev)); | |
| 355 | + | |
| 356 | + if (device_register(&idkp->dev)) | |
| 357 | + goto out_free_disk; | |
| 352 | 358 | |
| 353 | 359 | idkp->drive = drive; |
| 354 | 360 | idkp->driver = &ide_gd_driver; |
| @@ -373,6 +379,8 @@ static int ide_gd_probe(ide_drive_t *drive) · 18 unmodified lines | ||
| 373 | 379 | add_disk(g); |
| 374 | 380 | return 0; |
| 375 | 381 | |
| 382 | +out_free_disk: | |
| 383 | + put_disk(g); | |
| 376 | 384 | out_free_idkp: |
| 377 | 385 | kfree(idkp); |
| 378 | 386 | failed: |
| @@ -17,7 +17,7 @@ struct ide_disk_obj { · 16 unmodified lines | ||
| 17 | 17 | ide_drive_t *drive; |
| 18 | 18 | struct ide_driver *driver; |
| 19 | 19 | struct gendisk *disk; |
| 20 | − struct kref kref; | |
| 20 | + struct device dev; | |
| 21 | 21 | unsigned int openers; /* protected by BKL for now */ |
| 22 | 22 | |
| 23 | 23 | /* Last failed packet command */ |
| @@ -169,7 +169,7 @@ typedef struct ide_tape_obj { · 168 unmodified lines | ||
| 169 | 169 | ide_drive_t *drive; |
| 170 | 170 | struct ide_driver *driver; |
| 171 | 171 | struct gendisk *disk; |
| 172 | − struct kref kref; | |
| 172 | + struct device dev; | |
| 173 | 173 | |
| 174 | 174 | /* |
| 175 | 175 | * failed_pc points to the last failed packet command, or contains |
| @@ -267,7 +267,7 @@ static DEFINE_MUTEX(idetape_ref_mutex); · 91 unmodified lines | ||
| 267 | 267 | |
| 268 | 268 | static struct class *idetape_sysfs_class; |
| 269 | 269 | |
| 270 | −static void ide_tape_release(struct kref *); | |
| 270 | +static void ide_tape_release(struct device *); | |
| 271 | 271 | |
| 272 | 272 | static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) |
| 273 | 273 | { |
| @@ -279,7 +279,7 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) · 5 unmodified lines | ||
| 279 | 279 | if (ide_device_get(tape->drive)) |
| 280 | 280 | tape = NULL; |
| 281 | 281 | else |
| 282 | − kref_get(&tape->kref); | |
| 282 | + get_device(&tape->dev); | |
| 283 | 283 | } |
| 284 | 284 | mutex_unlock(&idetape_ref_mutex); |
| 285 | 285 | return tape; |
| @@ -290,7 +290,7 @@ static void ide_tape_put(struct ide_tape_obj *tape) · 4 unmodified lines | ||
| 290 | 290 | ide_drive_t *drive = tape->drive; |
| 291 | 291 | |
| 292 | 292 | mutex_lock(&idetape_ref_mutex); |
| 293 | − kref_put(&tape->kref, ide_tape_release); | |
| 293 | + put_device(&tape->dev); | |
| 294 | 294 | ide_device_put(drive); |
| 295 | 295 | mutex_unlock(&idetape_ref_mutex); |
| 296 | 296 | } |
| @@ -308,7 +308,7 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i) · 11 unmodified lines | ||
| 308 | 308 | mutex_lock(&idetape_ref_mutex); |
| 309 | 309 | tape = idetape_devs[i]; |
| 310 | 310 | if (tape) |
| 311 | − kref_get(&tape->kref); | |
| 311 | + get_device(&tape->dev); | |
| 312 | 312 | mutex_unlock(&idetape_ref_mutex); |
| 313 | 313 | return tape; |
| 314 | 314 | } |
| @@ -2256,15 +2256,17 @@ static void ide_tape_remove(ide_drive_t *drive) · 1941 unmodified lines | ||
| 2256 | 2256 | idetape_tape_t *tape = drive->driver_data; |
| 2257 | 2257 | |
| 2258 | 2258 | ide_proc_unregister_driver(drive, tape->driver); |
| 2259 | − | |
| 2259 | + device_del(&tape->dev); | |
| 2260 | 2260 | ide_unregister_region(tape->disk); |
| 2261 | 2261 | |
| 2262 | − ide_tape_put(tape); | |
| 2262 | + mutex_lock(&idetape_ref_mutex); | |
| 2263 | + put_device(&tape->dev); | |
| 2264 | + mutex_unlock(&idetape_ref_mutex); | |
| 2263 | 2265 | } |
| 2264 | 2266 | |
| 2265 | −static void ide_tape_release(struct kref *kref) | |
| 2267 | +static void ide_tape_release(struct device *dev) | |
| 2266 | 2268 | { |
| 2267 | − struct ide_tape_obj *tape = to_ide_drv(kref, ide_tape_obj); | |
| 2269 | + struct ide_tape_obj *tape = to_ide_drv(dev, ide_tape_obj); | |
| 2268 | 2270 | ide_drive_t *drive = tape->drive; |
| 2269 | 2271 | struct gendisk *g = tape->disk; |
| 2270 | 2272 | |
| @@ -2407,7 +2409,12 @@ static int ide_tape_probe(ide_drive_t *drive) · 136 unmodified lines | ||
| 2407 | 2409 | |
| 2408 | 2410 | ide_init_disk(g, drive); |
| 2409 | 2411 | |
| 2410 | − kref_init(&tape->kref); | |
| 2412 | + tape->dev.parent = &drive->gendev; | |
| 2413 | + tape->dev.release = ide_tape_release; | |
| 2414 | + dev_set_name(&tape->dev, dev_name(&drive->gendev)); | |
| 2415 | + | |
| 2416 | + if (device_register(&tape->dev)) | |
| 2417 | + goto out_free_disk; | |
| 2411 | 2418 | |
| 2412 | 2419 | tape->drive = drive; |
| 2413 | 2420 | tape->driver = &idetape_driver; |
| @@ -2436,6 +2443,8 @@ static int ide_tape_probe(ide_drive_t *drive) · 22 unmodified lines | ||
| 2436 | 2443 | |
| 2437 | 2444 | return 0; |
| 2438 | 2445 | |
| 2446 | +out_free_disk: | |
| 2447 | + put_disk(g); | |
| 2439 | 2448 | out_free_tape: |
| 2440 | 2449 | kfree(tape); |
| 2441 | 2450 | failed: |
| @@ -337,6 +337,7 @@ static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp) · 336 unmodified lines | ||
| 337 | 337 | int a, b, i, j = 1; |
| 338 | 338 | unsigned int *dev_param_mask = (unsigned int *)kp->arg; |
| 339 | 339 | |
| 340 | + /* controller . device (0 or 1) [ : 1 (set) | 0 (clear) ] */ | |
| 340 | 341 | if (sscanf(s, "%d.%d:%d", &a, &b, &j) != 3 && |
| 341 | 342 | sscanf(s, "%d.%d", &a, &b) != 2) |
| 342 | 343 | return -EINVAL; |
| @@ -349,7 +350,7 @@ static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp) · 6 unmodified lines | ||
| 349 | 350 | if (j) |
| 350 | 351 | *dev_param_mask |= (1 << i); |
| 351 | 352 | else |
| 352 | − *dev_param_mask &= (1 << i); | |
| 353 | + *dev_param_mask &= ~(1 << i); | |
| 353 | 354 | |
| 354 | 355 | return 0; |
| 355 | 356 | } |
| @@ -392,6 +393,8 @@ static int ide_set_disk_chs(const char *str, struct kernel_param *kp) · 36 unmodified lines | ||
| 392 | 393 | { |
| 393 | 394 | int a, b, c = 0, h = 0, s = 0, i, j = 1; |
| 394 | 395 | |
| 396 | + /* controller . device (0 or 1) : Cylinders , Heads , Sectors */ | |
| 397 | + /* controller . device (0 or 1) : 1 (use CHS) | 0 (ignore CHS) */ | |
| 395 | 398 | if (sscanf(str, "%d.%d:%d,%d,%d", &a, &b, &c, &h, &s) != 5 && |
| 396 | 399 | sscanf(str, "%d.%d:%d", &a, &b, &j) != 3) |
| 397 | 400 | return -EINVAL; |
| @@ -407,7 +410,7 @@ static int ide_set_disk_chs(const char *str, struct kernel_param *kp) · 9 unmodified lines | ||
| 407 | 410 | if (j) |
| 408 | 411 | ide_disks |= (1 << i); |
| 409 | 412 | else |
| 410 | − ide_disks &= (1 << i); | |
| 413 | + ide_disks &= ~(1 << i); | |
| 411 | 414 | |
| 412 | 415 | ide_disks_chs[i].cyl = c; |
| 413 | 416 | ide_disks_chs[i].head = h; |
| @@ -469,6 +472,8 @@ static int ide_set_ignore_cable(const char *s, struct kernel_param *kp) · 55 unmodified lines | ||
| 469 | 472 | { |
| 470 | 473 | int i, j = 1; |
| 471 | 474 | |
| 475 | + /* controller (ignore) */ | |
| 476 | + /* controller : 1 (ignore) | 0 (use) */ | |
| 472 | 477 | if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1) |
| 473 | 478 | return -EINVAL; |
| 474 | 479 | |
| @@ -478,7 +483,7 @@ static int ide_set_ignore_cable(const char *s, struct kernel_param *kp) · 3 unmodified lines | ||
| 478 | 483 | if (j) |
| 479 | 484 | ide_ignore_cable |= (1 << i); |
| 480 | 485 | else |
| 481 | − ide_ignore_cable &= (1 << i); | |
| 486 | + ide_ignore_cable &= ~(1 << i); | |
| 482 | 487 | |
| 483 | 488 | return 0; |
| 484 | 489 | } |
| @@ -5,9 +5,8 @@ · 4 unmodified lines | ||
| 5 | 5 | * May be copied or modified under the terms of the GNU General Public License |
| 6 | 6 | * Based in part on the ITE vendor provided SCSI driver. |
| 7 | 7 | * |
| 8 | − * Documentation available from | |
| 9 | − * http://www.ite.com.tw/pc/IT8212F_V04.pdf | |
| 10 | − * Some other documents are NDA. | |
| 8 | + * Documentation: | |
| 9 | + * Datasheet is freely available, some other documents under NDA. | |
| 11 | 10 | * |
| 12 | 11 | * The ITE8212 isn't exactly a standard IDE controller. It has two |
| 13 | 12 | * modes. In pass through mode then it is an IDE controller. In its smart |
| @@ -1275,7 +1275,7 @@ static void __exit ieee1394_cleanup(void) · 1274 unmodified lines | ||
| 1275 | 1275 | unregister_chrdev_region(IEEE1394_CORE_DEV, 256); |
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | −module_init(ieee1394_init); | |
| 1278 | +fs_initcall(ieee1394_init); | |
| 1279 | 1279 | module_exit(ieee1394_cleanup); |
| 1280 | 1280 | |
| 1281 | 1281 | /* Exported symbols */ |
| @@ -1237,8 +1237,9 @@ static void end_sync_write(struct bio *bio, int error) · 1236 unmodified lines | ||
| 1237 | 1237 | update_head_pos(mirror, r1_bio); |
| 1238 | 1238 | |
| 1239 | 1239 | if (atomic_dec_and_test(&r1_bio->remaining)) { |
| 1240 | − md_done_sync(mddev, r1_bio->sectors, uptodate); | |
| 1240 | + sector_t s = r1_bio->sectors; | |
| 1241 | 1241 | put_buf(r1_bio); |
| 1242 | + md_done_sync(mddev, s, uptodate); | |
| 1242 | 1243 | } |
| 1243 | 1244 | } |
| 1244 | 1245 | |
| @@ -1236,6 +1236,7 @@ static void end_sync_read(struct bio *bio, int error) · 1235 unmodified lines | ||
| 1236 | 1236 | /* for reconstruct, we always reschedule after a read. |
| 1237 | 1237 | * for resync, only after all reads |
| 1238 | 1238 | */ |
| 1239 | + rdev_dec_pending(conf->mirrors[d].rdev, conf->mddev); | |
| 1239 | 1240 | if (test_bit(R10BIO_IsRecover, &r10_bio->state) || |
| 1240 | 1241 | atomic_dec_and_test(&r10_bio->remaining)) { |
| 1241 | 1242 | /* we have read all the blocks, |
| @@ -1243,7 +1244,6 @@ static void end_sync_read(struct bio *bio, int error) · 1 unmodified line | ||
| 1243 | 1244 | */ |
| 1244 | 1245 | reschedule_retry(r10_bio); |
| 1245 | 1246 | } |
| 1246 | − rdev_dec_pending(conf->mirrors[d].rdev, conf->mddev); | |
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | static void end_sync_write(struct bio *bio, int error) |
| @@ -1264,11 +1264,13 @@ static void end_sync_write(struct bio *bio, int error) · 14 unmodified lines | ||
| 1264 | 1264 | |
| 1265 | 1265 | update_head_pos(i, r10_bio); |
| 1266 | 1266 | |
| 1267 | + rdev_dec_pending(conf->mirrors[d].rdev, mddev); | |
| 1267 | 1268 | while (atomic_dec_and_test(&r10_bio->remaining)) { |
| 1268 | 1269 | if (r10_bio->master_bio == NULL) { |
| 1269 | 1270 | /* the primary of several recovery bios */ |
| 1270 | − md_done_sync(mddev, r10_bio->sectors, 1); | |
| 1271 | + sector_t s = r10_bio->sectors; | |
| 1271 | 1272 | put_buf(r10_bio); |
| 1273 | + md_done_sync(mddev, s, 1); | |
| 1272 | 1274 | break; |
| 1273 | 1275 | } else { |
| 1274 | 1276 | r10bio_t *r10_bio2 = (r10bio_t *)r10_bio->master_bio; |
| @@ -1276,7 +1278,6 @@ static void end_sync_write(struct bio *bio, int error) · 1 unmodified line | ||
| 1276 | 1278 | r10_bio = r10_bio2; |
| 1277 | 1279 | } |
| 1278 | 1280 | } |
| 1279 | − rdev_dec_pending(conf->mirrors[d].rdev, mddev); | |
| 1280 | 1281 | } |
| 1281 | 1282 | |
| 1282 | 1283 | /* |
| @@ -1749,8 +1750,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i · 466 unmodified lines | ||
| 1749 | 1750 | if (!go_faster && conf->nr_waiting) |
| 1750 | 1751 | msleep_interruptible(1000); |
| 1751 | 1752 | |
| 1752 | − bitmap_cond_end_sync(mddev->bitmap, sector_nr); | |
| 1753 | − | |
| 1754 | 1753 | /* Again, very different code for resync and recovery. |
| 1755 | 1754 | * Both must result in an r10bio with a list of bios that |
| 1756 | 1755 | * have bi_end_io, bi_sector, bi_bdev set, |
| @@ -1886,6 +1885,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i · 129 unmodified lines | ||
| 1886 | 1885 | /* resync. Schedule a read for every block at this virt offset */ |
| 1887 | 1886 | int count = 0; |
| 1888 | 1887 | |
| 1888 | + bitmap_cond_end_sync(mddev->bitmap, sector_nr); | |
| 1889 | + | |
| 1889 | 1890 | if (!bitmap_start_sync(mddev->bitmap, sector_nr, |
| 1890 | 1891 | &sync_blocks, mddev->degraded) && |
| 1891 | 1892 | !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { |
| @@ -2010,13 +2011,13 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i · 118 unmodified lines | ||
| 2010 | 2011 | /* There is nowhere to write, so all non-sync |
| 2011 | 2012 | * drives must be failed, so try the next chunk... |
| 2012 | 2013 | */ |
| 2013 | − { | |
| 2014 | − sector_t sec = max_sector - sector_nr; | |
| 2015 | − sectors_skipped += sec; | |
| 2014 | + if (sector_nr + max_sync < max_sector) | |
| 2015 | + max_sector = sector_nr + max_sync; | |
| 2016 | + | |
| 2017 | + sectors_skipped += (max_sector - sector_nr); | |
| 2016 | 2018 | chunks_skipped ++; |
| 2017 | 2019 | sector_nr = max_sector; |
| 2018 | 2020 | goto skipped; |
| 2019 | − } | |
| 2020 | 2021 | } |
| 2021 | 2022 | |
| 2022 | 2023 | static int run(mddev_t *mddev) |
| @@ -192,6 +192,7 @@ int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *d · 191 unmodified lines | ||
| 192 | 192 | |
| 193 | 193 | return 0; |
| 194 | 194 | } |
| 195 | +EXPORT_SYMBOL(flexcop_pid_feed_control); | |
| 195 | 196 | |
| 196 | 197 | void flexcop_hw_filter_init(struct flexcop_device *fc) |
| 197 | 198 | { |
| @@ -13,9 +13,9 @@ static int enable_pid_filtering = 1; · 12 unmodified lines | ||
| 13 | 13 | module_param(enable_pid_filtering, int, 0444); |
| 14 | 14 | MODULE_PARM_DESC(enable_pid_filtering, "enable hardware pid filtering: supported values: 0 (fullts), 1"); |
| 15 | 15 | |
| 16 | −static int irq_chk_intv; | |
| 16 | +static int irq_chk_intv = 100; | |
| 17 | 17 | module_param(irq_chk_intv, int, 0644); |
| 18 | −MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ watchdog (currently just debugging)."); | |
| 18 | +MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ streaming watchdog."); | |
| 19 | 19 | |
| 20 | 20 | #ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG |
| 21 | 21 | #define dprintk(level,args...) \ |
| @@ -34,7 +34,9 @@ MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ watchdog (currently jus · 12 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | static int debug; |
| 36 | 36 | module_param(debug, int, 0644); |
| 37 | −MODULE_PARM_DESC(debug, "set debug level (1=info,2=regs,4=TS,8=irqdma (|-able))." DEBSTATUS); | |
| 37 | +MODULE_PARM_DESC(debug, | |
| 38 | + "set debug level (1=info,2=regs,4=TS,8=irqdma,16=check (|-able))." | |
| 39 | + DEBSTATUS); | |
| 38 | 40 | |
| 39 | 41 | #define DRIVER_VERSION "0.1" |
| 40 | 42 | #define DRIVER_NAME "Technisat/B2C2 FlexCop II/IIb/III Digital TV PCI Driver" |
| @@ -58,6 +60,8 @@ struct flexcop_pci { · 17 unmodified lines | ||
| 58 | 60 | int active_dma1_addr; /* 0 = addr0 of dma1; 1 = addr1 of dma1 */ |
| 59 | 61 | u32 last_dma1_cur_pos; /* position of the pointer last time the timer/packet irq occured */ |
| 60 | 62 | int count; |
| 63 | + int count_prev; | |
| 64 | + int stream_problem; | |
| 61 | 65 | |
| 62 | 66 | spinlock_t irq_lock; |
| 63 | 67 | |
| @@ -103,18 +107,32 @@ static void flexcop_pci_irq_check_work(struct work_struct *work) · 39 unmodified lines | ||
| 103 | 107 | container_of(work, struct flexcop_pci, irq_check_work.work); |
| 104 | 108 | struct flexcop_device *fc = fc_pci->fc_dev; |
| 105 | 109 | |
| 106 | − flexcop_ibi_value v = fc->read_ibi_reg(fc,sram_dest_reg_714); | |
| 107 | − | |
| 108 | − flexcop_dump_reg(fc_pci->fc_dev,dma1_000,4); | |
| 109 | − | |
| 110 | − if (v.sram_dest_reg_714.net_ovflow_error) | |
| 111 | − deb_chk("sram net_ovflow_error\n"); | |
| 112 | − if (v.sram_dest_reg_714.media_ovflow_error) | |
| 113 | − deb_chk("sram media_ovflow_error\n"); | |
| 114 | − if (v.sram_dest_reg_714.cai_ovflow_error) | |
| 115 | − deb_chk("sram cai_ovflow_error\n"); | |
| 116 | − if (v.sram_dest_reg_714.cai_ovflow_error) | |
| 117 | − deb_chk("sram cai_ovflow_error\n"); | |
| 110 | + if (fc->feedcount) { | |
| 111 | + | |
| 112 | + if (fc_pci->count == fc_pci->count_prev) { | |
| 113 | + deb_chk("no IRQ since the last check\n"); | |
| 114 | + if (fc_pci->stream_problem++ == 3) { | |
| 115 | + struct dvb_demux_feed *feed; | |
| 116 | + | |
| 117 | + spin_lock_irq(&fc->demux.lock); | |
| 118 | + list_for_each_entry(feed, &fc->demux.feed_list, | |
| 119 | + list_head) { | |
| 120 | + flexcop_pid_feed_control(fc, feed, 0); | |
| 121 | + } | |
| 122 | + | |
| 123 | + list_for_each_entry(feed, &fc->demux.feed_list, | |
| 124 | + list_head) { | |
| 125 | + flexcop_pid_feed_control(fc, feed, 1); | |
| 126 | + } | |
| 127 | + spin_unlock_irq(&fc->demux.lock); | |
| 128 | + | |
| 129 | + fc_pci->stream_problem = 0; | |
| 130 | + } | |
| 131 | + } else { | |
| 132 | + fc_pci->stream_problem = 0; | |
| 133 | + fc_pci->count_prev = fc_pci->count; | |
| 134 | + } | |
| 135 | + } | |
| 118 | 136 | |
| 119 | 137 | schedule_delayed_work(&fc_pci->irq_check_work, |
| 120 | 138 | msecs_to_jiffies(irq_chk_intv < 100 ? 100 : irq_chk_intv)); |
| @@ -216,16 +234,12 @@ static int flexcop_pci_stream_control(struct flexcop_device *fc, int onoff) · 95 unmodified lines | ||
| 216 | 234 | flexcop_dma_control_timer_irq(fc,FC_DMA_1,1); |
| 217 | 235 | deb_irq("IRQ enabled\n"); |
| 218 | 236 | |
| 237 | + fc_pci->count_prev = fc_pci->count; | |
| 238 | + | |
| 219 | 239 | // fc_pci->active_dma1_addr = 0; |
| 220 | 240 | // flexcop_dma_control_size_irq(fc,FC_DMA_1,1); |
| 221 | 241 | |
| 222 | − if (irq_chk_intv > 0) | |
| 223 | − schedule_delayed_work(&fc_pci->irq_check_work, | |
| 224 | − msecs_to_jiffies(irq_chk_intv < 100 ? 100 : irq_chk_intv)); | |
| 225 | 242 | } else { |
| 226 | − if (irq_chk_intv > 0) | |
| 227 | − cancel_delayed_work(&fc_pci->irq_check_work); | |
| 228 | − | |
| 229 | 243 | flexcop_dma_control_timer_irq(fc,FC_DMA_1,0); |
| 230 | 244 | deb_irq("IRQ disabled\n"); |
| 231 | 245 | |
| @@ -299,8 +313,6 @@ static int flexcop_pci_init(struct flexcop_pci *fc_pci) · 67 unmodified lines | ||
| 299 | 313 | IRQF_SHARED, DRIVER_NAME, fc_pci)) != 0) |
| 300 | 314 | goto err_pci_iounmap; |
| 301 | 315 | |
| 302 | − | |
| 303 | − | |
| 304 | 316 | fc_pci->init_state |= FC_PCI_INIT; |
| 305 | 317 | return ret; |
| 306 | 318 | |
| @@ -375,6 +387,10 @@ static int flexcop_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e · 68 unmodified lines | ||
| 375 | 387 | |
| 376 | 388 | INIT_DELAYED_WORK(&fc_pci->irq_check_work, flexcop_pci_irq_check_work); |
| 377 | 389 | |
| 390 | + if (irq_chk_intv > 0) | |
| 391 | + schedule_delayed_work(&fc_pci->irq_check_work, | |
| 392 | + msecs_to_jiffies(irq_chk_intv < 100 ? 100 : irq_chk_intv)); | |
| 393 | + | |
| 378 | 394 | return ret; |
| 379 | 395 | |
| 380 | 396 | err_fc_exit: |
| @@ -393,6 +409,9 @@ static void flexcop_pci_remove(struct pci_dev *pdev) · 12 unmodified lines | ||
| 393 | 409 | { |
| 394 | 410 | struct flexcop_pci *fc_pci = pci_get_drvdata(pdev); |
| 395 | 411 | |
| 412 | + if (irq_chk_intv > 0) | |
| 413 | + cancel_delayed_work(&fc_pci->irq_check_work); | |
| 414 | + | |
| 396 | 415 | flexcop_pci_dma_exit(fc_pci); |
| 397 | 416 | flexcop_device_exit(fc_pci->fc_dev); |
| 398 | 417 | flexcop_pci_exit(fc_pci); |
| @@ -212,8 +212,7 @@ void flexcop_reset_block_300(struct flexcop_device *fc) · 211 unmodified lines | ||
| 212 | 212 | v210.sw_reset_210.Block_reset_enable = 0xb2; |
| 213 | 213 | |
| 214 | 214 | fc->write_ibi_reg(fc,sw_reset_210,v210); |
| 215 | − msleep(1); | |
| 216 | − | |
| 215 | + udelay(1000); | |
| 217 | 216 | fc->write_ibi_reg(fc,ctrl_208,v208_save); |
| 218 | 217 | } |
| 219 | 218 | |
| @@ -463,6 +463,8 @@ static int em28xx_audio_init(struct em28xx *dev) · 462 unmodified lines | ||
| 463 | 463 | pcm->info_flags = 0; |
| 464 | 464 | pcm->private_data = dev; |
| 465 | 465 | strcpy(pcm->name, "Empia 28xx Capture"); |
| 466 | + | |
| 467 | + snd_card_set_dev(card, &dev->udev->dev); | |
| 466 | 468 | strcpy(card->driver, "Empia Em28xx Audio"); |
| 467 | 469 | strcpy(card->shortname, "Em28xx Audio"); |
| 468 | 470 | strcpy(card->longname, "Empia Em28xx Audio"); |
| @@ -1155,23 +1155,23 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, · 1154 unmodified lines | ||
| 1155 | 1155 | { |
| 1156 | 1156 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
| 1157 | 1157 | struct pxa_camera_dev *pcdev = ici->priv; |
| 1158 | − const struct soc_camera_data_format *host_fmt, *cam_fmt = NULL; | |
| 1159 | − const struct soc_camera_format_xlate *xlate; | |
| 1158 | + const struct soc_camera_data_format *cam_fmt = NULL; | |
| 1159 | + const struct soc_camera_format_xlate *xlate = NULL; | |
| 1160 | 1160 | struct soc_camera_sense sense = { |
| 1161 | 1161 | .master_clock = pcdev->mclk, |
| 1162 | 1162 | .pixel_clock_max = pcdev->ciclk / 4, |
| 1163 | 1163 | }; |
| 1164 | − int ret, buswidth; | |
| 1164 | + int ret; | |
| 1165 | 1165 | |
| 1166 | − xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | |
| 1167 | − if (!xlate) { | |
| 1168 | − dev_warn(&ici->dev, "Format %x not found\n", pixfmt); | |
| 1169 | − return -EINVAL; | |
| 1170 | − } | |
| 1166 | + if (pixfmt) { | |
| 1167 | + xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | |
| 1168 | + if (!xlate) { | |
| 1169 | + dev_warn(&ici->dev, "Format %x not found\n", pixfmt); | |
| 1170 | + return -EINVAL; | |
| 1171 | + } | |
| 1171 | 1172 | |
| 1172 | − buswidth = xlate->buswidth; | |
| 1173 | − host_fmt = xlate->host_fmt; | |
| 1174 | − cam_fmt = xlate->cam_fmt; | |
| 1173 | + cam_fmt = xlate->cam_fmt; | |
| 1174 | + } | |
| 1175 | 1175 | |
| 1176 | 1176 | /* If PCLK is used to latch data from the sensor, check sense */ |
| 1177 | 1177 | if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) |
| @@ -1201,8 +1201,8 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, · 23 unmodified lines | ||
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | if (pixfmt && !ret) { |
| 1204 | − icd->buswidth = buswidth; | |
| 1205 | − icd->current_fmt = host_fmt; | |
| 1204 | + icd->buswidth = xlate->buswidth; | |
| 1205 | + icd->current_fmt = xlate->host_fmt; | |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | return ret; |
| @@ -603,21 +603,18 @@ static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd, · 602 unmodified lines | ||
| 603 | 603 | const struct soc_camera_format_xlate *xlate; |
| 604 | 604 | int ret; |
| 605 | 605 | |
| 606 | + if (!pixfmt) | |
| 607 | + return icd->ops->set_fmt(icd, pixfmt, rect); | |
| 608 | + | |
| 606 | 609 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
| 607 | 610 | if (!xlate) { |
| 608 | 611 | dev_warn(&ici->dev, "Format %x not found\n", pixfmt); |
| 609 | 612 | return -EINVAL; |
| 610 | 613 | } |
| 611 | 614 | |
| 612 | − switch (pixfmt) { | |
| 613 | − case 0: /* Only geometry change */ | |
| 614 | − ret = icd->ops->set_fmt(icd, pixfmt, rect); | |
| 615 | − break; | |
| 616 | − default: | |
| 617 | − ret = icd->ops->set_fmt(icd, xlate->cam_fmt->fourcc, rect); | |
| 618 | − } | |
| 615 | + ret = icd->ops->set_fmt(icd, xlate->cam_fmt->fourcc, rect); | |
| 619 | 616 | |
| 620 | − if (pixfmt && !ret) { | |
| 617 | + if (!ret) { | |
| 621 | 618 | icd->buswidth = xlate->buswidth; |
| 622 | 619 | icd->current_fmt = xlate->host_fmt; |
| 623 | 620 | pcdev->camera_fmt = xlate->cam_fmt; |
| @@ -710,6 +710,7 @@ out: · 709 unmodified lines | ||
| 710 | 710 | |
| 711 | 711 | static struct pci_device_id ilo_devices[] = { |
| 712 | 712 | { PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xB204) }, |
| 713 | + { PCI_DEVICE(PCI_VENDOR_ID_HP, 0x3307) }, | |
| 713 | 714 | { } |
| 714 | 715 | }; |
| 715 | 716 | MODULE_DEVICE_TABLE(pci, ilo_devices); |
| @@ -758,7 +759,7 @@ static void __exit ilo_exit(void) · 42 unmodified lines | ||
| 758 | 759 | class_destroy(ilo_class); |
| 759 | 760 | } |
| 760 | 761 | |
| 761 | −MODULE_VERSION("0.06"); | |
| 762 | +MODULE_VERSION("1.0"); | |
| 762 | 763 | MODULE_ALIAS(ILO_NAME); |
| 763 | 764 | MODULE_DESCRIPTION(ILO_NAME); |
| 764 | 765 | MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>"); |
| @@ -19,6 +19,7 @@ static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); · 18 unmodified lines | ||
| 19 | 19 | static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
| 20 | 20 | static void maprom_nop (struct mtd_info *); |
| 21 | 21 | static struct mtd_info *map_rom_probe(struct map_info *map); |
| 22 | +static int maprom_erase (struct mtd_info *mtd, struct erase_info *info); | |
| 22 | 23 | |
| 23 | 24 | static struct mtd_chip_driver maprom_chipdrv = { |
| 24 | 25 | .probe = map_rom_probe, |
| @@ -42,6 +43,7 @@ static struct mtd_info *map_rom_probe(struct map_info *map) · 17 unmodified lines | ||
| 42 | 43 | mtd->read = maprom_read; |
| 43 | 44 | mtd->write = maprom_write; |
| 44 | 45 | mtd->sync = maprom_nop; |
| 46 | + mtd->erase = maprom_erase; | |
| 45 | 47 | mtd->flags = MTD_CAP_ROM; |
| 46 | 48 | mtd->erasesize = map->size; |
| 47 | 49 | mtd->writesize = 1; |
| @@ -71,6 +73,12 @@ static int maprom_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re · 23 unmodified lines | ||
| 71 | 73 | return -EIO; |
| 72 | 74 | } |
| 73 | 75 | |
| 76 | +static int maprom_erase (struct mtd_info *mtd, struct erase_info *info) | |
| 77 | +{ | |
| 78 | + /* We do our best 8) */ | |
| 79 | + return -EROFS; | |
| 80 | +} | |
| 81 | + | |
| 74 | 82 | static int __init map_rom_init(void) |
| 75 | 83 | { |
| 76 | 84 | register_mtd_chip_driver(&maprom_chipdrv); |
| @@ -267,22 +267,28 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength) · 266 unmodified lines | ||
| 267 | 267 | if (*(szlength) != '+') { |
| 268 | 268 | devlength = simple_strtoul(szlength, &buffer, 0); |
| 269 | 269 | devlength = handle_unit(devlength, buffer) - devstart; |
| 270 | + if (devlength < devstart) | |
| 271 | + goto err_out; | |
| 272 | + | |
| 273 | + devlength -= devstart; | |
| 270 | 274 | } else { |
| 271 | 275 | devlength = simple_strtoul(szlength + 1, &buffer, 0); |
| 272 | 276 | devlength = handle_unit(devlength, buffer); |
| 273 | 277 | } |
| 274 | 278 | T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n", |
| 275 | 279 | devname, devstart, devlength); |
| 276 | − if ((devstart < 0) || (devlength < 0) || (devlength % SLRAM_BLK_SZ != 0)) { | |
| 277 | − E("slram: Illegal start / length parameter.\n"); | |
| 278 | − return(-EINVAL); | |
| 279 | − } | |
| 280 | + if (devlength % SLRAM_BLK_SZ != 0) | |
| 281 | + goto err_out; | |
| 280 | 282 | |
| 281 | 283 | if ((devstart = register_device(devname, devstart, devlength))){ |
| 282 | 284 | unregister_devices(); |
| 283 | 285 | return((int)devstart); |
| 284 | 286 | } |
| 285 | 287 | return(0); |
| 288 | + | |
| 289 | +err_out: | |
| 290 | + E("slram: Illegal length parameter.\n"); | |
| 291 | + return(-EINVAL); | |
| 286 | 292 | } |
| 287 | 293 | |
| 288 | 294 | #ifndef MODULE |
| @@ -12,6 +12,7 @@ config MTD_LPDDR · 11 unmodified lines | ||
| 12 | 12 | DDR memories, intended for battery-operated systems. |
| 13 | 13 | |
| 14 | 14 | config MTD_QINFO_PROBE |
| 15 | + depends on MTD_LPDDR | |
| 15 | 16 | tristate "Detect flash chips by QINFO probe" |
| 16 | 17 | help |
| 17 | 18 | Device Information for LPDDR chips is offered through the Overlay |
| @@ -491,7 +491,7 @@ config MTD_PCMCIA_ANONYMOUS · 490 unmodified lines | ||
| 491 | 491 | |
| 492 | 492 | config MTD_BFIN_ASYNC |
| 493 | 493 | tristate "Blackfin BF533-STAMP Flash Chip Support" |
| 494 | − depends on BFIN533_STAMP && MTD_CFI | |
| 494 | + depends on BFIN533_STAMP && MTD_CFI && MTD_COMPLEX_MAPPINGS | |
| 495 | 495 | select MTD_PARTITIONS |
| 496 | 496 | default y |
| 497 | 497 | help |
| @@ -152,14 +152,18 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev) · 151 unmodified lines | ||
| 152 | 152 | |
| 153 | 153 | if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) { |
| 154 | 154 | pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin); |
| 155 | + kfree(state); | |
| 155 | 156 | return -EBUSY; |
| 156 | 157 | } |
| 157 | 158 | gpio_direction_output(state->enet_flash_pin, 1); |
| 158 | 159 | |
| 159 | 160 | pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8); |
| 160 | 161 | state->mtd = do_map_probe(memory->name, &state->map); |
| 161 | − if (!state->mtd) | |
| 162 | + if (!state->mtd) { | |
| 163 | + gpio_free(state->enet_flash_pin); | |
| 164 | + kfree(state); | |
| 162 | 165 | return -ENXIO; |
| 166 | + } | |
| 163 | 167 | |
| 164 | 168 | #ifdef CONFIG_MTD_PARTITIONS |
| 165 | 169 | ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); |
| @@ -342,9 +342,9 @@ static struct pci_device_id ck804xrom_pci_tbl[] = { · 341 unmodified lines | ||
| 342 | 342 | { 0, } |
| 343 | 343 | }; |
| 344 | 344 | |
| 345 | +#if 0 | |
| 345 | 346 | MODULE_DEVICE_TABLE(pci, ck804xrom_pci_tbl); |
| 346 | 347 | |
| 347 | −#if 0 | |
| 348 | 348 | static struct pci_driver ck804xrom_driver = { |
| 349 | 349 | .name = MOD_NAME, |
| 350 | 350 | .id_table = ck804xrom_pci_tbl, |
| @@ -29,6 +29,7 @@ struct physmap_flash_info { · 28 unmodified lines | ||
| 29 | 29 | struct map_info map[MAX_RESOURCES]; |
| 30 | 30 | #ifdef CONFIG_MTD_PARTITIONS |
| 31 | 31 | int nr_parts; |
| 32 | + struct mtd_partition *parts; | |
| 32 | 33 | #endif |
| 33 | 34 | }; |
| 34 | 35 | |
| @@ -45,25 +46,26 @@ static int physmap_flash_remove(struct platform_device *dev) · 10 unmodified lines | ||
| 45 | 46 | |
| 46 | 47 | physmap_data = dev->dev.platform_data; |
| 47 | 48 | |
| 48 | −#ifdef CONFIG_MTD_CONCAT | |
| 49 | − if (info->cmtd != info->mtd[0]) { | |
| 49 | +#ifdef CONFIG_MTD_PARTITIONS | |
| 50 | + if (info->nr_parts) { | |
| 51 | + del_mtd_partitions(info->cmtd); | |
| 52 | + kfree(info->parts); | |
| 53 | + } else if (physmap_data->nr_parts) | |
| 54 | + del_mtd_partitions(info->cmtd); | |
| 55 | + else | |
| 50 | 56 | del_mtd_device(info->cmtd); |
| 57 | +#else | |
| 58 | + del_mtd_device(info->cmtd); | |
| 59 | +#endif | |
| 60 | + | |
| 61 | +#ifdef CONFIG_MTD_CONCAT | |
| 62 | + if (info->cmtd != info->mtd[0]) | |
| 51 | 63 | mtd_concat_destroy(info->cmtd); |
| 52 | − } | |
| 53 | 64 | #endif |
| 54 | 65 | |
| 55 | 66 | for (i = 0; i < MAX_RESOURCES; i++) { |
| 56 | − if (info->mtd[i] != NULL) { | |
| 57 | −#ifdef CONFIG_MTD_PARTITIONS | |
| 58 | − if (info->nr_parts || physmap_data->nr_parts) | |
| 59 | − del_mtd_partitions(info->mtd[i]); | |
| 60 | − else | |
| 61 | − del_mtd_device(info->mtd[i]); | |
| 62 | −#else | |
| 63 | − del_mtd_device(info->mtd[i]); | |
| 64 | −#endif | |
| 67 | + if (info->mtd[i] != NULL) | |
| 65 | 68 | map_destroy(info->mtd[i]); |
| 66 | − } | |
| 67 | 69 | } |
| 68 | 70 | return 0; |
| 69 | 71 | } |
| @@ -86,9 +88,6 @@ static int physmap_flash_probe(struct platform_device *dev) · 16 unmodified lines | ||
| 86 | 88 | int err = 0; |
| 87 | 89 | int i; |
| 88 | 90 | int devices_found = 0; |
| 89 | −#ifdef CONFIG_MTD_PARTITIONS | |
| 90 | − struct mtd_partition *parts; | |
| 91 | −#endif | |
| 92 | 91 | |
| 93 | 92 | physmap_data = dev->dev.platform_data; |
| 94 | 93 | if (physmap_data == NULL) |
| @@ -167,10 +166,11 @@ static int physmap_flash_probe(struct platform_device *dev) · 72 unmodified lines | ||
| 167 | 166 | goto err_out; |
| 168 | 167 | |
| 169 | 168 | #ifdef CONFIG_MTD_PARTITIONS |
| 170 | − err = parse_mtd_partitions(info->cmtd, part_probe_types, &parts, 0); | |
| 169 | + err = parse_mtd_partitions(info->cmtd, part_probe_types, | |
| 170 | + &info->parts, 0); | |
| 171 | 171 | if (err > 0) { |
| 172 | − add_mtd_partitions(info->cmtd, parts, err); | |
| 173 | − kfree(parts); | |
| 172 | + add_mtd_partitions(info->cmtd, info->parts, err); | |
| 173 | + info->nr_parts = err; | |
| 174 | 174 | return 0; |
| 175 | 175 | } |
| 176 | 176 | |
| @@ -148,7 +148,7 @@ static void iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) · 147 unmodified lines | ||
| 148 | 148 | pci_unmap_single(dev, |
| 149 | 149 | pci_unmap_addr(&txq->cmd[index]->meta, mapping), |
| 150 | 150 | pci_unmap_len(&txq->cmd[index]->meta, len), |
| 151 | − PCI_DMA_TODEVICE); | |
| 151 | + PCI_DMA_BIDIRECTIONAL); | |
| 152 | 152 | |
| 153 | 153 | /* Unmap chunks, if any. */ |
| 154 | 154 | for (i = 1; i < num_tbs; i++) { |
| @@ -964,7 +964,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) · 809 unmodified lines | ||
| 964 | 964 | * within command buffer array. */ |
| 965 | 965 | txcmd_phys = pci_map_single(priv->pci_dev, |
| 966 | 966 | out_cmd, sizeof(struct iwl_cmd), |
| 967 | − PCI_DMA_TODEVICE); | |
| 967 | + PCI_DMA_BIDIRECTIONAL); | |
| 968 | 968 | pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); |
| 969 | 969 | pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd)); |
| 970 | 970 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
| @@ -1115,7 +1115,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) · 144 unmodified lines | ||
| 1115 | 1115 | IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); |
| 1116 | 1116 | |
| 1117 | 1117 | phys_addr = pci_map_single(priv->pci_dev, out_cmd, |
| 1118 | − len, PCI_DMA_TODEVICE); | |
| 1118 | + len, PCI_DMA_BIDIRECTIONAL); | |
| 1119 | 1119 | pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr); |
| 1120 | 1120 | pci_unmap_len_set(&out_cmd->meta, len, len); |
| 1121 | 1121 | phys_addr += offsetof(struct iwl_cmd, hdr); |
| @@ -1212,7 +1212,7 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, · 90 unmodified lines | ||
| 1212 | 1212 | pci_unmap_single(priv->pci_dev, |
| 1213 | 1213 | pci_unmap_addr(&txq->cmd[cmd_idx]->meta, mapping), |
| 1214 | 1214 | pci_unmap_len(&txq->cmd[cmd_idx]->meta, len), |
| 1215 | − PCI_DMA_TODEVICE); | |
| 1215 | + PCI_DMA_BIDIRECTIONAL); | |
| 1216 | 1216 | |
| 1217 | 1217 | for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; |
| 1218 | 1218 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { |
| @@ -332,6 +332,14 @@ parse_dmar_table(void) · 331 unmodified lines | ||
| 332 | 332 | entry_header = (struct acpi_dmar_header *)(dmar + 1); |
| 333 | 333 | while (((unsigned long)entry_header) < |
| 334 | 334 | (((unsigned long)dmar) + dmar_tbl->length)) { |
| 335 | + /* Avoid looping forever on bad ACPI tables */ | |
| 336 | + if (entry_header->length == 0) { | |
| 337 | + printk(KERN_WARNING PREFIX | |
| 338 | + "Invalid 0-length structure\n"); | |
| 339 | + ret = -EINVAL; | |
| 340 | + break; | |
| 341 | + } | |
| 342 | + | |
| 335 | 343 | dmar_table_print_dmar_entry(entry_header); |
| 336 | 344 | |
| 337 | 345 | switch (entry_header->type) { |
| @@ -494,7 +502,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd) · 156 unmodified lines | ||
| 494 | 502 | int map_size; |
| 495 | 503 | u32 ver; |
| 496 | 504 | static int iommu_allocated = 0; |
| 497 | − int agaw; | |
| 505 | + int agaw = 0; | |
| 498 | 506 | |
| 499 | 507 | iommu = kzalloc(sizeof(*iommu), GFP_KERNEL); |
| 500 | 508 | if (!iommu) |
| @@ -510,6 +518,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd) · 9 unmodified lines | ||
| 510 | 518 | iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG); |
| 511 | 519 | iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG); |
| 512 | 520 | |
| 521 | +#ifdef CONFIG_DMAR | |
| 513 | 522 | agaw = iommu_calculate_agaw(iommu); |
| 514 | 523 | if (agaw < 0) { |
| 515 | 524 | printk(KERN_ERR |
| @@ -517,6 +526,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd) · 1 unmodified line | ||
| 517 | 526 | iommu->seq_id); |
| 518 | 527 | goto error; |
| 519 | 528 | } |
| 529 | +#endif | |
| 520 | 530 | iommu->agaw = agaw; |
| 521 | 531 | |
| 522 | 532 | /* the registers might be more than one page */ |
| @@ -574,19 +584,49 @@ static inline void reclaim_free_desc(struct q_inval *qi) · 51 unmodified lines | ||
| 574 | 584 | } |
| 575 | 585 | } |
| 576 | 586 | |
| 587 | +static int qi_check_fault(struct intel_iommu *iommu, int index) | |
| 588 | +{ | |
| 589 | + u32 fault; | |
| 590 | + int head; | |
| 591 | + struct q_inval *qi = iommu->qi; | |
| 592 | + int wait_index = (index + 1) % QI_LENGTH; | |
| 593 | + | |
| 594 | + fault = readl(iommu->reg + DMAR_FSTS_REG); | |
| 595 | + | |
| 596 | + /* | |
| 597 | + * If IQE happens, the head points to the descriptor associated | |
| 598 | + * with the error. No new descriptors are fetched until the IQE | |
| 599 | + * is cleared. | |
| 600 | + */ | |
| 601 | + if (fault & DMA_FSTS_IQE) { | |
| 602 | + head = readl(iommu->reg + DMAR_IQH_REG); | |
| 603 | + if ((head >> 4) == index) { | |
| 604 | + memcpy(&qi->desc[index], &qi->desc[wait_index], | |
| 605 | + sizeof(struct qi_desc)); | |
| 606 | + __iommu_flush_cache(iommu, &qi->desc[index], | |
| 607 | + sizeof(struct qi_desc)); | |
| 608 | + writel(DMA_FSTS_IQE, iommu->reg + DMAR_FSTS_REG); | |
| 609 | + return -EINVAL; | |
| 610 | + } | |
| 611 | + } | |
| 612 | + | |
| 613 | + return 0; | |
| 614 | +} | |
| 615 | + | |
| 577 | 616 | /* |
| 578 | 617 | * Submit the queued invalidation descriptor to the remapping |
| 579 | 618 | * hardware unit and wait for its completion. |
| 580 | 619 | */ |
| 581 | −void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu) | |
| 620 | +int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu) | |
| 582 | 621 | { |
| 622 | + int rc = 0; | |
| 583 | 623 | struct q_inval *qi = iommu->qi; |
| 584 | 624 | struct qi_desc *hw, wait_desc; |
| 585 | 625 | int wait_index, index; |
| 586 | 626 | unsigned long flags; |
| 587 | 627 | |
| 588 | 628 | if (!qi) |
| 589 | − return; | |
| 629 | + return 0; | |
| 590 | 630 | |
| 591 | 631 | hw = qi->desc; |
| 592 | 632 | |
| @@ -604,7 +644,8 @@ void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu) · 11 unmodified lines | ||
| 604 | 644 | |
| 605 | 645 | hw[index] = *desc; |
| 606 | 646 | |
| 607 | − wait_desc.low = QI_IWD_STATUS_DATA(2) | QI_IWD_STATUS_WRITE | QI_IWD_TYPE; | |
| 647 | + wait_desc.low = QI_IWD_STATUS_DATA(QI_DONE) | | |
| 648 | + QI_IWD_STATUS_WRITE | QI_IWD_TYPE; | |
| 608 | 649 | wait_desc.high = virt_to_phys(&qi->desc_status[wait_index]); |
| 609 | 650 | |
| 610 | 651 | hw[wait_index] = wait_desc; |
| @@ -615,13 +656,11 @@ void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu) · 4 unmodified lines | ||
| 615 | 656 | qi->free_head = (qi->free_head + 2) % QI_LENGTH; |
| 616 | 657 | qi->free_cnt -= 2; |
| 617 | 658 | |
| 618 | − spin_lock(&iommu->register_lock); | |
| 619 | 659 | /* |
| 620 | 660 | * update the HW tail register indicating the presence of |
| 621 | 661 | * new descriptors. |
| 622 | 662 | */ |
| 623 | 663 | writel(qi->free_head << 4, iommu->reg + DMAR_IQT_REG); |
| 624 | − spin_unlock(&iommu->register_lock); | |
| 625 | 664 | |
| 626 | 665 | while (qi->desc_status[wait_index] != QI_DONE) { |
| 627 | 666 | /* |
| @@ -631,15 +670,21 @@ void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu) · 3 unmodified lines | ||
| 631 | 670 | * a deadlock where the interrupt context can wait indefinitely |
| 632 | 671 | * for free slots in the queue. |
| 633 | 672 | */ |
| 673 | + rc = qi_check_fault(iommu, index); | |
| 674 | + if (rc) | |
| 675 | + goto out; | |
| 676 | + | |
| 634 | 677 | spin_unlock(&qi->q_lock); |
| 635 | 678 | cpu_relax(); |
| 636 | 679 | spin_lock(&qi->q_lock); |
| 637 | 680 | } |
| 638 | − | |
| 639 | − qi->desc_status[index] = QI_DONE; | |
| 681 | +out: | |
| 682 | + qi->desc_status[index] = qi->desc_status[wait_index] = QI_DONE; | |
| 640 | 683 | |
| 641 | 684 | reclaim_free_desc(qi); |
| 642 | 685 | spin_unlock_irqrestore(&qi->q_lock, flags); |
| 686 | + | |
| 687 | + return rc; | |
| 643 | 688 | } |
| 644 | 689 | |
| 645 | 690 | /* |
| @@ -652,13 +697,13 @@ void qi_global_iec(struct intel_iommu *iommu) · 6 unmodified lines | ||
| 652 | 697 | desc.low = QI_IEC_TYPE; |
| 653 | 698 | desc.high = 0; |
| 654 | 699 | |
| 700 | + /* should never fail */ | |
| 655 | 701 | qi_submit_sync(&desc, iommu); |
| 656 | 702 | } |
| 657 | 703 | |
| 658 | 704 | int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm, |
| 659 | 705 | u64 type, int non_present_entry_flush) |
| 660 | 706 | { |
| 661 | − | |
| 662 | 707 | struct qi_desc desc; |
| 663 | 708 | |
| 664 | 709 | if (non_present_entry_flush) { |
| @@ -672,10 +717,7 @@ int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm, · 7 unmodified lines | ||
| 672 | 717 | | QI_CC_GRAN(type) | QI_CC_TYPE; |
| 673 | 718 | desc.high = 0; |
| 674 | 719 | |
| 675 | − qi_submit_sync(&desc, iommu); | |
| 676 | − | |
| 677 | − return 0; | |
| 678 | − | |
| 720 | + return qi_submit_sync(&desc, iommu); | |
| 679 | 721 | } |
| 680 | 722 | |
| 681 | 723 | int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, |
| @@ -705,10 +747,7 @@ int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, · 23 unmodified lines | ||
| 705 | 747 | desc.high = QI_IOTLB_ADDR(addr) | QI_IOTLB_IH(ih) |
| 706 | 748 | | QI_IOTLB_AM(size_order); |
| 707 | 749 | |
| 708 | − qi_submit_sync(&desc, iommu); | |
| 709 | − | |
| 710 | − return 0; | |
| 711 | − | |
| 750 | + return qi_submit_sync(&desc, iommu); | |
| 712 | 751 | } |
| 713 | 752 | |
| 714 | 753 | /* |
| @@ -111,6 +111,7 @@ struct controller { · 110 unmodified lines | ||
| 111 | 111 | int cmd_busy; |
| 112 | 112 | unsigned int no_cmd_complete:1; |
| 113 | 113 | unsigned int link_active_reporting:1; |
| 114 | + unsigned int notification_enabled:1; | |
| 114 | 115 | }; |
| 115 | 116 | |
| 116 | 117 | #define INT_BUTTON_IGNORE 0 |
| @@ -170,6 +171,7 @@ extern int pciehp_configure_device(struct slot *p_slot); · 53 unmodified lines | ||
| 170 | 171 | extern int pciehp_unconfigure_device(struct slot *p_slot); |
| 171 | 172 | extern void pciehp_queue_pushbutton_work(struct work_struct *work); |
| 172 | 173 | struct controller *pcie_init(struct pcie_device *dev); |
| 174 | +int pcie_init_notification(struct controller *ctrl); | |
| 173 | 175 | int pciehp_enable_slot(struct slot *p_slot); |
| 174 | 176 | int pciehp_disable_slot(struct slot *p_slot); |
| 175 | 177 | int pcie_enable_notification(struct controller *ctrl); |
| @@ -434,6 +434,13 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ · 433 unmodified lines | ||
| 434 | 434 | goto err_out_release_ctlr; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | + /* Enable events after we have setup the data structures */ | |
| 438 | + rc = pcie_init_notification(ctrl); | |
| 439 | + if (rc) { | |
| 440 | + ctrl_err(ctrl, "Notification initialization failed\n"); | |
| 441 | + goto err_out_release_ctlr; | |
| 442 | + } | |
| 443 | + | |
| 437 | 444 | /* Check if slot is occupied */ |
| 438 | 445 | t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); |
| 439 | 446 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); |
| @@ -934,7 +934,7 @@ static void pcie_disable_notification(struct controller *ctrl) · 933 unmodified lines | ||
| 934 | 934 | ctrl_warn(ctrl, "Cannot disable software notification\n"); |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | −static int pcie_init_notification(struct controller *ctrl) | |
| 937 | +int pcie_init_notification(struct controller *ctrl) | |
| 938 | 938 | { |
| 939 | 939 | if (pciehp_request_irq(ctrl)) |
| 940 | 940 | return -1; |
| @@ -942,13 +942,17 @@ static int pcie_init_notification(struct controller *ctrl) · 1 unmodified line | ||
| 942 | 942 | pciehp_free_irq(ctrl); |
| 943 | 943 | return -1; |
| 944 | 944 | } |
| 945 | + ctrl->notification_enabled = 1; | |
| 945 | 946 | return 0; |
| 946 | 947 | } |
| 947 | 948 | |
| 948 | 949 | static void pcie_shutdown_notification(struct controller *ctrl) |
| 949 | 950 | { |
| 950 | − pcie_disable_notification(ctrl); | |
| 951 | − pciehp_free_irq(ctrl); | |
| 951 | + if (ctrl->notification_enabled) { | |
| 952 | + pcie_disable_notification(ctrl); | |
| 953 | + pciehp_free_irq(ctrl); | |
| 954 | + ctrl->notification_enabled = 0; | |
| 955 | + } | |
| 952 | 956 | } |
| 953 | 957 | |
| 954 | 958 | static int pcie_init_slot(struct controller *ctrl) |
| @@ -1110,13 +1114,8 @@ struct controller *pcie_init(struct pcie_device *dev) · 155 unmodified lines | ||
| 1110 | 1114 | if (pcie_init_slot(ctrl)) |
| 1111 | 1115 | goto abort_ctrl; |
| 1112 | 1116 | |
| 1113 | − if (pcie_init_notification(ctrl)) | |
| 1114 | − goto abort_slot; | |
| 1115 | − | |
| 1116 | 1117 | return ctrl; |
| 1117 | 1118 | |
| 1118 | −abort_slot: | |
| 1119 | − pcie_cleanup_slot(ctrl); | |
| 1120 | 1119 | abort_ctrl: |
| 1121 | 1120 | kfree(ctrl); |
| 1122 | 1121 | abort: |
| @@ -208,7 +208,7 @@ int alloc_irte(struct intel_iommu *iommu, int irq, u16 count) · 207 unmodified lines | ||
| 208 | 208 | return index; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | −static void qi_flush_iec(struct intel_iommu *iommu, int index, int mask) | |
| 211 | +static int qi_flush_iec(struct intel_iommu *iommu, int index, int mask) | |
| 212 | 212 | { |
| 213 | 213 | struct qi_desc desc; |
| 214 | 214 | |
| @@ -216,7 +216,7 @@ static void qi_flush_iec(struct intel_iommu *iommu, int index, int mask) · 1 unmodified line | ||
| 216 | 216 | | QI_IEC_SELECTIVE; |
| 217 | 217 | desc.high = 0; |
| 218 | 218 | |
| 219 | − qi_submit_sync(&desc, iommu); | |
| 219 | + return qi_submit_sync(&desc, iommu); | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | int map_irq_to_irte_handle(int irq, u16 *sub_handle) |
| @@ -284,6 +284,7 @@ int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index) · 61 unmodified lines | ||
| 284 | 284 | |
| 285 | 285 | int modify_irte(int irq, struct irte *irte_modified) |
| 286 | 286 | { |
| 287 | + int rc; | |
| 287 | 288 | int index; |
| 288 | 289 | struct irte *irte; |
| 289 | 290 | struct intel_iommu *iommu; |
| @@ -304,14 +305,15 @@ int modify_irte(int irq, struct irte *irte_modified) · 14 unmodified lines | ||
| 304 | 305 | set_64bit((unsigned long *)irte, irte_modified->low | (1 << 1)); |
| 305 | 306 | __iommu_flush_cache(iommu, irte, sizeof(*irte)); |
| 306 | 307 | |
| 307 | − qi_flush_iec(iommu, index, 0); | |
| 308 | − | |
| 308 | + rc = qi_flush_iec(iommu, index, 0); | |
| 309 | 309 | spin_unlock(&irq_2_ir_lock); |
| 310 | − return 0; | |
| 310 | + | |
| 311 | + return rc; | |
| 311 | 312 | } |
| 312 | 313 | |
| 313 | 314 | int flush_irte(int irq) |
| 314 | 315 | { |
| 316 | + int rc; | |
| 315 | 317 | int index; |
| 316 | 318 | struct intel_iommu *iommu; |
| 317 | 319 | struct irq_2_iommu *irq_iommu; |
| @@ -327,10 +329,10 @@ int flush_irte(int irq) · 9 unmodified lines | ||
| 327 | 329 | |
| 328 | 330 | index = irq_iommu->irte_index + irq_iommu->sub_handle; |
| 329 | 331 | |
| 330 | − qi_flush_iec(iommu, index, irq_iommu->irte_mask); | |
| 332 | + rc = qi_flush_iec(iommu, index, irq_iommu->irte_mask); | |
| 331 | 333 | spin_unlock(&irq_2_ir_lock); |
| 332 | 334 | |
| 333 | − return 0; | |
| 335 | + return rc; | |
| 334 | 336 | } |
| 335 | 337 | |
| 336 | 338 | struct intel_iommu *map_ioapic_to_ir(int apic) |
| @@ -356,6 +358,7 @@ struct intel_iommu *map_dev_to_ir(struct pci_dev *dev) · 19 unmodified lines | ||
| 356 | 358 | |
| 357 | 359 | int free_irte(int irq) |
| 358 | 360 | { |
| 361 | + int rc = 0; | |
| 359 | 362 | int index, i; |
| 360 | 363 | struct irte *irte; |
| 361 | 364 | struct intel_iommu *iommu; |
| @@ -376,7 +379,7 @@ int free_irte(int irq) · 14 unmodified lines | ||
| 376 | 379 | if (!irq_iommu->sub_handle) { |
| 377 | 380 | for (i = 0; i < (1 << irq_iommu->irte_mask); i++) |
| 378 | 381 | set_64bit((unsigned long *)irte, 0); |
| 379 | − qi_flush_iec(iommu, index, irq_iommu->irte_mask); | |
| 382 | + rc = qi_flush_iec(iommu, index, irq_iommu->irte_mask); | |
| 380 | 383 | } |
| 381 | 384 | |
| 382 | 385 | irq_iommu->iommu = NULL; |
| @@ -386,7 +389,7 @@ int free_irte(int irq) · 3 unmodified lines | ||
| 386 | 389 | |
| 387 | 390 | spin_unlock(&irq_2_ir_lock); |
| 388 | 391 | |
| 389 | − return 0; | |
| 392 | + return rc; | |
| 390 | 393 | } |
| 391 | 394 | |
| 392 | 395 | static void iommu_set_intr_remapping(struct intel_iommu *iommu, int mode) |
| @@ -108,6 +108,34 @@ int pci_cleanup_aer_correct_error_status(struct pci_dev *dev) · 107 unmodified lines | ||
| 108 | 108 | } |
| 109 | 109 | #endif /* 0 */ |
| 110 | 110 | |
| 111 | + | |
| 112 | +static void set_device_error_reporting(struct pci_dev *dev, void *data) | |
| 113 | +{ | |
| 114 | + bool enable = *((bool *)data); | |
| 115 | + | |
| 116 | + if (dev->pcie_type != PCIE_RC_PORT && | |
| 117 | + dev->pcie_type != PCIE_SW_UPSTREAM_PORT && | |
| 118 | + dev->pcie_type != PCIE_SW_DOWNSTREAM_PORT) | |
| 119 | + return; | |
| 120 | + | |
| 121 | + if (enable) | |
| 122 | + pci_enable_pcie_error_reporting(dev); | |
| 123 | + else | |
| 124 | + pci_disable_pcie_error_reporting(dev); | |
| 125 | +} | |
| 126 | + | |
| 127 | +/** | |
| 128 | + * set_downstream_devices_error_reporting - enable/disable the error reporting bits on the root port and its downstream ports. | |
| 129 | + * @dev: pointer to root port's pci_dev data structure | |
| 130 | + * @enable: true = enable error reporting, false = disable error reporting. | |
| 131 | + */ | |
| 132 | +static void set_downstream_devices_error_reporting(struct pci_dev *dev, | |
| 133 | + bool enable) | |
| 134 | +{ | |
| 135 | + set_device_error_reporting(dev, &enable); | |
| 136 | + pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable); | |
| 137 | +} | |
| 138 | + | |
| 111 | 139 | static int find_device_iter(struct device *device, void *data) |
| 112 | 140 | { |
| 113 | 141 | struct pci_dev *dev; |
| @@ -525,15 +553,11 @@ void aer_enable_rootport(struct aer_rpc *rpc) · 411 unmodified lines | ||
| 525 | 553 | pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, ®32); |
| 526 | 554 | pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32); |
| 527 | 555 | |
| 528 | − /* Enable Root Port device reporting error itself */ | |
| 529 | − pci_read_config_word(pdev, pos+PCI_EXP_DEVCTL, ®16); | |
| 530 | − reg16 = reg16 | | |
| 531 | − PCI_EXP_DEVCTL_CERE | | |
| 532 | − PCI_EXP_DEVCTL_NFERE | | |
| 533 | − PCI_EXP_DEVCTL_FERE | | |
| 534 | − PCI_EXP_DEVCTL_URRE; | |
| 535 | − pci_write_config_word(pdev, pos+PCI_EXP_DEVCTL, | |
| 536 | − reg16); | |
| 556 | + /* | |
| 557 | + * Enable error reporting for the root port device and downstream port | |
| 558 | + * devices. | |
| 559 | + */ | |
| 560 | + set_downstream_devices_error_reporting(pdev, true); | |
| 537 | 561 | |
| 538 | 562 | /* Enable Root Port's interrupt in response to error messages */ |
| 539 | 563 | pci_write_config_dword(pdev, |
| @@ -553,6 +577,12 @@ static void disable_root_aer(struct aer_rpc *rpc) · 13 unmodified lines | ||
| 553 | 577 | u32 reg32; |
| 554 | 578 | int pos; |
| 555 | 579 | |
| 580 | + /* | |
| 581 | + * Disable error reporting for the root port device and downstream port | |
| 582 | + * devices. | |
| 583 | + */ | |
| 584 | + set_downstream_devices_error_reporting(pdev, false); | |
| 585 | + | |
| 556 | 586 | pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR); |
| 557 | 587 | /* Disable Root's interrupt in response to error messages */ |
| 558 | 588 | pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, 0); |
| @@ -97,8 +97,6 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev, · 96 unmodified lines | ||
| 97 | 97 | |
| 98 | 98 | pcie_portdrv_save_config(dev); |
| 99 | 99 | |
| 100 | − pci_enable_pcie_error_reporting(dev); | |
| 101 | − | |
| 102 | 100 | return 0; |
| 103 | 101 | } |
| 104 | 102 | |
| @@ -1584,6 +1584,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_ · 1583 unmodified lines | ||
| 1584 | 1584 | */ |
| 1585 | 1585 | #define AMD_813X_MISC 0x40 |
| 1586 | 1586 | #define AMD_813X_NOIOAMODE (1<<0) |
| 1587 | +#define AMD_813X_REV_B2 0x13 | |
| 1587 | 1588 | |
| 1588 | 1589 | static void quirk_disable_amd_813x_boot_interrupt(struct pci_dev *dev) |
| 1589 | 1590 | { |
| @@ -1591,6 +1592,8 @@ static void quirk_disable_amd_813x_boot_interrupt(struct pci_dev *dev) · 1 unmodified line | ||
| 1591 | 1592 | |
| 1592 | 1593 | if (noioapicquirk) |
| 1593 | 1594 | return; |
| 1595 | + if (dev->revision == AMD_813X_REV_B2) | |
| 1596 | + return; | |
| 1594 | 1597 | |
| 1595 | 1598 | pci_read_config_dword(dev, AMD_813X_MISC, &pci_config_dword); |
| 1596 | 1599 | pci_config_dword &= ~AMD_813X_NOIOAMODE; |
| @@ -1981,7 +1984,6 @@ static void __devinit quirk_msi_ht_cap(struct pci_dev *dev) · 384 unmodified lines | ||
| 1981 | 1984 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, |
| 1982 | 1985 | quirk_msi_ht_cap); |
| 1983 | 1986 | |
| 1984 | − | |
| 1985 | 1987 | /* The nVidia CK804 chipset may have 2 HT MSI mappings. |
| 1986 | 1988 | * MSI are supported if the MSI capability set in any of these mappings. |
| 1987 | 1989 | */ |
| @@ -2032,6 +2034,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, · 44 unmodified lines | ||
| 2032 | 2034 | PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB, |
| 2033 | 2035 | ht_enable_msi_mapping); |
| 2034 | 2036 | |
| 2037 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE, | |
| 2038 | + ht_enable_msi_mapping); | |
| 2039 | + | |
| 2035 | 2040 | /* The P5N32-SLI Premium motherboard from Asus has a problem with msi |
| 2036 | 2041 | * for the MCP55 NIC. It is not yet determined whether the msi problem |
| 2037 | 2042 | * also affects other devices. As for now, turn off msi for this device. |
| @@ -2048,10 +2053,100 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, · 10 unmodified lines | ||
| 2048 | 2053 | PCI_DEVICE_ID_NVIDIA_NVENET_15, |
| 2049 | 2054 | nvenet_msi_disable); |
| 2050 | 2055 | |
| 2051 | −static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) | |
| 2056 | +static void __devinit nv_ht_enable_msi_mapping(struct pci_dev *dev) | |
| 2052 | 2057 | { |
| 2053 | 2058 | struct pci_dev *host_bridge; |
| 2059 | + int pos; | |
| 2060 | + int i, dev_no; | |
| 2061 | + int found = 0; | |
| 2062 | + | |
| 2063 | + dev_no = dev->devfn >> 3; | |
| 2064 | + for (i = dev_no; i >= 0; i--) { | |
| 2065 | + host_bridge = pci_get_slot(dev->bus, PCI_DEVFN(i, 0)); | |
| 2066 | + if (!host_bridge) | |
| 2067 | + continue; | |
| 2068 | + | |
| 2069 | + pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE); | |
| 2070 | + if (pos != 0) { | |
| 2071 | + found = 1; | |
| 2072 | + break; | |
| 2073 | + } | |
| 2074 | + pci_dev_put(host_bridge); | |
| 2075 | + } | |
| 2076 | + | |
| 2077 | + if (!found) | |
| 2078 | + return; | |
| 2079 | + | |
| 2080 | + /* root did that ! */ | |
| 2081 | + if (msi_ht_cap_enabled(host_bridge)) | |
| 2082 | + goto out; | |
| 2083 | + | |
| 2084 | + ht_enable_msi_mapping(dev); | |
| 2085 | + | |
| 2086 | +out: | |
| 2087 | + pci_dev_put(host_bridge); | |
| 2088 | +} | |
| 2089 | + | |
| 2090 | +static void __devinit ht_disable_msi_mapping(struct pci_dev *dev) | |
| 2091 | +{ | |
| 2092 | + int pos, ttl = 48; | |
| 2093 | + | |
| 2094 | + pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | |
| 2095 | + while (pos && ttl--) { | |
| 2096 | + u8 flags; | |
| 2097 | + | |
| 2098 | + if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | |
| 2099 | + &flags) == 0) { | |
| 2100 | + dev_info(&dev->dev, "Enabling HT MSI Mapping\n"); | |
| 2101 | + | |
| 2102 | + pci_write_config_byte(dev, pos + HT_MSI_FLAGS, | |
| 2103 | + flags & ~HT_MSI_FLAGS_ENABLE); | |
| 2104 | + } | |
| 2105 | + pos = pci_find_next_ht_capability(dev, pos, | |
| 2106 | + HT_CAPTYPE_MSI_MAPPING); | |
| 2107 | + } | |
| 2108 | +} | |
| 2109 | + | |
| 2110 | +static int __devinit ht_check_msi_mapping(struct pci_dev *dev) | |
| 2111 | +{ | |
| 2054 | 2112 | int pos, ttl = 48; |
| 2113 | + int found = 0; | |
| 2114 | + | |
| 2115 | + /* check if there is HT MSI cap or enabled on this device */ | |
| 2116 | + pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | |
| 2117 | + while (pos && ttl--) { | |
| 2118 | + u8 flags; | |
| 2119 | + | |
| 2120 | + if (found < 1) | |
| 2121 | + found = 1; | |
| 2122 | + if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | |
| 2123 | + &flags) == 0) { | |
| 2124 | + if (flags & HT_MSI_FLAGS_ENABLE) { | |
| 2125 | + if (found < 2) { | |
| 2126 | + found = 2; | |
| 2127 | + break; | |
| 2128 | + } | |
| 2129 | + } | |
| 2130 | + } | |
| 2131 | + pos = pci_find_next_ht_capability(dev, pos, | |
| 2132 | + HT_CAPTYPE_MSI_MAPPING); | |
| 2133 | + } | |
| 2134 | + | |
| 2135 | + return found; | |
| 2136 | +} | |
| 2137 | + | |
| 2138 | +static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) | |
| 2139 | +{ | |
| 2140 | + struct pci_dev *host_bridge; | |
| 2141 | + int pos; | |
| 2142 | + int found; | |
| 2143 | + | |
| 2144 | + /* check if there is HT MSI cap or enabled on this device */ | |
| 2145 | + found = ht_check_msi_mapping(dev); | |
| 2146 | + | |
| 2147 | + /* no HT MSI CAP */ | |
| 2148 | + if (found == 0) | |
| 2149 | + return; | |
| 2055 | 2150 | |
| 2056 | 2151 | /* |
| 2057 | 2152 | * HT MSI mapping should be disabled on devices that are below |
| @@ -2067,24 +2162,19 @@ static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) · 9 unmodified lines | ||
| 2067 | 2162 | pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE); |
| 2068 | 2163 | if (pos != 0) { |
| 2069 | 2164 | /* Host bridge is to HT */ |
| 2070 | − ht_enable_msi_mapping(dev); | |
| 2165 | + if (found == 1) { | |
| 2166 | + /* it is not enabled, try to enable it */ | |
| 2167 | + nv_ht_enable_msi_mapping(dev); | |
| 2168 | + } | |
| 2071 | 2169 | return; |
| 2072 | 2170 | } |
| 2073 | 2171 | |
| 2074 | − /* Host bridge is not to HT, disable HT MSI mapping on this device */ | |
| 2075 | − pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | |
| 2076 | − while (pos && ttl--) { | |
| 2077 | − u8 flags; | |
| 2172 | + /* HT MSI is not enabled */ | |
| 2173 | + if (found == 1) | |
| 2174 | + return; | |
| 2078 | 2175 | |
| 2079 | − if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | |
| 2080 | − &flags) == 0) { | |
| 2081 | − dev_info(&dev->dev, "Disabling HT MSI mapping"); | |
| 2082 | − pci_write_config_byte(dev, pos + HT_MSI_FLAGS, | |
| 2083 | − flags & ~HT_MSI_FLAGS_ENABLE); | |
| 2084 | − } | |
| 2085 | − pos = pci_find_next_ht_capability(dev, pos, | |
| 2086 | − HT_CAPTYPE_MSI_MAPPING); | |
| 2087 | − } | |
| 2176 | + /* Host bridge is not to HT, disable HT MSI mapping on this device */ | |
| 2177 | + ht_disable_msi_mapping(dev); | |
| 2088 | 2178 | } |
| 2089 | 2179 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk); |
| 2090 | 2180 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk); |
| @@ -133,7 +133,7 @@ · 132 unmodified lines | ||
| 133 | 133 | # define SCSPTR3 0xffed0024 /* 16 bit SCIF */ |
| 134 | 134 | # define SCSPTR4 0xffee0024 /* 16 bit SCIF */ |
| 135 | 135 | # define SCSPTR5 0xffef0024 /* 16 bit SCIF */ |
| 136 | −# define SCIF_OPER 0x0001 /* Overrun error bit */ | |
| 136 | +# define SCIF_ORER 0x0001 /* Overrun error bit */ | |
| 137 | 137 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
| 138 | 138 | #elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \ |
| 139 | 139 | defined(CONFIG_CPU_SUBTYPE_SH7203) || \ |
| @@ -2164,19 +2164,20 @@ static void __exit panel_cleanup_module(void) · 2163 unmodified lines | ||
| 2164 | 2164 | if (scan_timer.function != NULL) |
| 2165 | 2165 | del_timer(&scan_timer); |
| 2166 | 2166 | |
| 2167 | − if (keypad_enabled) | |
| 2168 | − misc_deregister(&keypad_dev); | |
| 2167 | + if (pprt != NULL) { | |
| 2168 | + if (keypad_enabled) | |
| 2169 | + misc_deregister(&keypad_dev); | |
| 2170 | + | |
| 2171 | + if (lcd_enabled) { | |
| 2172 | + panel_lcd_print("\x0cLCD driver " PANEL_VERSION | |
| 2173 | + "\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-"); | |
| 2174 | + misc_deregister(&lcd_dev); | |
| 2175 | + } | |
| 2169 | 2176 | |
| 2170 | − if (lcd_enabled) { | |
| 2171 | − panel_lcd_print("\x0cLCD driver " PANEL_VERSION | |
| 2172 | − "\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-"); | |
| 2173 | − misc_deregister(&lcd_dev); | |
| 2177 | + /* TODO: free all input signals */ | |
| 2178 | + parport_release(pprt); | |
| 2179 | + parport_unregister_device(pprt); | |
| 2174 | 2180 | } |
| 2175 | − | |
| 2176 | − /* TODO: free all input signals */ | |
| 2177 | − | |
| 2178 | − parport_release(pprt); | |
| 2179 | − parport_unregister_device(pprt); | |
| 2180 | 2181 | parport_unregister_driver(&panel_driver); |
| 2181 | 2182 | } |
| 2182 | 2183 | |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | config RTL8187SE |
| 2 | 2 | tristate "RealTek RTL8187SE Wireless LAN NIC driver" |
| 3 | 3 | depends on PCI |
| 4 | + depends on WIRELESS_EXT && COMPAT_NET_DEV_OPS | |
| 4 | 5 | default N |
| 5 | 6 | ---help--- |
| @@ -234,20 +234,21 @@ out: · 233 unmodified lines | ||
| 234 | 234 | void ieee80211_crypto_deinit(void) |
| 235 | 235 | { |
| 236 | 236 | struct list_head *ptr, *n; |
| 237 | + struct ieee80211_crypto_alg *alg = NULL; | |
| 237 | 238 | |
| 238 | 239 | if (hcrypt == NULL) |
| 239 | 240 | return; |
| 240 | 241 | |
| 241 | − for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; | |
| 242 | − ptr = n, n = ptr->next) { | |
| 243 | − struct ieee80211_crypto_alg *alg = | |
| 244 | − (struct ieee80211_crypto_alg *) ptr; | |
| 245 | − list_del(ptr); | |
| 246 | − printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " | |
| 247 | − "'%s' (deinit)\n", alg->ops->name); | |
| 248 | − kfree(alg); | |
| 242 | + list_for_each_safe(ptr, n, &hcrypt->algs) { | |
| 243 | + alg = list_entry(ptr, struct ieee80211_crypto_alg, list); | |
| 244 | + if (alg) { | |
| 245 | + list_del(ptr); | |
| 246 | + printk(KERN_DEBUG | |
| 247 | + "ieee80211_crypt: unregistered algorithm '%s' (deinit)\n", | |
| 248 | + alg->ops->name); | |
| 249 | + kfree(alg); | |
| 250 | + } | |
| 249 | 251 | } |
| 250 | − | |
| 251 | 252 | kfree(hcrypt); |
| 252 | 253 | } |
| 253 | 254 | |
| @@ -6161,10 +6161,10 @@ static void __exit rtl8180_pci_module_exit(void) · 6160 unmodified lines | ||
| 6161 | 6161 | { |
| 6162 | 6162 | pci_unregister_driver (&rtl8180_pci_driver); |
| 6163 | 6163 | rtl8180_proc_module_remove(); |
| 6164 | − ieee80211_crypto_deinit(); | |
| 6165 | 6164 | ieee80211_crypto_tkip_exit(); |
| 6166 | 6165 | ieee80211_crypto_ccmp_exit(); |
| 6167 | 6166 | ieee80211_crypto_wep_exit(); |
| 6167 | + ieee80211_crypto_deinit(); | |
| 6168 | 6168 | DMESG("Exiting"); |
| 6169 | 6169 | } |
| 6170 | 6170 | |
| @@ -319,16 +319,18 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id · 318 unmodified lines | ||
| 319 | 319 | struct usb_device *udev = interface_to_usbdev(intf); |
| 320 | 320 | struct wbsoft_priv *priv; |
| 321 | 321 | struct ieee80211_hw *dev; |
| 322 | − int err; | |
| 322 | + int nr, err; | |
| 323 | 323 | |
| 324 | 324 | usb_get_dev(udev); |
| 325 | 325 | |
| 326 | 326 | // 20060630.2 Check the device if it already be opened |
| 327 | − err = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ), | |
| 328 | − 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN, | |
| 329 | − 0x0, 0x400, <mp, 4, HZ*100 ); | |
| 330 | − if (err) | |
| 327 | + nr = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ), | |
| 328 | + 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN, | |
| 329 | + 0x0, 0x400, <mp, 4, HZ*100 ); | |
| 330 | + if (nr < 0) { | |
| 331 | + err = nr; | |
| 331 | 332 | goto error; |
| 333 | + } | |
| 332 | 334 | |
| 333 | 335 | ltmp = cpu_to_le32(ltmp); |
| 334 | 336 | if (ltmp) { // Is already initialized? |
| @@ -337,8 +339,10 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id · 2 unmodified lines | ||
| 337 | 339 | } |
| 338 | 340 | |
| 339 | 341 | dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops); |
| 340 | − if (!dev) | |
| 342 | + if (!dev) { | |
| 343 | + err = -ENOMEM; | |
| 341 | 344 | goto error; |
| 345 | + } | |
| 342 | 346 | |
| 343 | 347 | priv = dev->priv; |
| 344 | 348 | |
| @@ -369,9 +373,11 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id · 24 unmodified lines | ||
| 369 | 373 | } |
| 370 | 374 | |
| 371 | 375 | dev->extra_tx_headroom = 12; /* FIXME */ |
| 372 | − dev->flags = 0; | |
| 376 | + dev->flags = IEEE80211_HW_SIGNAL_UNSPEC; | |
| 377 | + dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); | |
| 373 | 378 | |
| 374 | 379 | dev->channel_change_time = 1000; |
| 380 | + dev->max_signal = 100; | |
| 375 | 381 | dev->queues = 1; |
| 376 | 382 | |
| 377 | 383 | dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &wbsoft_band_2GHz; |
| @@ -1376,6 +1376,15 @@ static struct usb_device_id acm_ids[] = { · 1375 unmodified lines | ||
| 1376 | 1376 | { USB_DEVICE(0x0572, 0x1324), /* Conexant USB MODEM RD02-D400 */ |
| 1377 | 1377 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
| 1378 | 1378 | }, |
| 1379 | + { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ | |
| 1380 | + }, | |
| 1381 | + { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ | |
| 1382 | + .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on | |
| 1383 | + data interface instead of | |
| 1384 | + communications interface. | |
| 1385 | + Maybe we should define a new | |
| 1386 | + quirk for this. */ | |
| 1387 | + }, | |
| 1379 | 1388 | |
| 1380 | 1389 | /* control interfaces with various AT-command sets */ |
| 1381 | 1390 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
| @@ -653,7 +653,7 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type, · 652 unmodified lines | ||
| 653 | 653 | if (result <= 0 && result != -ETIMEDOUT) |
| 654 | 654 | continue; |
| 655 | 655 | if (result > 1 && ((u8 *)buf)[1] != type) { |
| 656 | − result = -EPROTO; | |
| 656 | + result = -ENODATA; | |
| 657 | 657 | continue; |
| 658 | 658 | } |
| 659 | 659 | break; |
| @@ -696,8 +696,13 @@ static int usb_get_string(struct usb_device *dev, unsigned short langid, · 36 unmodified lines | ||
| 696 | 696 | USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, |
| 697 | 697 | (USB_DT_STRING << 8) + index, langid, buf, size, |
| 698 | 698 | USB_CTRL_GET_TIMEOUT); |
| 699 | − if (!(result == 0 || result == -EPIPE)) | |
| 700 | − break; | |
| 699 | + if (result == 0 || result == -EPIPE) | |
| 700 | + continue; | |
| 701 | + if (result > 1 && ((u8 *) buf)[1] != USB_DT_STRING) { | |
| 702 | + result = -ENODATA; | |
| 703 | + continue; | |
| 704 | + } | |
| 705 | + break; | |
| 701 | 706 | } |
| 702 | 707 | return result; |
| 703 | 708 | } |
| @@ -191,6 +191,7 @@ config USB_GADGET_OMAP · 190 unmodified lines | ||
| 191 | 191 | boolean "OMAP USB Device Controller" |
| 192 | 192 | depends on ARCH_OMAP |
| 193 | 193 | select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_H4_OTG |
| 194 | + select USB_OTG_UTILS if ARCH_OMAP | |
| 194 | 195 | help |
| 195 | 196 | Many Texas Instruments OMAP processors have flexible full |
| 196 | 197 | speed USB device controllers, with support for up to 30 |
| @@ -366,9 +366,9 @@ obex_bind(struct usb_configuration *c, struct usb_function *f) · 365 unmodified lines | ||
| 366 | 366 | f->hs_descriptors = usb_copy_descriptors(hs_function); |
| 367 | 367 | |
| 368 | 368 | obex->hs.obex_in = usb_find_endpoint(hs_function, |
| 369 | − f->descriptors, &obex_hs_ep_in_desc); | |
| 369 | + f->hs_descriptors, &obex_hs_ep_in_desc); | |
| 370 | 370 | obex->hs.obex_out = usb_find_endpoint(hs_function, |
| 371 | − f->descriptors, &obex_hs_ep_out_desc); | |
| 371 | + f->hs_descriptors, &obex_hs_ep_out_desc); | |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /* Avoid letting this gadget enumerate until the userspace |
| @@ -3879,7 +3879,11 @@ static int __init check_parameters(struct fsg_dev *fsg) · 3878 unmodified lines | ||
| 3879 | 3879 | mod_data.protocol_type = USB_SC_SCSI; |
| 3880 | 3880 | mod_data.protocol_name = "Transparent SCSI"; |
| 3881 | 3881 | |
| 3882 | − if (gadget_is_sh(fsg->gadget)) | |
| 3882 | + /* Some peripheral controllers are known not to be able to | |
| 3883 | + * halt bulk endpoints correctly. If one of them is present, | |
| 3884 | + * disable stalls. | |
| 3885 | + */ | |
| 3886 | + if (gadget_is_sh(fsg->gadget) || gadget_is_at91(fsg->gadget)) | |
| 3883 | 3887 | mod_data.can_stall = 0; |
| 3884 | 3888 | |
| 3885 | 3889 | if (mod_data.release == 0xffff) { // Parameter wasn't set |
| @@ -404,7 +404,10 @@ static void struct_ep_qh_setup(struct fsl_udc *udc, unsigned char ep_num, · 403 unmodified lines | ||
| 404 | 404 | } |
| 405 | 405 | if (zlt) |
| 406 | 406 | tmp |= EP_QUEUE_HEAD_ZLT_SEL; |
| 407 | + | |
| 407 | 408 | p_QH->max_pkt_length = cpu_to_le32(tmp); |
| 409 | + p_QH->next_dtd_ptr = 1; | |
| 410 | + p_QH->size_ioc_int_sts = 0; | |
| 408 | 411 | |
| 409 | 412 | return; |
| 410 | 413 | } |
| @@ -485,6 +485,7 @@ static int ehci_init(struct usb_hcd *hcd) · 484 unmodified lines | ||
| 485 | 485 | * periodic_size can shrink by USBCMD update if hcc_params allows. |
| 486 | 486 | */ |
| 487 | 487 | ehci->periodic_size = DEFAULT_I_TDPS; |
| 488 | + INIT_LIST_HEAD(&ehci->cached_itd_list); | |
| 488 | 489 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) |
| 489 | 490 | return retval; |
| 490 | 491 | |
| @@ -497,6 +498,7 @@ static int ehci_init(struct usb_hcd *hcd) · 6 unmodified lines | ||
| 497 | 498 | |
| 498 | 499 | ehci->reclaim = NULL; |
| 499 | 500 | ehci->next_uframe = -1; |
| 501 | + ehci->clock_frame = -1; | |
| 500 | 502 | |
| 501 | 503 | /* |
| 502 | 504 | * dedicate a qh for the async ring head, since we couldn't unlink |
| @@ -128,6 +128,7 @@ static inline void qh_put (struct ehci_qh *qh) · 127 unmodified lines | ||
| 128 | 128 | |
| 129 | 129 | static void ehci_mem_cleanup (struct ehci_hcd *ehci) |
| 130 | 130 | { |
| 131 | + free_cached_itd_list(ehci); | |
| 131 | 132 | if (ehci->async) |
| 132 | 133 | qh_put (ehci->async); |
| 133 | 134 | ehci->async = NULL; |
| @@ -1004,7 +1004,8 @@ iso_stream_put(struct ehci_hcd *ehci, struct ehci_iso_stream *stream) · 1003 unmodified lines | ||
| 1004 | 1004 | |
| 1005 | 1005 | is_in = (stream->bEndpointAddress & USB_DIR_IN) ? 0x10 : 0; |
| 1006 | 1006 | stream->bEndpointAddress &= 0x0f; |
| 1007 | − stream->ep->hcpriv = NULL; | |
| 1007 | + if (stream->ep) | |
| 1008 | + stream->ep->hcpriv = NULL; | |
| 1008 | 1009 | |
| 1009 | 1010 | if (stream->rescheduled) { |
| 1010 | 1011 | ehci_info (ehci, "ep%d%s-iso rescheduled " |
| @@ -1653,14 +1654,28 @@ itd_complete ( · 642 unmodified lines | ||
| 1653 | 1654 | (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); |
| 1654 | 1655 | } |
| 1655 | 1656 | iso_stream_put (ehci, stream); |
| 1656 | − /* OK to recycle this ITD now that its completion callback ran. */ | |
| 1657 | + | |
| 1657 | 1658 | done: |
| 1658 | 1659 | usb_put_urb(urb); |
| 1659 | 1660 | itd->urb = NULL; |
| 1660 | − itd->stream = NULL; | |
| 1661 | − list_move(&itd->itd_list, &stream->free_list); | |
| 1662 | − iso_stream_put(ehci, stream); | |
| 1663 | − | |
| 1661 | + if (ehci->clock_frame != itd->frame || itd->index[7] != -1) { | |
| 1662 | + /* OK to recycle this ITD now. */ | |
| 1663 | + itd->stream = NULL; | |
| 1664 | + list_move(&itd->itd_list, &stream->free_list); | |
| 1665 | + iso_stream_put(ehci, stream); | |
| 1666 | + } else { | |
| 1667 | + /* HW might remember this ITD, so we can't recycle it yet. | |
| 1668 | + * Move it to a safe place until a new frame starts. | |
| 1669 | + */ | |
| 1670 | + list_move(&itd->itd_list, &ehci->cached_itd_list); | |
| 1671 | + if (stream->refcount == 2) { | |
| 1672 | + /* If iso_stream_put() were called here, stream | |
| 1673 | + * would be freed. Instead, just prevent reuse. | |
| 1674 | + */ | |
| 1675 | + stream->ep->hcpriv = NULL; | |
| 1676 | + stream->ep = NULL; | |
| 1677 | + } | |
| 1678 | + } | |
| 1664 | 1679 | return retval; |
| 1665 | 1680 | } |
| 1666 | 1681 | |
| @@ -2101,6 +2116,20 @@ done: · 434 unmodified lines | ||
| 2101 | 2116 | |
| 2102 | 2117 | /*-------------------------------------------------------------------------*/ |
| 2103 | 2118 | |
| 2119 | +static void free_cached_itd_list(struct ehci_hcd *ehci) | |
| 2120 | +{ | |
| 2121 | + struct ehci_itd *itd, *n; | |
| 2122 | + | |
| 2123 | + list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) { | |
| 2124 | + struct ehci_iso_stream *stream = itd->stream; | |
| 2125 | + itd->stream = NULL; | |
| 2126 | + list_move(&itd->itd_list, &stream->free_list); | |
| 2127 | + iso_stream_put(ehci, stream); | |
| 2128 | + } | |
| 2129 | +} | |
| 2130 | + | |
| 2131 | +/*-------------------------------------------------------------------------*/ | |
| 2132 | + | |
| 2104 | 2133 | static void |
| 2105 | 2134 | scan_periodic (struct ehci_hcd *ehci) |
| 2106 | 2135 | { |
| @@ -2115,10 +2144,17 @@ scan_periodic (struct ehci_hcd *ehci) · 8 unmodified lines | ||
| 2115 | 2144 | * Touches as few pages as possible: cache-friendly. |
| 2116 | 2145 | */ |
| 2117 | 2146 | now_uframe = ehci->next_uframe; |
| 2118 | − if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) | |
| 2147 | + if (HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) { | |
| 2119 | 2148 | clock = ehci_readl(ehci, &ehci->regs->frame_index); |
| 2120 | − else | |
| 2149 | + clock_frame = (clock >> 3) % ehci->periodic_size; | |
| 2150 | + } else { | |
| 2121 | 2151 | clock = now_uframe + mod - 1; |
| 2152 | + clock_frame = -1; | |
| 2153 | + } | |
| 2154 | + if (ehci->clock_frame != clock_frame) { | |
| 2155 | + free_cached_itd_list(ehci); | |
| 2156 | + ehci->clock_frame = clock_frame; | |
| 2157 | + } | |
| 2122 | 2158 | clock %= mod; |
| 2123 | 2159 | clock_frame = clock >> 3; |
| 2124 | 2160 | |
| @@ -2277,6 +2313,10 @@ restart: · 152 unmodified lines | ||
| 2277 | 2313 | /* rescan the rest of this frame, then ... */ |
| 2278 | 2314 | clock = now; |
| 2279 | 2315 | clock_frame = clock >> 3; |
| 2316 | + if (ehci->clock_frame != clock_frame) { | |
| 2317 | + free_cached_itd_list(ehci); | |
| 2318 | + ehci->clock_frame = clock_frame; | |
| 2319 | + } | |
| 2280 | 2320 | } else { |
| 2281 | 2321 | now_uframe++; |
| 2282 | 2322 | now_uframe %= mod; |
| @@ -87,6 +87,10 @@ struct ehci_hcd { /* one per controller */ · 86 unmodified lines | ||
| 87 | 87 | int next_uframe; /* scan periodic, start here */ |
| 88 | 88 | unsigned periodic_sched; /* periodic activity count */ |
| 89 | 89 | |
| 90 | + /* list of itds completed while clock_frame was still active */ | |
| 91 | + struct list_head cached_itd_list; | |
| 92 | + unsigned clock_frame; | |
| 93 | + | |
| 90 | 94 | /* per root hub port */ |
| 91 | 95 | unsigned long reset_done [EHCI_MAX_ROOT_PORTS]; |
| 92 | 96 | |
| @@ -220,6 +224,8 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action) · 127 unmodified lines | ||
| 220 | 224 | } |
| 221 | 225 | } |
| 222 | 226 | |
| 227 | +static void free_cached_itd_list(struct ehci_hcd *ehci); | |
| 228 | + | |
| 223 | 229 | /*-------------------------------------------------------------------------*/ |
| 224 | 230 | |
| 225 | 231 | #include <linux/usb/ehci_def.h> |
| @@ -377,18 +377,8 @@ int __init musb_platform_init(struct musb *musb) · 376 unmodified lines | ||
| 377 | 377 | u32 revision; |
| 378 | 378 | |
| 379 | 379 | musb->mregs += DAVINCI_BASE_OFFSET; |
| 380 | −#if 0 | |
| 381 | − /* REVISIT there's something odd about clocking, this | |
| 382 | − * didn't appear do the job ... | |
| 383 | − */ | |
| 384 | − musb->clock = clk_get(pDevice, "usb"); | |
| 385 | − if (IS_ERR(musb->clock)) | |
| 386 | − return PTR_ERR(musb->clock); | |
| 387 | 380 | |
| 388 | − status = clk_enable(musb->clock); | |
| 389 | − if (status < 0) | |
| 390 | − return -ENODEV; | |
| 391 | −#endif | |
| 381 | + clk_enable(musb->clock); | |
| 392 | 382 | |
| 393 | 383 | /* returns zero if e.g. not clocked */ |
| 394 | 384 | revision = musb_readl(tibase, DAVINCI_USB_VERSION_REG); |
| @@ -453,5 +443,8 @@ int musb_platform_exit(struct musb *musb) · 58 unmodified lines | ||
| 453 | 443 | } |
| 454 | 444 | |
| 455 | 445 | phy_off(); |
| 446 | + | |
| 447 | + clk_disable(musb->clock); | |
| 448 | + | |
| 456 | 449 | return 0; |
| 457 | 450 | } |
| @@ -115,7 +115,7 @@ · 114 unmodified lines | ||
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | unsigned musb_debug; |
| 118 | −module_param(musb_debug, uint, S_IRUGO | S_IWUSR); | |
| 118 | +module_param_named(debug, musb_debug, uint, S_IRUGO | S_IWUSR); | |
| 119 | 119 | MODULE_PARM_DESC(debug, "Debug message level. Default = 0"); |
| 120 | 120 | |
| 121 | 121 | #define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" |
| @@ -767,6 +767,7 @@ static irqreturn_t musb_stage2_irq(struct musb *musb, u8 int_usb, · 645 unmodified lines | ||
| 767 | 767 | #ifdef CONFIG_USB_MUSB_HDRC_HCD |
| 768 | 768 | case OTG_STATE_A_HOST: |
| 769 | 769 | case OTG_STATE_A_SUSPEND: |
| 770 | + usb_hcd_resume_root_hub(musb_to_hcd(musb)); | |
| 770 | 771 | musb_root_disconnect(musb); |
| 771 | 772 | if (musb->a_wait_bcon != 0) |
| 772 | 773 | musb_platform_try_idle(musb, jiffies |
| @@ -1815,7 +1816,7 @@ static void musb_free(struct musb *musb) · 1042 unmodified lines | ||
| 1815 | 1816 | #ifdef CONFIG_SYSFS |
| 1816 | 1817 | device_remove_file(musb->controller, &dev_attr_mode); |
| 1817 | 1818 | device_remove_file(musb->controller, &dev_attr_vbus); |
| 1818 | −#ifdef CONFIG_USB_MUSB_OTG | |
| 1819 | +#ifdef CONFIG_USB_GADGET_MUSB_HDRC | |
| 1819 | 1820 | device_remove_file(musb->controller, &dev_attr_srp); |
| 1820 | 1821 | #endif |
| 1821 | 1822 | #endif |
| @@ -2063,7 +2064,7 @@ fail2: · 241 unmodified lines | ||
| 2063 | 2064 | #ifdef CONFIG_SYSFS |
| 2064 | 2065 | device_remove_file(musb->controller, &dev_attr_mode); |
| 2065 | 2066 | device_remove_file(musb->controller, &dev_attr_vbus); |
| 2066 | −#ifdef CONFIG_USB_MUSB_OTG | |
| 2067 | +#ifdef CONFIG_USB_GADGET_MUSB_HDRC | |
| 2067 | 2068 | device_remove_file(musb->controller, &dev_attr_srp); |
| 2068 | 2069 | #endif |
| 2069 | 2070 | #endif |
| @@ -2243,10 +2244,10 @@ static int __init musb_init(void) · 173 unmodified lines | ||
| 2243 | 2244 | return platform_driver_probe(&musb_driver, musb_probe); |
| 2244 | 2245 | } |
| 2245 | 2246 | |
| 2246 | −/* make us init after usbcore and before usb | |
| 2247 | − * gadget and host-side drivers start to register | |
| 2247 | +/* make us init after usbcore and i2c (transceivers, regulators, etc) | |
| 2248 | + * and before usb gadget and host-side drivers start to register | |
| 2248 | 2249 | */ |
| 2249 | −subsys_initcall(musb_init); | |
| 2250 | +fs_initcall(musb_init); | |
| 2250 | 2251 | |
| 2251 | 2252 | static void __exit musb_cleanup(void) |
| 2252 | 2253 | { |
| @@ -575,7 +575,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) · 574 unmodified lines | ||
| 575 | 575 | struct usb_request *request = &req->request; |
| 576 | 576 | struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; |
| 577 | 577 | void __iomem *epio = musb->endpoints[epnum].regs; |
| 578 | − u16 fifo_count = 0; | |
| 578 | + unsigned fifo_count = 0; | |
| 579 | 579 | u16 len = musb_ep->packet_sz; |
| 580 | 580 | |
| 581 | 581 | csr = musb_readw(epio, MUSB_RXCSR); |
| @@ -687,7 +687,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) · 105 unmodified lines | ||
| 687 | 687 | len, fifo_count, |
| 688 | 688 | musb_ep->packet_sz); |
| 689 | 689 | |
| 690 | − fifo_count = min(len, fifo_count); | |
| 690 | + fifo_count = min_t(unsigned, len, fifo_count); | |
| 691 | 691 | |
| 692 | 692 | #ifdef CONFIG_USB_TUSB_OMAP_DMA |
| 693 | 693 | if (tusb_dma_omap() && musb_ep->dma) { |
| @@ -335,16 +335,11 @@ musb_save_toggle(struct musb_hw_ep *ep, int is_in, struct urb *urb) · 334 unmodified lines | ||
| 335 | 335 | static struct musb_qh * |
| 336 | 336 | musb_giveback(struct musb_qh *qh, struct urb *urb, int status) |
| 337 | 337 | { |
| 338 | − int is_in; | |
| 339 | 338 | struct musb_hw_ep *ep = qh->hw_ep; |
| 340 | 339 | struct musb *musb = ep->musb; |
| 340 | + int is_in = usb_pipein(urb->pipe); | |
| 341 | 341 | int ready = qh->is_ready; |
| 342 | 342 | |
| 343 | − if (ep->is_shared_fifo) | |
| 344 | − is_in = 1; | |
| 345 | − else | |
| 346 | − is_in = usb_pipein(urb->pipe); | |
| 347 | − | |
| 348 | 343 | /* save toggle eagerly, for paranoia */ |
| 349 | 344 | switch (qh->type) { |
| 350 | 345 | case USB_ENDPOINT_XFER_BULK: |
| @@ -432,7 +427,7 @@ musb_advance_schedule(struct musb *musb, struct urb *urb, · 81 unmodified lines | ||
| 432 | 427 | else |
| 433 | 428 | qh = musb_giveback(qh, urb, urb->status); |
| 434 | 429 | |
| 435 | − if (qh && qh->is_ready && !list_empty(&qh->hep->urb_list)) { | |
| 430 | + if (qh != NULL && qh->is_ready) { | |
| 436 | 431 | DBG(4, "... next ep%d %cX urb %p\n", |
| 437 | 432 | hw_ep->epnum, is_in ? 'R' : 'T', |
| 438 | 433 | next_urb(qh)); |
| @@ -942,8 +937,8 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb) · 503 unmodified lines | ||
| 942 | 937 | switch (musb->ep0_stage) { |
| 943 | 938 | case MUSB_EP0_IN: |
| 944 | 939 | fifo_dest = urb->transfer_buffer + urb->actual_length; |
| 945 | − fifo_count = min(len, ((u16) (urb->transfer_buffer_length | |
| 946 | − - urb->actual_length))); | |
| 940 | + fifo_count = min_t(size_t, len, urb->transfer_buffer_length - | |
| 941 | + urb->actual_length); | |
| 947 | 942 | if (fifo_count < len) |
| 948 | 943 | urb->status = -EOVERFLOW; |
| 949 | 944 | |
| @@ -976,10 +971,9 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb) · 26 unmodified lines | ||
| 976 | 971 | } |
| 977 | 972 | /* FALLTHROUGH */ |
| 978 | 973 | case MUSB_EP0_OUT: |
| 979 | − fifo_count = min(qh->maxpacket, ((u16) | |
| 980 | − (urb->transfer_buffer_length | |
| 981 | − - urb->actual_length))); | |
| 982 | − | |
| 974 | + fifo_count = min_t(size_t, qh->maxpacket, | |
| 975 | + urb->transfer_buffer_length - | |
| 976 | + urb->actual_length); | |
| 983 | 977 | if (fifo_count) { |
| 984 | 978 | fifo_dest = (u8 *) (urb->transfer_buffer |
| 985 | 979 | + urb->actual_length); |
| @@ -1161,7 +1155,8 @@ void musb_host_tx(struct musb *musb, u8 epnum) · 175 unmodified lines | ||
| 1161 | 1155 | struct urb *urb; |
| 1162 | 1156 | struct musb_hw_ep *hw_ep = musb->endpoints + epnum; |
| 1163 | 1157 | void __iomem *epio = hw_ep->regs; |
| 1164 | − struct musb_qh *qh = hw_ep->out_qh; | |
| 1158 | + struct musb_qh *qh = hw_ep->is_shared_fifo ? hw_ep->in_qh | |
| 1159 | + : hw_ep->out_qh; | |
| 1165 | 1160 | u32 status = 0; |
| 1166 | 1161 | void __iomem *mbase = musb->mregs; |
| 1167 | 1162 | struct dma_channel *dma; |
| @@ -1308,7 +1303,8 @@ void musb_host_tx(struct musb *musb, u8 epnum) · 140 unmodified lines | ||
| 1308 | 1303 | * packets before updating TXCSR ... other docs disagree ... |
| 1309 | 1304 | */ |
| 1310 | 1305 | /* PIO: start next packet in this URB */ |
| 1311 | − wLength = min(qh->maxpacket, (u16) wLength); | |
| 1306 | + if (wLength > qh->maxpacket) | |
| 1307 | + wLength = qh->maxpacket; | |
| 1312 | 1308 | musb_write_fifo(hw_ep, wLength, buf); |
| 1313 | 1309 | qh->segsize = wLength; |
| 1314 | 1310 | |
| @@ -1867,19 +1863,21 @@ static int musb_urb_enqueue( · 552 unmodified lines | ||
| 1867 | 1863 | } |
| 1868 | 1864 | qh->type_reg = type_reg; |
| 1869 | 1865 | |
| 1870 | − /* precompute rxinterval/txinterval register */ | |
| 1871 | − interval = min((u8)16, epd->bInterval); /* log encoding */ | |
| 1866 | + /* Precompute RXINTERVAL/TXINTERVAL register */ | |
| 1872 | 1867 | switch (qh->type) { |
| 1873 | 1868 | case USB_ENDPOINT_XFER_INT: |
| 1874 | − /* fullspeed uses linear encoding */ | |
| 1875 | − if (USB_SPEED_FULL == urb->dev->speed) { | |
| 1876 | − interval = epd->bInterval; | |
| 1877 | − if (!interval) | |
| 1878 | − interval = 1; | |
| 1869 | + /* | |
| 1870 | + * Full/low speeds use the linear encoding, | |
| 1871 | + * high speed uses the logarithmic encoding. | |
| 1872 | + */ | |
| 1873 | + if (urb->dev->speed <= USB_SPEED_FULL) { | |
| 1874 | + interval = max_t(u8, epd->bInterval, 1); | |
| 1875 | + break; | |
| 1879 | 1876 | } |
| 1880 | 1877 | /* FALLTHROUGH */ |
| 1881 | 1878 | case USB_ENDPOINT_XFER_ISOC: |
| 1882 | − /* iso always uses log encoding */ | |
| 1879 | + /* ISO always uses logarithmic encoding */ | |
| 1880 | + interval = min_t(u8, epd->bInterval, 16); | |
| 1883 | 1881 | break; |
| 1884 | 1882 | default: |
| 1885 | 1883 | /* REVISIT we actually want to use NAK limits, hinting to the |
| @@ -2037,9 +2035,9 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) · 151 unmodified lines | ||
| 2037 | 2035 | goto done; |
| 2038 | 2036 | |
| 2039 | 2037 | /* Any URB not actively programmed into endpoint hardware can be |
| 2040 | − * immediately given back. Such an URB must be at the head of its | |
| 2038 | + * immediately given back; that's any URB not at the head of an | |
| 2041 | 2039 | * endpoint queue, unless someday we get real DMA queues. And even |
| 2042 | − * then, it might not be known to the hardware... | |
| 2040 | + * if it's at the head, it might not be known to the hardware... | |
| 2043 | 2041 | * |
| 2044 | 2042 | * Otherwise abort current transfer, pending dma, etc.; urb->status |
| 2045 | 2043 | * has already been updated. This is a synchronous abort; it'd be |
| @@ -2078,6 +2076,15 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) · 32 unmodified lines | ||
| 2078 | 2076 | qh->is_ready = 0; |
| 2079 | 2077 | __musb_giveback(musb, urb, 0); |
| 2080 | 2078 | qh->is_ready = ready; |
| 2079 | + | |
| 2080 | + /* If nothing else (usually musb_giveback) is using it | |
| 2081 | + * and its URB list has emptied, recycle this qh. | |
| 2082 | + */ | |
| 2083 | + if (ready && list_empty(&qh->hep->urb_list)) { | |
| 2084 | + qh->hep->hcpriv = NULL; | |
| 2085 | + list_del(&qh->ring); | |
| 2086 | + kfree(qh); | |
| 2087 | + } | |
| 2081 | 2088 | } else |
| 2082 | 2089 | ret = musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN); |
| 2083 | 2090 | done: |
| @@ -2093,15 +2100,16 @@ musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep) · 9 unmodified lines | ||
| 2093 | 2100 | unsigned long flags; |
| 2094 | 2101 | struct musb *musb = hcd_to_musb(hcd); |
| 2095 | 2102 | u8 is_in = epnum & USB_DIR_IN; |
| 2096 | − struct musb_qh *qh = hep->hcpriv; | |
| 2097 | − struct urb *urb, *tmp; | |
| 2103 | + struct musb_qh *qh; | |
| 2104 | + struct urb *urb; | |
| 2098 | 2105 | struct list_head *sched; |
| 2099 | 2106 | |
| 2100 | − if (!qh) | |
| 2101 | − return; | |
| 2102 | − | |
| 2103 | 2107 | spin_lock_irqsave(&musb->lock, flags); |
| 2104 | 2108 | |
| 2109 | + qh = hep->hcpriv; | |
| 2110 | + if (qh == NULL) | |
| 2111 | + goto exit; | |
| 2112 | + | |
| 2105 | 2113 | switch (qh->type) { |
| 2106 | 2114 | case USB_ENDPOINT_XFER_CONTROL: |
| 2107 | 2115 | sched = &musb->control; |
| @@ -2135,13 +2143,28 @@ musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep) · 27 unmodified lines | ||
| 2135 | 2143 | |
| 2136 | 2144 | /* cleanup */ |
| 2137 | 2145 | musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN); |
| 2138 | − } else | |
| 2139 | − urb = NULL; | |
| 2140 | 2146 | |
| 2141 | − /* then just nuke all the others */ | |
| 2142 | − list_for_each_entry_safe_from(urb, tmp, &hep->urb_list, urb_list) | |
| 2143 | − musb_giveback(qh, urb, -ESHUTDOWN); | |
| 2147 | + /* Then nuke all the others ... and advance the | |
| 2148 | + * queue on hw_ep (e.g. bulk ring) when we're done. | |
| 2149 | + */ | |
| 2150 | + while (!list_empty(&hep->urb_list)) { | |
| 2151 | + urb = next_urb(qh); | |
| 2152 | + urb->status = -ESHUTDOWN; | |
| 2153 | + musb_advance_schedule(musb, urb, qh->hw_ep, is_in); | |
| 2154 | + } | |
| 2155 | + } else { | |
| 2156 | + /* Just empty the queue; the hardware is busy with | |
| 2157 | + * other transfers, and since !qh->is_ready nothing | |
| 2158 | + * will activate any of these as it advances. | |
| 2159 | + */ | |
| 2160 | + while (!list_empty(&hep->urb_list)) | |
| 2161 | + __musb_giveback(musb, next_urb(qh), -ESHUTDOWN); | |
| 2144 | 2162 | |
| 2163 | + hep->hcpriv = NULL; | |
| 2164 | + list_del(&qh->ring); | |
| 2165 | + kfree(qh); | |
| 2166 | + } | |
| 2167 | +exit: | |
| 2145 | 2168 | spin_unlock_irqrestore(&musb->lock, flags); |
| 2146 | 2169 | } |
| 2147 | 2170 | |
| @@ -294,7 +294,11 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po · 293 unmodified lines | ||
| 294 | 294 | |
| 295 | 295 | /* Ericsson products */ |
| 296 | 296 | #define ERICSSON_VENDOR_ID 0x0bdb |
| 297 | −#define ERICSSON_PRODUCT_F3507G 0x1900 | |
| 297 | +#define ERICSSON_PRODUCT_F3507G_1 0x1900 | |
| 298 | +#define ERICSSON_PRODUCT_F3507G_2 0x1902 | |
| 299 | + | |
| 300 | +#define BENQ_VENDOR_ID 0x04a5 | |
| 301 | +#define BENQ_PRODUCT_H10 0x4068 | |
| 298 | 302 | |
| 299 | 303 | static struct usb_device_id option_ids[] = { |
| 300 | 304 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
| @@ -509,7 +513,10 @@ static struct usb_device_id option_ids[] = { · 208 unmodified lines | ||
| 509 | 513 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626) }, |
| 510 | 514 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, |
| 511 | 515 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, |
| 512 | − { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) }, | |
| 516 | + { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G_1) }, | |
| 517 | + { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G_2) }, | |
| 518 | + { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, | |
| 519 | + { USB_DEVICE(0x1da5, 0x4515) }, /* BenQ H20 */ | |
| 513 | 520 | { } /* Terminating entry */ |
| 514 | 521 | }; |
| 515 | 522 | MODULE_DEVICE_TABLE(usb, option_ids); |
| @@ -907,13 +907,13 @@ UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff, · 906 unmodified lines | ||
| 907 | 907 | "Genesys Logic", |
| 908 | 908 | "USB to IDE Optical", |
| 909 | 909 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 910 | − US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), | |
| 910 | + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ), | |
| 911 | 911 | |
| 912 | 912 | UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff, |
| 913 | 913 | "Genesys Logic", |
| 914 | 914 | "USB to IDE Disk", |
| 915 | 915 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 916 | − US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), | |
| 916 | + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ), | |
| 917 | 917 | |
| 918 | 918 | /* Reported by Ben Efros <ben@pc-doctor.com> */ |
| 919 | 919 | UNUSUAL_DEV( 0x05e3, 0x0723, 0x9451, 0x9451, |
| @@ -16,6 +16,12 @@ config W1_SLAVE_SMEM · 15 unmodified lines | ||
| 16 | 16 | Say Y here if you want to connect 1-wire |
| 17 | 17 | simple 64bit memory rom(ds2401/ds2411/ds1990*) to your wire. |
| 18 | 18 | |
| 19 | +config W1_SLAVE_DS2431 | |
| 20 | + tristate "1kb EEPROM family support (DS2431)" | |
| 21 | + help | |
| 22 | + Say Y here if you want to use a 1-wire | |
| 23 | + 1kb EEPROM family device (DS2431) | |
| 24 | + | |
| 19 | 25 | config W1_SLAVE_DS2433 |
| 20 | 26 | tristate "4kb EEPROM family support (DS2433)" |
| 21 | 27 | help |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o |
| 6 | 6 | obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o |
| 7 | +obj-$(CONFIG_W1_SLAVE_DS2431) += w1_ds2431.o | |
| 7 | 8 | obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o |
| 8 | 9 | obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o |
| 9 | 10 | obj-$(CONFIG_W1_SLAVE_BQ27000) += w1_bq27000.o |
| @@ -156,6 +156,9 @@ out_up: · 155 unmodified lines | ||
| 156 | 156 | */ |
| 157 | 157 | static int w1_f23_write(struct w1_slave *sl, int addr, int len, const u8 *data) |
| 158 | 158 | { |
| 159 | +#ifdef CONFIG_W1_SLAVE_DS2433_CRC | |
| 160 | + struct w1_f23_data *f23 = sl->family_data; | |
| 161 | +#endif | |
| 159 | 162 | u8 wrbuf[4]; |
| 160 | 163 | u8 rdbuf[W1_PAGE_SIZE + 3]; |
| 161 | 164 | u8 es = (addr + len - 1) & 0x1f; |
| @@ -196,7 +199,9 @@ static int w1_f23_write(struct w1_slave *sl, int addr, int len, const u8 *data) · 34 unmodified lines | ||
| 196 | 199 | |
| 197 | 200 | /* Reset the bus to wake up the EEPROM (this may not be needed) */ |
| 198 | 201 | w1_reset_bus(sl->master); |
| 199 | − | |
| 202 | +#ifdef CONFIG_W1_SLAVE_DS2433_CRC | |
| 203 | + f23->validcrc &= ~(1 << (addr >> W1_PAGE_BITS)); | |
| 204 | +#endif | |
| 200 | 205 | return 0; |
| 201 | 206 | } |
| 202 | 207 | |
| @@ -302,7 +302,7 @@ void bio_init(struct bio *bio) · 301 unmodified lines | ||
| 302 | 302 | struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) |
| 303 | 303 | { |
| 304 | 304 | struct bio *bio = NULL; |
| 305 | − void *p; | |
| 305 | + void *uninitialized_var(p); | |
| 306 | 306 | |
| 307 | 307 | if (bs) { |
| 308 | 308 | p = mempool_alloc(bs->bio_pool, gfp_mask); |
| @@ -66,6 +66,9 @@ struct btrfs_inode { · 65 unmodified lines | ||
| 66 | 66 | */ |
| 67 | 67 | struct list_head delalloc_inodes; |
| 68 | 68 | |
| 69 | + /* the space_info for where this inode's data allocations are done */ | |
| 70 | + struct btrfs_space_info *space_info; | |
| 71 | + | |
| 69 | 72 | /* full 64 bit generation number, struct vfs_inode doesn't have a big |
| 70 | 73 | * enough field for this. |
| 71 | 74 | */ |
| @@ -94,6 +97,11 @@ struct btrfs_inode { · 22 unmodified lines | ||
| 94 | 97 | */ |
| 95 | 98 | u64 delalloc_bytes; |
| 96 | 99 | |
| 100 | + /* total number of bytes that may be used for this inode for | |
| 101 | + * delalloc | |
| 102 | + */ | |
| 103 | + u64 reserved_bytes; | |
| 104 | + | |
| 97 | 105 | /* |
| 98 | 106 | * the size of the file stored in the metadata on disk. data=ordered |
| 99 | 107 | * means the in-memory i_size might be larger than the size on disk |
| @@ -596,13 +596,27 @@ struct btrfs_block_group_item { · 595 unmodified lines | ||
| 596 | 596 | |
| 597 | 597 | struct btrfs_space_info { |
| 598 | 598 | u64 flags; |
| 599 | − u64 total_bytes; | |
| 600 | − u64 bytes_used; | |
| 601 | − u64 bytes_pinned; | |
| 602 | − u64 bytes_reserved; | |
| 603 | − u64 bytes_readonly; | |
| 604 | − int full; | |
| 605 | − int force_alloc; | |
| 599 | + | |
| 600 | + u64 total_bytes; /* total bytes in the space */ | |
| 601 | + u64 bytes_used; /* total bytes used on disk */ | |
| 602 | + u64 bytes_pinned; /* total bytes pinned, will be freed when the | |
| 603 | + transaction finishes */ | |
| 604 | + u64 bytes_reserved; /* total bytes the allocator has reserved for | |
| 605 | + current allocations */ | |
| 606 | + u64 bytes_readonly; /* total bytes that are read only */ | |
| 607 | + | |
| 608 | + /* delalloc accounting */ | |
| 609 | + u64 bytes_delalloc; /* number of bytes reserved for allocation, | |
| 610 | + this space is not necessarily reserved yet | |
| 611 | + by the allocator */ | |
| 612 | + u64 bytes_may_use; /* number of bytes that may be used for | |
| 613 | + delalloc */ | |
| 614 | + | |
| 615 | + int full; /* indicates that we cannot allocate any more | |
| 616 | + chunks for this space */ | |
| 617 | + int force_alloc; /* set if we need to force a chunk alloc for | |
| 618 | + this space */ | |
| 619 | + | |
| 606 | 620 | struct list_head list; |
| 607 | 621 | |
| 608 | 622 | /* for block groups in our same type */ |
| @@ -1782,6 +1796,16 @@ int btrfs_add_dead_reloc_root(struct btrfs_root *root); · 1173 unmodified lines | ||
| 1782 | 1796 | int btrfs_cleanup_reloc_trees(struct btrfs_root *root); |
| 1783 | 1797 | int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len); |
| 1784 | 1798 | u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags); |
| 1799 | +void btrfs_set_inode_space_info(struct btrfs_root *root, struct inode *ionde); | |
| 1800 | +int btrfs_check_metadata_free_space(struct btrfs_root *root); | |
| 1801 | +int btrfs_check_data_free_space(struct btrfs_root *root, struct inode *inode, | |
| 1802 | + u64 bytes); | |
| 1803 | +void btrfs_free_reserved_data_space(struct btrfs_root *root, | |
| 1804 | + struct inode *inode, u64 bytes); | |
| 1805 | +void btrfs_delalloc_reserve_space(struct btrfs_root *root, struct inode *inode, | |
| 1806 | + u64 bytes); | |
| 1807 | +void btrfs_delalloc_free_space(struct btrfs_root *root, struct inode *inode, | |
| 1808 | + u64 bytes); | |
| 1785 | 1809 | /* ctree.c */ |
| 1786 | 1810 | int btrfs_previous_item(struct btrfs_root *root, |
| 1787 | 1811 | struct btrfs_path *path, u64 min_objectid, |
| @@ -2027,8 +2051,6 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset, · 239 unmodified lines | ||
| 2027 | 2051 | unsigned long btrfs_force_ra(struct address_space *mapping, |
| 2028 | 2052 | struct file_ra_state *ra, struct file *file, |
| 2029 | 2053 | pgoff_t offset, pgoff_t last_index); |
| 2030 | −int btrfs_check_free_space(struct btrfs_root *root, u64 num_required, | |
| 2031 | − int for_del); | |
| 2032 | 2054 | int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page); |
| 2033 | 2055 | int btrfs_readpage(struct file *file, struct page *page); |
| 2034 | 2056 | void btrfs_delete_inode(struct inode *inode); |
| @@ -60,6 +60,10 @@ static int update_block_group(struct btrfs_trans_handle *trans, · 59 unmodified lines | ||
| 60 | 60 | u64 bytenr, u64 num_bytes, int alloc, |
| 61 | 61 | int mark_free); |
| 62 | 62 | |
| 63 | +static int do_chunk_alloc(struct btrfs_trans_handle *trans, | |
| 64 | + struct btrfs_root *extent_root, u64 alloc_bytes, | |
| 65 | + u64 flags, int force); | |
| 66 | + | |
| 63 | 67 | static int block_group_bits(struct btrfs_block_group_cache *cache, u64 bits) |
| 64 | 68 | { |
| 65 | 69 | return (cache->flags & bits) == bits; |
| @@ -1909,6 +1913,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, · 1843 unmodified lines | ||
| 1909 | 1913 | found->bytes_pinned = 0; |
| 1910 | 1914 | found->bytes_reserved = 0; |
| 1911 | 1915 | found->bytes_readonly = 0; |
| 1916 | + found->bytes_delalloc = 0; | |
| 1912 | 1917 | found->full = 0; |
| 1913 | 1918 | found->force_alloc = 0; |
| 1914 | 1919 | *space_info = found; |
| @@ -1972,6 +1977,233 @@ u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags) · 57 unmodified lines | ||
| 1972 | 1977 | return flags; |
| 1973 | 1978 | } |
| 1974 | 1979 | |
| 1980 | +static u64 btrfs_get_alloc_profile(struct btrfs_root *root, u64 data) | |
| 1981 | +{ | |
| 1982 | + struct btrfs_fs_info *info = root->fs_info; | |
| 1983 | + u64 alloc_profile; | |
| 1984 | + | |
| 1985 | + if (data) { | |
| 1986 | + alloc_profile = info->avail_data_alloc_bits & | |
| 1987 | + info->data_alloc_profile; | |
| 1988 | + data = BTRFS_BLOCK_GROUP_DATA | alloc_profile; | |
| 1989 | + } else if (root == root->fs_info->chunk_root) { | |
| 1990 | + alloc_profile = info->avail_system_alloc_bits & | |
| 1991 | + info->system_alloc_profile; | |
| 1992 | + data = BTRFS_BLOCK_GROUP_SYSTEM | alloc_profile; | |
| 1993 | + } else { | |
| 1994 | + alloc_profile = info->avail_metadata_alloc_bits & | |
| 1995 | + info->metadata_alloc_profile; | |
| 1996 | + data = BTRFS_BLOCK_GROUP_METADATA | alloc_profile; | |
| 1997 | + } | |
| 1998 | + | |
| 1999 | + return btrfs_reduce_alloc_profile(root, data); | |
| 2000 | +} | |
| 2001 | + | |
| 2002 | +void btrfs_set_inode_space_info(struct btrfs_root *root, struct inode *inode) | |
| 2003 | +{ | |
| 2004 | + u64 alloc_target; | |
| 2005 | + | |
| 2006 | + alloc_target = btrfs_get_alloc_profile(root, 1); | |
| 2007 | + BTRFS_I(inode)->space_info = __find_space_info(root->fs_info, | |
| 2008 | + alloc_target); | |
| 2009 | +} | |
| 2010 | + | |
| 2011 | +/* | |
| 2012 | + * for now this just makes sure we have at least 5% of our metadata space free | |
| 2013 | + * for use. | |
| 2014 | + */ | |
| 2015 | +int btrfs_check_metadata_free_space(struct btrfs_root *root) | |
| 2016 | +{ | |
| 2017 | + struct btrfs_fs_info *info = root->fs_info; | |
| 2018 | + struct btrfs_space_info *meta_sinfo; | |
| 2019 | + u64 alloc_target, thresh; | |
| 2020 | + int committed = 0, ret; | |
| 2021 | + | |
| 2022 | + /* get the space info for where the metadata will live */ | |
| 2023 | + alloc_target = btrfs_get_alloc_profile(root, 0); | |
| 2024 | + meta_sinfo = __find_space_info(info, alloc_target); | |
| 2025 | + | |
| 2026 | +again: | |
| 2027 | + spin_lock(&meta_sinfo->lock); | |
| 2028 | + if (!meta_sinfo->full) | |
| 2029 | + thresh = meta_sinfo->total_bytes * 80; | |
| 2030 | + else | |
| 2031 | + thresh = meta_sinfo->total_bytes * 95; | |
| 2032 | + | |
| 2033 | + do_div(thresh, 100); | |
| 2034 | + | |
| 2035 | + if (meta_sinfo->bytes_used + meta_sinfo->bytes_reserved + | |
| 2036 | + meta_sinfo->bytes_pinned + meta_sinfo->bytes_readonly > thresh) { | |
| 2037 | + struct btrfs_trans_handle *trans; | |
| 2038 | + if (!meta_sinfo->full) { | |
| 2039 | + meta_sinfo->force_alloc = 1; | |
| 2040 | + spin_unlock(&meta_sinfo->lock); | |
| 2041 | + | |
| 2042 | + trans = btrfs_start_transaction(root, 1); | |
| 2043 | + if (!trans) | |
| 2044 | + return -ENOMEM; | |
| 2045 | + | |
| 2046 | + ret = do_chunk_alloc(trans, root->fs_info->extent_root, | |
| 2047 | + 2 * 1024 * 1024, alloc_target, 0); | |
| 2048 | + btrfs_end_transaction(trans, root); | |
| 2049 | + goto again; | |
| 2050 | + } | |
| 2051 | + spin_unlock(&meta_sinfo->lock); | |
| 2052 | + | |
| 2053 | + if (!committed) { | |
| 2054 | + committed = 1; | |
| 2055 | + trans = btrfs_join_transaction(root, 1); | |
| 2056 | + if (!trans) | |
| 2057 | + return -ENOMEM; | |
| 2058 | + ret = btrfs_commit_transaction(trans, root); | |
| 2059 | + if (ret) | |
| 2060 | + return ret; | |
| 2061 | + goto again; | |
| 2062 | + } | |
| 2063 | + return -ENOSPC; | |
| 2064 | + } | |
| 2065 | + spin_unlock(&meta_sinfo->lock); | |
| 2066 | + | |
| 2067 | + return 0; | |
| 2068 | +} | |
| 2069 | + | |
| 2070 | +/* | |
| 2071 | + * This will check the space that the inode allocates from to make sure we have | |
| 2072 | + * enough space for bytes. | |
| 2073 | + */ | |
| 2074 | +int btrfs_check_data_free_space(struct btrfs_root *root, struct inode *inode, | |
| 2075 | + u64 bytes) | |
| 2076 | +{ | |
| 2077 | + struct btrfs_space_info *data_sinfo; | |
| 2078 | + int ret = 0, committed = 0; | |
| 2079 | + | |
| 2080 | + /* make sure bytes are sectorsize aligned */ | |
| 2081 | + bytes = (bytes + root->sectorsize - 1) & ~((u64)root->sectorsize - 1); | |
| 2082 | + | |
| 2083 | + data_sinfo = BTRFS_I(inode)->space_info; | |
| 2084 | +again: | |
| 2085 | + /* make sure we have enough space to handle the data first */ | |
| 2086 | + spin_lock(&data_sinfo->lock); | |
| 2087 | + if (data_sinfo->total_bytes - data_sinfo->bytes_used - | |
| 2088 | + data_sinfo->bytes_delalloc - data_sinfo->bytes_reserved - | |
| 2089 | + data_sinfo->bytes_pinned - data_sinfo->bytes_readonly - | |
| 2090 | + data_sinfo->bytes_may_use < bytes) { | |
| 2091 | + struct btrfs_trans_handle *trans; | |
| 2092 | + | |
| 2093 | + /* | |
| 2094 | + * if we don't have enough free bytes in this space then we need | |
| 2095 | + * to alloc a new chunk. | |
| 2096 | + */ | |
| 2097 | + if (!data_sinfo->full) { | |
| 2098 | + u64 alloc_target; | |
| 2099 | + | |
| 2100 | + data_sinfo->force_alloc = 1; | |
| 2101 | + spin_unlock(&data_sinfo->lock); | |
| 2102 | + | |
| 2103 | + alloc_target = btrfs_get_alloc_profile(root, 1); | |
| 2104 | + trans = btrfs_start_transaction(root, 1); | |
| 2105 | + if (!trans) | |
| 2106 | + return -ENOMEM; | |
| 2107 | + | |
| 2108 | + ret = do_chunk_alloc(trans, root->fs_info->extent_root, | |
| 2109 | + bytes + 2 * 1024 * 1024, | |
| 2110 | + alloc_target, 0); | |
| 2111 | + btrfs_end_transaction(trans, root); | |
| 2112 | + if (ret) | |
| 2113 | + return ret; | |
| 2114 | + goto again; | |
| 2115 | + } | |
| 2116 | + spin_unlock(&data_sinfo->lock); | |
| 2117 | + | |
| 2118 | + /* commit the current transaction and try again */ | |
| 2119 | + if (!committed) { | |
| 2120 | + committed = 1; | |
| 2121 | + trans = btrfs_join_transaction(root, 1); | |
| 2122 | + if (!trans) | |
| 2123 | + return -ENOMEM; | |
| 2124 | + ret = btrfs_commit_transaction(trans, root); | |
| 2125 | + if (ret) | |
| 2126 | + return ret; | |
| 2127 | + goto again; | |
| 2128 | + } | |
| 2129 | + | |
| 2130 | + printk(KERN_ERR "no space left, need %llu, %llu delalloc bytes" | |
| 2131 | + ", %llu bytes_used, %llu bytes_reserved, " | |
| 2132 | + "%llu bytes_pinned, %llu bytes_readonly, %llu may use" | |
| 2133 | + "%llu total\n", bytes, data_sinfo->bytes_delalloc, | |
| 2134 | + data_sinfo->bytes_used, data_sinfo->bytes_reserved, | |
| 2135 | + data_sinfo->bytes_pinned, data_sinfo->bytes_readonly, | |
| 2136 | + data_sinfo->bytes_may_use, data_sinfo->total_bytes); | |
| 2137 | + return -ENOSPC; | |
| 2138 | + } | |
| 2139 | + data_sinfo->bytes_may_use += bytes; | |
| 2140 | + BTRFS_I(inode)->reserved_bytes += bytes; | |
| 2141 | + spin_unlock(&data_sinfo->lock); | |
| 2142 | + | |
| 2143 | + return btrfs_check_metadata_free_space(root); | |
| 2144 | +} | |
| 2145 | + | |
| 2146 | +/* | |
| 2147 | + * if there was an error for whatever reason after calling | |
| 2148 | + * btrfs_check_data_free_space, call this so we can cleanup the counters. | |
| 2149 | + */ | |
| 2150 | +void btrfs_free_reserved_data_space(struct btrfs_root *root, | |
| 2151 | + struct inode *inode, u64 bytes) | |
| 2152 | +{ | |
| 2153 | + struct btrfs_space_info *data_sinfo; | |
| 2154 | + | |
| 2155 | + /* make sure bytes are sectorsize aligned */ | |
| 2156 | + bytes = (bytes + root->sectorsize - 1) & ~((u64)root->sectorsize - 1); | |
| 2157 | + | |
| 2158 | + data_sinfo = BTRFS_I(inode)->space_info; | |
| 2159 | + spin_lock(&data_sinfo->lock); | |
| 2160 | + data_sinfo->bytes_may_use -= bytes; | |
| 2161 | + BTRFS_I(inode)->reserved_bytes -= bytes; | |
| 2162 | + spin_unlock(&data_sinfo->lock); | |
| 2163 | +} | |
| 2164 | + | |
| 2165 | +/* called when we are adding a delalloc extent to the inode's io_tree */ | |
| 2166 | +void btrfs_delalloc_reserve_space(struct btrfs_root *root, struct inode *inode, | |
| 2167 | + u64 bytes) | |
| 2168 | +{ | |
| 2169 | + struct btrfs_space_info *data_sinfo; | |
| 2170 | + | |
| 2171 | + /* get the space info for where this inode will be storing its data */ | |
| 2172 | + data_sinfo = BTRFS_I(inode)->space_info; | |
| 2173 | + | |
| 2174 | + /* make sure we have enough space to handle the data first */ | |
| 2175 | + spin_lock(&data_sinfo->lock); | |
| 2176 | + data_sinfo->bytes_delalloc += bytes; | |
| 2177 | + | |
| 2178 | + /* | |
| 2179 | + * we are adding a delalloc extent without calling | |
| 2180 | + * btrfs_check_data_free_space first. This happens on a weird | |
| 2181 | + * writepage condition, but shouldn't hurt our accounting | |
| 2182 | + */ | |
| 2183 | + if (unlikely(bytes > BTRFS_I(inode)->reserved_bytes)) { | |
| 2184 | + data_sinfo->bytes_may_use -= BTRFS_I(inode)->reserved_bytes; | |
| 2185 | + BTRFS_I(inode)->reserved_bytes = 0; | |
| 2186 | + } else { | |
| 2187 | + data_sinfo->bytes_may_use -= bytes; | |
| 2188 | + BTRFS_I(inode)->reserved_bytes -= bytes; | |
| 2189 | + } | |
| 2190 | + | |
| 2191 | + spin_unlock(&data_sinfo->lock); | |
| 2192 | +} | |
| 2193 | + | |
| 2194 | +/* called when we are clearing an delalloc extent from the inode's io_tree */ | |
| 2195 | +void btrfs_delalloc_free_space(struct btrfs_root *root, struct inode *inode, | |
| 2196 | + u64 bytes) | |
| 2197 | +{ | |
| 2198 | + struct btrfs_space_info *info; | |
| 2199 | + | |
| 2200 | + info = BTRFS_I(inode)->space_info; | |
| 2201 | + | |
| 2202 | + spin_lock(&info->lock); | |
| 2203 | + info->bytes_delalloc -= bytes; | |
| 2204 | + spin_unlock(&info->lock); | |
| 2205 | +} | |
| 2206 | + | |
| 1975 | 2207 | static int do_chunk_alloc(struct btrfs_trans_handle *trans, |
| 1976 | 2208 | struct btrfs_root *extent_root, u64 alloc_bytes, |
| 1977 | 2209 | u64 flags, int force) |
| @@ -3105,6 +3337,10 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes) · 1127 unmodified lines | ||
| 3105 | 3337 | (unsigned long long)(info->total_bytes - info->bytes_used - |
| 3106 | 3338 | info->bytes_pinned - info->bytes_reserved), |
| 3107 | 3339 | (info->full) ? "" : "not "); |
| 3340 | + printk(KERN_INFO "space_info total=%llu, pinned=%llu, delalloc=%llu," | |
| 3341 | + " may_use=%llu, used=%llu\n", info->total_bytes, | |
| 3342 | + info->bytes_pinned, info->bytes_delalloc, info->bytes_may_use, | |
| 3343 | + info->bytes_used); | |
| 3108 | 3344 | |
| 3109 | 3345 | down_read(&info->groups_sem); |
| 3110 | 3346 | list_for_each_entry(cache, &info->block_groups, list) { |
| @@ -3131,24 +3367,10 @@ static int __btrfs_reserve_extent(struct btrfs_trans_handle *trans, · 20 unmodified lines | ||
| 3131 | 3367 | { |
| 3132 | 3368 | int ret; |
| 3133 | 3369 | u64 search_start = 0; |
| 3134 | − u64 alloc_profile; | |
| 3135 | 3370 | struct btrfs_fs_info *info = root->fs_info; |
| 3136 | 3371 | |
| 3137 | − if (data) { | |
| 3138 | − alloc_profile = info->avail_data_alloc_bits & | |
| 3139 | − info->data_alloc_profile; | |
| 3140 | − data = BTRFS_BLOCK_GROUP_DATA | alloc_profile; | |
| 3141 | − } else if (root == root->fs_info->chunk_root) { | |
| 3142 | − alloc_profile = info->avail_system_alloc_bits & | |
| 3143 | − info->system_alloc_profile; | |
| 3144 | − data = BTRFS_BLOCK_GROUP_SYSTEM | alloc_profile; | |
| 3145 | − } else { | |
| 3146 | − alloc_profile = info->avail_metadata_alloc_bits & | |
| 3147 | − info->metadata_alloc_profile; | |
| 3148 | − data = BTRFS_BLOCK_GROUP_METADATA | alloc_profile; | |
| 3149 | − } | |
| 3372 | + data = btrfs_get_alloc_profile(root, data); | |
| 3150 | 3373 | again: |
| 3151 | − data = btrfs_reduce_alloc_profile(root, data); | |
| 3152 | 3374 | /* |
| 3153 | 3375 | * the only place that sets empty_size is btrfs_realloc_node, which |
| 3154 | 3376 | * is not called recursively on allocations |
| @@ -1091,19 +1091,24 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf, · 1090 unmodified lines | ||
| 1091 | 1091 | WARN_ON(num_pages > nrptrs); |
| 1092 | 1092 | memset(pages, 0, sizeof(struct page *) * nrptrs); |
| 1093 | 1093 | |
| 1094 | − ret = btrfs_check_free_space(root, write_bytes, 0); | |
| 1094 | + ret = btrfs_check_data_free_space(root, inode, write_bytes); | |
| 1095 | 1095 | if (ret) |
| 1096 | 1096 | goto out; |
| 1097 | 1097 | |
| 1098 | 1098 | ret = prepare_pages(root, file, pages, num_pages, |
| 1099 | 1099 | pos, first_index, last_index, |
| 1100 | 1100 | write_bytes); |
| 1101 | − if (ret) | |
| 1101 | + if (ret) { | |
| 1102 | + btrfs_free_reserved_data_space(root, inode, | |
| 1103 | + write_bytes); | |
| 1102 | 1104 | goto out; |
| 1105 | + } | |
| 1103 | 1106 | |
| 1104 | 1107 | ret = btrfs_copy_from_user(pos, num_pages, |
| 1105 | 1108 | write_bytes, pages, buf); |
| 1106 | 1109 | if (ret) { |
| 1110 | + btrfs_free_reserved_data_space(root, inode, | |
| 1111 | + write_bytes); | |
| 1107 | 1112 | btrfs_drop_pages(pages, num_pages); |
| 1108 | 1113 | goto out; |
| 1109 | 1114 | } |
| @@ -1111,8 +1116,11 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf, · 1 unmodified line | ||
| 1111 | 1116 | ret = dirty_and_release_pages(NULL, root, file, pages, |
| 1112 | 1117 | num_pages, pos, write_bytes); |
| 1113 | 1118 | btrfs_drop_pages(pages, num_pages); |
| 1114 | − if (ret) | |
| 1119 | + if (ret) { | |
| 1120 | + btrfs_free_reserved_data_space(root, inode, | |
| 1121 | + write_bytes); | |
| 1115 | 1122 | goto out; |
| 1123 | + } | |
| 1116 | 1124 | |
| 1117 | 1125 | if (will_write) { |
| 1118 | 1126 | btrfs_fdatawrite_range(inode->i_mapping, pos, |
| @@ -1136,6 +1144,8 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf, · 17 unmodified lines | ||
| 1136 | 1144 | } |
| 1137 | 1145 | out: |
| 1138 | 1146 | mutex_unlock(&inode->i_mutex); |
| 1147 | + if (ret) | |
| 1148 | + err = ret; | |
| 1139 | 1149 | |
| 1140 | 1150 | out_nolock: |
| 1141 | 1151 | kfree(pages); |
| @@ -101,34 +101,6 @@ static int btrfs_init_inode_security(struct inode *inode, struct inode *dir) · 100 unmodified lines | ||
| 101 | 101 | return err; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | −/* | |
| 105 | − * a very lame attempt at stopping writes when the FS is 85% full. There | |
| 106 | − * are countless ways this is incorrect, but it is better than nothing. | |
| 107 | − */ | |
| 108 | −int btrfs_check_free_space(struct btrfs_root *root, u64 num_required, | |
| 109 | − int for_del) | |
| 110 | −{ | |
| 111 | − u64 total; | |
| 112 | − u64 used; | |
| 113 | − u64 thresh; | |
| 114 | − int ret = 0; | |
| 115 | − | |
| 116 | − spin_lock(&root->fs_info->delalloc_lock); | |
| 117 | − total = btrfs_super_total_bytes(&root->fs_info->super_copy); | |
| 118 | − used = btrfs_super_bytes_used(&root->fs_info->super_copy); | |
| 119 | − if (for_del) | |
| 120 | − thresh = total * 90; | |
| 121 | − else | |
| 122 | − thresh = total * 85; | |
| 123 | − | |
| 124 | − do_div(thresh, 100); | |
| 125 | − | |
| 126 | − if (used + root->fs_info->delalloc_bytes + num_required > thresh) | |
| 127 | − ret = -ENOSPC; | |
| 128 | − spin_unlock(&root->fs_info->delalloc_lock); | |
| 129 | − return ret; | |
| 130 | −} | |
| 131 | − | |
| 132 | 104 | /* |
| 133 | 105 | * this does all the hard work for inserting an inline extent into |
| 134 | 106 | * the btree. The caller should have done a btrfs_drop_extents so that |
| @@ -1190,6 +1162,7 @@ static int btrfs_set_bit_hook(struct inode *inode, u64 start, u64 end, · 1055 unmodified lines | ||
| 1190 | 1162 | */ |
| 1191 | 1163 | if (!(old & EXTENT_DELALLOC) && (bits & EXTENT_DELALLOC)) { |
| 1192 | 1164 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 1165 | + btrfs_delalloc_reserve_space(root, inode, end - start + 1); | |
| 1193 | 1166 | spin_lock(&root->fs_info->delalloc_lock); |
| 1194 | 1167 | BTRFS_I(inode)->delalloc_bytes += end - start + 1; |
| 1195 | 1168 | root->fs_info->delalloc_bytes += end - start + 1; |
| @@ -1223,9 +1196,12 @@ static int btrfs_clear_bit_hook(struct inode *inode, u64 start, u64 end, · 27 unmodified lines | ||
| 1223 | 1196 | (unsigned long long)end - start + 1, |
| 1224 | 1197 | (unsigned long long) |
| 1225 | 1198 | root->fs_info->delalloc_bytes); |
| 1199 | + btrfs_delalloc_free_space(root, inode, (u64)-1); | |
| 1226 | 1200 | root->fs_info->delalloc_bytes = 0; |
| 1227 | 1201 | BTRFS_I(inode)->delalloc_bytes = 0; |
| 1228 | 1202 | } else { |
| 1203 | + btrfs_delalloc_free_space(root, inode, | |
| 1204 | + end - start + 1); | |
| 1229 | 1205 | root->fs_info->delalloc_bytes -= end - start + 1; |
| 1230 | 1206 | BTRFS_I(inode)->delalloc_bytes -= end - start + 1; |
| 1231 | 1207 | } |
| @@ -2245,10 +2221,6 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry) · 1013 unmodified lines | ||
| 2245 | 2221 | |
| 2246 | 2222 | root = BTRFS_I(dir)->root; |
| 2247 | 2223 | |
| 2248 | − ret = btrfs_check_free_space(root, 1, 1); | |
| 2249 | − if (ret) | |
| 2250 | − goto fail; | |
| 2251 | − | |
| 2252 | 2224 | trans = btrfs_start_transaction(root, 1); |
| 2253 | 2225 | |
| 2254 | 2226 | btrfs_set_trans_block_group(trans, dir); |
| @@ -2261,7 +2233,6 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry) · 6 unmodified lines | ||
| 2261 | 2233 | nr = trans->blocks_used; |
| 2262 | 2234 | |
| 2263 | 2235 | btrfs_end_transaction_throttle(trans, root); |
| 2264 | −fail: | |
| 2265 | 2236 | btrfs_btree_balance_dirty(root, nr); |
| 2266 | 2237 | return ret; |
| 2267 | 2238 | } |
| @@ -2284,10 +2255,6 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) · 16 unmodified lines | ||
| 2284 | 2255 | return -ENOTEMPTY; |
| 2285 | 2256 | } |
| 2286 | 2257 | |
| 2287 | − ret = btrfs_check_free_space(root, 1, 1); | |
| 2288 | − if (ret) | |
| 2289 | − goto fail; | |
| 2290 | − | |
| 2291 | 2258 | trans = btrfs_start_transaction(root, 1); |
| 2292 | 2259 | btrfs_set_trans_block_group(trans, dir); |
| 2293 | 2260 | |
| @@ -2304,7 +2271,6 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) · 10 unmodified lines | ||
| 2304 | 2271 | fail_trans: |
| 2305 | 2272 | nr = trans->blocks_used; |
| 2306 | 2273 | ret = btrfs_end_transaction_throttle(trans, root); |
| 2307 | −fail: | |
| 2308 | 2274 | btrfs_btree_balance_dirty(root, nr); |
| 2309 | 2275 | |
| 2310 | 2276 | if (ret && !err) |
| @@ -2818,7 +2784,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t size) · 507 unmodified lines | ||
| 2818 | 2784 | if (size <= hole_start) |
| 2819 | 2785 | return 0; |
| 2820 | 2786 | |
| 2821 | − err = btrfs_check_free_space(root, 1, 0); | |
| 2787 | + err = btrfs_check_metadata_free_space(root); | |
| 2822 | 2788 | if (err) |
| 2823 | 2789 | return err; |
| 2824 | 2790 | |
| @@ -3014,6 +2980,7 @@ static noinline void init_btrfs_i(struct inode *inode) · 189 unmodified lines | ||
| 3014 | 2980 | bi->last_trans = 0; |
| 3015 | 2981 | bi->logged_trans = 0; |
| 3016 | 2982 | bi->delalloc_bytes = 0; |
| 2983 | + bi->reserved_bytes = 0; | |
| 3017 | 2984 | bi->disk_i_size = 0; |
| 3018 | 2985 | bi->flags = 0; |
| 3019 | 2986 | bi->index_cnt = (u64)-1; |
| @@ -3035,6 +3002,7 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p) · 15 unmodified lines | ||
| 3035 | 3002 | inode->i_ino = args->ino; |
| 3036 | 3003 | init_btrfs_i(inode); |
| 3037 | 3004 | BTRFS_I(inode)->root = args->root; |
| 3005 | + btrfs_set_inode_space_info(args->root, inode); | |
| 3038 | 3006 | return 0; |
| 3039 | 3007 | } |
| 3040 | 3008 | |
| @@ -3455,6 +3423,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, · 414 unmodified lines | ||
| 3455 | 3423 | BTRFS_I(inode)->index_cnt = 2; |
| 3456 | 3424 | BTRFS_I(inode)->root = root; |
| 3457 | 3425 | BTRFS_I(inode)->generation = trans->transid; |
| 3426 | + btrfs_set_inode_space_info(root, inode); | |
| 3458 | 3427 | |
| 3459 | 3428 | if (mode & S_IFDIR) |
| 3460 | 3429 | owner = 0; |
| @@ -3602,7 +3571,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, · 141 unmodified lines | ||
| 3602 | 3571 | if (!new_valid_dev(rdev)) |
| 3603 | 3572 | return -EINVAL; |
| 3604 | 3573 | |
| 3605 | − err = btrfs_check_free_space(root, 1, 0); | |
| 3574 | + err = btrfs_check_metadata_free_space(root); | |
| 3606 | 3575 | if (err) |
| 3607 | 3576 | goto fail; |
| 3608 | 3577 | |
| @@ -3665,7 +3634,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, · 56 unmodified lines | ||
| 3665 | 3634 | u64 objectid; |
| 3666 | 3635 | u64 index = 0; |
| 3667 | 3636 | |
| 3668 | − err = btrfs_check_free_space(root, 1, 0); | |
| 3637 | + err = btrfs_check_metadata_free_space(root); | |
| 3669 | 3638 | if (err) |
| 3670 | 3639 | goto fail; |
| 3671 | 3640 | trans = btrfs_start_transaction(root, 1); |
| @@ -3733,7 +3702,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, · 61 unmodified lines | ||
| 3733 | 3702 | return -ENOENT; |
| 3734 | 3703 | |
| 3735 | 3704 | btrfs_inc_nlink(inode); |
| 3736 | − err = btrfs_check_free_space(root, 1, 0); | |
| 3705 | + err = btrfs_check_metadata_free_space(root); | |
| 3737 | 3706 | if (err) |
| 3738 | 3707 | goto fail; |
| 3739 | 3708 | err = btrfs_set_inode_index(dir, &index); |
| @@ -3779,7 +3748,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) · 39 unmodified lines | ||
| 3779 | 3748 | u64 index = 0; |
| 3780 | 3749 | unsigned long nr = 1; |
| 3781 | 3750 | |
| 3782 | − err = btrfs_check_free_space(root, 1, 0); | |
| 3751 | + err = btrfs_check_metadata_free_space(root); | |
| 3783 | 3752 | if (err) |
| 3784 | 3753 | goto out_unlock; |
| 3785 | 3754 | |
| @@ -4336,7 +4305,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page) · 550 unmodified lines | ||
| 4336 | 4305 | u64 page_start; |
| 4337 | 4306 | u64 page_end; |
| 4338 | 4307 | |
| 4339 | − ret = btrfs_check_free_space(root, PAGE_CACHE_SIZE, 0); | |
| 4308 | + ret = btrfs_check_data_free_space(root, inode, PAGE_CACHE_SIZE); | |
| 4340 | 4309 | if (ret) |
| 4341 | 4310 | goto out; |
| 4342 | 4311 | |
| @@ -4349,6 +4318,7 @@ again: · 6 unmodified lines | ||
| 4349 | 4318 | |
| 4350 | 4319 | if ((page->mapping != inode->i_mapping) || |
| 4351 | 4320 | (page_start >= size)) { |
| 4321 | + btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE); | |
| 4352 | 4322 | /* page got truncated out from underneath us */ |
| 4353 | 4323 | goto out_unlock; |
| 4354 | 4324 | } |
| @@ -4631,7 +4601,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, · 276 unmodified lines | ||
| 4631 | 4601 | if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) |
| 4632 | 4602 | return -EXDEV; |
| 4633 | 4603 | |
| 4634 | − ret = btrfs_check_free_space(root, 1, 0); | |
| 4604 | + ret = btrfs_check_metadata_free_space(root); | |
| 4635 | 4605 | if (ret) |
| 4636 | 4606 | goto out_unlock; |
| 4637 | 4607 | |
| @@ -4749,7 +4719,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, · 111 unmodified lines | ||
| 4749 | 4719 | if (name_len > BTRFS_MAX_INLINE_DATA_SIZE(root)) |
| 4750 | 4720 | return -ENAMETOOLONG; |
| 4751 | 4721 | |
| 4752 | − err = btrfs_check_free_space(root, 1, 0); | |
| 4722 | + err = btrfs_check_metadata_free_space(root); | |
| 4753 | 4723 | if (err) |
| 4754 | 4724 | goto out_fail; |
| 4755 | 4725 | |
| @@ -70,7 +70,7 @@ static noinline int create_subvol(struct btrfs_root *root, · 69 unmodified lines | ||
| 70 | 70 | u64 index = 0; |
| 71 | 71 | unsigned long nr = 1; |
| 72 | 72 | |
| 73 | − ret = btrfs_check_free_space(root, 1, 0); | |
| 73 | + ret = btrfs_check_metadata_free_space(root); | |
| 74 | 74 | if (ret) |
| 75 | 75 | goto fail_commit; |
| 76 | 76 | |
| @@ -203,7 +203,7 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry, · 126 unmodified lines | ||
| 203 | 203 | if (!root->ref_cows) |
| 204 | 204 | return -EINVAL; |
| 205 | 205 | |
| 206 | − ret = btrfs_check_free_space(root, 1, 0); | |
| 206 | + ret = btrfs_check_metadata_free_space(root); | |
| 207 | 207 | if (ret) |
| 208 | 208 | goto fail_unlock; |
| 209 | 209 | |
| @@ -374,7 +374,7 @@ static int btrfs_defrag_file(struct file *file) · 164 unmodified lines | ||
| 374 | 374 | unsigned long i; |
| 375 | 375 | int ret; |
| 376 | 376 | |
| 377 | − ret = btrfs_check_free_space(root, inode->i_size, 0); | |
| 377 | + ret = btrfs_check_data_free_space(root, inode, inode->i_size); | |
| 378 | 378 | if (ret) |
| 379 | 379 | return -ENOSPC; |
| 380 | 380 | |
| @@ -1913,6 +1913,9 @@ COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */ · 1912 unmodified lines | ||
| 1913 | 1913 | /* 0x00 */ |
| 1914 | 1914 | COMPATIBLE_IOCTL(FIBMAP) |
| 1915 | 1915 | COMPATIBLE_IOCTL(FIGETBSZ) |
| 1916 | +/* 'X' - originally XFS but some now in the VFS */ | |
| 1917 | +COMPATIBLE_IOCTL(FIFREEZE) | |
| 1918 | +COMPATIBLE_IOCTL(FITHAW) | |
| 1916 | 1919 | /* RAID */ |
| 1917 | 1920 | COMPATIBLE_IOCTL(RAID_VERSION) |
| 1918 | 1921 | COMPATIBLE_IOCTL(GET_ARRAY_INFO) |
| @@ -1180,7 +1180,7 @@ struct dentry *d_obtain_alias(struct inode *inode) · 1179 unmodified lines | ||
| 1180 | 1180 | iput(inode); |
| 1181 | 1181 | return res; |
| 1182 | 1182 | } |
| 1183 | −EXPORT_SYMBOL_GPL(d_obtain_alias); | |
| 1183 | +EXPORT_SYMBOL(d_obtain_alias); | |
| 1184 | 1184 | |
| 1185 | 1185 | /** |
| 1186 | 1186 | * d_splice_alias - splice a disconnected dentry into the tree if one exists |
| @@ -95,13 +95,17 @@ static int jffs2_garbage_collect_thread(void *_c) · 94 unmodified lines | ||
| 95 | 95 | spin_unlock(&c->erase_completion_lock); |
| 96 | 96 | |
| 97 | 97 | |
| 98 | − /* This thread is purely an optimisation. But if it runs when | |
| 99 | − other things could be running, it actually makes things a | |
| 100 | − lot worse. Use yield() and put it at the back of the runqueue | |
| 101 | − every time. Especially during boot, pulling an inode in | |
| 102 | − with read_inode() is much preferable to having the GC thread | |
| 103 | − get there first. */ | |
| 104 | − yield(); | |
| 98 | + /* Problem - immediately after bootup, the GCD spends a lot | |
| 99 | + * of time in places like jffs2_kill_fragtree(); so much so | |
| 100 | + * that userspace processes (like gdm and X) are starved | |
| 101 | + * despite plenty of cond_resched()s and renicing. Yield() | |
| 102 | + * doesn't help, either (presumably because userspace and GCD | |
| 103 | + * are generally competing for a higher latency resource - | |
| 104 | + * disk). | |
| 105 | + * This forces the GCD to slow the hell down. Pulling an | |
| 106 | + * inode in with read_inode() is much preferable to having | |
| 107 | + * the GC thread get there first. */ | |
| 108 | + schedule_timeout_interruptible(msecs_to_jiffies(50)); | |
| 105 | 109 | |
| 106 | 110 | /* Put_super will send a SIGKILL and then wait on the sem. |
| 107 | 111 | */ |
| @@ -220,7 +220,7 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c, · 219 unmodified lines | ||
| 220 | 220 | struct jffs2_tmp_dnode_info *tn) |
| 221 | 221 | { |
| 222 | 222 | uint32_t fn_end = tn->fn->ofs + tn->fn->size; |
| 223 | − struct jffs2_tmp_dnode_info *this; | |
| 223 | + struct jffs2_tmp_dnode_info *this, *ptn; | |
| 224 | 224 | |
| 225 | 225 | dbg_readinode("insert fragment %#04x-%#04x, ver %u at %08x\n", tn->fn->ofs, fn_end, tn->version, ref_offset(tn->fn->raw)); |
| 226 | 226 | |
| @@ -251,11 +251,18 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c, · 24 unmodified lines | ||
| 251 | 251 | if (this) { |
| 252 | 252 | /* If the node is coincident with another at a lower address, |
| 253 | 253 | back up until the other node is found. It may be relevant */ |
| 254 | − while (this->overlapped) | |
| 255 | − this = tn_prev(this); | |
| 256 | − | |
| 257 | − /* First node should never be marked overlapped */ | |
| 258 | − BUG_ON(!this); | |
| 254 | + while (this->overlapped) { | |
| 255 | + ptn = tn_prev(this); | |
| 256 | + if (!ptn) { | |
| 257 | + /* | |
| 258 | + * We killed a node which set the overlapped | |
| 259 | + * flags during the scan. Fix it up. | |
| 260 | + */ | |
| 261 | + this->overlapped = 0; | |
| 262 | + break; | |
| 263 | + } | |
| 264 | + this = ptn; | |
| 265 | + } | |
| 259 | 266 | dbg_readinode("'this' found %#04x-%#04x (%s)\n", this->fn->ofs, this->fn->ofs + this->fn->size, this->fn ? "data" : "hole"); |
| 260 | 267 | } |
| 261 | 268 | |
| @@ -360,7 +367,17 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c, · 98 unmodified lines | ||
| 360 | 367 | } |
| 361 | 368 | if (!this->overlapped) |
| 362 | 369 | break; |
| 363 | − this = tn_prev(this); | |
| 370 | + | |
| 371 | + ptn = tn_prev(this); | |
| 372 | + if (!ptn) { | |
| 373 | + /* | |
| 374 | + * We killed a node which set the overlapped | |
| 375 | + * flags during the scan. Fix it up. | |
| 376 | + */ | |
| 377 | + this->overlapped = 0; | |
| 378 | + break; | |
| 379 | + } | |
| 380 | + this = ptn; | |
| 364 | 381 | } |
| 365 | 382 | } |
| 366 | 383 | |
| @@ -456,8 +473,15 @@ static int jffs2_build_inode_fragtree(struct jffs2_sb_info *c, · 89 unmodified lines | ||
| 456 | 473 | eat_last(&rii->tn_root, &last->rb); |
| 457 | 474 | ver_insert(&ver_root, last); |
| 458 | 475 | |
| 459 | − if (unlikely(last->overlapped)) | |
| 460 | − continue; | |
| 476 | + if (unlikely(last->overlapped)) { | |
| 477 | + if (pen) | |
| 478 | + continue; | |
| 479 | + /* | |
| 480 | + * We killed a node which set the overlapped | |
| 481 | + * flags during the scan. Fix it up. | |
| 482 | + */ | |
| 483 | + last->overlapped = 0; | |
| 484 | + } | |
| 461 | 485 | |
| 462 | 486 | /* Now we have a bunch of nodes in reverse version |
| 463 | 487 | order, in the tree at ver_root. Most of the time, |
| @@ -4796,6 +4796,29 @@ out: · 4795 unmodified lines | ||
| 4796 | 4796 | return ret; |
| 4797 | 4797 | } |
| 4798 | 4798 | |
| 4799 | +static int ocfs2_replace_extent_rec(struct inode *inode, | |
| 4800 | + handle_t *handle, | |
| 4801 | + struct ocfs2_path *path, | |
| 4802 | + struct ocfs2_extent_list *el, | |
| 4803 | + int split_index, | |
| 4804 | + struct ocfs2_extent_rec *split_rec) | |
| 4805 | +{ | |
| 4806 | + int ret; | |
| 4807 | + | |
| 4808 | + ret = ocfs2_path_bh_journal_access(handle, inode, path, | |
| 4809 | + path_num_items(path) - 1); | |
| 4810 | + if (ret) { | |
| 4811 | + mlog_errno(ret); | |
| 4812 | + goto out; | |
| 4813 | + } | |
| 4814 | + | |
| 4815 | + el->l_recs[split_index] = *split_rec; | |
| 4816 | + | |
| 4817 | + ocfs2_journal_dirty(handle, path_leaf_bh(path)); | |
| 4818 | +out: | |
| 4819 | + return ret; | |
| 4820 | +} | |
| 4821 | + | |
| 4799 | 4822 | /* |
| 4800 | 4823 | * Mark part or all of the extent record at split_index in the leaf |
| 4801 | 4824 | * pointed to by path as written. This removes the unwritten |
| @@ -4885,7 +4908,9 @@ static int __ocfs2_mark_extent_written(struct inode *inode, · 83 unmodified lines | ||
| 4885 | 4908 | |
| 4886 | 4909 | if (ctxt.c_contig_type == CONTIG_NONE) { |
| 4887 | 4910 | if (ctxt.c_split_covers_rec) |
| 4888 | − el->l_recs[split_index] = *split_rec; | |
| 4911 | + ret = ocfs2_replace_extent_rec(inode, handle, | |
| 4912 | + path, el, | |
| 4913 | + split_index, split_rec); | |
| 4889 | 4914 | else |
| 4890 | 4915 | ret = ocfs2_split_and_insert(inode, handle, path, et, |
| 4891 | 4916 | &last_eb_bh, split_index, |
| @@ -1849,12 +1849,12 @@ int dlm_assert_master_handler(struct o2net_msg *msg, u32 len, void *data, · 1848 unmodified lines | ||
| 1849 | 1849 | if (!mle) { |
| 1850 | 1850 | if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN && |
| 1851 | 1851 | res->owner != assert->node_idx) { |
| 1852 | − mlog(ML_ERROR, "assert_master from " | |
| 1853 | − "%u, but current owner is " | |
| 1854 | − "%u! (%.*s)\n", | |
| 1855 | − assert->node_idx, res->owner, | |
| 1856 | − namelen, name); | |
| 1857 | − goto kill; | |
| 1852 | + mlog(ML_ERROR, "DIE! Mastery assert from %u, " | |
| 1853 | + "but current owner is %u! (%.*s)\n", | |
| 1854 | + assert->node_idx, res->owner, namelen, | |
| 1855 | + name); | |
| 1856 | + __dlm_print_one_lock_resource(res); | |
| 1857 | + BUG(); | |
| 1858 | 1858 | } |
| 1859 | 1859 | } else if (mle->type != DLM_MLE_MIGRATION) { |
| 1860 | 1860 | if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN) { |
| @@ -181,8 +181,7 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm, · 180 unmodified lines | ||
| 181 | 181 | |
| 182 | 182 | spin_lock(&res->spinlock); |
| 183 | 183 | /* This ensures that clear refmap is sent after the set */ |
| 184 | − __dlm_wait_on_lockres_flags(res, (DLM_LOCK_RES_SETREF_INPROG | | |
| 185 | − DLM_LOCK_RES_MIGRATING)); | |
| 184 | + __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_SETREF_INPROG); | |
| 186 | 185 | spin_unlock(&res->spinlock); |
| 187 | 186 | |
| 188 | 187 | /* clear our bit from the master's refmap, ignore errors */ |
| @@ -117,11 +117,11 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, · 116 unmodified lines | ||
| 117 | 117 | else |
| 118 | 118 | BUG_ON(res->owner == dlm->node_num); |
| 119 | 119 | |
| 120 | − spin_lock(&dlm->spinlock); | |
| 120 | + spin_lock(&dlm->ast_lock); | |
| 121 | 121 | /* We want to be sure that we're not freeing a lock |
| 122 | 122 | * that still has AST's pending... */ |
| 123 | 123 | in_use = !list_empty(&lock->ast_list); |
| 124 | − spin_unlock(&dlm->spinlock); | |
| 124 | + spin_unlock(&dlm->ast_lock); | |
| 125 | 125 | if (in_use) { |
| 126 | 126 | mlog(ML_ERROR, "lockres %.*s: Someone is calling dlmunlock " |
| 127 | 127 | "while waiting for an ast!", res->lockname.len, |
| @@ -320,9 +320,14 @@ static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb, · 319 unmodified lines | ||
| 320 | 320 | struct ocfs2_lock_res *lockres); |
| 321 | 321 | static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, |
| 322 | 322 | int convert); |
| 323 | −#define ocfs2_log_dlm_error(_func, _err, _lockres) do { \ | |
| 324 | − mlog(ML_ERROR, "DLM error %d while calling %s on resource %s\n", \ | |
| 325 | − _err, _func, _lockres->l_name); \ | |
| 323 | +#define ocfs2_log_dlm_error(_func, _err, _lockres) do { \ | |
| 324 | + if ((_lockres)->l_type != OCFS2_LOCK_TYPE_DENTRY) \ | |
| 325 | + mlog(ML_ERROR, "DLM error %d while calling %s on resource %s\n", \ | |
| 326 | + _err, _func, _lockres->l_name); \ | |
| 327 | + else \ | |
| 328 | + mlog(ML_ERROR, "DLM error %d while calling %s on resource %.*s%08x\n", \ | |
| 329 | + _err, _func, OCFS2_DENTRY_LOCK_INO_START - 1, (_lockres)->l_name, \ | |
| 330 | + (unsigned int)ocfs2_get_dentry_lock_ino(_lockres)); \ | |
| 326 | 331 | } while (0) |
| 327 | 332 | static int ocfs2_downconvert_thread(void *arg); |
| 328 | 333 | static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, |
| @@ -341,6 +341,9 @@ struct ocfs2_super · 340 unmodified lines | ||
| 341 | 341 | struct ocfs2_node_map osb_recovering_orphan_dirs; |
| 342 | 342 | unsigned int *osb_orphan_wipes; |
| 343 | 343 | wait_queue_head_t osb_wipe_event; |
| 344 | + | |
| 345 | + /* used to protect metaecc calculation check of xattr. */ | |
| 346 | + spinlock_t osb_xattr_lock; | |
| 344 | 347 | }; |
| 345 | 348 | |
| 346 | 349 | #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) |
| @@ -1537,6 +1537,13 @@ static int ocfs2_get_sector(struct super_block *sb, · 1536 unmodified lines | ||
| 1537 | 1537 | unlock_buffer(*bh); |
| 1538 | 1538 | ll_rw_block(READ, 1, bh); |
| 1539 | 1539 | wait_on_buffer(*bh); |
| 1540 | + if (!buffer_uptodate(*bh)) { | |
| 1541 | + mlog_errno(-EIO); | |
| 1542 | + brelse(*bh); | |
| 1543 | + *bh = NULL; | |
| 1544 | + return -EIO; | |
| 1545 | + } | |
| 1546 | + | |
| 1540 | 1547 | return 0; |
| 1541 | 1548 | } |
| 1542 | 1549 | |
| @@ -1747,6 +1754,7 @@ static int ocfs2_initialize_super(struct super_block *sb, · 204 unmodified lines | ||
| 1747 | 1754 | INIT_LIST_HEAD(&osb->blocked_lock_list); |
| 1748 | 1755 | osb->blocked_lock_count = 0; |
| 1749 | 1756 | spin_lock_init(&osb->osb_lock); |
| 1757 | + spin_lock_init(&osb->osb_xattr_lock); | |
| 1750 | 1758 | ocfs2_init_inode_steal_slot(osb); |
| 1751 | 1759 | |
| 1752 | 1760 | atomic_set(&osb->alloc_stats.moves, 0); |
| @@ -82,13 +82,14 @@ struct ocfs2_xattr_set_ctxt { · 81 unmodified lines | ||
| 82 | 82 | |
| 83 | 83 | #define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root)) |
| 84 | 84 | #define OCFS2_XATTR_INLINE_SIZE 80 |
| 85 | +#define OCFS2_XATTR_HEADER_GAP 4 | |
| 85 | 86 | #define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \ |
| 86 | 87 | - sizeof(struct ocfs2_xattr_header) \ |
| 87 | − - sizeof(__u32)) | |
| 88 | + - OCFS2_XATTR_HEADER_GAP) | |
| 88 | 89 | #define OCFS2_XATTR_FREE_IN_BLOCK(ptr) ((ptr)->i_sb->s_blocksize \ |
| 89 | 90 | - sizeof(struct ocfs2_xattr_block) \ |
| 90 | 91 | - sizeof(struct ocfs2_xattr_header) \ |
| 91 | − - sizeof(__u32)) | |
| 92 | + - OCFS2_XATTR_HEADER_GAP) | |
| 92 | 93 | |
| 93 | 94 | static struct ocfs2_xattr_def_value_root def_xv = { |
| 94 | 95 | .xv.xr_list.l_count = cpu_to_le16(1), |
| @@ -274,10 +275,12 @@ static int ocfs2_read_xattr_bucket(struct ocfs2_xattr_bucket *bucket, · 179 unmodified lines | ||
| 274 | 275 | bucket->bu_blocks, bucket->bu_bhs, 0, |
| 275 | 276 | NULL); |
| 276 | 277 | if (!rc) { |
| 278 | + spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock); | |
| 277 | 279 | rc = ocfs2_validate_meta_ecc_bhs(bucket->bu_inode->i_sb, |
| 278 | 280 | bucket->bu_bhs, |
| 279 | 281 | bucket->bu_blocks, |
| 280 | 282 | &bucket_xh(bucket)->xh_check); |
| 283 | + spin_unlock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock); | |
| 281 | 284 | if (rc) |
| 282 | 285 | mlog_errno(rc); |
| 283 | 286 | } |
| @@ -310,9 +313,11 @@ static void ocfs2_xattr_bucket_journal_dirty(handle_t *handle, · 26 unmodified lines | ||
| 310 | 313 | { |
| 311 | 314 | int i; |
| 312 | 315 | |
| 316 | + spin_lock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock); | |
| 313 | 317 | ocfs2_compute_meta_ecc_bhs(bucket->bu_inode->i_sb, |
| 314 | 318 | bucket->bu_bhs, bucket->bu_blocks, |
| 315 | 319 | &bucket_xh(bucket)->xh_check); |
| 320 | + spin_unlock(&OCFS2_SB(bucket->bu_inode->i_sb)->osb_xattr_lock); | |
| 316 | 321 | |
| 317 | 322 | for (i = 0; i < bucket->bu_blocks; i++) |
| 318 | 323 | ocfs2_journal_dirty(handle, bucket->bu_bhs[i]); |
| @@ -1507,7 +1512,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode, · 1188 unmodified lines | ||
| 1507 | 1512 | last += 1; |
| 1508 | 1513 | } |
| 1509 | 1514 | |
| 1510 | − free = min_offs - ((void *)last - xs->base) - sizeof(__u32); | |
| 1515 | + free = min_offs - ((void *)last - xs->base) - OCFS2_XATTR_HEADER_GAP; | |
| 1511 | 1516 | if (free < 0) |
| 1512 | 1517 | return -EIO; |
| 1513 | 1518 | |
| @@ -2190,7 +2195,7 @@ static int ocfs2_xattr_can_be_in_inode(struct inode *inode, · 676 unmodified lines | ||
| 2190 | 2195 | last += 1; |
| 2191 | 2196 | } |
| 2192 | 2197 | |
| 2193 | − free = min_offs - ((void *)last - xs->base) - sizeof(__u32); | |
| 2198 | + free = min_offs - ((void *)last - xs->base) - OCFS2_XATTR_HEADER_GAP; | |
| 2194 | 2199 | if (free < 0) |
| 2195 | 2200 | return 0; |
| 2196 | 2201 | |
| @@ -2592,8 +2597,9 @@ static int __ocfs2_xattr_set_handle(struct inode *inode, · 395 unmodified lines | ||
| 2592 | 2597 | |
| 2593 | 2598 | if (!ret) { |
| 2594 | 2599 | /* Update inode ctime. */ |
| 2595 | − ret = ocfs2_journal_access(ctxt->handle, inode, xis->inode_bh, | |
| 2596 | − OCFS2_JOURNAL_ACCESS_WRITE); | |
| 2600 | + ret = ocfs2_journal_access_di(ctxt->handle, inode, | |
| 2601 | + xis->inode_bh, | |
| 2602 | + OCFS2_JOURNAL_ACCESS_WRITE); | |
| 2597 | 2603 | if (ret) { |
| 2598 | 2604 | mlog_errno(ret); |
| 2599 | 2605 | goto out; |
| @@ -5060,8 +5066,8 @@ try_again: · 2460 unmodified lines | ||
| 5060 | 5066 | xh_free_start = le16_to_cpu(xh->xh_free_start); |
| 5061 | 5067 | header_size = sizeof(struct ocfs2_xattr_header) + |
| 5062 | 5068 | count * sizeof(struct ocfs2_xattr_entry); |
| 5063 | − max_free = OCFS2_XATTR_BUCKET_SIZE - | |
| 5064 | − le16_to_cpu(xh->xh_name_value_len) - header_size; | |
| 5069 | + max_free = OCFS2_XATTR_BUCKET_SIZE - header_size - | |
| 5070 | + le16_to_cpu(xh->xh_name_value_len) - OCFS2_XATTR_HEADER_GAP; | |
| 5065 | 5071 | |
| 5066 | 5072 | mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " |
| 5067 | 5073 | "of %u which exceed block size\n", |
| @@ -5094,7 +5100,7 @@ try_again: · 26 unmodified lines | ||
| 5094 | 5100 | need = 0; |
| 5095 | 5101 | } |
| 5096 | 5102 | |
| 5097 | − free = xh_free_start - header_size; | |
| 5103 | + free = xh_free_start - header_size - OCFS2_XATTR_HEADER_GAP; | |
| 5098 | 5104 | /* |
| 5099 | 5105 | * We need to make sure the new name/value pair |
| 5100 | 5106 | * can exist in the same block. |
| @@ -5127,7 +5133,8 @@ try_again: · 26 unmodified lines | ||
| 5127 | 5133 | } |
| 5128 | 5134 | |
| 5129 | 5135 | xh_free_start = le16_to_cpu(xh->xh_free_start); |
| 5130 | − free = xh_free_start - header_size; | |
| 5136 | + free = xh_free_start - header_size | |
| 5137 | + - OCFS2_XATTR_HEADER_GAP; | |
| 5131 | 5138 | if (xh_free_start % blocksize < need) |
| 5132 | 5139 | free -= xh_free_start % blocksize; |
| 5133 | 5140 | |
| @@ -76,6 +76,7 @@ struct drm_encoder_helper_funcs { · 75 unmodified lines | ||
| 76 | 76 | void (*mode_set)(struct drm_encoder *encoder, |
| 77 | 77 | struct drm_display_mode *mode, |
| 78 | 78 | struct drm_display_mode *adjusted_mode); |
| 79 | + struct drm_crtc *(*get_crtc)(struct drm_encoder *encoder); | |
| 79 | 80 | /* detect for DAC style encoders */ |
| 80 | 81 | enum drm_connector_status (*detect)(struct drm_encoder *encoder, |
| 81 | 82 | struct drm_connector *connector); |
| @@ -58,10 +58,10 @@ struct detailed_pixel_timing { · 57 unmodified lines | ||
| 58 | 58 | u8 hsync_pulse_width_lo; |
| 59 | 59 | u8 vsync_pulse_width_lo:4; |
| 60 | 60 | u8 vsync_offset_lo:4; |
| 61 | − u8 hsync_pulse_width_hi:2; | |
| 62 | − u8 hsync_offset_hi:2; | |
| 63 | 61 | u8 vsync_pulse_width_hi:2; |
| 64 | 62 | u8 vsync_offset_hi:2; |
| 63 | + u8 hsync_pulse_width_hi:2; | |
| 64 | + u8 hsync_offset_hi:2; | |
| 65 | 65 | u8 width_mm_lo; |
| 66 | 66 | u8 height_mm_lo; |
| 67 | 67 | u8 height_mm_hi:4; |
| @@ -708,6 +708,8 @@ struct req_iterator { · 707 unmodified lines | ||
| 708 | 708 | }; |
| 709 | 709 | |
| 710 | 710 | /* This should not be used directly - use rq_for_each_segment */ |
| 711 | +#define for_each_bio(_bio) \ | |
| 712 | + for (; _bio; _bio = _bio->bi_next) | |
| 711 | 713 | #define __rq_for_each_bio(_bio, rq) \ |
| 712 | 714 | if ((rq->bio)) \ |
| 713 | 715 | for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) |
| @@ -663,7 +663,7 @@ typedef struct ide_drive_s ide_drive_t; · 662 unmodified lines | ||
| 663 | 663 | #define to_ide_device(dev) container_of(dev, ide_drive_t, gendev) |
| 664 | 664 | |
| 665 | 665 | #define to_ide_drv(obj, cont_type) \ |
| 666 | − container_of(obj, struct cont_type, kref) | |
| 666 | + container_of(obj, struct cont_type, dev) | |
| 667 | 667 | |
| 668 | 668 | #define ide_drv_g(disk, cont_type) \ |
| 669 | 669 | container_of((disk)->private_data, struct cont_type, driver) |
| @@ -194,6 +194,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) · 193 unmodified lines | ||
| 194 | 194 | /* FSTS_REG */ |
| 195 | 195 | #define DMA_FSTS_PPF ((u32)2) |
| 196 | 196 | #define DMA_FSTS_PFO ((u32)1) |
| 197 | +#define DMA_FSTS_IQE (1 << 4) | |
| 197 | 198 | #define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff) |
| 198 | 199 | |
| 199 | 200 | /* FRCD_REG, 32 bits access */ |
| @@ -328,7 +329,7 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, · 128 unmodified lines | ||
| 328 | 329 | unsigned int size_order, u64 type, |
| 329 | 330 | int non_present_entry_flush); |
| 330 | 331 | |
| 331 | −extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); | |
| 332 | +extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); | |
| 332 | 333 | |
| 333 | 334 | extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t); |
| 334 | 335 | extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t); |
| @@ -13,6 +13,7 @@ struct user_namespace { · 12 unmodified lines | ||
| 13 | 13 | struct kref kref; |
| 14 | 14 | struct hlist_head uidhash_table[UIDHASH_SZ]; |
| 15 | 15 | struct user_struct *creator; |
| 16 | + struct work_struct destroyer; | |
| 16 | 17 | }; |
| 17 | 18 | |
| 18 | 19 | extern struct user_namespace init_user_ns; |
| @@ -60,12 +60,25 @@ int create_user_ns(struct cred *new) · 59 unmodified lines | ||
| 60 | 60 | return 0; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | −void free_user_ns(struct kref *kref) | |
| 63 | +/* | |
| 64 | + * Deferred destructor for a user namespace. This is required because | |
| 65 | + * free_user_ns() may be called with uidhash_lock held, but we need to call | |
| 66 | + * back to free_uid() which will want to take the lock again. | |
| 67 | + */ | |
| 68 | +static void free_user_ns_work(struct work_struct *work) | |
| 64 | 69 | { |
| 65 | − struct user_namespace *ns; | |
| 66 | − | |
| 67 | − ns = container_of(kref, struct user_namespace, kref); | |
| 70 | + struct user_namespace *ns = | |
| 71 | + container_of(work, struct user_namespace, destroyer); | |
| 68 | 72 | free_uid(ns->creator); |
| 69 | 73 | kfree(ns); |
| 70 | 74 | } |
| 75 | + | |
| 76 | +void free_user_ns(struct kref *kref) | |
| 77 | +{ | |
| 78 | + struct user_namespace *ns = | |
| 79 | + container_of(kref, struct user_namespace, kref); | |
| 80 | + | |
| 81 | + INIT_WORK(&ns->destroyer, free_user_ns_work); | |
| 82 | + schedule_work(&ns->destroyer); | |
| 83 | +} | |
| 71 | 84 | EXPORT_SYMBOL(free_user_ns); |
| @@ -169,13 +169,13 @@ static inline struct shmem_sb_info *SHMEM_SB(struct super_block *sb) · 168 unmodified lines | ||
| 169 | 169 | */ |
| 170 | 170 | static inline int shmem_acct_size(unsigned long flags, loff_t size) |
| 171 | 171 | { |
| 172 | − return (flags & VM_ACCOUNT) ? | |
| 173 | − security_vm_enough_memory_kern(VM_ACCT(size)) : 0; | |
| 172 | + return (flags & VM_NORESERVE) ? | |
| 173 | + 0 : security_vm_enough_memory_kern(VM_ACCT(size)); | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | static inline void shmem_unacct_size(unsigned long flags, loff_t size) |
| 177 | 177 | { |
| 178 | − if (flags & VM_ACCOUNT) | |
| 178 | + if (!(flags & VM_NORESERVE)) | |
| 179 | 179 | vm_unacct_memory(VM_ACCT(size)); |
| 180 | 180 | } |
| 181 | 181 | |
| @@ -187,13 +187,13 @@ static inline void shmem_unacct_size(unsigned long flags, loff_t size) · 5 unmodified lines | ||
| 187 | 187 | */ |
| 188 | 188 | static inline int shmem_acct_block(unsigned long flags) |
| 189 | 189 | { |
| 190 | − return (flags & VM_ACCOUNT) ? | |
| 191 | − 0 : security_vm_enough_memory_kern(VM_ACCT(PAGE_CACHE_SIZE)); | |
| 190 | + return (flags & VM_NORESERVE) ? | |
| 191 | + security_vm_enough_memory_kern(VM_ACCT(PAGE_CACHE_SIZE)) : 0; | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | static inline void shmem_unacct_blocks(unsigned long flags, long pages) |
| 195 | 195 | { |
| 196 | − if (!(flags & VM_ACCOUNT)) | |
| 196 | + if (flags & VM_NORESERVE) | |
| 197 | 197 | vm_unacct_memory(pages * VM_ACCT(PAGE_CACHE_SIZE)); |
| 198 | 198 | } |
| 199 | 199 | |
| @@ -1515,8 +1515,8 @@ static int shmem_mmap(struct file *file, struct vm_area_struct *vma) · 1315 unmodified lines | ||
| 1515 | 1515 | return 0; |
| 1516 | 1516 | } |
| 1517 | 1517 | |
| 1518 | −static struct inode * | |
| 1519 | −shmem_get_inode(struct super_block *sb, int mode, dev_t dev) | |
| 1518 | +static struct inode *shmem_get_inode(struct super_block *sb, int mode, | |
| 1519 | + dev_t dev, unsigned long flags) | |
| 1520 | 1520 | { |
| 1521 | 1521 | struct inode *inode; |
| 1522 | 1522 | struct shmem_inode_info *info; |
| @@ -1537,6 +1537,7 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev) · 14 unmodified lines | ||
| 1537 | 1537 | info = SHMEM_I(inode); |
| 1538 | 1538 | memset(info, 0, (char *)inode - (char *)info); |
| 1539 | 1539 | spin_lock_init(&info->lock); |
| 1540 | + info->flags = flags & VM_NORESERVE; | |
| 1540 | 1541 | INIT_LIST_HEAD(&info->swaplist); |
| 1541 | 1542 | |
| 1542 | 1543 | switch (mode & S_IFMT) { |
| @@ -1779,9 +1780,10 @@ static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf) · 236 unmodified lines | ||
| 1779 | 1780 | static int |
| 1780 | 1781 | shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) |
| 1781 | 1782 | { |
| 1782 | − struct inode *inode = shmem_get_inode(dir->i_sb, mode, dev); | |
| 1783 | + struct inode *inode; | |
| 1783 | 1784 | int error = -ENOSPC; |
| 1784 | 1785 | |
| 1786 | + inode = shmem_get_inode(dir->i_sb, mode, dev, VM_NORESERVE); | |
| 1785 | 1787 | if (inode) { |
| 1786 | 1788 | error = security_inode_init_security(inode, dir, NULL, NULL, |
| 1787 | 1789 | NULL); |
| @@ -1920,7 +1922,7 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s · 132 unmodified lines | ||
| 1920 | 1922 | if (len > PAGE_CACHE_SIZE) |
| 1921 | 1923 | return -ENAMETOOLONG; |
| 1922 | 1924 | |
| 1923 | − inode = shmem_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0); | |
| 1925 | + inode = shmem_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0, VM_NORESERVE); | |
| 1924 | 1926 | if (!inode) |
| 1925 | 1927 | return -ENOSPC; |
| 1926 | 1928 | |
| @@ -2332,7 +2334,7 @@ static int shmem_fill_super(struct super_block *sb, · 405 unmodified lines | ||
| 2332 | 2334 | sb->s_flags |= MS_POSIXACL; |
| 2333 | 2335 | #endif |
| 2334 | 2336 | |
| 2335 | − inode = shmem_get_inode(sb, S_IFDIR | sbinfo->mode, 0); | |
| 2337 | + inode = shmem_get_inode(sb, S_IFDIR | sbinfo->mode, 0, VM_NORESERVE); | |
| 2336 | 2338 | if (!inode) |
| 2337 | 2339 | goto failed; |
| 2338 | 2340 | inode->i_uid = sbinfo->uid; |
| @@ -2574,12 +2576,12 @@ int shmem_unuse(swp_entry_t entry, struct page *page) · 235 unmodified lines | ||
| 2574 | 2576 | return 0; |
| 2575 | 2577 | } |
| 2576 | 2578 | |
| 2577 | −#define shmem_file_operations ramfs_file_operations | |
| 2578 | −#define shmem_vm_ops generic_file_vm_ops | |
| 2579 | −#define shmem_get_inode ramfs_get_inode | |
| 2580 | −#define shmem_acct_size(a, b) 0 | |
| 2581 | −#define shmem_unacct_size(a, b) do {} while (0) | |
| 2582 | −#define SHMEM_MAX_BYTES LLONG_MAX | |
| 2579 | +#define shmem_vm_ops generic_file_vm_ops | |
| 2580 | +#define shmem_file_operations ramfs_file_operations | |
| 2581 | +#define shmem_get_inode(sb, mode, dev, flags) ramfs_get_inode(sb, mode, dev) | |
| 2582 | +#define shmem_acct_size(flags, size) 0 | |
| 2583 | +#define shmem_unacct_size(flags, size) do {} while (0) | |
| 2584 | +#define SHMEM_MAX_BYTES LLONG_MAX | |
| 2583 | 2585 | |
| 2584 | 2586 | #endif /* CONFIG_SHMEM */ |
| 2585 | 2587 | |
| @@ -2589,7 +2591,7 @@ int shmem_unuse(swp_entry_t entry, struct page *page) · 3 unmodified lines | ||
| 2589 | 2591 | * shmem_file_setup - get an unlinked file living in tmpfs |
| 2590 | 2592 | * @name: name for dentry (to be seen in /proc/<pid>/maps |
| 2591 | 2593 | * @size: size to be set for the file |
| 2592 | − * @flags: vm_flags | |
| 2594 | + * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size | |
| 2593 | 2595 | */ |
| 2594 | 2596 | struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags) |
| 2595 | 2597 | { |
| @@ -2623,13 +2625,10 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags) · 27 unmodified lines | ||
| 2623 | 2625 | goto put_dentry; |
| 2624 | 2626 | |
| 2625 | 2627 | error = -ENOSPC; |
| 2626 | − inode = shmem_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); | |
| 2628 | + inode = shmem_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0, flags); | |
| 2627 | 2629 | if (!inode) |
| 2628 | 2630 | goto close_file; |
| 2629 | 2631 | |
| 2630 | −#ifdef CONFIG_SHMEM | |
| 2631 | − SHMEM_I(inode)->flags = (flags & VM_NORESERVE) ? 0 : VM_ACCOUNT; | |
| 2632 | −#endif | |
| 2633 | 2632 | d_instantiate(dentry, inode); |
| 2634 | 2633 | inode->i_size = size; |
| 2635 | 2634 | inode->i_nlink = 0; /* It is unlinked */ |
| @@ -323,6 +323,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, · 322 unmodified lines | ||
| 323 | 323 | unsigned long addr; |
| 324 | 324 | int purged = 0; |
| 325 | 325 | |
| 326 | + BUG_ON(!size); | |
| 326 | 327 | BUG_ON(size & ~PAGE_MASK); |
| 327 | 328 | |
| 328 | 329 | va = kmalloc_node(sizeof(struct vmap_area), |
| @@ -334,6 +335,9 @@ retry: · 5 unmodified lines | ||
| 334 | 335 | addr = ALIGN(vstart, align); |
| 335 | 336 | |
| 336 | 337 | spin_lock(&vmap_area_lock); |
| 338 | + if (addr + size - 1 < addr) | |
| 339 | + goto overflow; | |
| 340 | + | |
| 337 | 341 | /* XXX: could have a last_hole cache */ |
| 338 | 342 | n = vmap_area_root.rb_node; |
| 339 | 343 | if (n) { |
| @@ -365,6 +369,8 @@ retry: · 25 unmodified lines | ||
| 365 | 369 | |
| 366 | 370 | while (addr + size > first->va_start && addr + size <= vend) { |
| 367 | 371 | addr = ALIGN(first->va_end + PAGE_SIZE, align); |
| 372 | + if (addr + size - 1 < addr) | |
| 373 | + goto overflow; | |
| 368 | 374 | |
| 369 | 375 | n = rb_next(&first->rb_node); |
| 370 | 376 | if (n) |
| @@ -375,6 +381,7 @@ retry: · 4 unmodified lines | ||
| 375 | 381 | } |
| 376 | 382 | found: |
| 377 | 383 | if (addr + size > vend) { |
| 384 | +overflow: | |
| 378 | 385 | spin_unlock(&vmap_area_lock); |
| 379 | 386 | if (!purged) { |
| 380 | 387 | purge_vmap_area_lazy(); |
| @@ -498,6 +505,7 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end, · 117 unmodified lines | ||
| 498 | 505 | static DEFINE_SPINLOCK(purge_lock); |
| 499 | 506 | LIST_HEAD(valist); |
| 500 | 507 | struct vmap_area *va; |
| 508 | + struct vmap_area *n_va; | |
| 501 | 509 | int nr = 0; |
| 502 | 510 | |
| 503 | 511 | /* |
| @@ -537,7 +545,7 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end, · 33 unmodified lines | ||
| 537 | 545 | |
| 538 | 546 | if (nr) { |
| 539 | 547 | spin_lock(&vmap_area_lock); |
| 540 | − list_for_each_entry(va, &valist, purge_list) | |
| 548 | + list_for_each_entry_safe(va, n_va, &valist, purge_list) | |
| 541 | 549 | __free_vmap_area(va); |
| 542 | 550 | spin_unlock(&vmap_area_lock); |
| 543 | 551 | } |
| @@ -10,7 +10,7 @@ use strict; · 9 unmodified lines | ||
| 10 | 10 | my $P = $0; |
| 11 | 11 | $P =~ s@.*/@@g; |
| 12 | 12 | |
| 13 | −my $V = '0.27'; | |
| 13 | +my $V = '0.28'; | |
| 14 | 14 | |
| 15 | 15 | use Getopt::Long qw(:config no_auto_abbrev); |
| 16 | 16 | |
| @@ -110,7 +110,8 @@ our $Sparse = qr{ · 93 unmodified lines | ||
| 110 | 110 | __iomem| |
| 111 | 111 | __must_check| |
| 112 | 112 | __init_refok| |
| 113 | − __kprobes | |
| 113 | + __kprobes| | |
| 114 | + __ref | |
| 114 | 115 | }x; |
| 115 | 116 | our $Attribute = qr{ |
| 116 | 117 | const| |
| @@ -1240,7 +1241,8 @@ sub process { · 1123 unmodified lines | ||
| 1240 | 1241 | $realfile =~ s@^([^/]*)/@@; |
| 1241 | 1242 | |
| 1242 | 1243 | $p1_prefix = $1; |
| 1243 | − if ($tree && $p1_prefix ne '' && -e "$root/$p1_prefix") { | |
| 1244 | + if (!$file && $tree && $p1_prefix ne '' && | |
| 1245 | + -e "$root/$p1_prefix") { | |
| 1244 | 1246 | WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n"); |
| 1245 | 1247 | } |
| 1246 | 1248 | |
| @@ -1583,9 +1585,9 @@ sub process { · 336 unmodified lines | ||
| 1583 | 1585 | } |
| 1584 | 1586 | # TEST: allow direct testing of the attribute matcher. |
| 1585 | 1587 | if ($dbg_attr) { |
| 1586 | − if ($line =~ /^.\s*$Attribute\s*$/) { | |
| 1588 | + if ($line =~ /^.\s*$Modifier\s*$/) { | |
| 1587 | 1589 | ERROR("TEST: is attr\n" . $herecurr); |
| 1588 | − } elsif ($dbg_attr > 1 && $line =~ /^.+($Attribute)/) { | |
| 1590 | + } elsif ($dbg_attr > 1 && $line =~ /^.+($Modifier)/) { | |
| 1589 | 1591 | ERROR("TEST: is not attr ($1 is)\n". $herecurr); |
| 1590 | 1592 | } |
| 1591 | 1593 | next; |
| @@ -1657,7 +1659,7 @@ sub process { · 65 unmodified lines | ||
| 1657 | 1659 | |
| 1658 | 1660 | # * goes on variable not on type |
| 1659 | 1661 | # (char*[ const]) |
| 1660 | − if ($line =~ m{\($NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)*)\)}) { | |
| 1662 | + if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) { | |
| 1661 | 1663 | my ($from, $to) = ($1, $1); |
| 1662 | 1664 | |
| 1663 | 1665 | # Should start with a space. |
| @@ -1672,7 +1674,7 @@ sub process { · 8 unmodified lines | ||
| 1672 | 1674 | if ($from ne $to) { |
| 1673 | 1675 | ERROR("\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr); |
| 1674 | 1676 | } |
| 1675 | − } elsif ($line =~ m{\b$NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)?)($Ident)}) { | |
| 1677 | + } elsif ($line =~ m{\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident)}) { | |
| 1676 | 1678 | my ($from, $to, $ident) = ($1, $1, $2); |
| 1677 | 1679 | |
| 1678 | 1680 | # Should start with a space. |
| @@ -1685,8 +1687,8 @@ sub process { · 6 unmodified lines | ||
| 1685 | 1687 | # Modifiers should have spaces. |
| 1686 | 1688 | $to =~ s/(\b$Modifier$)/$1 /; |
| 1687 | 1689 | |
| 1688 | − #print "from<$from> to<$to>\n"; | |
| 1689 | − if ($from ne $to) { | |
| 1690 | + #print "from<$from> to<$to> ident<$ident>\n"; | |
| 1691 | + if ($from ne $to && $ident !~ /^$Modifier$/) { | |
| 1690 | 1692 | ERROR("\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr); |
| 1691 | 1693 | } |
| 1692 | 1694 | } |
| @@ -1885,11 +1887,11 @@ sub process { · 192 unmodified lines | ||
| 1885 | 1887 | if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { |
| 1886 | 1888 | ERROR("space required before that '$op' $at\n" . $hereptr); |
| 1887 | 1889 | } |
| 1888 | − if ($op eq '*' && $cc =~/\s*const\b/) { | |
| 1890 | + if ($op eq '*' && $cc =~/\s*$Modifier\b/) { | |
| 1889 | 1891 | # A unary '*' may be const |
| 1890 | 1892 | |
| 1891 | 1893 | } elsif ($ctx =~ /.xW/) { |
| 1892 | − ERROR("space prohibited after that '$op' $at\n" . $hereptr); | |
| 1894 | + ERROR("Aspace prohibited after that '$op' $at\n" . $hereptr); | |
| 1893 | 1895 | } |
| 1894 | 1896 | |
| 1895 | 1897 | # unary ++ and unary -- are allowed no space on one side. |
| @@ -2560,7 +2562,7 @@ sub process { · 664 unmodified lines | ||
| 2560 | 2562 | if ($line =~ /\bin_atomic\s*\(/) { |
| 2561 | 2563 | if ($realfile =~ m@^drivers/@) { |
| 2562 | 2564 | ERROR("do not use in_atomic in drivers\n" . $herecurr); |
| 2563 | − } else { | |
| 2565 | + } elsif ($realfile !~ m@^kernel/@) { | |
| 2564 | 2566 | WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); |
| 2565 | 2567 | } |
| 2566 | 2568 | } |
| @@ -157,7 +157,7 @@ static void resample_shrink(struct snd_pcm_plugin *plugin, · 156 unmodified lines | ||
| 157 | 157 | while (dst_frames1 > 0) { |
| 158 | 158 | S1 = S2; |
| 159 | 159 | if (src_frames1-- > 0) { |
| 160 | − S1 = *src; | |
| 160 | + S2 = *src; | |
| 161 | 161 | src += src_step; |
| 162 | 162 | } |
| 163 | 163 | if (pos & ~R_MASK) { |
| @@ -165,7 +165,7 @@ module_param_array(enable, bool, NULL, 0444); · 164 unmodified lines | ||
| 165 | 165 | MODULE_PARM_DESC(enable, "Enable Audiowerk2 soundcard."); |
| 166 | 166 | |
| 167 | 167 | static struct pci_device_id snd_aw2_ids[] = { |
| 168 | − {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, PCI_ANY_ID, PCI_ANY_ID, | |
| 168 | + {PCI_VENDOR_ID_SAA7146, PCI_DEVICE_ID_SAA7146, 0, 0, | |
| 169 | 169 | 0, 0, 0}, |
| 170 | 170 | {0} |
| 171 | 171 | }; |
| @@ -1528,6 +1528,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { · 1527 unmodified lines | ||
| 1528 | 1528 | .ca0151_chip = 1, |
| 1529 | 1529 | .spk71 = 1, |
| 1530 | 1530 | .spdif_bug = 1, |
| 1531 | + .invert_shared_spdif = 1, /* digital/analog switch swapped */ | |
| 1531 | 1532 | .ac97_chip = 1} , |
| 1532 | 1533 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, |
| 1533 | 1534 | .driver = "Audigy2", .name = "SB Audigy 2 Platinum [SB0240P]", |
| @@ -277,18 +277,19 @@ static ssize_t init_verbs_store(struct device *dev, · 276 unmodified lines | ||
| 277 | 277 | { |
| 278 | 278 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); |
| 279 | 279 | struct hda_codec *codec = hwdep->private_data; |
| 280 | − char *p; | |
| 281 | − struct hda_verb verb, *v; | |
| 280 | + struct hda_verb *v; | |
| 281 | + int nid, verb, param; | |
| 282 | 282 | |
| 283 | − verb.nid = simple_strtoul(buf, &p, 0); | |
| 284 | − verb.verb = simple_strtoul(p, &p, 0); | |
| 285 | − verb.param = simple_strtoul(p, &p, 0); | |
| 286 | − if (!verb.nid || !verb.verb || !verb.param) | |
| 283 | + if (sscanf(buf, "%i %i %i", &nid, &verb, ¶m) != 3) | |
| 284 | + return -EINVAL; | |
| 285 | + if (!nid || !verb) | |
| 287 | 286 | return -EINVAL; |
| 288 | 287 | v = snd_array_new(&codec->init_verbs); |
| 289 | 288 | if (!v) |
| 290 | 289 | return -ENOMEM; |
| 291 | − *v = verb; | |
| 290 | + v->nid = nid; | |
| 291 | + v->verb = verb; | |
| 292 | + v->param = param; | |
| 292 | 293 | return count; |
| 293 | 294 | } |
| 294 | 295 | |
| @@ -7017,6 +7017,7 @@ static int patch_alc882(struct hda_codec *codec) · 7016 unmodified lines | ||
| 7017 | 7017 | case 0x106b3e00: /* iMac 24 Aluminium */ |
| 7018 | 7018 | board_config = ALC885_IMAC24; |
| 7019 | 7019 | break; |
| 7020 | + case 0x106b00a0: /* MacBookPro3,1 - Another revision */ | |
| 7020 | 7021 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
| 7021 | 7022 | case 0x106b00a4: /* MacbookPro4,1 */ |
| 7022 | 7023 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| @@ -8469,6 +8470,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { · 1446 unmodified lines | ||
| 8469 | 8470 | ALC888_ACER_ASPIRE_4930G), |
| 8470 | 8471 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 8471 | 8472 | ALC888_ACER_ASPIRE_4930G), |
| 8473 | + SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | |
| 8474 | + ALC888_ACER_ASPIRE_4930G), | |
| 8472 | 8475 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
| 8473 | 8476 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
| 8474 | 8477 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
| @@ -97,12 +97,12 @@ struct pcxhr_mgr { · 96 unmodified lines | ||
| 97 | 97 | int capture_chips; |
| 98 | 98 | int fw_file_set; |
| 99 | 99 | int firmware_num; |
| 100 | − int is_hr_stereo:1; | |
| 101 | − int board_has_aes1:1; /* if 1 board has AES1 plug and SRC */ | |
| 102 | − int board_has_analog:1; /* if 0 the board is digital only */ | |
| 103 | − int board_has_mic:1; /* if 1 the board has microphone input */ | |
| 104 | − int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */ | |
| 105 | − int mono_capture:1; /* if 1 the board does mono capture */ | |
| 100 | + unsigned int is_hr_stereo:1; | |
| 101 | + unsigned int board_has_aes1:1; /* if 1 board has AES1 plug and SRC */ | |
| 102 | + unsigned int board_has_analog:1; /* if 0 the board is digital only */ | |
| 103 | + unsigned int board_has_mic:1; /* if 1 the board has microphone input */ | |
| 104 | + unsigned int board_aes_in_192k:1;/* if 1 the aes input plugs do support 192kHz */ | |
| 105 | + unsigned int mono_capture:1; /* if 1 the board does mono capture */ | |
| 106 | 106 | |
| 107 | 107 | struct snd_dma_buffer hostport; |
| 108 | 108 | |